Previous 15994 Revisions Next

r870 Thursday 23rd August, 2007 at 23:39:19 UTC by Nathan Woods
Core updated to 0.118u3 (all 8086/8088/80186/80286 drivers not working until
drivers can be updated)
[docs]messnew.txt
[src/emu]cpuintrf.c cpuintrf.h driver.h inptport.c inptport.h memory.c memory.h tilemap.c timer.h validity.c
[src/emu/cpu]cpu.mak
[src/emu/cpu/cop400]cop420.c
[src/emu/cpu/e132xs]e132xs.c
[src/emu/cpu/h83002]h83002.c
[src/emu/cpu/i386]i386dasm.c
[src/emu/cpu/i86]ea.h i186intf.h i188intf.h i286.c i286intf.h i86.c i86.h i86intf.h i86mem.c* i86mem.h* i86time.c i88intf.h instr186.c instr286.c instr286.h instr86.c
[src/emu/cpu/m37710]m37710.c
[src/emu/cpu/mips]mdrcold.c mips3.c mips3.h mips3com.c* mips3com.h* mips3drc.c
[src/emu/cpu/nec]nec.c nec.h necdasm.c* necea.h necmodrm.h
[src/emu/cpu/sh4]sh4.c
[src/emu/sound]2203intf.c 2203intf.h bsmt2000.c iremga20.c iremga20.h x1_010.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]leland.c m72.c m72.h mcr.c t5182.c
[src/mame/drivers]actfancr.c aerofgt.c aladbl.c alg.c arcadia.c astrof.c asuka.c atarifb.c ataxx.c backfire.c bishi.c blockade.c btime.c bublbobl.c bwing.c canyon.c cbuster.c cham24.c circus.c cischeat.c cliffhgr.c cojag.c cps2.c cps3.c cubocd32.c cvs.c dacholer.c darkseal.c dassault.c ddragon.c deadang.c dec0.c dec8.c deco156.c decocass.c djboy.c dkong.c dynduke.c eolith.c eolith16.c equites.c exidy.c fantland.c fastfred.c filetto.c funkyjet.c gberet.c genesis.c goldstar.c gottlieb.c grchamp.c gstriker.c gunpey.c hng64.c hotblock.c igs_180.c ironhors.c itech32.c jackpool.c junofrst.c kncljoe.c konamigq.c konamigv.c konamigx.c konamim2.c ksys573.c lastfght.c leland.c lemmings.c liberate.c lockon.c m107.c m62.c m72.c m90.c m92.c m92.h madalien.c malzak.c marineb.c maxaflex.c mcr.c mcr3.c mcr68.c megadriv.c megadriv.h mnight.c model2.c moo.c mpatrol.c mquake.c mrdo.c mystston.c mystwarr.c namcos1.c namcos10.c namcos11.c namcos12.c namcos21.c nemesis.c neogeo.c ninjakd2.c ninjaw.c onetwo.c opwolf.c orbit.c othunder.c pangofun.c pgm.c playch10.c pmpoker.c progolf.c psikyosh.c raiden.c raiden2.c rainbow.c rastan.c rohga.c sauro.c scramble.c scregg.c segae.c segag80r.c segag80v.c segald.c segas32.c seibuspi.c sengokmj.c sfkick.c shanghai.c shisen.c simpl156.c skyraid.c smstrv.c snk.c sshangha.c sslam.c sspeedr.c stadhero.c statriv2.c stv.c supbtime.c superdq.c suprloco.c suprslam.c system24.c tagteam.c taito_f3.c taito_z.c taitowlf.c tank8.c tatsumi.c tempest.c tetriunk.c thayers.c tiamc1.c toaplan2.c topspeed.c travrusa.c troangel.c ttchamp.c tumbleb.c tumblep.c turbo.c tutankhm.c twins.c tx1.c ultrsprt.c upscope.c vaportra.c vegaeo.c vertigo.c vicdual.c vigilant.c volfied.c warriorb.c wgp.c williams.c wwfsstar.c yard.c zac2650.c zaccaria.c zaxxon.c zn.c
[src/mame/includes]amiga.h leland.h m107.h* m72.h* m92.h* tatsumi.h
[src/mame/machine]8237dma.c 8237dma.h 8255ppi.c 8255ppi.h amiga.c bonzeadv.c laserdsc.c leland.c mc146818.c mc146818.h opwolf.c pcshare.c pcshare.h pic8259.c pic8259.h pit8253.c pit8253.h rainbow.c scsicd.c tatsumi.c tx1.c volfied.c wd33c93.c* wd33c93.h*
[src/mame/video]bfm_adr2.c deadang.c dynduke.c m107.c m72.c m90.c m92.c raiden.c sengokmj.c tatsumi.c tx1.c
[src/mess]mess.h mess.mak mslegacy.h*
[src/mess/drivers]amstrad.c apexc.c apple1.c apple2.c apple2gs.c aquarius.c arcadia.c at.c atari.c bbc.c c128.c c16.c c65.c cbmb.c cgenie.c compis.c comquest.c coupe.c dai.c dgn_beta.c exidy.c galaxy.c gamecom.c gb.c intv.c jupiter.c kaypro.c lviv.c mac.c mbee.c mz700.c nascom1.c nes.c oric.c p2000t.c pc.c pdp1.c pet.c pmd85.c primo.c psx.c saturn.c spectrum.c super80.c svision.c ti85.c ti99_2.c tm990189.c trs80.c tx0.c vc20.c vc4000.c vtech2.c wswan.c x68k.c zx.c
[src/mess/machine]bebox.c
[src/mess/video]733_asr.c 911_vdt.c avigo.c channelf.c dai.c epnick.c exidy.c galaxy.c hp48.c i82720.c kc.c lviv.c odyssey2.c pc_vga.c pmd85.c pocketc.c primo.c saa5050.c ssystem3.c sym1.c vic6567.c
[src/osd/windows]mame.rc mamex64.rc vconv.c verinfo.c* windows.mak

src/mame/audio/mcr.c
r869r870
477477   AM_RANGE(0xc000, 0xcfff) AM_READWRITE(MRA8_NOP, ssio_status_w)
478478   AM_RANGE(0xd000, 0xdfff) AM_WRITENOP   /* low bit controls yellow LED */
479479   AM_RANGE(0xe000, 0xefff) AM_READ(ssio_irq_clear)
480   AM_RANGE(0xf000, 0xffff) AM_READ(port_tag_to_handler8("SSIO.DIP"))   /* 6 DIP switches */
480   AM_RANGE(0xf000, 0xffff) AM_READ_PORT("SSIO.DIP")   /* 6 DIP switches */
481481ADDRESS_MAP_END
482482
483483
src/mame/audio/t5182.c
r869r870
285285   AM_RANGE(0x12, 0x12) AM_WRITE(t5182_ym2151_irq_ack_w)
286286   AM_RANGE(0x13, 0x13) AM_WRITE(t5182_cpu_irq_ack_w)
287287   AM_RANGE(0x20, 0x20) AM_READ(t5182_sharedram_semaphore_main_r)
288   AM_RANGE(0x30, 0x30) AM_READ(port_tag_to_handler8(T5182COINPORT))
288   AM_RANGE(0x30, 0x30) AM_READ_PORT(T5182COINPORT)
289289ADDRESS_MAP_END
src/mame/audio/leland.c
r869r870
197197static sound_stream * nondma_stream;
198198static sound_stream * extern_stream;
199199
200static UINT8 *ram_base;
201200static UINT8 has_ym2151;
202201static UINT8 is_redline;
203202
r869r870
205204static UINT8 clock_active;
206205static UINT8 clock_tick;
207206
208static UINT8 sound_command[2];
207static UINT16 sound_command;
209208static UINT8 sound_response;
210209
211210static UINT32 ext_start;
r869r870
258257   UINT16   ext[4];
259258};
260259
261static struct i186_state
260static struct i80186_state
262261{
263262   struct timer_state   timer[3];
264263   struct dma_state   dma[2];
265264   struct intr_state   intr;
266265   struct mem_state   mem;
267} i186;
266} i80186;
268267
269268
270269#define DAC_BUFFER_SIZE         1024
r869r870
294293
295294static void set_dac_frequency(int which, int frequency);
296295
297static READ8_HANDLER( peripheral_r );
298static WRITE8_HANDLER( peripheral_w );
296static READ16_HANDLER( peripheral_r );
297static WRITE16_HANDLER( peripheral_w );
299298
300299
301300
r869r870
305304 *
306305 *************************************/
307306
308static void leland_i186_dac_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
307static void leland_80186_dac_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
309308{
310309   stream_sample_t *buffer = outputs[0];
311310   int i, j, start, stop;
r869r870
368367 *
369368 *************************************/
370369
371static void leland_i186_dma_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
370static void leland_80186_dma_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
372371{
373372   stream_sample_t *buffer = outputs[0];
374373   int i, j;
r869r870
380379   cpuintrf_push_context(2);
381380   for (i = 0; i < 2; i++)
382381   {
383      struct dma_state *d = &i186.dma[i];
382      struct dma_state *d = &i80186.dma[i];
384383
385384      /* check for enabled DMA */
386385      if (d->control & 0x0002)
r869r870
458457 *
459458 *************************************/
460459
461static void leland_i186_extern_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
460static void leland_80186_extern_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
462461{
463462   stream_sample_t *buffer = outputs[0];
464463   struct dac_state *d = &dac[7];
r869r870
502501static TIMER_CALLBACK( internal_timer_int );
503502static TIMER_CALLBACK( dma_timer_callback );
504503
505void *leland_i186_sh_start(int clock, const struct CustomSound_interface *config)
504void *leland_80186_sh_start(int clock, const struct CustomSound_interface *config)
506505{
507506   int i;
508507
r869r870
513512         has_ym2151 = 1;
514513
515514   /* allocate separate streams for the DMA and non-DMA DACs */
516   dma_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_i186_dma_update);
517   nondma_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_i186_dac_update);
515   dma_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_80186_dma_update);
516   nondma_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_80186_dac_update);
518517
519518   /* if we have a 2151, install an externally driven DAC stream */
520519   if (has_ym2151)
521520   {
522521      ext_base = memory_region(REGION_SOUND1);
523      extern_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_i186_extern_update);
522      extern_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update);
524523   }
525524
526525   /* by default, we're not redline racer */
527526   is_redline = 0;
528527
529528   /* create timers here so they stick around */
530   i186.timer[0].int_timer = mame_timer_alloc(internal_timer_int);
531   i186.timer[1].int_timer = mame_timer_alloc(internal_timer_int);
532   i186.timer[2].int_timer = mame_timer_alloc(internal_timer_int);
533   i186.timer[0].time_timer = mame_timer_alloc(NULL);
534   i186.timer[1].time_timer = mame_timer_alloc(NULL);
535   i186.timer[2].time_timer = mame_timer_alloc(NULL);
536   i186.dma[0].finish_timer = mame_timer_alloc(dma_timer_callback);
537   i186.dma[1].finish_timer = mame_timer_alloc(dma_timer_callback);
529   i80186.timer[0].int_timer = mame_timer_alloc(internal_timer_int);
530   i80186.timer[1].int_timer = mame_timer_alloc(internal_timer_int);
531   i80186.timer[2].int_timer = mame_timer_alloc(internal_timer_int);
532   i80186.timer[0].time_timer = mame_timer_alloc(NULL);
533   i80186.timer[1].time_timer = mame_timer_alloc(NULL);
534   i80186.timer[2].time_timer = mame_timer_alloc(NULL);
535   i80186.dma[0].finish_timer = mame_timer_alloc(dma_timer_callback);
536   i80186.dma[1].finish_timer = mame_timer_alloc(dma_timer_callback);
538537
539538   for (i = 0; i < 9; i++)
540539      counter[i].timer = mame_timer_alloc(NULL);
r869r870
543542}
544543
545544
546void *redline_i186_sh_start(int clock, const struct CustomSound_interface *config)
545void *redline_80186_sh_start(int clock, const struct CustomSound_interface *config)
547546{
548   void *result = leland_i186_sh_start(clock, config);
547   void *result = leland_80186_sh_start(clock, config);
549548   is_redline = 1;
550549   return result;
551550}
552551
553552
554static void leland_i186_reset(void)
553static void leland_80186_reset(void)
555554{
556   struct i186_state oldstate = i186;
555   struct i80186_state oldstate = i80186;
557556   mame_timer *counter_timer[9];
558557   int i;
559558
560   /* reset the i186 state, but save the timers */
561   memset(&i186, 0, sizeof(i186));
562   i186.timer[0].int_timer = oldstate.timer[0].int_timer;
563   i186.timer[1].int_timer = oldstate.timer[1].int_timer;
564   i186.timer[2].int_timer = oldstate.timer[2].int_timer;
565   i186.timer[0].time_timer = oldstate.timer[0].time_timer;
566   i186.timer[1].time_timer = oldstate.timer[1].time_timer;
567   i186.timer[2].time_timer = oldstate.timer[2].time_timer;
568   i186.dma[0].finish_timer = oldstate.dma[0].finish_timer;
569   i186.dma[1].finish_timer = oldstate.dma[1].finish_timer;
559   /* reset the i80186 state, but save the timers */
560   memset(&i80186, 0, sizeof(i80186));
561   i80186.timer[0].int_timer = oldstate.timer[0].int_timer;
562   i80186.timer[1].int_timer = oldstate.timer[1].int_timer;
563   i80186.timer[2].int_timer = oldstate.timer[2].int_timer;
564   i80186.timer[0].time_timer = oldstate.timer[0].time_timer;
565   i80186.timer[1].time_timer = oldstate.timer[1].time_timer;
566   i80186.timer[2].time_timer = oldstate.timer[2].time_timer;
567   i80186.dma[0].finish_timer = oldstate.dma[0].finish_timer;
568   i80186.dma[1].finish_timer = oldstate.dma[1].finish_timer;
570569
571570   /* reset the interrupt state */
572   i186.intr.priority_mask   = 0x0007;
573   i186.intr.timer       = 0x000f;
574   i186.intr.dma[0]      = 0x000f;
575   i186.intr.dma[1]      = 0x000f;
576   i186.intr.ext[0]      = 0x000f;
577   i186.intr.ext[1]      = 0x000f;
578   i186.intr.ext[2]      = 0x000f;
579   i186.intr.ext[3]      = 0x000f;
571   i80186.intr.priority_mask   = 0x0007;
572   i80186.intr.timer          = 0x000f;
573   i80186.intr.dma[0]         = 0x000f;
574   i80186.intr.dma[1]         = 0x000f;
575   i80186.intr.ext[0]         = 0x000f;
576   i80186.intr.ext[1]         = 0x000f;
577   i80186.intr.ext[2]         = 0x000f;
578   i80186.intr.ext[3]         = 0x000f;
580579
581580   /* reset the DAC and counter states as well */
582581   memset(&dac, 0, sizeof(dac));
r869r870
588587}
589588
590589
591void leland_i186_sound_init(void)
590void leland_80186_sound_init(void)
592591{
593   /* reset the I86 registers */
594   leland_i186_reset();
592   /* reset the 80186 registers */
593   leland_80186_reset();
595594
596595   /* reset our internal stuff */
597596   last_control = 0xf8;
r869r870
613612
614613static int int_callback(int line)
615614{
616   if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", mame_time_to_double(mame_timer_get_time()), i186.intr.poll_status & 0x1f);
615   if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", mame_time_to_double(mame_timer_get_time()), i80186.intr.poll_status & 0x1f);
617616
618617   /* clear the interrupt */
619618   activecpu_set_info_int(CPUINFO_INT_INPUT_STATE + 0, CLEAR_LINE);
620   i186.intr.pending = 0;
619   i80186.intr.pending = 0;
621620
622621   /* clear the request and set the in-service bit */
623622#if LATCH_INTS
624   i186.intr.request &= ~i186.intr.ack_mask;
623   i80186.intr.request &= ~i80186.intr.ack_mask;
625624#else
626   i186.intr.request &= ~(i186.intr.ack_mask & 0x0f);
625   i80186.intr.request &= ~(i80186.intr.ack_mask & 0x0f);
627626#endif
628   i186.intr.in_service |= i186.intr.ack_mask;
629   if (i186.intr.ack_mask == 0x0001)
627   i80186.intr.in_service |= i80186.intr.ack_mask;
628   if (i80186.intr.ack_mask == 0x0001)
630629   {
631      switch (i186.intr.poll_status & 0x1f)
630      switch (i80186.intr.poll_status & 0x1f)
632631      {
633         case 0x08:   i186.intr.status &= ~0x01;   break;
634         case 0x12:   i186.intr.status &= ~0x02;   break;
635         case 0x13:   i186.intr.status &= ~0x04;   break;
632         case 0x08:   i80186.intr.status &= ~0x01;   break;
633         case 0x12:   i80186.intr.status &= ~0x02;   break;
634         case 0x13:   i80186.intr.status &= ~0x04;   break;
636635      }
637636   }
638   i186.intr.ack_mask = 0;
637   i80186.intr.ack_mask = 0;
639638
640639   /* a request no longer pending */
641   i186.intr.poll_status &= ~0x8000;
640   i80186.intr.poll_status &= ~0x8000;
642641
643642   /* return the vector */
644   return i186.intr.poll_status & 0x1f;
643   return i80186.intr.poll_status & 0x1f;
645644}
646645
647646
r869r870
649648{
650649   int i, j, new_vector = 0;
651650
652   if (LOG_INTERRUPTS) logerror("update_interrupt_status: req=%02X stat=%02X serv=%02X\n", i186.intr.request, i186.intr.status, i186.intr.in_service);
651   if (LOG_INTERRUPTS) logerror("update_interrupt_status: req=%02X stat=%02X serv=%02X\n", i80186.intr.request, i80186.intr.status, i80186.intr.in_service);
653652
654653   /* loop over priorities */
655   for (i = 0; i <= i186.intr.priority_mask; i++)
654   for (i = 0; i <= i80186.intr.priority_mask; i++)
656655   {
657656      /* note: by checking 4 bits, we also verify that the mask is off */
658      if ((i186.intr.timer & 15) == i)
657      if ((i80186.intr.timer & 15) == i)
659658      {
660659         /* if we're already servicing something at this level, don't generate anything new */
661         if (i186.intr.in_service & 0x01)
660         if (i80186.intr.in_service & 0x01)
662661            return;
663662
664663         /* if there's something pending, generate an interrupt */
665         if (i186.intr.status & 0x07)
664         if (i80186.intr.status & 0x07)
666665         {
667            if (i186.intr.status & 1)
666            if (i80186.intr.status & 1)
668667               new_vector = 0x08;
669            else if (i186.intr.status & 2)
668            else if (i80186.intr.status & 2)
670669               new_vector = 0x12;
671            else if (i186.intr.status & 4)
670            else if (i80186.intr.status & 4)
672671               new_vector = 0x13;
673672            else
674673               popmessage("Invalid timer interrupt!");
675674
676675            /* set the clear mask and generate the int */
677            i186.intr.ack_mask = 0x0001;
676            i80186.intr.ack_mask = 0x0001;
678677            goto generate_int;
679678         }
680679      }
681680
682681      /* check DMA interrupts */
683682      for (j = 0; j < 2; j++)
684         if ((i186.intr.dma[j] & 15) == i)
683         if ((i80186.intr.dma[j] & 15) == i)
685684         {
686685            /* if we're already servicing something at this level, don't generate anything new */
687            if (i186.intr.in_service & (0x04 << j))
686            if (i80186.intr.in_service & (0x04 << j))
688687               return;
689688
690689            /* if there's something pending, generate an interrupt */
691            if (i186.intr.request & (0x04 << j))
690            if (i80186.intr.request & (0x04 << j))
692691            {
693692               new_vector = 0x0a + j;
694693
695694               /* set the clear mask and generate the int */
696               i186.intr.ack_mask = 0x0004 << j;
695               i80186.intr.ack_mask = 0x0004 << j;
697696               goto generate_int;
698697            }
699698         }
700699
701700      /* check external interrupts */
702701      for (j = 0; j < 4; j++)
703         if ((i186.intr.ext[j] & 15) == i)
702         if ((i80186.intr.ext[j] & 15) == i)
704703         {
705704            /* if we're already servicing something at this level, don't generate anything new */
706            if (i186.intr.in_service & (0x10 << j))
705            if (i80186.intr.in_service & (0x10 << j))
707706               return;
708707
709708            /* if there's something pending, generate an interrupt */
710            if (i186.intr.request & (0x10 << j))
709            if (i80186.intr.request & (0x10 << j))
711710            {
712711               /* otherwise, generate an interrupt for this request */
713712               new_vector = 0x0c + j;
714713
715714               /* set the clear mask and generate the int */
716               i186.intr.ack_mask = 0x0010 << j;
715               i80186.intr.ack_mask = 0x0010 << j;
717716               goto generate_int;
718717            }
719718         }
r869r870
722721
723722generate_int:
724723   /* generate the appropriate interrupt */
725   i186.intr.poll_status = 0x8000 | new_vector;
726   if (!i186.intr.pending)
724   i80186.intr.poll_status = 0x8000 | new_vector;
725   if (!i80186.intr.pending)
727726      cpunum_set_input_line(2, 0, ASSERT_LINE);
728   i186.intr.pending = 1;
727   i80186.intr.pending = 1;
729728   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", mame_time_to_double(mame_timer_get_time()), new_vector);
730729}
731730
r869r870
740739      /* turn off the appropriate in-service bit */
741740      switch (data & 0x1f)
742741      {
743         case 0x08:   i186.intr.in_service &= ~0x01;   break;
744         case 0x12:   i186.intr.in_service &= ~0x01;   break;
745         case 0x13:   i186.intr.in_service &= ~0x01;   break;
746         case 0x0a:   i186.intr.in_service &= ~0x04;   break;
747         case 0x0b:   i186.intr.in_service &= ~0x08;   break;
748         case 0x0c:   i186.intr.in_service &= ~0x10;   break;
749         case 0x0d:   i186.intr.in_service &= ~0x20;   break;
750         case 0x0e:   i186.intr.in_service &= ~0x40;   break;
751         case 0x0f:   i186.intr.in_service &= ~0x80;   break;
742         case 0x08:   i80186.intr.in_service &= ~0x01;   break;
743         case 0x12:   i80186.intr.in_service &= ~0x01;   break;
744         case 0x13:   i80186.intr.in_service &= ~0x01;   break;
745         case 0x0a:   i80186.intr.in_service &= ~0x04;   break;
746         case 0x0b:   i80186.intr.in_service &= ~0x08;   break;
747         case 0x0c:   i80186.intr.in_service &= ~0x10;   break;
748         case 0x0d:   i80186.intr.in_service &= ~0x20;   break;
749         case 0x0e:   i80186.intr.in_service &= ~0x40;   break;
750         case 0x0f:   i80186.intr.in_service &= ~0x80;   break;
752751         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", activecpu_get_pc(), data & 0x1f);
753752      }
754753      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", mame_time_to_double(mame_timer_get_time()), data & 0x1f);
r869r870
761760      for (i = 0; i <= 7; i++)
762761      {
763762         /* check for in-service timers */
764         if ((i186.intr.timer & 7) == i && (i186.intr.in_service & 0x01))
763         if ((i80186.intr.timer & 7) == i && (i80186.intr.in_service & 0x01))
765764         {
766            i186.intr.in_service &= ~0x01;
765            i80186.intr.in_service &= ~0x01;
767766            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", mame_time_to_double(mame_timer_get_time()));
768767            return;
769768         }
770769
771770         /* check for in-service DMA interrupts */
772771         for (j = 0; j < 2; j++)
773            if ((i186.intr.dma[j] & 7) == i && (i186.intr.in_service & (0x04 << j)))
772            if ((i80186.intr.dma[j] & 7) == i && (i80186.intr.in_service & (0x04 << j)))
774773            {
775               i186.intr.in_service &= ~(0x04 << j);
774               i80186.intr.in_service &= ~(0x04 << j);
776775               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", mame_time_to_double(mame_timer_get_time()), j);
777776               return;
778777            }
779778
780779         /* check external interrupts */
781780         for (j = 0; j < 4; j++)
782            if ((i186.intr.ext[j] & 7) == i && (i186.intr.in_service & (0x10 << j)))
781            if ((i80186.intr.ext[j] & 7) == i && (i80186.intr.in_service & (0x10 << j)))
783782            {
784               i186.intr.in_service &= ~(0x10 << j);
783               i80186.intr.in_service &= ~(0x10 << j);
785784               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", mame_time_to_double(mame_timer_get_time()), j);
786785               return;
787786            }
r869r870
800799static TIMER_CALLBACK( internal_timer_int )
801800{
802801   int which = param;
803   struct timer_state *t = &i186.timer[which];
802   struct timer_state *t = &i80186.timer[which];
804803
805804   if (LOG_TIMER) logerror("Hit interrupt callback for timer %d\n", which);
806805
r869r870
810809   /* request an interrupt */
811810   if (t->control & 0x2000)
812811   {
813      i186.intr.status |= 0x01 << which;
812      i80186.intr.status |= 0x01 << which;
814813      update_interrupt_state();
815814      if (LOG_TIMER) logerror("  Generating timer interrupt\n");
816815   }
r869r870
829828
830829static void internal_timer_sync(int which)
831830{
832   struct timer_state *t = &i186.timer[which];
831   struct timer_state *t = &i80186.timer[which];
833832
834833   /* if we have a timing timer running, adjust the count */
835834   if (t->time_timer_active)
r869r870
853852
854853static void internal_timer_update(int which, int new_count, int new_maxA, int new_maxB, int new_control)
855854{
856   struct timer_state *t = &i186.timer[which];
855   struct timer_state *t = &i80186.timer[which];
857856   int update_int_timer = 0;
858857
859858   /* if we have a new count and we're on, update things */
r869r870
994993static TIMER_CALLBACK( dma_timer_callback )
995994{
996995   int which = param;
997   struct dma_state *d = &i186.dma[which];
996   struct dma_state *d = &i80186.dma[which];
998997
999998   /* force an update and see if we're really done */
1000999   stream_update(dma_stream);
r869r870
10081007   if (d->control & 0x0100)
10091008   {
10101009      if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source);
1011      i186.intr.request |= 0x04 << which;
1010      i80186.intr.request |= 0x04 << which;
10121011      update_interrupt_state();
10131012   }
10141013}
r869r870
10161015
10171016static void update_dma_control(int which, int new_control)
10181017{
1019   struct dma_state *d = &i186.dma[which];
1018   struct dma_state *d = &i80186.dma[which];
10201019   int diff;
10211020
10221021   /* handle the CHG bit */
r869r870
10801079 *
10811080 *************************************/
10821081
1083static READ8_HANDLER( i186_internal_port_r )
1082static READ16_HANDLER( i80186_internal_port_r )
10841083{
1085   int shift = 8 * (offset & 1);
10861084   int temp, which;
10871085
1088   switch (offset & ~1)
1086   switch (offset)
10891087   {
1090      case 0x22:
1088      case 0x22/2:
10911089         logerror("%05X:ERROR - read from 80186 EOI\n", activecpu_get_pc());
10921090         break;
10931091
1094      case 0x24:
1092      case 0x24/2:
10951093         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", activecpu_get_pc());
1096         if (i186.intr.poll_status & 0x8000)
1094         if (i80186.intr.poll_status & 0x8000)
10971095            int_callback(0);
1098         return (i186.intr.poll_status >> shift) & 0xff;
1096         return i80186.intr.poll_status;
10991097
1100      case 0x26:
1098      case 0x26/2:
11011099         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", activecpu_get_pc());
1102         return (i186.intr.poll_status >> shift) & 0xff;
1100         return i80186.intr.poll_status;
11031101
1104      case 0x28:
1102      case 0x28/2:
11051103         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", activecpu_get_pc());
1106         temp  = (i186.intr.timer  >> 3) & 0x01;
1107         temp |= (i186.intr.dma[0] >> 1) & 0x04;
1108         temp |= (i186.intr.dma[1] >> 0) & 0x08;
1109         temp |= (i186.intr.ext[0] << 1) & 0x10;
1110         temp |= (i186.intr.ext[1] << 2) & 0x20;
1111         temp |= (i186.intr.ext[2] << 3) & 0x40;
1112         temp |= (i186.intr.ext[3] << 4) & 0x80;
1113         return (temp >> shift) & 0xff;
1104         temp  = (i80186.intr.timer  >> 3) & 0x01;
1105         temp |= (i80186.intr.dma[0] >> 1) & 0x04;
1106         temp |= (i80186.intr.dma[1] >> 0) & 0x08;
1107         temp |= (i80186.intr.ext[0] << 1) & 0x10;
1108         temp |= (i80186.intr.ext[1] << 2) & 0x20;
1109         temp |= (i80186.intr.ext[2] << 3) & 0x40;
1110         temp |= (i80186.intr.ext[3] << 4) & 0x80;
1111         return temp;
11141112
1115      case 0x2a:
1113      case 0x2a/2:
11161114         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", activecpu_get_pc());
1117         return (i186.intr.priority_mask >> shift) & 0xff;
1115         return i80186.intr.priority_mask;
11181116
1119      case 0x2c:
1117      case 0x2c/2:
11201118         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", activecpu_get_pc());
1121         return (i186.intr.in_service >> shift) & 0xff;
1119         return i80186.intr.in_service;
11221120
1123      case 0x2e:
1121      case 0x2e/2:
11241122         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", activecpu_get_pc());
1125         temp = i186.intr.request & ~0x0001;
1126         if (i186.intr.status & 0x0007)
1123         temp = i80186.intr.request & ~0x0001;
1124         if (i80186.intr.status & 0x0007)
11271125            temp |= 1;
1128         return (temp >> shift) & 0xff;
1126         return temp;
11291127
1130      case 0x30:
1128      case 0x30/2:
11311129         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", activecpu_get_pc());
1132         return (i186.intr.status >> shift) & 0xff;
1130         return i80186.intr.status;
11331131
1134      case 0x32:
1132      case 0x32/2:
11351133         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", activecpu_get_pc());
1136         return (i186.intr.timer >> shift) & 0xff;
1134         return i80186.intr.timer;
11371135
1138      case 0x34:
1136      case 0x34/2:
11391137         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", activecpu_get_pc());
1140         return (i186.intr.dma[0] >> shift) & 0xff;
1138         return i80186.intr.dma[0];
11411139
1142      case 0x36:
1140      case 0x36/2:
11431141         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", activecpu_get_pc());
1144         return (i186.intr.dma[1] >> shift) & 0xff;
1142         return i80186.intr.dma[1];
11451143
1146      case 0x38:
1144      case 0x38/2:
11471145         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", activecpu_get_pc());
1148         return (i186.intr.ext[0] >> shift) & 0xff;
1146         return i80186.intr.ext[0];
11491147
1150      case 0x3a:
1148      case 0x3a/2:
11511149         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", activecpu_get_pc());
1152         return (i186.intr.ext[1] >> shift) & 0xff;
1150         return i80186.intr.ext[1];
11531151
1154      case 0x3c:
1152      case 0x3c/2:
11551153         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", activecpu_get_pc());
1156         return (i186.intr.ext[2] >> shift) & 0xff;
1154         return i80186.intr.ext[2];
11571155
1158      case 0x3e:
1156      case 0x3e/2:
11591157         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", activecpu_get_pc());
1160         return (i186.intr.ext[3] >> shift) & 0xff;
1158         return i80186.intr.ext[3];
11611159
1162      case 0x50:
1163      case 0x58:
1164      case 0x60:
1165         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", activecpu_get_pc(), (offset - 0x50) / 8);
1166         which = (offset - 0x50) / 8;
1167         if (!(offset & 1))
1160      case 0x50/2:
1161      case 0x58/2:
1162      case 0x60/2:
1163         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", activecpu_get_pc(), (offset - 0x50/2) / 4);
1164         which = (offset - 0x50/2) / 4;
1165         if (ACCESSING_LSB)
11681166            internal_timer_sync(which);
1169         return (i186.timer[which].count >> shift) & 0xff;
1167         return i80186.timer[which].count;
11701168
1171      case 0x52:
1172      case 0x5a:
1173      case 0x62:
1174         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", activecpu_get_pc(), (offset - 0x50) / 8);
1175         which = (offset - 0x50) / 8;
1176         return (i186.timer[which].maxA >> shift) & 0xff;
1169      case 0x52/2:
1170      case 0x5a/2:
1171      case 0x62/2:
1172         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", activecpu_get_pc(), (offset - 0x50/2) / 4);
1173         which = (offset - 0x50/2) / 4;
1174         return i80186.timer[which].maxA;
11771175
1178      case 0x54:
1179      case 0x5c:
1180         logerror("%05X:read 80186 Timer %d max B\n", activecpu_get_pc(), (offset - 0x50) / 8);
1181         which = (offset - 0x50) / 8;
1182         return (i186.timer[which].maxB >> shift) & 0xff;
1176      case 0x54/2:
1177      case 0x5c/2:
1178         logerror("%05X:read 80186 Timer %d max B\n", activecpu_get_pc(), (offset/2 - 0x50) / 4);
1179         which = (offset - 0x50/2) / 4;
1180         return i80186.timer[which].maxB;
11831181
1184      case 0x56:
1185      case 0x5e:
1186      case 0x66:
1187         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", activecpu_get_pc(), (offset - 0x50) / 8);
1188         which = (offset - 0x50) / 8;
1189         return (i186.timer[which].control >> shift) & 0xff;
1182      case 0x56/2:
1183      case 0x5e/2:
1184      case 0x66/2:
1185         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", activecpu_get_pc(), (offset - 0x50/2) / 4);
1186         which = (offset - 0x50/2) / 4;
1187         return i80186.timer[which].control;
11901188
1191      case 0xa0:
1189      case 0xa0/2:
11921190         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", activecpu_get_pc());
1193         return (i186.mem.upper >> shift) & 0xff;
1191         return i80186.mem.upper;
11941192
1195      case 0xa2:
1193      case 0xa2/2:
11961194         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", activecpu_get_pc());
1197         return (i186.mem.lower >> shift) & 0xff;
1195         return i80186.mem.lower;
11981196
1199      case 0xa4:
1197      case 0xa4/2:
12001198         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", activecpu_get_pc());
1201         return (i186.mem.peripheral >> shift) & 0xff;
1199         return i80186.mem.peripheral;
12021200
1203      case 0xa6:
1201      case 0xa6/2:
12041202         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", activecpu_get_pc());
1205         return (i186.mem.middle >> shift) & 0xff;
1203         return i80186.mem.middle;
12061204
1207      case 0xa8:
1205      case 0xa8/2:
12081206         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", activecpu_get_pc());
1209         return (i186.mem.middle_size >> shift) & 0xff;
1207         return i80186.mem.middle_size;
12101208
1211      case 0xc0:
1212      case 0xd0:
1213         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", activecpu_get_pc(), (offset - 0xc0) / 0x10);
1214         which = (offset - 0xc0) / 0x10;
1209      case 0xc0/2:
1210      case 0xd0/2:
1211         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", activecpu_get_pc(), (offset - 0xc0/2) / 8);
1212         which = (offset - 0xc0/2) / 8;
12151213         stream_update(dma_stream);
1216         return (i186.dma[which].source >> shift) & 0xff;
1214         return i80186.dma[which].source;
12171215
1218      case 0xc2:
1219      case 0xd2:
1220         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", activecpu_get_pc(), (offset - 0xc0) / 0x10);
1221         which = (offset - 0xc0) / 0x10;
1216      case 0xc2/2:
1217      case 0xd2/2:
1218         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", activecpu_get_pc(), (offset - 0xc0/2) / 8);
1219         which = (offset - 0xc0/2) / 8;
12221220         stream_update(dma_stream);
1223         return (i186.dma[which].source >> (shift + 16)) & 0xff;
1221         return i80186.dma[which].source >> 16;
12241222
1225      case 0xc4:
1226      case 0xd4:
1227         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", activecpu_get_pc(), (offset - 0xc0) / 0x10);
1228         which = (offset - 0xc0) / 0x10;
1223      case 0xc4/2:
1224      case 0xd4/2:
1225         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", activecpu_get_pc(), (offset - 0xc0/2) / 8);
1226         which = (offset - 0xc0/2) / 8;
12291227         stream_update(dma_stream);
1230         return (i186.dma[which].dest >> shift) & 0xff;
1228         return i80186.dma[which].dest;
12311229
1232      case 0xc6:
1233      case 0xd6:
1234         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", activecpu_get_pc(), (offset - 0xc0) / 0x10);
1235         which = (offset - 0xc0) / 0x10;
1230      case 0xc6/2:
1231      case 0xd6/2:
1232         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", activecpu_get_pc(), (offset - 0xc0/2) / 8);
1233         which = (offset - 0xc0/2) / 8;
12361234         stream_update(dma_stream);
1237         return (i186.dma[which].dest >> (shift + 16)) & 0xff;
1235         return i80186.dma[which].dest >> 16;
12381236
1239      case 0xc8:
1240      case 0xd8:
1241         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", activecpu_get_pc(), (offset - 0xc0) / 0x10);
1242         which = (offset - 0xc0) / 0x10;
1237      case 0xc8/2:
1238      case 0xd8/2:
1239         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", activecpu_get_pc(), (offset - 0xc0/2) / 8);
1240         which = (offset - 0xc0/2) / 8;
12431241         stream_update(dma_stream);
1244         return (i186.dma[which].count >> shift) & 0xff;
1242         return i80186.dma[which].count;
12451243
1246      case 0xca:
1247      case 0xda:
1248         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", activecpu_get_pc(), (offset - 0xc0) / 0x10);
1249         which = (offset - 0xc0) / 0x10;
1244      case 0xca/2:
1245      case 0xda/2:
1246         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", activecpu_get_pc(), (offset - 0xc0/2) / 8);
1247         which = (offset - 0xc0/2) / 8;
12501248         stream_update(dma_stream);
1251         return (i186.dma[which].control >> shift) & 0xff;
1249         return i80186.dma[which].control;
12521250
12531251      default:
1254         logerror("%05X:read 80186 port %02X\n", activecpu_get_pc(), offset);
1252         logerror("%05X:read 80186 port %02X\n", activecpu_get_pc(), offset*2);
12551253         break;
12561254   }
12571255   return 0x00;
r869r870
12651263 *
12661264 *************************************/
12671265
1268static WRITE8_HANDLER( i186_internal_port_w )
1266static WRITE16_HANDLER( i80186_internal_port_w )
12691267{
1270   static UINT8 even_byte;
1271   int temp, which, data16;
1268   int temp, which;
12721269
1273   /* warning: this assumes all port writes here are word-sized */
1274   if (!(offset & 1))
1275   {
1276      even_byte = data;
1277      return;
1278   }
1279   data16 = (data << 8) | even_byte;
1270   /* handle partials */
1271   if (!ACCESSING_MSB)
1272      data = (i80186_internal_port_r(offset, 0) & 0xff00) | (data & 0x00ff);
1273   else if (!ACCESSING_LSB)
1274      data = (i80186_internal_port_r(offset, 0) & 0x00ff) | (data & 0xff00);
12801275
1281   switch (offset & ~1)
1276   switch (offset)
12821277   {
1283      case 0x22:
1284         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", activecpu_get_pc(), data16);
1278      case 0x22/2:
1279         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
12851280         handle_eoi(0x8000);
12861281         update_interrupt_state();
12871282         break;
12881283
1289      case 0x24:
1290         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", activecpu_get_pc(), data16);
1284      case 0x24/2:
1285         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
12911286         break;
12921287
1293      case 0x26:
1294         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", activecpu_get_pc(), data16);
1288      case 0x26/2:
1289         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
12951290         break;
12961291
1297      case 0x28:
1298         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", activecpu_get_pc(), data16);
1299         i186.intr.timer  = (i186.intr.timer  & ~0x08) | ((data16 << 3) & 0x08);
1300         i186.intr.dma[0] = (i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08);
1301         i186.intr.dma[1] = (i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08);
1302         i186.intr.ext[0] = (i186.intr.ext[0] & ~0x08) | ((data16 >> 1) & 0x08);
1303         i186.intr.ext[1] = (i186.intr.ext[1] & ~0x08) | ((data16 >> 2) & 0x08);
1304         i186.intr.ext[2] = (i186.intr.ext[2] & ~0x08) | ((data16 >> 3) & 0x08);
1305         i186.intr.ext[3] = (i186.intr.ext[3] & ~0x08) | ((data16 >> 4) & 0x08);
1292      case 0x28/2:
1293         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1294         i80186.intr.timer  = (i80186.intr.timer  & ~0x08) | ((data << 3) & 0x08);
1295         i80186.intr.dma[0] = (i80186.intr.dma[0] & ~0x08) | ((data << 1) & 0x08);
1296         i80186.intr.dma[1] = (i80186.intr.dma[1] & ~0x08) | ((data << 0) & 0x08);
1297         i80186.intr.ext[0] = (i80186.intr.ext[0] & ~0x08) | ((data >> 1) & 0x08);
1298         i80186.intr.ext[1] = (i80186.intr.ext[1] & ~0x08) | ((data >> 2) & 0x08);
1299         i80186.intr.ext[2] = (i80186.intr.ext[2] & ~0x08) | ((data >> 3) & 0x08);
1300         i80186.intr.ext[3] = (i80186.intr.ext[3] & ~0x08) | ((data >> 4) & 0x08);
13061301         update_interrupt_state();
13071302         break;
13081303
1309      case 0x2a:
1310         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", activecpu_get_pc(), data16);
1311         i186.intr.priority_mask = data16 & 0x0007;
1304      case 0x2a/2:
1305         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1306         i80186.intr.priority_mask = data & 0x0007;
13121307         update_interrupt_state();
13131308         break;
13141309
1315      case 0x2c:
1316         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", activecpu_get_pc(), data16);
1317         i186.intr.in_service = data16 & 0x00ff;
1310      case 0x2c/2:
1311         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1312         i80186.intr.in_service = data & 0x00ff;
13181313         update_interrupt_state();
13191314         break;
13201315
1321      case 0x2e:
1322         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", activecpu_get_pc(), data16);
1323         i186.intr.request = (i186.intr.request & ~0x00c0) | (data16 & 0x00c0);
1316      case 0x2e/2:
1317         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1318         i80186.intr.request = (i80186.intr.request & ~0x00c0) | (data & 0x00c0);
13241319         update_interrupt_state();
13251320         break;
13261321
1327      case 0x30:
1328         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", activecpu_get_pc(), data16);
1329         i186.intr.status = (i186.intr.status & ~0x8007) | (data16 & 0x8007);
1322      case 0x30/2:
1323         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1324         i80186.intr.status = (i80186.intr.status & ~0x8000) | (data & 0x8000);
1325         i80186.intr.status = (i80186.intr.status & ~0x0007) | (data & 0x0007);
13301326         update_interrupt_state();
13311327         break;
13321328
1333      case 0x32:
1334         if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", activecpu_get_pc(), data16);
1335         i186.intr.timer = data16 & 0x000f;
1329      case 0x32/2:
1330         if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1331         i80186.intr.timer = data & 0x000f;
13361332         break;
13371333
1338      case 0x34:
1339         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", activecpu_get_pc(), data16);
1340         i186.intr.dma[0] = data16 & 0x000f;
1334      case 0x34/2:
1335         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1336         i80186.intr.dma[0] = data & 0x000f;
13411337         break;
13421338
1343      case 0x36:
1344         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", activecpu_get_pc(), data16);
1345         i186.intr.dma[1] = data16 & 0x000f;
1339      case 0x36/2:
1340         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1341         i80186.intr.dma[1] = data & 0x000f;
13461342         break;
13471343
1348      case 0x38:
1349         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", activecpu_get_pc(), data16);
1350         i186.intr.ext[0] = data16 & 0x007f;
1344      case 0x38/2:
1345         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1346         i80186.intr.ext[0] = data & 0x007f;
13511347         break;
13521348
1353      case 0x3a:
1354         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", activecpu_get_pc(), data16);
1355         i186.intr.ext[1] = data16 & 0x007f;
1349      case 0x3a/2:
1350         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1351         i80186.intr.ext[1] = data & 0x007f;
13561352         break;
13571353
1358      case 0x3c:
1359         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", activecpu_get_pc(), data16);
1360         i186.intr.ext[2] = data16 & 0x001f;
1354      case 0x3c/2:
1355         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1356         i80186.intr.ext[2] = data & 0x001f;
13611357         break;
13621358
1363      case 0x3e:
1364         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", activecpu_get_pc(), data16);
1365         i186.intr.ext[3] = data16 & 0x001f;
1359      case 0x3e/2:
1360         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1361         i80186.intr.ext[3] = data & 0x001f;
13661362         break;
13671363
1368      case 0x50:
1369      case 0x58:
1370      case 0x60:
1371         if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16);
1372         which = (offset - 0x50) / 8;
1373         internal_timer_update(which, data16, -1, -1, -1);
1364      case 0x50/2:
1365      case 0x58/2:
1366      case 0x60/2:
1367         if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X & %04X\n", activecpu_get_pc(), (offset - 0x50/2) / 4, data, mem_mask ^ 0xffff);
1368         which = (offset - 0x50/2) / 4;
1369         internal_timer_update(which, data, -1, -1, -1);
13741370         break;
13751371
1376      case 0x52:
1377      case 0x5a:
1378      case 0x62:
1379         if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16);
1380         which = (offset - 0x50) / 8;
1381         internal_timer_update(which, -1, data16, -1, -1);
1372      case 0x52/2:
1373      case 0x5a/2:
1374      case 0x62/2:
1375         if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X & %04X\n", activecpu_get_pc(), (offset - 0x50/2) / 4, data, mem_mask ^ 0xffff);
1376         which = (offset - 0x50/2) / 4;
1377         internal_timer_update(which, -1, data, -1, -1);
13821378         break;
13831379
1384      case 0x54:
1385      case 0x5c:
1386         if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16);
1387         which = (offset - 0x50) / 8;
1388         internal_timer_update(which, -1, -1, data16, -1);
1380      case 0x54/2:
1381      case 0x5c/2:
1382         if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X & %04X\n", activecpu_get_pc(), (offset - 0x50/2) / 4, data, mem_mask ^ 0xffff);
1383         which = (offset - 0x50/2) / 4;
1384         internal_timer_update(which, -1, -1, data, -1);
13891385         break;
13901386
1391      case 0x56:
1392      case 0x5e:
1393      case 0x66:
1394         if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16);
1395         which = (offset - 0x50) / 8;
1396         internal_timer_update(which, -1, -1, -1, data16);
1387      case 0x56/2:
1388      case 0x5e/2:
1389      case 0x66/2:
1390         if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X & %04X\n", activecpu_get_pc(), (offset - 0x50/2) / 4, data, mem_mask  ^ 0xffff);
1391         which = (offset - 0x50/2) / 4;
1392         internal_timer_update(which, -1, -1, -1, data);
13971393         break;
13981394
1399      case 0xa0:
1400         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", activecpu_get_pc(), data16);
1401         i186.mem.upper = data16 | 0xc038;
1395      case 0xa0/2:
1396         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1397         i80186.mem.upper = data | 0xc038;
14021398         break;
14031399
1404      case 0xa2:
1405         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", activecpu_get_pc(), data16);
1406         i186.mem.lower = (data16 & 0x3fff) | 0x0038;
1400      case 0xa2/2:
1401         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1402         i80186.mem.lower = (data & 0x3fff) | 0x0038;
14071403         break;
14081404
1409      case 0xa4:
1410         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", activecpu_get_pc(), data16);
1411         i186.mem.peripheral = data16 | 0x0038;
1405      case 0xa4/2:
1406         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1407         i80186.mem.peripheral = data | 0x0038;
14121408         break;
14131409
1414      case 0xa6:
1415         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", activecpu_get_pc(), data16);
1416         i186.mem.middle = data16 | 0x01f8;
1410      case 0xa6/2:
1411         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1412         i80186.mem.middle = data | 0x01f8;
14171413         break;
14181414
1419      case 0xa8:
1420         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", activecpu_get_pc(), data16);
1421         i186.mem.middle_size = data16 | 0x8038;
1415      case 0xa8/2:
1416         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
1417         i80186.mem.middle_size = data | 0x8038;
14221418
1423         temp = (i186.mem.peripheral & 0xffc0) << 4;
1424         if (i186.mem.middle_size & 0x0040)
1419         temp = (i80186.mem.peripheral & 0xffc0) << 4;
1420         if (i80186.mem.middle_size & 0x0040)
14251421         {
1426            memory_install_read8_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0x2ff, 0, 0, peripheral_r);
1427            memory_install_write8_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0x2ff, 0, 0, peripheral_w);
1422            memory_install_read16_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0x2ff, 0, 0, peripheral_r);
1423            memory_install_write16_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0x2ff, 0, 0, peripheral_w);
14281424         }
14291425         else
14301426         {
14311427            temp &= 0xffff;
1432            memory_install_read8_handler(2, ADDRESS_SPACE_IO, temp, temp + 0x2ff, 0, 0, peripheral_r);
1433            memory_install_write8_handler(2, ADDRESS_SPACE_IO, temp, temp + 0x2ff, 0, 0, peripheral_w);
1428            memory_install_read16_handler(2, ADDRESS_SPACE_IO, temp, temp + 0x2ff, 0, 0, peripheral_r);
1429            memory_install_write16_handler(2, ADDRESS_SPACE_IO, temp, temp + 0x2ff, 0, 0, peripheral_w);
14341430         }
14351431
1436         /* we need to do this at a time when the I86 context is swapped in */
1432         /* we need to do this at a time when the 80186 context is swapped in */
14371433         /* this register is generally set once at startup and never again, so it's a good */
14381434         /* time to set it up */
14391435         cpunum_set_irq_callback(cpu_getactivecpu(), int_callback);
14401436         break;
14411437
1442      case 0xc0:
1443      case 0xd0:
1444         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16);
1445         which = (offset - 0xc0) / 0x10;
1438      case 0xc0/2:
1439      case 0xd0/2:
1440         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X & %04X\n", activecpu_get_pc(), (offset - 0xc0/2) / 8, data, mem_mask ^ 0xffff);
1441         which = (offset - 0xc0/2) / 8;
14461442         stream_update(dma_stream);
1447         i186.dma[which].source = (i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff);
1443         i80186.dma[which].source = (i80186.dma[which].source & ~0x0ffff) | (data & 0x0ffff);
14481444         break;
14491445
1450      case 0xc2:
1451      case 0xd2:
1452         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16);
1453         which = (offset - 0xc0) / 0x10;
1446      case 0xc2/2:
1447      case 0xd2/2:
1448         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X & %04X\n", activecpu_get_pc(), (offset - 0xc0/2) / 8, data, mem_mask ^ 0xffff);
1449         which = (offset - 0xc0/2) / 8;
14541450         stream_update(dma_stream);
1455         i186.dma[which].source = (i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000);
1451         i80186.dma[which].source = (i80186.dma[which].source & ~0xf0000) | ((data << 16) & 0xf0000);
14561452         break;
14571453
1458      case 0xc4:
1459      case 0xd4:
1460         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16);
1461         which = (offset - 0xc0) / 0x10;
1454      case 0xc4/2:
1455      case 0xd4/2:
1456         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X & %04X\n", activecpu_get_pc(), (offset - 0xc0/2) / 8, data, mem_mask ^ 0xffff);
1457         which = (offset - 0xc0/2) / 8;
14621458         stream_update(dma_stream);
1463         i186.dma[which].dest = (i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff);
1459         i80186.dma[which].dest = (i80186.dma[which].dest & ~0x0ffff) | (data & 0x0ffff);
14641460         break;
14651461
1466      case 0xc6:
1467      case 0xd6:
1468         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16);
1469         which = (offset - 0xc0) / 0x10;
1462      case 0xc6/2:
1463      case 0xd6/2:
1464         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X & %04X\n", activecpu_get_pc(), (offset - 0xc0/2) / 8, data, mem_mask ^ 0xffff);
1465         which = (offset - 0xc0/2) / 8;
14701466         stream_update(dma_stream);
1471         i186.dma[which].dest = (i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000);
1467         i80186.dma[which].dest = (i80186.dma[which].dest & ~0xf0000) | ((data << 16) & 0xf0000);
14721468         break;
14731469
1474      case 0xc8:
1475      case 0xd8:
1476         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16);
1477         which = (offset - 0xc0) / 0x10;
1470      case 0xc8/2:
1471      case 0xd8/2:
1472         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X & %04X\n", activecpu_get_pc(), (offset - 0xc0/2) / 8, data, mem_mask ^ 0xffff);
1473         which = (offset - 0xc0/2) / 8;
14781474         stream_update(dma_stream);
1479         i186.dma[which].count = data16;
1475         i80186.dma[which].count = data;
14801476         break;
14811477
1482      case 0xca:
1483      case 0xda:
1484         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16);
1485         which = (offset - 0xc0) / 0x10;
1478      case 0xca/2:
1479      case 0xda/2:
1480         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X & %04X\n", activecpu_get_pc(), (offset - 0xc0/2) / 8, data, mem_mask ^ 0xffff);
1481         which = (offset - 0xc0/2) / 8;
14861482         stream_update(dma_stream);
1487         update_dma_control(which, data16);
1483         update_dma_control(which, data);
14881484         break;
14891485
1490      case 0xfe:
1491         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", activecpu_get_pc(), data16);
1486      case 0xfe/2:
1487         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X & %04X\n", activecpu_get_pc(), data, mem_mask ^ 0xffff);
14921488
14931489         /* we assume here there that this doesn't happen too often */
14941490         /* plus, we can't really remove the old memory range, so we also assume that it's */
14951491         /* okay to leave us mapped where we were */
1496         temp = (data16 & 0x0fff) << 8;
1497         if (data16 & 0x1000)
1492         temp = (data & 0x0fff) << 8;
1493         if (data & 0x1000)
14981494         {
1499            memory_install_read8_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0xff, 0, 0, i186_internal_port_r);
1500            memory_install_write8_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0xff, 0, 0, i186_internal_port_w);
1495            memory_install_read16_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0xff, 0, 0, i80186_internal_port_r);
1496            memory_install_write16_handler(2, ADDRESS_SPACE_PROGRAM, temp, temp + 0xff, 0, 0, i80186_internal_port_w);
15011497         }
15021498         else
15031499         {
15041500            temp &= 0xffff;
1505            memory_install_read8_handler(2, ADDRESS_SPACE_IO, temp, temp + 0xff, 0, 0, i186_internal_port_r);
1506            memory_install_write8_handler(2, ADDRESS_SPACE_IO, temp, temp + 0xff, 0, 0, i186_internal_port_w);
1501            memory_install_read16_handler(2, ADDRESS_SPACE_IO, temp, temp + 0xff, 0, 0, i80186_internal_port_r);
1502            memory_install_write16_handler(2, ADDRESS_SPACE_IO, temp, temp + 0xff, 0, 0, i80186_internal_port_w);
15071503         }
15081504/*          popmessage("Sound CPU reset");*/
15091505         break;
15101506
15111507      default:
1512         logerror("%05X:80186 port %02X = %04X\n", activecpu_get_pc(), offset, data16);
1508         logerror("%05X:80186 port %02X = %04X & %04X\n", activecpu_get_pc(), offset*2, data, mem_mask ^ 0xffff);
15131509         break;
15141510   }
15151511}
r869r870
15341530}
15351531
15361532
1537static READ8_HANDLER( pit8254_r )
1533static READ16_HANDLER( pit8254_r )
15381534{
15391535   struct counter_state *ctr;
1540   int which = offset / 0x80;
1541   int reg = (offset / 2) & 3;
1536   int which = offset / 0x40;
1537   int reg = offset & 3;
15421538
1543   /* ignore odd offsets */
1544   if (offset & 1)
1545      return 0;
1546
15471539   /* switch off the register */
1548   switch (offset & 3)
1540   switch (reg)
15491541   {
15501542      case 0:
15511543      case 1:
r869r870
15761568}
15771569
15781570
1579static WRITE8_HANDLER( pit8254_w )
1571static WRITE16_HANDLER( pit8254_w )
15801572{
15811573   struct counter_state *ctr;
1582   int which = offset / 0x80;
1583   int reg = (offset / 2) & 3;
1574   int which = offset / 0x40;
1575   int reg = offset & 3;
15841576
15851577   /* ignore odd offsets */
1586   if (offset & 1)
1578   if (!ACCESSING_LSB)
15871579      return;
1580   data &= 0xff;
15881581
15891582   /* switch off the register */
15901583   switch (reg)
r869r870
16541647 *
16551648 *************************************/
16561649
1657WRITE8_HANDLER( leland_i86_control_w )
1650WRITE8_HANDLER( leland_80186_control_w )
16581651{
16591652   /* see if anything changed */
16601653   int diff = (last_control ^ data) & 0xf8;
r869r870
16641657
16651658   if (LOG_COMM)
16661659   {
1667      logerror("%04X:I86 control = %02X", activecpu_get_previouspc(), data);
1660      logerror("%04X:80186 control = %02X", activecpu_get_previouspc(), data);
16681661      if (!(data & 0x80)) logerror("  /RESET");
16691662      if (!(data & 0x40)) logerror("  ZNMI");
16701663      if (!(data & 0x20)) logerror("  INT0");
r869r870
16861679   /* INT0 */
16871680   if (data & 0x20)
16881681   {
1689      if (!LATCH_INTS) i186.intr.request &= ~0x10;
1682      if (!LATCH_INTS) i80186.intr.request &= ~0x10;
16901683   }
1691   else if (i186.intr.ext[0] & 0x10)
1692      i186.intr.request |= 0x10;
1684   else if (i80186.intr.ext[0] & 0x10)
1685      i80186.intr.request |= 0x10;
16931686   else if (diff & 0x20)
1694      i186.intr.request |= 0x10;
1687      i80186.intr.request |= 0x10;
16951688
16961689   /* INT1 */
16971690   if (data & 0x08)
16981691   {
1699      if (!LATCH_INTS) i186.intr.request &= ~0x20;
1692      if (!LATCH_INTS) i80186.intr.request &= ~0x20;
17001693   }
1701   else if (i186.intr.ext[1] & 0x10)
1702      i186.intr.request |= 0x20;
1694   else if (i80186.intr.ext[1] & 0x10)
1695      i80186.intr.request |= 0x20;
17031696   else if (diff & 0x08)
1704      i186.intr.request |= 0x20;
1697      i80186.intr.request |= 0x20;
17051698
17061699   /* handle reset here */
17071700   if ((diff & 0x80) && (data & 0x80))
1708      leland_i186_reset();
1701      leland_80186_reset();
17091702
17101703   update_interrupt_state();
17111704}
r869r870
17211714static TIMER_CALLBACK( command_lo_sync )
17221715{
17231716   if (LOG_COMM) logerror("%04X:Write sound command latch lo = %02X\n", activecpu_get_previouspc(), param);
1724   sound_command[0] = param;
1717   sound_command = (sound_command & 0xff00) | param;
17251718}
17261719
17271720
1728WRITE8_HANDLER( leland_i86_command_lo_w )
1721WRITE8_HANDLER( leland_80186_command_lo_w )
17291722{
17301723   timer_call_after_resynch(data, command_lo_sync);
17311724}
17321725
17331726
1734WRITE8_HANDLER( leland_i86_command_hi_w )
1727WRITE8_HANDLER( leland_80186_command_hi_w )
17351728{
17361729   if (LOG_COMM) logerror("%04X:Write sound command latch hi = %02X\n", activecpu_get_previouspc(), data);
1737   sound_command[1] = data;
1730   sound_command = (sound_command & 0x00ff) | (data << 8);
17381731}
17391732
17401733
1741static READ8_HANDLER( main_to_sound_comm_r )
1734static READ16_HANDLER( main_to_sound_comm_r )
17421735{
1743   if (!(offset & 1))
1744   {
1745      if (LOG_COMM) logerror("%05X:Read sound command latch lo = %02X\n", activecpu_get_pc(), sound_command[0]);
1746      return sound_command[0];
1747   }
1748   else
1749   {
1750      if (LOG_COMM) logerror("%05X:Read sound command latch hi = %02X\n", activecpu_get_pc(), sound_command[1]);
1751      return sound_command[1];
1752   }
1736   if (LOG_COMM) logerror("%05X:Read sound command latch = %02X\n", activecpu_get_pc(), sound_command);
1737   return sound_command;
17531738}
17541739
17551740
r869r870
17611746 *
17621747 *************************************/
17631748
1764static TIMER_CALLBACK( delayed_response_r)
1749static TIMER_CALLBACK( delayed_response_r )
17651750{
17661751   int checkpc = param;
17671752   int pc = cpunum_get_reg(0, Z80_PC);
r869r870
17851770}
17861771
17871772
1788READ8_HANDLER( leland_i86_response_r )
1773READ8_HANDLER( leland_80186_response_r )
17891774{
17901775   if (LOG_COMM) logerror("%04X:Read sound response latch = %02X\n", activecpu_get_previouspc(), sound_response);
17911776
r869r870
17951780}
17961781
17971782
1798static WRITE8_HANDLER( sound_to_main_comm_w )
1783static WRITE16_HANDLER( sound_to_main_comm_w )
17991784{
18001785   if (LOG_COMM) logerror("%05X:Write sound response latch = %02X\n", activecpu_get_pc(), data);
18011786   sound_response = data;
r869r870
18331818}
18341819
18351820
1836static WRITE8_HANDLER( dac_w )
1821static WRITE16_HANDLER( dac_w )
18371822{
1838   int which = offset / 2;
1823   int which = offset;
18391824   struct dac_state *d = &dac[which];
18401825
18411826   /* handle value changes */
1842   if (!(offset & 1))
1827   if (ACCESSING_LSB)
18431828   {
18441829      int count = (d->bufin - d->bufout) & DAC_BUFFER_SIZE_MASK;
18451830
18461831      /* set the new value */
1847      d->value = (INT16)data - 0x80;
1848      if (LOG_DAC) logerror("%05X:DAC %d value = %02X\n", activecpu_get_pc(), offset / 2, data);
1832      d->value = (INT16)(UINT8)data - 0x80;
1833      if (LOG_DAC) logerror("%05X:DAC %d value = %02X\n", activecpu_get_pc(), offset, (UINT8)data);
18491834
18501835      /* if we haven't overflowed the buffer, add the value value to it */
18511836      if (count < DAC_BUFFER_SIZE - 1)
r869r870
18651850   }
18661851
18671852   /* handle volume changes */
1868   else
1853   if (ACCESSING_MSB)
18691854   {
1870      d->volume = (data ^ 0x00) / DAC_VOLUME_SCALE;
1871      if (LOG_DAC) logerror("%05X:DAC %d volume = %02X\n", activecpu_get_pc(), offset / 2, data);
1855      d->volume = ((data >> 8) ^ 0x00) / DAC_VOLUME_SCALE;
1856      if (LOG_DAC) logerror("%05X:DAC %d volume = %02X\n", activecpu_get_pc(), offset, data);
18721857   }
18731858}
18741859
18751860
1876static WRITE8_HANDLER( redline_dac_w )
1861static WRITE16_HANDLER( redline_dac_w )
18771862{
1878   int which = offset / 0x200;
1863   int which = offset / 0x100;
18791864   struct dac_state *d = &dac[which];
18801865   int count = (d->bufin - d->bufout) & DAC_BUFFER_SIZE_MASK;
18811866
18821867   /* set the new value */
1883   d->value = (INT16)data - 0x80;
1868   d->value = (INT16)(UINT8)data - 0x80;
18841869
18851870   /* if we haven't overflowed the buffer, add the value value to it */
18861871   if (count < DAC_BUFFER_SIZE - 1)
r869r870
18991884   }
19001885
19011886   /* update the volume */
1902   d->volume = (offset & 0x1fe) / 2 / DAC_VOLUME_SCALE;
1887   d->volume = (offset & 0xff) / DAC_VOLUME_SCALE;
19031888   if (LOG_DAC) logerror("%05X:DAC %d value = %02X, volume = %02X\n", activecpu_get_pc(), which, data, (offset & 0x1fe) / 2);
19041889}
19051890
19061891
1907static WRITE8_HANDLER( dac_10bit_w )
1892static WRITE16_HANDLER( dac_10bit_w )
19081893{
1909   static UINT8 even_byte;
19101894   struct dac_state *d = &dac[6];
19111895   int count = (d->bufin - d->bufout) & DAC_BUFFER_SIZE_MASK;
19121896   int data16;
19131897
19141898   /* warning: this assumes all port writes here are word-sized */
1915   /* if the offset is even, just stash the value */
1916   if (!(offset & 1))
1917   {
1918      even_byte = data;
1919      return;
1920   }
1921   data16 = (data << 8) | even_byte;
1899   assert(ACCESSING_LSB && ACCESSING_MSB);
1900   data16 = data;
19221901
19231902   /* set the new value */
19241903   d->value = (INT16)data16 - 0x200;
r869r870
19421921}
19431922
19441923
1945static WRITE8_HANDLER( ataxx_dac_control )
1924static WRITE16_HANDLER( ataxx_dac_control )
19461925{
19471926   /* handle common offsets */
19481927   switch (offset)
19491928   {
19501929      case 0x00:
1930      case 0x01:
19511931      case 0x02:
1952      case 0x04:
1953         dac_w(offset, data);
1932         if (ACCESSING_LSB)
1933            dac_w(offset, data, 0xff00);
19541934         return;
19551935
1956      case 0x06:
1957         dac_w(1, ((data << 5) & 0xe0) | ((data << 2) & 0x1c) | (data & 0x03));
1958         dac_w(3, ((data << 2) & 0xe0) | ((data >> 1) & 0x1c) | ((data >> 4) & 0x03));
1959         dac_w(5, (data & 0xc0) | ((data >> 2) & 0x30) | ((data >> 4) & 0x0c) | ((data >> 6) & 0x03));
1936      case 0x03:
1937         dac_w(0, ((data << 13) & 0xe000) | ((data << 10) & 0x1c00) | ((data << 7) & 0x0300), 0x00ff);
1938         dac_w(2, ((data << 10) & 0xe000) | ((data <<  7) & 0x1c00) | ((data << 4) & 0x0300), 0x00ff);
1939         dac_w(4, ((data <<  8) & 0xc000) | ((data <<  6) & 0x3000) | ((data << 4) & 0x0c00) | ((data << 2) & 0x0300), 0x00ff);
19601940         return;
19611941   }
19621942
r869r870
19661946      stream_update(extern_stream);
19671947      switch (offset)
19681948      {
1969         case 0x08:
1970         case 0x09:
1949         case 0x04:
19711950            ext_active = 1;
19721951            if (LOG_EXTERN) logerror("External DAC active\n");
19731952            return;
19741953
1975         case 0x0a:
1976         case 0x0b:
1954         case 0x05:
19771955            ext_active = 0;
19781956            if (LOG_EXTERN) logerror("External DAC inactive\n");
19791957            return;
19801958
1981         case 0x0c:
1982            ext_start = (ext_start & 0xff00f) | ((data << 4) & 0x00ff0);
1959         case 0x06:
1960            ext_start >>= 4;
1961            COMBINE_DATA(&ext_start);
1962            ext_start <<= 4;
19831963            if (LOG_EXTERN) logerror("External DAC start = %05X\n", ext_start);
19841964            return;
19851965
1986         case 0x0d:
1987            ext_start = (ext_start & 0x00fff) | ((data << 12) & 0xff000);
1988            if (LOG_EXTERN) logerror("External DAC start = %05X\n", ext_start);
1989            return;
1990
1991         case 0x0e:
1992            ext_stop = (ext_stop & 0xff00f) | ((data << 4) & 0x00ff0);
1966         case 0x07:
1967            ext_stop >>= 4;
1968            COMBINE_DATA(&ext_stop);
1969            ext_stop <<= 4;
19931970            if (LOG_EXTERN) logerror("External DAC stop = %05X\n", ext_stop);
19941971            return;
19951972
1996         case 0x0f:
1997            ext_stop = (ext_stop & 0x00fff) | ((data << 12) & 0xff000);
1998            if (LOG_EXTERN) logerror("External DAC stop = %05X\n", ext_stop);
1973         case 0x21:
1974            dac_w(offset - 0x21 + 7, data, mem_mask);
19991975            return;
2000
2001         case 0x42:
2002         case 0x43:
2003            dac_w(offset - 0x42 + 14, data);
2004            return;
20051976      }
20061977   }
20071978   logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", activecpu_get_pc(), 5, offset, data);
r869r870
20151986 *
20161987 *************************************/
20171988
2018static READ8_HANDLER( peripheral_r )
1989static READ16_HANDLER( peripheral_r )
20191990{
2020   int select = offset / 0x80;
2021   offset &= 0x7f;
1991   int select = offset / 0x40;
1992   offset &= 0x3f;
20221993
20231994   switch (select)
20241995   {
20251996      case 0:
2026         if (offset & 1)
2027            return 0;
2028
20291997         /* we have to return 0 periodically so that they handle interrupts */
20301998         if ((++clock_tick & 7) == 0)
20311999            return 0;
20322000
20332001         /* if we've filled up all the active channels, we can give this CPU a reset */
20342002         /* until the next interrupt */
2035         {
2036            UINT8 result;
2003         if (!is_redline)
2004            return ((clock_active >> 1) & 0x3e);
2005         else
2006            return ((clock_active << 1) & 0x7e);
20372007
2038            if (!is_redline)
2039               result = ((clock_active >> 1) & 0x3e);
2040            else
2041               result = ((clock_active << 1) & 0x7e);
2042
2043            return result;
2044         }
2045
20462008      case 1:
2047         return main_to_sound_comm_r(offset);
2009         return main_to_sound_comm_r(offset, mem_mask);
20482010
20492011      case 2:
2050         return pit8254_r(offset);
2012         return pit8254_r(offset, mem_mask);
20512013
20522014      case 3:
20532015         if (!has_ym2151)
2054            return pit8254_r(offset | 0x80);
2016            return pit8254_r(offset | 0x40, mem_mask);
20552017         else
2056            return (offset & 1) ? 0 : YM2151_status_port_0_r(offset);
2018            return YM2151_status_port_0_lsb_r(offset, mem_mask);
20572019
20582020      case 4:
20592021         if (is_redline)
2060            return pit8254_r(offset | 0x100);
2022            return pit8254_r(offset | 0x80, mem_mask);
20612023         else
2062            logerror("%05X:Unexpected peripheral read %d/%02X\n", activecpu_get_pc(), select, offset);
2024            logerror("%05X:Unexpected peripheral read %d/%02X\n", activecpu_get_pc(), select, offset*2);
20632025         break;
20642026
20652027      default:
2066         logerror("%05X:Unexpected peripheral read %d/%02X\n", activecpu_get_pc(), select, offset);
2028         logerror("%05X:Unexpected peripheral read %d/%02X\n", activecpu_get_pc(), select, offset*2);
20672029         break;
20682030   }
2069   return 0xff;
2031   return 0xffff;
20702032}
20712033
20722034
2073static WRITE8_HANDLER( peripheral_w )
2035static WRITE16_HANDLER( peripheral_w )
20742036{
2075   int select = offset / 0x80;
2076   offset &= 0x7f;
2037   int select = offset / 0x40;
2038   offset &= 0x3f;
20772039
20782040   switch (select)
20792041   {
20802042      case 1:
2081         sound_to_main_comm_w(offset, data);
2043         sound_to_main_comm_w(offset, data, mem_mask);
20822044         break;
20832045
20842046      case 2:
2085         pit8254_w(offset, data);
2047         pit8254_w(offset, data, mem_mask);
20862048         break;
20872049
20882050      case 3:
20892051         if (!has_ym2151)
2090            pit8254_w(offset | 0x80, data);
2052            pit8254_w(offset | 0x40, data, mem_mask);
20912053         else if (offset == 0)
2092            YM2151_register_port_0_w(offset, data);
2093         else if (offset == 2)
2094            YM2151_data_port_0_w(offset, data);
2054            YM2151_register_port_0_lsb_w(offset, data, mem_mask);
2055         else if (offset == 1)
2056            YM2151_data_port_0_lsb_w(offset, data, mem_mask);
20952057         break;
20962058
20972059      case 4:
20982060         if (is_redline)
2099            pit8254_w(offset | 0x100, data);
2061            pit8254_w(offset | 0x80, data, mem_mask);
21002062         else
2101            dac_10bit_w(offset, data);
2063            dac_10bit_w(offset, data, mem_mask);
21022064         break;
21032065
21042066      case 5:   /* Ataxx/WSF/Indy Heat only */
2105         ataxx_dac_control(offset, data);
2067         ataxx_dac_control(offset, data, mem_mask);
21062068         break;
21072069
21082070      default:
r869r870
21192081 *
21202082 *************************************/
21212083
2122WRITE8_HANDLER( ataxx_i86_control_w )
2084WRITE8_HANDLER( ataxx_80186_control_w )
21232085{
21242086   /* compute the bit-shuffled variants of the bits and then write them */
21252087   int modified =    ((data & 0x01) << 7) |
21262088               ((data & 0x02) << 5) |
21272089               ((data & 0x04) << 3) |
21282090               ((data & 0x08) << 1);
2129   leland_i86_control_w(offset, modified);
2091   leland_80186_control_w(offset, modified);
21302092}
21312093
21322094
r869r870
21372099 *
21382100 *************************************/
21392101
2140ADDRESS_MAP_START( leland_i86_map_program, ADDRESS_SPACE_PROGRAM, 8 )
2141   AM_RANGE(0x00000, 0x03fff) AM_MIRROR(0x1c000) AM_RAM AM_BASE(&ram_base)
2102ADDRESS_MAP_START( leland_80186_map_program, ADDRESS_SPACE_PROGRAM, 16 )
2103   AM_RANGE(0x00000, 0x03fff) AM_MIRROR(0x1c000) AM_RAM
21422104   AM_RANGE(0x20000, 0xfffff) AM_ROM
21432105ADDRESS_MAP_END
21442106
21452107
2146ADDRESS_MAP_START( ataxx_i86_map_io, ADDRESS_SPACE_IO, 8 )
2147   AM_RANGE(0xff00, 0xffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w)
2108ADDRESS_MAP_START( ataxx_80186_map_io, ADDRESS_SPACE_IO, 16 )
2109   AM_RANGE(0xff00, 0xffff) AM_READWRITE(i80186_internal_port_r, i80186_internal_port_w)
21482110ADDRESS_MAP_END
21492111
21502112
2151ADDRESS_MAP_START( redline_i86_map_io, ADDRESS_SPACE_IO, 8 )
2113ADDRESS_MAP_START( redline_80186_map_io, ADDRESS_SPACE_IO, 16 )
21522114   AM_RANGE(0x6000, 0x6fff) AM_WRITE(redline_dac_w)
2153   AM_RANGE(0xff00, 0xffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w)
2115   AM_RANGE(0xff00, 0xffff) AM_READWRITE(i80186_internal_port_r, i80186_internal_port_w)
21542116ADDRESS_MAP_END
21552117
21562118
2157ADDRESS_MAP_START( leland_i86_map_io, ADDRESS_SPACE_IO, 8 )
2119ADDRESS_MAP_START( leland_80186_map_io, ADDRESS_SPACE_IO, 16 )
21582120   AM_RANGE(0x0000, 0x000b) AM_WRITE(dac_w)
21592121   AM_RANGE(0x0080, 0x008b) AM_WRITE(dac_w)
21602122   AM_RANGE(0x00c0, 0x00cb) AM_WRITE(dac_w)
2161   AM_RANGE(0xff00, 0xffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w)
2123   AM_RANGE(0xff00, 0xffff) AM_READWRITE(i80186_internal_port_r, i80186_internal_port_w)
21622124ADDRESS_MAP_END
21632125
21642126
src/mame/audio/m72.c
r869r870
121121      timer_call_after_resynch(YM2151_CLEAR,setvector_callback);
122122}
123123
124WRITE8_HANDLER( m72_sound_command_w )
124WRITE16_HANDLER( m72_sound_command_w )
125125{
126   if (offset == 0)
126   if (ACCESSING_LSB)
127127   {
128128      soundlatch_w(offset,data);
129129      timer_call_after_resynch(Z80_ASSERT,setvector_callback);
130130   }
131131}
132132
133WRITE8_HANDLER( m72_sound_command_byte_w )
134{
135   soundlatch_w(offset,data);
136   timer_call_after_resynch(Z80_ASSERT,setvector_callback);
137}
138
133139WRITE8_HANDLER( m72_sound_irq_ack_w )
134140{
135141   timer_call_after_resynch(Z80_CLEAR,setvector_callback);
src/mame/audio/m72.h
r869r870
66
77MACHINE_RESET( m72_sound );
88void m72_ym2151_irq_handler(int irq);
9WRITE8_HANDLER( m72_sound_command_w );
9WRITE8_HANDLER( m72_sound_command_byte_w );
10WRITE16_HANDLER( m72_sound_command_w );
1011WRITE8_HANDLER( m72_sound_irq_ack_w );
1112READ8_HANDLER( m72_sample_r );
1213WRITE8_HANDLER( m72_sample_w );
src/mame/machine/mc146818.h
r869r870
4545READ8_HANDLER(mc146818_port_r);
4646WRITE8_HANDLER(mc146818_port_w);
4747
48READ16_HANDLER(mc146818_port16le_r);
49WRITE16_HANDLER(mc146818_port16le_w);
50
4851READ32_HANDLER(mc146818_port32le_r);
4952WRITE32_HANDLER(mc146818_port32le_w);
5053
src/mame/machine/rainbow.c
r869r870
759759   coin_counter_w(1, CRAM[0][8] & 0x20);
760760   coin_counter_w(0, CRAM[0][8] & 0x10);
761761
762   CRAM[0][3] = readinputport(2);
763   CRAM[0][4] = readinputport(3);
764   CRAM[0][5] = readinputport(4);
765   CRAM[0][6] = readinputport(5);
762   CRAM[0][3] = readinputportbytag("800007");    /* STARTn + SERVICE1 */
763   CRAM[0][4] = readinputportbytag("800009");    /* COINn */
764   CRAM[0][5] = readinputportbytag("80000B");    /* Player controls + TILT */
765   CRAM[0][6] = readinputportbytag("80000D");    /* Player controls (cocktail) */
766766}
767767
768768/*************************************
769769 *
770 * C-Chip reads and writes
770 * Writes to C-Chip - Important Bits
771771 *
772772 *************************************/
773773
r869r870
786786   CRAM[current_bank][offset] = data;
787787}
788788
789/*************************************
790 *
791 * Reads from C-Chip
792 *
793 *************************************/
794
789795READ16_HANDLER( rainbow_cchip_ctrl_r )
790796{
791   return 1;
797   /*
798        Bit 2 = Error signal
799        Bit 0 = Ready signal
800    */
801   return 0x01; /* Return 0x05 for C-Chip error */
792802}
793803
794804READ16_HANDLER( rainbow_cchip_ram_r )
src/mame/machine/scsicd.c
r869r870
4949   switch (our_this->last_command)
5050   {
5151      case 0:      // TEST UNIT READY
52         retval = 12;
52         retval = 0;
5353         break;
5454      case 3:    // REQUEST SENSE
5555         logerror("SCSICD: REQUEST SENSE\n");
r869r870
6565         }
6666         break;
6767      case 0x12:   // INQUIRY
68         retval = pCmdBuf[4];
6869         break;
6970      case 0x15:   // MODE SELECT (6)
7071         logerror("SCSICD: MODE SELECT (6) length %x control %x\n", pCmdBuf[4], pCmdBuf[5]);
src/mame/machine/volfied.c
r869r870
331331 *
332332 *************************************/
333333
334WRITE16_HANDLER( volfied_cchip_ctrl_w )
335{
336   /* value 2 is written here */
337}
338
334339WRITE16_HANDLER( volfied_cchip_bank_w )
335340{
336   current_bank=data&7;
341   current_bank = data & 7;
337342}
338343
339WRITE16_HANDLER( volfied_cchip_data_w )
344WRITE16_HANDLER( volfied_cchip_ram_w )
340345{
341346   cchip_ram[(current_bank * 0x400) + offset]=data;
342347
r869r870
360365         /*******************
361366            (This table stored in ROM at $146a8)
362367            (Level number stored at $100198.b, from $100118.b, from $100098.b)
363            (Level number at at $b34 stored to $100098.b)
368            (Level number at $b34 stored to $100098.b)
364369
365370            round 01 => data $0A
366371            round 02 => data $01
r869r870
416421 *
417422 *************************************/
418423
419READ16_HANDLER( volfied_cchip_status_r )
424READ16_HANDLER( volfied_cchip_ctrl_r )
420425{
421426   /*
422        Bit 0x4 = Error signal
423        Bit 0x1 = Ready signal
427        Bit 2 = Error signal
428        Bit 0 = Ready signal
424429    */
425   return 0x1; /* Return 0x5 for C-Chip error */
430   return 0x01; /* Return 0x05 for C-Chip error */
426431}
427432
428READ16_HANDLER( volfied_cchip_data_r )
433READ16_HANDLER( volfied_cchip_ram_r )
429434{
430435   /* Check for input ports */
431436   if (current_bank == 0)
432437   {
433438      switch (offset)
434439      {
435      case 0x003: return input_port_2_word_r(offset, mem_mask);
436      case 0x004: return input_port_3_word_r(offset, mem_mask);
437      case 0x005: return input_port_4_word_r(offset, mem_mask);
438      case 0x006: return input_port_5_word_r(offset, mem_mask);
439      case 0x008: return cc_port;
440      case 0x03: return readinputportbytag("F00007");    /* STARTn + SERVICE1 */
441      case 0x04: return readinputportbytag("F00009");    /* COINn */
442      case 0x05: return readinputportbytag("F0000B");    /* Player controls + TILT */
443      case 0x06: return readinputportbytag("F0000D");    /* Player controls (cocktail) */
444      case 0x08: return cc_port;
440445      }
441446   }
442447
src/mame/machine/amiga.c
r869r870
100100   "BLTCON0",       "BLTCON1",       "BLTAFWM",       "BLTALWM",
101101   "BLTCPTH",       "BLTCPTL",       "BLTBPTH",       "BLTBPTL",
102102   "BLTAPTH",       "BLTAPTL",       "BLTDPTH",       "BLTDPTL",
103   "BLTSIZE",       "UNK05A",      "UNK05C",      "UNK05E",
103   "BLTSIZE",       "UNK05A",      "BLTSIZV",      "BLTSIZH",
104104   /* 0x060 */
105105   "BLTCMOD",       "BLTBMOD",       "BLTAMOD",       "BLTDMOD",
106106   "UNK068",      "UNK06A",      "UNK06C",      "UNK06E",
r869r870
381381{
382382   UINT32 shifta = (CUSTOM_REG(REG_BLTCON0) >> 12) & 0xf;
383383   UINT32 shiftb = (CUSTOM_REG(REG_BLTCON1) >> 12) & 0xf;
384   UINT32 height = (CUSTOM_REG(REG_BLTSIZE) >> 6) & 0x3ff;
385   UINT32 width = CUSTOM_REG(REG_BLTSIZE) & 0x3f;
384   UINT32 height = CUSTOM_REG(REG_BLTSIZV);
385   UINT32 width = CUSTOM_REG(REG_BLTSIZH);
386386   UINT32 acca = 0, accb = 0;
387387   UINT32 blitsum = 0;
388388   UINT32 x, y;
389389
390   /* normalize height/width */
391   if (height == 0)
392      height = 0x400;
393   if (width == 0)
394      width = 0x40;
395
396390   /* iterate over the height */
397391   for (y = 0; y < height; y++)
398392   {
r869r870
510504   UINT32 fill_inclusive = (CUSTOM_REG(REG_BLTCON1) >> 3);
511505   UINT32 shifta = (CUSTOM_REG(REG_BLTCON0) >> 12) & 0xf;
512506   UINT32 shiftb = (CUSTOM_REG(REG_BLTCON1) >> 12) & 0xf;
513   UINT32 height = (CUSTOM_REG(REG_BLTSIZE) >> 6) & 0x3ff;
514   UINT32 width = CUSTOM_REG(REG_BLTSIZE) & 0x3f;
507   UINT32 height = CUSTOM_REG(REG_BLTSIZV);
508   UINT32 width = CUSTOM_REG(REG_BLTSIZH);
515509   UINT32 acca = 0, accb = 0;
516510   UINT32 blitsum = 0;
517511   UINT32 x, y;
518512
519   /* normalize height/width */
520   if (height == 0)
521      height = 0x400;
522   if (width == 0)
523      width = 0x40;
524
525513   /* iterate over the height */
526514   for (y = 0; y < height; y++)
527515   {
r869r870
699687   UINT32 height;
700688
701689   /* see if folks are breaking the rules */
702   if ((CUSTOM_REG(REG_BLTSIZE) & 0x003f) != 0x0002)
703      logerror("Blitter: BLTSIZE.w != 2 in line mode!\n");
690   if (CUSTOM_REG(REG_BLTSIZH) != 0x0002)
691      logerror("Blitter: Blit width != 2 in line mode!\n");
704692   if ((CUSTOM_REG(REG_BLTCON0) & 0x0a00) != 0x0a00)
705693      logerror("Blitter: Channel selection incorrect in line mode!\n" );
706694
707695   /* extract the length of the line */
708   height = (CUSTOM_REG(REG_BLTSIZE) >> 6) & 0x3ff;
709   if (height == 0)
710      height = 0x400;
696   height = CUSTOM_REG(REG_BLTSIZV);
711697
712698   /* iterate over the line height */
713699   while (height--)
r869r870
852838   if (LOG_BLITS)
853839   {
854840      static const char *type[] = { "ASCENDING", "LINE", "DESCENDING", "LINE" };
855      logerror("BLIT %s: %dx%d  %04x %04x\n", type[CUSTOM_REG(REG_BLTCON1) & 0x0003], CUSTOM_REG(REG_BLTSIZE) & 0x3f, (CUSTOM_REG(REG_BLTSIZE) >> 6) & 0x3ff, CUSTOM_REG(REG_BLTCON0), CUSTOM_REG(REG_BLTCON1));
841      logerror("BLIT %s: %dx%d  %04x %04x\n", type[CUSTOM_REG(REG_BLTCON1) & 0x0003], CUSTOM_REG(REG_BLTSIZH), CUSTOM_REG(REG_BLTSIZV), CUSTOM_REG(REG_BLTCON0), CUSTOM_REG(REG_BLTCON1));
856842      if (CUSTOM_REG(REG_BLTCON0) & 0x0800)
857843         logerror("  A: addr=%06X mod=%3d shift=%2d maskl=%04x maskr=%04x\n", CUSTOM_REG_LONG(REG_BLTAPTH), CUSTOM_REG_SIGNED(REG_BLTAMOD), CUSTOM_REG(REG_BLTCON0) >> 12, CUSTOM_REG(REG_BLTAFWM), CUSTOM_REG(REG_BLTALWM));
858844      if (CUSTOM_REG(REG_BLTCON0) & 0x0400)
r869r870
935921   }
936922
937923   /* extract height/width */
938   width = (CUSTOM_REG(REG_BLTSIZE) & 0x3f);
939   if (width == 0)
940      width = 0x40;
941   height = ((CUSTOM_REG(REG_BLTSIZE) >> 6) & 0x3ff);
942   if (height == 0)
943      height = 0x400;
924   width = CUSTOM_REG(REG_BLTSIZH);
925   height = CUSTOM_REG(REG_BLTSIZV);
944926
945927   /* compute the blit time */
946928   blittime = ticks * height * width;
r869r870
10651047
10661048static void custom_reset(void)
10671049{
1050   UINT16   vidmode = (O2_CLOCK == 715909) ? 0x1000 : 0x0000; /* NTSC or PAL? */
1051
10681052   CUSTOM_REG(REG_DDFSTRT) = 0x18;
10691053   CUSTOM_REG(REG_DDFSTOP) = 0xd8;
10701054   CUSTOM_REG(REG_INTENA) = 0x0000;
1055   CUSTOM_REG(REG_VPOSR) = vidmode;
10711056
10721057   switch (amiga_intf->chip_ram_mask)
10731058   {
10741059      case ANGUS_CHIP_RAM_MASK:
10751060      case FAT_ANGUS_CHIP_RAM_MASK:
1076         CUSTOM_REG(REG_VPOSR) = 0x10 << 8;
10771061         CUSTOM_REG(REG_DENISEID) = 0xFFFF;
10781062         break;
10791063
10801064      case ECS_CHIP_RAM_MASK:
1081         CUSTOM_REG(REG_VPOSR) = 0x30 << 8;
1065         CUSTOM_REG(REG_VPOSR) |= 0x2000;
10821066         CUSTOM_REG(REG_DENISEID) = 0xFFFC;
10831067         break;
10841068   }
r869r870
12271211
12281212      case REG_BLTSIZE:
12291213         CUSTOM_REG(REG_BLTSIZE) = data;
1214         CUSTOM_REG(REG_BLTSIZV) = (data >> 6) & 0x3ff;
1215         CUSTOM_REG(REG_BLTSIZH) = data & 0x3f;
1216         if ( CUSTOM_REG(REG_BLTSIZV) == 0 ) CUSTOM_REG(REG_BLTSIZV) = 0x400;
1217         if ( CUSTOM_REG(REG_BLTSIZH) == 0 ) CUSTOM_REG(REG_BLTSIZH) = 0x40;
12301218         blitter_setup();
12311219         break;
12321220
1221      case REG_BLTSIZV:   /* ECS only */
1222         if ( amiga_intf->chip_ram_mask == ECS_CHIP_RAM_MASK )
1223         {
1224            CUSTOM_REG(REG_BLTSIZV) = data & 0x7fff;
1225            if ( CUSTOM_REG(REG_BLTSIZV) == 0 ) CUSTOM_REG(REG_BLTSIZV) = 0x8000;
1226         }
1227         break;
1228
1229      case REG_BLTSIZH:   /* ECS only */
1230         if ( amiga_intf->chip_ram_mask == ECS_CHIP_RAM_MASK )
1231         {
1232            CUSTOM_REG(REG_BLTSIZH) = data & 0x7ff;
1233            if ( CUSTOM_REG(REG_BLTSIZH) == 0 ) CUSTOM_REG(REG_BLTSIZH) = 0x800;
1234            blitter_setup();
1235         }
1236         break;
1237
12331238      case REG_SPR0PTH:   case REG_SPR1PTH:   case REG_SPR2PTH:   case REG_SPR3PTH:
12341239      case REG_SPR4PTH:   case REG_SPR5PTH:   case REG_SPR6PTH:   case REG_SPR7PTH:
12351240         data &= ( amiga_intf->chip_ram_mask >> 16 );
src/mame/machine/wd33c93.c
r0r870
1/*
2 * wd33c93.c
3 *
4 * WD/AMD 33c93 SCSI controller, as seen in
5 * early PCs, some MSX add-ons, NEC PC-88, and SGI
6 * Indigo, Indigo2, and Indy systems.
7 *
8 * References:
9 * WD 33c93 manual
10 * NetBSD 33c93 driver
11 *
12 */
13
14#include "driver.h"
15#include "state.h"
16#include "wd33c93.h"
17
18#define VERBOSE 0
19
20typedef struct
21{
22   void *data;      // device's "this" pointer
23   pSCSIDispatch handler;   // device's handler routine
24} SCSIDev;
25
26static SCSIDev devices[8];   // SCSI IDs 0-7
27static struct WD33C93interface *intf;
28
29/* wd register names */
30#define WD_OWN_ID               0x00
31#define WD_CONTROL               0x01
32#define WD_TIMEOUT_PERIOD         0x02
33#define WD_CDB_1               0x03
34#define WD_CDB_2               0x04
35#define WD_CDB_3               0x05
36#define WD_CDB_4               0x06
37#define WD_CDB_5               0x07
38#define WD_CDB_6               0x08
39#define WD_CDB_7               0x09
40#define WD_CDB_8               0x0a
41#define WD_CDB_9               0x0b
42#define WD_CDB_10               0x0c
43#define WD_CDB_11               0x0d
44#define WD_CDB_12               0x0e
45#define WD_TARGET_LUN            0x0f
46#define WD_COMMAND_PHASE         0x10
47#define WD_SYNCHRONOUS_TRANSFER      0x11
48#define WD_TRANSFER_COUNT_MSB      0x12
49#define WD_TRANSFER_COUNT         0x13
50#define WD_TRANSFER_COUNT_LSB      0x14
51#define WD_DESTINATION_ID         0x15
52#define WD_SOURCE_ID            0x16
53#define WD_SCSI_STATUS            0x17
54#define WD_COMMAND               0x18
55#define WD_DATA                  0x19
56#define WD_QUEUE_TAG            0x1a
57#define WD_AUXILIARY_STATUS         0x1f
58
59/* WD commands */
60#define WD_CMD_RESET            0x00
61#define WD_CMD_ABORT            0x01
62#define WD_CMD_ASSERT_ATN         0x02
63#define WD_CMD_NEGATE_ACK         0x03
64#define WD_CMD_DISCONNECT         0x04
65#define WD_CMD_RESELECT            0x05
66#define WD_CMD_SEL_ATN            0x06
67#define WD_CMD_SEL               0x07
68#define WD_CMD_SEL_ATN_XFER         0x08
69#define WD_CMD_SEL_XFER            0x09
70#define WD_CMD_RESEL_RECEIVE      0x0a
71#define WD_CMD_RESEL_SEND         0x0b
72#define WD_CMD_WAIT_SEL_RECEIVE      0x0c
73#define WD_CMD_SSCC               0x0d
74#define WD_CMD_SND_DISC            0x0e
75#define WD_CMD_SET_IDI            0x0f
76#define WD_CMD_RCV_CMD            0x10
77#define WD_CMD_RCV_DATA            0x11
78#define WD_CMD_RCV_MSG_OUT         0x12
79#define WD_CMD_RCV               0x13
80#define WD_CMD_SND_STATUS         0x14
81#define WD_CMD_SND_DATA            0x15
82#define WD_CMD_SND_MSG_IN         0x16
83#define WD_CMD_SND               0x17
84#define WD_CMD_TRANS_ADDR         0x18
85#define WD_CMD_XFER_PAD            0x19
86#define WD_CMD_TRANS_INFO         0x20
87#define WD_CMD_TRANSFER_PAD         0x21
88#define WD_CMD_SBT_MODE            0x80
89
90/* ASR register */
91#define ASR_INT                  0x80
92#define ASR_LCI                  0x40
93#define ASR_BSY                  0x20
94#define ASR_CIP                  0x10
95#define ASR_PE                  0x02
96#define ASR_DBR                  0x01
97
98/* SCSI Bus Phases */
99#define PHS_DATA_OUT            0x00
100#define PHS_DATA_IN               0x01
101#define PHS_COMMAND               0x02
102#define PHS_STATUS               0x03
103#define PHS_MESS_OUT            0x06
104#define PHS_MESS_IN               0x07
105
106/* Command Status Register definitions */
107
108  /* reset state interrupts */
109#define CSR_RESET               0x00
110#define CSR_RESET_AF            0x01
111
112  /* successful completion interrupts */
113#define CSR_RESELECT            0x10
114#define CSR_SELECT               0x11
115#define CSR_SEL_XFER_DONE         0x16
116#define CSR_XFER_DONE            0x18
117
118  /* paused or aborted interrupts */
119#define CSR_MSGIN               0x20
120#define CSR_SDP                  0x21
121#define CSR_SEL_ABORT            0x22
122#define CSR_RESEL_ABORT            0x25
123#define CSR_RESEL_ABORT_AM         0x27
124#define CSR_ABORT               0x28
125
126  /* terminated interrupts */
127#define CSR_INVALID               0x40
128#define CSR_UNEXP_DISC            0x41
129#define CSR_TIMEOUT               0x42
130#define CSR_PARITY               0x43
131#define CSR_PARITY_ATN            0x44
132#define CSR_BAD_STATUS            0x45
133#define CSR_UNEXP               0x48
134
135  /* service required interrupts */
136#define CSR_RESEL               0x80
137#define CSR_RESEL_AM            0x81
138#define CSR_DISC               0x85
139#define CSR_SRV_REQ               0x88
140
141   /* Own ID/CDB Size register */
142#define OWNID_EAF               0x08
143#define OWNID_EHP               0x10
144#define OWNID_RAF               0x20
145#define OWNID_FS_8               0x00
146#define OWNID_FS_12               0x40
147#define OWNID_FS_16               0x80
148
149   /* Control register */
150#define CTRL_HSP               0x01
151#define CTRL_HA                  0x02
152#define CTRL_IDI               0x04
153#define CTRL_EDI               0x08
154#define CTRL_HHP               0x10
155#define CTRL_POLLED               0x00
156#define CTRL_BURST               0x20
157#define CTRL_BUS               0x40
158#define CTRL_DMA               0x80
159
160   /* Synchronous Transfer Register */
161#define STR_FSS                  0x80
162
163   /* Destination ID register */
164#define DSTID_DPD               0x40
165#define DATA_OUT_DIR            0
166#define DATA_IN_DIR               1
167#define DSTID_SCC               0x80
168
169   /* Source ID register */
170#define SRCID_MASK               0x07
171#define SRCID_SIV               0x08
172#define SRCID_DSP               0x20
173#define SRCID_ES               0x40
174#define SRCID_ER               0x80
175
176/* command handler definition */
177typedef void (*cmd_handler)(void);
178
179#define TEMP_INPUT_LEN   65536
180#define FIFO_SIZE      12
181
182/* internal controller data definition */
183typedef struct
184{
185   UINT8      sasr;
186   UINT8      regs[WD_AUXILIARY_STATUS+1];
187   UINT8      fifo[FIFO_SIZE];
188   int         fifo_pos;
189   UINT8      *temp_input;
190   int         temp_input_pos;
191   UINT8      busphase;
192   UINT8      identify;
193   int         read_pending;
194   mame_timer *cmd_timer;
195} _wd33c93_data;
196
197/* local instance of controller data */
198static _wd33c93_data scsi_data;
199
200
201/* convernience functions */
202static UINT8 wd33c93_getunit( void )
203{
204   /* return the destination unit id */
205   return scsi_data.regs[WD_DESTINATION_ID] & SRCID_MASK;
206}
207
208static void wd33c93_set_xfer_count( int count )
209{
210   /* set the count */
211   scsi_data.regs[ WD_TRANSFER_COUNT_LSB ] = count & 0xff;
212   scsi_data.regs[ WD_TRANSFER_COUNT ] = ( count >> 8 ) & 0xff;
213   scsi_data.regs[ WD_TRANSFER_COUNT_MSB ] = ( count >> 16 ) & 0xff;
214}
215
216static int wd33c93_get_xfer_count( void )
217{
218   /* get the count */
219   int      count = scsi_data.regs[ WD_TRANSFER_COUNT_MSB ];
220
221   count <<= 8;
222   count |= scsi_data.regs[ WD_TRANSFER_COUNT ];
223   count <<= 8;
224   count |= scsi_data.regs[ WD_TRANSFER_COUNT_LSB ];
225
226   return count;
227}
228
229static void wd33c93_read_data(int bytes, UINT8 *pData)
230{
231   UINT8   unit = wd33c93_getunit();
232
233   if ( devices[unit].handler )
234   {
235      devices[unit].handler(SCSIOP_READ_DATA, devices[unit].data, bytes, pData);
236   }
237   else
238   {
239      logerror("wd33c93: request for unknown device SCSI ID %d\n", unit);
240   }
241}
242
243static void wd33c93_complete_immediate( int status )
244{
245   /* reset our timer */
246   mame_timer_reset( scsi_data.cmd_timer, time_never );
247
248   /* set the new status */
249   scsi_data.regs[WD_SCSI_STATUS] = status & 0xff;
250
251   /* set interrupt pending */
252   scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_INT;
253
254   /* check for error conditions */
255   if ( wd33c93_get_xfer_count() > 0 )
256   {
257      /* set data buffer ready */
258      scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_DBR;
259   }
260   else
261   {
262      /* clear data buffer ready */
263      scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
264   }
265
266   /* clear command in progress and bus busy */
267   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
268
269   /* if we have a callback, call it */
270   if (intf && intf->irq_callback)
271   {
272      intf->irq_callback(1);
273   }
274}
275
276static TIMER_CALLBACK(wd33c93_complete_cb)
277{
278   wd33c93_complete_immediate( param );
279}
280
281static TIMER_CALLBACK(wd33c93_service_request)
282{
283   /* issue a message out request */
284   wd33c93_complete_immediate(CSR_SRV_REQ | scsi_data.busphase);
285}
286
287static TIMER_CALLBACK(wd33c93_deassert_cip)
288{
289   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_CIP;
290}
291
292static void wd33c93_complete_cmd( UINT8 status )
293{
294   /* fire off a timer to complete the command */
295   mame_timer_adjust( scsi_data.cmd_timer, MAME_TIME_IN_USEC(1), status, time_zero );
296}
297
298/* command handlers */
299static void wd33c93_invalid_cmd( void )
300{
301   logerror( "Unknown/Unimplemented SCSI controller command: %02x (PC=%x)\n", scsi_data.regs[WD_COMMAND], activecpu_get_pc() );
302
303   /* complete the command */
304   wd33c93_complete_cmd( CSR_INVALID );
305}
306
307static void wd33c93_reset_cmd( void )
308{
309   int      advanced = 0;
310
311   /* see if it wants us to reset with advanced features */
312   if ( scsi_data.regs[WD_OWN_ID] & OWNID_EAF )
313   {
314      advanced = 1;
315   }
316
317   /* clear out all registers */
318   memset( scsi_data.regs, 0, sizeof( scsi_data.regs ) );
319
320   /* complete the command */
321   wd33c93_complete_cmd(advanced ? CSR_RESET_AF : CSR_RESET);
322}
323
324static void wd33c93_abort_cmd( void )
325{
326   /* complete the command */
327   wd33c93_complete_cmd(CSR_ABORT);
328}
329
330static void wd33c93_disconnect_cmd( void )
331{
332   /* complete the command */
333   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
334}
335
336static void wd33c93_select_cmd( void )
337{
338   UINT8   unit = wd33c93_getunit();
339   UINT8   newstatus;
340
341   /* see if we can select that device */
342   if ( devices[unit].handler )
343   {
344      /* device is available - signal selection done */
345      newstatus = CSR_SELECT;
346
347      /* determine the next bus phase depending on the command */
348      if ( (scsi_data.regs[WD_COMMAND] & 0x7f) == WD_CMD_SEL_ATN )
349      {
350         /* /ATN asserted during select: Move to Message Out Phase to read identify */
351         scsi_data.busphase = PHS_MESS_OUT;
352      }
353      else
354      {
355         /* No /ATN asserted: Move to Command Phase */
356         scsi_data.busphase = PHS_COMMAND;
357      }
358
359      /* queue up a service request out in the future */
360      mame_timer_set( MAME_TIME_IN_USEC(50), 0, wd33c93_service_request );
361   }
362   else
363   {
364      /* device is not available */
365      newstatus = CSR_TIMEOUT;
366   }
367
368   /* complete the command */
369   wd33c93_complete_cmd(newstatus);
370}
371
372static void wd33c93_selectxfer_cmd( void )
373{
374   UINT8   unit = wd33c93_getunit();
375   UINT8   newstatus;
376
377   /* see if we can select that device */
378   if ( devices[unit].handler )
379   {
380      if ( scsi_data.regs[WD_COMMAND_PHASE] < 0x45 )
381      {
382         /* device is available */
383         int xfercount;
384
385         /* do the request */
386         xfercount = devices[unit].handler(SCSIOP_EXEC_COMMAND, devices[unit].data, 0, &scsi_data.regs[WD_CDB_1]);
387
388         /* set transfer count */
389         if ( wd33c93_get_xfer_count() > TEMP_INPUT_LEN )
390         {
391            logerror( "WD33C93: Transfer count too big. Please increase TEMP_INPUT_LEN (size=%d)\n", wd33c93_get_xfer_count() );
392            wd33c93_set_xfer_count( TEMP_INPUT_LEN );
393         }
394
395         scsi_data.read_pending = 1;
396      }
397
398      if ( scsi_data.read_pending )
399      {
400         int      len = TEMP_INPUT_LEN;
401
402         if ( wd33c93_get_xfer_count() < len ) len = wd33c93_get_xfer_count();
403
404         memset( &scsi_data.temp_input[0], 0, TEMP_INPUT_LEN );
405         wd33c93_read_data( len, &scsi_data.temp_input[0] );
406         scsi_data.temp_input_pos = 0;
407         scsi_data.read_pending = 0;
408      }
409
410      scsi_data.regs[WD_TARGET_LUN] = 0;
411      scsi_data.regs[WD_CONTROL] |= CTRL_EDI;
412      scsi_data.regs[WD_COMMAND_PHASE] = 0x60;
413
414      /* signal transfer ready */
415      newstatus = CSR_SEL_XFER_DONE;
416
417      /* if allowed disconnect, queue a service request */
418      if ( scsi_data.identify & 0x40 )
419      {
420         /* queue disconnect message in */
421         scsi_data.busphase = PHS_MESS_IN;
422
423         /* queue up a service request out in the future */
424         mame_timer_set( MAME_TIME_IN_MSEC(50), 0, wd33c93_service_request );
425      }
426   }
427   else
428   {
429      /* device is not available */
430      newstatus = CSR_TIMEOUT;
431
432      wd33c93_set_xfer_count( 0 );
433   }
434
435   /* complete the command */
436   wd33c93_complete_cmd(newstatus);
437}
438
439static void wd33c93_negate_ack( void )
440{
441   logerror( "WD33C93: ACK Negated\n" );
442
443   /* complete the command */
444   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
445}
446
447static void wd33c93_xferinfo_cmd( void )
448{
449   /* make the buffer available right away */
450   scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_DBR;
451   scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
452
453   /* the command will be completed once the data is transferred */
454   mame_timer_set( MAME_TIME_IN_MSEC(1), 0, wd33c93_deassert_cip );
455}
456
457/* Command handlers */
458static cmd_handler wd33c93_cmds[0x22] =
459{
460   &wd33c93_reset_cmd,      /* 0x00 - WD_CMD_RESET */
461   &wd33c93_abort_cmd,      /* 0x01 - WD_CMD_ABORT */
462   &wd33c93_invalid_cmd,   /* 0x02 - WD_CMD_ASSERT_ATN (uninmplemented) */
463   &wd33c93_negate_ack,   /* 0x03 - WD_CMD_NEGATE_ACK */
464   &wd33c93_disconnect_cmd,/* 0x04 - WD_CMD_DISCONNECT */
465   &wd33c93_invalid_cmd,   /* 0x05 - WD_CMD_RESELECT (uninmplemented) */
466   &wd33c93_select_cmd,   /* 0x06 - WD_CMD_SEL_ATN */
467   &wd33c93_select_cmd,   /* 0x07 - WD_CMD_SEL */
468   &wd33c93_selectxfer_cmd,/* 0x08 - WD_CMD_SEL_ATN_XFER */
469   &wd33c93_selectxfer_cmd,/* 0x09 - WD_CMD_SEL_XFER */
470   &wd33c93_invalid_cmd,   /* 0x0a - WD_CMD_RESEL_RECEIVE (uninmplemented) */
471   &wd33c93_invalid_cmd,   /* 0x0b - WD_CMD_RESEL_SEND (uninmplemented) */
472   &wd33c93_invalid_cmd,   /* 0x0c - WD_CMD_WAIT_SEL_RECEIVE (uninmplemented) */
473   &wd33c93_invalid_cmd,   /* 0x0d - WD_CMD_SSCC (uninmplemented) */
474   &wd33c93_invalid_cmd,   /* 0x0e - WD_CMD_SND_DISC (uninmplemented) */
475   &wd33c93_invalid_cmd,   /* 0x0f - WD_CMD_SET_IDI (uninmplemented) */
476   &wd33c93_invalid_cmd,   /* 0x10 - WD_CMD_RCV_CMD (uninmplemented) */
477   &wd33c93_invalid_cmd,   /* 0x11 - WD_CMD_RCV_DATA (uninmplemented) */
478   &wd33c93_invalid_cmd,   /* 0x12 - WD_CMD_RCV_MSG_OUT (uninmplemented) */
479   &wd33c93_invalid_cmd,   /* 0x13 - WD_CMD_RCV (uninmplemented) */
480   &wd33c93_invalid_cmd,   /* 0x14 - WD_CMD_SND_STATUS (uninmplemented) */
481   &wd33c93_invalid_cmd,   /* 0x15 - WD_CMD_SND_DATA (uninmplemented) */
482   &wd33c93_invalid_cmd,   /* 0x16 - WD_CMD_SND_MSG_IN (uninmplemented) */
483   &wd33c93_invalid_cmd,   /* 0x17 - WD_CMD_SND (uninmplemented) */
484   &wd33c93_invalid_cmd,   /* 0x18 - WD_CMD_TRANS_ADDR (uninmplemented) */
485   &wd33c93_invalid_cmd,   /* 0x19 - WD_CMD_XFER_PAD (uninmplemented) */
486   &wd33c93_invalid_cmd,   /* 0x1a - invalid */
487   &wd33c93_invalid_cmd,   /* 0x1b - invalid */
488   &wd33c93_invalid_cmd,   /* 0x1c - invalid */
489   &wd33c93_invalid_cmd,   /* 0x1d - invalid */
490   &wd33c93_invalid_cmd,   /* 0x1e - invalid */
491   &wd33c93_invalid_cmd,   /* 0x1f - invalid */
492   &wd33c93_xferinfo_cmd,   /* 0x20 - WD_CMD_TRANS_INFO) */
493   &wd33c93_invalid_cmd   /* 0x21 - WD_CMD_TRANSFER_PAD (uninmplemented) */
494};
495
496/* Handle pending commands */
497static void wd33c93_command( void )
498{
499   /* get the command */
500   UINT8 cmd = scsi_data.regs[WD_COMMAND];
501
502   /* check if its within valid bounds */
503   if ( (cmd & 0x7F) > WD_CMD_TRANSFER_PAD )
504   {
505      wd33c93_invalid_cmd();
506      return;
507   }
508
509   /* call the command handler */
510   (*wd33c93_cmds[cmd & 0x7F])();
511}
512
513WRITE8_HANDLER(wd33c93_w)
514{
515   switch( offset )
516   {
517      case 0:
518      {
519         /* update register select */
520         scsi_data.sasr = data & 0x1f;
521      }
522      break;
523
524      case 1:
525      {
526#if VERBOSE
527         logerror( "WD33C93: PC=%08x - Write REG=%02x, data = %02x\n", safe_activecpu_get_pc(), scsi_data.sasr, data );
528#endif
529
530         /* update the register */
531         scsi_data.regs[scsi_data.sasr] = data;
532
533         /* if we receive a command, schedule to process it */
534         if ( scsi_data.sasr == WD_COMMAND )
535         {
536#if VERBOSE
537            logerror( "WDC33C93: PC=%08x - Executing command %08x - unit %d\n", safe_activecpu_get_pc(), data, wd33c93_getunit() );
538#endif
539
540            /* signal we're processing it */
541            scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
542
543            /* process the command */
544            wd33c93_command();
545         }
546         else if ( scsi_data.sasr == WD_CDB_1 )
547         {
548            scsi_data.regs[WD_COMMAND_PHASE] = 0;
549         }
550         else if ( scsi_data.sasr == WD_DATA )
551         {
552            /* if data was written, and we have a count, send to device */
553            int      count = wd33c93_get_xfer_count();
554
555            if ( scsi_data.regs[WD_COMMAND] & 0x80 )
556               count = 1;
557
558            if ( count-- > 0 )
559            {
560               /* write to FIFO */
561               if ( scsi_data.fifo_pos < FIFO_SIZE )
562               {
563                  scsi_data.fifo[scsi_data.fifo_pos++] = data;
564               }
565
566               /* update count */
567               wd33c93_set_xfer_count( count );
568
569               /* if we're done with the write, see where we're at */
570               if ( count == 0 )
571               {
572                  scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_INT;
573                  scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
574
575                  switch( scsi_data.busphase )
576                  {
577                     case PHS_MESS_OUT:
578                     {
579                        /* reset fifo */
580                        scsi_data.fifo_pos = 0;
581
582                        /* Message out phase. Data is probably SCSI Identify. Move to command phase. */
583                        scsi_data.busphase = PHS_COMMAND;
584
585                        scsi_data.identify = scsi_data.fifo[0];
586                     }
587                     break;
588
589                     case PHS_COMMAND:
590                     {
591                        UINT8   unit = wd33c93_getunit();
592                        int      xfercount;
593
594                        /* Execute the command. Depending on the command, we'll move to data in or out */
595                        xfercount = devices[unit].handler(SCSIOP_EXEC_COMMAND, devices[unit].data, 0, &scsi_data.fifo[0]);
596
597                        /* reset fifo */
598                        scsi_data.fifo_pos = 0;
599
600                        /* set the new count */
601                        wd33c93_set_xfer_count( xfercount );
602
603                        if ( xfercount == 0 )
604                        {
605                           /* move to status phase */
606                           scsi_data.busphase = PHS_STATUS;
607                        }
608                        else
609                        {
610                           /* update bus phase */
611                           if ( scsi_data.fifo[0] == 0x15 || scsi_data.fifo[0] == 0x55 ) /* MODE SELECT */
612                           {
613                              scsi_data.busphase = PHS_DATA_OUT;
614                           }
615                           else
616                           {
617                              scsi_data.busphase = PHS_DATA_IN;
618                              scsi_data.read_pending = 1;
619                           }
620                        }
621                     }
622                     break;
623
624                     case PHS_DATA_OUT:
625                     {
626                        /* write data out to device */
627                        wd33c93_write_data( scsi_data.fifo_pos, scsi_data.fifo );
628
629                        /* reset fifo */
630                        scsi_data.fifo_pos = 0;
631
632                        /* move to status phase */
633                        scsi_data.busphase = PHS_STATUS;
634                     }
635                     break;
636                  }
637
638                  /* complete the command */
639                  wd33c93_complete_immediate(CSR_XFER_DONE | scsi_data.busphase);
640               }
641            }
642            else
643            {
644               logerror( "WD33C93: Sending data to device with transfer count = 0!. Ignoring...\n" );
645            }
646         }
647
648         /* auto-increment register select if not on special registers */
649         if ( scsi_data.sasr != WD_COMMAND && scsi_data.sasr != WD_DATA && scsi_data.sasr != WD_AUXILIARY_STATUS )
650         {
651            scsi_data.sasr = ( scsi_data.sasr + 1 ) & 0x1f;
652         }
653      }
654      break;
655
656      default:
657      {
658         logerror( "WD33C93: Write to invalid offset %d (data=%02x)\n", offset, data );
659      }
660      break;
661   }
662}
663
664READ8_HANDLER(wd33c93_r)
665{
666   switch( offset )
667   {
668      case 0:
669      {
670         /* read aux status */
671         return scsi_data.regs[WD_AUXILIARY_STATUS];
672      }
673      break;
674
675      case 1:
676      {
677         UINT8   ret;
678
679         /* if reading status, clear irq flag */
680         if ( scsi_data.sasr == WD_SCSI_STATUS )
681         {
682            scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_INT;
683
684            if (intf && intf->irq_callback)
685            {
686               intf->irq_callback(0);
687            }
688
689#if VERBOSE
690            logerror( "WD33C93: PC=%08x - Status read (%02x)\n", safe_activecpu_get_pc(), scsi_data.regs[WD_SCSI_STATUS] );
691#endif
692         }
693         else if ( scsi_data.sasr == WD_DATA )
694         {
695            /* we're going to be doing synchronous reads */
696
697            /* get the transfer count */
698            int      count = wd33c93_get_xfer_count();
699
700            /* initialize the return value */
701            scsi_data.regs[WD_DATA] = 0;
702
703            if ( count <= 0 && scsi_data.busphase == PHS_MESS_IN )
704            {
705               /* move to disconnect */
706               wd33c93_complete_cmd(CSR_DISC);
707            }
708            else if ( count == 1 && scsi_data.busphase == PHS_STATUS )
709            {
710               /* update the count */
711               wd33c93_set_xfer_count( 0 );
712
713               /* move to message in phase */
714               scsi_data.busphase = PHS_MESS_IN;
715
716               /* complete the command */
717               wd33c93_complete_cmd(CSR_XFER_DONE | scsi_data.busphase);
718            }
719            else if ( count-- > 0 ) /* make sure we still have data to send */
720            {
721               if ( scsi_data.read_pending )
722               {
723                  int      len = TEMP_INPUT_LEN;
724
725                  if ( (count+1) < len ) len = count+1;
726                  wd33c93_read_data( len, &scsi_data.temp_input[0] );
727                  scsi_data.temp_input_pos = 0;
728                  scsi_data.read_pending = 0;
729               }
730
731               scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_INT;
732
733               /* read in one byte */
734               if ( scsi_data.temp_input_pos < TEMP_INPUT_LEN )
735                  scsi_data.regs[WD_DATA] = scsi_data.temp_input[scsi_data.temp_input_pos++];
736
737               /* update the count */
738               wd33c93_set_xfer_count( count );
739
740               /* transfer finished, see where we're at */
741               if ( count == 0 )
742               {
743                  if ( scsi_data.regs[WD_COMMAND_PHASE] != 0x60 )
744                  {
745                     /* move to status phase */
746                     scsi_data.busphase = PHS_STATUS;
747
748                     /* complete the command */
749                     wd33c93_complete_cmd(CSR_XFER_DONE | scsi_data.busphase);
750                  }
751                  else
752                  {
753                     scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_INT;
754                     scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
755                  }
756               }
757            }
758         }
759
760#if VERBOSE
761         logerror( "WD33C93: PC=%08x - Data read (%02x)\n", safe_activecpu_get_pc(), scsi_data.regs[WD_DATA] );
762#endif
763
764         /* get the register value */
765         ret = scsi_data.regs[scsi_data.sasr];
766
767         /* auto-increment register select if not on special registers */
768         if ( scsi_data.sasr != WD_COMMAND && scsi_data.sasr != WD_DATA && scsi_data.sasr != WD_AUXILIARY_STATUS )
769         {
770            scsi_data.sasr = ( scsi_data.sasr + 1 ) & 0x1f;
771         }
772
773         return ret;
774      }
775
776      default:
777      {
778         logerror( "WD33C93: Read from invalid offset %d\n", offset );
779      }
780      break;
781   }
782
783   return 0;
784}
785
786extern void wd33c93_init( struct WD33C93interface *interface )
787{
788   int i;
789
790   // save interface pointer for later
791   intf = interface;
792
793   memset(&scsi_data, 0, sizeof(scsi_data));
794   memset(devices, 0, sizeof(devices));
795
796   // try to open the devices
797   for (i = 0; i < interface->scsidevs->devs_present; i++)
798   {
799      devices[interface->scsidevs->devices[i].scsiID].handler = interface->scsidevs->devices[i].handler;
800      interface->scsidevs->devices[i].handler(SCSIOP_ALLOC_INSTANCE, &devices[interface->scsidevs->devices[i].scsiID].data, interface->scsidevs->devices[i].diskID, (UINT8 *)NULL);
801   }
802
803   /* allocate a timer for commands */
804   scsi_data.cmd_timer = mame_timer_alloc(wd33c93_complete_cb);
805
806   scsi_data.temp_input = auto_malloc( TEMP_INPUT_LEN );
807
808//  state_save_register_item_array("wd33c93", 0, scsi_data);
809}
810
811void wd33c93_get_dma_data( int bytes, UINT8 *pData )
812{
813   int      len = bytes;
814
815   if ( len >= wd33c93_get_xfer_count() )
816      len = wd33c93_get_xfer_count();
817
818   if ( len == 0 )
819      return;
820
821   if ( (scsi_data.temp_input_pos+len) >= TEMP_INPUT_LEN )
822   {
823      logerror( "Reading past end of buffer, increase TEMP_INPUT_LEN size\n" );
824      len = TEMP_INPUT_LEN - len;
825   }
826
827   memcpy( pData, &scsi_data.temp_input[scsi_data.temp_input_pos], len );
828
829   scsi_data.temp_input_pos += len;
830   len = wd33c93_get_xfer_count() - len;
831   wd33c93_set_xfer_count(len);
832}
833
834void wd33c93_write_data(int bytes, UINT8 *pData)
835{
836   UINT8   unit = wd33c93_getunit();
837
838   if (devices[unit].handler)
839   {
840      devices[unit].handler(SCSIOP_WRITE_DATA, devices[unit].data, bytes, pData);
841   }
842   else
843   {
844      logerror("wd33c93: request for unknown device SCSI ID %d\n", unit);
845   }
846}
847
848void *wd33c93_get_device(int id)
849{
850   void *ret;
851
852   if (devices[id].handler)
853   {
854      devices[id].handler(SCSIOP_GET_DEVICE, devices[id].data, 0, (UINT8 *)&ret);
855
856      return ret;
857   }
858
859   return NULL;
860}
861
862void wd33c93_clear_dma(void)
863{
864   /* indicate DMA completed by clearing the transfer count */
865   wd33c93_set_xfer_count(0);
866   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
867}
868
869int wd33c93_get_dma_count(void)
870{
871   return wd33c93_get_xfer_count();
872}
src/mame/machine/pic8259.c
r869r870
380380WRITE8_HANDLER ( pic8259_0_w )   { pic8259_write(0, offset, data); }
381381WRITE8_HANDLER ( pic8259_1_w )   { pic8259_write(1, offset, data); }
382382
383READ16_HANDLER ( pic8259_16le_0_r ) { return read16le_with_read8_handler(pic8259_0_r, offset, mem_mask); }
384READ16_HANDLER ( pic8259_16le_1_r ) { return read16le_with_read8_handler(pic8259_1_r, offset, mem_mask); }
385WRITE16_HANDLER ( pic8259_16le_0_w ) { write16le_with_write8_handler(pic8259_0_w, offset, data, mem_mask); }
386WRITE16_HANDLER ( pic8259_16le_1_w ) { write16le_with_write8_handler(pic8259_1_w, offset, data, mem_mask); }
387
383388READ32_HANDLER ( pic8259_32le_0_r ) { return read32le_with_read8_handler(pic8259_0_r, offset, mem_mask); }
384389READ32_HANDLER ( pic8259_32le_1_r ) { return read32le_with_read8_handler(pic8259_1_r, offset, mem_mask); }
385390WRITE32_HANDLER ( pic8259_32le_0_w ) { write32le_with_write8_handler(pic8259_0_w, offset, data, mem_mask); }
src/mame/machine/wd33c93.h
r0r870
1/*
2 * wd33c93.h
3 *
4 */
5
6#ifndef _WD33C93_H_
7#define _WD33C93_H_
8
9#include "machine/scsidev.h"
10
11struct WD33C93interface
12{
13   SCSIConfigTable *scsidevs;      /* SCSI devices */
14   void (*irq_callback)(int state);   /* irq callback */
15};
16
17extern void wd33c93_init( struct WD33C93interface *interface );
18extern void wd33c93_get_dma_data(int bytes, UINT8 *pData);
19extern void wd33c93_write_data(int bytes, UINT8 *pData);
20extern void *wd33c93_get_device(int id);
21extern void wd33c93_set_device(int id, void *);
22extern void wd33c93_clear_dma(void);
23extern int wd33c93_get_dma_count(void);
24extern READ8_HANDLER(wd33c93_r);
25extern WRITE8_HANDLER(wd33c93_w);
26
27#endif
src/mame/machine/pic8259.h
r869r870
1919WRITE8_HANDLER ( pic8259_0_w );
2020WRITE8_HANDLER ( pic8259_1_w );
2121
22READ16_HANDLER ( pic8259_16le_0_r );
23READ16_HANDLER ( pic8259_16le_1_r );
24WRITE16_HANDLER ( pic8259_16le_0_w );
25WRITE16_HANDLER ( pic8259_16le_1_w );
26
2227READ32_HANDLER ( pic8259_32le_0_r );
2328READ32_HANDLER ( pic8259_32le_1_r );
2429WRITE32_HANDLER ( pic8259_32le_0_w );
src/mame/machine/tx1.c
r869r870
88
99static INT16 AU_DATA;
1010static INT16 *AU_PTR = &AU_DATA;
11static int inst_index;
11static UINT16 inst_index;
1212
1313/* Internal registers and so forth */
1414static struct Regs
r869r870
588588
589589*/
590590
591READ8_HANDLER(BB_AU_R)
591READ16_HANDLER(BB_AU_R)
592592{
593593UINT8 *AU_instr = (UINT8 *)memory_region(REGION_USER1);
594594//UINT8 *AU_PROM1 = (UINT8 *)memory_region(REGION_PROMS) + 0x1700;
595595//UINT8 *AU_PROM2 = (UINT8 *)memory_region(REGION_PROMS) + 0x1900;
596596
597INT8 value = 0;
597INT16 value = 0;
598598
599599      switch (offset)
600600      {
r869r870
605605        case 0x4:
606606        case 0x5:
607607        case 0x6:
608        case 0x7:
609        case 0x8:
610        case 0x9:
611        case 0xa:
612        case 0xb:
613        case 0xc:
614        case 0xd:
615        case 0xe:    MMI_74S516(offset>>1, (UINT16*)AU_PTR);   /* Typically Instruction 7 - read result(s) */
608        case 0x7:    MMI_74S516(offset, (UINT16*)AU_PTR);   /* Typically Instruction 7 - read result(s) */
616609                     value = *AU_PTR;
617610                     break;
618611
619        case 0xf:    value = (*AU_PTR)>>8;
612        case 0x0e00/2: value = AU_instr[inst_index] | (AU_instr[inst_index] << 8);
620613                     break;
621614
622        case 0x0e00:
623        case 0x0e01: value = AU_instr[inst_index];
624                     break;
625
626        case 0x0680:
615        case 0x0680/2:
627616                     break;                       /* Use to change upper ROM address portion? */
628617
629        case 0x0726:
618        case 0x0726/2:
630619                     break;
631620
632621        default:     value = 0;
r869r870
637626
638627}
639628
640WRITE8_HANDLER(BB_AU_W)
629WRITE16_HANDLER(BB_AU_W)
641630{
642631//UINT8 *AU_PROM1 = (UINT8 *)memory_region(REGION_PROMS) + 0x1700;
643632//UINT8 *AU_PROM2 = (UINT8 *)memory_region(REGION_PROMS) + 0x1900;
r869r870
645634      switch (offset)
646635      {
647636
648        case 0x0:    *AU_PTR = (data & 0xff);
637        case 0x0:    COMBINE_DATA(AU_PTR);
638                     MMI_74S516(offset, (UINT16*)AU_PTR); /* Load values */
649639                     break;
650        case 0x1:    *AU_PTR |= data<<8;
651                     MMI_74S516(offset>>1, (UINT16*)AU_PTR); /* Load values */
652                     break;
653640
654        case 0x2:    *AU_PTR = (data & 0xff);
641        case 0x1:    COMBINE_DATA(AU_PTR);
642                     MMI_74S516(offset, (UINT16*)AU_PTR);
655643                     break;
656        case 0x3:    *AU_PTR |= data<<8;
657                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
658                     break;
659644
660        case 0x4:    *AU_PTR = (data & 0xff);
645        case 0x2:    COMBINE_DATA(AU_PTR);
646                     MMI_74S516(offset, (UINT16*)AU_PTR);
661647                     break;
662        case 0x5:    *AU_PTR |= data<<8;
663                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
664                     break;
665648
666        case 0x6:    *AU_PTR = (data & 0xff);
649        case 0x3:    COMBINE_DATA(AU_PTR);
650                     MMI_74S516(offset, (UINT16*)AU_PTR);
667651                     break;
668        case 0x7:    *AU_PTR |= data<<8;
669                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
670                     break;
671652
672        case 0x8:    *AU_PTR = (data & 0xff);
653        case 0x4:    COMBINE_DATA(AU_PTR);
654                     MMI_74S516(offset, (UINT16*)AU_PTR);
673655                     break;
674        case 0x9:    *AU_PTR |= data<<8;
675                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
676                     break;
677656
678        case 0xa:    *AU_PTR = (data & 0xff);
657        case 0x5:    COMBINE_DATA(AU_PTR);
658                     MMI_74S516(offset, (UINT16*)AU_PTR);
679659                     break;
680        case 0xb:    *AU_PTR |= data<<8;
681                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
682                     break;
683660
684        case 0xc:    *AU_PTR = (data & 0xff);
661        case 0x6:    COMBINE_DATA(AU_PTR);
662                     MMI_74S516(offset, (UINT16*)AU_PTR);
685663                     break;
686        case 0xd:    *AU_PTR |= data<<8;
687                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
688                     break;
689664
690        case 0xe:    *AU_PTR = (data & 0xff);
665        case 0x7:    COMBINE_DATA(AU_PTR);
666                     MMI_74S516(offset, (UINT16*)AU_PTR);
691667                     break;
692        case 0xf:    *AU_PTR |= data<<8;
693                     MMI_74S516(offset>>1, (UINT16*)AU_PTR);
694                     break;
695668
696669       /* Accessing FN ROMs */
697        case 0x0600:
698                     inst_index &= 0xff00;      /* clear lower byte */
699                     inst_index |= data;
700
670        case 0x0600/2:
671                 COMBINE_DATA(&inst_index);
701672                     break;
702673
703        case 0x0601:
704                     inst_index &= 0x00ff;     /* clear upper byte */
705                     inst_index |=(data << 8); /* upper */
706                     break;
707674
708
709        case 0x0680: break;                       /* Increment instruction PROM address */
710        case 0x0726: break;
675        case 0x0680/2: break;                       /* Increment instruction PROM address */
676        case 0x0726/2: break;
711677      }
712678}
713679
src/mame/machine/tatsumi.c
r869r870
2828
2929/******************************************************************************/
3030
31READ8_HANDLER( apache3_bank_r )
31READ16_HANDLER( apache3_bank_r )
3232{
33   if (offset)
34      return tatsumi_control_word>>8;
35   return tatsumi_control_word&0xff;
33   return tatsumi_control_word;
3634}
3735
38WRITE8_HANDLER( apache3_bank_w )
36WRITE16_HANDLER( apache3_bank_w )
3937{
4038   /*
4139        0x8000  - Set when accessing palette ram (not implemented, perhaps blank screen?)
r869r870
4543        0x000f  - OBJ bank to access from main cpu (0x8 = RAM, 0x0 to 0x7 = ROM)
4644    */
4745
48   if (offset==1) tatsumi_control_word=(tatsumi_control_word&0xff)|(data<<8);
49   else tatsumi_control_word=(tatsumi_control_word&0xff00)|(data&0xff);
46   COMBINE_DATA(&tatsumi_control_word);
5047
5148   if (tatsumi_control_word&0x7f00)
5249   {
r869r870
8784   tatsumi_last_irq=data;
8885}
8986
90READ8_HANDLER( apache3_v30_v20_r )
87READ16_HANDLER( apache3_v30_v20_r )
9188{
9289   UINT8 value;
9390
9491   /* Each V20 byte maps to a V30 word */
9592   if ((tatsumi_control_word&0xe0)==0xe0)
96      offset+=0xf8000*2; /* Upper half */
93      offset+=0xf8000; /* Upper half */
9794   else if ((tatsumi_control_word&0xe0)==0xc0)
98      offset+=0xf0000*2;
95      offset+=0xf0000;
9996   else if ((tatsumi_control_word&0xe0)==0x80)
100      offset+=0x00000*2; // main ram
97      offset+=0x00000; // main ram
10198   else
10299      logerror("%08x: unmapped read z80 rom %08x\n",activecpu_get_pc(),offset);
103100
104101   cpuintrf_push_context(2);
105   value = program_read_byte(offset/2);
102   value = program_read_byte(offset);
106103   cpuintrf_pop_context();
107   return value;
104   return value | 0xff00;
108105}
109106
110WRITE8_HANDLER( apache3_v30_v20_w )
107WRITE16_HANDLER( apache3_v30_v20_w )
111108{
112109   if ((tatsumi_control_word&0xe0)!=0x80)
113110      logerror("%08x: write unmapped v30 rom %08x\n",activecpu_get_pc(),offset);
114111
115112   /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */
116   if (offset&1)
117      return;
118
119   cpuintrf_push_context(2);
120   program_write_byte(offset/2, data&0xff);
121   cpuintrf_pop_context();
113   if (ACCESSING_LSB)
114   {
115      cpuintrf_push_context(2);
116      program_write_byte(offset, data&0xff);
117      cpuintrf_pop_context();
118   }
122119}
123120
124121READ16_HANDLER(apache3_z80_r)
r869r870
155152
156153/******************************************************************************/
157154
158READ8_HANDLER( roundup_v30_z80_r )
155READ16_HANDLER( roundup_v30_z80_r )
159156{
160157   UINT8 value;
161158
162159   /* Each Z80 byte maps to a V30 word */
163160   if (tatsumi_control_word&0x20)
164      offset+=0x8000*2; /* Upper half */
161      offset+=0x8000; /* Upper half */
165162
166163   cpuintrf_push_context(2);
167   value = program_read_byte(offset/2);
164   value = program_read_byte(offset);
168165   cpuintrf_pop_context();
169   return value;
166   return value | 0xff00;
170167}
171168
172WRITE8_HANDLER( roundup_v30_z80_w )
169WRITE16_HANDLER( roundup_v30_z80_w )
173170{
174171   /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */
175   if (offset&1)
176      return;
172   if (ACCESSING_LSB)
173   {
174      if (tatsumi_control_word&0x20)
175         offset+=0x8000; /* Upper half of Z80 address space */
177176
178   if (tatsumi_control_word&0x20)
179      offset+=0x10000; /* Upper half of Z80 address space */
180
181   cpuintrf_push_context(2);
182   program_write_byte(offset/2, data&0xff);
183   cpuintrf_pop_context();
177      cpuintrf_push_context(2);
178      program_write_byte(offset, data&0xff);
179      cpuintrf_pop_context();
180   }
184181}
185182
186183
187WRITE8_HANDLER( roundup5_control_w )
184WRITE16_HANDLER( roundup5_control_w )
188185{
189   if (offset==1) tatsumi_control_word=(tatsumi_control_word&0xff)|(data<<8);
190   else tatsumi_control_word=(tatsumi_control_word&0xff00)|(data&0xff);
186   COMBINE_DATA(&tatsumi_control_word);
191187
192188   if (tatsumi_control_word&0x10)
193189      cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
r869r870
307303
308304/******************************************************************************/
309305
310READ8_HANDLER( tatsumi_v30_68000_r )
306READ16_HANDLER( tatsumi_v30_68000_r )
311307{
312308   const UINT16* rom=(UINT16*)memory_region(REGION_CPU2);
313309
310logerror("%05X:68000_r(%04X),cw=%04X\n", activecpu_get_pc(), offset*2, tatsumi_control_word);
314311   /* Read from 68k RAM */
315   if ((tatsumi_control_word&0x1f)==0x18) {
316
312   if ((tatsumi_control_word&0x1f)==0x18)
313   {
317314      // hack to make roundup 5 boot
318      if (activecpu_get_pc()==0xec575) {
315      if (activecpu_get_pc()==0xec575)
316      {
319317         UINT8 *dst = memory_region(REGION_CPU1);
320         dst[0xec57a]=0x46;
321         dst[0xec57b]=0x46;
318         dst[BYTE_XOR_LE(0xec57a)]=0x46;
319         dst[BYTE_XOR_LE(0xec57b)]=0x46;
322320
323         dst[0xfc520]=0x46; //code that stops cpu after coin counter goes mad..
324         dst[0xfc521]=0x46;
325         dst[0xfc522]=0x46;
326         dst[0xfc523]=0x46;
327         dst[0xfc524]=0x46;
328         dst[0xfc525]=0x46;
321         dst[BYTE_XOR_LE(0xfc520)]=0x46; //code that stops cpu after coin counter goes mad..
322         dst[BYTE_XOR_LE(0xfc521)]=0x46;
323         dst[BYTE_XOR_LE(0xfc522)]=0x46;
324         dst[BYTE_XOR_LE(0xfc523)]=0x46;
325         dst[BYTE_XOR_LE(0xfc524)]=0x46;
326         dst[BYTE_XOR_LE(0xfc525)]=0x46;
329327      }
330328
331      if ((offset&1)==0) return tatsumi_68k_ram[offset/2]&0xff;
332      return (tatsumi_68k_ram[offset/2]>>8)&0xff;
329      return tatsumi_68k_ram[offset & 0x1fff];
333330   }
334331
335332   /* Read from 68k ROM */
336   offset+=(tatsumi_control_word&0x7)*0x10000;
333   offset+=(tatsumi_control_word&0x7)*0x8000;
337334
338   if ((offset&1)==0) return rom[offset/2]&0xff;
339   return (rom[offset/2]>>8)&0xff;
335   return rom[offset];
340336}
341337
342WRITE8_HANDLER( tatsumi_v30_68000_w )
338WRITE16_HANDLER( tatsumi_v30_68000_w )
343339{
344   UINT16 d=tatsumi_68k_ram[offset/2];
345   if ((offset&1)==0) d=(d&0xff00)|data;
346   else d=(d&0xff)|(data<<8);
347
348340   if ((tatsumi_control_word&0x1f)!=0x18)
349341      logerror("68k write in bank %05x\n",tatsumi_control_word);
350342
351   tatsumi_68k_ram[offset/2]=d;
343   COMBINE_DATA(&tatsumi_68k_ram[offset]);
352344}
353345
354346/***********************************************************************************/
src/mame/machine/leland.c
r869r870
401401   if (slave_length > 0x10000)
402402      memory_set_bankptr(3, &slave_base[0x10000]);
403403
404   /* if we have an I86 CPU, reset it */
405   if (machine->drv->cpu[2].cpu_type == CPU_I186)
406      leland_i186_sound_init();
404   /* if we have an I80186 CPU, reset it */
405   if (machine->drv->cpu[2].cpu_type == CPU_I80186)
406      leland_80186_sound_init();
407407}
408408
409409
r869r870
449449   if (slave_length > 0x10000)
450450      memory_set_bankptr(3, &slave_base[0x10000]);
451451
452   /* reset the I186 */
453   leland_i186_sound_init();
452   /* reset the 80186 */
453   leland_80186_sound_init();
454454}
455455
456456
r869r870
518518   (*leland_update_master_bank)();
519519
520520   /* sound control is in the rest */
521   leland_i86_control_w(offset, data);
521   leland_80186_control_w(offset, data);
522522}
523523
524524
src/mame/machine/bonzeadv.c
r869r870
373373 *
374374 *************************************/
375375
376WRITE16_HANDLER( bonzeadv_c_chip_w )
376WRITE16_HANDLER( bonzeadv_cchip_ctrl_w )
377377{
378   /* value 2 is written here */
379}
380
381WRITE16_HANDLER( bonzeadv_cchip_bank_w )
382{
383   current_bank = data & 7;
384}
385
386WRITE16_HANDLER( bonzeadv_cchip_ram_w )
387{
378388//  if (activecpu_get_pc()!=0xa028)
379389//  logerror("%08x:  write %04x %04x cchip\n", activecpu_get_pc(), offset, data);
380390
381   if (offset == 0x600)
382   {
383      current_bank = data;
384   }
385
386391   if (current_bank == 0)
387392   {
388      if (offset == 0x008)
393      if (offset == 0x08)
389394      {
390395         cc_port = data;
391396
r869r870
395400         coin_counter_w(0, data & 0x10);
396401      }
397402
398      if (offset == 0x00E && data != 0x00)
403      if (offset == 0x0e && data != 0x00)
399404      {
400405         WriteRestartPos(current_round);
401406      }
402407
403      if (offset == 0x00F && data != 0x00)
408      if (offset == 0x0f && data != 0x00)
404409      {
405410         WriteLevelData();
406411      }
407412
408      if (offset == 0x010)
413      if (offset == 0x10)
409414      {
410415         current_round = data;
411416      }
412417
413      if (offset >= 0x011 && offset <= 0x02A)
418      if (offset >= 0x11 && offset <= 0x2a)
414419      {
415420         cval[offset - 0x11] = data;
416421      }
r869r870
423428 *
424429 *************************************/
425430
426READ16_HANDLER( bonzeadv_c_chip_r )
431READ16_HANDLER( bonzeadv_cchip_ctrl_r )
427432{
433   /*
434        Bit 2 = Error signal
435        Bit 0 = Ready signal
436    */
437   return 0x01; /* Return 0x05 for C-Chip error */
438}
439
440READ16_HANDLER( bonzeadv_cchip_ram_r )
441{
428442//  logerror("%08x:  read %04x cchip\n", activecpu_get_pc(), offset);
429443
430   /* C-chip ID */
431   if (offset == 0x401)
432   {
433      return 0x01;
434   }
435
436444   if (current_bank == 0)
437445   {
438446      switch (offset)
439447      {
440      case 0x003: return input_port_2_word_r(offset, mem_mask);
441      case 0x004: return input_port_3_word_r(offset, mem_mask);
442      case 0x005: return input_port_4_word_r(offset, mem_mask);
443      case 0x006: return input_port_5_word_r(offset, mem_mask);
444      case 0x008: return cc_port;
448      case 0x03: return readinputportbytag("800007");    /* STARTn + SERVICE1 */
449      case 0x04: return readinputportbytag("800009");    /* COINn */
450      case 0x05: return readinputportbytag("80000B");    /* Player controls + TILT */
451      case 0x06: return readinputportbytag("80000D");    /* Player controls (cocktail) */
452      case 0x08: return cc_port;
445453      }
446454
447      if (offset == 0x00E)
455      if (offset == 0x0e)
448456      {
449457         return restart_status; /* 0xff signals error, 0 signals ok */
450458      }
451459
452      if (offset >= 0x011 && offset <= 0x2A)
460      if (offset >= 0x11 && offset <= 0x2a)
453461      {
454462         return cval[offset - 0x11];
455463      }
src/mame/machine/8255ppi.c
r869r870
9292
9393#include "driver.h"
9494#include "8255ppi.h"
95#include "memconv.h"
9596
9697
9798static int num;
r869r870
569570WRITE8_HANDLER( ppi8255_5_w ) { ppi8255_w( 5, offset, data ); }
570571WRITE8_HANDLER( ppi8255_6_w ) { ppi8255_w( 6, offset, data ); }
571572WRITE8_HANDLER( ppi8255_7_w ) { ppi8255_w( 7, offset, data ); }
573
574READ16_HANDLER( ppi8255_16le_0_r ) { return read16le_with_read8_handler(ppi8255_0_r, offset, mem_mask); }
575READ16_HANDLER( ppi8255_16le_1_r ) { return read16le_with_read8_handler(ppi8255_1_r, offset, mem_mask); }
576READ16_HANDLER( ppi8255_16le_2_r ) { return read16le_with_read8_handler(ppi8255_2_r, offset, mem_mask); }
577READ16_HANDLER( ppi8255_16le_3_r ) { return read16le_with_read8_handler(ppi8255_3_r, offset, mem_mask); }
578READ16_HANDLER( ppi8255_16le_4_r ) { return read16le_with_read8_handler(ppi8255_4_r, offset, mem_mask); }
579READ16_HANDLER( ppi8255_16le_5_r ) { return read16le_with_read8_handler(ppi8255_5_r, offset, mem_mask); }
580READ16_HANDLER( ppi8255_16le_6_r ) { return read16le_with_read8_handler(ppi8255_6_r, offset, mem_mask); }
581READ16_HANDLER( ppi8255_16le_7_r ) { return read16le_with_read8_handler(ppi8255_7_r, offset, mem_mask); }
582WRITE16_HANDLER( ppi8255_16le_0_w ) { write16le_with_write8_handler(ppi8255_0_w, offset, data, mem_mask); }
583WRITE16_HANDLER( ppi8255_16le_1_w ) { write16le_with_write8_handler(ppi8255_1_w, offset, data, mem_mask); }
584WRITE16_HANDLER( ppi8255_16le_2_w ) { write16le_with_write8_handler(ppi8255_2_w, offset, data, mem_mask); }
585WRITE16_HANDLER( ppi8255_16le_3_w ) { write16le_with_write8_handler(ppi8255_3_w, offset, data, mem_mask); }
586WRITE16_HANDLER( ppi8255_16le_4_w ) { write16le_with_write8_handler(ppi8255_4_w, offset, data, mem_mask); }
587WRITE16_HANDLER( ppi8255_16le_5_w ) { write16le_with_write8_handler(ppi8255_5_w, offset, data, mem_mask); }
588WRITE16_HANDLER( ppi8255_16le_6_w ) { write16le_with_write8_handler(ppi8255_6_w, offset, data, mem_mask); }
589WRITE16_HANDLER( ppi8255_16le_7_w ) { write16le_with_write8_handler(ppi8255_7_w, offset, data, mem_mask); }
src/mame/machine/8255ppi.h
r869r870
6464WRITE8_HANDLER( ppi8255_6_w );
6565WRITE8_HANDLER( ppi8255_7_w );
6666
67READ16_HANDLER( ppi8255_16le_0_r );
68READ16_HANDLER( ppi8255_16le_1_r );
69READ16_HANDLER( ppi8255_16le_2_r );
70READ16_HANDLER( ppi8255_16le_3_r );
71READ16_HANDLER( ppi8255_16le_4_r );
72READ16_HANDLER( ppi8255_16le_5_r );
73READ16_HANDLER( ppi8255_16le_6_r );
74READ16_HANDLER( ppi8255_16le_7_r );
75WRITE16_HANDLER( ppi8255_16le_0_w );
76WRITE16_HANDLER( ppi8255_16le_1_w );
77WRITE16_HANDLER( ppi8255_16le_2_w );
78WRITE16_HANDLER( ppi8255_16le_3_w );
79WRITE16_HANDLER( ppi8255_16le_4_w );
80WRITE16_HANDLER( ppi8255_16le_5_w );
81WRITE16_HANDLER( ppi8255_16le_6_w );
82WRITE16_HANDLER( ppi8255_16le_7_w );
83
6784#ifdef MESS
6885/* Peek at the ports */
6986UINT8 ppi8255_peek( int which, offs_t offset );
src/mame/machine/pcshare.c
r869r870
272272
273273
274274
275READ16_HANDLER(pc_page16le_r) { return read16le_with_read8_handler(pc_page_r, offset, mem_mask); }
276WRITE16_HANDLER(pc_page16le_w) { write16le_with_write8_handler(pc_page_w, offset, data, mem_mask); }
277
278
279
275280READ8_HANDLER(at_page8_r)
276281{
277282   UINT8 data = at_pages[offset % 0x10];
r869r870
364369static struct dma8237_interface pc_dma =
365370{
366371   0,
367   TIME_IN_USEC(1),
372   1.0e-6,   // 1us
368373
369374   pc_dma_read_byte,
370375   pc_dma_write_byte,
r869r870
528533
529534void pc_keyb_set_clock(int on)
530535{
531   mame_time keyb_delay = double_to_mame_time(1/200.0);
536   mame_time keyb_delay = { 0, MAX_SUBSECONDS/200 };   // 5ms
532537
533538   on = on ? 1 : 0;
534539
src/mame/machine/pcshare.h
r869r870
2020READ8_HANDLER(pc_page_r);
2121WRITE8_HANDLER(pc_page_w);
2222
23READ16_HANDLER(pc_page16le_r);
24WRITE16_HANDLER(pc_page16le_w);
25
2326READ8_HANDLER(at_page8_r);
2427WRITE8_HANDLER(at_page8_w);
2528
src/mame/machine/laserdsc.c
r869r870
21722172
21732173#if 0
21742174      {
2175         int usecdiff = SUBSECONDS_TO_DOUBLE(delta.subseconds) / TIME_IN_USEC(1);
2175         int usecdiff = (int)(delta.subseconds / USEC_TO_SUBSECONDS(1));
21762176
21772177         printf( "bitdelta = %d\n", usecdiff );
21782178      }
src/mame/machine/8237dma.c
r869r870
433433WRITE8_HANDLER( dma8237_0_w ) { dma8237_write(0, offset, data); }
434434WRITE8_HANDLER( dma8237_1_w ) { dma8237_write(1, offset, data); }
435435
436READ16_HANDLER( dma8237_16le_0_r ) { return read16le_with_read8_handler(dma8237_0_r, offset, mem_mask); }
437READ16_HANDLER( dma8237_16le_1_r ) { return read16le_with_read8_handler(dma8237_1_r, offset, mem_mask); }
438WRITE16_HANDLER( dma8237_16le_0_w ) { write16le_with_write8_handler(dma8237_0_w, offset, data, mem_mask); }
439WRITE16_HANDLER( dma8237_16le_1_w ) { write16le_with_write8_handler(dma8237_1_w, offset, data, mem_mask); }
440
436441READ32_HANDLER( dma8237_32le_0_r ) { return read32le_with_read8_handler(dma8237_0_r, offset, mem_mask); }
437442READ32_HANDLER( dma8237_32le_1_r ) { return read32le_with_read8_handler(dma8237_1_r, offset, mem_mask); }
438443WRITE32_HANDLER( dma8237_32le_0_w ) { write32le_with_write8_handler(dma8237_0_w, offset, data, mem_mask); }
src/mame/machine/8237dma.h
r869r870
4545WRITE8_HANDLER( dma8237_0_w );
4646WRITE8_HANDLER( dma8237_1_w );
4747
48READ16_HANDLER( dma8237_16le_0_r );
49READ16_HANDLER( dma8237_16le_1_r );
50WRITE16_HANDLER( dma8237_16le_0_w );
51WRITE16_HANDLER( dma8237_16le_1_w );
52
4853READ32_HANDLER( dma8237_32le_0_r );
4954READ32_HANDLER( dma8237_32le_1_r );
5055WRITE32_HANDLER( dma8237_32le_0_w );
src/mame/machine/opwolf.c
r869r870
3737
3838#include "driver.h"
3939
40/* Select how coinage data is initialised in opwolf_cchip_data_w : 0 = user-defined in function - 1 = automatic */
41#define OPWOLF_READ_COINAGE_FROM_ROM   1
42
43/* List of possible regions */
44enum {
45   OPWOLF_REGION_BAD=0,
46   OPWOLF_REGION_JAPAN,
47   OPWOLF_REGION_US,
48   OPWOLF_REGION_WORLD,
49   OPWOLF_REGION_OTHER
50};
51
52extern int opwolf_region;
53
4054static UINT8 current_bank=0;
4155static UINT8 current_cmd=0;
4256static UINT8* cchip_ram=0;
4357static UINT8 cchip_last_7a=0;
4458static UINT8 cchip_last_04=0;
4559static UINT8 cchip_last_05=0;
46static UINT8 cchip_coins_for_credit_a=1;
47static UINT8 cchip_credit_for_coin_b=2;
48static UINT8 cchip_coins=0;
60static UINT8 cchip_coins_for_credit[2]={1,1};
61static UINT8 cchip_credits_for_coin[2]={1,1};
62static UINT8 cchip_coins[2]={0,0};
4963static UINT8 c588=0, c589=0, c58a=0; // These variables derived from the bootleg
5064
5165static const UINT16 level_data_00[0xcc] =
r869r870
349363      {
350364      case 3:
351365         cchip_ram[0x2c]=0x46;
352         cchip_ram[0x77]=0x5;
366         cchip_ram[0x77]=0x05;
353367         cchip_ram[0x25]=0x11;
354         cchip_ram[0x26]=0xe;
368         cchip_ram[0x26]=0x0e;
355369         break;
356370      case 0:
357371         cchip_ram[0x2c]=0x30;
358         cchip_ram[0x77]=0x6;
359         cchip_ram[0x25]=0xb;
360         cchip_ram[0x26]=0x3;
372         cchip_ram[0x77]=0x06;
373         cchip_ram[0x25]=0x0b;
374         cchip_ram[0x26]=0x03;
361375         break;
362376      case 1:
363377         cchip_ram[0x2c]=0x3a;
364         cchip_ram[0x77]=0x5;
365         cchip_ram[0x25]=0xf;
366         cchip_ram[0x26]=0x9;
378         cchip_ram[0x77]=0x05;
379         cchip_ram[0x25]=0x0f;
380         cchip_ram[0x26]=0x09;
367381         break;
368382      case 2:
369383         cchip_ram[0x2c]=0x4c;
370         cchip_ram[0x77]=0x4;
384         cchip_ram[0x77]=0x04;
371385         cchip_ram[0x25]=0x19;
372386         cchip_ram[0x26]=0x11;
373387         break;
r869r870
408422   if (current_bank == 0)
409423   {
410424      // Dip switch A is written here by the 68k - precalculate the coinage values
425      // Shouldn't we directly read the values from the ROM area ?
411426      if (offset == 0x14)
412427      {
413         switch (data&0x30)
428#if OPWOLF_READ_COINAGE_FROM_ROM
429         UINT16* rom=(UINT16*)memory_region(REGION_CPU1);
430         UINT32 coin_table[2]={0,0};
431         UINT8 coin_offset[2];
432         int slot;
433
434         if ((opwolf_region == OPWOLF_REGION_JAPAN) || (opwolf_region == OPWOLF_REGION_US))
414435         {
415         case 0x00: cchip_coins_for_credit_a=4; break;
416         case 0x10: cchip_coins_for_credit_a=3; break;
417         case 0x20: cchip_coins_for_credit_a=2; break;
418         case 0x30: cchip_coins_for_credit_a=1; break;
436            coin_table[0] = 0x03ffce;
437            coin_table[1] = 0x03ffce;
419438         }
439         if ((opwolf_region == OPWOLF_REGION_WORLD) || (opwolf_region == OPWOLF_REGION_OTHER))
440         {
441            coin_table[0] = 0x03ffde;
442            coin_table[1] = 0x03ffee;
443         }
444         coin_offset[0] = 12 - (4 * ((data & 0x30) >> 4));
445         coin_offset[1] = 12 - (4 * ((data & 0xc0) >> 6));
420446
421         switch (data&0xc0)
447         for (slot=0; slot<2; slot++)
422448         {
423         case 0x00: cchip_credit_for_coin_b=6; break;
424         case 0x40: cchip_credit_for_coin_b=4; break;
425         case 0x80: cchip_credit_for_coin_b=3; break;
426         case 0xc0: cchip_credit_for_coin_b=2; break;
449            if (coin_table[slot])
450            {
451               cchip_coins_for_credit[slot] = rom[(coin_table[slot] + coin_offset[slot] + 0) / 2] & 0xff;
452               cchip_credits_for_coin[slot] = rom[(coin_table[slot] + coin_offset[slot] + 2) / 2] & 0xff;
453            }
427454         }
455#else
456         if ((opwolf_region == OPWOLF_REGION_JAPAN) || (opwolf_region == OPWOLF_REGION_US))
457         {
458            switch (data&0x30)   /* table at 0x03ffce.w - 4 * 2 words (coins for credits first) - inverted order */
459            {
460               case 0x00: cchip_coins_for_credit[0]=2; cchip_credits_for_coin[0]=3; break;
461               case 0x10: cchip_coins_for_credit[0]=2; cchip_credits_for_coin[0]=1; break;
462               case 0x20: cchip_coins_for_credit[0]=1; cchip_credits_for_coin[0]=2; break;
463               case 0x30: cchip_coins_for_credit[0]=1; cchip_credits_for_coin[0]=1; break;
464            }
465            switch (data&0xc0)   /* table at 0x03ffce.w - 4 * 2 words (coins for credits first) - inverted order */
466            {
467               case 0x00: cchip_coins_for_credit[1]=2; cchip_credits_for_coin[1]=3; break;
468               case 0x40: cchip_coins_for_credit[1]=2; cchip_credits_for_coin[1]=1; break;
469               case 0x80: cchip_coins_for_credit[1]=1; cchip_credits_for_coin[1]=2; break;
470               case 0xc0: cchip_coins_for_credit[1]=1; cchip_credits_for_coin[1]=1; break;
471            }
472         }
473
474         if ((opwolf_region == OPWOLF_REGION_WORLD) || (opwolf_region == OPWOLF_REGION_OTHER))
475         {
476            switch (data&0x30)   /* table at 0x03ffde.w - 4 * 2 words (coins for credits first) - inverted order */
477            {
478               case 0x00: cchip_coins_for_credit[0]=4; cchip_credits_for_coin[0]=1; break;
479               case 0x10: cchip_coins_for_credit[0]=3; cchip_credits_for_coin[0]=1; break;
480               case 0x20: cchip_coins_for_credit[0]=2; cchip_credits_for_coin[0]=1; break;
481               case 0x30: cchip_coins_for_credit[0]=1; cchip_credits_for_coin[0]=1; break;
482            }
483            switch (data&0xc0)   /* table at 0x03ffee.w - 4 * 2 words (coins for credits first) - inverted order */
484            {
485               case 0x00: cchip_coins_for_credit[1]=1; cchip_credits_for_coin[1]=6; break;
486               case 0x40: cchip_coins_for_credit[1]=1; cchip_credits_for_coin[1]=4; break;
487               case 0x80: cchip_coins_for_credit[1]=1; cchip_credits_for_coin[1]=3; break;
488               case 0xc0: cchip_coins_for_credit[1]=1; cchip_credits_for_coin[1]=2; break;
489            }
490         }
491#endif
428492      }
429493
430494      // Dip switch B
r869r870
468532static TIMER_CALLBACK( cchip_timer )
469533{
470534   // Update input ports, these are used by both the 68k directly and by the c-chip
471   cchip_ram[0x4]=input_port_0_word_r(0,0);
472   cchip_ram[0x5]=input_port_1_word_r(0,0);
535   cchip_ram[0x4]=readinputportbytag("IN0");
536   cchip_ram[0x5]=readinputportbytag("IN1");
473537
474   // Update coins - cchip handles coinage according to dipswitch A
538   // Coin slots
475539   if (cchip_ram[0x4]!=cchip_last_04)
476540   {
477      // Coin slot A
478      if (cchip_ram[0x4]&1)
541      int slot=-1;
542
543      if (cchip_ram[0x4]&1) slot=0;
544      if (cchip_ram[0x4]&2) slot=1;
545
546      if (slot != -1)
479547      {
480         cchip_coins++;
481         if (cchip_coins >= cchip_coins_for_credit_a)
548         cchip_coins[slot]++;
549         if (cchip_coins[slot] >= cchip_coins_for_credit[slot])
482550         {
483            cchip_ram[0x53]++;
551            cchip_ram[0x53]+=cchip_credits_for_coin[slot];
484552            cchip_ram[0x51]=0x55;
485553            cchip_ram[0x52]=0x55;
486            cchip_coins=0;
554            cchip_coins[slot]-=cchip_coins_for_credit[slot];
487555         }
488         coin_counter_w(0, 1);
556         coin_counter_w(slot, 1);
489557      }
490558
491      // Coin slot B
492      if (cchip_ram[0x4]&2)
493      {
494         cchip_ram[0x53]+=cchip_credit_for_coin_b;
495         cchip_ram[0x51]=0x55;
496         cchip_ram[0x52]=0x55;
497         coin_counter_w(1, 1);
498      }
499
500559      if (cchip_ram[0x53]>9)
501560         cchip_ram[0x53]=9;
502561   }
r869r870
670729   state_save_register_global(c588);
671730   state_save_register_global(c589);
672731   state_save_register_global(c58a);
673   state_save_register_global(cchip_coins);
674   state_save_register_global(cchip_coins_for_credit_a);
675   state_save_register_global(cchip_credit_for_coin_b);
732   state_save_register_global(cchip_coins[0]);
733   state_save_register_global(cchip_coins[1]);
734   state_save_register_global(cchip_coins_for_credit[0]);
735   state_save_register_global(cchip_credits_for_coin[0]);
736   state_save_register_global(cchip_coins_for_credit[1]);
737   state_save_register_global(cchip_credits_for_coin[1]);
676738   state_save_register_global_pointer(cchip_ram, 0x400 * 8);
677739
678740   cchip_last_7a=0;
679741   cchip_last_04=0xfc;
680742   cchip_last_05=0xff;
681   cchip_coins=0;
682   cchip_coins_for_credit_a=1;
683   cchip_credit_for_coin_b=2;
743   cchip_coins[0]=0;
744   cchip_coins[1]=0;
745   cchip_coins_for_credit[0]=1;
746   cchip_credits_for_coin[0]=1;
747   cchip_coins_for_credit[1]=1;
748   cchip_credits_for_coin[1]=1;
684749
685750   mame_timer_pulse(MAME_TIME_IN_HZ(60), 0, cchip_timer);
686751}
src/mame/machine/pit8253.c
r869r870
11961196WRITE16_HANDLER ( pit8253_0_lsb_w ) { if (ACCESSING_LSB) pit8253_write(0, offset, data); }
11971197WRITE16_HANDLER ( pit8253_1_lsb_w ) { if (ACCESSING_LSB) pit8253_write(1, offset, data); }
11981198
1199READ16_HANDLER ( pit8253_16le_0_r ) { return read16le_with_read8_handler(pit8253_0_r, offset, mem_mask); }
1200READ16_HANDLER ( pit8253_16le_1_r ) { return read16le_with_read8_handler(pit8253_1_r, offset, mem_mask); }
1201WRITE16_HANDLER   ( pit8253_16le_0_w ) { write16le_with_write8_handler(pit8253_0_w, offset, data,   mem_mask); }
1202WRITE16_HANDLER   ( pit8253_16le_1_w ) { write16le_with_write8_handler(pit8253_1_w, offset, data,   mem_mask); }
1203
11991204READ32_HANDLER ( pit8253_32le_0_r ) { return read32le_with_read8_handler(pit8253_0_r, offset, mem_mask); }
12001205READ32_HANDLER ( pit8253_32le_1_r ) { return read32le_with_read8_handler(pit8253_1_r, offset, mem_mask); }
12011206WRITE32_HANDLER   ( pit8253_32le_0_w ) { write32le_with_write8_handler(pit8253_0_w, offset, data,   mem_mask); }
src/mame/machine/pit8253.h
r869r870
3535WRITE16_HANDLER ( pit8253_0_lsb_w );
3636WRITE16_HANDLER ( pit8253_1_lsb_w );
3737
38READ16_HANDLER ( pit8253_16le_0_r );
39READ16_HANDLER ( pit8253_16le_1_r );
40WRITE16_HANDLER ( pit8253_16le_0_w );
41WRITE16_HANDLER ( pit8253_16le_1_w );
42
3843READ32_HANDLER ( pit8253_32le_0_r );
3944READ32_HANDLER ( pit8253_32le_1_r );
4045WRITE32_HANDLER ( pit8253_32le_0_w );
src/mame/machine/mc146818.c
r869r870
360360
361361
362362
363READ16_HANDLER(mc146818_port16le_r)
364{
365   return read16le_with_read8_handler(mc146818_port_r, offset, mem_mask);
366}
367
368WRITE16_HANDLER(mc146818_port16le_w)
369{
370   write16le_with_write8_handler(mc146818_port_w, offset, data, mem_mask);
371}
372
363373READ32_HANDLER(mc146818_port32le_r)
364374{
365375   return read32le_with_read8_handler(mc146818_port_r, offset, mem_mask);
src/mame/mamedriv.c
r869r870
61006100   DRIVER( rdftau )   /* (c) 1996 Seibu Kaihatsu */
61016101   DRIVER( rdftj )      /* (c) 1996 Seibu Kaihatsu */
61026102   DRIVER( rdftdi )   /* (c) 1996 Seibu Kaihatsu (Dream Island license) */
6103   DRIVER( rdftit )   /* (c) 1996 Seibu Kaihatsu */
61036104
61046105   DRIVER( rdft2 )      /* (c) 1997 Seibu Kaihatsu (Tuning License) */
61056106   DRIVER( rdft2a )   /* (c) 1997 Seibu Kaihatsu (Metrotainment license) */
r869r870
69946995   DRIVER( dunhuang )   /* (c) 199? */
69956996
69966997   DRIVER( iqblocka )   /* (c) 1996 */
6998   DRIVER( iqblockf )   /* (c) 1996 */
69976999   DRIVER( tjsb )      /* (c) 1997 */
69987000
69997001   DRIVER( lhzb2 )      /* (c) 1998 */
r869r870
76897691   DRIVER( kingpin )   /* (c) 1983 American Communications Laboratories Inc. */
76907692   DRIVER( kingpinm )   /* (c) 1983 American Communications Laboratories Inc. */
76917693   DRIVER( thayers )   /* (c) 1983 RDI Video Systems */
7694   DRIVER( thayersa )   /* (c) 1983 RDI Video Systems */
76927695
76937696#endif   /* DRIVER_RECURSIVE */
src/mame/includes/leland.h
r869r870
103103
104104void *leland_sh_start(int clock, const struct CustomSound_interface *config);
105105
106void *leland_i186_sh_start(int clock, const struct CustomSound_interface *config);
107void *redline_i186_sh_start(int clock, const struct CustomSound_interface *config);
106void *leland_80186_sh_start(int clock, const struct CustomSound_interface *config);
107void *redline_80186_sh_start(int clock, const struct CustomSound_interface *config);
108108void leland_dac_update(int dacnum, UINT8 sample);
109109
110void leland_i186_sound_init(void);
110void leland_80186_sound_init(void);
111111
112READ8_HANDLER( leland_i86_response_r );
112READ8_HANDLER( leland_80186_response_r );
113113
114WRITE8_HANDLER( leland_i86_control_w );
115WRITE8_HANDLER( leland_i86_command_lo_w );
116WRITE8_HANDLER( leland_i86_command_hi_w );
117WRITE8_HANDLER( ataxx_i86_control_w );
114WRITE8_HANDLER( leland_80186_control_w );
115WRITE8_HANDLER( leland_80186_command_lo_w );
116WRITE8_HANDLER( leland_80186_command_hi_w );
117WRITE8_HANDLER( ataxx_80186_control_w );
118118
119ADDRESS_MAP_EXTERN(leland_i86_map_program);
120ADDRESS_MAP_EXTERN(leland_i86_map_io);
121ADDRESS_MAP_EXTERN(redline_i86_map_io);
122ADDRESS_MAP_EXTERN(ataxx_i86_map_io);
119ADDRESS_MAP_EXTERN(leland_80186_map_program);
120ADDRESS_MAP_EXTERN(leland_80186_map_io);
121ADDRESS_MAP_EXTERN(redline_80186_map_io);
122ADDRESS_MAP_EXTERN(ataxx_80186_map_io);
123123
124124
125125/*----------- defined in video/leland.c -----------*/
src/mame/includes/m92.h
r0r870
1/*************************************************************************
2
3    Irem M92 hardware
4
5*************************************************************************/
6
7/*----------- defined in video/m92.c -----------*/
8
9extern int m92_raster_irq_position, m92_raster_enable;
10extern UINT16 *m92_vram_data, *m92_spritecontrol;
11
12extern UINT8 m92_sprite_buffer_busy, m92_game_kludge;
13
14WRITE16_HANDLER( m92_spritecontrol_w );
15WRITE16_HANDLER( m92_videocontrol_w );
16READ16_HANDLER( m92_paletteram_r );
17WRITE16_HANDLER( m92_paletteram_w );
18WRITE16_HANDLER( m92_vram_w );
19WRITE16_HANDLER( m92_pf1_control_w );
20WRITE16_HANDLER( m92_pf2_control_w );
21WRITE16_HANDLER( m92_pf3_control_w );
22WRITE16_HANDLER( m92_master_control_w );
23
24VIDEO_START( m92 );
25VIDEO_UPDATE( m92 );
src/mame/includes/amiga.h
r869r870
7878#define REG_BLTDPTH      (0x054/2)   /* W  A      Blitter pointer to destination D (high 3 bits) */
7979#define REG_BLTDPTL      (0x056/2)   /* W  A      Blitter pointer to destination D (low 15 bits) */
8080#define REG_BLTSIZE      (0x058/2)   /* W  A      Blitter start and size (window width, height) */
81#define REG_BLTSIZV      (0x05C/2)   /* W  A      Blitter V size (for 15 bit vertical size) (ECS) */
82#define REG_BLTSIZH      (0x05E/2)   /* W  A      Blitter H size and start (for 11 bit H size) (ECS) */
8183#define REG_BLTCMOD      (0x060/2)   /* W  A      Blitter modulo for source C */
8284#define REG_BLTBMOD      (0x062/2)   /* W  A      Blitter modulo for source B */
8385#define REG_BLTAMOD      (0x064/2)   /* W  A      Blitter modulo for source A */
src/mame/includes/m107.h
r0r870
1/*************************************************************************
2
3    Irem M107 hardware
4
5*************************************************************************/
6
7
8/*----------- defined in video/m107.c -----------*/
9
10extern UINT16 *m107_vram_data;
11extern UINT8 m107_spritesystem;
12extern UINT16 m107_raster_irq_position;
13
14WRITE16_HANDLER( m107_spritebuffer_w );
15VIDEO_UPDATE( m107 );
16VIDEO_UPDATE( dsoccr );
17VIDEO_START( m107 );
18WRITE16_HANDLER( m107_control_w );
19WRITE16_HANDLER( m107_vram_w );
src/mame/includes/tatsumi.h
r869r870
66extern UINT8* tatsumi_rom_clut1;
77
88extern UINT16 *roundup5_d0000_ram, *roundup5_e0000_ram;
9extern UINT8 *roundup5_unknown0, *roundup5_unknown1, *roundup5_unknown2;
9extern UINT16 *roundup5_unknown0, *roundup5_unknown1, *roundup5_unknown2;
1010
1111/*----------- defined in machine/tatsumi.c -----------*/
1212
13READ8_HANDLER( apache3_bank_r );
14WRITE8_HANDLER( apache3_bank_w );
13READ16_HANDLER( apache3_bank_r );
14WRITE16_HANDLER( apache3_bank_w );
1515WRITE16_HANDLER( apache3_irq_ack_w );
16READ8_HANDLER( apache3_v30_v20_r );
17WRITE8_HANDLER( apache3_v30_v20_w );
18READ8_HANDLER( roundup_v30_z80_r );
19WRITE8_HANDLER( roundup_v30_z80_w );
20READ8_HANDLER( tatsumi_v30_68000_r );
21WRITE8_HANDLER( tatsumi_v30_68000_w ) ;
16READ16_HANDLER( apache3_v30_v20_r );
17WRITE16_HANDLER( apache3_v30_v20_w );
18READ16_HANDLER( roundup_v30_z80_r );
19WRITE16_HANDLER( roundup_v30_z80_w );
20READ16_HANDLER( tatsumi_v30_68000_r );
21WRITE16_HANDLER( tatsumi_v30_68000_w ) ;
2222READ16_HANDLER(apache3_z80_r);
2323WRITE16_HANDLER(apache3_z80_w);
2424READ8_HANDLER( apache3_adc_r );
2525WRITE8_HANDLER( apache3_adc_w );
2626WRITE16_HANDLER(cyclwarr_control_w);
2727READ16_HANDLER(cyclwarr_control_r);
28WRITE8_HANDLER( roundup5_control_w );
28WRITE16_HANDLER( roundup5_control_w );
2929WRITE16_HANDLER( apache3_a0000_w );
3030WRITE16_HANDLER( roundup5_d0000_w );
3131WRITE16_HANDLER( roundup5_e0000_w );
r869r870
4242
4343/*----------- defined in video/tatsumi.c -----------*/
4444
45WRITE8_HANDLER(roundup5_palette_w);
46WRITE16_HANDLER(tatsumi_sprite_control_w);
47WRITE8_HANDLER( roundup5_text_w );
48WRITE8_HANDLER( roundup5_crt_w );
45WRITE16_HANDLER( roundup5_palette_w );
46WRITE16_HANDLER( tatsumi_sprite_control_w );
47WRITE16_HANDLER( roundup5_text_w );
48WRITE16_HANDLER( roundup5_crt_w );
4949READ16_HANDLER( cyclwarr_videoram_r );
5050WRITE16_HANDLER( cyclwarr_videoram_w );
5151READ16_HANDLER( cyclwarr_videoram2_r );
5252WRITE16_HANDLER( cyclwarr_videoram2_w );
53READ8_HANDLER(roundup5_vram_r);
54WRITE8_HANDLER(roundup5_vram_w);
55WRITE8_HANDLER(apache3_palette_w);
53READ16_HANDLER(roundup5_vram_r);
54WRITE16_HANDLER(roundup5_vram_w);
55WRITE16_HANDLER(apache3_palette_w);
5656
5757extern UINT16* tatsumi_sprite_control_ram;
5858extern UINT16 *cyclwarr_videoram, *cyclwarr_videoram2;
src/mame/includes/m72.h
r0r870
1/*************************************************************************
2
3    Irem M72 hardware
4
5*************************************************************************/
6
7/*----------- defined in video/m72.c -----------*/
8
9extern UINT16 *m72_videoram1,*m72_videoram2,*majtitle_rowscrollram;
10
11MACHINE_RESET( m72 );
12MACHINE_RESET( xmultipl );
13MACHINE_RESET( kengo );
14
15INTERRUPT_GEN( m72_interrupt );
16
17VIDEO_START( m72 );
18VIDEO_START( rtype2 );
19VIDEO_START( majtitle );
20VIDEO_START( hharry );
21VIDEO_START( poundfor );
22
23READ16_HANDLER( m72_palette1_r );
24READ16_HANDLER( m72_palette2_r );
25WRITE16_HANDLER( m72_palette1_w );
26WRITE16_HANDLER( m72_palette2_w );
27WRITE16_HANDLER( m72_videoram1_w );
28WRITE16_HANDLER( m72_videoram2_w );
29WRITE16_HANDLER( m72_irq_line_w );
30WRITE16_HANDLER( m72_scrollx1_w );
31WRITE16_HANDLER( m72_scrollx2_w );
32WRITE16_HANDLER( m72_scrolly1_w );
33WRITE16_HANDLER( m72_scrolly2_w );
34WRITE16_HANDLER( m72_dmaon_w );
35WRITE16_HANDLER( m72_port02_w );
36WRITE16_HANDLER( rtype2_port02_w );
37WRITE16_HANDLER( majtitle_gfx_ctrl_w );
38
39VIDEO_UPDATE( m72 );
40VIDEO_UPDATE( majtitle );
src/mame/mame.mak
r869r870
5050CPUS += DECO16
5151CPUS += M4510
5252CPUS += H6280
53CPUS += I86
54CPUS += I88
55CPUS += I186
56CPUS += I188
57CPUS += I286
53CPUS += I8086
54CPUS += I8088
55CPUS += I80186
56CPUS += I80188
57CPUS += I80286
5858CPUS += V20
59CPUS += V25
5960CPUS += V30
6061CPUS += V33
62CPUS += V35
6163CPUS += V60
6264CPUS += V70
6365CPUS += I8035
r869r870
435437   $(MACHINE)/ticket.o \
436438   $(MACHINE)/timekpr.o \
437439   $(MACHINE)/tmp68301.o \
440   $(MACHINE)/wd33c93.o \
438441   $(MACHINE)/z80ctc.o \
439442   $(MACHINE)/z80pio.o \
440443   $(MACHINE)/z80sio.o \
src/mame/video/dynduke.c
r869r870
22#include "driver.h"
33
44static tilemap *bg_layer,*fg_layer,*tx_layer;
5UINT8 *dynduke_back_data,*dynduke_fore_data,*dynduke_scroll_ram;
5UINT16 *dynduke_back_data,*dynduke_fore_data,*dynduke_scroll_ram;
66
77static int back_bankbase,fore_bankbase,back_palbase;
88static int back_enable,fore_enable,sprite_enable;
99
1010/******************************************************************************/
1111
12WRITE8_HANDLER( dynduke_paletteram_w )
12WRITE16_HANDLER( dynduke_paletteram_w )
1313{
1414   int color;
1515
16   paletteram[offset]=data;
17   color=paletteram[offset&0xffe]|(paletteram[offset|1]<<8);
18   palette_set_color_rgb(Machine,offset/2,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8));
16   COMBINE_DATA(&paletteram16[offset]);
17   color=paletteram16[offset];
18   palette_set_color_rgb(Machine,offset,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8));
1919
2020   /* This is a kludge to handle 5bpp graphics but 4bpp palette data */
2121   /* the 5th bit is actually transparency, so I should use TILEMAP_TYPE_PEN */
22   if (offset<1024) {
23      palette_set_color_rgb(Machine,((offset&0x1f)/2) | (offset&0xffe0) | 2048,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8));
24      palette_set_color_rgb(Machine,((offset&0x1f)/2) | (offset&0xffe0) | 2048 | 16,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8));
22   if (offset<512)
23   {
24      palette_set_color_rgb(Machine,(offset&0x0f) | ((offset*2)&0xffe0) | 2048,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8));
25      palette_set_color_rgb(Machine,(offset&0x0f) | ((offset*2)&0xffe0) | 2048 | 16,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8));
2526   }
2627}
2728
28WRITE8_HANDLER( dynduke_background_w )
29WRITE16_HANDLER( dynduke_background_w )
2930{
30   dynduke_back_data[offset]=data;
31   tilemap_mark_tile_dirty(bg_layer,offset/2);
31   COMBINE_DATA(&dynduke_back_data[offset]);
32   tilemap_mark_tile_dirty(bg_layer,offset);
3233}
3334
34WRITE8_HANDLER( dynduke_foreground_w )
35WRITE16_HANDLER( dynduke_foreground_w )
3536{
36   dynduke_fore_data[offset]=data;
37   tilemap_mark_tile_dirty(fg_layer,offset/2);
37   COMBINE_DATA(&dynduke_fore_data[offset]);
38   tilemap_mark_tile_dirty(fg_layer,offset);
3839}
3940
40WRITE8_HANDLER( dynduke_text_w )
41WRITE16_HANDLER( dynduke_text_w )
4142{
42   videoram[offset]=data;
43   tilemap_mark_tile_dirty(tx_layer,offset/2);
43   COMBINE_DATA(&videoram16[offset]);
44   tilemap_mark_tile_dirty(tx_layer,offset);
4445}
4546
4647static TILE_GET_INFO( get_bg_tile_info )
4748{
48   int tile=dynduke_back_data[2*tile_index]+(dynduke_back_data[2*tile_index+1]<<8);
49   int tile=dynduke_back_data[tile_index];
4950   int color=tile >> 12;
5051
5152   tile=tile&0xfff;
r869r870
5960
6061static TILE_GET_INFO( get_fg_tile_info )
6162{
62   int tile=dynduke_fore_data[2*tile_index]+(dynduke_fore_data[2*tile_index+1]<<8);
63   int tile=dynduke_fore_data[tile_index];
6364   int color=tile >> 12;
6465
6566   tile=tile&0xfff;
r869r870
7374
7475static TILE_GET_INFO( get_tx_tile_info )
7576{
76   int tile=videoram[2*tile_index]+((videoram[2*tile_index+1]&0xc0)<<2);
77   int color=videoram[2*tile_index+1]&0xf;
77   int tile=videoram16[tile_index];
78   int color=(tile >> 8) & 0x0f;
7879
80   tile = (tile & 0xff) | ((tile & 0xc000) >> 6);
81
7982   SET_TILE_INFO(
8083         0,
8184         tile,
r869r870
9598   tilemap_set_transparent_pen(tx_layer,15);
9699}
97100
98WRITE8_HANDLER( dynduke_gfxbank_w )
101WRITE16_HANDLER( dynduke_gfxbank_w )
99102{
100103   static int old_back,old_fore;
101104
102   if (data&0x01) back_bankbase=0x1000; else back_bankbase=0;
103   if (data&0x10) fore_bankbase=0x1000; else fore_bankbase=0;
105   if (ACCESSING_LSB)
106   {
107      if (data&0x01) back_bankbase=0x1000; else back_bankbase=0;
108      if (data&0x10) fore_bankbase=0x1000; else fore_bankbase=0;
104109
105   if (back_bankbase!=old_back)
106      tilemap_mark_all_tiles_dirty(bg_layer);
107   if (fore_bankbase!=old_fore)
108      tilemap_mark_all_tiles_dirty(fg_layer);
110      if (back_bankbase!=old_back)
111         tilemap_mark_all_tiles_dirty(bg_layer);
112      if (fore_bankbase!=old_fore)
113         tilemap_mark_all_tiles_dirty(fg_layer);
109114
110   old_back=back_bankbase;
111   old_fore=fore_bankbase;
115      old_back=back_bankbase;
116      old_fore=fore_bankbase;
117   }
112118}
113119
114WRITE8_HANDLER( dynduke_control_w )
120WRITE16_HANDLER( dynduke_control_w )
115121{
116122   static int old_bpal;
117123
118   if (data&0x1) back_enable=0; else back_enable=1;
119   if (data&0x2) back_palbase=16; else back_palbase=0;
120   if (data&0x4) fore_enable=0; else fore_enable=1;
121   if (data&0x8) sprite_enable=0; else sprite_enable=1;
124   if (ACCESSING_LSB)
125   {
126      if (data&0x1) back_enable=0; else back_enable=1;
127      if (data&0x2) back_palbase=16; else back_palbase=0;
128      if (data&0x4) fore_enable=0; else fore_enable=1;
129      if (data&0x8) sprite_enable=0; else sprite_enable=1;
122130
123   if (back_palbase!=old_bpal)
124      tilemap_mark_all_tiles_dirty(bg_layer);
131      if (back_palbase!=old_bpal)
132         tilemap_mark_all_tiles_dirty(bg_layer);
125133
126   old_bpal=back_palbase;
127   flip_screen_set(data & 0x40);
134      old_bpal=back_palbase;
135      flip_screen_set(data & 0x40);
136   }
128137}
129138
130139static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri)
r869r870
133142
134143   if (!sprite_enable) return;
135144
136   for (offs = 0x1000-8;offs >= 0;offs -= 8)
145   for (offs = 0x800-4;offs >= 0;offs -= 4)
137146   {
138147      /* Don't draw empty sprite table entries */
139      if (buffered_spriteram[offs+7]!=0xf) continue;
140      if (((buffered_spriteram[offs+5]>>5)&3)!=pri) continue;
148      if ((buffered_spriteram16[offs+3] >> 8)!=0xf) continue;
149      if (((buffered_spriteram16[offs+2]>>13)&3)!=pri) continue;
141150
142      fx= buffered_spriteram[offs+1]&0x20;
143      fy= buffered_spriteram[offs+1]&0x40;
144      y = buffered_spriteram[offs+0];
145      x = buffered_spriteram[offs+4];
151      fx= buffered_spriteram16[offs+0]&0x2000;
152      fy= buffered_spriteram16[offs+0]&0x4000;
153      y = buffered_spriteram16[offs+0] & 0xff;
154      x = buffered_spriteram16[offs+2] & 0xff;
146155
147      if (buffered_spriteram[offs+5]&1) x=0-(0x100-x);
156      if (buffered_spriteram16[offs+2]&0x100) x=0-(0x100-x);
148157
149      color = buffered_spriteram[offs+1]&0x1f;
150      sprite = buffered_spriteram[offs+2]+(buffered_spriteram[offs+3]<<8);
158      color = (buffered_spriteram16[offs+0]>>8)&0x1f;
159      sprite = buffered_spriteram16[offs+1];
151160      sprite &= 0x3fff;
152161
153162      if (flip_screen) {
r869r870
167176VIDEO_UPDATE( dynduke )
168177{
169178   /* Setup the tilemaps */
170   tilemap_set_scrolly( bg_layer,0, ((dynduke_scroll_ram[0x02]&0x30)<<4)+((dynduke_scroll_ram[0x04]&0x7f)<<1)+((dynduke_scroll_ram[0x04]&0x80)>>7) );
171   tilemap_set_scrollx( bg_layer,0, ((dynduke_scroll_ram[0x12]&0x30)<<4)+((dynduke_scroll_ram[0x14]&0x7f)<<1)+((dynduke_scroll_ram[0x14]&0x80)>>7) );
172   tilemap_set_scrolly( fg_layer,0, ((dynduke_scroll_ram[0x22]&0x30)<<4)+((dynduke_scroll_ram[0x24]&0x7f)<<1)+((dynduke_scroll_ram[0x24]&0x80)>>7) );
173   tilemap_set_scrollx( fg_layer,0, ((dynduke_scroll_ram[0x32]&0x30)<<4)+((dynduke_scroll_ram[0x34]&0x7f)<<1)+((dynduke_scroll_ram[0x34]&0x80)>>7) );
179   tilemap_set_scrolly( bg_layer,0, ((dynduke_scroll_ram[0x01]&0x30)<<4)+((dynduke_scroll_ram[0x02]&0x7f)<<1)+((dynduke_scroll_ram[0x02]&0x80)>>7) );
180   tilemap_set_scrollx( bg_layer,0, ((dynduke_scroll_ram[0x09]&0x30)<<4)+((dynduke_scroll_ram[0x0a]&0x7f)<<1)+((dynduke_scroll_ram[0x0a]&0x80)>>7) );
181   tilemap_set_scrolly( fg_layer,0, ((dynduke_scroll_ram[0x11]&0x30)<<4)+((dynduke_scroll_ram[0x12]&0x7f)<<1)+((dynduke_scroll_ram[0x12]&0x80)>>7) );
182   tilemap_set_scrollx( fg_layer,0, ((dynduke_scroll_ram[0x19]&0x30)<<4)+((dynduke_scroll_ram[0x1a]&0x7f)<<1)+((dynduke_scroll_ram[0x1a]&0x80)>>7) );
174183   tilemap_set_enable( bg_layer,back_enable);
175184   tilemap_set_enable( fg_layer,fore_enable);
176185
r869r870
191200
192201VIDEO_EOF( dynduke )
193202{
194   buffer_spriteram_w(0,0); // Could be a memory location instead
203   buffer_spriteram16_w(0,0,0); // Could be a memory location instead
195204}
src/mame/video/deadang.c
r869r870
22
33static tilemap *pf3_layer,*pf2_layer,*pf1_layer,*text_layer;
44static int deadangle_tilebank, deadangle_oldtilebank;
5UINT8 *deadang_video_data,*deadang_scroll_ram;
5UINT16 *deadang_video_data,*deadang_scroll_ram;
66
77/******************************************************************************/
88
9WRITE8_HANDLER( deadang_foreground_w )
9WRITE16_HANDLER( deadang_foreground_w )
1010{
11   deadang_video_data[offset]=data;
12   tilemap_mark_tile_dirty( pf1_layer, offset/2 );
11   COMBINE_DATA(&deadang_video_data[offset]);
12   tilemap_mark_tile_dirty( pf1_layer, offset );
1313}
1414
15WRITE8_HANDLER( deadang_text_w )
15WRITE16_HANDLER( deadang_text_w )
1616{
17   videoram[offset]=data;
18   tilemap_mark_tile_dirty( text_layer, offset/2 );
17   COMBINE_DATA(&videoram16[offset]);
18   tilemap_mark_tile_dirty( text_layer, offset );
1919}
2020
21WRITE8_HANDLER( deadang_bank_w )
21WRITE16_HANDLER( deadang_bank_w )
2222{
23   deadangle_tilebank = data&1;
24   if (deadangle_tilebank!=deadangle_oldtilebank) {
25      deadangle_oldtilebank = deadangle_tilebank;
26      tilemap_mark_all_tiles_dirty (pf1_layer);
23   if (ACCESSING_LSB)
24   {
25      deadangle_tilebank = data&1;
26      if (deadangle_tilebank!=deadangle_oldtilebank)
27      {
28         deadangle_oldtilebank = deadangle_tilebank;
29         tilemap_mark_all_tiles_dirty (pf1_layer);
30      }
2731   }
2832}
2933
r869r870
3640
3741static TILE_GET_INFO( get_pf3_tile_info )
3842{
39   const UINT8 *bgMap = memory_region(REGION_GFX6);
40   int code=(bgMap[tile_index*2]<<8) | bgMap[tile_index*2+1];
43   const UINT16 *bgMap = (const UINT16 *)memory_region(REGION_GFX6);
44   int code= bgMap[tile_index];
4145   SET_TILE_INFO(4,code&0x7ff,code>>12,0);
4246}
4347
4448static TILE_GET_INFO( get_pf2_tile_info )
4549{
46   const UINT8 *bgMap = memory_region(REGION_GFX7);
47   int code=(bgMap[tile_index*2]<<8) | bgMap[tile_index*2+1];
50   const UINT16 *bgMap = (const UINT16 *)memory_region(REGION_GFX7);
51   int code= bgMap[tile_index];
4852   SET_TILE_INFO(3,code&0x7ff,code>>12,0);
4953}
5054
5155static TILE_GET_INFO( get_pf1_tile_info )
5256{
53   int offs=tile_index*2;
54   int tile=deadang_video_data[offs]+(deadang_video_data[offs+1]<<8);
57   int tile=deadang_video_data[tile_index];
5558   int color=tile >> 12;
5659   tile=tile&0xfff;
5760
r869r870
6063
6164static TILE_GET_INFO( get_text_tile_info )
6265{
63   int offs=tile_index*2;
64   int tile=videoram[offs]+((videoram[offs+1]&0xc0)<<2);
65   int color=videoram[offs+1]&0xf;
66   int tile=(videoram16[tile_index] & 0xff) | ((videoram16[tile_index] >> 6) & 0x300);
67   int color=(videoram16[tile_index] >> 8)&0xf;
6668
6769   SET_TILE_INFO(0,tile,color,0);
6870}
r869r870
8385{
8486   int offs,fx,fy,x,y,color,sprite,pri;
8587
86   for (offs = 0; offs<0x800; offs+=8)
88   for (offs = 0; offs<0x800/2; offs+=4)
8789   {
8890      /* Don't draw empty sprite table entries */
89      if (spriteram[offs+7]!=0xf) continue;
91      if ((spriteram16[offs+3] & 0xff00)!=0xf00) continue;
9092
91      switch (spriteram[offs+5]&0xc0) {
93      switch (spriteram16[offs+2]&0xc000) {
9294      default:
93      case 0xc0: pri=0; break; /* Unknown */
94      case 0x80: pri=0; break; /* Over all playfields */
95      case 0x40: pri=0xf0; break; /* Under top playfield */
96      case 0x00: pri=0xf0|0xcc; break; /* Under middle playfield */
95      case 0xc000: pri=0; break; /* Unknown */
96      case 0x8000: pri=0; break; /* Over all playfields */
97      case 0x4000: pri=0xf0; break; /* Under top playfield */
98      case 0x0000: pri=0xf0|0xcc; break; /* Under middle playfield */
9799      }
98100
99      fx= spriteram[offs+1]&0x20;
100      fy= spriteram[offs+1]&0x40;
101      y = spriteram[offs+0];
102      x = spriteram[offs+4];
101      fx= spriteram16[offs+0]&0x2000;
102      fy= spriteram16[offs+0]&0x4000;
103      y = spriteram16[offs+0] & 0xff;
104      x = spriteram16[offs+2] & 0xff;
103105      if (fy) fy=0; else fy=1;
104      if (spriteram[offs+5]&1) x=0-(0xff-x);
106      if (spriteram16[offs+2]&0x100) x=0-(0xff-x);
105107
106      color = (spriteram[offs+3]>>4)&0xf;
107      sprite = (spriteram[offs+2]+(spriteram[offs+3]<<8))&0xfff;
108      color = (spriteram16[offs+1]>>12)&0xf;
109      sprite = spriteram16[offs+1]&0xfff;
108110
109111      if (flip_screen) {
110112         x=240-x;
r869r870
123125VIDEO_UPDATE( deadang )
124126{
125127   /* Setup the tilemaps */
126   tilemap_set_scrolly( pf3_layer,0, ((deadang_scroll_ram[0x02]&0xf0)<<4)+((deadang_scroll_ram[0x04]&0x7f)<<1)+((deadang_scroll_ram[0x04]&0x80)>>7) );
127   tilemap_set_scrollx( pf3_layer,0, ((deadang_scroll_ram[0x12]&0xf0)<<4)+((deadang_scroll_ram[0x14]&0x7f)<<1)+((deadang_scroll_ram[0x14]&0x80)>>7) );
128   tilemap_set_scrolly( pf1_layer,0, ((deadang_scroll_ram[0x22]&0x10)<<4)+((deadang_scroll_ram[0x24]&0x7f)<<1)+((deadang_scroll_ram[0x24]&0x80)>>7) );
129   tilemap_set_scrollx( pf1_layer,0, ((deadang_scroll_ram[0x32]&0x10)<<4)+((deadang_scroll_ram[0x34]&0x7f)<<1)+((deadang_scroll_ram[0x34]&0x80)>>7) );
130   tilemap_set_scrolly( pf2_layer,0, ((deadang_scroll_ram[0x42]&0xf0)<<4)+((deadang_scroll_ram[0x44]&0x7f)<<1)+((deadang_scroll_ram[0x44]&0x80)>>7) );
131   tilemap_set_scrollx( pf2_layer,0, ((deadang_scroll_ram[0x52]&0xf0)<<4)+((deadang_scroll_ram[0x54]&0x7f)<<1)+((deadang_scroll_ram[0x54]&0x80)>>7) );
128   tilemap_set_scrolly( pf3_layer,0, ((deadang_scroll_ram[0x01]&0xf0)<<4)+((deadang_scroll_ram[0x02]&0x7f)<<1)+((deadang_scroll_ram[0x02]&0x80)>>7) );
129   tilemap_set_scrollx( pf3_layer,0, ((deadang_scroll_ram[0x09]&0xf0)<<4)+((deadang_scroll_ram[0x0a]&0x7f)<<1)+((deadang_scroll_ram[0x0a]&0x80)>>7) );
130   tilemap_set_scrolly( pf1_layer,0, ((deadang_scroll_ram[0x11]&0x10)<<4)+((deadang_scroll_ram[0x12]&0x7f)<<1)+((deadang_scroll_ram[0x12]&0x80)>>7) );
131   tilemap_set_scrollx( pf1_layer,0, ((deadang_scroll_ram[0x19]&0x10)<<4)+((deadang_scroll_ram[0x1a]&0x7f)<<1)+((deadang_scroll_ram[0x1a]&0x80)>>7) );
132   tilemap_set_scrolly( pf2_layer,0, ((deadang_scroll_ram[0x21]&0xf0)<<4)+((deadang_scroll_ram[0x22]&0x7f)<<1)+((deadang_scroll_ram[0x22]&0x80)>>7) );
133   tilemap_set_scrollx( pf2_layer,0, ((deadang_scroll_ram[0x29]&0xf0)<<4)+((deadang_scroll_ram[0x2a]&0x7f)<<1)+((deadang_scroll_ram[0x2a]&0x80)>>7) );
132134
133135   /* Control byte:
134136        0x01: Background playfield disable
r869r870
140142        0x40: Flipscreen
141143        0x80: Always set?
142144    */
143   tilemap_set_enable(pf3_layer,!(deadang_scroll_ram[0x68]&1));
144   tilemap_set_enable(pf1_layer,!(deadang_scroll_ram[0x68]&2));
145   tilemap_set_enable(pf2_layer,!(deadang_scroll_ram[0x68]&4));
146   flip_screen_set( deadang_scroll_ram[0x68]&0x40 );
145   tilemap_set_enable(pf3_layer,!(deadang_scroll_ram[0x34]&1));
146   tilemap_set_enable(pf1_layer,!(deadang_scroll_ram[0x34]&2));
147   tilemap_set_enable(pf2_layer,!(deadang_scroll_ram[0x34]&4));
148   flip_screen_set( deadang_scroll_ram[0x34]&0x40 );
147149
148150   fillbitmap(bitmap,get_black_pen(machine),cliprect);
149151   fillbitmap(priority_bitmap,0,cliprect);
150152   tilemap_draw(bitmap,cliprect,pf3_layer,0,1);
151153   tilemap_draw(bitmap,cliprect,pf1_layer,0,2);
152154   tilemap_draw(bitmap,cliprect,pf2_layer,0,4);
153   if (!(deadang_scroll_ram[0x68]&0x10)) draw_sprites(machine,bitmap,cliprect);
155   if (!(deadang_scroll_ram[0x34]&0x10)) draw_sprites(machine,bitmap,cliprect);
154156   tilemap_draw(bitmap,cliprect,text_layer,0,0);
155157   return 0;
156158}
src/mame/video/bfm_adr2.c
r869r870
477477   AM_RANGE(0xC001, 0xC001) AM_WRITE(adder2_c001_w)         // ??
478478
479479   AM_RANGE(0xC101, 0xC101) AM_READWRITE(adder2_vbl_ctrl_r, adder2_vbl_ctrl_w)
480   AM_RANGE(0xC103, 0xC103) AM_READ(adder2_irq_r);            // IRQ latch read
480   AM_RANGE(0xC103, 0xC103) AM_READ(adder2_irq_r)            // IRQ latch read
481481
482482   // MC6850 compatible uart connected to main (scorpion2) board ///////////////////////////////////////
483483
484   AM_RANGE(0xC200, 0xC200) AM_READWRITE( adder2_uart_ctrl_r, adder2_uart_ctrl_w );// 6850 compatible uart control reg
485   AM_RANGE(0xC201, 0xC201) AM_READWRITE( adder2_uart_rx_r, adder2_uart_tx_w );   // 6850 compatible uart data reg
484   AM_RANGE(0xC200, 0xC200) AM_READWRITE( adder2_uart_ctrl_r, adder2_uart_ctrl_w )   // 6850 compatible uart control reg
485   AM_RANGE(0xC201, 0xC201) AM_READWRITE( adder2_uart_rx_r, adder2_uart_tx_w )   // 6850 compatible uart data reg
486486
487487   AM_RANGE(0xE000, 0xFFFF) AM_ROM                        // 8k  ROM
488488ADDRESS_MAP_END
src/mame/video/raiden.c
r869r870
22#include "driver.h"
33
44static tilemap *bg_layer,*fg_layer,*tx_layer;
5UINT8 *raiden_back_data,*raiden_fore_data,*raiden_scroll_ram;
5UINT16 *raiden_back_data,*raiden_fore_data,*raiden_scroll_ram;
66
77static int flipscreen,ALTERNATE;
88
99/******************************************************************************/
1010
11READ8_HANDLER( raiden_background_r )
11WRITE16_HANDLER( raiden_background_w )
1212{
13   return raiden_back_data[offset];
13   COMBINE_DATA(&raiden_back_data[offset]);
14   tilemap_mark_tile_dirty(bg_layer, offset);
1415}
1516
16READ8_HANDLER( raiden_foreground_r )
17WRITE16_HANDLER( raiden_foreground_w )
1718{
18   return raiden_fore_data[offset];
19   COMBINE_DATA(&raiden_fore_data[offset]);
20   tilemap_mark_tile_dirty(fg_layer, offset);
1921}
2022
21WRITE8_HANDLER( raiden_background_w )
23WRITE16_HANDLER( raiden_text_w )
2224{
23   raiden_back_data[offset]=data;
24   tilemap_mark_tile_dirty( bg_layer,offset/2);
25   COMBINE_DATA(&videoram16[offset]);
26   tilemap_mark_tile_dirty(tx_layer, offset);
2527}
2628
27WRITE8_HANDLER( raiden_foreground_w )
28{
29   raiden_fore_data[offset]=data;
30   tilemap_mark_tile_dirty( fg_layer,offset/2);
31}
32
33WRITE8_HANDLER( raiden_text_w )
34{
35   videoram[offset]=data;
36   tilemap_mark_tile_dirty( tx_layer,offset/2);
37}
38
39WRITE8_HANDLER( raidena_text_w )
40{
41   videoram[offset]=data;
42   tilemap_mark_tile_dirty( tx_layer,offset/2);
43}
44
4529static TILE_GET_INFO( get_back_tile_info )
4630{
47   int tile=raiden_back_data[2*tile_index]+(raiden_back_data[2*tile_index+1]<<8);
31   int tile=raiden_back_data[tile_index];
4832   int color=tile >> 12;
4933
5034   tile=tile&0xfff;
r869r870
5842
5943static TILE_GET_INFO( get_fore_tile_info )
6044{
61   int tile=raiden_fore_data[2*tile_index]+(raiden_fore_data[2*tile_index+1]<<8);
45   int tile=raiden_fore_data[tile_index];
6246   int color=tile >> 12;
6347
6448   tile=tile&0xfff;
r869r870
7256
7357static TILE_GET_INFO( get_text_tile_info )
7458{
75   int tile=videoram[2*tile_index]+((videoram[2*tile_index+1]&0xc0)<<2);
76   int color=videoram[2*tile_index+1]&0xf;
59   int tiledata = videoram16[tile_index];
60   int tile = (tiledata & 0xff) | ((tiledata >> 6) & 0x300);
61   int color = (tiledata >> 8) & 0x0f;
7762
7863   SET_TILE_INFO(
7964         0,
r869r870
10489   tilemap_set_transparent_pen(tx_layer,15);
10590}
10691
107WRITE8_HANDLER( raiden_control_w )
92WRITE16_HANDLER( raiden_control_w )
10893{
10994   /* All other bits unknown - could be playfield enables */
11095
11196   /* Flipscreen */
112   if (offset==6) {
97   if (offset==3 && ACCESSING_LSB) {
11398      flipscreen=data&0x2;
11499      tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
115100   }
r869r870
119104{
120105   int offs,fx,fy,x,y,color,sprite;
121106
122   for (offs = 0x1000-8;offs >= 0;offs -= 8)
107   for (offs = 0x1000/2-4;offs >= 0;offs -= 4)
123108   {
124      /* Don't draw empty sprite table entries */
125      if (buffered_spriteram[offs+7]!=0xf) continue;
126      if (!(pri_mask&buffered_spriteram[offs+5])) continue;
109      if (!(pri_mask&(buffered_spriteram16[offs+2]>>8))) continue;
127110
128      fx= buffered_spriteram[offs+1]&0x20;
129      fy= buffered_spriteram[offs+1]&0x40;
130      y = buffered_spriteram[offs+0];
131      x = buffered_spriteram[offs+4];
111      fx    = buffered_spriteram16[offs+0] & 0x2000;
112      fy    = buffered_spriteram16[offs+0] & 0x4000;
113      color = (buffered_spriteram16[offs+0] & 0x0f00) >> 8;
114      y = buffered_spriteram16[offs+0] & 0x00ff;
132115
133      if (buffered_spriteram[offs+5]&1) x=0-(0x100-x);
134
135      color = buffered_spriteram[offs+1]&0xf;
136      sprite = buffered_spriteram[offs+2]+(buffered_spriteram[offs+3]<<8);
116      sprite = buffered_spriteram16[offs+1];
137117      sprite &= 0x0fff;
138118
119      x = buffered_spriteram16[offs+2] & 0xff;
120      if (buffered_spriteram16[offs+2] & 0x100) x=0-(0x100-x);
121
139122      if (flipscreen) {
140123         x=240-x;
141124         y=240-y;
r869r870
154137{
155138   /* Setup the tilemaps, alternate version has different scroll positions */
156139   if (!ALTERNATE) {
157      tilemap_set_scrollx( bg_layer,0, ((raiden_scroll_ram[1]<<8)+raiden_scroll_ram[0]) );
158      tilemap_set_scrolly( bg_layer,0, ((raiden_scroll_ram[3]<<8)+raiden_scroll_ram[2]) );
159      tilemap_set_scrollx( fg_layer,0, ((raiden_scroll_ram[5]<<8)+raiden_scroll_ram[4]) );
160      tilemap_set_scrolly( fg_layer,0, ((raiden_scroll_ram[7]<<8)+raiden_scroll_ram[6]) );
140      tilemap_set_scrollx( bg_layer,0, raiden_scroll_ram[0]);
141      tilemap_set_scrolly( bg_layer,0, raiden_scroll_ram[1]);
142      tilemap_set_scrollx( fg_layer,0, raiden_scroll_ram[2]);
143      tilemap_set_scrolly( fg_layer,0, raiden_scroll_ram[3]);
161144   }
162145   else {
163      tilemap_set_scrolly( bg_layer,0, ((raiden_scroll_ram[0x02]&0x30)<<4)+((raiden_scroll_ram[0x04]&0x7f)<<1)+((raiden_scroll_ram[0x04]&0x80)>>7) );
164      tilemap_set_scrollx( bg_layer,0, ((raiden_scroll_ram[0x12]&0x30)<<4)+((raiden_scroll_ram[0x14]&0x7f)<<1)+((raiden_scroll_ram[0x14]&0x80)>>7) );
165      tilemap_set_scrolly( fg_layer,0, ((raiden_scroll_ram[0x22]&0x30)<<4)+((raiden_scroll_ram[0x24]&0x7f)<<1)+((raiden_scroll_ram[0x24]&0x80)>>7) );
166      tilemap_set_scrollx( fg_layer,0, ((raiden_scroll_ram[0x32]&0x30)<<4)+((raiden_scroll_ram[0x34]&0x7f)<<1)+((raiden_scroll_ram[0x34]&0x80)>>7) );
146      tilemap_set_scrolly( bg_layer,0, ((raiden_scroll_ram[0x01]&0x30)<<4)+((raiden_scroll_ram[0x02]&0x7f)<<1)+((raiden_scroll_ram[0x02]&0x80)>>7) );
147      tilemap_set_scrollx( bg_layer,0, ((raiden_scroll_ram[0x09]&0x30)<<4)+((raiden_scroll_ram[0x0a]&0x7f)<<1)+((raiden_scroll_ram[0x0a]&0x80)>>7) );
148      tilemap_set_scrolly( fg_layer,0, ((raiden_scroll_ram[0x11]&0x30)<<4)+((raiden_scroll_ram[0x12]&0x7f)<<1)+((raiden_scroll_ram[0x12]&0x80)>>7) );
149      tilemap_set_scrollx( fg_layer,0, ((raiden_scroll_ram[0x19]&0x30)<<4)+((raiden_scroll_ram[0x1a]&0x7f)<<1)+((raiden_scroll_ram[0x1a]&0x80)>>7) );
167150   }
168151
169152   tilemap_draw(bitmap,cliprect,bg_layer,0,0);
src/mame/video/tx1.c
r869r870
77
88#include "driver.h"
99
10extern UINT8 *buggyb1_vram;
11extern UINT8 *buggyboy_vram;
12extern UINT8 *bb_objram;
13extern UINT8 *bb_sky;
10extern UINT16 *buggyb1_vram;
11extern UINT16 *buggyboy_vram;
12extern UINT16 *bb_objram;
13extern UINT16 *bb_sky;
1414
1515extern tilemap *buggyb1_tilemap;
1616extern tilemap *buggyboy_tilemap;
1717extern size_t bb_objectram_size;
1818
1919
20extern UINT8 *tx1_vram;
21extern UINT8 *tx1_object_ram;
20extern UINT16 *tx1_vram;
21extern UINT16 *tx1_object_ram;
2222
2323extern tilemap *tx1_tilemap;
2424extern size_t tx1_objectram_size;
r869r870
2727/* TX-1 */
2828/********/
2929
30WRITE8_HANDLER( tx1_vram_w )
30WRITE16_HANDLER( tx1_vram_w )
3131{
32   tx1_vram[offset] = data;
33   tilemap_mark_tile_dirty(tx1_tilemap,offset/2);
32   COMBINE_DATA(&tx1_vram[offset]);
33   tilemap_mark_tile_dirty(tx1_tilemap,offset);
3434}
3535
3636static TILE_GET_INFO( get_tx1_tile_info )
3737{
38   int bit15, upper, lower, tileno;
38   int tileno = (tx1_vram[tile_index]&0x03ff) | ((tx1_vram[tile_index] & 0x8000) >> 5);
3939
40   tile_index <<= 1;
41   bit15 = (tx1_vram[tile_index+1] & 0x80)<<6;
42   upper = (tx1_vram[tile_index+1]&0x03)<<11;
43   lower = (tx1_vram[tile_index]<<3);
44   tileno = (bit15 | upper | lower)/8;
45
4640   SET_TILE_INFO(0,tileno,0,0);
4741}
4842
r869r870
161155}
162156
163157
164WRITE8_HANDLER( buggyb1_vram_w )
158WRITE16_HANDLER( buggyb1_vram_w )
165159{
166   buggyb1_vram[offset] = data;
167   tilemap_mark_tile_dirty(buggyb1_tilemap,offset/2);
160   COMBINE_DATA(&buggyb1_vram[offset]);
161   tilemap_mark_tile_dirty(buggyb1_tilemap,offset);
168162}
169163
170WRITE8_HANDLER( buggyboy_vram_w )
164WRITE16_HANDLER( buggyboy_vram_w )
171165{
172   buggyboy_vram[offset] = data;
173   tilemap_mark_tile_dirty(buggyboy_tilemap,offset/2);
166   COMBINE_DATA(&buggyboy_vram[offset]);
167   tilemap_mark_tile_dirty(buggyboy_tilemap,offset);
174168}
175169
176170
177171static TILE_GET_INFO( get_buggyb1_tile_info )
178172{
179   int color, bit15, upper, lower, tileno;
173   int color, tileno;
180174
181   tile_index <<= 1;
182   color = ((buggyb1_vram[tile_index+1] >>2) & 0x3f);
183   bit15 = (buggyb1_vram[tile_index+1] & 0x80);
184   upper = (buggyb1_vram[tile_index+1]&0x03)<<11;
185   lower = (buggyb1_vram[tile_index]<<3);
186   tileno = ((bit15 << 6) | upper | lower)/8;
175   color = ((buggyb1_vram[tile_index] >>10) & 0x3f);
176   tileno = (buggyb1_vram[tile_index]&0x03ff) | ((buggyb1_vram[tile_index] & 0x8000) >> 5);
187177
188178   SET_TILE_INFO(0,tileno,color,0);
189179}
190180
191181static TILE_GET_INFO( get_buggyboy_tile_info )
192182{
193     int color, bit15, upper, lower, tileno;
183   int color, tileno;
194184
195   tile_index <<= 1;
196   color = ((buggyboy_vram[tile_index+1] >>2) & 0x3f);
197   bit15 = (buggyboy_vram[tile_index+1] & 0x80)<<6;
198   upper = (buggyboy_vram[tile_index+1]&0x03)<<11;
199   lower = (buggyboy_vram[tile_index]<<3);
200   tileno = (bit15 | upper | lower)/8;
185   color = ((buggyboy_vram[tile_index] >>10) & 0x3f);
186   tileno = (buggyboy_vram[tile_index]&0x03ff) | ((buggyboy_vram[tile_index] & 0x8000) >> 5);
201187
202188   SET_TILE_INFO(0,tileno,color,0);
203189}
r869r870
243229   UINT8 *ROM_LUTB = (UINT8 *)memory_region(REGION_USER2)+0x8000;      /* Object LUT (lower byte) */
244230   UINT8 *ROM_CLUT = (UINT8 *)memory_region(REGION_USER3)+0x2000;      /* Object palette LUT */
245231
246   for (offs = 0x0; offs <= (bb_objectram_size); offs += 16)
232   for (offs = 0x0; offs <= (bb_objectram_size)/2; offs += 8)
247233   {
248234      int inc,last;
249235      int bit_12, PSA0_12, PSA, object_flip_x;
250236      int index_y,index_x,index=0;
251237
252238
253      if(bb_objram[offs+1] == 0xff)   /* End of object list marker? */
239      if((bb_objram[offs+0] >> 8) == 0xff)   /* End of object list marker? */
254240         return;
255241
256242      /* The object code is fed into ROM and PROM to generate a lookup into a pair of ROMs */
257      PROM_lookup = bb_objram[offs];
258      ROM_lookup = (bb_objram[offs] << 4)  | ((bb_objram[offs+3]>>3) & 0xf);
243      PROM_lookup = bb_objram[offs] & 0xff;
244      ROM_lookup = ((bb_objram[offs] & 0xff) << 4)  | ((bb_objram[offs+1]>>11) & 0xf);
259245
260246      if(rom_lut[ROM_lookup] == 0xff) /* Do not draw object  */
261247         continue;
r869r870
267253
268254      PSA = (PSA0_12 << 2);
269255
270      object_flip_x = (bb_objram[offs+5]>>7)&0x1;
256      object_flip_x = (bb_objram[offs+2]>>15)&0x1;
271257
272258      for (index_y=0; index_y<16; index_y++)
273259      {
r869r870
289275            /* Bit 14 of chunk_number = data_end, related to end of line */
290276            int chunk_number = (ROM_LUTB[PSA+index]<<8) | ROM_LUTA[PSA+index];    // PSBB0-15
291277
292            int sx = (bb_objram[offs+8])+(bb_objram[offs+9]<<8)+(index_x*8);
293            int sy = (bb_objram[offs+1])+(index_y*7);
278            int sx = (bb_objram[offs+4])+(index_x*8);
279            int sy = (bb_objram[offs+0] >> 8)+(index_y*7);
294280
295281            /* Calculate the 14-bit CLUT ROM address */
296            int bit13 = (bb_objram[offs+5] & 0x10) << 9;
282            int bit13 = (bb_objram[offs+2] & 0x1000) << 1;
297283            int bit12 = (chunk_number & 0x2000) >> 1;
298284
299285            /* Tile Number bit 12 -> 1 = Bits 6-7 of BUG16s or bits 8-9 of PC_TMP */
300            int bits6_and_7 = (chunk_number & 0x1000 ? chunk_number : bb_objram[offs+5] << 6) & 0xc0;
286            int bits6_and_7 = (chunk_number & 0x1000 ? chunk_number : bb_objram[offs+2] >> 2) & 0xc0;
301287            int CLUT_ROM_ADDR = (chunk_number & 0xf3f) + bits6_and_7 + bit12 + bit13;
302288
303289            /* Now form the 12 bit OPCD */
304            int bits10_and_11 = 0xc00 - ((bb_objram[offs+5] << 8) & 0xc00);
305            int OPCS = (bb_objram[offs+5] & 0x60) << 3;                     // bits 8 and 9
290            int bits10_and_11 = 0xc00 - (bb_objram[offs+2] & 0xc00);
291            int OPCS = (bb_objram[offs+2] & 0x6000) >> 5;                     // bits 8 and 9
306292            int OPCD = (ROM_CLUT[CLUT_ROM_ADDR] + OPCS + bits10_and_11) & 0xfff;
307293
308294            int tmp = (OPCD&0x7f);      // bits 0-6
r869r870
313299            int trans;
314300
315301            /* 8x8 chunk ROM bank (0-2) */
316            int bank = (((bb_objram[offs+5]>>3)&0x2) | ((chunk_number>>13)&0x1))+1;
302            int bank = (((bb_objram[offs+2]>>11)&0x2) | ((chunk_number>>13)&0x1))+1;
317303            int zoomx = 0xffff; //object_ram[offs+6]<<8;
318304            int zoomy = 0xffff; //object_ram[offs+4]<<8;
319305            int flipx = ((chunk_number>>15) & 0x1) ^ object_flip_x;
src/mame/video/tatsumi.c
r869r870
88UINT16 *roundup_r_ram, *roundup_p_ram, *roundup_l_ram;
99UINT16 *cyclwarr_videoram, *cyclwarr_videoram2;
1010UINT16* tatsumi_sprite_control_ram;
11UINT8* roundup5_vram;
11UINT16* roundup5_vram;
1212
1313/******************************************************************************/
1414
r869r870
2323
2424/******************************************************************************/
2525
26READ8_HANDLER(roundup5_vram_r)
26READ16_HANDLER(roundup5_vram_r)
2727{
28   offset+=((tatsumi_control_word&0x0c00)>>10) * 0x10000;
28   offset+=((tatsumi_control_word&0x0c00)>>10) * 0xc000;
2929   return roundup5_vram[offset];
3030}
3131
32WRITE8_HANDLER(roundup5_vram_w)
32WRITE16_HANDLER(roundup5_vram_w)
3333{
34   offset+=((tatsumi_control_word&0x0c00)>>10) * 0x18000;
34   offset+=((tatsumi_control_word&0x0c00)>>10) * 0xc000;
3535
3636//  if (offset>=0x30000)
3737//      logerror("effective write to vram %06x %02x (control %04x)\n",offset,data,tatsumi_control_word);
3838
39   roundup5_vram[offset]=data;
39   COMBINE_DATA(&roundup5_vram[offset]);
4040
41   offset=offset%0x18000;
41   offset=offset%0xc000;
4242
4343   decodechar(Machine->gfx[1],offset/0x10,(UINT8 *)roundup5_vram,
4444         Machine->drv->gfxdecodeinfo[1].gfxlayout);
4545}
4646
4747
48WRITE8_HANDLER(roundup5_palette_w)
48WRITE16_HANDLER(roundup5_palette_w)
4949{
5050//  static int hack=0;
5151   int word;
5252
53   paletteram[offset]=data;
53   COMBINE_DATA(&paletteram16[offset]);
5454
5555//  if (offset==0xbfe)
5656//      hack++;
r869r870
7171
7272//  logerror("PAL: %04x %02x\n",offset,data);
7373
74   offset&=~3;
75   word=(paletteram[offset]<<8)|(paletteram[offset+2]);
76   palette_set_color_rgb(Machine,offset/4,pal5bit(word >> 10),pal5bit(word >> 5),pal5bit(word >> 0));
74   offset&=~1;
75   word = ((paletteram16[offset] & 0xff)<<8) | (paletteram16[offset+1] & 0xff);
76   palette_set_color_rgb(Machine,offset/2,pal5bit(word >> 10),pal5bit(word >> 5),pal5bit(word >> 0));
7777}
78WRITE8_HANDLER(apache3_palette_w)
78
79
80WRITE16_HANDLER(apache3_palette_w)
7981{
8082//  static int hack=0;
81   int word;
8283
83   paletteram[offset]=data;
84   COMBINE_DATA(&paletteram16[offset]);
8485
8586//  if (offset==0xbfe)
8687//      hack++;
r869r870
101102
102103//  logerror("PAL: %04x %02x\n",offset,data);
103104
104   offset&=~1;
105   word=(paletteram[offset+1]<<8)|(paletteram[offset]);
106   palette_set_color_rgb(Machine,offset/2,pal5bit(word >> 10),pal5bit(word >> 5),pal5bit(word >> 0));
105   data = paletteram16[offset];
106   palette_set_color_rgb(Machine,offset,pal5bit(data >> 10),pal5bit(data >> 5),pal5bit(data >> 0));
107107}
108108
109109
110WRITE8_HANDLER( roundup5_text_w )
110WRITE16_HANDLER( roundup5_text_w )
111111{
112   videoram[offset]=data;
113   tilemap_mark_tile_dirty( tx_layer,offset/2);
112   COMBINE_DATA(&videoram16[offset]);
113   tilemap_mark_tile_dirty( tx_layer,offset);
114114}
115115
116116READ16_HANDLER( cyclwarr_videoram_r )
r869r870
147147
148148static UINT8* shadow_pen_array;
149149
150WRITE8_HANDLER( roundup5_crt_w )
150WRITE16_HANDLER( roundup5_crt_w )
151151{
152   if (offset==0)
152   if (offset==0 && ACCESSING_LSB)
153153      roundupt_crt_selected_reg=data&0x3f;
154   if (offset==2) {
154   if (offset==1 && ACCESSING_LSB) {
155155      roundupt_crt_reg[roundupt_crt_selected_reg]=data;
156156//      if (roundupt_crt_selected_reg!=0xa && roundupt_crt_selected_reg!=0xb && roundupt_crt_selected_reg!=29)
157157//      logerror("%08x:  Crt write %02x %02x\n",activecpu_get_pc(),roundupt_crt_selected_reg,data);
r869r870
162162
163163static TILE_GET_INFO( get_text_tile_info )
164164{
165   int tile=videoram[2*tile_index]+((videoram[2*tile_index+1]&0xf)<<8);
166   int color=videoram[2*tile_index+1]>>4;
167
165   int tile = videoram16[tile_index];
168166   SET_TILE_INFO(
169167         1,
170         tile,
171         color,
168         tile & 0xfff,
169         tile >> 12,
172170         0);
173171}
174172
r869r870
767765   const UINT16* data=roundup_r_ram;
768766
769767   // Road layer enable (?)
770   if ((roundup5_unknown0[0x2]&0x1)==0)
768   if ((roundup5_unknown0[0x1]&0x1)==0)
771769      return;
772770
773771   // Road data bank select (double buffered)
r869r870
775773      data+=0x400;
776774
777775   // ??  Todo: This is wrong - don't know how to clip the road properly
778   y=256 - roundup5_unknown0[0xb];
776   y=256 - (roundup5_unknown0[0xb/2] >> 8);
779777   data+=y*4;
780778
781779   visible_line=0;
r869r870
970968
971969VIDEO_UPDATE( roundup5 )
972970{
973//  UINT16 bg_x_scroll=roundup5_unknown1[0] | (roundup5_unknown1[1]<<8);
974//  UINT16 bg_y_scroll=roundup5_unknown2[0] | (roundup5_unknown2[1]<<8);
971//  UINT16 bg_x_scroll=roundup5_unknown1[0];
972//  UINT16 bg_y_scroll=roundup5_unknown2[0];
975973
976974   update_cluts(machine, 1024, 512, 4096);
977975
src/mame/video/m72.c
r869r870
11#include "driver.h"
22#include "audio/m72.h"
3#include "m72.h"
34
45
56
6UINT8 *m72_videoram1,*m72_videoram2,*majtitle_rowscrollram;
7static UINT8 *m72_spriteram;
7UINT16 *m72_videoram1,*m72_videoram2,*majtitle_rowscrollram;
8static UINT16 *m72_spriteram;
89static INT32 splitline;
910static tilemap *fg_tilemap,*bg_tilemap;
1011static int xadjust;
r869r870
6566
6667***************************************************************************/
6768
68INLINE void m72_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,UINT8 *vram,int gfxnum)
69INLINE void m72_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,const UINT16 *vram,int gfxnum)
6970{
7071   int code,attr,color,pri;
7172
72   tile_index *= 4;
73   tile_index *= 2;
7374
74   code  = vram[tile_index];
75   attr  = vram[tile_index+1];
76   color = vram[tile_index+2];
75   code  = vram[tile_index] & 0xff;
76   attr  = vram[tile_index] >> 8;
77   color = vram[tile_index+1] & 0xff;
7778
7879   if (color & 0x80) pri = 2;
7980   else if (color & 0x40) pri = 1;
r869r870
8889   tileinfo->group = pri;
8990}
9091
91INLINE void rtype2_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,UINT8 *vram,int gfxnum)
92INLINE void rtype2_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,const UINT16 *vram,int gfxnum)
9293{
9394   int code,attr,color,pri;
9495
95   tile_index *= 4;
96   tile_index *= 2;
9697
97   code  = vram[tile_index] + (vram[tile_index+1] << 8);
98   color = vram[tile_index+2];
99   attr  = vram[tile_index+3];
98   code  = vram[tile_index];
99   color = vram[tile_index+1] & 0xff;
100   attr  = vram[tile_index+1] >> 8;
100101
101102   if (attr & 0x01) pri = 2;
102103   else if (color & 0x80) pri = 1;
r869r870
276277
277278***************************************************************************/
278279
279READ8_HANDLER( m72_palette1_r )
280READ16_HANDLER( m72_palette1_r )
280281{
281   /* only D0-D4 are connected */
282   if (offset & 1) return 0xff;
283
284282   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
285   offset &= ~0x200;
283   offset &= ~0x100;
286284
287   return paletteram[offset] | 0xe0;   /* only D0-D4 are connected */
285   return paletteram16[offset] | 0xffe0;   /* only D0-D4 are connected */
288286}
289287
290READ8_HANDLER( m72_palette2_r )
288READ16_HANDLER( m72_palette2_r )
291289{
292   /* only D0-D4 are connected */
293   if (offset & 1) return 0xff;
294
295290   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
296   offset &= ~0x200;
291   offset &= ~0x100;
297292
298   return paletteram_2[offset] | 0xe0;   /* only D0-D4 are connected */
293   return paletteram16_2[offset] | 0xffe0;   /* only D0-D4 are connected */
299294}
300295
301296INLINE void changecolor(int color,int r,int g,int b)
r869r870
303298   palette_set_color_rgb(Machine,color,pal5bit(r),pal5bit(g),pal5bit(b));
304299}
305300
306WRITE8_HANDLER( m72_palette1_w )
301WRITE16_HANDLER( m72_palette1_w )
307302{
308   /* only D0-D4 are connected */
309   if (offset & 1) return;
310
311303   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
312   offset &= ~0x200;
304   offset &= ~0x100;
313305
314   paletteram[offset] = data;
315   offset &= 0x1ff;
316   changecolor(offset / 2,
317         paletteram[offset + 0x000],
318         paletteram[offset + 0x400],
319         paletteram[offset + 0x800]);
306   COMBINE_DATA(&paletteram16[offset]);
307   offset &= 0x0ff;
308   changecolor(offset,
309         paletteram16[offset + 0x000],
310         paletteram16[offset + 0x200],
311         paletteram16[offset + 0x400]);
320312}
321313
322WRITE8_HANDLER( m72_palette2_w )
314WRITE16_HANDLER( m72_palette2_w )
323315{
324   /* only D0-D4 are connected */
325   if (offset & 1) return;
326
327316   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
328   offset &= ~0x200;
317   offset &= ~0x100;
329318
330   paletteram_2[offset] = data;
331   offset &= 0x1ff;
332   changecolor(offset / 2 + 256,
333         paletteram_2[offset + 0x000],
334         paletteram_2[offset + 0x400],
335         paletteram_2[offset + 0x800]);
319   COMBINE_DATA(&paletteram16_2[offset]);
320   offset &= 0x0ff;
321   changecolor(offset + 256,
322         paletteram16_2[offset + 0x000],
323         paletteram16_2[offset + 0x200],
324         paletteram16_2[offset + 0x400]);
336325}
337326
338READ8_HANDLER( m72_videoram1_r )
327WRITE16_HANDLER( m72_videoram1_w )
339328{
340   return m72_videoram1[offset];
329   COMBINE_DATA(&m72_videoram1[offset]);
330   tilemap_mark_tile_dirty(fg_tilemap,offset/2);
341331}
342332
343READ8_HANDLER( m72_videoram2_r )
333WRITE16_HANDLER( m72_videoram2_w )
344334{
345   return m72_videoram2[offset];
335   COMBINE_DATA(&m72_videoram2[offset]);
336   tilemap_mark_tile_dirty(bg_tilemap,offset/2);
346337}
347338
348WRITE8_HANDLER( m72_videoram1_w )
339WRITE16_HANDLER( m72_irq_line_w )
349340{
350   m72_videoram1[offset] = data;
351   tilemap_mark_tile_dirty(fg_tilemap,offset/4);
341   COMBINE_DATA(&splitline);
352342}
353343
354WRITE8_HANDLER( m72_videoram2_w )
344WRITE16_HANDLER( m72_scrollx1_w )
355345{
356   m72_videoram2[offset] = data;
357   tilemap_mark_tile_dirty(bg_tilemap,offset/4);
346   COMBINE_DATA(&scrollx1);
358347}
359348
360WRITE8_HANDLER( m72_irq_line_w )
349WRITE16_HANDLER( m72_scrollx2_w )
361350{
362   offset *= 8;
363   splitline = (splitline & (0xff00 >> offset)) | (data << offset);
351   COMBINE_DATA(&scrollx2);
364352}
365353
366WRITE8_HANDLER( m72_scrollx1_w )
354WRITE16_HANDLER( m72_scrolly1_w )
367355{
368   offset *= 8;
369   scrollx1 = (scrollx1 & (0xff00 >> offset)) | (data << offset);
356   COMBINE_DATA(&scrolly1);
370357}
371358
372WRITE8_HANDLER( m72_scrollx2_w )
359WRITE16_HANDLER( m72_scrolly2_w )
373360{
374   offset *= 8;
375   scrollx2 = (scrollx2 & (0xff00 >> offset)) | (data << offset);
361   COMBINE_DATA(&scrolly2);
376362}
377363
378WRITE8_HANDLER( m72_scrolly1_w )
364WRITE16_HANDLER( m72_dmaon_w )
379365{
380   offset *= 8;
381   scrolly1 = (scrolly1 & (0xff00 >> offset)) | (data << offset);
366   if (ACCESSING_LSB)
367      memcpy(m72_spriteram,spriteram16,spriteram_size);
382368}
383369
384WRITE8_HANDLER( m72_scrolly2_w )
385{
386   offset *= 8;
387   scrolly2 = (scrolly2 & (0xff00 >> offset)) | (data << offset);
388}
389370
390WRITE8_HANDLER( m72_dmaon_w )
371WRITE16_HANDLER( m72_port02_w )
391372{
392   if (offset == 0)
373   if (ACCESSING_LSB)
393374   {
394      memcpy(m72_spriteram,spriteram,spriteram_size);
395   }
396}
375      if (data & 0xe0) logerror("write %02x to port 02\n",data);
397376
377      /* bits 0/1 are coin counters */
378      coin_counter_w(0,data & 0x01);
379      coin_counter_w(1,data & 0x02);
398380
399WRITE8_HANDLER( m72_port02_w )
400{
401   if (offset != 0)
402   {
403      if (data) logerror("write %02x to port 03\n",data);
404      return;
405   }
406   if (data & 0xe0) logerror("write %02x to port 02\n",data);
381      /* bit 2 is flip screen (handled both by software and hardware) */
382      flip_screen_set(((data & 0x04) >> 2) ^ ((~readinputport(2) >> 8) & 1));
407383
408   /* bits 0/1 are coin counters */
409   coin_counter_w(0,data & 0x01);
410   coin_counter_w(1,data & 0x02);
384      /* bit 3 is display disable */
385      video_off = data & 0x08;
411386
412   /* bit 2 is flip screen (handled both by software and hardware) */
413   flip_screen_set(((data & 0x04) >> 2) ^ (~readinputport(5) & 1));
387      /* bit 4 resets sound CPU (active low) */
388      if (data & 0x10)
389         cpunum_set_input_line(1, INPUT_LINE_RESET, CLEAR_LINE);
390      else
391         cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
414392
415   /* bit 3 is display disable */
416   video_off = data & 0x08;
417
418   /* bit 4 resets sound CPU (active low) */
419   if (data & 0x10)
420      cpunum_set_input_line(1, INPUT_LINE_RESET, CLEAR_LINE);
421   else
422      cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
423
424   /* bit 5 = "bank"? */
393      /* bit 5 = "bank"? */
394   }
425395}
426396
427WRITE8_HANDLER( rtype2_port02_w )
397WRITE16_HANDLER( rtype2_port02_w )
428398{
429   if (offset != 0)
399   if (ACCESSING_LSB)
430400   {
431      if (data) logerror("write %02x to port 03\n",data);
432      return;
433   }
434   if (data & 0xe0) logerror("write %02x to port 02\n",data);
401      if (data & 0xe0) logerror("write %02x to port 02\n",data);
435402
436   /* bits 0/1 are coin counters */
437   coin_counter_w(0,data & 0x01);
438   coin_counter_w(1,data & 0x02);
403      /* bits 0/1 are coin counters */
404      coin_counter_w(0,data & 0x01);
405      coin_counter_w(1,data & 0x02);
439406
440   /* bit 2 is flip screen (handled both by software and hardware) */
441   flip_screen_set(((data & 0x04) >> 2) ^ (~readinputport(5) & 1));
407      /* bit 2 is flip screen (handled both by software and hardware) */
408      flip_screen_set(((data & 0x04) >> 2) ^ ((~readinputport(2) >> 8) & 1));
442409
443   /* bit 3 is display disable */
444   video_off = data & 0x08;
410      /* bit 3 is display disable */
411      video_off = data & 0x08;
445412
446   /* other bits unknown */
413      /* other bits unknown */
414   }
447415}
448416
449417
450418static int majtitle_rowscroll;
451419
452420/* the following is mostly a kludge. This register seems to be used for something else */
453WRITE8_HANDLER( majtitle_gfx_ctrl_w )
421WRITE16_HANDLER( majtitle_gfx_ctrl_w )
454422{
455   if (offset == 1)
423   if (ACCESSING_MSB)
456424   {
457      if (data) majtitle_rowscroll = 1;
425      if (data & 0xff00) majtitle_rowscroll = 1;
458426      else majtitle_rowscroll = 0;
459427   }
460428}
r869r870
471439   int offs;
472440
473441   offs = 0;
474   while (offs < spriteram_size)
442   while (offs < spriteram_size/2)
475443   {
476444      int code,color,sx,sy,flipx,flipy,w,h,x,y;
477445
478446
479      code = m72_spriteram[offs+2] | (m72_spriteram[offs+3] << 8);
480      color = m72_spriteram[offs+4] & 0x0f;
481      sx = -256+(m72_spriteram[offs+6] | ((m72_spriteram[offs+7] & 0x03) << 8));
482      sy = 512-(m72_spriteram[offs+0] | ((m72_spriteram[offs+1] & 0x01) << 8));
483      flipx = m72_spriteram[offs+5] & 0x08;
484      flipy = m72_spriteram[offs+5] & 0x04;
447      code = m72_spriteram[offs+1];
448      color = m72_spriteram[offs+2] & 0x0f;
449      sx = -256+(m72_spriteram[offs+3] & 0x3ff);
450      sy = 512-(m72_spriteram[offs+0] & 0x1ff);
451      flipx = m72_spriteram[offs+2] & 0x0800;
452      flipy = m72_spriteram[offs+2] & 0x0400;
485453
486      w = 1 << ((m72_spriteram[offs+5] & 0xc0) >> 6);
487      h = 1 << ((m72_spriteram[offs+5] & 0x30) >> 4);
454      w = 1 << ((m72_spriteram[offs+2] & 0xc000) >> 14);
455      h = 1 << ((m72_spriteram[offs+2] & 0x3000) >> 12);
488456      sy -= 16 * h;
489457
490458      if (flip_screen)
r869r870
515483         }
516484      }
517485
518      offs += w*8;
486      offs += w*4;
519487   }
520488}
521489
r869r870
523491{
524492   int offs;
525493
526   for (offs = 0;offs < spriteram_size;offs += 8)
494   for (offs = 0;offs < spriteram_size;offs += 4)
527495   {
528496      int code,color,sx,sy,flipx,flipy,w,h,x,y;
529497
530498
531      code = spriteram_2[offs+2] | (spriteram_2[offs+3] << 8);
532      color = spriteram_2[offs+4] & 0x0f;
533      sx = -256+(spriteram_2[offs+6] | ((spriteram_2[offs+7] & 0x03) << 8));
534      sy = 512-(spriteram_2[offs+0] | ((spriteram_2[offs+1] & 0x01) << 8));
535      flipx = spriteram_2[offs+5] & 0x08;
536      flipy = spriteram_2[offs+5] & 0x04;
499      code = spriteram16_2[offs+1];
500      color = spriteram16_2[offs+2] & 0x0f;
501      sx = -256+(spriteram16_2[offs+3] & 0x3ff);
502      sy = 512-(spriteram16_2[offs+0] & 0x1ff);
503      flipx = spriteram16_2[offs+2] & 0x0800;
504      flipy = spriteram16_2[offs+2] & 0x0400;
537505
538      w = 1;// << ((spriteram_2[offs+5] & 0xc0) >> 6);
539      h = 1 << ((spriteram_2[offs+5] & 0x30) >> 4);
506      w = 1;// << ((spriteram16_2[offs+2] & 0xc000) >> 14);
507      h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12);
540508      sy -= 16 * h;
541509
542510      if (flip_screen)
r869r870
610578      tilemap_set_scroll_rows(bg_tilemap,512);
611579      for (i = 0;i < 512;i++)
612580         tilemap_set_scrollx(bg_tilemap,(i+scrolly2)&0x1ff,
613               256 + majtitle_rowscrollram[2*i] + (majtitle_rowscrollram[2*i+1] << 8) + xadjust);
581               256 + majtitle_rowscrollram[i] + xadjust);
614582   }
615583   else
616584   {
src/mame/video/m90.c
r869r870
2626
2727#include "driver.h"
2828
29static UINT8 *m90_spriteram;
30UINT8 *m90_video_data;
29static UINT16 *m90_spriteram;
30UINT16 *m90_video_data;
31static UINT16 m90_video_control_data[8];
3132static tilemap *pf1_layer,*pf2_layer,*pf1_wide_layer,*pf2_wide_layer;
32static INT32 m90_video_control_data[16];
3333
3434INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,int page_mask)
3535{
3636   int tile,color;
37   tile_index = 4*tile_index + ((m90_video_control_data[0xa+2*layer] & page_mask)*0x4000);
37   tile_index = 2*tile_index + ((m90_video_control_data[5+layer] & page_mask) * 0x2000);
3838
39   tile=m90_video_data[tile_index]+(m90_video_data[tile_index+1]<<8);
40   color=m90_video_data[tile_index+2];
39   tile=m90_video_data[tile_index];
40   color=m90_video_data[tile_index+1];
4141   SET_TILE_INFO(
4242         0,
4343         tile,
r869r870
4747}
4848
4949
50static TILE_GET_INFO( get_pf1_tile_info ) { get_tile_info(machine,tileinfo,tile_index,0,3); }
51static TILE_GET_INFO( get_pf1w_tile_info ) { get_tile_info(machine,tileinfo,tile_index,0,2); }
52static TILE_GET_INFO( get_pf2_tile_info ) { get_tile_info(machine,tileinfo,tile_index,1,3); }
53static TILE_GET_INFO( get_pf2w_tile_info ) { get_tile_info(machine,tileinfo,tile_index,1,2); }
50static TILE_GET_INFO( get_pf1_tile_info ) { get_tile_info(machine,tileinfo,tile_index,0,0x3); }
51static TILE_GET_INFO( get_pf1w_tile_info ) { get_tile_info(machine,tileinfo,tile_index,0,0x2); }
52static TILE_GET_INFO( get_pf2_tile_info ) { get_tile_info(machine,tileinfo,tile_index,1,0x3); }
53static TILE_GET_INFO( get_pf2w_tile_info ) { get_tile_info(machine,tileinfo,tile_index,1,0x2); }
5454
5555
5656VIDEO_START( m90 )
r869r870
7070{
7171   int offs;
7272
73   for (offs = 0x1f2;offs >= 0;offs -= 6)
73   for (offs = 0x1f2/2;offs >= 0;offs -= 3)
7474   {
7575      int x,y,sprite,colour,fx,fy,y_multi,i;
7676
77      sprite = (m90_spriteram[offs+2] | (m90_spriteram[offs+3]<<8));
78      colour = (m90_spriteram[offs+1] >> 1) & 0x0f;
77      sprite = m90_spriteram[offs+1];
78      colour = (m90_spriteram[offs+0] >> 9) & 0x0f;
7979
80      y = m90_spriteram[offs+0] | ((m90_spriteram[offs+1] & 0x01) << 8);
81      x = m90_spriteram[offs+4] | ((m90_spriteram[offs+5] & 0x01) << 8);
80      y = m90_spriteram[offs+0] & 0x1ff;
81      x = m90_spriteram[offs+2] & 0x1ff;
8282
8383      x = x - 16;
8484      y = 512 - y;
8585
86      fx = m90_spriteram[offs+5] & 0x02;
87      fy = m90_spriteram[offs+1] & 0x80;
86      fx = (m90_spriteram[offs+2] >> 8) & 0x02;
87      fy = (m90_spriteram[offs+0] >> 8) & 0x80;
8888
89      y_multi = 1 << ((m90_spriteram[offs+1] & 0x60) >> 5);
89      y_multi = 1 << ((m90_spriteram[offs+0] & 0x6000) >> 13);
9090      y -= 16 * y_multi;
9191
9292      for (i = 0;i < y_multi;i++)
r869r870
132132}
133133#endif
134134
135WRITE8_HANDLER( m90_video_control_w )
135WRITE16_HANDLER( m90_video_control_w )
136136{
137   m90_video_control_data[offset]=data;
137   COMBINE_DATA(&m90_video_control_data[offset]);
138138}
139139
140140
141141static void markdirty(tilemap *tmap,int page,offs_t offset)
142142{
143   offset -= page * 0x4000;
143   offset -= page * 0x2000;
144144
145   if (offset >= 0 && offset < 0x4000)
146      tilemap_mark_tile_dirty(tmap,offset/4);
145   if (offset >= 0 && offset < 0x2000)
146      tilemap_mark_tile_dirty(tmap,offset/2);
147147}
148148
149149
150WRITE8_HANDLER( m90_video_w )
150WRITE16_HANDLER( m90_video_w )
151151{
152   m90_video_data[offset] = data;
152   COMBINE_DATA(&m90_video_data[offset]);
153153
154   markdirty(pf1_layer,     m90_video_control_data[0xa] & 0x3,offset);
155   markdirty(pf1_wide_layer,m90_video_control_data[0xa] & 0x2,offset);
156   markdirty(pf2_layer,     m90_video_control_data[0xc] & 0x3,offset);
157   markdirty(pf2_wide_layer,m90_video_control_data[0xc] & 0x2,offset);
154   markdirty(pf1_layer,     m90_video_control_data[5] & 0x3,offset);
155   markdirty(pf1_wide_layer,m90_video_control_data[5] & 0x2,offset);
156   markdirty(pf2_layer,     m90_video_control_data[6] & 0x3,offset);
157   markdirty(pf2_wide_layer,m90_video_control_data[6] & 0x2,offset);
158158}
159159
160160VIDEO_UPDATE( m90 )
161161{
162162   static int last_pf1,last_pf2;
163   int pf1_base = m90_video_control_data[0xa] & 0x3;
164   int pf2_base = m90_video_control_data[0xc] & 0x3;
163   int pf1_base = m90_video_control_data[5] & 0x3;
164   int pf2_base = m90_video_control_data[6] & 0x3;
165165   int i,pf1_enable,pf2_enable;
166166
167   if (m90_video_control_data[0xa]&0x10) pf1_enable=0; else pf1_enable=1;
168   if (m90_video_control_data[0xc]&0x10) pf2_enable=0; else pf2_enable=1;
167   if (m90_video_control_data[5]&0x10) pf1_enable=0; else pf1_enable=1;
168   if (m90_video_control_data[6]&0x10) pf2_enable=0; else pf2_enable=1;
169169//  tilemap_set_enable(pf1_layer,pf1_enable);
170170//  tilemap_set_enable(pf2_layer,pf2_enable);
171171//  tilemap_set_enable(pf1_wide_layer,pf1_enable);
r869r870
185185   last_pf1=pf1_base;
186186   last_pf2=pf2_base;
187187
188   m90_spriteram=m90_video_data+0xee00;
188   m90_spriteram=m90_video_data+0xee00/2;
189189
190190   /* Setup scrolling */
191   if (m90_video_control_data[0xa]&0x20)
191   if (m90_video_control_data[5]&0x20)
192192   {
193193      tilemap_set_scroll_rows(pf1_layer,512);
194194      tilemap_set_scroll_rows(pf1_wide_layer,512);
195      for (i=0; i<1024; i+=2)
196         tilemap_set_scrollx( pf1_layer,i/2, (m90_video_data[0xf000+i]+(m90_video_data[0xf001+i]<<8))+2);
197      for (i=0; i<1024; i+=2)
198         tilemap_set_scrollx( pf1_wide_layer,i/2, (m90_video_data[0xf000+i]+(m90_video_data[0xf001+i]<<8))+256+2);
195      for (i=0; i<512; i++)
196         tilemap_set_scrollx( pf1_layer,i, m90_video_data[0xf000/2+i]+2);
197      for (i=0; i<512; i++)
198         tilemap_set_scrollx( pf1_wide_layer,i, m90_video_data[0xf000/2+i]+256+2);
199199   }
200200   else
201201   {
202202      tilemap_set_scroll_rows(pf1_layer,1);
203203      tilemap_set_scroll_rows(pf1_wide_layer,1);
204      tilemap_set_scrollx( pf1_layer,0, (m90_video_control_data[3]<<8)+m90_video_control_data[2]+2);
205      tilemap_set_scrollx( pf1_wide_layer,0, (m90_video_control_data[3]<<8)+m90_video_control_data[2]+256+2);
204      tilemap_set_scrollx( pf1_layer,0, m90_video_control_data[1]+2);
205      tilemap_set_scrollx( pf1_wide_layer,0, m90_video_control_data[1]+256+2);
206206   }
207207
208208   /* Setup scrolling */
209   if (m90_video_control_data[0xc]&0x20) {
209   if (m90_video_control_data[6]&0x20) {
210210      tilemap_set_scroll_rows(pf2_layer,512);
211211      tilemap_set_scroll_rows(pf2_wide_layer,512);
212      for (i=0; i<1024; i+=2)
213         tilemap_set_scrollx( pf2_layer,i/2, (m90_video_data[0xf400+i]+(m90_video_data[0xf401+i]<<8))-2);
214      for (i=0; i<1024; i+=2)
215         tilemap_set_scrollx( pf2_wide_layer,i/2, (m90_video_data[0xf400+i]+(m90_video_data[0xf401+i]<<8))+256-2);
212      for (i=0; i<512; i++)
213         tilemap_set_scrollx( pf2_layer,i, m90_video_data[0xf400/2+i]-2);
214      for (i=0; i<512; i++)
215         tilemap_set_scrollx( pf2_wide_layer,i, m90_video_data[0xf400/2+i]+256-2);
216216   } else {
217217      tilemap_set_scroll_rows(pf2_layer,1);
218218      tilemap_set_scroll_rows(pf2_wide_layer,1);
219      tilemap_set_scrollx( pf2_layer,0, (m90_video_control_data[7]<<8)+m90_video_control_data[6]-2);
220      tilemap_set_scrollx( pf2_wide_layer,0, (m90_video_control_data[7]<<8)+m90_video_control_data[6]+256-2 );
219      tilemap_set_scrollx( pf2_layer,0, m90_video_control_data[3]-2);
220      tilemap_set_scrollx( pf2_wide_layer,0, m90_video_control_data[3]+256-2 );
221221   }
222222
223   tilemap_set_scrolly( pf1_layer,0, (m90_video_control_data[1]<<8)+m90_video_control_data[0] );
224   tilemap_set_scrolly( pf2_layer,0, (m90_video_control_data[5]<<8)+m90_video_control_data[4] );
225   tilemap_set_scrolly( pf1_wide_layer,0, (m90_video_control_data[1]<<8)+m90_video_control_data[0] );
226   tilemap_set_scrolly( pf2_wide_layer,0, (m90_video_control_data[5]<<8)+m90_video_control_data[4] );
223   tilemap_set_scrolly( pf1_layer,0, m90_video_control_data[0] );
224   tilemap_set_scrolly( pf2_layer,0, m90_video_control_data[2] );
225   tilemap_set_scrolly( pf1_wide_layer,0, m90_video_control_data[0] );
226   tilemap_set_scrolly( pf2_wide_layer,0, m90_video_control_data[2] );
227227
228228   fillbitmap(priority_bitmap,0,cliprect);
229229
r869r870
232232
233233   if (pf2_enable)
234234   {
235      if (m90_video_control_data[0xc] & 0x4)
235      if (m90_video_control_data[6] & 0x4)
236236         tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
237237      else
238238         tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
239239
240      if (m90_video_control_data[0xc] & 0x4)
240      if (m90_video_control_data[6] & 0x4)
241241         tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
242242      else
243243         tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
r869r870
245245
246246   if (pf1_enable)
247247   {
248      if (m90_video_control_data[0xa] & 0x4)
248      if (m90_video_control_data[5] & 0x4)
249249         tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
250250      else
251251         tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
252252
253      if (m90_video_control_data[0xa] & 0x4)
253      if (m90_video_control_data[5] & 0x4)
254254         tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
255255      else
256256         tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
src/mame/video/m92.c
r869r870
4141
4242#include "driver.h"
4343
44static tilemap *pf3_wide_layer,*pf3_layer,*pf2_layer,*pf1_wide_layer,*pf1_layer;
45static INT32 pf1_control[8],pf2_control[8],pf3_control[8],pf4_control[8];
46static INT32 pf1_vram_ptr,pf2_vram_ptr,pf3_vram_ptr;
47static INT32 pf1_enable,pf2_enable,pf3_enable;
48static INT32 pf1_rowscroll,pf2_rowscroll,pf3_rowscroll;
49static INT32 pf1_shape,pf2_shape,pf3_shape;
44typedef struct _pf_layer_info pf_layer_info;
45struct _pf_layer_info
46{
47   tilemap *      tmap;
48   tilemap *      wide_tmap;
49   UINT16         vram_base;
50   UINT16         control[4];
51};
52
53static pf_layer_info pf_layer[3];
54
55static UINT16 pf_master_control[4];
5056static INT32 m92_sprite_list;
5157
52int m92_raster_irq_position,m92_raster_enable;
53UINT8 *m92_vram_data,*m92_spritecontrol;
54int m92_game_kludge;
58UINT32 m92_raster_irq_position;
59UINT16 *m92_vram_data,*m92_spritecontrol;
60UINT8 m92_game_kludge;
5561
5662extern void m92_sprite_interrupt(void);
57int m92_sprite_buffer_busy;
63UINT8 m92_sprite_buffer_busy;
5864static int m92_palette_bank;
5965
6066/*****************************************************************************/
6167
6268static TIMER_CALLBACK( spritebuffer_callback )
6369{
64   m92_sprite_buffer_busy=0x80;
70   m92_sprite_buffer_busy = 1;
6571   if (m92_game_kludge!=2) /* Major Title 2 doesn't like this interrupt!? */
6672      m92_sprite_interrupt();
6773}
6874
69WRITE8_HANDLER( m92_spritecontrol_w )
75WRITE16_HANDLER( m92_spritecontrol_w )
7076{
71   static int sprite_extent;
77   COMBINE_DATA(&m92_spritecontrol[offset]);
7278
73   m92_spritecontrol[offset]=data;
74
7579   /* Sprite list size register - used in spriteroutine */
76   if (offset==0)
77      sprite_extent=data;
7880
7981   /* Sprite control - display all sprites, or partial list */
80   if (offset==4) {
81      if (data==8)
82         m92_sprite_list=(((0x100 - sprite_extent)&0xff)*8);
82   if (offset==2 && ACCESSING_LSB)
83   {
84      if ((data & 0xff) == 8)
85         m92_sprite_list = (((0x100 - m92_spritecontrol[0]) & 0xff) * 4);
8386      else
84         m92_sprite_list=0x800;
87         m92_sprite_list = 0x400;
8588
8689      /* Bit 0 is also significant */
8790   }
8891
8992   /* Sprite buffer - the data written doesn't matter (confirmed by several games) */
90   if (offset==8) {
91      buffer_spriteram_w(0,0);
92      m92_sprite_buffer_busy=0;
93   if (offset==4)
94   {
95      buffer_spriteram16_w(0,0,0);
96      m92_sprite_buffer_busy = 0;
9397
9498      /* Pixel clock is 26.6666 MHz, we have 0x800 bytes, or 0x400 words
95        to copy from spriteram to the buffer.  It seems safe to assume 1
96        word can be copied per clock.*/
97      mame_timer_set (scale_up_mame_time(MAME_TIME_IN_HZ(26666000), 0x400), 0, spritebuffer_callback);
99           to copy from spriteram to the buffer.  It seems safe to assume 1
100           word can be copied per clock.*/
101      mame_timer_set(scale_up_mame_time(MAME_TIME_IN_HZ(26666000), 0x400), 0, spritebuffer_callback);
98102   }
99103//  logerror("%04x: m92_spritecontrol_w %08x %08x\n",activecpu_get_pc(),offset,data);
100104}
101105
102WRITE8_HANDLER( m92_videocontrol_w )
106WRITE16_HANDLER( m92_videocontrol_w )
103107{
104108   /*
105109        Many games write:
r869r870
114118        be a different motherboard revision (most games use M92-A-B top
115119        pcb, a M92-A-A revision could exist...).
116120    */
117   if (offset==0)
121   if (ACCESSING_LSB)
118122   {
119123      /* Access to upper palette bank */
120      if ((data & 0x2) == 0x2 && m92_game_kludge!=3) m92_palette_bank = 1;
121      else                     m92_palette_bank = 0;
124      m92_palette_bank = (data >> 1) & 1;
122125   }
123126//  logerror("%04x: m92_videocontrol_w %d = %02x\n",activecpu_get_pc(),offset,data);
124127}
125128
126READ8_HANDLER( m92_paletteram_r )
129READ16_HANDLER( m92_paletteram_r )
127130{
128   return paletteram_r(offset + 0x800*m92_palette_bank);
131   return paletteram16_word_r(offset + 0x400 * m92_palette_bank, mem_mask);
129132}
130133
131WRITE8_HANDLER( m92_paletteram_w )
134WRITE16_HANDLER( m92_paletteram_w )
132135{
133   paletteram_xBBBBBGGGGGRRRRR_le_w(offset + 0x800*m92_palette_bank,data);
136   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset + 0x400 * m92_palette_bank, data, mem_mask);
134137}
135138
136139/*****************************************************************************/
137140
138static TILE_GET_INFO( get_pf1_tile_info )
141static TILE_GET_INFO( get_pf_tile_info )
139142{
140   int tile,color,pri;
141   tile_index = 4*tile_index+pf1_vram_ptr;
143   pf_layer_info *layer = param;
144   int tile, attrib;
145   tile_index = 2 * tile_index + layer->vram_base;
142146
143   tile=m92_vram_data[tile_index]+(m92_vram_data[tile_index+1]<<8)+((m92_vram_data[tile_index+3]&0x80)<<9);
144   color=m92_vram_data[tile_index+2];
145   if (m92_vram_data[tile_index+3]&1) pri = 2;
146   else if (color&0x80) pri = 1;
147   else pri = 0;
147   attrib = m92_vram_data[tile_index + 1];
148   tile = m92_vram_data[tile_index] + ((attrib & 0x8000) << 1);
148149
149150   SET_TILE_INFO(
150151         0,
151152         tile,
152         color&0x7f,
153         TILE_FLIPYX((m92_vram_data[tile_index+3] & 0x6)>>1));
154   tileinfo->group = pri;
153         attrib & 0x7f,
154         TILE_FLIPYX(attrib >> 9));
155   if (attrib & 0x100) tileinfo->group = 2;
156   else if (attrib & 0x80) tileinfo->group = 1;
157   else tileinfo->group = 0;
155158}
156159
157static TILE_GET_INFO( get_pf2_tile_info )
158{
159   int tile,color,pri;
160   tile_index = 4*tile_index + pf2_vram_ptr;
161
162   tile=m92_vram_data[tile_index]+(m92_vram_data[tile_index+1]<<8)+((m92_vram_data[tile_index+3]&0x80)<<9);
163   color=m92_vram_data[tile_index+2];
164   if (m92_vram_data[tile_index+3]&1) pri = 2;
165   else if (color&0x80) pri = 1;
166   else pri = 0;
167
168   SET_TILE_INFO(
169         0,
170         tile,
171         color&0x7f,
172         TILE_FLIPYX((m92_vram_data[tile_index+3] & 0x6)>>1));
173   tileinfo->group = pri;
174}
175
176static TILE_GET_INFO( get_pf3_tile_info )
177{
178   int tile,color,pri;
179   tile_index = 4*tile_index + pf3_vram_ptr;
180   tile=m92_vram_data[tile_index]+(m92_vram_data[tile_index+1]<<8)+((m92_vram_data[tile_index+3]&0x80)<<9);
181   color=m92_vram_data[tile_index+2];
182
183   if (color&0x80) pri = 1;
184   else pri = 0;
185
186   SET_TILE_INFO(
187         0,
188         tile,
189         color&0x7f,
190         TILE_FLIPYX((m92_vram_data[tile_index+3] & 0x6)>>1));
191   tileinfo->group = pri;
192}
193
194static TILE_GET_INFO( get_pf1_wide_tile_info )
195{
196   int tile,color,pri;
197   tile_index = 4*tile_index + pf1_vram_ptr;
198
199   tile=m92_vram_data[tile_index]+(m92_vram_data[tile_index+1]<<8)+((m92_vram_data[tile_index+3]&0x80)<<9);
200   color=m92_vram_data[tile_index+2];
201   if (m92_vram_data[tile_index+3]&1) pri = 2;
202   else if (color&0x80) pri = 1;
203   else pri = 0;
204
205   SET_TILE_INFO(
206         0,
207         tile,
208         color&0x7f,
209         TILE_FLIPYX((m92_vram_data[tile_index+3] & 0x6)>>1));
210   tileinfo->group = pri;
211}
212
213static TILE_GET_INFO( get_pf3_wide_tile_info )
214{
215   int tile,color,pri;
216   tile_index = 4*tile_index + pf3_vram_ptr;
217
218   tile=m92_vram_data[tile_index]+(m92_vram_data[tile_index+1]<<8)+((m92_vram_data[tile_index+3]&0x80)<<9);
219   color=m92_vram_data[tile_index+2];
220
221   if (color&0x80) pri = 1;
222   else pri = 0;
223
224   SET_TILE_INFO(
225         0,
226         tile,
227         color&0x7f,
228         TILE_FLIPYX((m92_vram_data[tile_index+3] & 0x6)>>1));
229   tileinfo->group = pri;
230}
231
232160/*****************************************************************************/
233161
234READ8_HANDLER( m92_vram_r )
162WRITE16_HANDLER( m92_vram_w )
235163{
236   return m92_vram_data[offset];
237}
164   int laynum;
238165
239WRITE8_HANDLER( m92_vram_w )
240{
241   int a,wide;
166   COMBINE_DATA(&m92_vram_data[offset]);
242167
243   m92_vram_data[offset]=data;
244
245   /* Work out what area to dirty, potentially more than 1 */
246   a=offset&0xc000;
247   wide=offset&0x7fff;
248   offset&=0x3fff;
249
250   if (a==pf1_vram_ptr || (a==pf1_vram_ptr+0x4000)) {
251      tilemap_mark_tile_dirty(pf1_layer,offset/4);
252      tilemap_mark_tile_dirty(pf1_wide_layer,wide/4);
168   for (laynum = 0; laynum < 3; laynum++)
169   {
170      if ((offset & 0x6000) == pf_layer[laynum].vram_base)
171      {
172         tilemap_mark_tile_dirty(pf_layer[laynum].tmap, (offset & 0x1fff) / 2);
173         tilemap_mark_tile_dirty(pf_layer[laynum].wide_tmap, (offset & 0x3fff) / 2);
174      }
175      if ((offset & 0x6000) == pf_layer[laynum].vram_base + 0x2000)
176         tilemap_mark_tile_dirty(pf_layer[laynum].wide_tmap, (offset & 0x3fff) / 2);
253177   }
254
255   if (a==pf2_vram_ptr)
256      tilemap_mark_tile_dirty(pf2_layer,offset/4);
257
258   if (a==pf3_vram_ptr || (a==pf3_vram_ptr+0x4000)) {
259      tilemap_mark_tile_dirty(pf3_layer,offset/4);
260      tilemap_mark_tile_dirty(pf3_wide_layer,wide/4);
261   }
262178}
263179
264180/*****************************************************************************/
265181
266WRITE8_HANDLER( m92_pf1_control_w )
182WRITE16_HANDLER( m92_pf1_control_w )
267183{
268   pf1_control[offset]=data;
184   COMBINE_DATA(&pf_layer[0].control[offset]);
269185}
270186
271WRITE8_HANDLER( m92_pf2_control_w )
187WRITE16_HANDLER( m92_pf2_control_w )
272188{
273   pf2_control[offset]=data;
189   COMBINE_DATA(&pf_layer[1].control[offset]);
274190}
275191
276WRITE8_HANDLER( m92_pf3_control_w )
192WRITE16_HANDLER( m92_pf3_control_w )
277193{
278   pf3_control[offset]=data;
194   COMBINE_DATA(&pf_layer[2].control[offset]);
279195}
280196
281WRITE8_HANDLER( m92_master_control_w )
197WRITE16_HANDLER( m92_master_control_w )
282198{
283   static int last_pf1_ptr,last_pf2_ptr,last_pf3_ptr;
199   UINT16 old = pf_master_control[offset];
200   pf_layer_info *layer;
284201
285   pf4_control[offset]=data;
202   COMBINE_DATA(&pf_master_control[offset]);
286203
287   switch (offset) {
204   switch (offset)
205   {
288206      case 0: /* Playfield 1 (top layer) */
289         if ((pf4_control[0]&0x10)==0x10) pf1_enable=0; else pf1_enable=1;
290         if ((pf4_control[0]&0x40)==0x40) pf1_rowscroll=1; else pf1_rowscroll=0;
291         pf1_vram_ptr=(pf4_control[0]&3)*0x4000;
292         pf1_shape=(pf4_control[0]&4)>>2;
207      case 1: /* Playfield 2 (middle layer) */
208      case 2: /* Playfield 3 (bottom layer) */
209         layer = &pf_layer[offset];
293210
294         if (pf1_shape) {
295            tilemap_set_enable(pf1_layer,0);
296            tilemap_set_enable(pf1_wide_layer,pf1_enable);
211         /* update VRAM base (bits 0-1) */
212         layer->vram_base = (pf_master_control[offset] & 3) * 0x2000;
213
214         /* update size (bit 2) */
215         if (pf_master_control[offset] & 0x04)
216         {
217            tilemap_set_enable(layer->tmap, FALSE);
218            tilemap_set_enable(layer->wide_tmap, (~pf_master_control[offset] >> 4) & 1);
297219         }
298         else {
299            tilemap_set_enable(pf1_layer,pf1_enable);
300            tilemap_set_enable(pf1_wide_layer,0);
220         else
221         {
222            tilemap_set_enable(layer->tmap, (~pf_master_control[offset] >> 4) & 1);
223            tilemap_set_enable(layer->wide_tmap, FALSE);
301224         }
302         /* Have to dirty tilemaps if vram pointer has changed */
303         if (m92_game_kludge!=1 && last_pf1_ptr!=pf1_vram_ptr) {
304            tilemap_mark_all_tiles_dirty(pf1_layer);
305            tilemap_mark_all_tiles_dirty(pf1_wide_layer);
225
226         /* mark everything dirty of the VRAM base or size changes */
227         if ((old ^ pf_master_control[offset]) & 0x07)
228         {
229            tilemap_mark_all_tiles_dirty(layer->tmap);
230            tilemap_mark_all_tiles_dirty(layer->wide_tmap);
306231         }
307         last_pf1_ptr=pf1_vram_ptr;
308232         break;
309      case 2: /* Playfield 2 (middle layer) */
310         if ((pf4_control[2]&0x10)==0x10) pf2_enable=0; else pf2_enable=1;
311         if ((pf4_control[2]&0x40)==0x40) pf2_rowscroll=1; else pf2_rowscroll=0;
312         tilemap_set_enable(pf2_layer,pf2_enable);
313         pf2_vram_ptr=(pf4_control[2]&3)*0x4000;
314         pf2_shape=(pf4_control[2]&4)>>2;
315         if (last_pf2_ptr!=pf2_vram_ptr)
316            tilemap_mark_all_tiles_dirty(pf2_layer);
317         last_pf2_ptr=pf2_vram_ptr;
318         break;
319      case 4: /* Playfield 3 (bottom layer) */
320         if ((pf4_control[4]&0x10)==0x10) pf3_enable=0; else pf3_enable=1;
321         if ((pf4_control[4]&0x40)==0x40) pf3_rowscroll=1; else pf3_rowscroll=0;
322         pf3_shape=(pf4_control[4]&4)>>2;
323233
324         if (pf3_shape) {
325            tilemap_set_enable(pf3_layer,0);
326            tilemap_set_enable(pf3_wide_layer,pf3_enable);
327         }
328         else {
329            tilemap_set_enable(pf3_layer,pf3_enable);
330            tilemap_set_enable(pf3_wide_layer,0);
331         }
332         pf3_vram_ptr=(pf4_control[4]&3)*0x4000;
333         if (last_pf3_ptr!=pf3_vram_ptr) {
334            tilemap_mark_all_tiles_dirty(pf3_layer);
335            tilemap_mark_all_tiles_dirty(pf3_wide_layer);
336         }
337         last_pf3_ptr=pf3_vram_ptr;
234      case 3:
235         m92_raster_irq_position = pf_master_control[3] - 128;
338236         break;
339      case 6:
340      case 7:
341//          if (flip_screen)
342//              m92_raster_irq_position=256-(((pf4_control[7]<<8) | pf4_control[6])-128);
343//          else
344            m92_raster_irq_position=((pf4_control[7]<<8) | pf4_control[6])-128;
345//          if (offset==7)
346//              logerror("%06x: Raster %d %d\n",activecpu_get_pc(),offset, m92_raster_irq_position);
347         break;
348237   }
349238}
350239
r869r870
352241
353242VIDEO_START( m92 )
354243{
355   pf1_layer = tilemap_create(
356      get_pf1_tile_info,tilemap_scan_rows,
357      TILEMAP_TYPE_PEN,
358      8,8,
359      64,64
360   );
244   int laynum;
361245
362   pf2_layer = tilemap_create(
363      get_pf2_tile_info,tilemap_scan_rows,
364      TILEMAP_TYPE_PEN,
365      8,8,
366      64,64
367   );
246   memset(&pf_layer, 0, sizeof(pf_layer));
247   for (laynum = 0; laynum < 3; laynum++)
248   {
249      pf_layer_info *layer = &pf_layer[laynum];
368250
369   pf3_layer = tilemap_create(
370      get_pf3_tile_info,tilemap_scan_rows,
371      TILEMAP_TYPE_PEN,
372      8,8,
373      64,64
374   );
251      /* allocate two tilemaps per layer, one normal, one wide */
252      layer->tmap = tilemap_create(get_pf_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8,8, 64,64);
253      layer->wide_tmap = tilemap_create(get_pf_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8,8, 128,64);
375254
376   pf1_wide_layer = tilemap_create(
377      get_pf1_wide_tile_info,tilemap_scan_rows,
378      TILEMAP_TYPE_PEN,
379      8,8,
380      128,64
381   );
255      /* set the user data for each one to point to the layer */
256      tilemap_set_user_data(layer->tmap, &pf_layer[laynum]);
257      tilemap_set_user_data(layer->wide_tmap, &pf_layer[laynum]);
382258
383   pf3_wide_layer = tilemap_create(
384      get_pf3_wide_tile_info,tilemap_scan_rows,
385      TILEMAP_TYPE_PEN,
386      8,8,
387      128,64
388   );
259      /* set scroll offsets */
260      tilemap_set_scrolldx(layer->tmap, 2 * laynum, -2 * laynum + 8);
261      tilemap_set_scrolldy(layer->tmap, -128, -128);
262      tilemap_set_scrolldx(layer->wide_tmap, 2 * laynum - 256, -2 * laynum + 8 - 256);
263      tilemap_set_scrolldy(layer->wide_tmap, -128, -128);
389264
390   paletteram = auto_malloc(0x1000);
265      /* layer group 0 - totally transparent in front half */
266      tilemap_set_transmask(layer->tmap, 0, 0xffff, (laynum == 2) ? 0x0000 : 0x0001);
267      tilemap_set_transmask(layer->wide_tmap, 0, 0xffff, (laynum == 2) ? 0x0000 : 0x0001);
391268
392   /* split type 0 - totally transparent in front half */
393   tilemap_set_transmask(pf1_layer,0,0xffff,0x0001);
394   tilemap_set_transmask(pf2_layer,0,0xffff,0x0001);
395   tilemap_set_transmask(pf3_layer,0,0xffff,0x0000);
396   tilemap_set_transmask(pf1_wide_layer,0,0xffff,0x0001);
397   tilemap_set_transmask(pf3_wide_layer,0,0xffff,0x0000);
398   /* split type 1 - pens 0-7 transparent in front half */
399   tilemap_set_transmask(pf1_layer,1,0x00ff,0xff01);
400   tilemap_set_transmask(pf2_layer,1,0x00ff,0xff01);
401   tilemap_set_transmask(pf3_layer,1,0x00ff,0xff00);
402   tilemap_set_transmask(pf1_wide_layer,1,0x00ff,0xff01);
403   tilemap_set_transmask(pf3_wide_layer,1,0x00ff,0xff00);
404   /* split type 2 - pen 0 transparent in front half */
405   tilemap_set_transmask(pf1_layer,2,0x0001,0xffff);
406   tilemap_set_transmask(pf2_layer,2,0x0001,0xffff);
407   tilemap_set_transmask(pf3_layer,2,0x0001,0xfffe);
408   tilemap_set_transmask(pf1_wide_layer,2,0x0001,0xffff);
409   tilemap_set_transmask(pf3_wide_layer,2,0x0001,0xfffe);
269      /* layer group 1 - pens 0-7 transparent in front half */
270      tilemap_set_transmask(layer->tmap, 1, 0x00ff, (laynum == 2) ? 0xff00 : 0xff01);
271      tilemap_set_transmask(layer->wide_tmap, 1, 0x00ff, (laynum == 2) ? 0xff00 : 0xff01);
410272
411   pf1_vram_ptr=pf2_vram_ptr=pf3_vram_ptr=0;
412   pf1_enable=pf2_enable=pf3_enable=0;
413   pf1_rowscroll=pf2_rowscroll=pf3_rowscroll=0;
414   pf1_shape=pf2_shape=pf3_shape=0;
273      /* layer group 2 - pen 0 transparent in front half */
274      tilemap_set_transmask(layer->tmap, 2, 0x0001, (laynum == 2) ? 0xfffe : 0xffff);
275      tilemap_set_transmask(layer->wide_tmap, 2, 0x0001, (laynum == 2) ? 0xfffe : 0xffff);
415276
416   memset(spriteram,0,0x800);
417   memset(buffered_spriteram,0,0x800);
277      state_save_register_item("layer", laynum, layer->vram_base);
278      state_save_register_item_array("layer", laynum, layer->control);
279   }
418280
419   state_save_register_global(pf1_vram_ptr);
420   state_save_register_global(pf1_shape);
421   state_save_register_global(pf1_enable);
422   state_save_register_global(pf1_rowscroll);
423   state_save_register_global_array(pf1_control);
281   paletteram16 = auto_malloc(0x1000);
424282
425   state_save_register_global(pf2_vram_ptr);
426   state_save_register_global(pf2_shape);
427   state_save_register_global(pf2_enable);
428   state_save_register_global(pf2_rowscroll);
429   state_save_register_global_array(pf2_control);
283   memset(spriteram16,0,0x800);
284   memset(buffered_spriteram16,0,0x800);
430285
431   state_save_register_global(pf3_vram_ptr);
432   state_save_register_global(pf3_shape);
433   state_save_register_global(pf3_enable);
434   state_save_register_global(pf3_rowscroll);
435   state_save_register_global_array(pf3_control);
286   state_save_register_global_array(pf_master_control);
436287
437   state_save_register_global_array(pf4_control);
438
439288   state_save_register_global(m92_sprite_list);
440289   state_save_register_global(m92_raster_irq_position);
441290   state_save_register_global(m92_sprite_buffer_busy);
442291   state_save_register_global(m92_palette_bank);
443292
444   state_save_register_global_pointer(paletteram, 0x1000);
293   state_save_register_global_pointer(paletteram16, 0x1000);
445294}
446295
447296/*****************************************************************************/
r869r870
450299{
451300   int offs,k;
452301
453   for (k=0; k<8; k++) {
454      offs = 0;
455      while (offs<m92_sprite_list) {
456
302   for (k=0; k<8; k++)
303   {
304      for (offs = 0; offs < m92_sprite_list; )
305      {
457306         int x,y,sprite,colour,fx,fy,x_multi,y_multi,i,j,s_ptr,pri_back,pri_sprite;
458307
459         y=(buffered_spriteram[offs+0] | (buffered_spriteram[offs+1]<<8))&0x1ff;
460         x=(buffered_spriteram[offs+6] | (buffered_spriteram[offs+7]<<8))&0x1ff;
308         y = buffered_spriteram16[offs+0] & 0x1ff;
309         x = buffered_spriteram16[offs+3] & 0x1ff;
461310
462         if ((buffered_spriteram[offs+4] & 0x80)==0x80) pri_back=0; else pri_back=2;
311         if ((buffered_spriteram16[offs+2] & 0x0080)==0x0080) pri_back=0; else pri_back=2;
463312
464         x = x - 16;
465         y = 512 - 16 - y;
313          sprite= buffered_spriteram16[offs+1];
314         colour = buffered_spriteram16[offs+2] & 0x007f;
315         pri_sprite= (buffered_spriteram16[offs+0] & 0xe000) >> 13;
466316
467          sprite=(buffered_spriteram[offs+2] | (buffered_spriteram[offs+3]<<8));
468         colour=buffered_spriteram[offs+4]&0x7f;
469         pri_sprite=(buffered_spriteram[offs+1] & 0xe0)>>5;
317         fx = (buffered_spriteram16[offs+2] >> 8) & 1;
318         fy = (buffered_spriteram16[offs+2] >> 9) & 1;
319         y_multi = (buffered_spriteram16[offs+0] >> 9) & 3;
320         x_multi = (buffered_spriteram16[offs+0] >> 11) & 3;
470321
471         fx=buffered_spriteram[offs+5]&1;
472         fy=(buffered_spriteram[offs+5]&2)>>1;
473         y_multi=(buffered_spriteram[offs+1]>>1)&0x3;
474         x_multi=(buffered_spriteram[offs+1]>>3)&0x3;
322         y_multi = 1 << y_multi;
323         x_multi = 1 << x_multi;
475324
476         y_multi=1 << y_multi;
477         x_multi=1 << x_multi;
325         offs += 4 * x_multi;
326         if (pri_sprite != k)
327            continue;
478328
329         x = x - 16;
330         y = 384 - 16 - y;
331
479332         if (fx) x+=16 * (x_multi - 1);
480333
481334         for (j=0; j<x_multi; j++)
r869r870
483336            s_ptr=8 * j;
484337            if (!fy) s_ptr+=y_multi-1;
485338
339            x &= 0x1ff;
486340            for (i=0; i<y_multi; i++)
487341            {
488342               if (flip_screen) {
489                  int ffx=fx,ffy=fy;
490                  if (ffx) ffx=0; else ffx=1;
491                  if (ffy) ffy=0; else ffy=1;
492                     if (pri_sprite==k)
493                     {
494                        pdrawgfx(bitmap,machine->gfx[1],
495                              sprite + s_ptr,
496                              colour,
497                              ffx,ffy,
498                              496-x,496-(y-i*16),
499                              cliprect,TRANSPARENCY_PEN,0,pri_back);
500                     }
343                  pdrawgfx(bitmap,machine->gfx[1],
344                        sprite + s_ptr,
345                        colour,
346                        !fx,!fy,
347                        464-x,240-(y-i*16),
348                        cliprect,TRANSPARENCY_PEN,0,pri_back);
349
350                  // wrap around x
351                  pdrawgfx(bitmap,machine->gfx[1],
352                        sprite + s_ptr,
353                        colour,
354                        !fx,!fy,
355                        464-x+512,240-(y-i*16),
356                        cliprect,TRANSPARENCY_PEN,0,pri_back);
501357               } else {
502                     if (pri_sprite==k)
503                     {
504                        pdrawgfx(bitmap,machine->gfx[1],
505                              sprite + s_ptr,
506                              colour,
507                              fx,fy,
508                              x,y-i*16,
509                              cliprect,TRANSPARENCY_PEN,0,pri_back);
358                  pdrawgfx(bitmap,machine->gfx[1],
359                        sprite + s_ptr,
360                        colour,
361                        fx,fy,
362                        x,y-i*16,
363                        cliprect,TRANSPARENCY_PEN,0,pri_back);
510364
511                        // wrap around x
512                        pdrawgfx(bitmap,machine->gfx[1],
513                              sprite + s_ptr,
514                              colour,
515                              fx,fy,
516                              x-512,y-i*16,
517                              cliprect,TRANSPARENCY_PEN,0,pri_back);
518                  }
365                  // wrap around x
366                  pdrawgfx(bitmap,machine->gfx[1],
367                        sprite + s_ptr,
368                        colour,
369                        fx,fy,
370                        x-512,y-i*16,
371                        cliprect,TRANSPARENCY_PEN,0,pri_back);
519372               }
520373               if (fy) s_ptr++; else s_ptr--;
521374            }
522375            if (fx) x-=16; else x+=16;
523            offs+=8;
524376         }
525377      }
526378   }
r869r870
531383
532384static void m92_update_scroll_positions(void)
533385{
534   int i,pf1_off,pf2_off,pf3_off;
386   int laynum;
387   int i;
535388
536389   /*  Playfield 3 rowscroll data is 0xdfc00 - 0xdffff
537390        Playfield 2 rowscroll data is 0xdf800 - 0xdfbff
r869r870
544397
545398    */
546399
547   if (flip_screen) {
548      pf1_off=-25;
549      pf2_off=-27;
550      pf3_off=-29;
551   } else {
552      pf1_off=0;
553      pf2_off=2;
554      pf3_off=4;
555   }
400    for (laynum = 0; laynum < 3; laynum++)
401    {
402       pf_layer_info *layer = &pf_layer[laynum];
556403
557   if (pf1_rowscroll) {
558      tilemap_set_scroll_rows(pf1_layer,512);
559      tilemap_set_scroll_rows(pf1_wide_layer,512);
560      for (i=0; i<1024; i+=2)
561         tilemap_set_scrollx( pf1_layer,i/2, (m92_vram_data[0xf400+i]+(m92_vram_data[0xf401+i]<<8))-pf1_off);
562      for (i=0; i<1024; i+=2)
563         tilemap_set_scrollx( pf1_wide_layer,i/2, (m92_vram_data[0xf400+i]+(m92_vram_data[0xf401+i]<<8))-pf1_off+256);
564   } else {
565      tilemap_set_scroll_rows(pf1_layer,1);
566      tilemap_set_scroll_rows(pf1_wide_layer,1);
567      tilemap_set_scrollx( pf1_layer,0, (pf1_control[5]<<8)+pf1_control[4]-pf1_off );
568      tilemap_set_scrollx( pf1_wide_layer,0, (pf1_control[5]<<8)+pf1_control[4]+256-pf1_off );
569   }
404      if (pf_master_control[laynum] & 0x40)
405      {
406         const UINT16 *scrolldata = m92_vram_data + (0xf400 + 0x400 * laynum) / 2;
570407
571   if (pf2_rowscroll) {
572      tilemap_set_scroll_rows(pf2_layer,512);
573      for (i=0; i<1024; i+=2)
574         tilemap_set_scrollx( pf2_layer,i/2, (m92_vram_data[0xf800+i]+(m92_vram_data[0xf801+i]<<8))-pf2_off);
575   } else {
576      tilemap_set_scroll_rows(pf2_layer,1);
577      tilemap_set_scrollx( pf2_layer,0, (pf2_control[5]<<8)+pf2_control[4]-pf2_off );
578   }
408         tilemap_set_scroll_rows(layer->tmap, 512);
409         tilemap_set_scroll_rows(layer->wide_tmap, 512);
410         for (i = 0; i < 512; i++)
411         {
412            tilemap_set_scrollx(layer->tmap, i, scrolldata[i]);
413            tilemap_set_scrollx(layer->wide_tmap, i, scrolldata[i]);
414         }
415      }
416      else
417      {
418         tilemap_set_scroll_rows(layer->tmap, 1);
419         tilemap_set_scroll_rows(layer->wide_tmap, 1);
420         tilemap_set_scrollx(layer->tmap, 0, layer->control[2]);
421         tilemap_set_scrollx(layer->wide_tmap, 0, layer->control[2]);
422      }
579423
580   if (pf3_rowscroll) {
581      tilemap_set_scroll_rows(pf3_layer,512);
582      for (i=0; i<1024; i+=2)
583         tilemap_set_scrollx( pf3_layer,i/2, (m92_vram_data[0xfc00+i]+(m92_vram_data[0xfc01+i]<<8))-pf3_off);
584      tilemap_set_scroll_rows(pf3_wide_layer,512);
585      for (i=0; i<1024; i+=2)
586         tilemap_set_scrollx( pf3_wide_layer,i/2, (m92_vram_data[0xfc00+i]+(m92_vram_data[0xfc01+i]<<8))-pf3_off+256);
587   } else {
588      tilemap_set_scroll_rows(pf3_layer,1);
589      tilemap_set_scrollx( pf3_layer,0, (pf3_control[5]<<8)+pf3_control[4]-pf3_off );
590      tilemap_set_scroll_rows(pf3_wide_layer,1);
591      tilemap_set_scrollx( pf3_wide_layer,0, (pf3_control[5]<<8)+pf3_control[4]-pf3_off+256 );
424      tilemap_set_scrolly(layer->tmap, 0, layer->control[0]);
425      tilemap_set_scrolly(layer->wide_tmap, 0, layer->control[0]);
592426   }
593
594   tilemap_set_scrolly( pf1_layer,0, (pf1_control[1]<<8)+pf1_control[0] );
595   tilemap_set_scrolly( pf2_layer,0, (pf2_control[1]<<8)+pf2_control[0] );
596   tilemap_set_scrolly( pf3_layer,0, (pf3_control[1]<<8)+pf3_control[0] );
597   tilemap_set_scrolly( pf1_wide_layer,0, (pf1_control[1]<<8)+pf1_control[0] );
598   tilemap_set_scrolly( pf3_wide_layer,0, (pf3_control[1]<<8)+pf3_control[0] );
599427}
600428
601429/*****************************************************************************/
602430
603431static void m92_screenrefresh(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
604432{
605   fillbitmap(priority_bitmap,0,cliprect);
433   fillbitmap(priority_bitmap, 0, cliprect);
606434
607   if (pf3_enable) {
608      tilemap_draw(bitmap,cliprect,pf3_wide_layer,TILEMAP_DRAW_LAYER1,0);
609      tilemap_draw(bitmap,cliprect,pf3_layer,      TILEMAP_DRAW_LAYER1,0);
435   if ((~pf_master_control[2] >> 4) & 1)
436   {
437      tilemap_draw(bitmap, cliprect, pf_layer[2].wide_tmap, TILEMAP_DRAW_LAYER1, 0);
438      tilemap_draw(bitmap, cliprect, pf_layer[2].tmap,      TILEMAP_DRAW_LAYER1, 0);
439      tilemap_draw(bitmap, cliprect, pf_layer[2].wide_tmap, TILEMAP_DRAW_LAYER0, 1);
440      tilemap_draw(bitmap, cliprect, pf_layer[2].tmap,      TILEMAP_DRAW_LAYER0, 1);
610441   }
611442   else
612      fillbitmap(bitmap,machine->pens[0],cliprect);
443      fillbitmap(bitmap, machine->pens[0], cliprect);
613444
614   tilemap_draw(bitmap,cliprect,pf3_wide_layer,TILEMAP_DRAW_LAYER0,1);
615   tilemap_draw(bitmap,cliprect,pf3_layer,      TILEMAP_DRAW_LAYER0,1);
445   tilemap_draw(bitmap, cliprect, pf_layer[1].wide_tmap, TILEMAP_DRAW_LAYER1, 0);
446   tilemap_draw(bitmap, cliprect, pf_layer[1].tmap,      TILEMAP_DRAW_LAYER1, 0);
447   tilemap_draw(bitmap, cliprect, pf_layer[1].wide_tmap, TILEMAP_DRAW_LAYER0, 1);
448   tilemap_draw(bitmap, cliprect, pf_layer[1].tmap,      TILEMAP_DRAW_LAYER0, 1);
616449
617   tilemap_draw(bitmap,cliprect,pf2_layer,      TILEMAP_DRAW_LAYER1, 0);
618   tilemap_draw(bitmap,cliprect,pf2_layer,      TILEMAP_DRAW_LAYER0,1);
450   tilemap_draw(bitmap, cliprect, pf_layer[0].wide_tmap, TILEMAP_DRAW_LAYER1, 0);
451   tilemap_draw(bitmap, cliprect, pf_layer[0].tmap,      TILEMAP_DRAW_LAYER1, 0);
452   tilemap_draw(bitmap, cliprect, pf_layer[0].wide_tmap, TILEMAP_DRAW_LAYER0, 1);
453   tilemap_draw(bitmap, cliprect, pf_layer[0].tmap,      TILEMAP_DRAW_LAYER0, 1);
619454
620   tilemap_draw(bitmap,cliprect,pf1_wide_layer,TILEMAP_DRAW_LAYER1, 0);
621   tilemap_draw(bitmap,cliprect,pf1_layer,      TILEMAP_DRAW_LAYER1, 0);
622   tilemap_draw(bitmap,cliprect,pf1_wide_layer,TILEMAP_DRAW_LAYER0,1);
623   tilemap_draw(bitmap,cliprect,pf1_layer,      TILEMAP_DRAW_LAYER0,1);
624
625   draw_sprites(machine,bitmap,cliprect);
455   draw_sprites(machine, bitmap, cliprect);
626456}
627457
458
628459VIDEO_UPDATE( m92 )
629460{
630461   m92_update_scroll_positions();
631   m92_screenrefresh(machine,bitmap,cliprect);
462   m92_screenrefresh(machine, bitmap, cliprect);
632463
633   /* check the keyboard */
634   if (input_code_pressed_once(KEYCODE_F1)) {
635      m92_raster_enable ^= 1;
636      if (m92_raster_enable)
637         popmessage("Raster IRQ enabled");
638      else
639         popmessage("Raster IRQ disabled");
640   }
641
642464   /* Flipscreen appears hardwired to the dipswitch - strange */
643   if (readinputport(5)&1)
465   if (readinputportbytag("DIPS21") & 0x100)
644466      flip_screen_set(0);
645467   else
646468      flip_screen_set(1);
647469   return 0;
648470}
649
src/mame/video/m107.c
r869r870
3535*****************************************************************************/
3636
3737#include "driver.h"
38#include "m107.h"
3839
39static tilemap *pf4_layer,*pf3_layer,*pf2_layer,*pf1_layer;
40static int m107_control[0x20];
41static UINT8 *m107_spriteram;
42UINT8 *m107_vram_data;
43int m107_raster_irq_position,m107_sprite_list;
44int m107_spritesystem;
45
46static int pf1_vram_ptr,pf2_vram_ptr,pf3_vram_ptr,pf4_vram_ptr;
47static int pf1_enable,pf2_enable,pf3_enable,pf4_enable;
48static int pf1_rowscroll,pf2_rowscroll,pf3_rowscroll,pf4_rowscroll;
49
50/*****************************************************************************/
51
52static TILE_GET_INFO( get_pf1_tile_info )
40typedef struct _pf_layer_info pf_layer_info;
41struct _pf_layer_info
5342{
54   int tile,color;
55   tile_index = 4*tile_index + pf1_vram_ptr;
43   tilemap *      tmap;
44   UINT16         vram_base;
45   UINT16         control[4];
46};
5647
57   tile=m107_vram_data[tile_index]+(m107_vram_data[tile_index+1]<<8);
58   if (m107_vram_data[tile_index+3] & 0x10) tile+=0x10000;
59   color=m107_vram_data[tile_index+2];
48static pf_layer_info pf_layer[4];
6049
61   SET_TILE_INFO(
62         0,
63         tile,
64         color&0x7f,
65         TILE_FLIPYX((m107_vram_data[tile_index+3] & 0xc)>>2));
6650
67   /* Priority 1 = tile appears above sprites */
68   tileinfo->category = ((m107_vram_data[tile_index+3]&2)>>1);
69}
51static UINT16 m107_control[0x10];
52static UINT16 *m107_spriteram;
53UINT16 *m107_vram_data;
54UINT16 m107_raster_irq_position;
55UINT8 m107_spritesystem;
7056
71static TILE_GET_INFO( get_pf2_tile_info )
72{
73   int tile,color;
74   tile_index = 4*tile_index + pf2_vram_ptr;
7557
76   tile=m107_vram_data[tile_index]+(m107_vram_data[tile_index+1]<<8);
77   if (m107_vram_data[tile_index+3] & 0x10) tile+=0x10000;
78   color=m107_vram_data[tile_index+2];
58/*****************************************************************************/
7959
80   SET_TILE_INFO(
81         0,
82         tile,
83         color&0x7f,
84         TILE_FLIPYX((m107_vram_data[tile_index+3] & 0xc)>>2));
85
86   tileinfo->category = ((m107_vram_data[tile_index+3]&2)>>1);
87}
88
89static TILE_GET_INFO( get_pf3_tile_info )
60static TILE_GET_INFO( get_pf_tile_info )
9061{
91   int tile,color;
92   tile_index = 4*tile_index + pf3_vram_ptr;
62   pf_layer_info *layer = param;
63   int tile, attrib;
64   tile_index = 2 * tile_index + layer->vram_base;
9365
94   tile=m107_vram_data[tile_index]+(m107_vram_data[tile_index+1]<<8);
95   if (m107_vram_data[tile_index+3] & 0x10) tile+=0x10000;
96   color=m107_vram_data[tile_index+2];
66   attrib = m107_vram_data[tile_index + 1];
67   tile = m107_vram_data[tile_index] + ((attrib & 0x1000) << 4);
9768
9869   SET_TILE_INFO(
9970         0,
10071         tile,
101         color&0x7f,
102         TILE_FLIPYX((m107_vram_data[tile_index+3] & 0xc)>>2));
103}
72         attrib & 0x7f,
73         TILE_FLIPYX(attrib >> 10));
10474
105static TILE_GET_INFO( get_pf4_tile_info )
106{
107   int tile,color;
108   tile_index = 4*tile_index + pf4_vram_ptr;
109
110   tile=m107_vram_data[tile_index]+(m107_vram_data[tile_index+1]<<8);
111   if (m107_vram_data[tile_index+3] & 0x10) tile+=0x10000;
112   color=m107_vram_data[tile_index+2];
113
114   SET_TILE_INFO(
115         0,
116         tile,
117         color&0x7f,
118         TILE_FLIPYX((m107_vram_data[tile_index+3] & 0xc)>>2));
75   /* Priority 1 = tile appears above sprites */
76   tileinfo->category = (attrib >> 9) & 1;
11977}
12078
12179/*****************************************************************************/
12280
123READ8_HANDLER( m107_vram_r )
81WRITE16_HANDLER( m107_vram_w )
12482{
125   return m107_vram_data[offset];
126}
83   int laynum;
12784
128WRITE8_HANDLER( m107_vram_w )
129{
130   int a;
131
132   m107_vram_data[offset]=data;
133
134   /* Work out what area to dirty, potentially more than 1 */
135   a=offset&0xc000;
136   offset&=0x3fff;
137
138   if (a==pf1_vram_ptr)
139      tilemap_mark_tile_dirty( pf1_layer,offset/4);
140
141   if (a==pf2_vram_ptr)
142      tilemap_mark_tile_dirty( pf2_layer,offset/4);
143
144   if (a==pf3_vram_ptr)
145      tilemap_mark_tile_dirty( pf3_layer,offset/4);
146
147   if (a==pf4_vram_ptr)
148      tilemap_mark_tile_dirty( pf4_layer,offset/4);
85   COMBINE_DATA(&m107_vram_data[offset]);
86   for (laynum = 0; laynum < 4; laynum++)
87      if ((offset & 0x6000) == pf_layer[laynum].vram_base)
88         tilemap_mark_tile_dirty(pf_layer[laynum].tmap, (offset & 0x1fff) / 2);
14989}
15090
15191/*****************************************************************************/
15292
153WRITE8_HANDLER( m107_control_w )
93WRITE16_HANDLER( m107_control_w )
15494{
155   static int last_pf1,last_pf2,last_pf3,last_pf4;
95   UINT16 old = m107_control[offset];
96   pf_layer_info *layer;
15697
157   m107_control[offset]=data;
98   COMBINE_DATA(&m107_control[offset]);
15899
159   switch (offset) {
160      case 0x10: /* Playfield 1 (top layer) */
161      case 0x11:
162         if ((m107_control[0x10]&0x80)==0x80) pf1_enable=0; else pf1_enable=1;
163         if ((m107_control[0x10]&0x02)==0x02) pf1_rowscroll=1; else pf1_rowscroll=0;
164         tilemap_set_enable(pf1_layer,pf1_enable);
165         pf1_vram_ptr=(m107_control[0x11]&0xf)*0x1000;
166         /* Have to dirty tilemaps if vram pointer has changed */
167         if (last_pf1!=pf1_vram_ptr)
168            tilemap_mark_all_tiles_dirty(pf1_layer);
169         last_pf1=pf1_vram_ptr;
170         break;
100   switch (offset)
101   {
102      case 0x08: /* Playfield 1 (top layer) */
103      case 0x09: /* Playfield 2 */
104      case 0x0a: /* Playfield 3 */
105      case 0x0b: /* Playfield 4 (bottom layer) */
106         layer = &pf_layer[offset - 0x08];
171107
172      case 0x12: /* Playfield 2 */
173      case 0x13:
174         if ((m107_control[0x12]&0x80)==0x80) pf2_enable=0; else pf2_enable=1;
175         if ((m107_control[0x12]&0x02)==0x02) pf2_rowscroll=1; else pf2_rowscroll=0;
176         tilemap_set_enable(pf2_layer,pf2_enable);
177         pf2_vram_ptr=(m107_control[0x13]&0xf)*0x1000;
178         /* Have to dirty tilemaps if vram pointer has changed */
179         if (last_pf2!=pf2_vram_ptr)
180            tilemap_mark_all_tiles_dirty(pf2_layer);
181         last_pf2=pf2_vram_ptr;
182         break;
108         /* update VRAM base (bits 8-11) */
109         layer->vram_base = ((m107_control[offset] >> 8) & 15) * 0x800;
183110
184      case 0x14: /* Playfield 3 */
185      case 0x15:
186         if ((m107_control[0x14]&0x80)==0x80) pf3_enable=0; else pf3_enable=1;
187         if ((m107_control[0x14]&0x02)==0x02) pf3_rowscroll=1; else pf3_rowscroll=0;
188         tilemap_set_enable(pf3_layer,pf3_enable);
189         pf3_vram_ptr=(m107_control[0x15]&0xf)*0x1000;
190         /* Have to dirty tilemaps if vram pointer has changed */
191         if (last_pf3!=pf3_vram_ptr)
192            tilemap_mark_all_tiles_dirty(pf3_layer);
193         last_pf3=pf3_vram_ptr;
194         break;
111         /* update enable (bit 7) */
112         tilemap_set_enable(layer->tmap, (~m107_control[offset] >> 7) & 1);
195113
196      case 0x16: /* Playfield 4 */
197      case 0x17:
198         if ((m107_control[0x16]&0x80)==0x80) pf4_enable=0; else pf4_enable=1;
199         if ((m107_control[0x16]&0x02)==0x02) pf4_rowscroll=1; else pf4_rowscroll=0;
200         tilemap_set_enable(pf4_layer,pf4_enable);
201         pf4_vram_ptr=(m107_control[0x17]&0xf)*0x1000;
202         /* Have to dirty tilemaps if vram pointer has changed */
203         if (last_pf4!=pf4_vram_ptr)
204            tilemap_mark_all_tiles_dirty(pf4_layer);
205         last_pf4=pf4_vram_ptr;
114         /* mark everything dirty of the VRAM base changes */
115         if ((old ^ m107_control[offset]) & 0x0f00)
116            tilemap_mark_all_tiles_dirty(layer->tmap);
206117         break;
207118
208      case 0x1e:
209      case 0x1f:
210         m107_raster_irq_position=((m107_control[0x1f]<<8) | m107_control[0x1e])-128;
119      case 0x0f:
120         m107_raster_irq_position = m107_control[offset] - 128;
211121         break;
212122   }
213123}
r869r870
216126
217127VIDEO_START( m107 )
218128{
219   pf1_layer = tilemap_create(
220      get_pf1_tile_info,tilemap_scan_rows,
221      TILEMAP_TYPE_PEN,
222      8,8,
223      64,64
224   );
129   int laynum;
225130
226   pf2_layer = tilemap_create(
227      get_pf2_tile_info,tilemap_scan_rows,
228      TILEMAP_TYPE_PEN,
229      8,8,
230      64,64
231   );
131   for (laynum = 0; laynum < 4; laynum++)
132   {
133      pf_layer_info *layer = &pf_layer[laynum];
232134
233   pf3_layer = tilemap_create(
234      get_pf3_tile_info,tilemap_scan_rows,
235      TILEMAP_TYPE_PEN,
236      8,8,
237      64,64
238   );
135      /* allocate a tilemaps per layer */
136      layer->tmap = tilemap_create(get_pf_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8,8, 64,64);
239137
240   pf4_layer = tilemap_create(
241      get_pf4_tile_info,tilemap_scan_rows,
242      0,
243      8,8,
244      64,64
245   );
138      /* set the user data to point to the layer */
139      tilemap_set_user_data(layer->tmap, &pf_layer[laynum]);
246140
247   tilemap_set_transparent_pen(pf1_layer,0);
248   tilemap_set_transparent_pen(pf2_layer,0);
249   tilemap_set_transparent_pen(pf3_layer,0);
141      /* set scroll offsets */
142      tilemap_set_scrolldx(layer->tmap, -3 + 2 * laynum, -3 + 2 * laynum);
143      tilemap_set_scrolldy(layer->tmap, -128, -128);
250144
251   pf1_vram_ptr=pf2_vram_ptr=pf3_vram_ptr=pf4_vram_ptr=0;
252   pf1_enable=pf2_enable=pf3_enable=pf4_enable=0;
253   pf1_rowscroll=pf2_rowscroll=pf3_rowscroll=pf4_rowscroll=0;
145      /* set pen 0 to transparent for all tilemaps except #4 */
146      if (laynum != 3)
147         tilemap_set_transparent_pen(layer->tmap, 0);
148   }
254149
255150   m107_spriteram = auto_malloc(0x1000);
256151   memset(m107_spriteram,0,0x1000);
257
258   m107_sprite_list=0;
259152}
260153
261154/*****************************************************************************/
r869r870
264157{
265158   int offs;
266159
267   for (offs = 0x1000-8;offs >= 0;offs -= 8) {
160   for (offs = 0x800-4;offs >= 0;offs -= 4)
161   {
268162      int x,y,sprite,colour,fx,fy,y_multi,i,s_ptr;
269163
270      if (((m107_spriteram[offs+4]&0x80)==0x80) && pri==0) continue;
271      if (((m107_spriteram[offs+4]&0x80)==0x00) && pri==1) continue;
164      if (((m107_spriteram[offs+2]&0x80)==0x80) && pri==0) continue;
165      if (((m107_spriteram[offs+2]&0x80)==0x00) && pri==1) continue;
272166
273      y=m107_spriteram[offs+0] | (m107_spriteram[offs+1]<<8);
274      x=m107_spriteram[offs+6] | (m107_spriteram[offs+7]<<8);
167      y=m107_spriteram[offs+0];
168      x=m107_spriteram[offs+3];
275169      x&=0x1ff;
276170      y&=0x1ff;
277171
278172      if (x==0 || y==0) continue; /* offscreen */
279173
280       sprite=(m107_spriteram[offs+2] | (m107_spriteram[offs+3]<<8))&0x7fff;
174       sprite=m107_spriteram[offs+1]&0x7fff;
281175
282176      x = x - 16;
283      y = 512 - 16 - y;
177      y = 384 - 16 - y;
284178
285      colour=m107_spriteram[offs+4]&0x7f;
286      fx=m107_spriteram[offs+5]&1;
287      fy=m107_spriteram[offs+5]&2;
288      y_multi=(m107_spriteram[offs+1]>>3)&0x3;
179      colour=m107_spriteram[offs+2]&0x7f;
180      fx=m107_spriteram[offs+2]&0x100;
181      fy=m107_spriteram[offs+2]&0x200;
182      y_multi=(m107_spriteram[offs+0]>>11)&0x3;
289183
290184      if (m107_spritesystem == 0)
291185      {
r869r870
346240
347241static void m107_update_scroll_positions(void)
348242{
243   int laynum;
349244   int i;
350245
351246   /*  Playfield 4 rowscroll data is 0xde800 - 0xdebff???
r869r870
354249        Playfield 1 rowscroll data is 0xde800 - 0xdebff     ??
355250    */
356251
357   if (pf1_rowscroll) {
358      tilemap_set_scroll_rows(pf1_layer,512);
359      for (i=0; i<1024; i+=2)
360         tilemap_set_scrollx( pf1_layer,i/2, (m107_vram_data[0xe800+i]+(m107_vram_data[0xe801+i]<<8)));
361   } else {
362      tilemap_set_scroll_rows(pf1_layer,1);
363      tilemap_set_scrollx( pf1_layer,0, (m107_control[3]<<8)+m107_control[2]+3 );
364   }
365   if (pf2_rowscroll) {
366      tilemap_set_scroll_rows(pf2_layer,512);
367      for (i=0; i<1024; i+=2)
368         tilemap_set_scrollx( pf2_layer,i/2, (m107_vram_data[0xf400+i]+(m107_vram_data[0xf401+i]<<8)));
369   } else {
370      tilemap_set_scroll_rows(pf2_layer,1);
371      tilemap_set_scrollx( pf2_layer,0, (m107_control[7]<<8)+m107_control[6]+1 );
372   }
373   if (pf3_rowscroll) {
374      tilemap_set_scroll_rows(pf3_layer,512);
375      for (i=0; i<1024; i+=2)
376         tilemap_set_scrollx( pf3_layer,i/2, (m107_vram_data[0xf800+i]+(m107_vram_data[0xf801+i]<<8)));
377   } else {
378      tilemap_set_scroll_rows(pf3_layer,1);
379      tilemap_set_scrollx( pf3_layer,0, (m107_control[11]<<8)+m107_control[10]-1 );
380   }
381   if (pf4_rowscroll) {
382      tilemap_set_scroll_rows(pf4_layer,512);
383      for (i=0; i<1024; i+=2)
384         tilemap_set_scrollx( pf4_layer,i/2, (m107_vram_data[0xfc00+i]+(m107_vram_data[0xfc01+i]<<8)));
385   } else {
386      tilemap_set_scroll_rows(pf4_layer,1);
387      tilemap_set_scrollx( pf4_layer,0, (m107_control[15]<<8)+m107_control[14]-3 );
388   }
252    for (laynum = 0; laynum < 4; laynum++)
253    {
254       pf_layer_info *layer = &pf_layer[laynum];
389255
390   tilemap_set_scrolly( pf1_layer,0, (m107_control[1]<<8)+m107_control[0] );
391   tilemap_set_scrolly( pf2_layer,0, (m107_control[5]<<8)+m107_control[4] );
392   tilemap_set_scrolly( pf3_layer,0, (m107_control[9]<<8)+m107_control[8] );
393   tilemap_set_scrolly( pf4_layer,0, (m107_control[13]<<8)+m107_control[12] );
256      if (m107_control[0x08 + laynum] & 0x02)
257      {
258         const UINT16 *scrolldata = m107_vram_data + (0xf000 + 0x400 * laynum) / 2;
394259
395//  pf4_layer->scrolled=1;
396//  pf3_layer->scrolled=1;
397//  pf2_layer->scrolled=1;
398//  pf1_layer->scrolled=1;
260         tilemap_set_scroll_rows(layer->tmap, 512);
261         for (i = 0; i < 512; i++)
262            tilemap_set_scrollx(layer->tmap, i, scrolldata[i]);
263      }
264      else
265      {
266         tilemap_set_scroll_rows(layer->tmap, 1);
267         tilemap_set_scrollx(layer->tmap, 0, m107_control[1 + 2 * laynum]);
268      }
269
270      tilemap_set_scrolly(layer->tmap, 0, m107_control[0 + 2 * laynum]);
271   }
399272}
400273
401274/*****************************************************************************/
402275
403void m107_screenrefresh(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
276void m107_screenrefresh(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
404277{
405   if (pf4_enable)
406      tilemap_draw(bitmap,cliprect,pf4_layer,0,0);
278   if ((~m107_control[0x0b] >> 7) & 1)
279   {
280      tilemap_draw(bitmap, cliprect, pf_layer[3].tmap, 0, 0);
281      tilemap_draw(bitmap, cliprect, pf_layer[3].tmap, 1, 0);
282   }
407283   else
408      fillbitmap(bitmap,machine->pens[0],cliprect);
284      fillbitmap(bitmap, machine->pens[0], cliprect);
409285
410   tilemap_draw(bitmap,cliprect,pf3_layer,0,0);
411   tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
412   tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
286   tilemap_draw(bitmap, cliprect, pf_layer[2].tmap, 0, 0);
287   tilemap_draw(bitmap, cliprect, pf_layer[2].tmap, 1, 0);
413288
414   draw_sprites(machine,bitmap,cliprect,0);
415   tilemap_draw(bitmap,cliprect,pf2_layer,1,0);
416   tilemap_draw(bitmap,cliprect,pf1_layer,1,0);
289   tilemap_draw(bitmap, cliprect, pf_layer[1].tmap, 0, 0);
290   tilemap_draw(bitmap, cliprect, pf_layer[0].tmap, 0, 0);
417291
418   draw_sprites(machine, bitmap,cliprect,1);
292   draw_sprites(machine, bitmap, cliprect, 0);
293   tilemap_draw(bitmap, cliprect, pf_layer[1].tmap, 1, 0);
294   tilemap_draw(bitmap, cliprect, pf_layer[0].tmap, 1, 0);
419295
296   draw_sprites(machine, bitmap, cliprect, 1);
297
420298   /* This hardware probably has more priority values - but I haven't found
421299        any used yet */
422300}
423301
424302/*****************************************************************************/
425303
426WRITE8_HANDLER( m107_spritebuffer_w )
304WRITE16_HANDLER( m107_spritebuffer_w )
427305{
428   if (offset==0) {
306   if (ACCESSING_LSB) {
429307//      logerror("%04x: buffered spriteram\n",activecpu_get_pc());
430      memcpy(m107_spriteram,spriteram,0x1000);
308      memcpy(m107_spriteram,spriteram16,0x1000);
431309   }
432310}
433311
r869r870
436314VIDEO_UPDATE( m107 )
437315{
438316   m107_update_scroll_positions();
439   m107_screenrefresh(machine, bitmap,cliprect);
317   m107_screenrefresh(machine, bitmap, cliprect);
440318   return 0;
441319}
442320
src/mame/video/sengokmj.c
r869r870
77#include "driver.h"
88
99static tilemap *bg_tilemap,*md_tilemap,*fg_tilemap,*tx_tilemap;
10UINT8 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram;
10UINT16 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram;
1111
12WRITE8_HANDLER( sengokmj_bgvram_w )
12WRITE16_HANDLER( sengokmj_bgvram_w )
1313{
14   sengokmj_bgvram[offset] = data;
15   tilemap_mark_tile_dirty(bg_tilemap,offset/2);
14   COMBINE_DATA(&sengokmj_bgvram[offset]);
15   tilemap_mark_tile_dirty(bg_tilemap,offset);
1616}
1717
18WRITE8_HANDLER( sengokmj_mdvram_w )
18WRITE16_HANDLER( sengokmj_mdvram_w )
1919{
20   sengokmj_mdvram[offset] = data;
21   tilemap_mark_tile_dirty(md_tilemap,offset/2);
20   COMBINE_DATA(&sengokmj_mdvram[offset]);
21   tilemap_mark_tile_dirty(md_tilemap,offset);
2222}
2323
24WRITE8_HANDLER( sengokmj_fgvram_w )
24WRITE16_HANDLER( sengokmj_fgvram_w )
2525{
26   sengokmj_fgvram[offset] = data;
27   tilemap_mark_tile_dirty(fg_tilemap,offset/2);
26   COMBINE_DATA(&sengokmj_fgvram[offset]);
27   tilemap_mark_tile_dirty(fg_tilemap,offset);
2828}
2929
30WRITE8_HANDLER( sengokmj_txvram_w )
30WRITE16_HANDLER( sengokmj_txvram_w )
3131{
32   sengokmj_txvram[offset] = data;
33   tilemap_mark_tile_dirty(tx_tilemap,offset/2);
32   COMBINE_DATA(&sengokmj_txvram[offset]);
33   tilemap_mark_tile_dirty(tx_tilemap,offset);
3434}
3535
3636static TILE_GET_INFO( sengoku_bg_tile_info )
3737{
38   int tile = sengokmj_bgvram[tile_index*2] + (sengokmj_bgvram[2*tile_index+1] << 8);
38   int tile = sengokmj_bgvram[tile_index];
3939   int color = (tile >> 12) & 0x0f;
4040   SET_TILE_INFO(1, tile & 0xfff, color, 0);
4141}
4242
4343static TILE_GET_INFO( sengoku_md_tile_info )
4444{
45   int tile = sengokmj_mdvram[tile_index*2] + (sengokmj_mdvram[2*tile_index+1] << 8);
45   int tile = sengokmj_mdvram[tile_index];
4646   int color = (tile >> 12) & 0x0f;
4747   SET_TILE_INFO(1, (tile & 0xfff) + 0x1000, color + 0x10, 0);
4848}
4949
5050static TILE_GET_INFO( sengoku_fg_tile_info )
5151{
52   int tile = sengokmj_fgvram[tile_index*2] + (sengokmj_fgvram[2*tile_index+1] << 8);
52   int tile = sengokmj_fgvram[tile_index];
5353   int color = (tile >> 12) & 0x0f;
5454   SET_TILE_INFO(1, (tile & 0xfff) + 0x2000, color + 0x20, 0);
5555}
5656
5757static TILE_GET_INFO( sengoku_tx_tile_info )
5858{
59   int tile = sengokmj_txvram[tile_index*2] + (sengokmj_txvram[2*tile_index+1] << 8);
59   int tile = sengokmj_txvram[tile_index];
6060   int color = (tile >> 12) & 0x0f;
6161   SET_TILE_INFO(2, (tile & 0xfff) + 0x3000, color, 0);
6262}
r869r870
6666   int offs,fx,fy,x,y,color,sprite;
6767   int dx,dy,ax,ay;
6868
69   for (offs = 0x800-8;offs >= 0;offs -= 8)
69   for (offs = 0x400-4;offs >= 0;offs -= 4)
7070   {
71      if ((spriteram[offs+1]&0x80)!=0x80) continue;
72      sprite = spriteram[offs+2] | (spriteram[offs+3]<<8);
71      if ((spriteram16[offs+0]&0x8000)!=0x8000) continue;
72      sprite = spriteram16[offs+1];
7373      if ((sprite>>14)!=pri) continue;
7474      sprite &= 0x1fff;
7575
76      y = spriteram[offs+6] + (spriteram[offs+7]<<8);
77      x = 128 + (spriteram[offs+4] + (spriteram[offs+5]<<8));
76      y = spriteram16[offs+3];
77      x = 128 + spriteram16[offs+2];
7878
7979      if (x&0x8000) x=0-(0x200-(x&0x1ff));
8080      //else x&=0x1ff;
8181      if (y&0x8000) y=0-(0x200-(y&0x1ff));
8282      //else y&=0x1ff;
8383
84      color = spriteram[offs+0]&0x3f;
85      fx = spriteram[offs+0]&0x40;
84      color = spriteram16[offs+0]&0x3f;
85      fx = spriteram16[offs+0]&0x40;
8686      fy = 0; /* To do - probably 0x2000 */
87      dy = (((spriteram[offs+0] + (spriteram[offs+1]<<8))&0x0380)>>7) + 1;
88      dx = (((spriteram[offs+0] + (spriteram[offs+1]<<8))&0x1c00)>>10) + 1;
87      dy = ((spriteram16[offs+0]&0x0380)>>7) + 1;
88      dx = ((spriteram16[offs+0]&0x1c00)>>10) + 1;
8989
9090      for (ax=0; ax<dx; ax++)
9191         for (ay=0; ay<dy; ay++) {
src/mame/drivers/rainbow.c
r869r870
198198    Hint E        |  N/A       |  LRSLRSJR
199199    Hint F        |  N/A       |  SBJLSBRR
200200
201
202
203Stephh's notes (based on the game M68000 code and some tests) :
204
2051) 'rainbow*'
206
207  - Region stored at 0x02fffe.w
208  - Sets :
209      * 'rainbow'  : region = 0x0000
210      * 'rainbowo' : region = 0x0000
211      * 'rainbowe' : region = 0x0000
212  - Possible regions :
213      * 0x0000 : Japan
214      * 0x0001 : US
215      * 0x0002 : World
216      * 0x0003 : US, licenced to ROMSTAR
217      * 0x0004 : licenced to PHOENIX ELECTRONICS CO.
218  - Coinage relies on "Coin Mode" Dip Switch (code at 0x0030fc) :
219      * "Mode A" uses TAITO_COINAGE_JAPAN_OLD
220      * "Mode B" uses TAITO_COINAGE_WORLD
221
222
2232) 'jumping'
224
225  - Region stored at 0x02fffe.w
226  - Sets :
227      * 'jumping' : region = 0x0000
228  - If you change the region, you'll notice that the copyright strings
229    haven't been correcly erased !
230  - Some Dip Switches have no effect due to code at 0x000850;
231    this means the following things :
232      * always upright cabinet
233      * screen never flipped
234      * impossible to enter the "test mode"
235      * always English language
236
201237***************************************************************************/
202238
203239#include "driver.h"
240#include "taitoipt.h"
204241#include "video/taitoic.h"
205242#include "audio/taitosnd.h"
206243#include "sound/2203intf.h"
r869r870
214251
215252WRITE16_HANDLER( jumping_spritectrl_w );
216253WRITE16_HANDLER( rainbow_spritectrl_w );
217WRITE16_HANDLER( rainbow_cchip_ram_w );
254
255void rainbow_cchip_init(int version);
256READ16_HANDLER( rainbow_cchip_ctrl_r );
257READ16_HANDLER( rainbow_cchip_ram_r );
218258WRITE16_HANDLER( rainbow_cchip_ctrl_w );
219259WRITE16_HANDLER( rainbow_cchip_bank_w );
260WRITE16_HANDLER( rainbow_cchip_ram_w );
220261
221READ16_HANDLER( rainbow_cchip_ram_r );
222READ16_HANDLER( rainbow_cchip_ctrl_r );
223
224void rainbow_cchip_init(int version);
225
226262static UINT8 jumping_latch = 0;
227263
228264
r869r870
368404             INPUT PORTS, DIPs
369405***********************************************************/
370406
371INPUT_PORTS_START( rainbow )
372   PORT_START   /* DIP SWITCH A */
373   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
374   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
375   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
376   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
377   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
378   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
379   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
380   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
381   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
382   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
407INPUT_PORTS_START( rainbow_generic )
408   PORT_START_TAG("DSWA")
409   TAITO_MACHINE_COCKTAIL
383410   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
384   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
385   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
386   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
387   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
411   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
412   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
413   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
414   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
415   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
416   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
417   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
418   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
388419   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
389   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
390   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
391   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
392   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
420   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
421   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
422   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
423   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
424   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
425   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
426   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
427   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
393428
394   PORT_START   /* DIP SWITCH B */
395   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
396   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
397   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
398   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
399   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
429   PORT_START_TAG("DSWB")
430   TAITO_DIFFICULTY
400431   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
432   PORT_DIPSETTING(    0x04, "100k 1000k" )
401433   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
402   PORT_DIPSETTING(    0x04, "100k,1000k" )
403434   PORT_DIPNAME( 0x08, 0x08, "Complete Bonus" )
404   PORT_DIPSETTING(    0x00, "100K Points" )
405435   PORT_DIPSETTING(    0x08, "1 Up" )
436   PORT_DIPSETTING(    0x00, "100k" )
406437   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
407438   PORT_DIPSETTING(    0x10, "1" )
408439   PORT_DIPSETTING(    0x00, "2" )
r869r870
411442   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Language ) )
412443   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
413444   PORT_DIPSETTING(    0x40, DEF_STR( Japanese ) )
414   PORT_DIPNAME( 0x80, 0x00, "Coin Type" )
415   PORT_DIPSETTING(    0x00, "Type 1" )
416   PORT_DIPSETTING(    0x80, "Type 2" )
445   PORT_DIPNAME( 0x80, 0x80, "Coin Mode" )
446   PORT_DIPSETTING(    0x80, "Mode A (Japan)" ) /* Mode A is TAITO_COINAGE_JAPAN_OLD */
447   PORT_DIPSETTING(    0x00, "Mode B (World)" ) /* Mode B is TAITO_COINAGE_WORLD */
448INPUT_PORTS_END
417449
418   PORT_START   /* 800007 */
450INPUT_PORTS_START( rainbow )
451   PORT_INCLUDE(rainbow_generic)
452
453   /* 0x390000 -> 0x10cfc2 ($fc2,A5) : DSWA */
454
455   /* 0x3b0000 -> 0x10cfc4 ($fc4,A5) : DSWB */
456
457   PORT_START_TAG("800007")
458   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
459   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
460   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
461   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
462   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
419463   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
420464   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
421465   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
422466
423   PORT_START /* 800009 */
467   PORT_START_TAG("800009")
424468   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
425469   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
470   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
471   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
472   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
473   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
474   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
475   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
426476
427   PORT_START   /* 80000B */
477   PORT_START_TAG("80000B")
428478   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
479   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
429480   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
430481   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
431482   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
r869r870
433484   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
434485   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
435486
436   PORT_START   /* 80000d */
487   PORT_START_TAG("80000D")
488   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
437489   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
438490   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
439   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
440   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2)
441   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
442   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
491   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
492   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
493   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
494   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
443495INPUT_PORTS_END
444496
445497INPUT_PORTS_START( jumping )
446   PORT_START   /* DIP SWITCH A */
447   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
448   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
449   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
450   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
451   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
452   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
453   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
454   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
455   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
456   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
457   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
458   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
459   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
460   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
461   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
462   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
463   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
464   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
465   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
466   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
467   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
468   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
498   PORT_INCLUDE(rainbow_generic)
469499
470   PORT_START   /* DIP SWITCH B */
471   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
472   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
473   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
474   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
475   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
476   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Bonus_Life ) )
477   PORT_DIPSETTING(    0x04, "100k,1000k" )
478   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
479   PORT_DIPNAME( 0x08, 0x00, "Complete Bonus" )
480   PORT_DIPSETTING(    0x08, "1 Up" )
481   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
482   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
483   PORT_DIPSETTING(    0x10, "1" )
484   PORT_DIPSETTING(    0x00, "2" )
485   PORT_DIPSETTING(    0x30, "3" )
486   PORT_DIPSETTING(    0x20, "4" )
487   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
488   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
489   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
490   PORT_DIPNAME( 0x80, 0x00, "Coin Type" )
491   PORT_DIPSETTING(    0x00, "Type 1" )
492   PORT_DIPSETTING(    0x80, "Type 2" )
500   /* 0x400000 -> 0x10cfc2 ($fc2,A5) */
501   PORT_MODIFY("DSWA")
502   PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )                        /* see notes */
503   PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW )                        /* see notes */
504   PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )                        /* see notes */
493505
494   PORT_START  /* 401001 - Coins Etc. */
495   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
496   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
497   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 )
498   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
506   /* 0x400002 -> 0x10cfc4 ($fc4,A5) */
507   PORT_MODIFY("DSWB")
508   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )                        /* see notes */
499509
500   PORT_START   /* 401003 - Player Controls */
510   PORT_START_TAG("401001")
511   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
512   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
513   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
514   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
515   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
516   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
517   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
518   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
519
520   PORT_START_TAG("401003")
521   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
501522   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
502523   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
524   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
525   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
526   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
503527   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
504528   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
505529INPUT_PORTS_END
src/mame/drivers/dynduke.c
r869r870
2727#include "sound/3812intf.h"
2828#include "sound/okim6295.h"
2929
30WRITE8_HANDLER( dynduke_background_w );
31WRITE8_HANDLER( dynduke_foreground_w );
32WRITE8_HANDLER( dynduke_text_w );
33WRITE8_HANDLER( dynduke_gfxbank_w );
34WRITE8_HANDLER( dynduke_control_w );
35WRITE8_HANDLER( dynduke_paletteram_w );
30WRITE16_HANDLER( dynduke_background_w );
31WRITE16_HANDLER( dynduke_foreground_w );
32WRITE16_HANDLER( dynduke_text_w );
33WRITE16_HANDLER( dynduke_gfxbank_w );
34WRITE16_HANDLER( dynduke_control_w );
35WRITE16_HANDLER( dynduke_paletteram_w );
3636VIDEO_START( dynduke );
3737VIDEO_UPDATE( dynduke );
3838VIDEO_EOF( dynduke );
3939
40extern UINT8 *dynduke_back_data, *dynduke_fore_data, *dynduke_scroll_ram;
40extern UINT16 *dynduke_back_data, *dynduke_fore_data, *dynduke_scroll_ram;
4141
4242/* Memory Maps */
4343
44static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
44static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 16 )
4545   AM_RANGE(0x00000, 0x06fff) AM_RAM
46   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
46   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
4747   AM_RANGE(0x08000, 0x080ff) AM_RAM AM_BASE(&dynduke_scroll_ram)
4848   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1)
49   AM_RANGE(0x0b000, 0x0b000) AM_READ(input_port_1_r)
50   AM_RANGE(0x0b001, 0x0b001) AM_READ(input_port_2_r)
51   AM_RANGE(0x0b002, 0x0b002) AM_READ(input_port_3_r)
52   AM_RANGE(0x0b003, 0x0b003) AM_READ(input_port_4_r)
53   AM_RANGE(0x0b004, 0x0b004) AM_WRITENOP
54   AM_RANGE(0x0b006, 0x0b006) AM_WRITE(dynduke_control_w)
55   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_WRITE(dynduke_text_w) AM_BASE(&videoram)
56   AM_RANGE(0x0d000, 0x0d00d) AM_READWRITE(seibu_main_v30_r, seibu_main_v30_w)
49   AM_RANGE(0x0b000, 0x0b001) AM_READ(input_port_1_word_r)
50   AM_RANGE(0x0b002, 0x0b003) AM_READ(input_port_2_word_r)
51   AM_RANGE(0x0b004, 0x0b005) AM_WRITENOP
52   AM_RANGE(0x0b006, 0x0b007) AM_WRITE(dynduke_control_w)
53   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_WRITE(dynduke_text_w) AM_BASE(&videoram16)
54   AM_RANGE(0x0d000, 0x0d00d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
5755   AM_RANGE(0xa0000, 0xfffff) AM_ROM
5856ADDRESS_MAP_END
5957
60static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 8 )
58static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 16 )
6159   AM_RANGE(0x00000, 0x05fff) AM_RAM
6260   AM_RANGE(0x06000, 0x067ff) AM_RAM AM_WRITE(dynduke_background_w) AM_BASE(&dynduke_back_data)
6361   AM_RANGE(0x06800, 0x06fff) AM_RAM AM_WRITE(dynduke_foreground_w) AM_BASE(&dynduke_fore_data)
64   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_WRITE(dynduke_paletteram_w) AM_BASE(&paletteram)
62   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_WRITE(dynduke_paletteram_w) AM_BASE(&paletteram16)
6563   AM_RANGE(0x08000, 0x08fff) AM_RAM AM_SHARE(1)
6664   AM_RANGE(0x0a000, 0x0a001) AM_WRITE(dynduke_gfxbank_w)
6765   AM_RANGE(0x0c000, 0x0c001) AM_WRITENOP
r869r870
6967ADDRESS_MAP_END
7068
7169/* Memory map used by DlbDyn - probably an addressing PAL is different */
72static ADDRESS_MAP_START( masterj_map, ADDRESS_SPACE_PROGRAM, 8 )
70static ADDRESS_MAP_START( masterj_map, ADDRESS_SPACE_PROGRAM, 16 )
7371   AM_RANGE(0x00000, 0x06fff) AM_RAM
74   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
75   AM_RANGE(0x08000, 0x087ff) AM_RAM AM_WRITE(dynduke_text_w) AM_BASE(&videoram)
76   AM_RANGE(0x09000, 0x0900d) AM_READWRITE(seibu_main_v30_r, seibu_main_v30_w)
72   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
73   AM_RANGE(0x08000, 0x087ff) AM_RAM AM_WRITE(dynduke_text_w) AM_BASE(&videoram16)
74   AM_RANGE(0x09000, 0x0900d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
7775   AM_RANGE(0x0c000, 0x0c0ff) AM_RAM AM_BASE(&dynduke_scroll_ram)
7876   AM_RANGE(0x0e000, 0x0efff) AM_RAM AM_SHARE(1)
79   AM_RANGE(0x0f000, 0x0f000) AM_READ(input_port_1_r)
80   AM_RANGE(0x0f001, 0x0f001) AM_READ(input_port_2_r)
81   AM_RANGE(0x0f002, 0x0f002) AM_READ(input_port_3_r)
82   AM_RANGE(0x0f003, 0x0f003) AM_READ(input_port_4_r)
83   AM_RANGE(0x0f004, 0x0f004) AM_WRITENOP
84   AM_RANGE(0x0f006, 0x0f006) AM_WRITE(dynduke_control_w)
77   AM_RANGE(0x0f000, 0x0f001) AM_READ(input_port_1_word_r)
78   AM_RANGE(0x0f002, 0x0f003) AM_READ(input_port_2_word_r)
79   AM_RANGE(0x0f004, 0x0f005) AM_WRITENOP
80   AM_RANGE(0x0f006, 0x0f007) AM_WRITE(dynduke_control_w)
8581   AM_RANGE(0xa0000, 0xfffff) AM_ROM
8682ADDRESS_MAP_END
8783
r869r870
9187   SEIBU_COIN_INPUTS   // Must be port 0: coin inputs read through sound cpu
9288
9389   PORT_START_TAG("IN0")
94   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(1)
95   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1)
96   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(1)
97   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
98   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
99   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
100   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
101   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
90   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(1)
91   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1)
92   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(1)
93   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
94   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
95   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
96   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
97   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
98   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(2)
99   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(2)
100   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(2)
101   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
102   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
103   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
104   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
105   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
102106
103   PORT_START_TAG("IN1")
104   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(2)
105   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(2)
106   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(2)
107   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
108   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
109   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
110   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
111   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
112
113107   /*
114108        SW#1
115109        --------------------------------------------------------------------
r869r870
146140        FACTORY SETTINGS                     OFF OFF OFF OFF OFF OFF OFF OFF
147141        --------------------------------------------------------------------
148142    */
149   PORT_START_TAG("DSW1")
150   PORT_DIPNAME( 0x07, 0x06, DEF_STR( Coin_A ) )
151   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
152   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
153   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
154   PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
155   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Coin_B ) )
156   PORT_DIPSETTING(    0x18, DEF_STR( 1C_2C ) )
157   PORT_DIPSETTING(    0x10, DEF_STR( 1C_3C ) )
158   PORT_DIPSETTING(    0x08, DEF_STR( 1C_5C ) )
159   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
160   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
161   PORT_DIPNAME( 0x20, 0x20, "Starting Coin" )
162   PORT_DIPSETTING(    0x20, DEF_STR( Normal ) )
163   PORT_DIPSETTING(    0x00, "X 2" )
164   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
165   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
166   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
167   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) )
168   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
169   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
170
171   PORT_START_TAG("DSW2")
172   PORT_BIT( 0x03, 0x03, IPT_UNUSED )
173   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
174   PORT_DIPSETTING(    0x0c, "80K 100K+" )
175   PORT_DIPSETTING(    0x08, "100K 100K+" )
176   PORT_DIPSETTING(    0x04, "120K 100K+" )
177   PORT_DIPSETTING(    0x00, "120K 120K+" )
178   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
179   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
180   PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
181   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
182   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
183   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
184   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
185   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
186   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
187   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
188   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
143   PORT_START_TAG("DSW")
144   PORT_DIPNAME( 0x0007, 0x0006, DEF_STR( Coin_A ) )
145   PORT_DIPSETTING(    0x0000, DEF_STR( 5C_1C ) )
146   PORT_DIPSETTING(    0x0002, DEF_STR( 3C_1C ) )
147   PORT_DIPSETTING(    0x0004, DEF_STR( 2C_1C ) )
148   PORT_DIPSETTING(    0x0006, DEF_STR( 1C_1C ) )
149   PORT_DIPNAME( 0x0018, 0x0008, DEF_STR( Coin_B ) )
150   PORT_DIPSETTING(    0x0018, DEF_STR( 1C_2C ) )
151   PORT_DIPSETTING(    0x0010, DEF_STR( 1C_3C ) )
152   PORT_DIPSETTING(    0x0008, DEF_STR( 1C_5C ) )
153   PORT_DIPSETTING(    0x0000, DEF_STR( 1C_6C ) )
154   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
155   PORT_DIPNAME( 0x0020, 0x0020, "Starting Coin" )
156   PORT_DIPSETTING(    0x0020, DEF_STR( Normal ) )
157   PORT_DIPSETTING(    0x0000, "X 2" )
158   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unused ) )
159   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
160   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
161   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) )
162   PORT_DIPSETTING(    0x0080, DEF_STR( Off ) )
163   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
164   PORT_BIT( 0x0300, 0x0300, IPT_UNUSED )
165   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Bonus_Life ) )
166   PORT_DIPSETTING(    0x0c00, "80K 100K+" )
167   PORT_DIPSETTING(    0x0800, "100K 100K+" )
168   PORT_DIPSETTING(    0x0400, "120K 100K+" )
169   PORT_DIPSETTING(    0x0000, "120K 120K+" )
170   PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Difficulty ) )
171   PORT_DIPSETTING(    0x3000, DEF_STR( Normal ) )
172   PORT_DIPSETTING(    0x2000, DEF_STR( Easy ) )
173   PORT_DIPSETTING(    0x1000, DEF_STR( Hard ) )
174   PORT_DIPSETTING(    0x0000, DEF_STR( Hardest ) )
175   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Allow_Continue ) )
176   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
177   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
178   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Demo_Sounds ) )
179   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
180   PORT_DIPSETTING(    0x8000, DEF_STR( On ) )
189181INPUT_PORTS_END
190182
191183/* Graphics Layouts */
src/mame/drivers/tempest.c
r869r870
586586   MDRV_CPU_PERIODIC_INT(irq0_line_assert, (double)MASTER_CLOCK / 4096 / 12)
587587   MDRV_WATCHDOG_TIME_INIT(MAME_TIME_IN_HZ(CLOCK_3KHZ / 256))
588588   MDRV_SCREEN_REFRESH_RATE(60)
589   MDRV_SCREEN_VBLANK_TIME(0)
589   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
590590   MDRV_NVRAM_HANDLER(atari_vg)
591591
592592   /* video hardware */
src/mame/drivers/bublbobl.c
r869r870
748748   MDRV_CPU_PROGRAM_MAP(tokio_sound_map, 0) // NMIs are triggered by the main CPU, IRQs are triggered by the YM2203
749749
750750   MDRV_SCREEN_REFRESH_RATE(VSYNC)   // 59.185606 Hz
751   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(VBLANK))    // 2560 us
751   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(VBLANK))    // 2560 us
752752   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
753753
754754   // video hardware
r869r870
791791   MDRV_CPU_VBLANK_INT(irq0_line_pulse, 1) // comes from the same clock that latches the INT pin on the second Z80
792792
793793   MDRV_SCREEN_REFRESH_RATE(VSYNC)   // 59.185606 Hz
794   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(VBLANK))    // 2560 us
794   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(VBLANK))    // 2560 us
795795   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
796796
797797   // video hardware
src/mame/drivers/aerofgt.c
r869r870
16341634   MDRV_CPU_IO_MAP(aerofgt_sound_readport,aerofgt_sound_writeport)
16351635                        /* IRQs are triggered by the YM2610 */
16361636   MDRV_SCREEN_REFRESH_RATE(60)
1637   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(500))
1637   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(500))
16381638            /* wrong but improves sprite-background synchronization */
16391639
16401640   MDRV_MACHINE_RESET(aerofgt)
r869r870
16741674   MDRV_CPU_IO_MAP(aerofgt_sound_readport,aerofgt_sound_writeport)
16751675                        /* IRQs are triggered by the YM2610 */
16761676   MDRV_SCREEN_REFRESH_RATE(60)
1677   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(400))
1677   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(400))
16781678            /* wrong but improves sprite-background synchronization */
16791679
16801680   MDRV_MACHINE_RESET(aerofgt)
r869r870
17121712   MDRV_CPU_PROGRAM_MAP(aerfboot_snd_map,0)
17131713
17141714   MDRV_SCREEN_REFRESH_RATE(60)
1715   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(500))
1715   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(500))
17161716            /* wrong but improves sprite-background synchronization */
17171717
17181718   /* video hardware */
src/mame/drivers/ultrsprt.c
r869r870
279279   MDRV_CPU_PERIODIC_INT(irq5_line_hold, 1)   // ???
280280
281281   MDRV_SCREEN_REFRESH_RATE(60)
282   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
282   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
283283
284284   MDRV_INTERLEAVE(200)
285285
src/mame/drivers/mystston.c
r869r870
250250   MDRV_CPU_VBLANK_INT(mystston_interrupt, 272)
251251
252252   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
253   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
253   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
254254
255255   /* video hardware */
256256   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/sslam.c
r869r870
412412   AM_RANGE(0x280000, 0x280fff) AM_READWRITE(MRA16_RAM, bigtwin_paletteram_w) AM_BASE(&paletteram16)
413413   AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&sslam_spriteram)
414414   AM_RANGE(0x304000, 0x304001) AM_WRITENOP
415   AM_RANGE(0x300010, 0x300011) AM_READ(port_tag_to_handler16("IN0"))
416   AM_RANGE(0x300012, 0x300013) AM_READ(port_tag_to_handler16("IN1"))
417   AM_RANGE(0x300014, 0x300015) AM_READ(port_tag_to_handler16("IN2"))
418   AM_RANGE(0x300016, 0x300017) AM_READ(port_tag_to_handler16("IN3"))
419   AM_RANGE(0x300018, 0x300019) AM_READ(port_tag_to_handler16("IN4"))
420   AM_RANGE(0x30001a, 0x30001b) AM_READ(port_tag_to_handler16("DSW1"))
421   AM_RANGE(0x30001c, 0x30001d) AM_READ(port_tag_to_handler16("DSW2"))
415   AM_RANGE(0x300010, 0x300011) AM_READ_PORT("IN0")
416   AM_RANGE(0x300012, 0x300013) AM_READ_PORT("IN1")
417   AM_RANGE(0x300014, 0x300015) AM_READ_PORT("IN2")
418   AM_RANGE(0x300016, 0x300017) AM_READ_PORT("IN3")
419   AM_RANGE(0x300018, 0x300019) AM_READ_PORT("IN4")
420   AM_RANGE(0x30001a, 0x30001b) AM_READ_PORT("DSW1")
421   AM_RANGE(0x30001c, 0x30001d) AM_READ_PORT("DSW2")
422422   AM_RANGE(0x30001e, 0x30001f) AM_WRITE(sslam_snd_w)
423423   AM_RANGE(0xf00000, 0xffffff) AM_RAM     /* Main RAM */
424424
r869r870
433433   AM_RANGE(0x200000, 0x200001) AM_WRITENOP
434434   AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&sslam_spriteram)
435435   AM_RANGE(0x280000, 0x2803ff) AM_READWRITE(MRA16_RAM, bigtwin_paletteram_w) AM_BASE(&paletteram16)
436   AM_RANGE(0x300010, 0x300011) AM_READ(port_tag_to_handler16("IN0"))
437   AM_RANGE(0x300012, 0x300013) AM_READ(port_tag_to_handler16("IN1"))
438   AM_RANGE(0x300014, 0x300015) AM_READ(port_tag_to_handler16("IN2"))
439   AM_RANGE(0x30001a, 0x30001b) AM_READ(port_tag_to_handler16("DSW1"))
440   AM_RANGE(0x30001c, 0x30001d) AM_READ(port_tag_to_handler16("DSW2"))
436   AM_RANGE(0x300010, 0x300011) AM_READ_PORT("IN0")
437   AM_RANGE(0x300012, 0x300013) AM_READ_PORT("IN1")
438   AM_RANGE(0x300014, 0x300015) AM_READ_PORT("IN2")
439   AM_RANGE(0x30001a, 0x30001b) AM_READ_PORT("DSW1")
440   AM_RANGE(0x30001c, 0x30001d) AM_READ_PORT("DSW2")
441441   AM_RANGE(0x30001e, 0x30001f) AM_WRITE(powerbls_sound_w)
442442   AM_RANGE(0x304000, 0x304001) AM_WRITENOP
443443   AM_RANGE(0xff0000, 0xffffff) AM_RAM     /* Main RAM */
src/mame/drivers/simpl156.c
r869r870
488488   MDRV_CPU_VBLANK_INT(simpl156_vbl_interrupt,1)
489489
490490   MDRV_SCREEN_REFRESH_RATE(58)
491   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(800))
491   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(800))
492492   MDRV_NVRAM_HANDLER(simpl156) // 93C45
493493
494494   /* video hardware */
src/mame/drivers/deadang.c
r869r870
1919#include "sound/2203intf.h"
2020#include "sound/msm5205.h"
2121
22static UINT8 *deadang_shared_ram;
23extern UINT8 *deadang_video_data, *deadang_scroll_ram;
22extern UINT16 *deadang_video_data, *deadang_scroll_ram;
2423
25extern WRITE8_HANDLER( deadang_foreground_w );
26extern WRITE8_HANDLER( deadang_text_w );
27extern WRITE8_HANDLER( deadang_bank_w );
24extern WRITE16_HANDLER( deadang_foreground_w );
25extern WRITE16_HANDLER( deadang_text_w );
26extern WRITE16_HANDLER( deadang_bank_w );
2827
2928extern VIDEO_START( deadang );
3029extern VIDEO_UPDATE( deadang );
3130
3231/* Read/Write Handlers */
3332
34static READ8_HANDLER( deadang_shared_r )
33static READ16_HANDLER( ghunter_trackball_low_r )
3534{
36   return deadang_shared_ram[offset];
35   return (readinputport(3) & 0xff) | ((readinputport(4) & 0xff) << 8);
3736}
38
39static WRITE8_HANDLER( deadang_shared_w )
37static READ16_HANDLER( ghunter_trackball_high_r )
4038{
41   deadang_shared_ram[offset] = data;
39   return ((readinputport(3) & 0x0f00) >> 4) | (readinputport(4) & 0x0f00);
4240}
4341
44READ8_HANDLER( ghunter_trackball_low_r )
45{
46   switch (offset)
47   {
48      case 0:   return (readinputport(5) & 0xff);
49      case 1: return (readinputport(6) & 0xff);
50   }
51
52   return 0;
53}
54READ8_HANDLER( ghunter_trackball_high_r )
55{
56   switch (offset)
57   {
58      case 0:   return (readinputport(5) & 0xff00) >> 4;
59      case 1: return (readinputport(6) & 0xff00) >> 4;
60   }
61
62   return 0;
63}
64
6542/* Memory Maps */
6643
67static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
68   AM_RANGE(0x00000, 0x03fff) AM_READ(MRA8_RAM)
69   AM_RANGE(0x04000, 0x04fff) AM_READ(deadang_shared_r)
70   AM_RANGE(0x06000, 0x0600f) AM_READ(seibu_main_v30_r)
71   AM_RANGE(0x0a000, 0x0a000) AM_READ(input_port_1_r)
72   AM_RANGE(0x0a001, 0x0a001) AM_READ(input_port_2_r)
73   AM_RANGE(0x0a002, 0x0a002) AM_READ(input_port_3_r)
74   AM_RANGE(0x0a003, 0x0a003) AM_READ(input_port_4_r)
75   AM_RANGE(0xc0000, 0xfffff) AM_READ(MRA8_ROM)
44static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
45   AM_RANGE(0x00000, 0x037ff) AM_RAM
46   AM_RANGE(0x03800, 0x03fff) AM_RAM AM_BASE(&spriteram16)
47   AM_RANGE(0x04000, 0x04fff) AM_RAM AM_SHARE(1)
48   AM_RANGE(0x05000, 0x05fff) AM_WRITE(MWA16_RAM)
49   AM_RANGE(0x06000, 0x0600f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
50   AM_RANGE(0x06010, 0x07fff) AM_WRITE(MWA16_RAM)
51   AM_RANGE(0x08000, 0x087ff) AM_WRITE(deadang_text_w) AM_BASE(&videoram16)
52   AM_RANGE(0x08800, 0x0bfff) AM_WRITE(MWA16_RAM)
53   AM_RANGE(0x0a000, 0x0a001) AM_READ(input_port_1_word_r)
54   AM_RANGE(0x0a002, 0x0a003) AM_READ(input_port_2_word_r)
55   AM_RANGE(0x0c000, 0x0cfff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
56   AM_RANGE(0x0d000, 0x0dfff) AM_WRITE(MWA16_RAM)
57   AM_RANGE(0x0e000, 0x0e0ff) AM_WRITE(MWA16_RAM) AM_BASE(&deadang_scroll_ram)
58   AM_RANGE(0x0e100, 0x0ffff) AM_WRITE(MWA16_RAM)
59   AM_RANGE(0xc0000, 0xfffff) AM_ROM
7660ADDRESS_MAP_END
7761
78static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
79   AM_RANGE(0x00000, 0x037ff) AM_WRITE(MWA8_RAM)
80   AM_RANGE(0x03800, 0x03fff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram)
81   AM_RANGE(0x04000, 0x04fff) AM_WRITE(deadang_shared_w) AM_BASE(&deadang_shared_ram)
82   AM_RANGE(0x05000, 0x05fff) AM_WRITE(MWA8_RAM)
83   AM_RANGE(0x06000, 0x0600f) AM_WRITE(seibu_main_v30_w)
84   AM_RANGE(0x06010, 0x07fff) AM_WRITE(MWA8_RAM)
85   AM_RANGE(0x08000, 0x087ff) AM_WRITE(deadang_text_w) AM_BASE(&videoram)
86   AM_RANGE(0x08800, 0x0bfff) AM_WRITE(MWA8_RAM)
87   AM_RANGE(0x0c000, 0x0cfff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
88   AM_RANGE(0x0d000, 0x0dfff) AM_WRITE(MWA8_RAM)
89   AM_RANGE(0x0e000, 0x0e0ff) AM_WRITE(MWA8_RAM) AM_BASE(&deadang_scroll_ram)
90   AM_RANGE(0x0e100, 0x0ffff) AM_WRITE(MWA8_RAM)
91   AM_RANGE(0xc0000, 0xfffff) AM_WRITE(MWA8_ROM)
62static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 16 )
63   AM_RANGE(0x00000, 0x037ff) AM_RAM
64   AM_RANGE(0x03800, 0x03fff) AM_READWRITE(MRA16_RAM, deadang_foreground_w) AM_BASE(&deadang_video_data)
65   AM_RANGE(0x04000, 0x04fff) AM_RAM AM_SHARE(1)
66   AM_RANGE(0x08000, 0x08001) AM_WRITE(deadang_bank_w)
67   AM_RANGE(0x0c000, 0x0c001) AM_WRITE(watchdog_reset16_w)
68   AM_RANGE(0xe0000, 0xfffff) AM_ROM
9269ADDRESS_MAP_END
9370
94static ADDRESS_MAP_START( sub_readmem, ADDRESS_SPACE_PROGRAM, 8 )
95   AM_RANGE(0x00000, 0x037ff) AM_READ(MRA8_RAM)
96   AM_RANGE(0x03800, 0x03fff) AM_READ(MRA8_RAM)
97   AM_RANGE(0x04000, 0x04fff) AM_READ(deadang_shared_r)
98   AM_RANGE(0xe0000, 0xfffff) AM_READ(MRA8_ROM)
99ADDRESS_MAP_END
100
101static ADDRESS_MAP_START( sub_writemem, ADDRESS_SPACE_PROGRAM, 8 )
102   AM_RANGE(0x00000, 0x037ff) AM_WRITE(MWA8_RAM)
103   AM_RANGE(0x03800, 0x03fff) AM_WRITE(deadang_foreground_w) AM_BASE(&deadang_video_data)
104   AM_RANGE(0x04000, 0x04fff) AM_WRITE(deadang_shared_w)
105   AM_RANGE(0x08000, 0x08000) AM_WRITE(deadang_bank_w)
106   AM_RANGE(0x0c000, 0x0c000) AM_WRITE(watchdog_reset_w)
107   AM_RANGE(0xe0000, 0xfffff) AM_WRITE(MWA8_ROM)
108ADDRESS_MAP_END
109
11071/* Input Ports */
11172
11273INPUT_PORTS_START( deadang )
11374   SEIBU_COIN_INPUTS   /* Must be port 0: coin inputs read through sound cpu */
11475
11576   PORT_START   /* IN0 */
116   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
117   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
118   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
119   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
120   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
121   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
122   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
77   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
78   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
79   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
80   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
81   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
82   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
83   PORT_BIT( 0x00c0, IP_ACTIVE_LOW, IPT_UNUSED )
84   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
85   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
86   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
87   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
88   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
89   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
90   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 )
91   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
12392
124   PORT_START   /* IN1 */
125   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
126   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
127   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
128   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
129   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
130   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
131   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
132   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
133
13493   PORT_START   /* Dip switch A */
135   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
136   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
137   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
138   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
139   PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
140   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
141   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
142   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
143   PORT_DIPSETTING(    0x01, DEF_STR( 1C_5C ) )
144   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) )
145   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
146   PORT_DIPSETTING(    0x18, DEF_STR( 1C_1C ) )
147   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
148   PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
149   PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
150   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
151   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
152   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
153   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet) )
154   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
155   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
156
157   PORT_START   /* Dip switch B */
158   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
159   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
160   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
161   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
162   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
163   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
164   PORT_DIPSETTING(    0x08, "20K 50K" )
165   PORT_DIPSETTING(    0x0c, "30K 100K" )
166   PORT_DIPSETTING(    0x04, "50K 150K" )
167   PORT_DIPSETTING(    0x00, "100K 200K" )
168   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
169   PORT_DIPSETTING(    0x20, "1" )
170   PORT_DIPSETTING(    0x10, "2" )
171   PORT_DIPSETTING(    0x30, "3" )
172   PORT_DIPSETTING(    0x00, "4" )
173   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
174   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
175   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
176   PORT_DIPNAME( 0x80, 0x80, "User Mode" )
177   PORT_DIPSETTING(    0x00, DEF_STR( Japan ) )
178   PORT_DIPSETTING(    0x80, "Overseas" )
94   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
95   PORT_DIPSETTING(    0x0000, DEF_STR( 5C_1C ) )
96   PORT_DIPSETTING(    0x0004, DEF_STR( 4C_1C ) )
97   PORT_DIPSETTING(    0x0002, DEF_STR( 3C_1C ) )
98   PORT_DIPSETTING(    0x0006, DEF_STR( 2C_1C ) )
99   PORT_DIPSETTING(    0x0007, DEF_STR( 1C_1C ) )
100   PORT_DIPSETTING(    0x0003, DEF_STR( 1C_2C ) )
101   PORT_DIPSETTING(    0x0005, DEF_STR( 1C_3C ) )
102   PORT_DIPSETTING(    0x0001, DEF_STR( 1C_5C ) )
103   PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Coin_B ) )
104   PORT_DIPSETTING(    0x0010, DEF_STR( 2C_1C ) )
105   PORT_DIPSETTING(    0x0018, DEF_STR( 1C_1C ) )
106   PORT_DIPSETTING(    0x0000, DEF_STR( 2C_3C ) )
107   PORT_DIPSETTING(    0x0008, DEF_STR( 1C_2C ) )
108   PORT_SERVICE( 0x0020, IP_ACTIVE_LOW )
109   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )
110   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
111   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
112   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Cabinet) )
113   PORT_DIPSETTING(    0x0080, DEF_STR( Upright ) )
114   PORT_DIPSETTING(    0x0000, DEF_STR( Cocktail ) )
115   /* Dip switch B */
116   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )
117   PORT_DIPSETTING(    0x0200, DEF_STR( Easy ) )
118   PORT_DIPSETTING(    0x0300, DEF_STR( Normal ) )
119   PORT_DIPSETTING(    0x0100, DEF_STR( Hard ) )
120   PORT_DIPSETTING(    0x0000, DEF_STR( Hardest ) )
121   PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Bonus_Life ) )
122   PORT_DIPSETTING(    0x0800, "20K 50K" )
123   PORT_DIPSETTING(    0x0c00, "30K 100K" )
124   PORT_DIPSETTING(    0x0400, "50K 150K" )
125   PORT_DIPSETTING(    0x0000, "100K 200K" )
126   PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Lives ) )
127   PORT_DIPSETTING(    0x2000, "1" )
128   PORT_DIPSETTING(    0x1000, "2" )
129   PORT_DIPSETTING(    0x3000, "3" )
130   PORT_DIPSETTING(    0x0000, "4" )
131   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) )
132   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
133   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
134   PORT_DIPNAME( 0x8000, 0x8000, "User Mode" )
135   PORT_DIPSETTING(    0x0000, DEF_STR( Japan ) )
136   PORT_DIPSETTING(    0x8000, "Overseas" )
179137INPUT_PORTS_END
180138
181139INPUT_PORTS_START( ghunter )
182140   SEIBU_COIN_INPUTS   /* Must be port 0: coin inputs read through sound cpu */
183141
184142   PORT_START   /* IN0 */
185   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
186   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
187   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
188   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
189   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
190   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
191   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
143   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
144   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
145   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
146   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
147   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
148   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
149   PORT_BIT( 0x00c0, IP_ACTIVE_LOW, IPT_UNUSED )
150   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
151   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
152   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
153   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
154   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
155   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
156   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 )
157   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
192158
193   PORT_START   /* IN1 */
194   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
195   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
196   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
197   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
198   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
199   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
200   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
201   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
202
203159   PORT_START   /* Dip switch A */
204   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
205   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
206   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
207   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
208   PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
209   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
210   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
211   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
212   PORT_DIPSETTING(    0x01, DEF_STR( 1C_5C ) )
213   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) )
214   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
215   PORT_DIPSETTING(    0x18, DEF_STR( 1C_1C ) )
216   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
217   PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
218   PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
219   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
220   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
221   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
222   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet) )
223   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
224   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
160   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
161   PORT_DIPSETTING(    0x0000, DEF_STR( 5C_1C ) )
162   PORT_DIPSETTING(    0x0004, DEF_STR( 4C_1C ) )
163   PORT_DIPSETTING(    0x0002, DEF_STR( 3C_1C ) )
164   PORT_DIPSETTING(    0x0006, DEF_STR( 2C_1C ) )
165   PORT_DIPSETTING(    0x0007, DEF_STR( 1C_1C ) )
166   PORT_DIPSETTING(    0x0003, DEF_STR( 1C_2C ) )
167   PORT_DIPSETTING(    0x0005, DEF_STR( 1C_3C ) )
168   PORT_DIPSETTING(    0x0001, DEF_STR( 1C_5C ) )
169   PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Coin_B ) )
170   PORT_DIPSETTING(    0x0010, DEF_STR( 2C_1C ) )
171   PORT_DIPSETTING(    0x0018, DEF_STR( 1C_1C ) )
172   PORT_DIPSETTING(    0x0000, DEF_STR( 2C_3C ) )
173   PORT_DIPSETTING(    0x0008, DEF_STR( 1C_2C ) )
174   PORT_SERVICE( 0x0020, IP_ACTIVE_LOW )
175   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )
176   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
177   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
178   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Cabinet) )
179   PORT_DIPSETTING(    0x0080, DEF_STR( Upright ) )
180   PORT_DIPSETTING(    0x0000, DEF_STR( Cocktail ) )
181   /* Dip switch B */
182   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )
183   PORT_DIPSETTING(    0x0200, DEF_STR( Easy ) )
184   PORT_DIPSETTING(    0x0300, DEF_STR( Normal ) )
185   PORT_DIPSETTING(    0x0100, DEF_STR( Hard ) )
186   PORT_DIPSETTING(    0x0000, DEF_STR( Hardest ) )
187   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Bonus_Life ) )
188   PORT_DIPSETTING(    0x0400, "50K 150K" )
189   PORT_DIPSETTING(    0x0000, "100K 200K" )
190   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Controller ) )
191   PORT_DIPSETTING(    0x0800, DEF_STR( Trackball ) )
192   PORT_DIPSETTING(    0x0000, DEF_STR( Joystick ) )
193   PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Lives ) )
194   PORT_DIPSETTING(    0x2000, "1" )
195   PORT_DIPSETTING(    0x1000, "2" )
196   PORT_DIPSETTING(    0x3000, "3" )
197   PORT_DIPSETTING(    0x0000, "4" )
198   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) )
199   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
200   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
201   PORT_DIPNAME( 0x8000, 0x8000, "User Mode" )
202   PORT_DIPSETTING(    0x0000, DEF_STR( Japan ) )
203   PORT_DIPSETTING(    0x8000, "Overseas" )
225204
226   PORT_START   /* Dip switch B */
227   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
228   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
229   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
230   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
231   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
232   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
233   PORT_DIPSETTING(    0x04, "50K 150K" )
234   PORT_DIPSETTING(    0x00, "100K 200K" )
235   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Controller ) )
236   PORT_DIPSETTING(    0x08, DEF_STR( Trackball ) )
237   PORT_DIPSETTING(    0x00, DEF_STR( Joystick ) )
238   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
239   PORT_DIPSETTING(    0x20, "1" )
240   PORT_DIPSETTING(    0x10, "2" )
241   PORT_DIPSETTING(    0x30, "3" )
242   PORT_DIPSETTING(    0x00, "4" )
243   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
244   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
245   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
246   PORT_DIPNAME( 0x80, 0x80, "User Mode" )
247   PORT_DIPSETTING(    0x00, DEF_STR( Japan ) )
248   PORT_DIPSETTING(    0x80, "Overseas" )
249
250205   PORT_START
251206   PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(30) PORT_PLAYER(1)
252207
r869r870
261216   8,8,      /* 8*8 characters */
262217   RGN_FRAC(1,2),
263218   4,         /* 4 bits per pixel */
264   { 0x4000*8, 0x4000*8+4, 0, 4 },
265   { 3,2,1,0,11,10,9,8 },
266   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
219   { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+4, 0, 4 },
220   { STEP4(3,-1), STEP4(11,-1) },
221   { STEP8(0,16) },
267222   128
268223};
269224
r869r870
273228   RGN_FRAC(1,1),
274229   4,      /* 4 bits per pixel */
275230   { 8,12,0,4},
276   { 3,2,1,0, 19,18,17,16, 512+3,512+2,512+1,512+0, 512+11+8,512+10+8,512+9+8,512+8+8},
277   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
278   8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
279   },
231   { STEP4(3,-1), STEP4(19,-1), STEP4(512+3,-1), STEP4(512+19,-1) },
232   { STEP16(0,32) },
280233    1024
281234};
282235
r869r870
313266static MACHINE_DRIVER_START( deadang )
314267
315268   /* basic machine hardware */
316   MDRV_CPU_ADD(V20,16000000/2) /* Sony 8623h9 CXQ70116D-8 (V20 compatible) */
317   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
269   MDRV_CPU_ADD(V30,16000000/2) /* Sony 8623h9 CXQ70116D-8 (V30 compatible) */
270   MDRV_CPU_PROGRAM_MAP(main_map,0)
318271   MDRV_CPU_VBLANK_INT(deadang_interrupt,2)
319272
320   MDRV_CPU_ADD(V20,16000000/2) /* Sony 8623h9 CXQ70116D-8 (V20 compatible) */
321   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
273   MDRV_CPU_ADD(V30,16000000/2) /* Sony 8623h9 CXQ70116D-8 (V30 compatible) */
274   MDRV_CPU_PROGRAM_MAP(sub_map,0)
322275   MDRV_CPU_VBLANK_INT(deadang_interrupt,2)
323276
324277   SEIBU3A_SOUND_SYSTEM_CPU(14318180/4)
r869r870
379332   ROM_REGION( 0x40000, REGION_GFX5, ROMREGION_DISPOSE ) // pf3 layer
380333   ROM_LOAD( "11k", 0x000000, 0x40000, CRC(9cf5bcc7) SHA1(cf96592e601fc373b1bf322d9b576668799130a5) ) // fixed (0x800 tiles)
381334
382   ROM_REGION( 0x10000, REGION_GFX6, 0 )   /* background map data */
335   ROM_REGION16_BE( 0x10000, REGION_GFX6, 0 )   /* background map data */
383336   ROM_LOAD16_BYTE( "10.6l",  0x00000, 0x8000, CRC(ca99176b) SHA1(283e3769a1ff579c78a008b65cb8267e5770ba1f) )
384337   ROM_LOAD16_BYTE( "9.6m",   0x00001, 0x8000, CRC(51d868ca) SHA1(3e9a4e6bc4bc68773c4ba18c5f4110e6c595d0c9) )
385338
386   ROM_REGION( 0x10000, REGION_GFX7, 0 )   /* background map data */
339   ROM_REGION16_BE( 0x10000, REGION_GFX7, 0 )   /* background map data */
387340   ROM_LOAD16_BYTE( "12.6j",  0x00000, 0x8000, CRC(2674d23f) SHA1(0533d80a23d917e20a703aeb833dcaccfa3a1967) )
388341   ROM_LOAD16_BYTE( "11.6k",  0x00001, 0x8000, CRC(3dd4d81d) SHA1(94f0a13a8d3812f6879819ca186abf3a8665f7cb) )
389342
r869r870
424377   ROM_REGION( 0x40000, REGION_GFX5, ROMREGION_DISPOSE ) // pf3 layer
425378   ROM_LOAD( "11k", 0x000000, 0x40000, CRC(9cf5bcc7) SHA1(cf96592e601fc373b1bf322d9b576668799130a5) ) // fixed (0x800 tiles)
426379
427   ROM_REGION( 0x10000, REGION_GFX6, 0 )   /* background map data */
380   ROM_REGION16_BE( 0x10000, REGION_GFX6, 0 )   /* background map data */
428381   ROM_LOAD16_BYTE( "10.6l",  0x00000, 0x8000, CRC(ca99176b) SHA1(283e3769a1ff579c78a008b65cb8267e5770ba1f) )
429382   ROM_LOAD16_BYTE( "9.6m",   0x00001, 0x8000, CRC(51d868ca) SHA1(3e9a4e6bc4bc68773c4ba18c5f4110e6c595d0c9) )
430383
431   ROM_REGION( 0x10000, REGION_GFX7, 0 )   /* background map data */
384   ROM_REGION16_BE( 0x10000, REGION_GFX7, 0 )   /* background map data */
432385   ROM_LOAD16_BYTE( "12.6j",  0x00000, 0x8000, CRC(2674d23f) SHA1(0533d80a23d917e20a703aeb833dcaccfa3a1967) )
433386   ROM_LOAD16_BYTE( "11.6k",  0x00001, 0x8000, CRC(3dd4d81d) SHA1(94f0a13a8d3812f6879819ca186abf3a8665f7cb) )
434387
r869r870
450403   seibu_sound_decrypt(REGION_CPU3, 0x2000);
451404   seibu_adpcm_decrypt(REGION_SOUND1);
452405
453   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r);
454   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r);
406   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r);
407   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r);
455408}
456409
457410/* Game Drivers */
src/mame/drivers/cliffhgr.c
r869r870
293293   AM_RANGE(0x60, 0x60) AM_WRITE(cliff_port_bank_w)
294294   AM_RANGE(0x62, 0x62) AM_READ(cliff_port_r)
295295   AM_RANGE(0x64, 0x64) AM_WRITENOP /* unused in schematics, may be used as timing delay for IR interface */
296   AM_RANGE(0x66, 0x66) AM_WRITE(cliff_ldwire_w);
297   AM_RANGE(0x68, 0x68) AM_WRITE(cliff_coin_counter_w);
296   AM_RANGE(0x66, 0x66) AM_WRITE(cliff_ldwire_w)
297   AM_RANGE(0x68, 0x68) AM_WRITE(cliff_coin_counter_w)
298298   AM_RANGE(0x6A, 0x6A) AM_WRITENOP /* /LAMP0 (Infrared?) */
299299   AM_RANGE(0x6E, 0x6F) AM_WRITE(cliff_test_led_w)
300300ADDRESS_MAP_END
src/mame/drivers/orbit.c
r869r870
272272   MDRV_CPU_PERIODIC_INT(orbit_interrupt, 240)
273273
274274   MDRV_SCREEN_REFRESH_RATE(60) /* interlaced */
275   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC((int) ((22. * 1000000) / (262. * 60) + 0.5)))
275   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS((int) ((22. * 1000000) / (262. * 60) + 0.5)))
276276   MDRV_MACHINE_RESET(orbit)
277277
278278   /* video hardware */
src/mame/drivers/seibuspi.c
r869r870
17651765   MDRV_CPU_PROGRAM_MAP(spisound_map, 0)
17661766
17671767   MDRV_SCREEN_REFRESH_RATE(54)
1768   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1768   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
17691769   MDRV_INTERLEAVE(200)
17701770
17711771   MDRV_MACHINE_RESET(spi)
r869r870
20662066   MDRV_CPU_VBLANK_INT(spi_interrupt, 1)
20672067
20682068   MDRV_SCREEN_REFRESH_RATE(54)
2069   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
2069   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
20702070
20712071   MDRV_NVRAM_HANDLER(sxx2f)
20722072   MDRV_MACHINE_RESET(seibu386)
r869r870
25972597   ROM_LOAD("gd_8.216",   0x200000, 0x080000, CRC(f88cb6e4) SHA1(fb35b41307b490d5d08e4b8a70f8ff4ce2ca8105) )
25982598ROM_END
25992599
2600ROM_START(rdftit)
2601   ROM_REGION32_LE(0x200000, REGION_USER1, 0)   /* i386 program */
2602   ROM_LOAD32_BYTE("seibu1",   0x000000, 0x80000, CRC(de0c3e3c) SHA1(b00225bad282e46b5825608f76eea6670bfe5527) )
2603   ROM_LOAD32_BYTE("u212.bin", 0x000001, 0x80000, CRC(58ccb10c) SHA1(0cce4057bfada78121d9586574b98d46cdd7dd46) )
2604   ROM_LOAD32_BYTE("u210.bin", 0x000002, 0x80000, CRC(47fc3c96) SHA1(7378f8caa847f89f235b5be6779118721076873b) )
2605   ROM_LOAD32_BYTE("u29.bin",  0x000003, 0x80000, CRC(271bdd4b) SHA1(0a805568cbd6a9c18bdb755a41972ff6bba9e6eb) )
2606
2607   ROM_REGION( 0x30000, REGION_GFX1, 0)   /* text layer roms */
2608   ROM_LOAD24_BYTE("gd_5.423", 0x000000, 0x10000, CRC(8f8d4e14) SHA1(06c803975767ae98f40ba7ac5764a5bc8baa3a30) )
2609   ROM_LOAD24_BYTE("gd_6.424", 0x000001, 0x10000, CRC(6ac64968) SHA1(ec395205c24c4f864a1f805bb0d4641562d4faa9) )
2610   ROM_LOAD24_BYTE("gd_7.48",  0x000002, 0x10000, CRC(4d87e1ea) SHA1(3230e9b643fad773e61ab8ce09c0cd7d4d0558e3) )
2611
2612   ROM_REGION( 0x600000, REGION_GFX2, 0)   /* background layer roms */
2613   ROM_LOAD24_WORD("gd_bg1-d.415", 0x000000, 0x200000, CRC(6a68054c) SHA1(5cbfc4ac90045f1401c2dda7a51936558c9de07e) )
2614   ROM_LOAD24_BYTE("gd_bg1-p.410", 0x000002, 0x100000, CRC(3400794a) SHA1(719808f7442bac612cefd7b7fffcd665e6337ad0) )
2615   ROM_LOAD24_WORD("gd_bg2-d.416", 0x300000, 0x200000, CRC(61cd2991) SHA1(bb608e3948bf9ea35b5e1615d2ba6858d029dcbe) )
2616   ROM_LOAD24_BYTE("gd_bg2-p.49",  0x300002, 0x100000, CRC(502d5799) SHA1(c3a0e1a4f5a7b35572ae1ff31315da4ed08aa2fe) )
2617
2618   ROM_REGION( 0xc00000, REGION_GFX3, 0)   /* sprites */
2619   ROM_LOAD("gd_obj-1.322", 0x000000, 0x400000, CRC(59d86c99) SHA1(d3c9241e7b51fe21f8351051b063f91dc69bf905) )
2620   ROM_LOAD("gd_obj-2.324", 0x400000, 0x400000, CRC(1ceb0b6f) SHA1(97225a9b3e7be18080aa52f6570af2cce8f25c06) )
2621   ROM_LOAD("gd_obj-3.323", 0x800000, 0x400000, CRC(36e93234) SHA1(51917a80b7da5c32a9434a1076fc2916d62e6a3e) )
2622
2623   ROM_REGION(0x200000, REGION_SOUND1, ROMREGION_ERASE00)
2624
2625   ROM_REGION(0x280000, REGION_USER2, ROMREGION_ERASE00)   /* sound roms */
2626   ROM_LOAD("gd_pcm.217", 0x000000, 0x200000, CRC(31253ad7) SHA1(c81c8d50f8f287f5cbfaec77b30d969b01ce11a9) )
2627   ROM_LOAD("gd_8.216",   0x200000, 0x080000, CRC(f88cb6e4) SHA1(fb35b41307b490d5d08e4b8a70f8ff4ce2ca8105) )
2628ROM_END
2629
26002630ROM_START(rdft2us)   /* Single board version SXX2F */
26012631   ROM_REGION32_LE(0x200000, REGION_USER1, 0)   /* i386 program */
26022632   ROM_LOAD32_BYTE("prg0.u0259", 0x000000, 0x80000, CRC(ff3eeec1) SHA1(88c1741e4936db9a5b13e562061b0f1cc6fa6b36) )
r869r870
29763006GAME( 1996, rdftau,    rdft,    spi,      spi_3button, rdft,     ROT270, "Seibu Kaihatsu", "Raiden Fighters (Australia)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
29773007GAME( 1996, rdftj,     rdft,    spi,      spi_3button, rdft,     ROT270, "Seibu Kaihatsu", "Raiden Fighters (Japan set 2)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
29783008GAME( 1996, rdftdi,    rdft,    spi,      spi_3button, rdft,     ROT270, "Seibu Kaihatsu (Dream Island license)", "Raiden Fighters (Dream Island Co. license)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
3009GAME( 1996, rdftit,    rdft,    spi,      spi_3button, rdft,     ROT270, "Seibu Kaihatsu", "Raiden Fighters (Italy)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
29793010
29803011GAME( 1997, rdft2,     0,       spi,      spi_2button, rdft2,  ROT270, "Seibu Kaihatsu (Tuning license)", "Raiden Fighters 2",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
29813012GAME( 1997, rdft2a2,   rdft2,   spi,      spi_2button, rdft2,  ROT270, "Seibu Kaihatsu (Dream Island license)", "Raiden Fighters 2 (Asia, Dream Island license, SPI)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
src/mame/drivers/sauro.c
r869r870
339339   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
340340
341341   MDRV_SCREEN_REFRESH_RATE(60)
342   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(5000))  // frames per second, vblank duration (otherwise sprites lag)
342   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(5000))  // frames per second, vblank duration (otherwise sprites lag)
343343
344344   /* video hardware */
345345   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/twins.c
r869r870
3232
3333same TPC1020 AFN-084C chip
3434same 24c02 eeprom
35V30 instead of I88
35V30 instead of I8088
3636AY3-8910 instead of YM2149 (compatible)
3737
3838video is not banked in this case instead palette data is sent to the ports
r869r870
5151#include "driver.h"
5252#include "sound/ay8910.h"
5353
54static UINT8 *twins_videoram;
54static UINT16 *twins_videoram;
5555static UINT16 *twins_pal;
5656static UINT16 paloff = 0;
5757
5858/* port 4 is eeprom */
59static READ8_HANDLER( twins_port4_r )
59static READ16_HANDLER( twins_port4_r )
6060{
61   return 0xff;
61   return 0xffff;
6262}
6363
64static WRITE8_HANDLER( twins_port4_w )
64static WRITE16_HANDLER( twins_port4_w )
6565{
6666}
6767
68static WRITE8_HANDLER( port6_pal0_w )
68static WRITE16_HANDLER( port6_pal0_w )
6969{
70   twins_pal[paloff] = (twins_pal[paloff] & 0xff00) | data;
71}
72
73static WRITE8_HANDLER( port7_pal1_w )
74{
75   twins_pal[paloff] = (twins_pal[paloff] & 0x00ff) | (data<<8);
70   COMBINE_DATA(&twins_pal[paloff]);
7671   paloff = (paloff + 1) & 0xff;
77
7872}
7973
8074/* ??? weird ..*/
81static WRITE8_HANDLER( porte_paloff0_w )
75static WRITE16_HANDLER( porte_paloff0_w )
8276{
8377   paloff = 0;
8478}
8579
86/* ??? weird ..*/
87static WRITE8_HANDLER( portf_paloff1_w )
88{
89   paloff = 0;
90}
91
92static ADDRESS_MAP_START( twins_map, ADDRESS_SPACE_PROGRAM, 8 )
80static ADDRESS_MAP_START( twins_map, ADDRESS_SPACE_PROGRAM, 16 )
9381   AM_RANGE(0x00000, 0x0ffff) AM_RAM
9482   AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE(&twins_videoram)
9583   AM_RANGE(0x20000, 0xfffff) AM_ROM
9684ADDRESS_MAP_END
9785
98static ADDRESS_MAP_START( twins_io, ADDRESS_SPACE_IO, 8 )
99   AM_RANGE(0x0000, 0x0000) AM_WRITE(AY8910_control_port_0_w)
100   AM_RANGE(0x0002, 0x0002) AM_READ(AY8910_read_port_0_r) AM_WRITE(AY8910_write_port_0_w)
101   AM_RANGE(0x0004, 0x0004) AM_READ(twins_port4_r) AM_WRITE(twins_port4_w)
102   AM_RANGE(0x0006, 0x0006) AM_WRITE(port6_pal0_w)
103   AM_RANGE(0x0007, 0x0007) AM_WRITE(port7_pal1_w)
104   AM_RANGE(0x000e, 0x000e) AM_WRITE(porte_paloff0_w)
105   AM_RANGE(0x000f, 0x000f) AM_WRITE(portf_paloff1_w)
86static ADDRESS_MAP_START( twins_io, ADDRESS_SPACE_IO, 16 )
87   AM_RANGE(0x0000, 0x0001) AM_WRITE(AY8910_control_port_0_lsb_w)
88   AM_RANGE(0x0002, 0x0003) AM_READ(AY8910_read_port_0_lsb_r) AM_WRITE(AY8910_write_port_0_lsb_w)
89   AM_RANGE(0x0004, 0x0005) AM_READWRITE(twins_port4_r, twins_port4_w)
90   AM_RANGE(0x0006, 0x0007) AM_WRITE(port6_pal0_w)
91   AM_RANGE(0x000e, 0x000f) AM_WRITE(porte_paloff0_w)
10692ADDRESS_MAP_END
10793
10894VIDEO_START(twins)
r869r870
140126   {
141127      for(x=0;x<xxx;x++)
142128      {
143         *BITMAP_ADDR16(bitmap, y, x) = twins_videoram[count];
129         *BITMAP_ADDR16(bitmap, y, x) = ((UINT8 *)twins_videoram)[BYTE_XOR_LE(count)];
144130         count++;
145131      }
146132   }
r869r870
236222   {
237223      for(x=0;x<xxx;x++)
238224      {
239         *BITMAP_ADDR16(bitmap, y, x) = twins_videoram[count];
225         *BITMAP_ADDR16(bitmap, y, x) = ((UINT8 *)twins_videoram)[BYTE_XOR_LE(count)];
240226         count++;
241227      }
242228   }
243229   return 0;
244230}
245231
246WRITE8_HANDLER( twinsa_port4_w )
232WRITE16_HANDLER( twinsa_port4_w )
247233{
248234   twins_pal[paloff&0xfff] = data;
249235   paloff++;
250236//  printf("paloff %04x\n",paloff);
251237}
252238
253READ8_HANDLER( twinsa_unk_r )
239READ16_HANDLER( twinsa_unk_r )
254240{
255   return 0xff;
241   return 0xffff;
256242}
257243
258static ADDRESS_MAP_START( twinsa_io, ADDRESS_SPACE_IO, 8 )
259   AM_RANGE(0x0000, 0x0000) AM_READ(twinsa_unk_r) AM_WRITE(porte_paloff0_w)
260   AM_RANGE(0x0002, 0x0002) AM_WRITE(portf_paloff1_w)
261   AM_RANGE(0x0008, 0x0008) AM_WRITE(AY8910_control_port_0_w)
262   AM_RANGE(0x0010, 0x0010) AM_READ(AY8910_read_port_0_r) AM_WRITE(AY8910_write_port_0_w)
263   AM_RANGE(0x0018, 0x0018) AM_READ(twins_port4_r) AM_WRITE(twins_port4_w)
264   AM_RANGE(0x0004, 0x0004) AM_WRITE(twinsa_port4_w) // palette on this set
244static ADDRESS_MAP_START( twinsa_io, ADDRESS_SPACE_IO, 16 )
245   AM_RANGE(0x0000, 0x0001) AM_READWRITE(twinsa_unk_r, porte_paloff0_w)
246   AM_RANGE(0x0002, 0x0003) AM_WRITE(porte_paloff0_w)
247   AM_RANGE(0x0004, 0x0005) AM_WRITE(twinsa_port4_w) // palette on this set
248   AM_RANGE(0x0008, 0x0009) AM_WRITE(AY8910_control_port_0_lsb_w)
249   AM_RANGE(0x0010, 0x0011) AM_READWRITE(AY8910_read_port_0_lsb_r, AY8910_write_port_0_lsb_w)
250   AM_RANGE(0x0018, 0x0019) AM_READ(twins_port4_r) AM_WRITE(twins_port4_w)
265251ADDRESS_MAP_END
266252
267253
src/mame/drivers/tetriunk.c
r869r870
178178
179179static MACHINE_DRIVER_START( tetriunk )
180180   /* basic machine hardware */
181   MDRV_CPU_ADD(I86, 8000000)
181   MDRV_CPU_ADD(I8088, 8000000)
182182   MDRV_CPU_PROGRAM_MAP(tetriunk_mem, 0)
183183   MDRV_CPU_IO_MAP(tetriunk_io, 0)
184184   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/zn.c
r869r870
626626   MDRV_CPU_VBLANK_INT( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
627627
628628   MDRV_SCREEN_REFRESH_RATE( 60 )
629   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
629   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
630630
631631   MDRV_MACHINE_RESET( coh1000c )
632632   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
669669   MDRV_CPU_VBLANK_INT( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
670670
671671   MDRV_SCREEN_REFRESH_RATE( 60 )
672   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
672   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
673673
674674   MDRV_MACHINE_RESET( coh1000c )
675675   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
878878   MDRV_CPU_VBLANK_INT( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
879879
880880   MDRV_SCREEN_REFRESH_RATE( 60 )
881   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
881   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
882882
883883   MDRV_MACHINE_RESET( coh3002c )
884884   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
13171317   MDRV_CPU_PROGRAM_MAP( fx1a_sound_readmem, fx1a_sound_writemem )
13181318
13191319   MDRV_SCREEN_REFRESH_RATE( 60 )
1320   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
1320   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
13211321
13221322   MDRV_MACHINE_RESET( coh1000ta )
13231323   MDRV_NVRAM_HANDLER( coh1000ta )
r869r870
14201420   MDRV_CPU_VBLANK_INT( coh1000t_vblank, 1 )
14211421
14221422   MDRV_SCREEN_REFRESH_RATE( 60 )
1423   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
1423   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
14241424
14251425   MDRV_MACHINE_RESET( coh1000tb )
14261426   MDRV_NVRAM_HANDLER( coh1000tb )
r869r870
16101610   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
16111611
16121612   MDRV_SCREEN_REFRESH_RATE( 60 )
1613   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
1613   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
16141614
16151615   MDRV_MACHINE_RESET( coh3002t )
16161616   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
18241824   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
18251825
18261826   MDRV_SCREEN_REFRESH_RATE( 60 )
1827   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
1827   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
18281828
18291829   MDRV_MACHINE_RESET( coh1000w )
18301830   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
20702070   MDRV_CPU_PROGRAM_MAP( psarc_snd_map, 0 )
20712071
20722072   MDRV_SCREEN_REFRESH_RATE( 60 )
2073   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2073   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
20742074
20752075   MDRV_MACHINE_RESET( coh1002e )
20762076   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
24112411   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
24122412
24132413   MDRV_SCREEN_REFRESH_RATE( 60 )
2414   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2414   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
24152415
24162416   MDRV_MACHINE_RESET( coh1000a )
24172417   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
25822582//  MDRV_CPU_PROGRAM_MAP( atlus_snd_map, 0 )
25832583
25842584   MDRV_SCREEN_REFRESH_RATE( 60 )
2585   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2585   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
25862586
25872587   MDRV_MACHINE_RESET( coh1001l )
25882588   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
26672667   MDRV_CPU_VBLANK_INT( coh1002v_vblank, 1 )
26682668
26692669   MDRV_SCREEN_REFRESH_RATE( 60 )
2670   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2670   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
26712671
26722672   MDRV_MACHINE_RESET( coh1002v )
26732673   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
29362936   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
29372937
29382938   MDRV_SCREEN_REFRESH_RATE( 60 )
2939   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2939   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
29402940
29412941   MDRV_MACHINE_RESET( coh1002m )
29422942   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
29732973   MDRV_CPU_IO_MAP( cbaj_z80_port_map, 0 )
29742974
29752975   MDRV_SCREEN_REFRESH_RATE( 60 )
2976   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2976   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
29772977
29782978   MDRV_MACHINE_RESET( coh1002m )
29792979   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
30133013   MDRV_CPU_PROGRAM_MAP( link_readmem, link_writemem )
30143014
30153015   MDRV_SCREEN_REFRESH_RATE( 60 )
3016   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
3016   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
30173017
30183018   MDRV_MACHINE_RESET( coh1002m )
30193019   MDRV_NVRAM_HANDLER( at28c16_0 )
r869r870
31113111
31123112ROM_START( cpzn1 )
31133113   CPZN1_BIOS
3114   ROM_REGION( 0x50000, REGION_CPU2, ROMREGION_ERASE00 )
31143115ROM_END
31153116
31163117ROM_START( glpracr )
r869r870
33693370
33703371ROM_START( cpzn2 )
33713372   CPZN2_BIOS
3373   ROM_REGION( 0x50000, REGION_CPU2, ROMREGION_ERASE00 )
33723374ROM_END
33733375
33743376ROM_START( rvschool )
r869r870
40474049
40484050ROM_START( taitofx1 )
40494051   TAITOFX1_BIOS
4052   ROM_REGION( 0x080000, REGION_CPU2, ROMREGION_ERASE00 )
40504053ROM_END
40514054
40524055ROM_START( ftimpact )
r869r870
43194322
43204323ROM_START( psarc95 )
43214324   PSARC95_BIOS
4325   ROM_REGION( 0x080000, REGION_CPU2, ROMREGION_ERASE00 )
43224326ROM_END
43234327
43244328ROM_START( beastrzr )
src/mame/drivers/volfied.c
r869r870
1616        PC060HA     - Audio
1717        PC090OJ     - Sprites
1818
19
20Stephh's notes (based on the game M68000 code and some tests) :
21
221) 'volfied*'
23
24  - Region stored at 0x03fffe.w
25  - Sets :
26      * 'volfied'  : region = 0x0003
27      * 'volfiedj' : region = 0x0001
28      * 'volfiedu' : region = 0x0002
29  - These 3 games are 100% the same, only region differs !
30  - Coinage relies on the region (code at 0x00666a) :
31      * 0x0001 (Japan) uses TAITO_COINAGE_JAPAN_OLD
32      * 0x0002 (US) uses slighlty different TAITO_COINAGE_US :
33        in fact, as there is no possibility to continue a game,
34        what are used to be "Continue Price" Dip Switches are unused
35      * 0x0003 (World) uses TAITO_COINAGE_WORLD
36  - Notice screen only if region = 0x0001
37  - FBI logo only if region = 0x0002
38
39
1940********************************************************************/
2041
2142#include "driver.h"
43#include "taitoipt.h"
2244#include "video/taitoic.h"
2345#include "audio/taitosnd.h"
2446#include "sound/2203intf.h"
r869r870
2951WRITE16_HANDLER( volfied_video_mask_w );
3052
3153void volfied_cchip_init(void);
32READ16_HANDLER( volfied_cchip_status_r );
33READ16_HANDLER( volfied_cchip_data_r );
34WRITE16_HANDLER( volfied_cchip_data_w );
54READ16_HANDLER( volfied_cchip_ctrl_r );
55READ16_HANDLER( volfied_cchip_ram_r );
56WRITE16_HANDLER( volfied_cchip_ctrl_w );
3557WRITE16_HANDLER( volfied_cchip_bank_w );
58WRITE16_HANDLER( volfied_cchip_ram_w );
3659
3760READ16_HANDLER( volfied_video_ram_r );
3861READ16_HANDLER( volfied_video_ctrl_r );
r869r870
5376   AM_RANGE(0x500000, 0x503fff) AM_READ(paletteram16_word_r)
5477   AM_RANGE(0xd00000, 0xd00001) AM_READ(volfied_video_ctrl_r)
5578   AM_RANGE(0xe00002, 0xe00003) AM_READ(taitosound_comm16_lsb_r)
56   AM_RANGE(0xf00000, 0xf007ff) AM_READ(volfied_cchip_data_r)
57   AM_RANGE(0xf00802, 0xf00803) AM_READ(volfied_cchip_status_r)
79   AM_RANGE(0xf00000, 0xf007ff) AM_READ(volfied_cchip_ram_r)
80   AM_RANGE(0xf00802, 0xf00803) AM_READ(volfied_cchip_ctrl_r)
5881ADDRESS_MAP_END
5982
6083static ADDRESS_MAP_START( volfied_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r869r870
6992   AM_RANGE(0xd00000, 0xd00001) AM_WRITE(volfied_video_ctrl_w)
7093   AM_RANGE(0xe00000, 0xe00001) AM_WRITE(taitosound_port16_lsb_w)
7194   AM_RANGE(0xe00002, 0xe00003) AM_WRITE(taitosound_comm16_lsb_w)
72   AM_RANGE(0xf00000, 0xf007ff) AM_WRITE(volfied_cchip_data_w)
95   AM_RANGE(0xf00000, 0xf007ff) AM_WRITE(volfied_cchip_ram_w)
96   AM_RANGE(0xf00802, 0xf00803) AM_WRITE(volfied_cchip_ctrl_w)
7397   AM_RANGE(0xf00c00, 0xf00c01) AM_WRITE(volfied_cchip_bank_w)
7498ADDRESS_MAP_END
7599
r869r870
96120                INPUT PORTS
97121***********************************************************/
98122
99#define VOLFIED_INPUT_BITS                                                          \
100   PORT_START_TAG("IN0")                                                         \
101   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )                                   \
102   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )                                   \
103   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )                                 \
104                                                                                 \
105   PORT_START_TAG("IN1")                                                         \
106   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)                        \
107   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)                        \
108                                                                                 \
109   PORT_START_TAG("IN2")                                                         \
110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )                                     \
111   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY                \
112   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY                \
113   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY                \
114   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY                \
115   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )                                  \
116                                                                                 \
117   PORT_START_TAG("IN3")                                                         \
118   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL \
119   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL \
120   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL \
121   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL \
122   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
123
124
125123INPUT_PORTS_START( volfied )
124   /* Z80 CPU -> 0x10002c ($2c,A5) */
126125   PORT_START_TAG("DSWA")
127   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
128   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
129   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
130   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
131   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
132   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
133   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
134   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
135   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
136   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
137   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
138   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
139   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
140   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
141   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
142   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
143   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
144   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
145   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
146   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
126   TAITO_MACHINE_COCKTAIL
127   TAITO_COINAGE_WORLD
147128
129   /* Z80 CPU -> 0x10002e ($2e,A5) */
148130   PORT_START_TAG("DSWB")
149   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
150   PORT_DIPSETTING(    0x02, "20k,40k,120k,480k,2400k" )
151   PORT_DIPSETTING(    0x03, "50k,150k,600k,3000k" )
152   PORT_DIPSETTING(    0x01, "70k,280k,1400k" )
153   PORT_DIPSETTING(    0x00, "100k,500k" )
131   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )            /* table at 0x003140 - 4 * 6 words - LSB first */
132   PORT_DIPSETTING(    0x02, "20k 40k 120k 480k 2400k" )
133   PORT_DIPSETTING(    0x03, "50k 150k 600k 3000k" )
134   PORT_DIPSETTING(    0x01, "70k 280k 1400k" )
135   PORT_DIPSETTING(    0x00, "100k 500k" )
154136   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
155137   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
156   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
138   PORT_DIPSETTING(    0x0c, DEF_STR( Medium ) )
157139   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
158140   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
159   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
160   PORT_DIPSETTING(    0x30, "3" )
161   PORT_DIPSETTING(    0x20, "4" )
162   PORT_DIPSETTING(    0x10, "5" )
163   PORT_DIPSETTING(    0x00, "6" )
164   PORT_DIPNAME( 0x40, 0x40, "Infinite Lives (Cheat)")
165   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
166   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
141   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) )
142   PORT_DIPSETTING(    0x70, "3" )
143   PORT_DIPSETTING(    0x60, "4" )
144   PORT_DIPSETTING(    0x50, "5" )
145   PORT_DIPSETTING(    0x40, "6" )
146//  PORT_DIPSETTING(    0x30, "32768 (Cheat)" )
147//  PORT_DIPSETTING(    0x20, "32768 (Cheat)" )
148//  PORT_DIPSETTING(    0x10, "32768 (Cheat)" )
149   PORT_DIPSETTING(    0x00, "32768 (Cheat)" )                  /* code at 0x0015cc */
167150   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
168151   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
169152   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
170153
171   VOLFIED_INPUT_BITS
154   PORT_START_TAG("F00007")
155   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
156   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
157   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
158   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
159   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
160   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
161   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
162   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
163
164   PORT_START_TAG("F00009")
165   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
166   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
167   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
168   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
169   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
170   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
171   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
172   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
173
174   PORT_START_TAG("F0000B")
175   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
176   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
177   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
178   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
179   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
180   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
181   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
182   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
183
184   PORT_START_TAG("F0000D")
185   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
186   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
187   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
188   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
189   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
190   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
191   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
192   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
172193INPUT_PORTS_END
173194
174195INPUT_PORTS_START( volfiedu )
175   PORT_START_TAG("DSWA")
176   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
177   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
178   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
179   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
180   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
181   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
182   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
183   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
184   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
185   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
186   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) )
187   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
188   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
189   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
190   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
191   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
192   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
193   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
195   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
196   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
196   PORT_INCLUDE(volfied)
197197
198   PORT_START_TAG("DSWB")
199   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
200   PORT_DIPSETTING(    0x02, "20k,40k,120k,480k,2400k" )
201   PORT_DIPSETTING(    0x03, "50k,150k,600k,3000k" )
202   PORT_DIPSETTING(    0x01, "70k,280k,1400k" )
203   PORT_DIPSETTING(    0x00, "100k,500k" )
204   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
205   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
206   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
207   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
208   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
209   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
210   PORT_DIPSETTING(    0x30, "3" )
211   PORT_DIPSETTING(    0x20, "4" )
212   PORT_DIPSETTING(    0x10, "5" )
213   PORT_DIPSETTING(    0x00, "6" )
214   PORT_DIPNAME( 0x40, 0x40, "Infinite Lives (Cheat)")
215   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
216   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
217   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
218   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
219   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
220
221   VOLFIED_INPUT_BITS
198   PORT_MODIFY("DSWA")
199   TAITO_COINAGE_US_COIN_START                                  /* see notes */
200   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )                        /* see notes */
201   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )                        /* see notes */
222202INPUT_PORTS_END
223203
224204INPUT_PORTS_START( volfiedj )
225   PORT_START_TAG("DSWA")
226   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
227   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
228   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
229   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
230   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
231   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
232   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
233   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
234   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
235   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
236   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
237   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
238   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
239   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
240   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
241   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
242   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
243   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
244   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
245   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
205   PORT_INCLUDE(volfied)
246206
247   PORT_START_TAG("DSWB")
248   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
249   PORT_DIPSETTING(    0x02, "20k,40k,120k,480k,2400k" )
250   PORT_DIPSETTING(    0x03, "50k,150k,600k,3000k" )
251   PORT_DIPSETTING(    0x01, "70k,280k,1400k" )
252   PORT_DIPSETTING(    0x00, "100k,500k" )
253   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
254   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
255   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
256   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
257   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
258   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
259   PORT_DIPSETTING(    0x30, "3" )
260   PORT_DIPSETTING(    0x20, "4" )
261   PORT_DIPSETTING(    0x10, "5" )
262   PORT_DIPSETTING(    0x00, "6" )
263   PORT_DIPNAME( 0x40, 0x40, "Infinite Lives (Cheat)")
264   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
265   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
266   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Language ) )
267   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
268   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
269
270   VOLFIED_INPUT_BITS
207   PORT_MODIFY("DSWA")
208   TAITO_COINAGE_JAPAN_OLD
271209INPUT_PORTS_END
272210
273211
src/mame/drivers/megadriv.c
r869r870
14731473   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
14741474
14751475   PORT_START_TAG("REGION") /* Buttons on Genesis Console */
1476   //* Region setting for Console */
1476   /* Region setting for Console */
14771477   PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
14781478   PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
14791479   PORT_DIPSETTING(      0x0001, "US (NTSC, 60fps)" )
r869r870
15221522//  PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
15231523
15241524//  PORT_START_TAG("REGION") /* Buttons on Genesis Console */
1525//  //* Region setting for Console */
1525//  /* Region setting for Console */
15261526//  PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
15271527//  PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
15281528//  PORT_DIPSETTING(      0x0001, "US (NTSC, 60fps)" )
r869r870
16251625   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") // c
16261626   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 START") // start
16271627
1628   PORT_START /* Joypad 1 (3 button + start) NOT READ DIRECTLY */
1628   PORT_START /* Joypad 2 (3 button + start) NOT READ DIRECTLY */
16291629   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
16301630   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
16311631   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r869r870
16411641   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
16421642
16431643   PORT_START_TAG("REGION") /* Region setting for Console */
1644   /* Region setting for Console */
16441645   PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
16451646   PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
16461647   PORT_DIPSETTING(      0x0001, "US (NTSC, 60fps)" )
r869r870
16491650INPUT_PORTS_END
16501651
16511652
1653INPUT_PORTS_START( aladbl )
1654   PORT_START /* Joypad 1 (3 button + start) NOT READ DIRECTLY */
1655   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1656   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1657   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1658   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1659   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Throw") // a
1660   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Sword") // b
1661   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Jump") // c
1662   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) // start
1663
1664   PORT_START /* Joypad 2 (3 button + start) NOT READ DIRECTLY - not used */
1665//  PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1666//  PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1667//  PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1668//  PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1669//  PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Throw") // a
1670//  PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Sword") // b
1671//  PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Jump") // c
1672//  PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 ) // start
1673
1674   PORT_START /* 3rd I/O port */
1675
1676//  PORT_START_TAG("RESET") /* Buttons on Genesis Console */
1677//  PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
1678
1679//  PORT_START_TAG("REGION") /* Region setting for Console */
1680//  /* Region setting for Console */
1681//  PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
1682//  PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
1683//  PORT_DIPSETTING(      0x0001, "US (NTSC, 60fps)" )
1684//  PORT_DIPSETTING(      0x0002, "JAPAN (NTSC, 60fps)" )
1685//  PORT_DIPSETTING(      0x0003, "EUROPE (PAL, 50fps)" )
1686
1687    /* As I don't know how it is on real hardware, this is more a guess than anything */
1688   PORT_START_TAG("MCU")
1689   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )          /* code at 0x1b2a50 - unsure if there are so many settings */
1690//  PORT_DIPSETTING(    0x00, "INVALID" )                   /* adds 0 credit */
1691   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
1692   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
1693   PORT_DIPSETTING(    0x03, DEF_STR( 1C_3C ) )
1694   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
1695   PORT_DIPSETTING(    0x05, DEF_STR( 1C_5C ) )
1696   PORT_DIPSETTING(    0x06, DEF_STR( 1C_6C ) )
1697    PORT_DIPSETTING(    0x07, DEF_STR( 1C_7C ) )
1698   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL )         /* to avoid it being changed and corrupting Coinage settings */
1699   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )       /* code at 0x1b2680 */
1700   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )             /* "PRACTICE" */
1701   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )           /* "NORMAL" */
1702   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )             /* "DIFFICULT" */
1703//  PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
1704   PORT_DIPUNUSED( 0x0040, IP_ACTIVE_HIGH )
1705   PORT_DIPUNUSED( 0x0080, IP_ACTIVE_HIGH )
1706   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)     /* needed to avoid credits getting mad */
1707INPUT_PORTS_END
1708
1709
16521710#define MODE_BUTTON(player) ( (readinputport(player) & 0x800) >> 11 )
16531711#define Z_BUTTON(player) ( (readinputport(player) & 0x400) >> 10 )
16541712#define Y_BUTTON(player) ( (readinputport(player) & 0x200) >> 9 )
r869r870
44914549   /* IRQ handled via the timers */
44924550
44934551   MDRV_SCREEN_REFRESH_RATE(60)
4494   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0)) // Vblank handled manually.
4552   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) // Vblank handled manually.
44954553   MDRV_MACHINE_RESET(megadriv)
44964554
44974555   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/itech32.c
r869r870
6868    Starting with GT Fore!, I.T. moved to a redesigned hardware platform known as the Eagle platform.
6969        It has a main board with a 3Dfx video card and is hard drive based. This series started with
7070        GT Fore! in 2000 and continued through 2006 ending with Golden Tee Complete. This final
71        version incuded all the courses from the previous years in the Fore! series.
71        version incuded all the courses from all the previous years in the Fore! series.
7272        The Eagle platform also supports I.T.'s hunting series "Big Buck Hunter" and the light game
7373        gun called Carnival King.
7474
7575        Some time in 2004 I.T. introduced a new bowling game called Silver Strike Bowling on a full
76        blown PC type system to replace it's aging World Class Bowling game.
76        blown PC system known as "Nighthawk System Box" (AKA The Nighthawk Chassis) to replace it's
77        aging World Class Bowling game.  Other known games on this platform include Golden Tee Live!
78        and Target Toss Pro: Bags
7779
7880    Trivia: For the Golden Tee series, the second generation was called GT2.  The third gen was known
7981            as GT3 but also included Golden Tee '97 through 2K and Classic.  The fourth gen on the
r869r870
18791881
18801882
18811883ROM_START( pairs )
1882   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 )
1884   ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
18831885   ROM_LOAD16_BYTE( "pair0.u83", 0x00000, 0x20000, CRC(a9c761d8) SHA1(2618c9c3f336cf30f760fd88f12c09985cfd4ee7) )
18841886   ROM_LOAD16_BYTE( "pair1.u88", 0x00001, 0x20000, CRC(5141eb86) SHA1(3bb10d588e6334a33e5c2c468651699e84f46cdc) )
18851887
r869r870
19061908
19071909
19081910ROM_START( pairsa )
1909   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 )
1911   ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
19101912   ROM_LOAD16_BYTE( "pair0", 0x00000, 0x20000, CRC(774995a3) SHA1(93df91378b56802d14c105f7f48ed8a4f7bafffd) )
19111913   ROM_LOAD16_BYTE( "pair1", 0x00001, 0x20000, CRC(85d0b73a) SHA1(48a6ac6de94be13e407da13e3e2440d858714b4b) )
19121914
r869r870
21272129
21282130ROM_START( wcbwl15 )   /* Version 1.5 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
21292131   /* v1.0 & v1.3 for this platform have been confirmed, but not dumped */
2130   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 )
2132   ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
21312133   ROM_LOAD16_BYTE( "wcb_v15.u83", 0x00000, 0x20000, CRC(3ca9ab85) SHA1(364946dceb3f7279b7d67d9d685a98ba7f4901aa) ) /* Labeled as "WCB V1.5 (U83)" */
21322134   ROM_LOAD16_BYTE( "wcb_v15.u88", 0x00001, 0x20000, CRC(d43e6fad) SHA1(fd72f6945e7f5ef86dc28503749d18086dd29906) ) /* Labeled as "WCB V1.5 (U88)" */
21332135
r869r870
21622164
21632165
21642166ROM_START( wcbwl12 )   /* Version 1.2 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
2165   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 )
2167   ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
21662168   ROM_LOAD16_BYTE( "wcb_v12.u83", 0x00000, 0x20000, CRC(0602c5ce) SHA1(4339f77301f9c607c6f1dc81270d03681e874e69) ) /* Labeled as "WCB V1.2 (U83)" */
21672169   ROM_LOAD16_BYTE( "wcb_v12.u88", 0x00001, 0x20000, CRC(49573493) SHA1(42813573f4ab951cd830193c0ffe2ce7d79c354b) ) /* Labeled as "WCB V1.2 (U88)" */
21682170
src/mame/drivers/megadriv.h
r869r870
44extern DRIVER_INIT( _32x );
55
66INPUT_PORTS_EXTERN(megadriv);
7INPUT_PORTS_EXTERN(aladbl);
78INPUT_PORTS_EXTERN(megadri6);
89INPUT_PORTS_EXTERN(ssf2ghw);
910
src/mame/drivers/sspeedr.c
r869r870
227227   MDRV_CPU_VBLANK_INT(irq0_line_assert, 1)
228228
229229   MDRV_SCREEN_REFRESH_RATE(59.39)
230   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(16 * 1000000 / 15680))
230   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(16 * 1000000 / 15680))
231231
232232   /* video hardware */
233233   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/filetto.c
r869r870
736736
737737
738738static MACHINE_DRIVER_START( filetto )
739   MDRV_CPU_ADD_TAG("main", I88, 8000000)
739   MDRV_CPU_ADD_TAG("main", I8088, 8000000)
740740   MDRV_CPU_PROGRAM_MAP(filetto_map,0)
741741   MDRV_CPU_IO_MAP(filetto_io,0)
742742   MDRV_CPU_VBLANK_INT(filetto_irq,200)
src/mame/drivers/malzak.c
r869r870
472472   MDRV_CPU_IO_MAP(readport,writeport)
473473
474474   MDRV_SCREEN_REFRESH_RATE(50)
475   //MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(SAA5050_VBLANK))
475   //MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(SAA5050_VBLANK))
476476
477477   /* video hardware */
478478   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/vertigo.c
r869r870
6060 *
6161 *************************************/
6262
63#if 0
6364static ADDRESS_MAP_START( vertigo_motor, ADDRESS_SPACE_PROGRAM, 8 )
6465   AM_RANGE(0x010, 0x07f) AM_RAM
6566   AM_RANGE(0x080, 0x7ff) AM_ROM
6667ADDRESS_MAP_END
68#endif
6769
6870/*************************************
6971 *
r869r870
135137    */
136138
137139   MDRV_SCREEN_REFRESH_RATE(60)
138   MDRV_SCREEN_VBLANK_TIME(0)
140   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
139141   MDRV_MACHINE_RESET(vertigo)
140142   MDRV_NVRAM_HANDLER(generic_0fill)
141143
src/mame/drivers/grchamp.c
r869r870
527527
528528static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
529529   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
530   AM_RANGE(0x00, 0x00) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("ACCEL"))
530   AM_RANGE(0x00, 0x00) AM_MIRROR(0x78) AM_READ_PORT("ACCEL")
531531   AM_RANGE(0x02, 0x02) AM_MIRROR(0x78) AM_READ(sub_to_main_comm_r)
532   AM_RANGE(0x03, 0x03) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("WHEEL"))
533   AM_RANGE(0x04, 0x04) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("DSWA"))
534   AM_RANGE(0x05, 0x05) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("DSWB"))
535   AM_RANGE(0x06, 0x06) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("TILT"))
532   AM_RANGE(0x03, 0x03) AM_MIRROR(0x78) AM_READ_PORT("WHEEL")
533   AM_RANGE(0x04, 0x04) AM_MIRROR(0x78) AM_READ_PORT("DSWA")
534   AM_RANGE(0x05, 0x05) AM_MIRROR(0x78) AM_READ_PORT("DSWB")
535   AM_RANGE(0x06, 0x06) AM_MIRROR(0x78) AM_READ_PORT("TILT")
536536   AM_RANGE(0x01, 0x01) AM_MIRROR(0x60) AM_READ(pc3259_0_r)
537537   AM_RANGE(0x09, 0x09) AM_MIRROR(0x60) AM_READ(pc3259_1_r)
538538   AM_RANGE(0x11, 0x11) AM_MIRROR(0x60) AM_READ(pc3259_2_r)
src/mame/drivers/superdq.c
r869r870
223223
224224static ADDRESS_MAP_START( superdq_io, ADDRESS_SPACE_IO, 8 )
225225   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
226   AM_RANGE(0x00, 0x00) AM_READWRITE(port_tag_to_handler8("IN0"),superdq_ld_w)
227   AM_RANGE(0x01, 0x01) AM_READ(port_tag_to_handler8("IN1"))
228   AM_RANGE(0x02, 0x02) AM_READ(port_tag_to_handler8("DSW1"))
229   AM_RANGE(0x03, 0x03) AM_READ(port_tag_to_handler8("DSW2"))
226   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(superdq_ld_w)
227   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
228   AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW1")
229   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW2")
230230   AM_RANGE(0x04, 0x04) AM_READWRITE(superdq_ld_r,SN76496_0_w)
231231   AM_RANGE(0x08, 0x08) AM_WRITE(superdq_io_w)
232232   AM_RANGE(0x0c, 0x0d) AM_NOP /* HD46505S */
src/mame/drivers/zaxxon.c
r869r870
475475   AM_RANGE(0x6000, 0x6fff) AM_RAM
476476   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x1c00) AM_READWRITE(MRA8_RAM, zaxxon_videoram_w) AM_BASE(&videoram)
477477   AM_RANGE(0xa000, 0xa0ff) AM_MIRROR(0x1f00) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
478   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x18fc) AM_READ(port_tag_to_handler8("SW00"))
479   AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x18fc) AM_READ(port_tag_to_handler8("SW01"))
480   AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x18fc) AM_READ(port_tag_to_handler8("DSW02"))
481   AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x18fc) AM_READ(port_tag_to_handler8("DSW03"))
482   AM_RANGE(0xc100, 0xc100) AM_MIRROR(0x18ff) AM_READ(port_tag_to_handler8("SW100"))
478   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x18fc) AM_READ_PORT("SW00")
479   AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x18fc) AM_READ_PORT("SW01")
480   AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x18fc) AM_READ_PORT("DSW02")
481   AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x18fc) AM_READ_PORT("DSW03")
482   AM_RANGE(0xc100, 0xc100) AM_MIRROR(0x18ff) AM_READ_PORT("SW100")
483483   AM_RANGE(0xc000, 0xc002) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_coin_lockout_w)
484484   AM_RANGE(0xc003, 0xc004) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_coin_counter_w)
485485   AM_RANGE(0xc006, 0xc006) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_flipscreen_w)
r869r870
498498   AM_RANGE(0x8000, 0x8fff) AM_RAM
499499   AM_RANGE(0xa000, 0xa3ff) AM_MIRROR(0x1800) AM_READWRITE(MRA8_RAM, zaxxon_videoram_w) AM_BASE(&videoram)
500500   AM_RANGE(0xa400, 0xa7ff) AM_MIRROR(0x1800) AM_READWRITE(MRA8_RAM, congo_colorram_w) AM_BASE(&colorram)
501   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fc4) AM_READ(port_tag_to_handler8("SW00"))
502   AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x1fc4) AM_READ(port_tag_to_handler8("SW01"))
503   AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x1fc4) AM_READ(port_tag_to_handler8("DSW02"))
504   AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x1fc4) AM_READ(port_tag_to_handler8("DSW03"))
505   AM_RANGE(0xc008, 0xc008) AM_MIRROR(0x1fc7) AM_READ(port_tag_to_handler8("SW100"))
501   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fc4) AM_READ_PORT("SW00")
502   AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x1fc4) AM_READ_PORT("SW01")
503   AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x1fc4) AM_READ_PORT("DSW02")
504   AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x1fc4) AM_READ_PORT("DSW03")
505   AM_RANGE(0xc008, 0xc008) AM_MIRROR(0x1fc7) AM_READ_PORT("SW100")
506506   AM_RANGE(0xc018, 0xc01a) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_coin_lockout_w)
507507   AM_RANGE(0xc01b, 0xc01c) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_coin_counter_w)
508508   AM_RANGE(0xc01d, 0xc01d) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_bg_enable_w)
src/mame/drivers/astrof.c
r869r870
462462   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x1ff8) AM_READWRITE(MRA8_NOP, astrof_video_control_2_w)
463463   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READWRITE(MRA8_NOP, astrof_audio_1_w)
464464   AM_RANGE(0x8007, 0x8007) AM_MIRROR(0x1ff8) AM_READWRITE(MRA8_NOP, astrof_audio_2_w)
465   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READWRITE(port_tag_to_handler8("IN"), MWA8_NOP)
466   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READWRITE(port_tag_to_handler8("DSW"), MWA8_NOP)
465   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READ_PORT("IN") AM_WRITE(MWA8_NOP)
466   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READ_PORT("DSW") AM_WRITE(MWA8_NOP)
467467   AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ff8) AM_READWRITE(irq_ack_r, MWA8_NOP)
468468   AM_RANGE(0xa003, 0xa007) AM_MIRROR(0x1ff8) AM_NOP
469469   AM_RANGE(0xc000, 0xffff) AM_ROM
r869r870
481481   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x1ff8) AM_READWRITE(MRA8_NOP, tomahawk_video_control_2_w)
482482   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READWRITE(MRA8_NOP, tomahawk_audio_w)
483483   AM_RANGE(0x8007, 0x8007) AM_MIRROR(0x1ff8) AM_READWRITE(MRA8_NOP, MWA8_RAM) AM_BASE(&tomahawk_protection)
484   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READWRITE(port_tag_to_handler8("IN"), MWA8_NOP)
485   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READWRITE(port_tag_to_handler8("DSW"), MWA8_NOP)
484   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READ_PORT("IN") AM_WRITE(MWA8_NOP)
485   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READ_PORT("DSW") AM_WRITE(MWA8_NOP)
486486   AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ff8) AM_READWRITE(irq_ack_r, MWA8_NOP)
487487   AM_RANGE(0xa003, 0xa003) AM_MIRROR(0x1ff8) AM_READWRITE(tomahawk_protection_r, MWA8_NOP)
488488   AM_RANGE(0xa004, 0xa007) AM_MIRROR(0x1ff8) AM_NOP
src/mame/drivers/fastfred.c
r869r870
572572   MDRV_CPU_VBLANK_INT(nmi_line_pulse,4)
573573
574574   MDRV_SCREEN_REFRESH_RATE(60)
575   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))   //CLOCK/16/60
575   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)   //CLOCK/16/60
576576
577577   /* video hardware */
578578   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/maxaflex.c
r869r870
434434   MDRV_CPU_ADD_TAG("main", M6502, FREQ_17_EXACT)
435435   MDRV_CPU_PROGRAM_MAP(a600xl_mem, 0)
436436   MDRV_CPU_VBLANK_INT(a800xl_interrupt, TOTAL_LINES_60HZ)
437   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
437   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
438438
439439   MDRV_CPU_ADD(M68705, 3579545/M68705_CLOCK_DIVIDER)
440440   MDRV_CPU_PROGRAM_MAP(mcu_mem,0)
src/mame/drivers/system24.c
r869r870
23642364   MDRV_CPU_PROGRAM_MAP(system24_cpu2_map, 0)
23652365
23662366   MDRV_SCREEN_REFRESH_RATE(58)
2367   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(100))
2367   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(100))
23682368   MDRV_INTERLEAVE(4)
23692369
23702370   MDRV_MACHINE_RESET(system24)
src/mame/drivers/dkong.c
r869r870
19061906   MDRV_CPU_MODIFY("main")
19071907   MDRV_CPU_IO_MAP(herbiedk_io_map, 0)
19081908
1909   //MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1000))
1909   //MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1000))
19101910MACHINE_DRIVER_END
19111911
19121912static MACHINE_DRIVER_START( spclforc )
src/mame/drivers/skyraid.c
r869r870
268268   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
269269
270270   MDRV_SCREEN_REFRESH_RATE(60)
271   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(22 * 1000000 / 15750))
271   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(22 * 1000000 / 15750))
272272
273273   /* video hardware */
274274   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/travrusa.c
r869r870
341341   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
342342
343343   MDRV_SCREEN_REFRESH_RATE(56.75)
344   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1790)   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */)
344   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1790)   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */)
345345            /* the Lode Runner manual (similar but different hardware) */
346346            /* talks about 55Hz and 1790ms vblank duration. */
347347
src/mame/drivers/goldstar.c
r869r870
300300   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
301301
302302   MDRV_SCREEN_REFRESH_RATE(60)
303   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
303   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
304304
305305   /* video hardware */
306306   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
337337   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
338338
339339   MDRV_SCREEN_REFRESH_RATE(60)
340//  MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
340//  MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
341341
342342   /* video hardware */
343343   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
373373   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
374374
375375   MDRV_SCREEN_REFRESH_RATE(60)
376//  MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
376//  MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
377377
378378   /* video hardware */
379379   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/namcos10.c
r869r870
382382   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
383383
384384   MDRV_SCREEN_REFRESH_RATE( 60 )
385   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
385   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
386386
387387   MDRV_MACHINE_RESET( namcos10 )
388388
src/mame/drivers/darkseal.c
r869r870
297297   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
298298
299299   MDRV_SCREEN_REFRESH_RATE(58)
300   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
300   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
301301
302302   /* video hardware */
303303   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/mcr3.c
r869r870
459459/* I/O map verified from schematics */
460460static ADDRESS_MAP_START( mcrmono_portmap, ADDRESS_SPACE_IO, 8 )
461461   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) | AMEF_UNMAP(1) )
462   AM_RANGE(0x00, 0x00) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("MONO.IP0"))
463   AM_RANGE(0x01, 0x01) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("MONO.IP1"))
464   AM_RANGE(0x02, 0x02) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("MONO.IP2"))
465   AM_RANGE(0x03, 0x03) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("MONO.IP3"))
466   AM_RANGE(0x04, 0x04) AM_MIRROR(0x78) AM_READ(port_tag_to_handler8("MONO.IP4"))
462   AM_RANGE(0x00, 0x00) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP0")
463   AM_RANGE(0x01, 0x01) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP1")
464   AM_RANGE(0x02, 0x02) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP2")
465   AM_RANGE(0x03, 0x03) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP3")
466   AM_RANGE(0x04, 0x04) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP4")
467467   AM_RANGE(0x05, 0x05) AM_MIRROR(0x78) AM_WRITE(mcrmono_control_port_w)
468468   AM_RANGE(0x07, 0x07) AM_MIRROR(0x78) AM_WRITE(watchdog_reset_w)
469469   AM_RANGE(0xf0, 0xf3) AM_MIRROR(0x0c) AM_READWRITE(z80ctc_0_r, z80ctc_0_w)
r869r870
10581058   MDRV_CPU_VBLANK_INT(mcr_interrupt,2)
10591059
10601060   MDRV_SCREEN_REFRESH_RATE(30)
1061   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_30HZ_VBLANK_DURATION))
1061   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_30HZ_VBLANK_DURATION)
10621062   MDRV_WATCHDOG_VBLANK_INIT(16)
10631063   MDRV_MACHINE_START(mcr)
10641064   MDRV_MACHINE_RESET(mcr)
r869r870
14111411   ROM_LOAD( "ttprog5.bin",  0xa000, 0x2000, CRC(11e62fe4) SHA1(72897702c61486b654e4b4a3f6560c144c862e1f) )
14121412   ROM_RELOAD(               0xc000, 0x2000 )
14131413
1414   ROM_REGION( 0x10000, REGION_CPU2, ROMREGION_ERASE00 )
1415
14141416   ROM_REGION( 0x8000, REGION_CPU3, 0 )  /* 32k for the Chip Squeak Deluxe */
14151417   ROM_LOAD16_BYTE( "ttu7.bin",  0x00000, 0x2000, CRC(8ebb3302) SHA1(c516abdae6eea524a6d2a039ed9bd7dff72ab986) )
14161418   ROM_LOAD16_BYTE( "ttu17.bin", 0x00001, 0x2000, CRC(605d6c74) SHA1(a6c2bc95cca372fa823ab256c9dd1f92b6ba45fd) )
src/mame/drivers/stadhero.c
r869r870
290290   MDRV_CPU_PROGRAM_MAP(stadhero_s_readmem,stadhero_s_writemem)
291291
292292   MDRV_SCREEN_REFRESH_RATE(58)
293   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
293   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
294294
295295   /* video hardware */
296296   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/aladbl.c
r869r870
11#include "driver.h"
22#include "megadriv.h"
33
4/* it probably works, start is shift (start on md pad), but the credit system isn't emulated
5   properly yet, it's probably what the MCU on the board is for
6
7   left as non-working until i've had more time to investigate
8
9   */
10
114/*
125
136CPU
r869r870
4437However,hardware is totally different.It seems to be based on Sega Mega Drive hardware with cpu clock increased,
4538and since exists an "unlicensed" porting of the game for this system probably the "producers" are the same.
4639
40
41Stephh's notes (based on the game M68000 code and some tests) :
42
431) Useful addresses
44
45  - 0xffff88.b = number of credits (range 0x00-0xff but display limited to 9)
46  - 0xff7e3c.b = lives (range 0x30-0x39)
47  - 0xffeffa.b = energy (range 0x00-0x08)
48  - 0xffefe0.w = apples (range 0x30-0x39 * 2 , MSB first)
49  - 0xffefe2.w = jewels (range 0x30-0x39 * 2 , MSB first)
50  - 0xff7e29.b to 0xff7e2e.b = score (range 0x30-0x39 * 6) - MSDigit first
51  - 0xff7e12.b to 0xff7e15.b = ??? (range 0x30-0x33 * 3 + 0x00) - MSDigit first - see below
52  - 0xff7e16.b to 0xff7e19.b = ??? (range 0x30-0x33 * 3 + 0x00) - MSDigit first - see below
53  - 0xff7e21.b = difficulty (range 0x00-0x02) - see below
54
552) Adresses notes
56
57  - I can't tell what adresses 0xff7r12.l and 0xff7e16.l are supposed to be designed for :
58    they are written once at the begining of each level (code at 0x1a9030) but I haven't found
59    when they were read back (I've only played the 2 first levels though as well as the bonus level,
60    but I also watched all demo levels till the end after the games full credits).
61    I guess they were originally designed for bonus lives (additional and first), but no evidence.
62  - 0xff7e21.b affects contents of 0xff7e3c.b, 0xffefe0.w, 0xff7e12.l and 0xff7e16.l :
63
64                         Easy             Normal             Hard
65                    0xff7e21.b=0x00   0xff7e21.b=0x01   0xff7e21.b=0x02
66      0xff7e3c.b      0x32              0x31              0x30
67      0xffefe0.w      0x3035            0x3032            0x3030
68      0xff7e12.l      0x30313000        0x30313200        0x30313400
69      0xff7e16.l      0x30303900        0x30313200        0x30313500
70
713) MCU notes
72
73  - As I don't know how it is on real hardware, MCU simulation is more a guess than anything;
74    anyway, the game now runs correctly (coins are handled and settings change)
75  - Difficulty Dip Switches are correct (see code at 0x1b2680)
76  - Coinage Dip Switches might be wrong because I don't know what the possible values can be,
77    but setting them the way I did isn't that bad (see code at 0x1b2a50)
78  - It's possible that writes to 0x220000 are in fact a mask for what is read back from 0x330000,
79    but I haven't found any formula (thus the "lame" read/write handlers you may investigate)
80
814) Controls notes
82
83  - This game is a one player only game (same as the MegaDrive version);
84    that's why I've "blanked" player 2 inputs which are never read.
85  - I've labelled the buttons the same way as in 'g_aladj' with default options.
86
875) MegaDrive comparaison ('g_aladj' in HazeMD)
88
89  - There is no "OPTIONS" menu as the difficulty is handled via the MCU / Dip Switches.
90    Some code has been patched but most is still there (see the texts in the ROM ares);
91    Unfortunately, there seems to be no way to access them (no "service" button).
92  - Even with the same settings (same value for 0xff7e21.b), lives and apples,
93    as well as contents of 0xff7e12.l and 0xff7e16.l are really different) !
94    Here is the same data as above for 'g_aladj' :
95
96                         Easy             Normal             Hard
97                    0xff7e21.b=0x00   0xff7e21.b=0x01   0xff7e21.b=0x02
98      0xff7e3c.b      0x35              0x33              0x32
99      0xffefe0.w      0x3135            0x3130            0x3035
100      0xff7e12.l      0x30303600        0x30303800        0x30313000
101      0xff7e16.l      0x30303300        0x30303600        0x30303900
102
103    But what makes the arcade version much harder is how energy is handled : in 'g_aladj', you can
104    be hit 8 times before you lose a life, while in 'aladbl', you lose a life as soon as you are hit !
105    This is done via code change at 0x1aee3c and patched code at 0x1afc00 :
106
107      diff aladbl.asm g_aladj.asm
108
109      < 1AEE3C: 4EB9 001A FC00             jsr     $1afc00.l
110      > 1AEE3C: 5339 00FF EFFA             subq.b  #1, $ffeffa.l
111
112      < 1AFC00: 0C39 0001 00FF F57C        cmpi.b  #$1, $fff57c.l
113      < 1AFC08: 6700 000A                  beq     $1afc14
114      < 1AFC0C: 4239 00FF EFFA             clr.b   $ffeffa.l
115      < 1AFC12: 4E75                       rts
116      < 1AFC14: 5339 00FF EFFA             subq.b  #1, $ffeffa.l
117      < 1AFC1A: 4E75                       rts
118
119    Surprisingly, when you are in "demo mode", player can be again be hit 8 times
120    before losing a life (this is the purpose of the 0xfff57c "flag") !
121
47122*/
48123
49124ROM_START( aladbl )
r869r870
54129   ROM_LOAD16_BYTE( "m4.bin", 0x100000, 0x080000,  CRC(bc712661) SHA1(dfd554d000399e17b4ddc69761e572195ed4e1f0))
55130ROM_END
56131
132WRITE16_HANDLER( aladbl_w )
133{
134    /*
135    Values returned from the log file :
136      - aladbl_w : 1b2a6c - data = 6600 (each time a coin is inserted)
137      - aladbl_w : 1b2a82 - data = 0000 (each time a coin is inserted)
138      - aladbl_w : 1b2d18 - data = aa00 (only once on reset)
139      - aladbl_w : 1b2d42 - data = 0000 (only once on reset)
140    */
141   logerror("aladbl_w : %06x - data = %04x\n",activecpu_get_pc(),data);
142}
143
57144READ16_HANDLER( aladbl_r )
58145{
59   if (activecpu_get_pc()==0x1b2d24) return 0x1200;
60   if (activecpu_get_pc()==0x1b2a56) return mame_rand(Machine); // coins
61   if (activecpu_get_pc()==0x1b2a72) return 0x0000;//mame_rand(Machine);
62   if (activecpu_get_pc()==0x1b2d4e) return mame_rand(Machine);
146   if (activecpu_get_pc()==0x1b2a56) return (readinputportbytag("MCU") & 0xff0f);             // coins
147   if (activecpu_get_pc()==0x1b2a72) return 0x0000;
148   if (activecpu_get_pc()==0x1b2d24) return (readinputportbytag("MCU") & 0x00f0) | 0x1200;    // difficulty
149   if (activecpu_get_pc()==0x1b2d4e) return 0x0000;
63150
64   printf("read at %06x\n",activecpu_get_pc());
151   logerror("aladbl_r : %06x\n",activecpu_get_pc());
65152
66   return 0x00;
153   return 0x0000;
67154}
68155
69156DRIVER_INIT( aladbl )
70157{
71158   // 220000 = writes to mcu? 330000 = reads?
159   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x220000, 0x220001, 0, 0, aladbl_w);
72160   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x330000, 0x330001, 0, 0, aladbl_r);
73161   driver_init_megadrij(machine);
74162}
75163
76GAME( 1993, aladbl ,  0,   megadriv,    megadriv,     aladbl,  ROT0,   "bootleg / Sega", "Aladdin (bootleg of Japanese Megadrive version)", GAME_NOT_WORKING )
164GAME( 1993, aladbl ,  0,   megadriv,    aladbl,       aladbl,  ROT0,   "bootleg / Sega", "Aladdin (bootleg of Japanese Megadrive version)", 0)
src/mame/drivers/wwfsstar.c
r869r870
369369   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
370370
371371   MDRV_SCREEN_REFRESH_RATE(57.44)
372   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
372   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
373373
374374   /* video hardware */
375375   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/actfancr.c
r869r870
403403   MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem)
404404
405405   MDRV_SCREEN_REFRESH_RATE(60)
406   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
406   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
407407
408408   /* video hardware */
409409   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
r869r870
446446   MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem)
447447
448448   MDRV_SCREEN_REFRESH_RATE(60)
449   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
449   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
450450
451451   /* video hardware */
452452   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/tank8.c
r869r870
390390   MDRV_CPU_PROGRAM_MAP(tank8_cpu_map, 0)
391391
392392   MDRV_SCREEN_REFRESH_RATE(60)
393   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(30 * 1000000 / 15681))
393   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(30 * 1000000 / 15681))
394394   MDRV_MACHINE_RESET(tank8)
395395
396396   /* video hardware */
src/mame/drivers/vaportra.c
r869r870
277277   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
278278
279279   MDRV_SCREEN_REFRESH_RATE(58)
280   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
280   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
281281
282282   /* video hardware */
283283   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/btime.c
r869r870
13151315   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
13161316
13171317   MDRV_SCREEN_REFRESH_RATE(57)
1318   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072))
1318   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072))
13191319
13201320   /* video hardware */
13211321   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/namcos11.c
r869r870
899899   MDRV_CPU_VBLANK_INT( namcos11_vblank, 1 )
900900
901901   MDRV_SCREEN_REFRESH_RATE( 60 )
902   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
902   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
903903
904904   MDRV_MACHINE_RESET( namcos11 )
905905   MDRV_NVRAM_HANDLER( at28c16_0 )
src/mame/drivers/gstriker.c
r869r870
448448   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
449449
450450   MDRV_SCREEN_REFRESH_RATE(60)
451   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(5000) /* hand-tuned, it needs a bit */)
451   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(5000) /* hand-tuned, it needs a bit */)
452452
453453   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK)
454454   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mame/drivers/snk.c
r869r870
12011201   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
12021202
12031203   MDRV_SCREEN_REFRESH_RATE(60)
1204   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1000))
1204   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1000))
12051205   MDRV_INTERLEAVE(300)
12061206
12071207   /* video hardware */
r869r870
12461246   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
12471247
12481248   MDRV_SCREEN_REFRESH_RATE(60)
1249   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1000))
1249   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1000))
12501250   MDRV_INTERLEAVE(300)
12511251
12521252   /* video hardware */
src/mame/drivers/suprslam.c
r869r870
338338   MDRV_CPU_IO_MAP(suprslam_sound_readport,suprslam_sound_writeport)
339339
340340   MDRV_SCREEN_REFRESH_RATE(60)
341   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2300) /* hand-tuned */)
341   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2300) /* hand-tuned */)
342342
343343   MDRV_GFXDECODE(gfxdecodeinfo)
344344
src/mame/drivers/sfkick.c
r869r870
8282   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
8383//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
8484
85   MDRV_CPU_ADD(Z80,8000000) // ?
86   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
85   //MDRV_CPU_ADD(Z80,8000000) // ?
86   //MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
8787//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
8888
8989   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/troangel.c
r869r870
207207   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
208208
209209   MDRV_SCREEN_REFRESH_RATE(57)
210   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1790)   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */)
210   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1790)   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */)
211211            /* the Lode Runner manual (similar but different hardware) */
212212            /* talks about 55Hz and 1790ms vblank duration. */
213213
src/mame/drivers/model2.c
r869r870
16711671   AM_RANGE(0x1c00000, 0x1dfffff) AM_ROM AM_REGION(REGION_USER5, 0)
16721672ADDRESS_MAP_END
16731673
1674#if 0
16741675static ADDRESS_MAP_START( geo_sharc_map, ADDRESS_SPACE_DATA, 32 )
16751676ADDRESS_MAP_END
1677#endif
16761678
16771679/*****************************************************************************/
16781680// TGP memory maps
r869r870
19021904   ROM_LOAD32_WORD("mpr-20294.9",  0x800000, 0x400000, CRC(a0bd1474) SHA1(c0c032adac69bd545e3aab481878b08f3c3edab8) )
19031905   ROM_LOAD32_WORD("mpr-20295.10", 0x800002, 0x400000, CRC(c548cced) SHA1(d34f2fc9b4481c75a6824aa4bdd3f1884188d35b) )
19041906
1907   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
1908
19051909   ROM_REGION( 0x800000, REGION_USER2, 0 ) // Models
19061910   ROM_LOAD32_WORD("mpr-20298.17", 0x000000, 0x400000, CRC(8ab782fc) SHA1(595f6fc2e9c58ce9763d51798ceead8d470f0a33) )
19071911   ROM_LOAD32_WORD("mpr-20299.21", 0x000002, 0x400000, CRC(90e20cdb) SHA1(730d58286fb7e91aa4128dc208b0f60eb3becc78) )
r869r870
20292033   ROM_LOAD32_WORD( "mpr-17564.4",  0xc00000, 0x200000, CRC(d8062489) SHA1(57666b6937f79bb65c43ed02b04a454882d01e61) )
20302034   ROM_LOAD32_WORD( "mpr-17565.5",  0xc00002, 0x200000, CRC(0517c6e9) SHA1(d9ba93998286713758385033119416714674c8d8) )
20312035
2036   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2037
20322038   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
20332039   ROM_LOAD32_WORD( "mpr-17554.16", 0x000000, 0x200000, CRC(27896d82) SHA1(c0624e58de2e427465daaa10dbb02ea2a1fd0f1b) )
20342040   ROM_LOAD32_WORD( "mpr-17548.20", 0x000002, 0x200000, CRC(c95facc2) SHA1(09d19abe5d75a335df7510df8abb2d4425159cdf) )
r869r870
20732079   ROM_LOAD32_WORD( "mpr-17564.4",  0xc00000, 0x200000, CRC(d8062489) SHA1(57666b6937f79bb65c43ed02b04a454882d01e61) )
20742080   ROM_LOAD32_WORD( "mpr-17565.5",  0xc00002, 0x200000, CRC(0517c6e9) SHA1(d9ba93998286713758385033119416714674c8d8) )
20752081
2082   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2083
20762084   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
20772085   ROM_LOAD32_WORD( "mpr-17554.16", 0x000000, 0x200000, CRC(27896d82) SHA1(c0624e58de2e427465daaa10dbb02ea2a1fd0f1b) )
20782086   ROM_LOAD32_WORD( "mpr-17548.20", 0x000002, 0x200000, CRC(c95facc2) SHA1(09d19abe5d75a335df7510df8abb2d4425159cdf) )
r869r870
21172125   ROM_LOAD32_WORD( "mpr-17564.4",  0xc00000, 0x200000, CRC(d8062489) SHA1(57666b6937f79bb65c43ed02b04a454882d01e61) )
21182126   ROM_LOAD32_WORD( "mpr-17565.5",  0xc00002, 0x200000, CRC(0517c6e9) SHA1(d9ba93998286713758385033119416714674c8d8) )
21192127
2128   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2129
21202130   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
21212131   ROM_LOAD32_WORD( "mpr-17554.16", 0x000000, 0x200000, CRC(27896d82) SHA1(c0624e58de2e427465daaa10dbb02ea2a1fd0f1b) )
21222132   ROM_LOAD32_WORD( "mpr-17548.20", 0x000002, 0x200000, CRC(c95facc2) SHA1(09d19abe5d75a335df7510df8abb2d4425159cdf) )
r869r870
23182328   ROM_COPY( REGION_USER1, 0x1000000, 0x1e00000, 0x100000 )
23192329   ROM_COPY( REGION_USER1, 0x1000000, 0x1f00000, 0x100000 )
23202330
2331   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2332
23212333   ROM_REGION( 0x800000, REGION_USER5, 0 ) // Coprocessor Data ROM
23222334   ROM_LOAD32_WORD( "mpr-18420.28", 0x000000, 0x200000, CRC(92b87817) SHA1(b6949b745d0bedeecd6d0240f8911cb345c16d8d) )
23232335   ROM_LOAD32_WORD( "mpr-18419.29", 0x000002, 0x200000, CRC(74542d87) SHA1(37230e96dd526fb47fcbde5778e5466d8955a969) )
r869r870
23622374   ROM_COPY( REGION_USER1, 0xc00000, 0xe00000, 0x100000 )
23632375   ROM_COPY( REGION_USER1, 0xc00000, 0xf00000, 0x100000 )
23642376
2377   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2378
23652379   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
23662380   ROM_LOAD32_WORD( "mpr-18513.16", 0x000000, 0x200000, CRC(777a3633) SHA1(edc2798c4d88975ce67b54fc0db008e7d24db6ef) )
23672381   ROM_LOAD32_WORD( "mpr-18510.20", 0x000002, 0x200000, CRC(083f5186) SHA1(0f9d5c6e18bf3ae5d6bc195f513668286aa23478) )
r869r870
24702484   ROM_LOAD32_WORD("mpr-20791.4",  0x1800000, 0x400000, CRC(4883d0df) SHA1(b98af63e81f6c1b2766d7e96acbd1821bba000d4) )
24712485   ROM_LOAD32_WORD("mpr-20792.5",  0x1800002, 0x400000, CRC(47becfa2) SHA1(a333885872a64b322f3cb464a70352d73654b1b3) )
24722486
2487   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2488
24732489   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
24742490   ROM_LOAD32_WORD("mpr-20799.16", 0x0000000, 0x400000, CRC(424571bf) SHA1(18a4e8d0e968fff3b645b59a0023b0ef38d51924) )
24752491   ROM_LOAD32_WORD("mpr-20803.20", 0x0000002, 0x400000, CRC(61a8ad52) SHA1(0215b5de6d10f0852ac0ca4e10475e10243e39c7) )
r869r870
28542870   ROM_LOAD32_WORD("mpr-21262.da0", 0x000000, 0x400000, CRC(aa71353e) SHA1(6eb5e8284734f01beec1dbbee049b6b7672e2504) )
28552871   ROM_LOAD32_WORD("mpr-21263.da1", 0x000002, 0x400000, CRC(d55d4509) SHA1(641db6ec3e9266f8265a4b541bcd8c2f7d164cc3) )
28562872
2873   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2874
28572875   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
28582876   ROM_LOAD32_WORD("mpr-21264.tp0", 0x0000000, 0x400000, CRC(6b35204d) SHA1(3a07701b140eb3088fad29c8b2d9c1e1e7ef9471) )
28592877   ROM_LOAD32_WORD("mpr-21268.tp1", 0x0000002, 0x400000, CRC(16ce2147) SHA1(39cba6b4f1130a3da7e2d226c948425eec34090e) )
r869r870
31053123   ROM_LOAD32_WORD("mpr-19313.6",   0x1800002, 0x200000, CRC(8c63055e) SHA1(9f375b3f4a8884163ffcf364989499f2cd21e18b) )
31063124   ROM_RELOAD     (                 0x1c00002, 0x200000 )
31073125
3126   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
3127
31083128   ROM_REGION( 0x1800000, REGION_USER2, 0 ) // Models
31093129   ROM_LOAD32_WORD("mpr-19322.17",  0x0000000, 0x400000, CRC(d0e6ecf0) SHA1(1b87f6337b4286fd738856da899462e7baa92601) )
31103130   ROM_LOAD32_WORD("mpr-19325.21",  0x0000002, 0x400000, CRC(7cbe432d) SHA1(8b31e292160b88df9c77b36096914d09ab8b6086) )
src/mame/drivers/ataxx.c
r869r870
5252
5353static ADDRESS_MAP_START( master_map_io, ADDRESS_SPACE_IO, 8 )
5454   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
55    AM_RANGE(0x04, 0x04) AM_READ(leland_i86_response_r)
56    AM_RANGE(0x05, 0x05) AM_WRITE(leland_i86_command_hi_w)
57    AM_RANGE(0x06, 0x06) AM_WRITE(leland_i86_command_lo_w)
58    AM_RANGE(0x0c, 0x0c) AM_WRITE(ataxx_i86_control_w)
55    AM_RANGE(0x04, 0x04) AM_READ(leland_80186_response_r)
56    AM_RANGE(0x05, 0x05) AM_WRITE(leland_80186_command_hi_w)
57    AM_RANGE(0x06, 0x06) AM_WRITE(leland_80186_command_lo_w)
58    AM_RANGE(0x0c, 0x0c) AM_WRITE(ataxx_80186_control_w)
5959    AM_RANGE(0x20, 0x20) AM_READWRITE(ataxx_eeprom_r, ataxx_eeprom_w)
6060    AM_RANGE(0xd0, 0xef) AM_READWRITE(ataxx_mvram_port_r, ataxx_mvram_port_w)
6161    AM_RANGE(0xf0, 0xff) AM_READWRITE(ataxx_master_input_r, ataxx_master_output_w)
r869r870
312312 *
313313 *************************************/
314314
315static struct CustomSound_interface i186_custom_interface =
315static struct CustomSound_interface i80186_custom_interface =
316316{
317    leland_i186_sh_start
317    leland_80186_sh_start
318318};
319319
320320
r869r870
336336   MDRV_CPU_PROGRAM_MAP(slave_map_program,0)
337337   MDRV_CPU_IO_MAP(slave_map_io,0)
338338
339   MDRV_CPU_ADD_TAG("sound", I186, 16000000/2)
339   MDRV_CPU_ADD_TAG("sound", I80186, 16000000/2)
340340   /* audio CPU */
341   MDRV_CPU_PROGRAM_MAP(leland_i86_map_program,0)
342   MDRV_CPU_IO_MAP(ataxx_i86_map_io,0)
341   MDRV_CPU_PROGRAM_MAP(leland_80186_map_program,0)
342   MDRV_CPU_IO_MAP(ataxx_80186_map_io,0)
343343
344344   MDRV_SCREEN_REFRESH_RATE(60)
345345
r869r870
363363   MDRV_SPEAKER_STANDARD_MONO("mono")
364364
365365   MDRV_SOUND_ADD(CUSTOM, 0)
366   MDRV_SOUND_CONFIG(i186_custom_interface)
366   MDRV_SOUND_CONFIG(i80186_custom_interface)
367367   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
368368MACHINE_DRIVER_END
369369
src/mame/drivers/sshangha.c
r869r870
350350   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
351351
352352   MDRV_SCREEN_REFRESH_RATE(60)
353   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
353   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
354354   MDRV_MACHINE_RESET(sshangha)   /* init machine */
355355
356356   /* video hardware */
src/mame/drivers/leland.c
r869r870
6767static ADDRESS_MAP_START( master_map_io, ADDRESS_SPACE_IO, 8 )
6868   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
6969   AM_RANGE(0xf0, 0xf0) AM_WRITE(leland_master_alt_bankswitch_w)
70    AM_RANGE(0xf2, 0xf2) AM_READWRITE(leland_i86_response_r, leland_i86_command_lo_w)
71   AM_RANGE(0xf4, 0xf4) AM_WRITE(leland_i86_command_hi_w)
70    AM_RANGE(0xf2, 0xf2) AM_READWRITE(leland_80186_response_r, leland_80186_command_lo_w)
71   AM_RANGE(0xf4, 0xf4) AM_WRITE(leland_80186_command_hi_w)
7272    AM_RANGE(0xfd, 0xff) AM_READWRITE(leland_master_analog_key_r, leland_master_analog_key_w)
7373ADDRESS_MAP_END
7474
r869r870
713713};
714714
715715
716static struct CustomSound_interface i186_custom_interface =
716static struct CustomSound_interface i80186_custom_interface =
717717{
718    leland_i186_sh_start
718    leland_80186_sh_start
719719};
720720
721721
722722static struct CustomSound_interface redline_custom_interface =
723723{
724     redline_i186_sh_start
724     redline_80186_sh_start
725725};
726726
727727
r869r870
783783
784784   /* basic machine hardware */
785785   MDRV_IMPORT_FROM(leland)
786   MDRV_CPU_ADD_TAG("sound", I186, 16000000/2)
786   MDRV_CPU_ADD_TAG("sound", I80186, 16000000/2)
787787   /* audio CPU */
788   MDRV_CPU_PROGRAM_MAP(leland_i86_map_program,0)
789   MDRV_CPU_IO_MAP(redline_i86_map_io,0)
788   MDRV_CPU_PROGRAM_MAP(leland_80186_map_program,0)
789   MDRV_CPU_IO_MAP(redline_80186_map_io,0)
790790
791791   /* sound hardware */
792792   MDRV_SOUND_REPLACE("custom", CUSTOM, 0)
r869r870
800800   /* basic machine hardware */
801801   MDRV_IMPORT_FROM(redline)
802802   MDRV_CPU_MODIFY("sound")
803   MDRV_CPU_IO_MAP(leland_i86_map_io,0)
803   MDRV_CPU_IO_MAP(leland_80186_map_io,0)
804804
805805   /* sound hardware */
806806   MDRV_SOUND_REPLACE("custom", CUSTOM, 0)
807   MDRV_SOUND_CONFIG(i186_custom_interface)
807   MDRV_SOUND_CONFIG(i80186_custom_interface)
808808   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
809809MACHINE_DRIVER_END
810810
r869r870
25562556GAME( 1987, dblplay,  0,       leland,  basebal2, dblplay,  ROT0,   "Leland Corp. / Tradewest", "Super Baseball Double Play Home Run Derby", 0 )
25572557GAME( 1988, strkzone, 0,       leland,  basebal2, strkzone, ROT0,   "Leland Corp.", "Strike Zone Baseball", 0 )
25582558
2559/* large master banks, small slave banks, I86 sound */
2559/* large master banks, small slave banks, 80186 sound */
25602560GAME( 1987, redlin2p, 0,       redline, redline,  redlin2p, ROT270, "Cinematronics (Tradewest license)", "Redline Racer (2 players)", 0 )
25612561GAME( 1987, quarterb, 0,       quarterb,quarterb, quarterb, ROT270, "Leland Corp.", "Quarterback", 0 )
25622562GAME( 1987, quartrba, quarterb,quarterb,quarterb, quarterb, ROT270, "Leland Corp.", "Quarterback (set 2)", 0 )
25632563
2564/* large master banks, large slave banks, I86 sound */
2564/* large master banks, large slave banks, 80186 sound */
25652565GAME( 1988, viper,    0,       lelandi, dangerz,  viper,    ROT0,   "Leland Corp.", "Viper", 0 )
25662566GAME( 1988, teamqb,   0,       lelandi, teamqb,   teamqb,   ROT270, "Leland Corp.", "John Elway's Team Quarterback", 0 )
25672567GAME( 1988, teamqb2,  teamqb,  lelandi, teamqb,   teamqb,   ROT270, "Leland Corp.", "John Elway's Team Quarterback (set 2)", 0 )
r869r870
25702570GAME( 1989, aafbc,    aafb,    lelandi, teamqb,   aafbb,    ROT270, "Leland Corp.", "All American Football (rev C)", 0 )
25712571GAME( 1989, aafbb,    aafb,    lelandi, teamqb,   aafbb,    ROT270, "Leland Corp.", "All American Football (rev B)", 0 )
25722572
2573/* huge master banks, large slave banks, I86 sound */
2573/* huge master banks, large slave banks, 80186 sound */
25742574GAME( 1989, offroad,  0,       lelandi, offroad,  offroad,  ROT0,   "Leland Corp.", "Ironman Stewart's Super Off-Road", 0 )
25752575GAME( 1989, offroadt, 0,       lelandi, offroad,  offroadt, ROT0,   "Leland Corp.", "Ironman Stewart's Super Off-Road Track Pack", 0 )
25762576GAME( 1990, pigout,   0,       lelandi, pigout,   pigout,   ROT0,   "Leland Corp.", "Pigout", 0 )
src/mame/drivers/blockade.c
r869r870
116116
117117
118118static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
119    AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_ROM) AM_MIRROR(0x6000);
120    AM_RANGE(0x8000, 0x83ff) AM_READ(MRA8_RAM) AM_MIRROR(0x6c00);
121    AM_RANGE(0x9000, 0x90ff) AM_READ(MRA8_RAM) AM_MIRROR(0x6f00);
119    AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_ROM) AM_MIRROR(0x6000)
120    AM_RANGE(0x8000, 0x83ff) AM_READ(MRA8_RAM) AM_MIRROR(0x6c00)
121    AM_RANGE(0x9000, 0x90ff) AM_READ(MRA8_RAM) AM_MIRROR(0x6f00)
122122ADDRESS_MAP_END
123123
124124static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
125    AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_ROM) AM_MIRROR(0x6000);
126    AM_RANGE(0x8000, 0x83ff) AM_WRITE(blockade_videoram_w) AM_BASE(&videoram) AM_MIRROR(0x6c00);
127    AM_RANGE(0x9000, 0x90ff) AM_WRITE(MWA8_RAM) AM_MIRROR(0x6f00);
125    AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_ROM) AM_MIRROR(0x6000)
126    AM_RANGE(0x8000, 0x83ff) AM_WRITE(blockade_videoram_w) AM_BASE(&videoram) AM_MIRROR(0x6c00)
127    AM_RANGE(0x9000, 0x90ff) AM_WRITE(MWA8_RAM) AM_MIRROR(0x6f00)
128128ADDRESS_MAP_END
129129
130130static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
src/mame/drivers/cps2.c
r869r870
13611361   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 251)   /* 251 is good (see 'mercy mercy mercy'section of sgemf attract mode for accurate sound sync */
13621362
13631363   MDRV_SCREEN_REFRESH_RATE(59.633333)
1364   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1364   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
13651365//  MDRV_INTERLEAVE(262)  /* 262 scanlines, for raster effects */
13661366
13671367   MDRV_NVRAM_HANDLER(cps2)
src/mame/drivers/lemmings.c
r869r870
283283   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
284284
285285   MDRV_SCREEN_REFRESH_RATE(60)
286   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
286   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
287287
288288   /* video hardware */
289289   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/tiamc1.c
r869r870
282282   MDRV_CPU_IO_MAP(tiamc1_readport,tiamc1_writeport)
283283
284284   MDRV_SCREEN_REFRESH_RATE(50)
285   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1600))
285   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1600))
286286   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
287287
288288   MDRV_MACHINE_RESET(tiamc1)
src/mame/drivers/segag80r.c
r869r870
353353   AM_RANGE(0xbe, 0xbf) AM_READWRITE(segag80r_video_port_r, segag80r_video_port_w)
354354   AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x04) AM_WRITE(coin_count_w)
355355   AM_RANGE(0xf8, 0xfb) AM_READ(mangled_ports_r)
356   AM_RANGE(0xfc, 0xfc) AM_READ(port_tag_to_handler8("FC"))
356   AM_RANGE(0xfc, 0xfc) AM_READ_PORT("FC")
357357ADDRESS_MAP_END
358358
359359
src/mame/drivers/shanghai.c
r869r870
610610
611611static int regno;
612612
613static READ8_HANDLER( HD63484_status_r )
613static READ16_HANDLER( HD63484_status_r )
614614{
615   if (offset == 1) return 0xff;   /* high 8 bits - not used */
616
617615   if (activecpu_get_pc() != 0xfced6 && activecpu_get_pc() != 0xfe1d6) logerror("%05x: HD63484 status read\n",activecpu_get_pc());
618   return 0x22|4;   /* write FIFO ready + command end    + read FIFO ready */
616   return 0xff22|4;   /* write FIFO ready + command end    + read FIFO ready */
619617}
620618
621static WRITE8_HANDLER( HD63484_address_w )
619static WRITE16_HANDLER( HD63484_address_w )
622620{
623   static UINT8 reg[2];
624
625   reg[offset] = data;
626   regno = reg[0];   /* only low 8 bits are used */
627//if (offset == 0)
628//  logerror("PC %05x: HD63484 select register %02x\n",activecpu_get_pc(),regno);
621   /* only low 8 bits are used */
622   if (ACCESSING_LSB)
623      regno = data;
629624}
630625
631static WRITE8_HANDLER( HD63484_data_w )
626static WRITE16_HANDLER( HD63484_data_w )
632627{
633   static UINT8 dat[2];
634
635   dat[offset] = data;
636   if (offset == 1)
637   {
638      int val = dat[0] + 256 * dat[1];
639
640      if (regno == 0)   /* FIFO */
641         HD63484_command_w(val);
642      else
643      {
644logerror("PC %05x: HD63484 register %02x write %04x\n",activecpu_get_pc(),regno,val);
645         HD63484_reg[regno/2] = val;
646         if (regno & 0x80) regno += 2;   /* autoincrement */
647      }
648   }
628   COMBINE_DATA(&HD63484_reg[regno/2]);
629   if (regno & 0x80) regno += 2;   /* autoincrement */
630logerror("PC %05x: HD63484 register %02x write %04x\n",activecpu_get_pc(),regno,HD63484_reg[regno/2]);
631   if (regno == 0)   /* FIFO */
632      HD63484_command_w(HD63484_reg[0]);
649633}
650634
651static READ8_HANDLER( HD63484_data_r )
635static READ16_HANDLER( HD63484_data_r )
652636{
653637   int res;
654638
r869r870
667651      res = 0;
668652   }
669653
670   if (offset == 0)
671      return res & 0xff;
672   else
673      return (res >> 8) & 0xff;
654   return res;
674655}
675656
676657
r869r870
757738   cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0x80);
758739}
759740
760static WRITE8_HANDLER( shanghai_coin_w )
741static WRITE16_HANDLER( shanghai_coin_w )
761742{
762   coin_counter_w(0,data & 1);
763   coin_counter_w(1,data & 2);
743   if (ACCESSING_LSB)
744   {
745      coin_counter_w(0,data & 1);
746      coin_counter_w(1,data & 2);
747   }
764748}
765749
766static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
767   AM_RANGE(0x00000, 0x03fff) AM_READ(MRA8_RAM)
768   AM_RANGE(0x80000, 0xfffff) AM_READ(MRA8_ROM)
750static ADDRESS_MAP_START( shanghai_map, ADDRESS_SPACE_PROGRAM, 16 )
751   AM_RANGE(0x00000, 0x03fff) AM_RAM
752   AM_RANGE(0x80000, 0xfffff) AM_ROM
769753ADDRESS_MAP_END
770754
771static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
772   AM_RANGE(0x00000, 0x03fff) AM_WRITE(MWA8_RAM)
773   AM_RANGE(0x80000, 0xfffff) AM_WRITE(MWA8_ROM)
774ADDRESS_MAP_END
775755
776static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
777   AM_RANGE(0x00, 0x01) AM_READ(HD63484_status_r)
778   AM_RANGE(0x02, 0x03) AM_READ(HD63484_data_r)
779   AM_RANGE(0x20, 0x20) AM_READ(YM2203_status_port_0_r)
780   AM_RANGE(0x22, 0x22) AM_READ(YM2203_read_port_0_r)
781   AM_RANGE(0x40, 0x40) AM_READ(input_port_0_r)
782   AM_RANGE(0x44, 0x44) AM_READ(input_port_1_r)
783   AM_RANGE(0x48, 0x48) AM_READ(input_port_2_r)
756static ADDRESS_MAP_START( shangha2_map, ADDRESS_SPACE_PROGRAM, 16 )
757   AM_RANGE(0x00000, 0x03fff) AM_RAM
758   AM_RANGE(0x04000, 0x041ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
759   AM_RANGE(0x80000, 0xfffff) AM_ROM
784760ADDRESS_MAP_END
785761
786static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
787   AM_RANGE(0x00, 0x01) AM_WRITE(HD63484_address_w)
788   AM_RANGE(0x02, 0x03) AM_WRITE(HD63484_data_w)
789   AM_RANGE(0x20, 0x20) AM_WRITE(YM2203_control_port_0_w)
790   AM_RANGE(0x22, 0x22) AM_WRITE(YM2203_write_port_0_w)
791   AM_RANGE(0x4c, 0x4c) AM_WRITE(shanghai_coin_w)
792ADDRESS_MAP_END
793762
794
795static ADDRESS_MAP_START( shangha2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
796   AM_RANGE(0x00000, 0x03fff) AM_READ(MRA8_RAM)
797   AM_RANGE(0x80000, 0xfffff) AM_READ(MRA8_ROM)
763static ADDRESS_MAP_START( shanghai_portmap, ADDRESS_SPACE_IO, 16 )
764   AM_RANGE(0x00, 0x01) AM_READWRITE(HD63484_status_r, HD63484_address_w)
765   AM_RANGE(0x02, 0x03) AM_READWRITE(HD63484_data_r, HD63484_data_w)
766   AM_RANGE(0x20, 0x21) AM_READWRITE(YM2203_status_port_0_lsb_r, YM2203_control_port_0_lsb_w)
767   AM_RANGE(0x22, 0x23) AM_READWRITE(YM2203_read_port_0_lsb_r, YM2203_write_port_0_lsb_w)
768   AM_RANGE(0x40, 0x41) AM_READ(input_port_0_word_r)
769   AM_RANGE(0x44, 0x45) AM_READ(input_port_1_word_r)
770   AM_RANGE(0x48, 0x49) AM_READ(input_port_2_word_r)
771   AM_RANGE(0x4c, 0x4d) AM_WRITE(shanghai_coin_w)
798772ADDRESS_MAP_END
799773
800static ADDRESS_MAP_START( shangha2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
801   AM_RANGE(0x00000, 0x03fff) AM_WRITE(MWA8_RAM)
802   AM_RANGE(0x04000, 0x041ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
803   AM_RANGE(0x80000, 0xfffff) AM_WRITE(MWA8_ROM)
804ADDRESS_MAP_END
805774
806static ADDRESS_MAP_START( shangha2_readport, ADDRESS_SPACE_IO, 8 )
807   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r)
808   AM_RANGE(0x10, 0x10) AM_READ(input_port_1_r)
809   AM_RANGE(0x20, 0x20) AM_READ(input_port_2_r)
810   AM_RANGE(0x30, 0x31) AM_READ(HD63484_status_r)
811   AM_RANGE(0x32, 0x33) AM_READ(HD63484_data_r)
812   AM_RANGE(0x40, 0x40) AM_READ(YM2203_status_port_0_r)
813   AM_RANGE(0x42, 0x42) AM_READ(YM2203_read_port_0_r)
775static ADDRESS_MAP_START( shangha2_portmap, ADDRESS_SPACE_IO, 16 )
776   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)
777   AM_RANGE(0x10, 0x11) AM_READ(input_port_1_word_r)
778   AM_RANGE(0x20, 0x21) AM_READ(input_port_2_word_r)
779   AM_RANGE(0x30, 0x31) AM_READWRITE(HD63484_status_r, HD63484_address_w)
780   AM_RANGE(0x32, 0x33) AM_READWRITE(HD63484_data_r, HD63484_data_w)
781   AM_RANGE(0x40, 0x41) AM_READWRITE(YM2203_status_port_0_lsb_r, YM2203_control_port_0_lsb_w)
782   AM_RANGE(0x42, 0x43) AM_READWRITE(YM2203_read_port_0_lsb_r, YM2203_write_port_0_lsb_w)
783   AM_RANGE(0x50, 0x51) AM_WRITE(shanghai_coin_w)
814784ADDRESS_MAP_END
815785
816static ADDRESS_MAP_START( shangha2_writeport, ADDRESS_SPACE_IO, 8 )
817   AM_RANGE(0x30, 0x31) AM_WRITE(HD63484_address_w)
818   AM_RANGE(0x32, 0x33) AM_WRITE(HD63484_data_w)
819   AM_RANGE(0x40, 0x40) AM_WRITE(YM2203_control_port_0_w)
820   AM_RANGE(0x42, 0x42) AM_WRITE(YM2203_write_port_0_w)
821   AM_RANGE(0x50, 0x50) AM_WRITE(shanghai_coin_w)
822ADDRESS_MAP_END
823786
824787
825788
826789
827
828static READ8_HANDLER(shanghai_rand_r)
790static READ16_HANDLER(shanghai_rand_r)
829791{
830792   return mame_rand(Machine);
831793}
832794
833static READ8_HANDLER( kothello_HD63484_status_r )
795static READ16_HANDLER( kothello_HD63484_status_r )
834796{
835   if (offset == 1) return 0xff;   /* high 8 bits - not used */
836   return 0x22;   /* write FIFO ready + command end    + read FIFO ready */
797   return 0xff22;   /* write FIFO ready + command end    + read FIFO ready */
837798}
838799
839static ADDRESS_MAP_START( kothello_mem, ADDRESS_SPACE_PROGRAM, 8 )
800static ADDRESS_MAP_START( kothello_map, ADDRESS_SPACE_PROGRAM, 16 )
840801   AM_RANGE(0x00000, 0x07fff) AM_RAM
841   AM_RANGE(0x08010, 0x08011) AM_READ(kothello_HD63484_status_r) AM_WRITE(HD63484_address_w)
842   AM_RANGE(0x08012, 0x08013) AM_READ(HD63484_data_r) AM_WRITE(HD63484_data_w)
843   AM_RANGE(0x09010, 0x0901f) AM_READ(shanghai_rand_r)AM_WRITENOP // unknown, sub cpu communication ?
844   AM_RANGE(0x0a000, 0x0a1ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
845   AM_RANGE(0x0b010, 0x0b01f) AM_READ(seibu_main_v30_r) AM_WRITE(seibu_main_v30_w)
802   AM_RANGE(0x08010, 0x08011) AM_READWRITE(kothello_HD63484_status_r, HD63484_address_w)
803   AM_RANGE(0x08012, 0x08013) AM_READWRITE(HD63484_data_r, HD63484_data_w)
804   AM_RANGE(0x09010, 0x0901f) AM_READWRITE(shanghai_rand_r, MWA16_NOP) // unknown, sub cpu communication ?
805   AM_RANGE(0x0a000, 0x0a1ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
806   AM_RANGE(0x0b010, 0x0b01f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
846807   AM_RANGE(0x80000, 0xfffff) AM_ROM
847808ADDRESS_MAP_END
848809
r869r870
1022983
1023984   /* basic machine hardware */
1024985   MDRV_CPU_ADD(V30,16000000/2)   /* ? */
1025   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1026   MDRV_CPU_IO_MAP(readport,writeport)
986   MDRV_CPU_PROGRAM_MAP(shanghai_map,0)
987   MDRV_CPU_IO_MAP(shanghai_portmap,0)
1027988   MDRV_CPU_VBLANK_INT(shanghai_interrupt,1)
1028989
1029990   MDRV_SCREEN_REFRESH_RATE(30)
r869r870
10551016
10561017   /* basic machine hardware */
10571018   MDRV_CPU_ADD(V30,16000000/2)   /* ? */
1058   MDRV_CPU_PROGRAM_MAP(shangha2_readmem,shangha2_writemem)
1059   MDRV_CPU_IO_MAP(shangha2_readport,shangha2_writeport)
1019   MDRV_CPU_PROGRAM_MAP(shangha2_map,0)
1020   MDRV_CPU_IO_MAP(shangha2_portmap,0)
10601021   MDRV_CPU_VBLANK_INT(shanghai_interrupt,1)
10611022
10621023   MDRV_SCREEN_REFRESH_RATE(30)
r869r870
10911052
10921053   /* basic machine hardware */
10931054   MDRV_CPU_ADD(V30,16000000/2)   /* ? */
1094   MDRV_CPU_PROGRAM_MAP(kothello_mem, 0)
1055   MDRV_CPU_PROGRAM_MAP(kothello_map, 0)
10951056   MDRV_CPU_VBLANK_INT(shanghai_interrupt,1)
10961057
10971058   SEIBU3A_SOUND_SYSTEM_CPU(14318180/4)
r869r870
12141175GAME( 1988, shanghai, 0, shanghai, shanghai, 0, ROT0, "Sunsoft", "Shanghai (Japan)", GAME_IMPERFECT_GRAPHICS )
12151176GAME( 1989, shangha2, 0, shangha2, shangha2, 0, ROT0, "Sunsoft", "Shanghai II (Japan)", 0 )
12161177GAME( 1990, kothello, 0, kothello, kothello, 0, ROT0, "Success", "Kyuukyoku no Othello", GAME_NOT_WORKING )
1217
src/mame/drivers/namcos12.c
r869r870
13741374   MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 );
13751375
13761376   MDRV_SCREEN_REFRESH_RATE( 60 )
1377   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
1377   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
13781378
13791379   MDRV_MACHINE_START( namcos12 )
13801380   MDRV_MACHINE_RESET( namcos12 )
src/mame/drivers/raiden2.c
r869r870
2525#include "audio/seibu.h"
2626
2727static tilemap *background_layer,*midground_layer,*foreground_layer,*text_layer;
28static UINT8 *back_data,*fore_data,*mid_data, *w1ram;
28static UINT16 *back_data,*fore_data,*mid_data, *w1ram;
2929static int bg_bank=0, fg_bank=6, mid_bank=1, bg_col=0, fg_col=1, mid_col=2;
3030
3131static int tick;
32static UINT8 *mainram;
32static UINT16 *mainram;
3333
3434static int c_r[0xc000], c_w[0xc000];
3535
36static void combine16(UINT16 *val, int offset, UINT8 data)
36static void combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
3737{
38   offset *= 8;
39   *val = (*val & ~(0xff << offset)) | (data << offset);
38   UINT16 *dest = (UINT16 *)val + BYTE_XOR_LE(offset);
39   COMBINE_DATA(dest);
4040}
4141
42static void combine32(UINT32 *val, int offset, UINT8 data)
43{
44   offset *= 8;
45   *val = (*val & ~(0xff << offset)) | (data << offset);
46}
4742
48
4943/* SPRITE DRAWING (move to video file) */
5044
5145static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ,int pri_mask )
5246{
47   const UINT16 *source = spriteram16 + 0x1000/2 - 4;
48   const UINT16 *finish = spriteram16;
5349
54   const UINT8 *source = spriteram+0x1000-8 ;
55   const UINT8 *finish = spriteram;
56
5750   const gfx_element *gfx = machine->gfx[2];
5851
5952//  static int ytlim = 1;
r869r870
7972
8073
8174   while( source>finish ){
82      int tile_number = source[2]|(source[3]<<8);
83      int sx = source[4] | (source[5] <<8);
84      int sy = source[6] | (source[7] <<8);
75      int tile_number = source[1];
76      int sx = source[2];
77      int sy = source[3];
8578      int colr;
8679      int xtiles, ytiles;
8780      int ytlim, xtlim;
r869r870
9285      if (sy & 0x8000) sy -= 0x10000;
9386
9487
95      ytlim = (source[1] >> 4) & 0x7;
96      xtlim = (source[1] >> 0) & 0x7;
88      ytlim = (source[0] >> 12) & 0x7;
89      xtlim = (source[0] >> 8) & 0x7;
9790
98      xflip = (source[1] >> 7) & 0x1;
99      yflip = (source[1] >> 3) & 0x1;
91      xflip = (source[0] >> 15) & 0x1;
92      yflip = (source[0] >> 11) & 0x1;
10093
101      colr = source[0];
102      colr &= 0x3f;
94      colr = source[0] & 0x3f;
10395
10496      ytlim += 1;
10597      xtlim += 1;
r869r870
139131         }
140132      }
141133
142      source-=8;
134      source-=4;
143135   }
144136
145137}
146138
147139/* VIDEO RELATED WRITE HANDLERS (move to video file) */
148140
149static WRITE8_HANDLER(raiden2_background_w)
141static WRITE16_HANDLER(raiden2_background_w)
150142{
151   back_data[offset] = data;
152   tilemap_mark_tile_dirty(background_layer, offset/2);
143   COMBINE_DATA(&back_data[offset]);
144   tilemap_mark_tile_dirty(background_layer, offset);
153145}
154146
155static WRITE8_HANDLER(raiden2_midground_w)
147static WRITE16_HANDLER(raiden2_midground_w)
156148{
157   mid_data[offset] = data;
158   tilemap_mark_tile_dirty(midground_layer,offset/2);
149   COMBINE_DATA(&mid_data[offset]);
150   tilemap_mark_tile_dirty(midground_layer,offset);
159151}
160152
161static WRITE8_HANDLER(raiden2_foreground_w)
153static WRITE16_HANDLER(raiden2_foreground_w)
162154{
163   fore_data[offset] = data;
164   tilemap_mark_tile_dirty(foreground_layer,offset/2);
155   COMBINE_DATA(&fore_data[offset]);
156   tilemap_mark_tile_dirty(foreground_layer,offset);
165157}
166158
167static WRITE8_HANDLER(raiden2_text_w)
159static WRITE16_HANDLER(raiden2_text_w)
168160{
169   videoram[offset] = data;
170   tilemap_mark_tile_dirty(text_layer, offset/2);
161   COMBINE_DATA(&videoram16[offset]);
162   tilemap_mark_tile_dirty(text_layer, offset);
171163}
172164
173165/* TILEMAP RELATED (move to video file) */
174166
175167static TILE_GET_INFO( get_back_tile_info )
176168{
177   int offs = tile_index*2;
178   int tile = back_data[offs]+(back_data[offs+1]<<8);
169   int tile = back_data[tile_index];
179170   int color = (tile >> 12) | (bg_col << 4);
180171
181172   tile = (tile & 0xfff) | (bg_bank << 12);
r869r870
185176
186177static TILE_GET_INFO( get_mid_tile_info )
187178{
188   int offs = tile_index*2;
189   int tile = mid_data[offs]+(mid_data[offs+1]<<8);
179   int tile = mid_data[tile_index];
190180   int color = (tile >> 12) | (mid_col << 4);
191181
192182   tile = (tile & 0xfff) | (mid_bank << 12);
r869r870
196186
197187static TILE_GET_INFO( get_fore_tile_info )
198188{
199   int offs = tile_index*2;
200   int tile = fore_data[offs]+(fore_data[offs+1]<<8);
189   int tile = fore_data[tile_index];
201190   int color = (tile >> 12) | (fg_col << 4);
202191
203192
r869r870
209198
210199static TILE_GET_INFO( get_text_tile_info )
211200{
212   int offs = tile_index*2;
213   int tile = videoram[offs]+(videoram[offs+1]<<8);
201   int tile = videoram16[tile_index];
214202   int color = (tile>>12)&0xf;
215203
216204   tile &= 0xfff;
r869r870
220208
221209static void set_scroll(tilemap *tm, int plane)
222210{
223   int x = (mainram[0x620+plane*4+1]<<8) | mainram[0x620+plane*4+0];
224   int y = (mainram[0x620+plane*4+3]<<8) | mainram[0x620+plane*4+2];
211   int x = mainram[0x620/2+plane*2+0];
212   int y = mainram[0x620/2+plane*2+1];
225213   tilemap_set_scrollx(tm, 0, x);
226214   tilemap_set_scrolly(tm, 0, y);
227215}
r869r870
263251   static UINT8 zz3[12];
264252#endif
265253
266   info_1 = mainram[0x6cc] & 1;
267   info_2 = (mainram[0x6cc] & 2)>>1;
268   info_3 = (mainram[0x471] & 0xc0)>>6;
254   info_1 = mainram[0x6cc/2] & 1;
255   info_2 = (mainram[0x6cc/2] & 2)>>1;
256   info_3 = (mainram[0x470/2] & 0xc000)>>14;
269257
270258#if 1
271259   set_scroll(background_layer, 0);
r869r870
276264#if 0
277265   {
278266      int new_bank;
279      new_bank = 0 | (mainram[0x6cc]&1);
267      new_bank = 0 | (mainram[0x6cc/2]&1);
280268      if(new_bank != bg_bank) {
281269         bg_bank = new_bank;
282270         tilemap_mark_all_tiles_dirty(background_layer);
283271      }
284272
285      new_bank = 2 | ((mainram[0x6cc]>>1)&1);
273      new_bank = 2 | ((mainram[0x6cc/2]>>1)&1);
286274      if(new_bank != mid_bank) {
287275         mid_bank = new_bank;
288276         tilemap_mark_all_tiles_dirty(midground_layer);
289277      }
290278
291      new_bank = 4 | (mainram[0x471]>>6);
279      new_bank = 4 | (mainram[0x470]>>14);
292280      if(new_bank != fg_bank) {
293281         fg_bank = new_bank;
294282         tilemap_mark_all_tiles_dirty(foreground_layer);
r869r870
300288   }
301289#endif
302290#if 0
303   if(0 && memcmp(zz, mainram+0x620, 16)) {
291   if(0 && memcmp(zz, mainram+0x620/2, 16)) {
304292      logerror("0:%04x %04x  1:%04x %04x 2:%04x %04x 3:%04x %04x\n",
305             (mainram[0x623]<<8) | mainram[0x622],
306             (mainram[0x621]<<8) | mainram[0x620],
307             (mainram[0x627]<<8) | mainram[0x626],
308             (mainram[0x625]<<8) | mainram[0x624],
309             (mainram[0x62b]<<8) | mainram[0x62a],
310             (mainram[0x629]<<8) | mainram[0x628],
311             (mainram[0x62f]<<8) | mainram[0x62e],
312             (mainram[0x62d]<<8) | mainram[0x62c]);
313      memcpy(zz, mainram+0x620, 16);
293             mainram[0x622/2],
294             mainram[0x620/2],
295             mainram[0x626/2],
296             mainram[0x624/2],
297             mainram[0x62a/2],
298             mainram[0x628/2],
299             mainram[0x62e/2],
300             mainram[0x62c/2]);
301      memcpy(zz, mainram+0x620/2, 16);
314302   }
315   if(0 && memcmp(zz2, mainram+0x470, 32)) {
303   if(0 && memcmp(zz2, mainram+0x470/2, 32)) {
316304      logerror("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x  %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
317             mainram[0x470], mainram[0x471], mainram[0x472], mainram[0x473],
318             mainram[0x474], mainram[0x475], mainram[0x476], mainram[0x477],
319             mainram[0x478], mainram[0x479], mainram[0x47a], mainram[0x47b],
320             mainram[0x47c], mainram[0x47d], mainram[0x47e], mainram[0x47f],
321             mainram[0x480], mainram[0x481], mainram[0x482], mainram[0x483],
322             mainram[0x484], mainram[0x485], mainram[0x486], mainram[0x487],
323             mainram[0x488], mainram[0x489], mainram[0x48a], mainram[0x48b],
324             mainram[0x48c], mainram[0x48d], mainram[0x48e], mainram[0x48f]);
325      memcpy(zz2, mainram+0x470, 32);
305             mainram[0x470/2] & 0xff, mainram[0x471/2] >> 8, mainram[0x472/2] & 0xff, mainram[0x473/2] >> 8,
306             mainram[0x474/2] & 0xff, mainram[0x475/2] >> 8, mainram[0x476/2] & 0xff, mainram[0x477/2] >> 8,
307             mainram[0x478/2] & 0xff, mainram[0x479/2] >> 8, mainram[0x47a/2] & 0xff, mainram[0x47b/2] >> 8,
308             mainram[0x47c/2] & 0xff, mainram[0x47d/2] >> 8, mainram[0x47e/2] & 0xff, mainram[0x47f/2] >> 8,
309             mainram[0x480/2] & 0xff, mainram[0x481/2] >> 8, mainram[0x482/2] & 0xff, mainram[0x483/2] >> 8,
310             mainram[0x484/2] & 0xff, mainram[0x485/2] >> 8, mainram[0x486/2] & 0xff, mainram[0x487/2] >> 8,
311             mainram[0x488/2] & 0xff, mainram[0x489/2] >> 8, mainram[0x48a/2] & 0xff, mainram[0x48b/2] >> 8,
312             mainram[0x48c/2] & 0xff, mainram[0x48d/2] >> 8, mainram[0x48e/2] & 0xff, mainram[0x48f/2] >> 8);
313      memcpy(zz2, mainram+0x470/2, 32);
326314   }
327315
328316#endif
329317#if 0
330   if(memcmp(zz3, mainram+0x620, 12)) {
331      logerror("%02x%02x %02x%02x  %02x%02x %02x%02x  %02x%02x %02x%02x\n",
332             mainram[0x623], mainram[0x622], mainram[0x621], mainram[0x620],
333             mainram[0x627], mainram[0x626], mainram[0x625], mainram[0x624],
334             mainram[0x62b], mainram[0x62a], mainram[0x629], mainram[0x628]);
335      memcpy(zz3, mainram+0x620, 12);
318   if(memcmp(zz3, mainram+0x620/2, 12)) {
319      logerror("%04x %04x  %04x %04x  %04x %04x\n",
320             mainram[0x622/2], mainram[0x620/2],
321             mainram[0x626/2], mainram[0x624/2],
322             mainram[0x62a/2], mainram[0x628/2]);
323      memcpy(zz3, mainram+0x620/2, 12);
336324   }
337325#endif
338326#if 1
r869r870
425413
426414   fillbitmap(bitmap, get_black_pen(machine), cliprect);
427415
428   if(!input_code_pressed(KEYCODE_Q))
429      tilemap_draw(bitmap,cliprect,background_layer,0,0);
430   if(!input_code_pressed(KEYCODE_W))
431      tilemap_draw(bitmap,cliprect,midground_layer,0,0);
432   if(!input_code_pressed(KEYCODE_E))
433      tilemap_draw(bitmap,cliprect,foreground_layer,0,0);
416   if (!input_code_pressed(KEYCODE_Q))
417      tilemap_draw(bitmap, cliprect, background_layer, 0, 0);
418   if (!input_code_pressed(KEYCODE_W))
419      tilemap_draw(bitmap, cliprect, midground_layer, 0, 0);
420   if (!input_code_pressed(KEYCODE_E))
421      tilemap_draw(bitmap, cliprect, foreground_layer, 0, 0);
434422
435   draw_sprites(machine,bitmap,cliprect,0);
436   if(!input_code_pressed(KEYCODE_A))
437      tilemap_draw(bitmap,cliprect,text_layer,0,0);
423   draw_sprites(machine, bitmap, cliprect, 0);
424
425   if (!input_code_pressed(KEYCODE_A))
426      tilemap_draw(bitmap, cliprect, text_layer, 0, 0);
427
438428   return 0;
439429}
440430
441431
432
433
434/*************************************
435 *
436 *  Interrupts
437 *
438 *************************************/
439
440static INTERRUPT_GEN( raiden2_interrupt )
441{
442   mainram[0x740/2] = readinputport(2) | (readinputport(3) << 8);
443   mainram[0x742/2] = 0xffff;
444   mainram[0x744/2] = readinputport(0) | (readinputport(1) << 8);
445   mainram[0x746/2] = 0xffff;
446   mainram[0x748/2] = 0xffff;
447   mainram[0x74a/2] = 0xffff;
448   mainram[0x74c/2] = readinputport(4) | 0xff00;
449   mainram[0x74e/2] = 0xffff;
450
451   cpunum_set_input_line_and_vector(cpu_getactivecpu(), 0, HOLD_LINE, 0xc0/4);   /* VBL */
452   logerror("VSYNC\n");
453}
454
455
456
442457//  COPX functions, terribly incomplete
443458
444459typedef struct _cop_state cop_state;
445460struct _cop_state
446461{
447462   UINT16      offset;                  /* last write offset */
448   UINT8      latch;                  /* latched LSB */
449463   UINT16      ram[0x200/2];            /* RAM from 0x400-0x5ff */
450464
451465   UINT32      reg[4];                  /* registers */
r869r870
475489
476490INLINE UINT32 r32(offs_t address)
477491{
478   return    (program_read_byte(address + 0) << 0) |
479         (program_read_byte(address + 1) << 8) |
480         (program_read_byte(address + 2) << 16) |
481         (program_read_byte(address + 3) << 24);
492   return    (program_read_word(address + 0) << 0) |
493         (program_read_word(address + 2) << 16);
482494}
483495
484496INLINE void w32(offs_t address, UINT32 data)
485497{
486   program_write_byte(address + 0, data >> 0);
487   program_write_byte(address + 1, data >> 8);
488   program_write_byte(address + 2, data >> 16);
489   program_write_byte(address + 3, data >> 24);
498   program_write_word(address + 0, data >> 0);
499   program_write_word(address + 2, data >> 16);
490500}
491501
492502
493503static void cop_init(void)
494504{
495505   memset(&cop_data, 0, sizeof(cop_data));
496   cop_data.offset = 0xffff;
497506}
498507
499508
500static WRITE8_HANDLER( cop_w )
509static WRITE16_HANDLER( cop_w )
501510{
502511   cop_state *cop = &cop_data;
503512   UINT32 temp32;
504   UINT16 cop_data;
505513   UINT8 regnum;
506514   int func;
507515
508516   /* all COP data writes are word-length (?) */
509   if ((offset & 1) == 0)
510   {
511      assert(cop->offset == 0xffff);
512      cop->latch = data;
513      cop->offset = offset;
514      return;
515   }
516   else
517   {
518      assert(cop->offset != 0xffff);
519      assert(offset == cop->offset + 1);
520      cop_data = cop->latch | (data << 8);
521      cop->offset = 0xffff;
522      offset &= 0xfffe;
523   }
524   cop->ram[offset/2] = cop_data;
517   data = COMBINE_DATA(&cop->ram[offset]);
525518
526519   /* handle writes */
527520   switch (offset + 0x400)
r869r870
541534      /* ----- program upload registers ----- */
542535
543536      case 0x432:      /* COP program data */
544         COP_LOG(("%05X:COP Prog Data = %04X\n", activecpu_get_pc(), cop_data));
545         cop->program[cop_ram_r(cop, 0x434)] = cop_data;
537         COP_LOG(("%05X:COP Prog Data = %04X\n", activecpu_get_pc(), data));
538         cop->program[cop_ram_r(cop, 0x434)] = data;
546539         break;
547540
548541      case 0x434:      /* COP program address */
549         COP_LOG(("%05X:COP Prog Addr = %04X\n", activecpu_get_pc(), cop_data));
550         assert((cop_data & ~0xff) == 0);
551         temp32 = (cop_data & 0xff) / 8;
542         COP_LOG(("%05X:COP Prog Addr = %04X\n", activecpu_get_pc(), data));
543         assert((data & ~0xff) == 0);
544         temp32 = (data & 0xff) / 8;
552545         cop->func_value[temp32] = cop_ram_r(cop, 0x438);
553546         cop->func_mask[temp32] = cop_ram_r(cop, 0x43a);
554547         cop->func_trigger[temp32] = cop_ram_r(cop, 0x43c);
555548         break;
556549
557550      case 0x438:      /* COP program entry value (0,4,5,6,7,8,9,F) */
558         COP_LOG(("%05X:COP Prog Val  = %04X\n", activecpu_get_pc(), cop_data));
551         COP_LOG(("%05X:COP Prog Val  = %04X\n", activecpu_get_pc(), data));
559552         break;
560553
561554      case 0x43a:      /* COP program entry mask */
562         COP_LOG(("%05X:COP Prog Mask = %04X\n", activecpu_get_pc(), cop_data));
555         COP_LOG(("%05X:COP Prog Mask = %04X\n", activecpu_get_pc(), data));
563556         break;
564557
565558      case 0x43c:      /* COP program trigger value */
566         COP_LOG(("%05X:COP Prog Trig = %04X\n", activecpu_get_pc(), cop_data));
559         COP_LOG(("%05X:COP Prog Trig = %04X\n", activecpu_get_pc(), data));
567560         break;
568561
569562      /* ----- ???? ----- */
r869r870
579572         }
580573         else
581574         {
582            COP_LOG(("%05X:COP Unknown RAM clear(%04X) = %04X\n", activecpu_get_pc(), cop_ram_r(cop, 0x47e), cop_data));
575            COP_LOG(("%05X:COP Unknown RAM clear(%04X) = %04X\n", activecpu_get_pc(), cop_ram_r(cop, 0x47e), data));
583576         }
584577         break;
585578
r869r870
590583      case 0x4a4:      /* COP register high word */
591584      case 0x4a6:      /* COP register high word */
592585         regnum = (offset / 2) % 4;
593         COP_LOG(("%05X:COP RegHi(%d) = %04X\n", activecpu_get_pc(), regnum, cop_data));
594         cop->reg[regnum] = (cop->reg[regnum] & 0x0000ffff) | (cop_data << 16);
586         COP_LOG(("%05X:COP RegHi(%d) = %04X\n", activecpu_get_pc(), regnum, data));
587         cop->reg[regnum] = (cop->reg[regnum] & 0x0000ffff) | (data << 16);
595588         break;
596589
597590      case 0x4c0:      /* COP register low word */
r869r870
599592      case 0x4c4:      /* COP register low word */
600593      case 0x4c6:      /* COP register low word */
601594         regnum = (offset / 2) % 4;
602         COP_LOG(("%05X:COP RegLo(%d) = %04X\n", activecpu_get_pc(), regnum, cop_data));
603         cop->reg[regnum] = (cop->reg[regnum] & 0xffff0000) | cop_data;
595         COP_LOG(("%05X:COP RegLo(%d) = %04X\n", activecpu_get_pc(), regnum, data));
596         cop->reg[regnum] = (cop->reg[regnum] & 0xffff0000) | data;
604597         break;
605598
606599      /* ----- program trigger register ----- */
607600
608601      case 0x500:      /* COP trigger */
609         COP_LOG(("%05X:COP Trigger = %04X\n", activecpu_get_pc(), cop_data));
602         COP_LOG(("%05X:COP Trigger = %04X\n", activecpu_get_pc(), data));
610603         for (func = 0; func < ARRAY_LENGTH(cop->func_trigger); func++)
611            if (cop->func_trigger[func] == cop_data)
604            if (cop->func_trigger[func] == data)
612605            {
613606               int offs;
614607
r869r870
622615               COP_LOG(("\n"));
623616
624617               /* special cases for now */
625               if (cop_data == 0x5205 || cop_data == 0x5a05)
618               if (data == 0x5205 || data == 0x5a05)
626619               {
627620                  COP_LOG(("  Copy 32 bits from %05X to %05X\n", cop->reg[0], cop->reg[1]));
628621                  w32(cop->reg[1], r32(cop->reg[0]));
629622               }
630               else if (cop_data == 0xf205)
623               else if (data == 0xf205)
631624               {
632625                  COP_LOG(("  Copy 32 bits from %05X to %05X\n", cop->reg[0] + 4, cop->reg[1]));
633626                  w32(cop->reg[2], r32(cop->reg[0] + 4));
r869r870
640633      /* ----- other stuff ----- */
641634
642635      default:      /* unknown */
643         COP_LOG(("%05X:COP Unknown(%04X) = %04X\n", activecpu_get_pc(), offset + 0x400, cop_data));
636         COP_LOG(("%05X:COP Unknown(%04X) = %04X\n", activecpu_get_pc(), offset + 0x400, data));
644637         break;
645638   }
646639}
647640
648641
649static READ8_HANDLER( cop_r )
642static READ16_HANDLER( cop_r )
650643{
651644   cop_state *cop = &cop_data;
652   if ((offset & 1) == 0)
653      COP_LOG(("%05X:COP Read(%04X) = %04X\n", activecpu_get_pc(), offset + 0x400, cop->ram[offset/2]));
654   return cop->ram[offset/2] >> (8 * (offset & 1));
645   COP_LOG(("%05X:COP Read(%04X) = %04X\n", activecpu_get_pc(), offset*2 + 0x400, cop->ram[offset]));
646   return cop->ram[offset];
655647}
656648
657649
r869r870
675667}
676668
677669
678static WRITE8_HANDLER(sprcpt_adr_w)
670static WRITE16_HANDLER(sprcpt_adr_w)
679671{
680   combine32(&sprcpt_adr, offset, data);
672   combine32(&sprcpt_adr, offset, data, mem_mask);
681673}
682674
683static WRITE8_HANDLER(sprcpt_data_1_w)
675static WRITE16_HANDLER(sprcpt_data_1_w)
684676{
685   combine32(sprcpt_data_1+sprcpt_adr, offset, data);
677   combine32(sprcpt_data_1+sprcpt_adr, offset, data, mem_mask);
686678}
687679
688static WRITE8_HANDLER(sprcpt_data_2_w)
680static WRITE16_HANDLER(sprcpt_data_2_w)
689681{
690   combine32(sprcpt_data_2+sprcpt_adr, offset, data);
682   combine32(sprcpt_data_2+sprcpt_adr, offset, data, mem_mask);
691683}
692684
693static WRITE8_HANDLER(sprcpt_data_3_w)
685static WRITE16_HANDLER(sprcpt_data_3_w)
694686{
695   combine32(sprcpt_data_3+sprcpt_idx, offset, data);
696   if(offset == 3) {
687   combine32(sprcpt_data_3+sprcpt_idx, offset, data, mem_mask);
688   if(offset == 1) {
697689      sprcpt_idx ++;
698690      if(sprcpt_idx == 6)
699691         sprcpt_idx = 0;
700692   }
701693}
702694
703static WRITE8_HANDLER(sprcpt_data_4_w)
695static WRITE16_HANDLER(sprcpt_data_4_w)
704696{
705   combine32(sprcpt_data_4+sprcpt_idx, offset, data);
706   if(offset == 3) {
697   combine32(sprcpt_data_4+sprcpt_idx, offset, data, mem_mask);
698   if(offset == 1) {
707699      sprcpt_idx ++;
708700      if(sprcpt_idx == 4)
709701         sprcpt_idx = 0;
710702   }
711703}
712704
713static WRITE8_HANDLER(sprcpt_val_1_w)
705static WRITE16_HANDLER(sprcpt_val_1_w)
714706{
715   combine32(sprcpt_val+0, offset, data);
707   combine32(sprcpt_val+0, offset, data, mem_mask);
716708}
717709
718static WRITE8_HANDLER(sprcpt_val_2_w)
710static WRITE16_HANDLER(sprcpt_val_2_w)
719711{
720   combine32(sprcpt_val+1, offset, data);
712   combine32(sprcpt_val+1, offset, data, mem_mask);
721713}
722714
723static WRITE8_HANDLER(sprcpt_flags_1_w)
715static WRITE16_HANDLER(sprcpt_flags_1_w)
724716{
725   combine32(&sprcpt_flags1, offset, data);
726   if(offset == 3) {
717   combine32(&sprcpt_flags1, offset, data, mem_mask);
718   if(offset == 1) {
727719      // bit 31: 1 = allow write on sprcpt data
728720
729721      if(!(sprcpt_flags1 & 0x80000000U)) {
r869r870
749741   }
750742}
751743
752static WRITE8_HANDLER(sprcpt_flags_2_w)
744static WRITE16_HANDLER(sprcpt_flags_2_w)
753745{
754   combine16(&sprcpt_flags2, offset, data);
755   if(offset == 1) {
746   COMBINE_DATA(&sprcpt_flags2);
747   if(offset == 0) {
756748      if(sprcpt_flags2 & 0x8000) {
757749         // Reset decryption -> redo it
758750      }
r869r870
764756// XXX
765757// write only: 4c0 4c1 500 501 502 503
766758
767static UINT8 handle_io_r(int offset)
759static UINT16 handle_io_r(int offset)
768760{
769   logerror("io_r %04x, %02x (%x)\n", offset, mainram[offset], activecpu_get_pc());
761   logerror("io_r %04x, %04x (%x)\n", offset*2, mainram[offset], activecpu_get_pc());
770762   return mainram[offset];
771763}
772764
773static void handle_io_w(int offset, UINT8 data)
765static void handle_io_w(int offset, UINT16 data, UINT16 mem_mask)
774766{
775   mainram[offset] = data;
767   COMBINE_DATA(&mainram[offset]);
776768   switch(offset) {
777769   default:
778      logerror("io_w %04x, %02x (%x)\n", offset, data, activecpu_get_pc());
770      logerror("io_w %04x, %04x & %04x (%x)\n", offset*2, data, mem_mask ^ 0xffff, activecpu_get_pc());
779771   }
780772}
781773
782static READ8_HANDLER(any_r)
774static READ16_HANDLER(any_r)
783775{
784776   c_r[offset]++;
785777
786   if(offset >= 0x400 && offset < 0x800)
778   if(offset >= 0x400/2 && offset < 0x800/2)
787779      return handle_io_r(offset);
788780
789781   return mainram[offset];
790782}
791783
792static WRITE8_HANDLER(any_w)
784static WRITE16_HANDLER(any_w)
793785{
794786   int show = 0;
795   if(offset >= 0x400 && offset < 0x800)
796      handle_io_w(offset, data);
787   if(offset >= 0x400/2 && offset < 0x800/2)
788      handle_io_w(offset, data, mem_mask);
797789
798790   c_w[offset]++;
799791   //  logerror("mainram_w %04x, %02x (%x)\n", offset, data, activecpu_get_pc());
800792   if(mainram[offset] != data && offset >= 0x400 && offset < 0x800) {
801793      if(0 &&
802         offset != 0x4c0 && offset != 0x4c1 && offset != 0x500 && offset != 0x501 &&
803         offset != 0x444 && offset != 0x6de && offset != 0x6df && offset != 0x47e &&
804         offset != 0x4a0 && offset != 0x6df && offset != 0x620 && offset != 0x6c6 &&
805         offset != 0x6c7 && offset != 0x628 && offset != 0x62a && offset != 0x47f)
806         logerror("mainram_w %04x, %02x (%x)\n", offset, data, activecpu_get_pc());
794         offset != 0x4c0/2 && offset != 0x500/2 &&
795         offset != 0x444/2 && offset != 0x6de/2 && offset != 0x47e/2 &&
796         offset != 0x4a0/2 && offset != 0x620/2 && offset != 0x6c6/2 &&
797         offset != 0x628/2 && offset != 0x62a/2)
798         logerror("mainram_w %04x, %04x & %04x (%x)\n", offset*2, data, mem_mask ^ 0xffff, activecpu_get_pc());
807799   }
808800
809801   if(0 && c_w[offset]>1000 && !c_r[offset]) {
810      if(offset != 0x4c0 && offset != 0x4c1 && (offset<0x500 || offset > 0x503))
811         logerror("mainram_w %04x, %02x [%d.%d] (%x)\n", offset, data, c_w[offset], c_r[offset], activecpu_get_pc());
802      if(offset != 0x4c0/2 && (offset<0x500/2 || offset > 0x503/2))
803         logerror("mainram_w %04x, %04x & %04x [%d.%d] (%x)\n", offset*2, data, mem_mask ^ 0xffff, c_w[offset], c_r[offset], activecpu_get_pc());
812804   }
813805
814806   //  if(offset == 0x471 || (offset >= 0xb146 && offset < 0xb156))
r869r870
819811   //  show = offset == 0x704 || offset == 0x710 || offset == 0x71c;
820812
821813   if(show)
822      logerror("mainram_w %04x, %02x (%x)\n", offset, data, activecpu_get_pc());
814      logerror("mainram_w %04x, %04x & %04x (%x)\n", offset*2, data, mem_mask ^ 0xffff, activecpu_get_pc());
823815
824816   //  if(offset == 0x700)
825817   //      cpu_setbank(2, memory_region(REGION_USER1)+0x20000*data);
826818
827   mainram[offset] = data;
819   COMBINE_DATA(&mainram[offset]);
828820}
829#if 0
830static READ8_HANDLER(rb_r)
831{
832   static int bank = 0;
833   int pc = activecpu_get_pc();
834   int show = 0;
835   switch(pc) {
836   }
837   if(show)
838      logerror("rb_r %05x, pc=%05x\n", offset, activecpu_get_pc());
839821
840   return memory_region(REGION_USER1)[offset+0x20000*bank];
841}
842#endif
843
844static WRITE8_HANDLER(w1x)
822static WRITE16_HANDLER(w1x)
845823{
846   w1ram[offset] = data;
847   if(0 && offset < 0x800)
848      logerror("w1x %05x, %02x (%05x)\n", offset+0x10000, data, activecpu_get_pc());
824   COMBINE_DATA(&w1ram[offset]);
825   if(0 && offset < 0x800/2)
826      logerror("w1x %05x, %04x & %04x (%05x)\n", offset*2+0x10000, data, mem_mask ^ 0xffff, activecpu_get_pc());
849827}
850828
851829static void r2_dt(UINT16 sc, UINT16 cc, UINT16 ent, UINT16 tm, UINT16 x, UINT16 y)
852830{
853   int bank = mainram[0x704];
831   int bank = mainram[0x704/2];
854832
855833#if 0
856834   switch(ent) {
r869r870
916894
917895/* MEMORY MAPS */
918896
919static ADDRESS_MAP_START( raiden2_mem, ADDRESS_SPACE_PROGRAM, 8 )
897static ADDRESS_MAP_START( raiden2_mem, ADDRESS_SPACE_PROGRAM, 16 )
920898   AM_RANGE(0x00400, 0x005ff) AM_READWRITE(cop_r, cop_w)
921899
922900   AM_RANGE(0x006a0, 0x006a3) AM_WRITE(sprcpt_val_1_w)
r869r870
932910   AM_RANGE(0x00000, 0x0bfff) AM_READWRITE(any_r, any_w) AM_BASE(&mainram)
933911//  AM_RANGE(0x00000, 0x003ff) AM_RAM
934912
935   AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
936   AM_RANGE(0x0d000, 0x0d7ff) AM_READWRITE(MRA8_RAM, raiden2_background_w) AM_BASE(&back_data)
937   AM_RANGE(0x0d800, 0x0dfff) AM_READWRITE(MRA8_RAM, raiden2_foreground_w) AM_BASE(&fore_data)
938    AM_RANGE(0x0e000, 0x0e7ff) AM_READWRITE(MRA8_RAM, raiden2_midground_w)  AM_BASE(&mid_data)
939    AM_RANGE(0x0e800, 0x0f7ff) AM_READWRITE(MRA8_RAM, raiden2_text_w) AM_BASE(&videoram)
913   AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
914   AM_RANGE(0x0d000, 0x0d7ff) AM_READWRITE(MRA16_RAM, raiden2_background_w) AM_BASE(&back_data)
915   AM_RANGE(0x0d800, 0x0dfff) AM_READWRITE(MRA16_RAM, raiden2_foreground_w) AM_BASE(&fore_data)
916    AM_RANGE(0x0e000, 0x0e7ff) AM_READWRITE(MRA16_RAM, raiden2_midground_w)  AM_BASE(&mid_data)
917    AM_RANGE(0x0e800, 0x0f7ff) AM_READWRITE(MRA16_RAM, raiden2_text_w) AM_BASE(&videoram16)
940918   AM_RANGE(0x0f800, 0x0ffff) AM_RAM /* Stack area */
941919
942   AM_RANGE(0x10000, 0x1efff) AM_READWRITE(MRA8_RAM, w1x) AM_BASE(&w1ram)
943   AM_RANGE(0x1f000, 0x1ffff) AM_READWRITE(MRA8_RAM, paletteram_xBBBBBGGGGGRRRRR_le_w) AM_BASE(&paletteram)
920   AM_RANGE(0x10000, 0x1efff) AM_READWRITE(MRA16_RAM, w1x) AM_BASE(&w1ram)
921   AM_RANGE(0x1f000, 0x1ffff) AM_READWRITE(MRA16_RAM, paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
944922
945//  AM_RANGE(0x20000, 0x3ffff) AM_READ(rb_r)
946923   AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK(1)
947924   AM_RANGE(0x40000, 0xfffff) AM_ROMBANK(2)
948925ADDRESS_MAP_END
r869r870
11581135INPUT_PORTS_END
11591136
11601137
1161/* GFX DECODING */
11621138
1139
1140/*************************************
1141 *
1142 *  Graphics layouts
1143 *
1144 *************************************/
1145
11631146static const gfx_layout raiden2_charlayout =
11641147{
11651148   8,8,
r869r870
11671150   4,
11681151   { 8,12,0,4 },
11691152   { 3,2,1,0,19,18,17,16 },
1170   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
1153   { STEP8(0,32) },
11711154   32*8
11721155};
11731156
r869r870
11841167      3+64*8, 2+64*8, 1+64*8, 0+64*8,
11851168      19+64*8,18+64*8,17+64*8,16+64*8,
11861169   },
1187   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
1188         8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
1170   { STEP16(0,32) },
11891171   128*8
11901172};
11911173
r869r870
11941176   16, 16,
11951177   0x10000,
11961178   4,
1197   { 0, 1, 2, 3 },
1179   { STEP4(0,1) },
11981180   { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 },
1199   { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 },
1181   { STEP16(0,64) },
12001182   16*16*4
12011183};
12021184
r869r870
12081190   { -1 }
12091191};
12101192
1211/* INTERRUPTS */
12121193
1213static INTERRUPT_GEN( raiden2_interrupt )
1214{
1215   mainram[0x740] = readinputport(2);
1216   mainram[0x741] = readinputport(3);
1217   mainram[0x742] = 0xff;
1218   mainram[0x743] = 0xff;
1219   mainram[0x744] = readinputport(0);
1220   mainram[0x745] = readinputport(1);
1221   mainram[0x746] = 0xff;
1222   mainram[0x747] = 0xff;
1223   mainram[0x748] = 0xff;
1224   mainram[0x749] = 0xff;
1225   mainram[0x74a] = 0xff;
1226   mainram[0x74b] = 0xff;
1227   mainram[0x74c] = readinputport(4);
1228   mainram[0x74d] = 0xff; // Actually read but seems ignored
1229   mainram[0x74e] = 0xff;
1230   mainram[0x74f] = 0xff;
1231
1232   cpunum_set_input_line_and_vector(cpu_getactivecpu(), 0, HOLD_LINE, 0xc0/4);   /* VBL */
1233   logerror("VSYNC\n");
1234}
1235
12361194/* MACHINE DRIVERS */
12371195
12381196static MACHINE_DRIVER_START( raiden2 )
r869r870
12431201   MDRV_CPU_VBLANK_INT(raiden2_interrupt,1)
12441202
12451203   MDRV_SCREEN_REFRESH_RATE(60)
1246   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_60HZ_VBLANK_DURATION/2))
1204   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION/2)
12471205
12481206   MDRV_MACHINE_RESET(raiden2)
12491207
src/mame/drivers/scramble.c
r869r870
23962396   MDRV_CPU_IO_MAP(hunchbks_readport,0)
23972397   MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1)
23982398
2399   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2500))
2399   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2500))
24002400
24012401   /* video hardware */
24022402   MDRV_PALETTE_LENGTH(32+64+2+0)   /* 32 for characters, 64 for stars, 2 for bullets */
src/mame/drivers/dacholer.c
r869r870
131131   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
132132   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
133133
134   PORT_START
135   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
134   PORT_START_TAG("DSWA")
135   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )           /* table at 0x0a8c */
136136   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
137137   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
138138   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
139139   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
140   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
140   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )           /* table at 0x0a94 */
141141   PORT_DIPSETTING(    0x00, DEF_STR( 6C_1C ) )
142142   PORT_DIPSETTING(    0x04, DEF_STR( 5C_1C ) )
143143   PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
144144   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
145   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) // to let play the sounds
145   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL )            // to let play the sounds
146146   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
147147   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
148148   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
149149
150   PORT_START
151   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
150   PORT_START_TAG("DSWB")
151   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )            /* table at 0x0a9c */
152152   PORT_DIPSETTING(    0x03, "1" )
153153   PORT_DIPSETTING(    0x02, "2" )
154154   PORT_DIPSETTING(    0x01, "3" )
155155   PORT_DIPSETTING(    0x00, "4" )
156   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
157   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
158   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
159   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
160   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
161   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
162   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
163   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
164   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
165   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
166   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
167   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
168   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
156//  PORT_DIPNAME( 0x0c, 0x0c, "1st Bonus Life" )            /* table at 0x0aa0 */
157//  PORT_DIPSETTING(    0x0c, "20k" )
158//  PORT_DIPSETTING(    0x08, "30k" )
159//  PORT_DIPSETTING(    0x04, "40k" )
160//  PORT_DIPSETTING(    0x00, DEF_STR( None ) )
161//  PORT_DIPNAME( 0x30, 0x30, "Next Bonus Lifes" )          /* table at 0x0aa8 */
162//  PORT_DIPSETTING(    0x30, "+50k" )
163//  PORT_DIPSETTING(    0x20, "+70k" )
164//  PORT_DIPSETTING(    0x10, "+100k" )
165//  PORT_DIPSETTING(    0x00, DEF_STR( None ) )
166   PORT_DIPNAME( 0x3c, 0x3c, DEF_STR( Bonus_Life ) )
167   PORT_DIPSETTING(    0x3c, "20k 70k then every 50k" )
168   PORT_DIPSETTING(    0x38, "30k 80k then every 50k" )
169   PORT_DIPSETTING(    0x34, "40k 90k then every 50k" )
170//  PORT_DIPSETTING(    0x30, DEF_STR( None ) )
171   PORT_DIPSETTING(    0x2c, "20k 90k then every 70k" )
172   PORT_DIPSETTING(    0x28, "30k 100k then every 70k" )
173   PORT_DIPSETTING(    0x24, "40k 110k then every 70k" )
174//  PORT_DIPSETTING(    0x20, DEF_STR( None ) )
175   PORT_DIPSETTING(    0x1c, "20k 120k then every 100k" )
176   PORT_DIPSETTING(    0x18, "30k 130k then every 100k" )
177   PORT_DIPSETTING(    0x14, "40k 140k then every 100k" )
178//  PORT_DIPSETTING(    0x10, DEF_STR( None ) )
179   PORT_DIPSETTING(    0x0c, "20k only" )
180   PORT_DIPSETTING(    0x08, "30k only" )
181   PORT_DIPSETTING(    0x04, "40k only" )
182   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
183   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
169184   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
170185   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
171186   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
r869r870
173188   PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
174189INPUT_PORTS_END
175190
191INPUT_PORTS_START( kickboy )
192   PORT_INCLUDE(dacholer)
193
194   PORT_MODIFY("DSWA")
195   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )           /* table at 0x0f71 - same as in 'dacholer' */
196   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
197   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
198   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
199   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
200   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )           /* table at 0x0f79 */
201   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
202   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
203   PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
204   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
205
206   PORT_MODIFY("DSWB")
207   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )            /* table at 0x0f81 */
208   PORT_DIPSETTING(    0x03, "3" )
209   PORT_DIPSETTING(    0x02, "4" )
210   PORT_DIPSETTING(    0x01, "5" )
211   PORT_DIPSETTING(    0x00, "99 (Cheat)" )
212//  PORT_DIPNAME( 0x0c, 0x0c, "1st Bonus Life" )            /* table at 0x0f85 - same as in 'dacholer' */
213//  PORT_DIPSETTING(    0x0c, "20k" )
214//  PORT_DIPSETTING(    0x08, "30k" )
215//  PORT_DIPSETTING(    0x04, "40k" )
216//  PORT_DIPSETTING(    0x00, DEF_STR( None ) )
217//  PORT_DIPNAME( 0x30, 0x30, "Next Bonus Lifes" )          /* table at 0x0f8d */
218//  PORT_DIPSETTING(    0x30, "+30k" )
219//  PORT_DIPSETTING(    0x20, "+50k" )
220//  PORT_DIPSETTING(    0x10, "+70k" )
221//  PORT_DIPSETTING(    0x00, DEF_STR( None ) )
222   PORT_DIPNAME( 0x3c, 0x3c, DEF_STR( Bonus_Life ) )
223   PORT_DIPSETTING(    0x3c, "20k 50k then every 30k" )
224   PORT_DIPSETTING(    0x38, "30k 60k then every 30k" )
225   PORT_DIPSETTING(    0x34, "40k 70k then every 30k" )
226//  PORT_DIPSETTING(    0x30, DEF_STR( None ) )
227   PORT_DIPSETTING(    0x2c, "20k 70k then every 50k" )
228   PORT_DIPSETTING(    0x28, "30k 80k then every 50k" )
229   PORT_DIPSETTING(    0x24, "40k 90k then every 50k" )
230//  PORT_DIPSETTING(    0x20, DEF_STR( None ) )
231   PORT_DIPSETTING(    0x1c, "20k 90k then every 70k" )
232   PORT_DIPSETTING(    0x18, "30k 100k then every 70k" )
233   PORT_DIPSETTING(    0x14, "40k 110k then every 70k" )
234//  PORT_DIPSETTING(    0x10, DEF_STR( None ) )
235   PORT_DIPSETTING(    0x0c, "20k only" )
236   PORT_DIPSETTING(    0x08, "30k only" )
237   PORT_DIPSETTING(    0x04, "40k only" )
238   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
239   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )       /* stored at 0x920f */
240   PORT_DIPSETTING(    0x40, DEF_STR( Easy ) )
241   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
242INPUT_PORTS_END
243
244
176245static TILE_GET_INFO( get_bg_tile_info )
177246{
178247   SET_TILE_INFO(1,bgvideoram[tile_index] + bg_bank * 0x100,0,0);
r869r870
352421ROM_END
353422
354423GAME( 1983, dacholer, 0, dacholer, dacholer, 0, ROT0, "Nichibutsu", "Dacholer", GAME_WRONG_COLORS | GAME_NO_SOUND )
355GAME( 1983, kickboy,  0, dacholer, dacholer, 0, ROT0, "Nichibutsu", "Kick Boy", GAME_WRONG_COLORS | GAME_NO_SOUND )
424GAME( 1983, kickboy,  0, dacholer, kickboy, 0, ROT0, "Nichibutsu", "Kick Boy", GAME_WRONG_COLORS | GAME_NO_SOUND )
src/mame/drivers/namcos21.c
r869r870
608608   }
609609} /* dsp_portc_w */
610610
611
611612/***********************************************************/
612613
613614static UINT16 mCusKeyState;
r869r870
15021503   ROM_LOAD( "sys2mcpu.bin",  0x000000, 0x002000, CRC(a342a97e) SHA1(2c420d34dba21e409bf78ddca710fc7de65a6642) )
15031504   ROM_LOAD( "sys2c65c.bin",  0x008000, 0x008000, CRC(a5b2a4ff) SHA1(068bdfcc71a5e83706e8b23330691973c1c214dc) )
15041505
1506   ROM_REGION( 0x12000, REGION_CPU5, ROMREGION_ERASE00 )
1507   ROM_REGION( 0x12000, REGION_CPU6, ROMREGION_ERASE00 )
15051508
15061509   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
15071510   ROM_LOAD( "ac2-obj0.5s",  0x000000, 0x80000, CRC(8327ff22) SHA1(16f6022dedb7a74590898bc8ed3e8a97993c4635) )
r869r870
15541557   ROM_LOAD( "sys2mcpu.bin",  0x000000, 0x002000, CRC(a342a97e) SHA1(2c420d34dba21e409bf78ddca710fc7de65a6642) )
15551558   ROM_LOAD( "sys2c65c.bin",  0x008000, 0x008000, CRC(a5b2a4ff) SHA1(068bdfcc71a5e83706e8b23330691973c1c214dc) )
15561559
1560   ROM_REGION( 0x12000, REGION_CPU5, ROMREGION_ERASE00 )
1561   ROM_REGION( 0x12000, REGION_CPU6, ROMREGION_ERASE00 )
1562
15571563   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
15581564   ROM_LOAD( "ac1-obj0.5s",  0x000000, 0x80000, CRC(d2310c6a) SHA1(9bb8fdfc2c232574777248f4959975f9a20e3105) )
15591565   ROM_LOAD( "ac1-obj4.4s",  0x080000, 0x80000, CRC(0c93b478) SHA1(a92ffbcf04b64e0eee5bcf37008e247700641b25) )
r869r870
16051611   ROM_LOAD( "sys2mcpu.bin",  0x000000, 0x002000, CRC(a342a97e) SHA1(2c420d34dba21e409bf78ddca710fc7de65a6642) )
16061612   ROM_LOAD( "sys2c65c.bin",  0x008000, 0x008000, CRC(a5b2a4ff) SHA1(068bdfcc71a5e83706e8b23330691973c1c214dc) )
16071613
1614   ROM_REGION( 0x12000, REGION_CPU5, ROMREGION_ERASE00 )
1615   ROM_REGION( 0x12000, REGION_CPU6, ROMREGION_ERASE00 )
1616
16081617   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
16091618   ROM_LOAD( "cy1-obj0.5s",  0x000000, 0x80000, CRC(5ae542d5) SHA1(99b1a3ed476da4a97cb864538909d7b831f0fd3b) )
16101619   ROM_LOAD( "cy1-obj4.4s",  0x080000, 0x80000, CRC(57904076) SHA1(b1dc0d99543bc4b9584b37ffc12c6ebc59e30e3b) )
r869r870
16631672   ROM_LOAD( "sys2mcpu.bin",  0x000000, 0x002000, CRC(a342a97e) SHA1(2c420d34dba21e409bf78ddca710fc7de65a6642) )
16641673   ROM_LOAD( "sys2c65c.bin",  0x008000, 0x008000, CRC(a5b2a4ff) SHA1(068bdfcc71a5e83706e8b23330691973c1c214dc) )
16651674
1675   ROM_REGION( 0x12000, REGION_CPU5, ROMREGION_ERASE00 )
1676   ROM_REGION( 0x12000, REGION_CPU6, ROMREGION_ERASE00 )
1677
16661678   ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE ) /* sprites */
16671679   ROM_LOAD( "de1_obj0.5s",  0x000000, 0x40000, CRC(7438bd53) SHA1(7619c4b56d5c466e845eb45e6157dcaf2a03ad94) )
16681680   ROM_LOAD( "de1_obj1.5x",  0x040000, 0x40000, CRC(45f2334e) SHA1(95f277a4e43d6662ae44d6b69a57f65c72978319) )
r869r870
17101722   ROM_LOAD( "sys2mcpu.bin",  0x000000, 0x002000, CRC(a342a97e) SHA1(2c420d34dba21e409bf78ddca710fc7de65a6642) )
17111723   ROM_LOAD( "sys2c65c.bin",  0x008000, 0x008000, CRC(a5b2a4ff) SHA1(068bdfcc71a5e83706e8b23330691973c1c214dc) )
17121724
1725   ROM_REGION( 0x12000, REGION_CPU5, ROMREGION_ERASE00 )
1726   ROM_REGION( 0x12000, REGION_CPU6, ROMREGION_ERASE00 )
1727
17131728   ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE ) /* sprites */
17141729   ROM_LOAD( "st1obj0.bin",  0x000000, 0x80000, CRC(5d42c71e) SHA1(f1aa2bb31bbbcdcac8e94334b1c78238cac1a0e7) )
17151730   ROM_LOAD( "st1obj1.bin",  0x080000, 0x80000, CRC(c98011ad) SHA1(bc34c21428e0ef5887051c0eb0fdef5397823a82) )
r869r870
17541769   ROM_LOAD( "sys2mcpu.bin",  0x000000, 0x002000, CRC(a342a97e) SHA1(2c420d34dba21e409bf78ddca710fc7de65a6642) )
17551770   ROM_LOAD( "sys2c65c.bin",  0x008000, 0x008000, CRC(a5b2a4ff) SHA1(068bdfcc71a5e83706e8b23330691973c1c214dc) )
17561771
1772   ROM_REGION( 0x12000, REGION_CPU5, ROMREGION_ERASE00 )
1773   ROM_REGION( 0x12000, REGION_CPU6, ROMREGION_ERASE00 )
1774
17571775   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
17581776   ROM_LOAD( "sv1obj0.bin",  0x000000, 0x80000, CRC(773798bb) SHA1(51ab76c95030bab834f1a74ae677b2f0afc18c52) )
17591777   ROM_LOAD( "sv1obj4.bin",  0x080000, 0x80000, CRC(33a008a7) SHA1(4959a0ac24ad64f1367e2d8d63d39a0273c60f3e) )
src/mame/drivers/pgm.c
r869r870
671671   AM_RANGE(0xd10000, 0xd10001) AM_READWRITE(arm7_latch_68k_r, arm7_latch_68k_w) /* ARM7 Latch */
672672ADDRESS_MAP_END
673673
674#if 0
674675static ADDRESS_MAP_START( cavepgm_mem, ADDRESS_SPACE_PROGRAM, 16)
675676   AM_RANGE(0x000000, 0x07ffff) AM_ROM   /* larger BIOS ROM */
676677   AM_RANGE(0xfffffe, 0xffffff) AM_ROMBANK(1) /* Game ROM (unmapped for now, might not even have it) */
r869r870
700701
701702   AM_RANGE(0xc10000, 0xc1ffff) AM_READWRITE(z80_ram_r, z80_ram_w) /* Z80 Program */
702703ADDRESS_MAP_END
704#endif
703705
704706static ADDRESS_MAP_START( z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
705707   AM_RANGE(0x0000, 0xffff) AM_RAM AM_BASE(&z80_mainram)
r869r870
16261628   MDRV_CPU_PROGRAM_MAP(kovsh_arm7_map, 0)
16271629MACHINE_DRIVER_END
16281630
1631#if 0
16291632static MACHINE_DRIVER_START( cavepgm )
16301633   MDRV_IMPORT_FROM(pgm)
16311634
r869r870
16361639//  MDRV_CPU_ADD_TAG("prot", ARM7, 20000000)    // ???
16371640//  MDRV_CPU_PROGRAM_MAP(arm7_map, 0)
16381641MACHINE_DRIVER_END
1642#endif
16391643
16401644
16411645/*** Init Stuff **************************************************************/
src/mame/drivers/smstrv.c
r869r870
223223
224224
225225static MACHINE_DRIVER_START( smstrv )
226   MDRV_CPU_ADD(I88,24000000/2)
226   MDRV_CPU_ADD(I8088,24000000/2)
227227   MDRV_CPU_PROGRAM_MAP(smstrv_map,0)
228228//  MDRV_CPU_IO_MAP(io_map,0)
229229   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
src/mame/drivers/funkyjet.c
r869r870
376376   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
377377
378378   MDRV_SCREEN_REFRESH_RATE(58)
379   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
379   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
380380
381381   /* video hardware */
382382   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/ironhors.c
r869r870
408408   MDRV_CPU_IO_MAP(slave_io_map, 0)
409409
410410   MDRV_SCREEN_REFRESH_RATE(30)
411   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_30HZ_VBLANK_DURATION))
411   MDRV_SCREEN_VBLANK_TIME(DEFAULT_30HZ_VBLANK_DURATION)
412412
413413   /* video hardware */
414414   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/konamigq.c
r869r870
377377   MDRV_CPU_PERIODIC_INT( irq2_line_hold, 480 )
378378
379379   MDRV_SCREEN_REFRESH_RATE( 60 )
380   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
380   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS( 0 ))
381381
382382   MDRV_MACHINE_START( konamigq )
383383   MDRV_MACHINE_RESET( konamigq )
src/mame/drivers/cps3.c
r869r870
333333#include "cpu/sh2/sh2.h"
334334#include "machine/intelfsh.h"
335335#include "includes/cps3.h"
336#include "machine/wd33c93.h"
336337
337338/* load extracted cd content? */
338339#define LOAD_CD_CONTENT 1
r869r870
774775
775776}
776777
777/* SCSI Code - from ElSemi */
778
779
780static UINT8 Regs[0x100];
781static UINT8 CurReg=0;
782static UINT8 FIFO[0x1000];
783static UINT32 RPtr,RSize;
784
785static UINT8 AuxStatus=0;
786static UINT8 Advanced=0;
787static UINT8 Reading=0;
788//static FILE *f;
789
790
791
792static void scsi_init(void)
793{
794   AuxStatus=0;
795   Advanced=0;
796   Reading=0;
797
798   cps3_cd = cdrom_open(get_disk_handle(0));
799}
800
801static void scsi_reg_w(UINT8 val)
802{
803   CurReg=val;
804}
805
806static void ExecuteCDB(void)
807{
808   UINT8 cmd=Regs[0x3];
809//  UINT8 size=Regs[0x0];
810   UINT32 respsize=(Regs[0x12]<<16)|(Regs[0x13]<<8)|Regs[0x14];
811
812   switch(cmd)
813   {
814      case 0x00:   //Test Unit Ready
815         Regs[0xf]=0x00;   //Success
816         //printf("SCSI: TEST_UNIT_READY\n");
817         //AuxStatus|=1;
818         break;
819      case 0x12:   //Inquiry
820         //printf("SCSI: INQUIRY\n");
821         FIFO[0]=0x5;   //CDROM
822         FIFO[1]=0x80;
823         RPtr=0;
824         RSize=respsize;
825         Regs[0xf]=0x00;   //Success
826         break;
827      case 0x25:   //Read Capacity
828         //printf("SCSI: READ_CAPACITY\n");
829         FIFO[0]=0x00;   //Capacity
830         FIFO[1]=0x05;   //640MB
831         FIFO[2]=0x00;
832         FIFO[3]=0x00;
833
834         FIFO[4]=0x00;   //Sector size 2048
835         FIFO[5]=0x00;
836         FIFO[6]=0x08;
837         FIFO[7]=0x00;
838
839         RPtr=0;
840         RSize=respsize;
841         Regs[0xf]=0x00;   //Success
842
843         break;
844      case 0x43:   //Read TOC
845         //printf("SCSI: READ_TOC\n");
846         FIFO[0]=0x00;
847         FIFO[1]=0x12;
848
849         FIFO[2]=0x01;   //1 track
850         FIFO[3]=0x01;
851
852         FIFO[4]=0x00;   //Reserved
853         FIFO[5]=0x14;   //Digital data, copy prohibited
854         FIFO[6]=0x01;   //First track
855         FIFO[7]=0x00;   //Reserved
856
857         FIFO[8]=0x00;   //Starting LBA
858         FIFO[9]=0x00;
859         FIFO[10]=0x00;
860         FIFO[11]=0x00;
861
862         RPtr=0;
863         RSize=respsize;
864         Regs[0xf]=0x00;   //Success
865         break;
866      case 0x1E:   //Lock media
867         //printf("SCSI: LOCK_MEDIA: %s\n",(Regs[0x7]&1)?"LOCK":"UNLOCK");
868         Regs[0xf]=0x00;   //Success
869         break;
870      case 0x28:   //Read (10)
871         {
872            UINT32 LBA=(Regs[0x5]<<24)|(Regs[0x6]<<16)|(Regs[0x7]<<8)|(Regs[0x8]);
873            UINT32 sectors=(Regs[0xa]<<8)|(Regs[0xb]);
874            UINT8 tmp_buffer[20480];
875            //int a=1;
876            //int i;
877            //printf("SCSI: READ(10) LBA: %x SECTORS: %x\n",LBA,sectors);
878
879            if (!cps3_cd)
880            {
881               //printf("no cd?\n");
882               return;
883            }
884            else
885            {
886               if (!cdrom_read_data(cps3_cd, LBA, tmp_buffer, CD_TRACK_MODE1))
887               {
888               //  printf("SCSICD: CD read error!\n");
889               }
890               else
891               {
892               //  printf("SCSICD: CD read OK!\n");
893               }
894
895               if (sectors!=1)
896               {
897                  printf("sectors isn't 1, error\n");
898                  return;
899               }
900
901            //  for(i=0;i<sectors;++i)
902            //  {
903            //      fseek(f,2352*(LBA+i)+16,SEEK_SET);
904            //      fread(FIFO+2048*i,1,2048,f);
905            //  }
906
907               memcpy(FIFO,tmp_buffer,2048);
908            }
909
910            RPtr=0;
911            RSize=respsize;
912            Regs[0xf]=0x00;   //Success
913         }
914         break;
915      default:
916         {
917            //printf("SCSI: UNHANDLED COMMAND %x\n",cmd);
918            //int a=1;
919         }
920         break;
921   }
922}
923
924static void Interrupt(UINT8 code)
925{
926   AuxStatus|=0x80;
927   Regs[0x17]=code;
928}
929
930static void scsi_dat_w(UINT8 val)
931{
932   Regs[CurReg]=val;
933   if(CurReg==0x18)   //Command
934   {
935      switch(val)
936      {
937         case 0x00:   //Reset
938            if(Regs[0x00]&0x08)   //Advanced features enable
939            {
940               Advanced=1;
941               Interrupt(0x01);   //Reset with advanced features
942            }
943            else
944            {
945               Advanced=0;
946               Interrupt(0x00);   //Reset without advanced features
947            }
948            break;
949         case 0x08:
950         case 0x09:   //Transfer (execute SCSI)
951            if((Regs[0x15]&0x7)==1)   //only device 1 supported
952            {
953               ExecuteCDB();
954               Regs[0x1]=0x8;   //?? I don't know why is this needed
955               //Interrupt(0x16);  //Select and tranfer OK
956               if(RPtr==RSize)   //0 bytes transfer
957                  Interrupt(0x16);   //Command completed successfully
958            }
959            else
960               Interrupt(0x42);   //Timeout
961            break;
962      }
963   }
964   if(CurReg!=0x19 && CurReg!=0x18 && CurReg!=0x1f)
965      ++CurReg;
966}
967
968static UINT8 scsi_dat_r(void)
969{
970   if(CurReg==0x17)
971      AuxStatus&=~0x80;
972   if(CurReg==0x19)
973   {
974      Regs[CurReg]=FIFO[RPtr];
975      if(RPtr!=RSize)
976      {
977         ++RPtr;
978         if(RPtr==RSize)
979         {
980            Interrupt(0x16);
981         }
982      }
983   }
984   {
985      UINT8 r=Regs[CurReg];
986      if(CurReg!=0x19 && CurReg!=0x18 && CurReg!=0x1f)
987         ++CurReg;
988      return r;
989   }
990}
991
992static UINT8 scsi_status_r(void)
993{
994   if(RPtr<RSize)   //Data pending
995      return AuxStatus|1;
996   return AuxStatus;
997}
998
999778/* GFX decodes */
1000779
1001780
r869r870
21371916
21381917   UINT32 retval = 0;
21391918
2140//  printf("cdrom_r %08x\n",mem_mask);
2141
21421919   if (ACCESSING_MSB32)
21431920   {
2144      retval |= scsi_status_r()<<16;
1921      retval |= ((UINT16)wd33c93_r(0))<<16;
21451922   }
21461923
21471924   if (ACCESSING_LSB32)
21481925   {
2149      retval |= scsi_dat_r()<<0;
1926      retval |= (UINT16)wd33c93_r(1);
21501927   }
21511928
21521929   return retval;
r869r870
21541931
21551932WRITE32_HANDLER( cps3_cdrom_w )
21561933{
2157//  printf("cdrom_w %08x %08x\n",mem_mask, data);
2158
21591934   if (ACCESSING_MSB32)
21601935   {
2161      scsi_reg_w( (data & 0x00ff0000)>>16 );
1936      wd33c93_w(0,(data & 0x00ff0000)>>16);
21621937   }
21631938
21641939   if (ACCESSING_LSB32)
21651940   {
2166      scsi_dat_w( (data & 0x000000ff)>>0 );
1941      wd33c93_w(1,(data & 0x000000ff)>>0);
21671942   }
2168
2169//  return 0x00000000;
21701943}
21711944
21721945WRITE32_HANDLER( cps3_ss_bank_base_w )
r869r870
27242497   cpunum_set_reg(0,SH2_VBR, 0x6000000);
27252498}
27262499
2500static SCSIConfigTable dev_table =
2501{
2502   1,                                      /* 1 SCSI device */
2503   { { SCSI_ID_1, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 2, using CD 0, and it's a CD-ROM */
2504};
2505
2506static struct WD33C93interface scsi_intf =
2507{
2508   &dev_table,      /* SCSI device table */
2509   NULL         /* command completion IRQ */
2510};
2511
27272512MACHINE_RESET( cps3 )
27282513{
2729   scsi_init();
2514   wd33c93_init(&scsi_intf);
27302515
27312516   if (cps3_use_fastboot)
27322517   {
src/mame/drivers/toaplan2.c
r869r870
13451345   AM_RANGE(0x140004, 0x140007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
13461346   AM_RANGE(0x140008, 0x140009) AM_WRITE(toaplan2_0_scroll_reg_select_w)
13471347   AM_RANGE(0x14000c, 0x14000d) AM_READWRITE(toaplan2_inputport_0_word_r, toaplan2_0_scroll_reg_data_w)
1348   AM_RANGE(0x180000, 0x180001) AM_READ(port_tag_to_handler16("DSWA"))
1349   AM_RANGE(0x180010, 0x180011) AM_READ(port_tag_to_handler16("DSWB"))
1350   AM_RANGE(0x180020, 0x180021) AM_READ(port_tag_to_handler16("SYS"))
1348   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("DSWA")
1349   AM_RANGE(0x180010, 0x180011) AM_READ_PORT("DSWB")
1350   AM_RANGE(0x180020, 0x180021) AM_READ_PORT("SYS")
13511351   AM_RANGE(0x180030, 0x180031) AM_READ(c2map_port_6_r)      /* CPU 2 busy and Territory Jumper block */
13521352   AM_RANGE(0x180040, 0x180041) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
1353   AM_RANGE(0x180050, 0x180051) AM_READ(port_tag_to_handler16("IN1"))
1354   AM_RANGE(0x180060, 0x180061) AM_READ(port_tag_to_handler16("IN2"))
1353   AM_RANGE(0x180050, 0x180051) AM_READ_PORT("IN1")
1354   AM_RANGE(0x180060, 0x180061) AM_READ_PORT("IN2")
13551355   AM_RANGE(0x180070, 0x180071) AM_WRITE(toaplan2_hd647180_cpu_w)
13561356ADDRESS_MAP_END
13571357
r869r870
13671367   AM_RANGE(0x140008, 0x140009) AM_WRITE(toaplan2_0_scroll_reg_select_w)
13681368   AM_RANGE(0x14000c, 0x14000d) AM_READWRITE(toaplan2_inputport_0_word_r, toaplan2_0_scroll_reg_data_w)
13691369   AM_RANGE(0x180000, 0x180001) AM_READWRITE(ghox_mcu_r, ghox_mcu_w)   /* really part of shared RAM */
1370   AM_RANGE(0x180006, 0x180007) AM_READ(port_tag_to_handler16("DSWA"))
1371   AM_RANGE(0x180008, 0x180009) AM_READ(port_tag_to_handler16("DSWB"))
1372   AM_RANGE(0x180010, 0x180011) AM_READ(port_tag_to_handler16("SYS"))
1373   AM_RANGE(0x18000c, 0x18000d) AM_READ(port_tag_to_handler16("IN1"))
1374   AM_RANGE(0x18000e, 0x18000f) AM_READ(port_tag_to_handler16("IN2"))
1370   AM_RANGE(0x180006, 0x180007) AM_READ_PORT("DSWA")
1371   AM_RANGE(0x180008, 0x180009) AM_READ_PORT("DSWB")
1372   AM_RANGE(0x180010, 0x180011) AM_READ_PORT("SYS")
1373   AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("IN1")
1374   AM_RANGE(0x18000e, 0x18000f) AM_READ_PORT("IN2")
13751375   AM_RANGE(0x180500, 0x180fff) AM_READWRITE(ghox_shared_ram_r, ghox_shared_ram_w) AM_BASE(&toaplan2_shared_ram16)
13761376   AM_RANGE(0x181000, 0x181001) AM_WRITE(toaplan2_coin_word_w)
1377   AM_RANGE(0x18100c, 0x18100d) AM_READ(port_tag_to_handler16("JMPR"))
1377   AM_RANGE(0x18100c, 0x18100d) AM_READ_PORT("JMPR")
13781378ADDRESS_MAP_END
13791379
13801380
13811381static ADDRESS_MAP_START( dogyuun_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
13821382   AM_RANGE(0x000000, 0x07ffff) AM_ROM
13831383   AM_RANGE(0x100000, 0x103fff) AM_RAM
1384   AM_RANGE(0x200010, 0x200011) AM_READ(port_tag_to_handler16("IN1"))
1385   AM_RANGE(0x200014, 0x200015) AM_READ(port_tag_to_handler16("IN2"))
1386   AM_RANGE(0x200018, 0x200019) AM_READ(port_tag_to_handler16("SYS"))
1384   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("IN1")
1385   AM_RANGE(0x200014, 0x200015) AM_READ_PORT("IN2")
1386   AM_RANGE(0x200018, 0x200019) AM_READ_PORT("SYS")
13871387   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_coin_word_w)
13881388#if V25
13891389   AM_RANGE(0x21e000, 0x21fbff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&toaplan2_shared_ram16)   /* $21f000 status port */
r869r870
13911391#else
13921392   AM_RANGE(0x21e000, 0x21efff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&toaplan2_shared_ram16)
13931393   AM_RANGE(0x21f000, 0x21f001) AM_READWRITE(toaplan2_snd_cpu_r, dogyuun_snd_cpu_w)   /* V25+ status/command port */
1394   AM_RANGE(0x21f004, 0x21f005) AM_READ(port_tag_to_handler16("DSWA"))
1395   AM_RANGE(0x21f006, 0x21f007) AM_READ(port_tag_to_handler16("DSWB"))
1396   AM_RANGE(0x21f008, 0x21f009) AM_READ(port_tag_to_handler16("JMPR"))
1394   AM_RANGE(0x21f004, 0x21f005) AM_READ_PORT("DSWA")
1395   AM_RANGE(0x21f006, 0x21f007) AM_READ_PORT("DSWB")
1396   AM_RANGE(0x21f008, 0x21f009) AM_READ_PORT("JMPR")
13971397   AM_RANGE(0x21fc00, 0x21ffff) AM_READWRITE(V25_sharedram_r, V25_sharedram_w) AM_BASE(&V25_shared_ram)   /* 16-bit on 68000 side, 8-bit on V25+ side */
13981398#endif
13991399   /***** The following locations in 0x30000x are for video controller 1 ******/
r869r870
14161416   AM_RANGE(0x100000, 0x103fff) AM_RAM
14171417   AM_RANGE(0x200000, 0x200001) AM_READWRITE(kbash_snd_cpu_r, kbash_snd_cpu_w)   /* Sound number to play */
14181418   AM_RANGE(0x200002, 0x200003) AM_WRITENOP               /* Control info to V25+ */
1419   AM_RANGE(0x200004, 0x200005) AM_READ(port_tag_to_handler16("DSWA"))
1420   AM_RANGE(0x200006, 0x200007) AM_READ(port_tag_to_handler16("DSWB"))
1421   AM_RANGE(0x200008, 0x200009) AM_READ(port_tag_to_handler16("JMPR"))
1422   AM_RANGE(0x208010, 0x208011) AM_READ(port_tag_to_handler16("IN1"))
1423   AM_RANGE(0x208014, 0x208015) AM_READ(port_tag_to_handler16("IN2"))
1424   AM_RANGE(0x208018, 0x208019) AM_READ(port_tag_to_handler16("SYS"))
1419   AM_RANGE(0x200004, 0x200005) AM_READ_PORT("DSWA")
1420   AM_RANGE(0x200006, 0x200007) AM_READ_PORT("DSWB")
1421   AM_RANGE(0x200008, 0x200009) AM_READ_PORT("JMPR")
1422   AM_RANGE(0x208010, 0x208011) AM_READ_PORT("IN1")
1423   AM_RANGE(0x208014, 0x208015) AM_READ_PORT("IN2")
1424   AM_RANGE(0x208018, 0x208019) AM_READ_PORT("SYS")
14251425   AM_RANGE(0x20801c, 0x20801d) AM_WRITE(toaplan2_coin_word_w)
14261426   AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w)
14271427   AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
r869r870
14381438   AM_RANGE(0x104000, 0x10401f) AM_RAM         /* Sound related? */
14391439   AM_RANGE(0x200000, 0x200001) AM_NOP         /* Left over from original code - Sound Number write, Status read */
14401440   AM_RANGE(0x200002, 0x200003) AM_WRITENOP   /* Left over from original code - Reset Sound */
1441   AM_RANGE(0x200004, 0x200005) AM_READ(port_tag_to_handler16("DSWA"))
1442   AM_RANGE(0x200008, 0x200009) AM_READ(port_tag_to_handler16("DSWB"))
1443   AM_RANGE(0x20000c, 0x20000d) AM_READ(port_tag_to_handler16("JMPR"))
1444   AM_RANGE(0x200010, 0x200011) AM_READ(port_tag_to_handler16("IN1"))
1445   AM_RANGE(0x200014, 0x200015) AM_READ(port_tag_to_handler16("IN2"))
1446   AM_RANGE(0x200018, 0x200019) AM_READ(port_tag_to_handler16("SYS"))
1441   AM_RANGE(0x200004, 0x200005) AM_READ_PORT("DSWA")
1442   AM_RANGE(0x200008, 0x200009) AM_READ_PORT("DSWB")
1443   AM_RANGE(0x20000c, 0x20000d) AM_READ_PORT("JMPR")
1444   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("IN1")
1445   AM_RANGE(0x200014, 0x200015) AM_READ_PORT("IN2")
1446   AM_RANGE(0x200018, 0x200019) AM_READ_PORT("SYS")
14471447   AM_RANGE(0x200020, 0x200021) AM_READWRITE(OKIM6295_status_1_lsb_r, OKIM6295_data_1_lsb_w)
14481448   AM_RANGE(0x200024, 0x200025) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w)
14491449   AM_RANGE(0x200028, 0x200029) AM_WRITE(oki_bankswitch_w)
r869r870
14711471   AM_RANGE(0x403200, 0x403fff) AM_RAM
14721472   AM_RANGE(0x500000, 0x50ffff) AM_READWRITE(toaplan2_tx_gfxram16_r, toaplan2_tx_gfxram16_w) AM_BASE(&toaplan2_tx_gfxram16)
14731473   AM_RANGE(0x600000, 0x600001) AM_READ(video_count_r)
1474   AM_RANGE(0x700000, 0x700001) AM_READ(port_tag_to_handler16("DSWA"))
1475   AM_RANGE(0x700002, 0x700003) AM_READ(port_tag_to_handler16("DSWB"))
1476   AM_RANGE(0x700004, 0x700005) AM_READ(port_tag_to_handler16("JMPR"))
1477   AM_RANGE(0x700006, 0x700007) AM_READ(port_tag_to_handler16("IN1"))
1478   AM_RANGE(0x700008, 0x700009) AM_READ(port_tag_to_handler16("IN2"))
1479   AM_RANGE(0x70000a, 0x70000b) AM_READ(port_tag_to_handler16("SYS"))
1474   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSWA")
1475   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSWB")
1476   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("JMPR")
1477   AM_RANGE(0x700006, 0x700007) AM_READ_PORT("IN1")
1478   AM_RANGE(0x700008, 0x700009) AM_READ_PORT("IN2")
1479   AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("SYS")
14801480   AM_RANGE(0x700010, 0x700011) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w)
14811481   AM_RANGE(0x700014, 0x700015) AM_WRITE(YM2151_register_port_0_lsb_w)
14821482   AM_RANGE(0x700016, 0x700017) AM_READWRITE(YM2151_status_port_0_lsb_r, YM2151_data_port_0_lsb_w)
r869r870
14941494   AM_RANGE(0x14000c, 0x14000d) AM_READWRITE(toaplan2_inputport_0_word_r, toaplan2_0_scroll_reg_data_w)
14951495   AM_RANGE(0x190000, 0x190fff) AM_READWRITE(toaplan2_shared_r, toaplan2_shared_w)
14961496   AM_RANGE(0x19c01c, 0x19c01d) AM_WRITE(toaplan2_coin_word_w)      /* Coin count/lock */
1497   AM_RANGE(0x19c020, 0x19c021) AM_READ(port_tag_to_handler16("DSWA"))
1498   AM_RANGE(0x19c024, 0x19c025) AM_READ(port_tag_to_handler16("DSWB"))
1499   AM_RANGE(0x19c028, 0x19c029) AM_READ(port_tag_to_handler16("JMPR"))
1500   AM_RANGE(0x19c02c, 0x19c02d) AM_READ(port_tag_to_handler16("SYS"))
1501   AM_RANGE(0x19c030, 0x19c031) AM_READ(port_tag_to_handler16("IN1"))
1502   AM_RANGE(0x19c034, 0x19c035) AM_READ(port_tag_to_handler16("IN2"))
1497   AM_RANGE(0x19c020, 0x19c021) AM_READ_PORT("DSWA")
1498   AM_RANGE(0x19c024, 0x19c025) AM_READ_PORT("DSWB")
1499   AM_RANGE(0x19c028, 0x19c029) AM_READ_PORT("JMPR")
1500   AM_RANGE(0x19c02c, 0x19c02d) AM_READ_PORT("SYS")
1501   AM_RANGE(0x19c030, 0x19c031) AM_READ_PORT("IN1")
1502   AM_RANGE(0x19c034, 0x19c035) AM_READ_PORT("IN2")
15031503ADDRESS_MAP_END
15041504
15051505
r869r870
15161516   AM_RANGE(0x190002, 0x190003) AM_READ(pipibibi_z80_status_r)   /* Z80 ready ? */
15171517   AM_RANGE(0x190010, 0x190011) AM_WRITE(pipibibi_z80_task_w)   /* Z80 task to perform */
15181518   AM_RANGE(0x19c01c, 0x19c01d) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
1519   AM_RANGE(0x19c020, 0x19c021) AM_READ(port_tag_to_handler16("DSWA"))
1520   AM_RANGE(0x19c024, 0x19c025) AM_READ(port_tag_to_handler16("DSWB"))
1521   AM_RANGE(0x19c028, 0x19c029) AM_READ(port_tag_to_handler16("JMPR"))
1522   AM_RANGE(0x19c02c, 0x19c02d) AM_READ(port_tag_to_handler16("SYS"))
1523   AM_RANGE(0x19c030, 0x19c031) AM_READ(port_tag_to_handler16("IN1"))
1524   AM_RANGE(0x19c034, 0x19c035) AM_READ(port_tag_to_handler16("IN2"))
1519   AM_RANGE(0x19c020, 0x19c021) AM_READ_PORT("DSWA")
1520   AM_RANGE(0x19c024, 0x19c025) AM_READ_PORT("DSWB")
1521   AM_RANGE(0x19c028, 0x19c029) AM_READ_PORT("JMPR")
1522   AM_RANGE(0x19c02c, 0x19c02d) AM_READ_PORT("SYS")
1523   AM_RANGE(0x19c030, 0x19c031) AM_READ_PORT("IN1")
1524   AM_RANGE(0x19c034, 0x19c035) AM_READ_PORT("IN2")
15251525ADDRESS_MAP_END
15261526
15271527
15281528static ADDRESS_MAP_START( fixeight_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
15291529   AM_RANGE(0x000000, 0x07ffff) AM_ROM
15301530   AM_RANGE(0x100000, 0x103fff) AM_RAM
1531   AM_RANGE(0x200000, 0x200001) AM_READ(port_tag_to_handler16("IN1"))
1532   AM_RANGE(0x200004, 0x200005) AM_READ(port_tag_to_handler16("IN2"))
1533   AM_RANGE(0x200008, 0x200009) AM_READ(port_tag_to_handler16("IN3"))
1534   AM_RANGE(0x200010, 0x200011) AM_READ(port_tag_to_handler16("SYS"))
1531   AM_RANGE(0x200000, 0x200001) AM_READ_PORT("IN1")
1532   AM_RANGE(0x200004, 0x200005) AM_READ_PORT("IN2")
1533   AM_RANGE(0x200008, 0x200009) AM_READ_PORT("IN3")
1534   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("SYS")
15351535   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
15361536   AM_RANGE(0x280000, 0x28dfff) AM_RAM                     /* part of shared ram ? */
15371537#if V25
r869r870
15411541   AM_RANGE(0x28e000, 0x28efff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&toaplan2_shared_ram16)
15421542   AM_RANGE(0x28f000, 0x28f001) AM_READWRITE(fixeight_sec_cpu_r, fixeight_sec_cpu_w)   /* V25+ Command/Status port */
15431543//  AM_RANGE(0x28f002, 0x28f003) AM_READ(MRA16_RAM)             /* part of shared ram */
1544//  AM_RANGE(0x28f004, 0x28f005) AM_READ(port_tag_to_handler16("DSWA")) /* Dip Switch A - Wrong !!! */
1545//  AM_RANGE(0x28f006, 0x28f007) AM_READ(port_tag_to_handler16("DSWB")) /* Dip Switch B - Wrong !!! */
1546//  AM_RANGE(0x28f008, 0x28f009) AM_READ(port_tag_to_handler16("JMPR")) /* Territory Jumper block - Wrong !!! */
1544//  AM_RANGE(0x28f004, 0x28f005) AM_READ_PORT("DSWA") /* Dip Switch A - Wrong !!! */
1545//  AM_RANGE(0x28f006, 0x28f007) AM_READ_PORT("DSWB") /* Dip Switch B - Wrong !!! */
1546//  AM_RANGE(0x28f008, 0x28f009) AM_READ_PORT("JMPR") /* Territory Jumper block - Wrong !!! */
15471547//  AM_RANGE(0x28f00a, 0x28fbff) AM_READ(MRA16_RAM)             /* part of shared ram */
15481548   AM_RANGE(0x28fc00, 0x28ffff) AM_READWRITE(V25_sharedram_r, V25_sharedram_w) AM_BASE(&V25_shared_ram)   /* 16-bit on 68000 side, 8-bit on V25+ side */
15491549#endif
r869r870
15631563static ADDRESS_MAP_START( fixeighb_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
15641564   AM_RANGE(0x000000, 0x0fffff) AM_ROM      /* 0-$7ffff ?*/
15651565   AM_RANGE(0x100000, 0x10ffff) AM_RAM      /* 100000 - 107fff  105000-105xxx 106000-106xxx 108000 - related to sound ?*/
1566   AM_RANGE(0x200000, 0x200001) AM_READ(port_tag_to_handler16("IN1"))
1567   AM_RANGE(0x200004, 0x200005) AM_READ(port_tag_to_handler16("IN2"))
1568   AM_RANGE(0x200008, 0x200009) AM_READ(port_tag_to_handler16("IN3"))
1569   AM_RANGE(0x20000c, 0x20000d) AM_READ(port_tag_to_handler16("DSWB"))
1570   AM_RANGE(0x200010, 0x200011) AM_READ(port_tag_to_handler16("SYS"))
1566   AM_RANGE(0x200000, 0x200001) AM_READ_PORT("IN1")
1567   AM_RANGE(0x200004, 0x200005) AM_READ_PORT("IN2")
1568   AM_RANGE(0x200008, 0x200009) AM_READ_PORT("IN3")
1569   AM_RANGE(0x20000c, 0x20000d) AM_READ_PORT("DSWB")
1570   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("SYS")
15711571   AM_RANGE(0x200014, 0x200015) AM_WRITE(fixeighb_oki_bankswitch_w)   /* Sound banking. Code at $4084c, $5070 */
15721572   AM_RANGE(0x200018, 0x200019) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w)
1573   AM_RANGE(0x20001c, 0x20001d) AM_READ(port_tag_to_handler16("DSWA"))
1573   AM_RANGE(0x20001c, 0x20001d) AM_READ_PORT("DSWA")
15741574   AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w)   /* VideoRAM selector/offset */
15751575   AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
15761576   AM_RANGE(0x300008, 0x300009) AM_WRITE(toaplan2_0_scroll_reg_select_w)
r869r870
15881588   AM_RANGE(0x000000, 0x07ffff) AM_ROM
15891589   AM_RANGE(0x100000, 0x103fff) AM_RAM
15901590//  AM_RANGE(0x200000, 0x20ffff) AM_ROM                         /* Sound ROM is here ??? */
1591   AM_RANGE(0x200010, 0x200011) AM_READ(port_tag_to_handler16("IN1"))
1592   AM_RANGE(0x200014, 0x200015) AM_READ(port_tag_to_handler16("IN2"))
1593   AM_RANGE(0x200018, 0x200019) AM_READ(port_tag_to_handler16("SYS"))
1591   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("IN1")
1592   AM_RANGE(0x200014, 0x200015) AM_READ_PORT("IN2")
1593   AM_RANGE(0x200018, 0x200019) AM_READ_PORT("SYS")
15941594   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
15951595#if V25
15961596   AM_RANGE(0x21e000, 0x21fbff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&toaplan2_shared_ram16)   /* $21f000 status port */
r869r870
15981598#else
15991599   AM_RANGE(0x21e000, 0x21efff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&toaplan2_shared_ram16)
16001600   AM_RANGE(0x21f000, 0x21f001) AM_READWRITE(toaplan2_snd_cpu_r, vfive_snd_cpu_w)   /* V25+ Command/Status port */
1601   AM_RANGE(0x21f004, 0x21f005) AM_READ(port_tag_to_handler16("DSWA"))
1602   AM_RANGE(0x21f006, 0x21f007) AM_READ(port_tag_to_handler16("DSWB"))
1603   AM_RANGE(0x21f008, 0x21f009) AM_READ(port_tag_to_handler16("JMPR"))
1601   AM_RANGE(0x21f004, 0x21f005) AM_READ_PORT("DSWA")
1602   AM_RANGE(0x21f006, 0x21f007) AM_READ_PORT("DSWB")
1603   AM_RANGE(0x21f008, 0x21f009) AM_READ_PORT("JMPR")
16041604   AM_RANGE(0x21fc00, 0x21ffff) AM_READWRITE(V25_sharedram_r, V25_sharedram_w) AM_BASE(&V25_shared_ram)   /* 16-bit on 68000 side, 8-bit on V25+ side */
16051605#endif
16061606   AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w)   /* VideoRAM selector/offset */
r869r870
16151615static ADDRESS_MAP_START( batsugun_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
16161616   AM_RANGE(0x000000, 0x07ffff) AM_ROM
16171617   AM_RANGE(0x100000, 0x10ffff) AM_RAM
1618   AM_RANGE(0x200010, 0x200011) AM_READ(port_tag_to_handler16("IN1"))
1619   AM_RANGE(0x200014, 0x200015) AM_READ(port_tag_to_handler16("IN2"))
1620   AM_RANGE(0x200018, 0x200019) AM_READ(port_tag_to_handler16("SYS"))
1618   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("IN1")
1619   AM_RANGE(0x200014, 0x200015) AM_READ_PORT("IN2")
1620   AM_RANGE(0x200018, 0x200019) AM_READ_PORT("SYS")
16211621   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
16221622   AM_RANGE(0x210000, 0x21bbff) AM_RAM
16231623#if V25
r869r870
16261626#else
16271627   AM_RANGE(0x21e000, 0x21efff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&toaplan2_shared_ram16)
16281628   AM_RANGE(0x21f000, 0x21f001) AM_READWRITE(toaplan2_snd_cpu_r, batsugun_snd_cpu_w)   /* V25+ Command/Status port */
1629   AM_RANGE(0x21f004, 0x21f005) AM_READ(port_tag_to_handler16("DSWA"))
1630   AM_RANGE(0x21f006, 0x21f007) AM_READ(port_tag_to_handler16("DSWB"))
1631   AM_RANGE(0x21f008, 0x21f009) AM_READ(port_tag_to_handler16("JMPR"))
1629   AM_RANGE(0x21f004, 0x21f005) AM_READ_PORT("DSWA")
1630   AM_RANGE(0x21f006, 0x21f007) AM_READ_PORT("DSWB")
1631   AM_RANGE(0x21f008, 0x21f009) AM_READ_PORT("JMPR")
16321632   AM_RANGE(0x21fc00, 0x21ffff) AM_READWRITE(V25_sharedram_r, V25_sharedram_w) AM_BASE(&V25_shared_ram)   /* 16-bit on 68000 side, 8-bit on V25+ side */
16331633#endif
16341634   /***** The following in 0x30000x are for video controller 1 ******/
r869r870
16571657   AM_RANGE(0x500000, 0x500001) AM_WRITE(YM2151_register_port_0_lsb_w)
16581658   AM_RANGE(0x500002, 0x500003) AM_READWRITE(YM2151_status_port_0_lsb_r, YM2151_data_port_0_lsb_w)
16591659   AM_RANGE(0x600000, 0x600001) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w)
1660   AM_RANGE(0x700000, 0x700001) AM_READ(port_tag_to_handler16("JMPR"))
1661   AM_RANGE(0x700004, 0x700005) AM_READ(port_tag_to_handler16("DSWA"))
1662   AM_RANGE(0x700008, 0x700009) AM_READ(port_tag_to_handler16("DSWB"))
1663   AM_RANGE(0x70000c, 0x70000d) AM_READ(port_tag_to_handler16("IN1"))
1664   AM_RANGE(0x700010, 0x700011) AM_READ(port_tag_to_handler16("IN2"))
1665   AM_RANGE(0x700014, 0x700015) AM_READ(port_tag_to_handler16("IN3"))
1666   AM_RANGE(0x700018, 0x700019) AM_READ(port_tag_to_handler16("IN4"))
1667   AM_RANGE(0x70001c, 0x70001d) AM_READ(port_tag_to_handler16("SYS"))
1660   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("JMPR")
1661   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("DSWA")
1662   AM_RANGE(0x700008, 0x700009) AM_READ_PORT("DSWB")
1663   AM_RANGE(0x70000c, 0x70000d) AM_READ_PORT("IN1")
1664   AM_RANGE(0x700010, 0x700011) AM_READ_PORT("IN2")
1665   AM_RANGE(0x700014, 0x700015) AM_READ_PORT("IN3")
1666   AM_RANGE(0x700018, 0x700019) AM_READ_PORT("IN4")
1667   AM_RANGE(0x70001c, 0x70001d) AM_READ_PORT("SYS")
16681668   AM_RANGE(0x700030, 0x700031) AM_WRITE(oki_bankswitch_w)      /* Sample bank switch */
16691669   AM_RANGE(0x700034, 0x700035) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
16701670ADDRESS_MAP_END
r869r870
16751675   AM_RANGE(0x100000, 0x10ffff) AM_RAM
16761676   AM_RANGE(0x218000, 0x21bfff) AM_READWRITE(raizing_shared_ram_r, raizing_shared_ram_w)
16771677   AM_RANGE(0x21c01c, 0x21c01d) AM_WRITE(toaplan2_coin_word_w)
1678   AM_RANGE(0x21c020, 0x21c021) AM_READ(port_tag_to_handler16("IN1"))
1679   AM_RANGE(0x21c024, 0x21c025) AM_READ(port_tag_to_handler16("IN2"))
1680   AM_RANGE(0x21c028, 0x21c029) AM_READ(port_tag_to_handler16("SYS"))
1681   AM_RANGE(0x21c02c, 0x21c02d) AM_READ(port_tag_to_handler16("DSWA"))
1682   AM_RANGE(0x21c030, 0x21c031) AM_READ(port_tag_to_handler16("DSWB"))
1683   AM_RANGE(0x21c034, 0x21c035) AM_READ(port_tag_to_handler16("JMPR"))
1678   AM_RANGE(0x21c020, 0x21c021) AM_READ_PORT("IN1")
1679   AM_RANGE(0x21c024, 0x21c025) AM_READ_PORT("IN2")
1680   AM_RANGE(0x21c028, 0x21c029) AM_READ_PORT("SYS")
1681   AM_RANGE(0x21c02c, 0x21c02d) AM_READ_PORT("DSWA")
1682   AM_RANGE(0x21c030, 0x21c031) AM_READ_PORT("DSWB")
1683   AM_RANGE(0x21c034, 0x21c035) AM_READ_PORT("JMPR")
16841684   AM_RANGE(0x21c03c, 0x21c03d) AM_READ(video_count_r)
16851685   AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w)
16861686   AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
r869r870
17021702   AM_RANGE(0x218000, 0x21bfff) AM_READWRITE(raizing_shared_ram_r, raizing_shared_ram_w)
17031703//  AM_RANGE(0x21c008, 0x21c009) AM_WRITENOP                    /* ??? */
17041704   AM_RANGE(0x21c01c, 0x21c01d) AM_WRITE(shippumd_coin_word_w)
1705   AM_RANGE(0x21c020, 0x21c021) AM_READ(port_tag_to_handler16("IN1"))
1706   AM_RANGE(0x21c024, 0x21c025) AM_READ(port_tag_to_handler16("IN2"))
1707   AM_RANGE(0x21c028, 0x21c029) AM_READ(port_tag_to_handler16("SYS"))
1708   AM_RANGE(0x21c02c, 0x21c02d) AM_READ(port_tag_to_handler16("DSWA"))
1709   AM_RANGE(0x21c030, 0x21c031) AM_READ(port_tag_to_handler16("DSWB"))
1710   AM_RANGE(0x21c034, 0x21c035) AM_READ(port_tag_to_handler16("JMPR"))
1705   AM_RANGE(0x21c020, 0x21c021) AM_READ_PORT("IN1")
1706   AM_RANGE(0x21c024, 0x21c025) AM_READ_PORT("IN2")
1707   AM_RANGE(0x21c028, 0x21c029) AM_READ_PORT("SYS")
1708   AM_RANGE(0x21c02c, 0x21c02d) AM_READ_PORT("DSWA")
1709   AM_RANGE(0x21c030, 0x21c031) AM_READ_PORT("DSWB")
1710   AM_RANGE(0x21c034, 0x21c035) AM_READ_PORT("JMPR")
17111711   AM_RANGE(0x21c03c, 0x21c03d) AM_READ(video_count_r)
17121712   AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w)
17131713   AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
r869r870
17281728   AM_RANGE(0x100000, 0x10ffff) AM_RAM
17291729   AM_RANGE(0x218000, 0x21bfff) AM_READWRITE(raizing_shared_ram_r, raizing_shared_ram_w)
17301730   AM_RANGE(0x21c01c, 0x21c01d) AM_WRITE(toaplan2_coin_word_w)
1731   AM_RANGE(0x21c020, 0x21c021) AM_READ(port_tag_to_handler16("IN1"))
1732   AM_RANGE(0x21c024, 0x21c025) AM_READ(port_tag_to_handler16("IN2"))
1733   AM_RANGE(0x21c028, 0x21c029) AM_READ(port_tag_to_handler16("SYS"))
1734   AM_RANGE(0x21c02c, 0x21c02d) AM_READ(port_tag_to_handler16("DSWA"))
1735   AM_RANGE(0x21c030, 0x21c031) AM_READ(port_tag_to_handler16("DSWB"))
1736   AM_RANGE(0x21c034, 0x21c035) AM_READ(port_tag_to_handler16("JMPR"))
1731   AM_RANGE(0x21c020, 0x21c021) AM_READ_PORT("IN1")
1732   AM_RANGE(0x21c024, 0x21c025) AM_READ_PORT("IN2")
1733   AM_RANGE(0x21c028, 0x21c029) AM_READ_PORT("SYS")
1734   AM_RANGE(0x21c02c, 0x21c02d) AM_READ_PORT("DSWA")
1735   AM_RANGE(0x21c030, 0x21c031) AM_READ_PORT("DSWB")
1736   AM_RANGE(0x21c034, 0x21c035) AM_READ_PORT("JMPR")
17371737   AM_RANGE(0x21c03c, 0x21c03d) AM_READ(video_count_r)
17381738   AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w)
17391739   AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
r869r870
17621762   AM_RANGE(0x400004, 0x400005) AM_WRITE(toaplan2_0_scroll_reg_select_w)
17631763   AM_RANGE(0x400008, 0x40000b) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
17641764   AM_RANGE(0x40000c, 0x40000d) AM_WRITE(toaplan2_0_voffs_w)
1765   AM_RANGE(0x500000, 0x500001) AM_READ(port_tag_to_handler16("IN"))
1766   AM_RANGE(0x500002, 0x500003) AM_READ(port_tag_to_handler16("SYS-DSW"))
1767   AM_RANGE(0x500004, 0x500005) AM_READ(port_tag_to_handler16("DSW"))
1765   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("IN")
1766   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("SYS-DSW")
1767   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("DSW")
17681768   AM_RANGE(0x500006, 0x500007) AM_READ(video_count_r)
17691769   AM_RANGE(0x500008, 0x500009) AM_READ(soundlatch3_word_r)
17701770   AM_RANGE(0x50000a, 0x50000b) AM_READ(soundlatch4_word_r)
r869r870
17931793   AM_RANGE(0x400004, 0x400005) AM_WRITE(toaplan2_0_scroll_reg_select_w)
17941794   AM_RANGE(0x400008, 0x40000b) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w)   /* Tile/Sprite VideoRAM */
17951795   AM_RANGE(0x40000c, 0x40000d) AM_WRITE(toaplan2_0_voffs_w)
1796   AM_RANGE(0x500000, 0x500001) AM_READ(port_tag_to_handler16("IN"))
1797   AM_RANGE(0x500002, 0x500003) AM_READ(port_tag_to_handler16("SYS-DSW"))
1798   AM_RANGE(0x500004, 0x500005) AM_READ(port_tag_to_handler16("DSW"))
1796   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("IN")
1797   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("SYS-DSW")
1798   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("DSW")
17991799   AM_RANGE(0x500006, 0x500007) AM_READ(video_count_r)
18001800   AM_RANGE(0x500008, 0x500009) AM_WRITE(toaplan2_coin_word_w)
18011801   AM_RANGE(0x500010, 0x500011) AM_READ(soundlatch3_word_r)
r869r870
19111911   AM_RANGE(0x04001, 0x04001) AM_WRITE(YM2151_data_port_0_w)
19121912   AM_RANGE(0x04002, 0x04002) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
19131913   AM_RANGE(0x04004, 0x04004) AM_WRITE(oki_bankswitch_w)
1914   AM_RANGE(0x04008, 0x04008) AM_READ(port_tag_to_handler16("IN1"))
1915   AM_RANGE(0x0400a, 0x0400a) AM_READ(port_tag_to_handler16("IN2"))
1916   AM_RANGE(0x0400c, 0x0400c) AM_READ(port_tag_to_handler16("SYS"))
1914   AM_RANGE(0x04008, 0x04008) AM_READ_PORT("IN1")
1915   AM_RANGE(0x0400a, 0x0400a) AM_READ_PORT("IN2")
1916   AM_RANGE(0x0400c, 0x0400c) AM_READ_PORT("SYS")
19171917   AM_RANGE(0x0400e, 0x0400e) AM_WRITE(toaplan2_coin_w)
19181918   AM_RANGE(0x0fe00, 0x0ffff) AM_RAM                     /* Internal 512 bytes of RAM */
19191919   AM_RANGE(0x80000, 0x87fff) AM_RAM AM_BASE(&V25_sharedram)   /* External shared RAM (ROM for KBASH) */
r869r870
19211921
19221922
19231923static ADDRESS_MAP_START( V25_port, ADDRESS_SPACE_IO, 8 )
1924   AM_RANGE(0x0060, 0x0060) AM_READ(port_tag_to_handler16("DSWA"))   /* Directly mapped I/O ports */
1925   AM_RANGE(0x0061, 0x0061) AM_READ(port_tag_to_handler16("DSWA"))   /* Directly mapped I/O ports */
1926   AM_RANGE(0x0062, 0x0062) AM_READ(port_tag_to_handler16("JMPR"))   /* Directly mapped I/O ports */
1924   AM_RANGE(0x0060, 0x0060) AM_READ_PORT("DSWA")   /* Directly mapped I/O ports */
1925   AM_RANGE(0x0061, 0x0061) AM_READ_PORT("DSWA")   /* Directly mapped I/O ports */
1926   AM_RANGE(0x0062, 0x0062) AM_READ_PORT("JMPR")   /* Directly mapped I/O ports */
19271927ADDRESS_MAP_END
19281928#endif
19291929
src/mame/drivers/cischeat.c
r869r870
17761776   MDRV_CPU_VBLANK_INT(irq4_line_hold,CISCHEAT_SOUND_INTERRUPT_NUM)
17771777
17781778   MDRV_SCREEN_REFRESH_RATE(30)
1779   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_30HZ_VBLANK_DURATION))
1779   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_30HZ_VBLANK_DURATION)
17801780   MDRV_INTERLEAVE(20)
17811781
17821782   /* video hardware */
r869r870
19041904   MDRV_CPU_VBLANK_INT(interrupt_scudhamm,INTERRUPT_NUM_SCUDHAMM)
19051905
19061906   MDRV_SCREEN_REFRESH_RATE(30)
1907   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_30HZ_VBLANK_DURATION * 3))
1907   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_30HZ_VBLANK_DURATION * 3)
19081908
19091909   /* video hardware */
19101910   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK | VIDEO_HAS_SHADOWS)
src/mame/drivers/vicdual.c
r869r870
20582058
20592059/* dual game hardware */
20602060static ADDRESS_MAP_START( samurai_map, ADDRESS_SPACE_PROGRAM, 8 )
2061   AM_RANGE(0x0000, 0x3fff) AM_MIRROR(0x4000) AM_READWRITE(MRA8_ROM, samurai_protection_w);
2061   AM_RANGE(0x0000, 0x3fff) AM_MIRROR(0x4000) AM_READWRITE(MRA8_ROM, samurai_protection_w)
20622062   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x7000) AM_READWRITE(MRA8_RAM, vicdual_videoram_w) AM_BASE(&vicdual_videoram)
20632063   AM_RANGE(0x8400, 0x87ff) AM_MIRROR(0x7000) AM_RAM
20642064   AM_RANGE(0x8800, 0x8fff) AM_MIRROR(0x7000) AM_READWRITE(MRA8_RAM, vicdual_characterram_w) AM_BASE(&vicdual_characterram)
src/mame/drivers/wgp.c
r869r870
289289Be aware that the "Machine ID" Dip Switch must be set to 1, or the tests are
290290NOT performed (I can't explain why for the moment) !
291291
292The "Machine ID" determines which motorbike you will use and has an incidence
293on the start position on the grid. Motorbike 2 seems to be the best one as
294it is always on 1st position (against 2nd position for motorbike 1).
2922) 'wgpjoy*'
295293
296The "Slave / Master" Dip Switch is only a guess according to some other linked
297machines (eg: "Cadash"), and due to incomplete LAN RAM emulation, I haven't
298seen any visible effect 8(
299
300The "Motor Test" Dip Switch is a feature that is available (or not) in the
301"test mode". I can't tell for the moment if it has any effect during gameplay.
302
3032) 'wgpj'
304
305294LAN stuff :
306295
307Same stuff for the LAN RAM as in 'wgp' (the ROMS for CPUB are the same) ...
296It is very surprising, but you also find the text about the LAN stuff in
297the ROMS (still version 1.06), but you can't perform lan tests in the
298"test mode".
308299
309Dip Switches :
300As the LAN version is the same, I'll have to look at the code to see where
301the differences are.
310302
311Same as the ones for 'wgp' if you except the "Coinage" Dip Switches.
312
3133033) 'wgp2'
314304
315305LAN stuff :
316306
317307I haven't tested the LAN stuff for the moment.
318308
319Dip Switches :
320309
321They are almost the same as for 'wgpj' : the only is that there is no
322"Motor Test" Dip Switch has this feature is ALWAYS available in the "test mode".
310Stephh's notes (based on the game M68000 code and some tests) :
323311
3244) 'wgpjoy'
3121) 'wgp' and 'wgpj'
325313
326LAN stuff :
314  - Region stored at 0x03fffe.w and sub-region stored at 0x03fffc.w
315  - Sets :
316      * 'wgp'  : region = 0x0001 - sub-region = 0x0002
317      * 'wgpj' : region = 0x0000 - sub-region = 0x0000
318  - Coinage relies on the region (code at 0x00dd10) :
319      * 0x0000 (Japan) use TAITO_COINAGE_JAPAN_NEW
320      * 0x0001 (US) use TAITO_COINAGE_US
321      * 0x0002 (World), 0x0003 (US, licenced to ROMSTAR) and 0x0004 (licenced to PHOENIX ELECTRONICS CO.)
322        use slighlty different TAITO_COINAGE_WORLD : 1C_7C instead of 1C_6C for Coin B
323  - GP order relies on the sub-region (code at 0x00bc9c) :
324      * 0x0000 : 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
325      * 0x0001 : 0x01 0x00 0x02 0x03 0x04 0x05 0x06 0x07
326      * 0x0002 : 0x02 0x00 0x01 0x02 0x04 0x05 0x06 0x07
327      * 0x0003 : 0x03 0x00 0x01 0x03 0x04 0x05 0x06 0x07
328      * 0x0004 : 0x04 0x00 0x01 0x02 0x03 0x05 0x06 0x07
329      * 0x0005 : 0x05 0x00 0x01 0x02 0x03 0x04 0x06 0x07
330      * 0x0006 : 0x06 0x00 0x01 0x02 0x03 0x04 0x05 0x07
331      * 0x0007 : 0x07 0x00 0x01 0x02 0x03 0x04 0x05 0x06
332    GP country :
333      * 0x00 : Japan
334      * 0x01 : Australia
335      * 0x02 : USA
336      * 0x03 : Germany
337      * 0x04 : Netherlands
338      * 0x05 : Belgium
339      * 0x06 : France
340      * 0x07 : England
341  - Notice screen only if region = 0x0000 or region = 0x0001
342  - FBI logo only if region = 0x0001
343  - DSWA bit 0 does the following things when set to ON :
344      * "MACHINE TEST" message and additional tests on startup (code at 0x00b06e)
345      * alternate "SHIFT PATTERN SELECT" screen (code at 0x00ccdc)
346      * accel / brake "buttons" have different behaviour (code at 0x029ca0) :
347          . same as default when selecting "NORMAL" (4 gears, street machines)
348          . swapped "buttons" when selecting "RACING" (6 gears, racing machines)
349      * additional value sent to shared memory every frame (code at 0x00afd2)
350      * additional "MOTOR TEST" in the "test mode"
327351
328It is very surprising, but you also find the text about the LAN stuff in
329the ROMS (still version 1.06), but you can't perform lan tests in the
330"test mode".
331352
3325) 'wgpjoya'
3532) 'wgpjoy*'
333354
334LAN stuff :
355  - Region stored at 0x03fffe.w and sub-region stored at 0x03fffc.w
356  - Sets :
357      * 'wgpjoy'  : region = 0x0000 - sub-region = 0x0000
358      * 'wgpjoya' : region = 0x0000 - sub-region = 0x0000
359  - DSWA bit 0 does the following things when set to ON :
360      * "MACHINE TEST" message and additional tests on startup (code at 0x00b094)
361      * alternate "SHIFT PATTERN SELECT" screen (code at 0x00cd02)
362      * accel / brake "buttons" have different behaviour (code at 0x0298c6) :
363          . same as default when selecting "NORMAL" (4 gears, street machines)
364          . swapped "buttons" when selecting "RACING" (6 gears, racing machines)
365      * additional value sent to shared memory every frame (code at 0x00aff8)
366  - DSWB bits 4 to 7 ("Communication" and "Machine ID") have no effect
367    due to "ori.w   #$f0ff, D0" instruction at 0x003300 !
368  - "Test mode" is completely different
369  - Same other notes as for 'wgp' (different addresses though)
335370
336It is very surprising, but you also find the text about the LAN stuff in
337the ROMS (still version 1.06), but you can't perform lan tests in the
338"test mode".
339371
340As the LAN version is the same, I'll have to look at the code to see where
341the differences are.
3723) 'wgp2'
342373
374  - Region stored at 0x03fffe.w and sub-region stored at 0x03fffc.w
375  - Sets :
376      * 'wgp2' : region = 0x0000 - sub-region = 0x0000
377  - Coinage relies on the region (code at 0x00166e) :
378      * 0x0000 (Japan) use TAITO_COINAGE_JAPAN_NEW
379      * 0x0001 (US) use TAITO_COINAGE_US
380      * 0x0002 (World) use slighlty different TAITO_COINAGE_WORLD :
381        1C_7C instead of 1C_6C for Coin B, same settings otherwise
382  - Notice screen only if region = 0x0000 or region = 0x0001
383  - FBI logo only if region = 0x0001
384  - Routine at 0x01116c is the same as the one in 'wgp' based on sub-region;
385    however, as you can partically select your GP at start, and as I suck
386    at such driving game, I wonder if this routine is still called !
387  - DSWA bit 0 does the following things when set to ON :
388      * unknown effect (code at 0x0126f6)
389      * accel / brake "buttons" have different behaviour (code at 0x0142d2) :
390          . same as default when selecting "NORMAL" (4 gears, street machines)
391          . swapped "buttons" when selecting "RACING" (6 gears, racing machines)
392  - Always "MOTOR TEST" in the "test mode"
393
343394***************************************************************************/
344395
345396#include "driver.h"
397#include "taitoipt.h"
346398#include "cpu/m68000/m68000.h"
347399#include "video/taitoic.h"
348400#include "audio/taitosnd.h"
r869r870
488540}
489541
490542
543#define STEER_PORT_TAG   "STEER"
544#define UNKNOWN_PORT_TAG "UNKNOWN"
545#define FAKE_PORT_TAG    "FAKE"
546
491547static READ16_HANDLER( wgp_adinput_r )
492548{
493549   int steer = 0x40;
494   int fake = input_port_5_word_r(0,0);
550   int fake = readinputportbytag_safe(FAKE_PORT_TAG,0x00);
495551
496   if (!(fake &0x10))   /* Analogue steer (the real control method) */
552   if (!(fake & 0x10))   /* Analogue steer (the real control method) */
497553   {
498554      /* Reduce span to 0x80 */
499      steer = ((input_port_6_word_r(0,0)) * 0x80) / 0x100;
555      steer = (readinputportbytag_safe(STEER_PORT_TAG,0x00) * 0x80) / 0x100;
500556   }
501557   else   /* Digital steer */
502558   {
503      if (fake & 0x8)   /* pressing down */
559      if (fake & 0x08)   /* pressing down */
504560         steer = 0x20;
505561
506      if (fake & 0x4)   /* pressing up */
562      if (fake & 0x04)   /* pressing up */
507563         steer = 0x60;
508564
509      if (fake & 0x2)   /* pressing right */
565      if (fake & 0x02)   /* pressing right */
510566         steer = 0x00;
511567
512      if (fake & 0x1)   /* pressing left */
568      if (fake & 0x01)   /* pressing left */
513569         steer = 0x80;
514570   }
515571
r869r870
517573   {
518574      case 0x00:
519575      {
520         if (input_port_5_word_r(0,0) &0x40)   /* pressing accel */
576         if (fake & 0x40)   /* pressing accel */
521577            return 0xff;
522578         else
523579            return 0x00;
r869r870
534590
535591      case 0x04:
536592      {
537         if (input_port_5_word_r(0,0) &0x80)   /* pressing brake */
593         if (fake & 0x80)   /* pressing brake */
538594            return 0xcf;
539595         else
540596            return 0xff;
541597      }
542598
543599      case 0x05:
544         return input_port_7_word_r(0,0);   /* unknown */
600         return readinputportbytag_safe(UNKNOWN_PORT_TAG,0x00);   /* unknown */
545601   }
546602
547603logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",activecpu_get_pc(),offset);
r869r870
685741                      INPUT PORTS, DIPs
686742***********************************************************/
687743
688/* Duplicated macros from most other Taito drivers :
689
690    asuka.c
691    exzisus.c
692    ninjaw.c
693    opwolf.c
694    othunder.c
695    taito_b.c
696    taito_f2.c
697    taito_h.c
698    taito_l.c
699    taito_x.c
700    taitoair.c
701    topspeed.c
702    warriorb.c
703*/
704
705/* Same as TAITO_DIFFICULTY_8 in most Taito drivers. */
706#define TAITO_DIFFICULTY_8 \
707   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
708   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
709   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
710   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
711   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
712
713/* Same as TAITO_COINAGE_JAPAN_NEW_8 in most Taito drivers. */
714#define TAITO_COINAGE_JAPAN_NEW_8 \
715   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
716   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
717   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
718   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
719   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
720   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
721   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
722   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
723   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
724   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
725
726/* Same as TAITO_COINAGE_US_8 in most Taito drivers. */
727#define TAITO_COINAGE_US_8 \
728   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) ) \
729   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
730   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
731   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
732   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
733   PORT_DIPNAME( 0xc0, 0xc0, "Price to Continue" ) \
734   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
735   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
736   PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) ) \
737   PORT_DIPSETTING(    0xc0, "Same as Start" )
738
739
740/* Duplicated macros from some other Taito drivers */
741
742/* Same as TAITO_B_DSWA_2_4 in taito_b.c and TAITO_L_DSWA_2_4 in taito_l.c */
743#define TAITO_WGP_DSWA_2_4 \
744   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) \
745   PORT_DIPSETTING(    0x02, DEF_STR( Off ) ) \
746   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
747   PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) \
748   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) \
749   PORT_DIPSETTING(    0x00, DEF_STR( Off ) ) \
750   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
751
752/* Same as TAITO_X_SYSTEM_INPUT in taito_x.c */
753#define TAITO_WGP_SYSTEM_INPUT \
754   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) \
755   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
756   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) \
757   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
758
759
760/* Driver specific macros */
761
762/* Slightly different from TAITO_COINAGE_WORLD_8 in MANY Taito drivers :
763   1C_7C instead of 1C_6C for "Coin B". */
764#define WGP_COINAGE_WORLD_8 \
765   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
766   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
767   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
768   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
769   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
770   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
771   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
772   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
773   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
774   PORT_DIPSETTING(    0x00, DEF_STR( 1C_7C ) )
775
776#define WGP_MACHINE_ID_8 \
777   PORT_DIPNAME( 0xe0, 0xe0, "Machine ID" ) \
778   PORT_DIPSETTING(    0xe0, "1" ) \
779   PORT_DIPSETTING(    0xc0, "2" ) \
780   PORT_DIPSETTING(    0xa0, "3" ) \
781   PORT_DIPSETTING(    0x80, "4" ) \
782   PORT_DIPSETTING(    0x60, "5" ) \
783   PORT_DIPSETTING(    0x40, "6" ) \
784   PORT_DIPSETTING(    0x20, "7" ) \
785   PORT_DIPSETTING(    0x00, "8" )
786
787
788INPUT_PORTS_START( wgp )
789   PORT_START /* DSW A */
790   PORT_DIPNAME( 0x01, 0x01, "Motor Test" )            // Only available in "test mode"
791   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
744INPUT_PORTS_START( wgp_joy_generic )
745   PORT_START_TAG("DSWA")
746   PORT_DIPNAME( 0x01, 0x01, "Gear Shift" )                     /* see notes */
747   PORT_DIPSETTING(    0x01, DEF_STR( Normal ) )
748   PORT_DIPSETTING(    0x00, "Normal / Racing" )
749   TAITO_DSWA_BITS_1_TO_3
750   /* The 4 following Dip Switches will be filled by TAITO_COINAGE_* macros */
751   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
752   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
792753   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
793   TAITO_WGP_DSWA_2_4
794   TAITO_COINAGE_US_8
754   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
755   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
756   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
757   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
758   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
759   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
760   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
761   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
762   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
795763
796   PORT_START /* DSW B */
797   TAITO_DIFFICULTY_8
764   PORT_START_TAG("DSWB")
765   TAITO_DIFFICULTY
798766   PORT_DIPNAME( 0x04, 0x04, "Shift Pattern Select" )
799767   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
800768   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
801   PORT_DIPNAME( 0x08, 0x08, "Slave / Master ???" )
802   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
803   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
804   PORT_DIPNAME( 0x10, 0x10, "Communication" )
805   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
806   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
807   WGP_MACHINE_ID_8
769   PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
770   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )                        /* see notes */
771   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )                        /* see notes */
772   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )                        /* see notes */
773   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )                        /* see notes */
808774
809   PORT_START      /* IN0 */
810   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON7 ) PORT_PLAYER(1)   /* freeze */
811   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON4 ) PORT_PLAYER(1)   /* shift up */
812   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* shift down */
813   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
814   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
815   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
816   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
817   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
818
819   PORT_START      /* IN1 */
820   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)   /* "start lump" (lamp?) */
821   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)   /* "brake lump" (lamp?) */
822   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
823   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
824   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
825   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
826   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
827   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
828
829   PORT_START      /* IN2 */
830   TAITO_WGP_SYSTEM_INPUT
775   PORT_START_TAG("IN0")
776   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
777   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1)     /* shift up - see notes */
778   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(1)     /* shift down - see notes */
779   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(1)
831780   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
832781   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
833782   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
834783   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
835784
836   PORT_START      /* fake inputs, allowing digital steer etc. */
837   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
838   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
839   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
840   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
841   PORT_DIPNAME( 0x10, 0x10, "Steering type" )
842   PORT_DIPSETTING(    0x10, "Digital" )
843   PORT_DIPSETTING(    0x00, "Analogue" )
844   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* accel */
845   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* brake */
846
847/* It's not clear for accel and brake which is the input and
848   which the offset, but that doesn't matter. These continuous
849   inputs are replaced by discrete values derived from the fake
850   input port above, so keyboard control is feasible. */
851
852//  PORT_START  /* accel, 0-255 */
853//  PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
854
855   PORT_START   /* steer */
856   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
857
858//  PORT_START  /* steer offset */
859
860//  PORT_START  /* accel offset */
861
862//  PORT_START  /* brake, 0-0x30: needs to start at 0xff; then 0xcf is max brake */
863//  PORT_BIT( 0xff, 0xff, IPT_AD_STICK_X ) PORT_MINMAX(0xcf,0xff) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(2)
864
865   PORT_START   /* unknown */
866   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(2)
867INPUT_PORTS_END
868
869/* Same as 'wgp', but different coinage */
870INPUT_PORTS_START( wgpj )
871   PORT_START /* DSW A */
872   PORT_DIPNAME( 0x01, 0x01, "Motor Test" )            // Only available in "test mode"
873   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
874   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
875   TAITO_WGP_DSWA_2_4
876   TAITO_COINAGE_JAPAN_NEW_8
877
878   PORT_START /* DSW B */
879   TAITO_DIFFICULTY_8
880   PORT_DIPNAME( 0x04, 0x04, "Shift Pattern Select" )
881   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
882   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
883   PORT_DIPNAME( 0x08, 0x08, "Slave / Master ???" )
884   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
885   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
886   PORT_DIPNAME( 0x10, 0x10, "Communication" )
887   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
888   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
889   WGP_MACHINE_ID_8
890
891   PORT_START      /* IN0 */
892   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON7 ) PORT_PLAYER(1)   /* freeze */
893   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON4 ) PORT_PLAYER(1)   /* shift up */
894   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* shift down */
895   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
896   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
897   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
898   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
899   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
900
901   PORT_START      /* IN1 */
902   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)   /* "start lump" (lamp?) */
903   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)   /* "brake lump" (lamp?) */
904   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
905   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
906   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
907   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
908   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
909   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
910
911   PORT_START      /* IN2 */
912   TAITO_WGP_SYSTEM_INPUT
785   PORT_START_TAG("IN1")
786   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
787   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
788   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
789   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
913790   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
914791   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
915792   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
916793   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
917794
918   PORT_START      /* fake inputs, allowing digital steer etc. */
919   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
920   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
921   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
922   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
923   PORT_DIPNAME( 0x10, 0x10, "Steering type" )
924   PORT_DIPSETTING(    0x10, "Digital" )
925   PORT_DIPSETTING(    0x00, "Analogue" )
926   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* accel */
927   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* brake */
928
929/* It's not clear for accel and brake which is the input and
930   which the offset, but that doesn't matter. These continuous
931   inputs are replaced by discrete values derived from the fake
932   input port above, so keyboard control is feasible. */
933
934//  PORT_START  /* accel, 0-255 */
935//  PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
936
937   PORT_START   /* steer */
938   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
939
940//  PORT_START  /* steer offset */
941
942//  PORT_START  /* accel offset */
943
944//  PORT_START  /* brake, 0-0x30: needs to start at 0xff; then 0xcf is max brake */
945//  PORT_BIT( 0xff, 0xff, IPT_AD_STICK_X ) PORT_MINMAX(0xcf,0xff) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(2)
946
947   PORT_START   /* unknown */
948   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(2)
795   PORT_START_TAG("IN2")
796   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)                      /* brake */
797   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
798   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
799   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)                      /* accel */
800   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
801   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
802   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
803   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
949804INPUT_PORTS_END
950805
951INPUT_PORTS_START( wgpjoy )
952   PORT_START /* DSW A */
953   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
954   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
955   TAITO_WGP_DSWA_2_4
956   TAITO_COINAGE_JAPAN_NEW_8
806INPUT_PORTS_START( wgp_no_joy_generic )
807   PORT_INCLUDE(wgp_joy_generic)
957808
958   PORT_START /* DSW B */
959   TAITO_DIFFICULTY_8
960   PORT_DIPNAME( 0x04, 0x04, "Shift Pattern Select" )
961   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
962   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
963   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
964   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
965   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
966   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
809   PORT_MODIFY("DSWB")
810   PORT_DIPNAME( 0x10, 0x10, "Communication" )
967811   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
968812   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
969   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
970   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
971   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
972   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
973   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
974   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
975   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
976   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
977   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
813   PORT_DIPNAME( 0xe0, 0xe0, "Machine ID" )
814   PORT_DIPSETTING(    0xe0, "1" )
815   PORT_DIPSETTING(    0xc0, "2" )
816   PORT_DIPSETTING(    0xa0, "3" )
817   PORT_DIPSETTING(    0x80, "4" )
818   PORT_DIPSETTING(    0x60, "5" )
819   PORT_DIPSETTING(    0x40, "6" )
820   PORT_DIPSETTING(    0x20, "7" )
821   PORT_DIPSETTING(    0x00, "8" )
978822
979   PORT_START      /* IN0 */
980   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
981   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
982   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
983   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
984   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
985   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
986   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
987   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
823   PORT_MODIFY("IN0")
824   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F1)
825   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)                        /* shift up - see notes */
826   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)                        /* shift down - see notes */
827   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
988828
989   PORT_START      /* IN1, is it read? */
990   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
991   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
992   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
993   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
994   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
995   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
996   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
997   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
998
999   PORT_START      /* IN2 */
1000   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
829   PORT_MODIFY("IN2")
830   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
1001831   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
1002832   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1003   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1004   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1005   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1006   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1007   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
833   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1008834
1009   PORT_START   /* doesn't exist */
835   PORT_START_TAG(STEER_PORT_TAG)
836   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
1010837
1011   PORT_START   /* doesn't exist */
838   PORT_START_TAG(UNKNOWN_PORT_TAG)
839   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(2)
840
841   /* fake inputs, allowing digital steer etc. */
842   PORT_START_TAG(FAKE_PORT_TAG)
843   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )  PORT_4WAY PORT_PLAYER(1)
844   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
845   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_4WAY PORT_PLAYER(1)
846   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )  PORT_4WAY PORT_PLAYER(1)
847   PORT_CONFNAME( 0x10, 0x10, "Steering type" )
848   PORT_CONFSETTING(    0x10, "Digital" )
849   PORT_CONFSETTING(    0x00, "Analogue" )
850   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)                     /* accel */
851   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)                     /* brake */
1012852INPUT_PORTS_END
1013853
1014/* Same as 'wgpj', but no "Motor Test" Dip Switch (DSWA 0) */
1015INPUT_PORTS_START( wgp2 )   /* Wgp2 has no "lumps" ? */
1016   PORT_START /* DSW A */
1017   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1018   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1019   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1020   TAITO_WGP_DSWA_2_4
1021   TAITO_COINAGE_JAPAN_NEW_8
1022854
1023   PORT_START /* DSW B */
1024   TAITO_DIFFICULTY_8
1025   PORT_DIPNAME( 0x04, 0x04, "Shift Pattern Select" )
1026   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1027   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1028   PORT_DIPNAME( 0x08, 0x08, "Slave / Master ???" )
1029   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1030   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1031   PORT_DIPNAME( 0x10, 0x10, "Communication" )
1032   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1033   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1034   WGP_MACHINE_ID_8
855INPUT_PORTS_START( wgp )
856   PORT_INCLUDE(wgp_no_joy_generic)
1035857
1036   PORT_START      /* IN0 */
1037   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON7 ) PORT_PLAYER(1)   /* freeze */
1038   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON4 ) PORT_PLAYER(1)   /* shift up */
1039   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* shift down */
1040   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
1041   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1042   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1043   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1044   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
858   /* 0x180000 -> 0x10bf16 and 0x140010 (shared RAM) */
859   PORT_MODIFY("DSWA")
860   TAITO_COINAGE_US
1045861
1046   PORT_START      /* IN1 */
1047   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)   /* "start lump" (lamp?) */
1048   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)   /* "brake lump" (lamp?) */
1049   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1050   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1051   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1052   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1053   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1054   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
862   /* 0x180002 -> 0x10bf18 and 0x140012 (shared RAM) : DSWB */
1055863
1056   PORT_START      /* IN2 */
1057   TAITO_WGP_SYSTEM_INPUT
1058   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1059   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1060   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1061   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
864   PORT_MODIFY("IN1")
865   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)                    /* "start lump" (lamp?) - test mode only */
866   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)                    /* "brake lump" (lamp?) - test mode only */
867INPUT_PORTS_END
1062868
1063   PORT_START      /* fake inputs, allowing digital steer etc. */
1064   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
1065   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
1066   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
1067   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
1068   PORT_DIPNAME( 0x10, 0x10, "Steering type" )
1069   PORT_DIPSETTING(    0x10, "Digital" )
1070   PORT_DIPSETTING(    0x00, "Analogue" )
1071   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* accel */
1072   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* brake */
869INPUT_PORTS_START( wgpj )
870   PORT_INCLUDE(wgp)
1073871
1074/* It's not clear for accel and brake which is the input and
1075   which the offset, but that doesn't matter. These continuous
1076   inputs are replaced by discrete values derived from the fake
1077   input port above, so keyboard control is feasible. */
872   PORT_MODIFY("DSWA")
873   TAITO_COINAGE_JAPAN_NEW
874INPUT_PORTS_END
1078875
1079//  PORT_START  /* accel, 0-255 */
1080//  PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
876INPUT_PORTS_START( wgpjoy )
877   PORT_INCLUDE(wgp_joy_generic)
1081878
1082   PORT_START   /* steer */
1083   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_REVERSE PORT_PLAYER(1)
879   /* 0x180000 -> 0x10bf1a and 0x140010 (shared RAM) */
880   PORT_MODIFY("DSWA")
881   TAITO_COINAGE_JAPAN_NEW
1084882
1085//  PORT_START  /* steer offset */
883   /* 0x180002 -> 0x10bf1c and 0x140012 (shared RAM) : DSWB*/
884INPUT_PORTS_END
1086885
1087//  PORT_START  /* accel offset */
886INPUT_PORTS_START( wgp2 )
887   PORT_INCLUDE(wgp_no_joy_generic)
1088888
1089//  PORT_START  /* brake, 0-0x30: needs to start at 0xff; then 0xcf is max brake */
1090//  PORT_BIT( 0xff, 0xff, IPT_AD_STICK_X ) PORT_MINMAX(0xcf,0xff) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(2)
889   /* 0x180000 -> 0x107d3a.b (-$2c6,A5) and 0x140018 (shared RAM) */
890   PORT_MODIFY("DSWA")
891   TAITO_COINAGE_JAPAN_NEW
1091892
1092   PORT_START   /* unknown */
1093   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(2)
893   /* 0x180002 -> 0x107d3b.b (-$2c5,A5) and 0x140012 (shared RAM) : DSWB */
1094894INPUT_PORTS_END
1095895
1096896
r869r870
14981298
14991299GAME( 1989, wgp,      0,      wgp,    wgp,    wgp,    ROT0, "Taito America Corporation", "World Grand Prix (US)", GAME_IMPERFECT_GRAPHICS )
15001300GAME( 1989, wgpj,     wgp,    wgp,    wgpj,   wgp,    ROT0, "Taito Corporation", "World Grand Prix (Japan)", GAME_IMPERFECT_GRAPHICS )
1501GAME( 1989, wgpjoy,   wgp,    wgp,    wgpjoy, wgp,    ROT0, "Taito Corporation", "World Grand Prix (joystick version set 1) (Japan)", GAME_IMPERFECT_GRAPHICS )
1502GAME( 1989, wgpjoya,  wgp,    wgp,    wgpjoy, wgp,    ROT0, "Taito Corporation", "World Grand Prix (joystick version set 2) (Japan)", GAME_IMPERFECT_GRAPHICS )
1301GAME( 1989, wgpjoy,   wgp,    wgp,    wgpjoy, wgp,    ROT0, "Taito Corporation", "World Grand Prix (joystick version) (Japan, set 1)", GAME_IMPERFECT_GRAPHICS )
1302GAME( 1989, wgpjoya,  wgp,    wgp,    wgpjoy, wgp,    ROT0, "Taito Corporation", "World Grand Prix (joystick version) (Japan, set 2)", GAME_IMPERFECT_GRAPHICS )
15031303GAME( 1990, wgp2,     wgp,    wgp2,   wgp2,   wgp2,   ROT0, "Taito Corporation", "World Grand Prix 2 (Japan)", GAME_IMPERFECT_GRAPHICS )
15041304
src/mame/drivers/scregg.c
r869r870
237237   MDRV_CPU_VBLANK_INT(irq0_line_hold,16)
238238
239239   MDRV_SCREEN_REFRESH_RATE(57)
240   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072)        /* frames per second, vblank duration taken from Burger Time */)
240   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072)        /* frames per second, vblank duration taken from Burger Time */)
241241
242242   /* video hardware */
243243   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
270270   MDRV_CPU_VBLANK_INT(irq0_line_hold,16)
271271
272272   MDRV_SCREEN_REFRESH_RATE(57)
273   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072)        /* frames per second, vblank duration taken from Burger Time */)
273   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072)        /* frames per second, vblank duration taken from Burger Time */)
274274
275275   /* video hardware */
276276   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/dec0.c
r869r870
3333    Gouky's patch for Bad Dudes & YM3812 information!
3434    Thanks to JC Alexander for fix to Robocop ending!
3535
36ToDo:
37  Hook up the 68705 in Midnight Resistance (bootleg)
38
3639***************************************************************************/
3740
3841#include "driver.h"
r869r870
937940   MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem)
938941
939942   MDRV_SCREEN_REFRESH_RATE(57.41)
940   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
943   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
941944
942945   /* video hardware */
943946   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
980983   MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem)
981984
982985   MDRV_SCREEN_REFRESH_RATE(57.41)
983   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
986   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
984987
985988   /* video hardware */
986989   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
10231026   MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem)
10241027
10251028   MDRV_SCREEN_REFRESH_RATE(57.41)
1026   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1029   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
10271030
10281031   /* video hardware */
10291032   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
10691072   MDRV_CPU_PROGRAM_MAP(robocop_sub_readmem,robocop_sub_writemem)
10701073
10711074   MDRV_SCREEN_REFRESH_RATE(57.41)
1072   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1075   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
10731076   MDRV_INTERLEAVE(50)   /* Interleave between HuC6280 & 68000 */
10741077
10751078   /* video hardware */
r869r870
11131116   MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem)
11141117
11151118   MDRV_SCREEN_REFRESH_RATE(57.41)
1116   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1119   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
11171120
11181121   /* video hardware */
11191122   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
11591162   MDRV_CPU_PROGRAM_MAP(hippodrm_sub_readmem,hippodrm_sub_writemem)
11601163
11611164   MDRV_SCREEN_REFRESH_RATE(57.41)
1162   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1165   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
11631166   MDRV_INTERLEAVE(5)   /* Interleave between H6280 & 68000 */
11641167
11651168   /* video hardware */
r869r870
12031206   MDRV_CPU_PROGRAM_MAP(slyspy_s_readmem,slyspy_s_writemem)
12041207
12051208   MDRV_SCREEN_REFRESH_RATE(57.41)
1206   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1209   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
12071210
12081211   /* video hardware */
12091212   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
12461249   MDRV_CPU_PROGRAM_MAP(midres_s_readmem,midres_s_writemem)
12471250
12481251   MDRV_SCREEN_REFRESH_RATE(57.41)
1249   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1252   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 57.41 Hz, 529us Vblank */)
12501253
12511254   /* video hardware */
12521255   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
22222225XTALs 16MHz & 12MHz
222322262x 8 position DSWs
22242227
2225rom10 is missing
2228rom10 is missing (another PCB was found and dumped)
22262229*/
22272230
22282231ROM_START( midresb )
r869r870
22302233   ROM_LOAD16_BYTE( "14.bin",         0x00000, 0x10000, CRC(d9c0f06f) SHA1(23cdc3e0613fed4e3e35094884b716d2507d59c8) )
22312234   ROM_LOAD16_BYTE( "13.bin",         0x20000, 0x10000, CRC(d1bb2cd6) SHA1(6d4afd8dd8c4c3e90de199358da27108286637e2) )
22322235   ROM_LOAD16_BYTE( "11.bin",         0x00001, 0x10000, CRC(1909081a) SHA1(a8cfa551b55830f3cc32e52c9a855ca525e1ab3f) )
2233   ROM_LOAD16_BYTE( "10.bin",         0x20001, 0x10000, NO_DUMP ) // missing
2236   ROM_LOAD16_BYTE( "10.bin",         0x20001, 0x10000, CRC(42ccdd0d) SHA1(ef17cc984a8d57e9c52877f4e9b78e9976f99033) )
22342237   ROM_LOAD16_BYTE( "12.bin",         0x40000, 0x10000, CRC(1e85a68d) SHA1(9ff778d023523302f408d80f1cbd3a7c49c044b0) )
22352238   ROM_LOAD16_BYTE( "9.bin",          0x40001, 0x10000, CRC(1587bc2a) SHA1(0ca2abccfc52b0071b0741e1498c34d765fe38da) )
22362239
r869r870
23782381GAME( 1989, midres,   0,        midres,   midres,   0,        ROT0,   "Data East Corporation", "Midnight Resistance (World)", 0 )
23792382GAME( 1989, midresu,  midres,   midres,   midres,   0,        ROT0,   "Data East USA",         "Midnight Resistance (US)", 0 )
23802383GAME( 1989, midresj,  midres,   midres,   midres,   0,        ROT0,   "Data East Corporation", "Midnight Resistance (Japan)", 0 )
2381GAME( 1989, midresb,  midres,   midres,   midres,   0,        ROT0,   "bootleg",               "Midnight Resistance (bootleg with 68705)", GAME_NOT_WORKING ) // missing 1 prg rom
2384GAME( 1989, midresb,  midres,   midres,   midres,   0,        ROT0,   "bootleg",               "Midnight Resistance (bootleg with 68705)", GAME_NOT_WORKING ) // need to hook up 68705
23822385GAME( 1990, bouldash, 0,        slyspy,   bouldash, slyspy,   ROT0,   "Data East Corporation (licensed from First Star)", "Boulder Dash / Boulder Dash Part 2 (World)", 0 )
23832386GAME( 1990, bouldshj, bouldash, slyspy,   bouldash, slyspy,   ROT0,   "Data East Corporation (licensed from First Star)", "Boulder Dash / Boulder Dash Part 2 (Japan)", 0 )
src/mame/drivers/opwolf.c
r869r870
2929would be used.
3030
3131
32Stephh's notes (based on the game M68000 code and some tests) :
33
341) 'opwolf' and 'opwolfu'
35
36  - Region stored at 0x03fffe.w
37  - Sets :
38      * 'opwolf'  : region = 0x0003
39      * 'opwolfu' : region = 0x0002
40  - These 2 games are 100% the same, only region and gun offsets differ !
41  - Coinage relies on the region (code at 0x00bea4) :
42      * 0x0001 (Japan) and 0x0002 (US) use TAITO_COINAGE_JAPAN_OLD
43      * 0x0003 (World) and 0x0004 (Japan, licenced to Taito America ?) use TAITO_COINAGE_WORLD
44  - Gun offsets are stored at 0x03ffaf.b (Y) and 0x03ffb1.b (X);
45    these values are checked via routine at 0x000b76
46  - Notice screen only if region = 0x0001
47  - When "Language" Dip Switch is set to Japanese, you can also select your starting level;
48    however, only the 4 first levels are available ! Correct behaviour ?
49
50
512) 'opwolfb'
52
53  - Region stored at 0x03fffe.w
54  - Sets :
55      * 'opwolfb' : region = 0x0003
56  - Comparison with 'opwolf' :
57      * gun offsets are the same (so why are they different in the INIT function ?)
58      * all reference to TAITO and "Operation Wolf" have been changed or "blanked"
59      * "(c) 1988 BEAR CORPORATION KOREA" / "ALL RIGHTS RESERVED"
60      * ROM check test "noped" (code at 0x00bb72)
61  - Notes on bootleg c-chip (similar to what is in machine/opwolf.c) :
62      * always Engish language (thus the Dip Switch change to "Unused")
63      * round 4 in "demo mode" instead of round 5
64      * "service" button doesn't add credits (it works in the "test mode" though)
65      * if you die after round 6, difficulty isn't reset for the next game
66
67
3268TODO
3369====
3470
r869r870
4985***************************************************************************/
5086
5187#include "driver.h"
88#include "taitoipt.h"
5289#include "video/taitoic.h"
5390#include "audio/taitosnd.h"
5491#include "sound/2151intf.h"
5592#include "sound/msm5205.h"
5693
94int opwolf_region;
95
5796static UINT8 *cchip_ram;
5897static UINT8 adpcm_b[0x08];
5998static UINT8 adpcm_c[0x08];
r869r870
85124                GAME INPUTS
86125**********************************************************/
87126
127#define P1X_PORT_TAG     "P1X"
128#define P1Y_PORT_TAG     "P1Y"
129
130static READ16_HANDLER( opwolf_in_r )
131{
132   static const char *inname[2] = { "IN0", "IN1" };
133   return readinputportbytag(inname[offset]);
134}
135
136static READ16_HANDLER( opwolf_dsw_r )
137{
138   static const char *dswname[2] = { "DSWA", "DSWB" };
139   return readinputportbytag(dswname[offset]);
140}
141
88142static READ16_HANDLER( opwolf_lightgun_r )
89143{
90144   int scaled;
r869r870
92146   switch (offset)
93147   {
94148      case 0x00:   /* P1X - Have to remap 8 bit input value, into 0-319 visible range */
95         scaled=(input_port_4_word_r(0,mem_mask) * 320 ) / 256;
149         scaled=(readinputportbytag(P1X_PORT_TAG) * 320 ) / 256;
96150         return (scaled + 0x15 + opwolf_gun_xoffs);
97151      case 0x01:   /* P1Y */
98         return (input_port_5_word_r(0,mem_mask) - 0x24 + opwolf_gun_yoffs);
152         return (readinputportbytag(P1Y_PORT_TAG) - 0x24 + opwolf_gun_yoffs);
99153   }
100154
101155   return 0xff;
r869r870
103157
104158static READ8_HANDLER( z80_input1_r )
105159{
106   return input_port_0_word_r(0,0);   /* irrelevant mirror ? */
160   return readinputportbytag("IN0");   /* irrelevant mirror ? */
107161}
108162
109163static READ8_HANDLER( z80_input2_r )
110164{
111   return input_port_0_word_r(0,0);   /* needed for coins */
165   return readinputportbytag("IN0");   /* needed for coins */
112166}
113167
114168
r869r870
132186   AM_RANGE(0x0f0802, 0x0f0803) AM_MIRROR(0xf000) AM_READ(opwolf_cchip_status_r)
133187   AM_RANGE(0x100000, 0x107fff) AM_READ(MRA16_RAM)   /* RAM */
134188   AM_RANGE(0x200000, 0x200fff) AM_READ(paletteram16_word_r)
135   AM_RANGE(0x380000, 0x380001) AM_READ(input_port_2_word_r)   /* DSW A */
136   AM_RANGE(0x380002, 0x380003) AM_READ(input_port_3_word_r)   /* DSW B */
189   AM_RANGE(0x380000, 0x380003) AM_READ(opwolf_dsw_r)   /* dip switches */
137190   AM_RANGE(0x3a0000, 0x3a0003) AM_READ(opwolf_lightgun_r)   /* lightgun, read at $11e0/6 */
138191   AM_RANGE(0x3e0000, 0x3e0001) AM_READ(MRA16_NOP)
139192   AM_RANGE(0x3e0002, 0x3e0003) AM_READ(taitosound_comm16_msb_r)
r869r870
163216
164217static ADDRESS_MAP_START( opwolfb_readmem, ADDRESS_SPACE_PROGRAM, 16 )
165218   AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
166   AM_RANGE(0x0f0008, 0x0f0009) AM_READ(input_port_0_word_r)   /* IN0 */
167   AM_RANGE(0x0f000a, 0x0f000b) AM_READ(input_port_1_word_r)   /* IN1 */
219   AM_RANGE(0x0f0008, 0x0f000b) AM_READ(opwolf_in_r)   /* coins and buttons */
168220   AM_RANGE(0x0ff000, 0x0fffff) AM_READ(cchip_r)
169221   AM_RANGE(0x100000, 0x107fff) AM_READ(MRA16_RAM)   /* RAM */
170222   AM_RANGE(0x200000, 0x200fff) AM_READ(paletteram16_word_r)
171   AM_RANGE(0x380000, 0x380001) AM_READ(input_port_2_word_r)   /* DSW A */
172   AM_RANGE(0x380002, 0x380003) AM_READ(input_port_3_word_r)   /* DSW B */
223   AM_RANGE(0x380000, 0x380003) AM_READ(opwolf_dsw_r)   /* dip switches */
173224   AM_RANGE(0x3a0000, 0x3a0003) AM_READ(opwolf_lightgun_r)   /* lightgun, read at $11e0/6 */
174225   AM_RANGE(0x3e0000, 0x3e0001) AM_READ(MRA16_NOP)
175226   AM_RANGE(0x3e0002, 0x3e0003) AM_READ(taitosound_comm16_msb_r)
r869r870
342393             INPUT PORTS, DIPs
343394***********************************************************/
344395
345#define TAITO_COINAGE_WORLD_8 \
346   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
347   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
348   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
349   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
350   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
351   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
352   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
353   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
354   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
355   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
396INPUT_PORTS_START( opwolf )
397   /* 0x380000 -> 0x0ff028 (-$fd8,A5) (C-chip) */
398   PORT_START_TAG("DSWA")
399   PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )
400   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Allow_Continue ) )
401   PORT_DIPSETTING(    0x02, DEF_STR( No ) )
402   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
403   TAITO_DSWA_BITS_2_TO_3
404   TAITO_COINAGE_WORLD
356405
357#define TAITO_DIFFICULTY_8 \
358   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
359   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
360   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
361   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
362   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
406   /* 0x380002 -> 0x0ff02a (-$fd6,A5) (C-chip) */
407   PORT_START_TAG("DSWB")
408   TAITO_DIFFICULTY
409   PORT_DIPNAME( 0x0c, 0x0c, "Ammo Magazines at Start" )
410   PORT_DIPSETTING(    0x00, "4" )
411   PORT_DIPSETTING(    0x04, "5" )
412   PORT_DIPSETTING(    0x0c, "6" )
413   PORT_DIPSETTING(    0x08, "7" )
414   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
415   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
416   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
417   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
418   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
419   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
363420
364INPUT_PORTS_START( opwolf )
365   PORT_START   /* IN0 */
421   PORT_START_TAG("IN0")
366422   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
367423   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
368424   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r869r870
372428   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
373429   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
374430
375   PORT_START   /* IN1 */
431   PORT_START_TAG("IN1")
376432   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON1 )
377433   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON2 )
378434   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
r869r870
382438   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
383439   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
384440
385   PORT_START /* DSW A */
386   PORT_DIPNAME( 0x01, 0x01, "NY Conversion of Upright" )
387   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
388   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
389   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Allow_Continue ) )
390   PORT_DIPSETTING(    0x02, DEF_STR( No ))
391   PORT_DIPSETTING(    0x00, DEF_STR( Yes ))
392   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
393   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
394   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
395   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
396   TAITO_COINAGE_WORLD_8
397
398   PORT_START /* DSW B */
399   TAITO_DIFFICULTY_8
400   PORT_DIPNAME( 0x0c, 0x0c, "Ammo Magazines at Start" )
401   PORT_DIPSETTING(    0x00, "4" )
402   PORT_DIPSETTING(    0x04, "5" )
403   PORT_DIPSETTING(    0x0c, "6" )
404   PORT_DIPSETTING(    0x08, "7" )
405   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )   // Manual says all 3 unused
406   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
407   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
408   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
409   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
410   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
411   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
412   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
413   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
414   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
415   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
416   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
417
418   PORT_START   /* P1X (span allows you to shoot enemies behind status bar) */
441   /* P1X (span allows you to shoot enemies behind status bar) */
442   PORT_START_TAG(P1X_PORT_TAG)
419443   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
420444
421   PORT_START   /* P1Y (span allows you to be slightly offscreen) */
445   /* P1Y (span allows you to be slightly offscreen) */
446   PORT_START_TAG(P1Y_PORT_TAG)
422447   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
423448INPUT_PORTS_END
424449
450INPUT_PORTS_START( opwolfu )
451   PORT_INCLUDE( opwolf )
425452
453   PORT_MODIFY( "DSWA" )
454   TAITO_COINAGE_JAPAN_OLD
455INPUT_PORTS_END
456
457INPUT_PORTS_START( opwolfb )
458   PORT_INCLUDE( opwolf )
459
460   PORT_MODIFY( "DSWB" )
461   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )                        /* see notes */
462INPUT_PORTS_END
463
464
426465/**************************************************************
427466                GFX DECODING
428467**************************************************************/
r869r870
712751{
713752   UINT16* rom=(UINT16*)memory_region(REGION_CPU1);
714753
754   opwolf_region = rom[0x03fffe / 2] & 0xff;
755
715756   opwolf_cchip_init();
716757
717758   // World & US version have different gun offsets, presumably slightly different gun hardware
718   opwolf_gun_xoffs = 0xec - (rom[0x1ffd8]&0xff);
719   opwolf_gun_yoffs = 0x1c - (rom[0x1ffd7]&0xff);
759   opwolf_gun_xoffs = 0xec - (rom[0x03ffb0 / 2] & 0xff);
760   opwolf_gun_yoffs = 0x1c - (rom[0x03ffae / 2] & 0xff);
720761
721762   memory_configure_bank(10, 0, 4, memory_region(REGION_CPU2) + 0x10000, 0x4000);
722763}
r869r870
724765
725766static DRIVER_INIT( opwolfb )
726767{
768   UINT16* rom=(UINT16*)memory_region(REGION_CPU1);
769
770   opwolf_region = rom[0x03fffe / 2] & 0xff;
771
727772   /* bootleg needs different range of raw gun coords */
728773   opwolf_gun_xoffs = -2;
729774   opwolf_gun_yoffs = 17;
r869r870
732777}
733778
734779
735
736780/*    year  rom       parent    machine   inp       init */
737781GAME( 1987, opwolf,   0,        opwolf,   opwolf,   opwolf,   ROT0, "Taito Corporation Japan", "Operation Wolf (World)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
738GAME( 1987, opwolfu,  opwolf,   opwolf,   opwolf,   opwolf,   ROT0, "Taito America Corporation", "Operation Wolf (US)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
739GAME( 1987, opwolfb,  opwolf,   opwolfb,  opwolf,   opwolfb,  ROT0, "bootleg", "Operation Bear", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
782GAME( 1987, opwolfu,  opwolf,   opwolf,   opwolfu,  opwolf,   ROT0, "Taito America Corporation", "Operation Wolf (US)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
783GAME( 1987, opwolfb,  opwolf,   opwolfb,  opwolfb,  opwolfb,  ROT0, "bootleg", "Operation Bear", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
src/mame/drivers/pangofun.c
r869r870
118118   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
119119   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
120120   MDRV_SCREEN_REFRESH_RATE(60)
121   MDRV_SCREEN_VBLANK_TIME(0)
121   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
122122   MDRV_SCREEN_SIZE(64*8, 32*8)
123123   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
124124   MDRV_PALETTE_LENGTH(0x100)
src/mame/drivers/pmpoker.c
r869r870
11921192   ROM_LOAD( "517.7a",   0x1000, 0x0800, CRC(6e3e9b1d) SHA1(14eb8d14ce16719a6ad7d13db01e47c8f05955f0) )    /* cards deck gfx, bitplane3 */
11931193
11941194   ROM_REGION( 0x0100, REGION_PROMS, 0 )
1195   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, BAD_DUMP CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
1195   ROM_LOAD( "517_mb7052.9c",   0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) )
11961196ROM_END
11971197
11981198
src/mame/drivers/zaccaria.c
r869r870
272272}
273273
274274
275game_driver monymony_driver;
275extern game_driver driver_monymony;
276276
277277static READ8_HANDLER( zaccaria_prot1_r )
278278{
r869r870
285285         return 0x40;    /* Jack Rabbit */
286286
287287      case 6:
288         if (Machine->gamedrv == &monymony_driver)
288         if (Machine->gamedrv == &driver_monymony)
289289            return 0x70;    /* Money Money */
290290         return 0xa0;    /* Jack Rabbit */
291291
src/mame/drivers/tagteam.c
r869r870
281281   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)   /* IRQs are triggered by the main CPU */
282282
283283   MDRV_SCREEN_REFRESH_RATE(57)
284   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072))
284   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072))
285285
286286   /* video hardware */
287287   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/eolith.c
r869r870
262262   /* sound cpu */
263263
264264   MDRV_SCREEN_REFRESH_RATE(60)
265   MDRV_SCREEN_VBLANK_TIME(0)
265   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
266266
267267   MDRV_NVRAM_HANDLER(eolith)
268268
src/mame/drivers/ninjakd2.c
r869r870
481481   MDRV_CPU_IO_MAP(ninjakd2_sound_io,0)
482482
483483   MDRV_SCREEN_REFRESH_RATE(60)
484   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(10000))
484   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(10000))
485485
486486   /* video hardware */
487487   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/cubocd32.c
r869r870
7373   //MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
7474
7575   MDRV_SCREEN_REFRESH_RATE(59.997)
76   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
76   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
7777
7878   //MDRV_MACHINE_RESET(amiga)
7979   //MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/cbuster.c
r869r870
353353   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
354354
355355   MDRV_SCREEN_REFRESH_RATE(58)
356   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
356   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
357357
358358   /* video hardware */
359359   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/onetwo.c
r869r870
275275   MDRV_CPU_IO_MAP(sound_cpu_io,0)
276276
277277   MDRV_SCREEN_REFRESH_RATE(60)
278   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(16))
278   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(16))
279279
280280   /* video hardware */
281281   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/kncljoe.c
r869r870
187187   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
188188
189189   MDRV_SCREEN_REFRESH_RATE(60)
190   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1500))
190   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1500))
191191
192192   /* video hardware */
193193   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK)
src/mame/drivers/liberate.c
r869r870
161161 *
162162 *************************************/
163163
164#if 0
164165static ADDRESS_MAP_START( prosoccr_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
165166    AM_RANGE(0x0000, 0x01ff) AM_READ(MRA8_RAM)
166167   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
r869r870
175176   AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_1_w)
176177    AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM)
177178ADDRESS_MAP_END
179#endif
178180
179181static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
180182    AM_RANGE(0x0000, 0x01ff) AM_READ(MRA8_RAM)
r869r870
529531   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
530532
531533   MDRV_SCREEN_REFRESH_RATE(60)
532   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 529ms Vblank duration?? */)
534   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 529ms Vblank duration?? */)
533535   MDRV_INTERLEAVE(200)
534536
535537   /* video hardware */
r869r870
599601   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
600602
601603   MDRV_SCREEN_REFRESH_RATE(60)
602   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 529ms Vblank duration?? */)
604   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 529ms Vblank duration?? */)
603605   MDRV_INTERLEAVE(200)
604606
605607   /* video hardware */
src/mame/drivers/cvs.c
r869r870
383383   MDRV_CPU_IO_MAP(cvs_cpu2_io,0)
384384
385385   MDRV_SCREEN_REFRESH_RATE(60)
386   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1000))
386   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1000))
387387
388388   /* video hardware */
389389   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
419419***************************************************************************/
420420
421421ROM_START( cvs )
422   ROM_REGION( 0x8000, REGION_CPU1, ROMREGION_ERASE00 )
423   ROM_REGION( 0x2000, REGION_CPU2, ROMREGION_ERASE00 )
424
422425   ROM_REGION( 0x8000, REGION_CPU3, 0 )
423426   ROM_LOAD( "5b.bin",            0x0000, 0x0800, CRC(f055a624) SHA1(5dfe89d7271092e665cdd5cd59d15a2b70f92f43) )
424427
src/mame/drivers/turbo.c
r869r870
14071407   ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) )  /* sprite Y scaling */
14081408   ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) )  /* video timing */
14091409   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char colortable */
1410   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite colortable */
1410   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, BAD_DUMP CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite colortable */
14111411ROM_END
14121412
14131413
src/mame/drivers/rohga.c
r869r870
828828   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
829829
830830   MDRV_SCREEN_REFRESH_RATE(58)
831   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
831   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
832832
833833   /* video hardware */
834834   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
r869r870
871871   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
872872
873873   MDRV_SCREEN_REFRESH_RATE(58)
874   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
874   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
875875
876876   /* video hardware */
877877   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM )
r869r870
914914   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
915915
916916   MDRV_SCREEN_REFRESH_RATE(58)
917   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
917   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
918918
919919   /* video hardware */
920920   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM )
r869r870
957957   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
958958
959959   MDRV_SCREEN_REFRESH_RATE(58)
960   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
960   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
961961
962962   /* video hardware */
963963   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/nemesis.c
r869r870
22492249   MDRV_CPU_PROGRAM_MAP(sal_sound_readmem,sal_sound_writemem)
22502250
22512251   MDRV_SCREEN_REFRESH_RATE((18432000.0/4)/(288*264))      /* 60.606060 Hz */
2252   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC((264-256)*62.5))
2252   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS((264-256)*125/2))
22532253
22542254   MDRV_MACHINE_RESET(nemesis)
22552255
src/mame/drivers/progolf.c
r869r870
7777   AM_RANGE(0xb000, 0xffff) AM_ROM
7878ADDRESS_MAP_END
7979
80#if 0
8081static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
8182   AM_RANGE(0x0000, 0x03ff) AM_READ(MRA8_RAM)
8283   AM_RANGE(0xa000, 0xafff) AM_READ(soundlatch_r)
r869r870
9293   AM_RANGE(0xc000, 0xcfff) AM_WRITE(interrupt_enable_w)
9394   AM_RANGE(0xf000, 0xffff) AM_WRITE(MWA8_ROM)
9495ADDRESS_MAP_END
96#endif
9597
9698INPUT_PORTS_START( progolf )
9799   PORT_START
r869r870
207209//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
208210
209211   MDRV_SCREEN_REFRESH_RATE(57)
210   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072))
212   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072))
211213
212214   /* video hardware */
213215   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/stv.c
r869r870
27432743   MDRV_CPU_PROGRAM_MAP(sound_mem, 0)
27442744
27452745   MDRV_SCREEN_REFRESH_RATE(60)
2746   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(192))   // guess, needed to force video update after V-Blank OUT interrupt
2746   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(192))   // guess, needed to force video update after V-Blank OUT interrupt
27472747
27482748   MDRV_MACHINE_START(stv)
27492749   MDRV_MACHINE_RESET(stv)
src/mame/drivers/warriorb.c
r869r870
8888
8989[The 390LHC/130LNB functions are unknown].
9090
91
92Stephh's notes (based on the game M68000 code and some tests) :
93
941) 'darius2d' and 'drius2do'
95
96  - Region stored at 0x07fffe.w
97  - Sets :
98      * 'darius2d' : region = 0x0001
99      * 'drius2do' : region = 0x0001
100  - Comparison with 'darius2' :
101      * coinage routine at 0x013e3a ('darius2d') or 0x013da4 ('drius2do')
102      * same specific US coinage (4C_3C instead of 4C_1C for coinage)
103      * what used to be an "Invulnerability" Dip Switch in 'darius' is now unused
104        because the code to test it has been removed (not "noped")
105      * different joystick mapping : 2 UDLR joys instead of 2 UDRL joys
106      * same other notes as for 'darius2' (ninjaw.c driver)
107
108
1092) 'warriorb'
110
111  - Region stored at 0x0ffffe.w
112  - Sets :
113      * 'warriorb' : region = 0x0001
114  - Coinage relies on the region (code at 0x002614) :
115      * 0x0000 (?), 0x0001 (Japan) use TAITO_COINAGE_JAPAN_NEW
116      * 0x0002 (US) uses TAITO_COINAGE_US
117      * 0x0003 (World) uses TAITO_COINAGE_WORLD
118  - Additional Japanese text when region = 0x0001
119  - Notice screen only if region = 0x0001 or region = 0x0002
120  - FBI logo only if region = 0x0002
121  - US version doesn't reset score on continue, other versions do
122
123
91124TODO
92125====
93126
r869r870
111144***************************************************************************/
112145
113146#include "driver.h"
147#include "taitoipt.h"
114148#include "rendlay.h"
115149#include "cpu/m68000/m68000.h"
116150#include "video/taitoic.h"
r869r870
272306                     INPUT PORTS, DIPs
273307***********************************************************/
274308
275#define TAITO_COINAGE_JAPAN_8 \
276   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
277   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
278   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
279   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
280   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
281   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
282   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
283   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
284   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
285   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
286
287#define TAITO_COINAGE_JAPAN_NEW_8 \
288   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
289   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
290   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
291   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
292   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
293   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
294   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
295   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
296   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
297   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
298
299#define TAITO_DIFFICULTY_8 \
300   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
301   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
302   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
303   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
304   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
305
306#define WARRIORB_SYSTEM_INPUT \
307   PORT_START_TAG("IN0") \
308   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
309   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) \
310   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) \
311   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) \
312   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) \
313   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) \
314
315#define WARRIORB_PLAYERS_INPUT_1 \
316   PORT_START_TAG("IN1") \
317   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) \
318   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) \
319   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) \
320   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) \
321   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) \
322   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) \
323   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) \
324   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
325
326#define WARRIORB_PLAYERS_INPUT_2( freeze_button) \
327   PORT_START_TAG("IN2") \
328   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN ) \
329   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN ) \
330   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN ) \
331   PORT_BIT( 0x08, IP_ACTIVE_HIGH, freeze_button ) PORT_PLAYER(1) \
332   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1) \
333   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1) \
334   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2) \
335   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
336
337
338309INPUT_PORTS_START( darius2d )
310   /* 0x800000 -> 0x109e16 ($1e16,A5) and 0x109e1a ($1e1a,A5) */
339311   PORT_START_TAG("DSWA")
340   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) // used, but manual in japanese
312   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")    /* code at 0x0170f2 ('darius2d') or 0x01705c ('drius2do') */
341313   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
342314   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
343   PORT_DIPNAME( 0x02, 0x02, "Autofire" )
315   PORT_DIPNAME( 0x02, 0x02, "Auto Fire" ) PORT_DIPLOCATION("SW1:2")
344316   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
345317   PORT_DIPSETTING(    0x00, "Fast" )
346   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
347   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
348   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
349   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
350   TAITO_COINAGE_JAPAN_8
318   TAITO_DSWA_BITS_2_TO_3_LOC(SW1)
319   TAITO_COINAGE_JAPAN_OLD_LOC(SW1)
351320
321   /* 0x800002 -> 0x109e18 ($1e18,A5) and 0x109e1c ($1e1c,A5)  */
352322   PORT_START_TAG("DSWB")
353   TAITO_DIFFICULTY_8
354   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
355   PORT_DIPSETTING(    0x00, "every 500k" )
323   TAITO_DIFFICULTY_LOC(SW2)
324   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:3,4")
356325   PORT_DIPSETTING(    0x0c, "every 700k" )
357326   PORT_DIPSETTING(    0x08, "every 800k" )
358327   PORT_DIPSETTING(    0x04, "every 900k" )
359   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
328   PORT_DIPSETTING(    0x00, "every 1000k" )
329   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:5,6")
360330   PORT_DIPSETTING(    0x30, "3" )
361331   PORT_DIPSETTING(    0x20, "4" )
362332   PORT_DIPSETTING(    0x10, "5" )
363333   PORT_DIPSETTING(    0x00, "6" )
364   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )  // in manual
365   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
366   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
367   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) )
334   PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" )
335   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:8")
368336   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
369337   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
370338
371   /* IN0 */
372   WARRIORB_SYSTEM_INPUT
339   PORT_START_TAG("IN0")
340   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
341   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
342   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
343   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
344   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
345   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
373346   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
374347   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
375348
376   /* IN1 */
377   WARRIORB_PLAYERS_INPUT_1
349   PORT_START_TAG("IN1")
350   TAITO_JOY_DUAL_UDLR( 1, 2 )
378351
379   /* IN2 */
380   WARRIORB_PLAYERS_INPUT_2( IPT_BUTTON3 )
352   PORT_START_TAG("IN2")
353   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
354   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
355   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
356   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F1)
357   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
358   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)
359   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
360   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
381361INPUT_PORTS_END
382362
383363INPUT_PORTS_START( warriorb )
384   PORT_START_TAG("DSWA")
385   PORT_DIPNAME( 0x03, 0x03, "Vitality Recovery" ) //after finishing a level
364   PORT_INCLUDE(darius2d)
365
366   /* 0x800000 -> 0x202912.b (-$56ee,A5) */
367   PORT_MODIFY("DSWA")
368   PORT_DIPNAME( 0x03, 0x03, "Vitality Recovery" ) PORT_DIPLOCATION("SW1:1,2") /* table at 0x00d508 - 4 * 4 words */
386369   PORT_DIPSETTING(    0x02, "Less" )
387370   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
388371   PORT_DIPSETTING(    0x01, "More" )
389372   PORT_DIPSETTING(    0x00, "Most" )
390   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
391   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
392   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
393   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
394   TAITO_COINAGE_JAPAN_NEW_8
373   TAITO_DSWA_BITS_2_TO_3_LOC(SW1)
374   TAITO_COINAGE_JAPAN_NEW_LOC(SW1)
395375
396   PORT_START_TAG("DSWB")
397   TAITO_DIFFICULTY_8
398   PORT_DIPNAME( 0x04, 0x04, "Gold Sheep at" )
376   /* 0x800002 -> 0x202913.b (-$56ed,A5) */
377   PORT_MODIFY("DSWB")
378   TAITO_DIFFICULTY_LOC(SW2)
379   PORT_DIPNAME( 0x04, 0x04, "Gold Sheep at" ) PORT_DIPLOCATION("SW2:3")
399380   PORT_DIPSETTING(    0x04, "50k only" )
400   PORT_DIPSETTING(    0x00, "50k and every 70k" )
401   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )   //in manual
402   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
403   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
404   PORT_DIPNAME( 0x10, 0x10, "Player Starting Strength" )
381   PORT_DIPSETTING(    0x00, "50k then every 70k" )
382   PORT_DIPNAME( 0x08, 0x08, "Magic Energy Loss" ) PORT_DIPLOCATION("SW2:4")   /* code at 0x0587de - when BUTTON3 pressed */
383   PORT_DIPSETTING(    0x08, "Always Player" )
384   PORT_DIPSETTING(    0x00, "Player or Magician" )
385   PORT_DIPNAME( 0x10, 0x10, "Player Starting Strength" ) PORT_DIPLOCATION("SW2:5")
405386   PORT_DIPSETTING(    0x10, DEF_STR( Normal ) )
406387   PORT_DIPSETTING(    0x00, "Full" )
407   PORT_DIPNAME( 0x20, 0x20, "Magician appears" )
388   PORT_DIPNAME( 0x20, 0x20, "Magician appears" ) PORT_DIPLOCATION("SW2:6")
408389   PORT_DIPSETTING(    0x20, "When you get a Crystal" )
409390   PORT_DIPSETTING(    0x00, "Always" )
410   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
391   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:7")
411392   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
412393   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
413   PORT_DIPNAME( 0x80, 0x80, "Rounds" )
394   PORT_DIPNAME( 0x80, 0x80, "Rounds" ) PORT_DIPLOCATION("SW2:8")
414395   PORT_DIPSETTING(    0x80, "Normal (10-14, depends on skill)" )
415396   PORT_DIPSETTING(    0x00, "Long (14)" )
416397
417   /* IN0 */
418   WARRIORB_SYSTEM_INPUT
419   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   PORT_NAME("P1 Button 3 (Cheat)")/* Japanese version actually doesn't */
420   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   PORT_NAME("P2 Button 3 (Cheat)")/* have the third button */
421
422   /* IN1 */
423   WARRIORB_PLAYERS_INPUT_1
424
425   /* IN2 */
426   WARRIORB_PLAYERS_INPUT_2( IPT_BUTTON4 )
398   PORT_MODIFY("IN0")
399   /* Japanese version actually doesn't have the third button */
400   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   PORT_NAME("P1 Button 3 (Cheat)")
401   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   PORT_NAME("P2 Button 3 (Cheat)")
427402INPUT_PORTS_END
428403
429404
src/mame/drivers/bishi.c
r869r870
270270   MDRV_CPU_VBLANK_INT(bishi_interrupt, 2)
271271
272272   MDRV_SCREEN_REFRESH_RATE(60)
273   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1200))
273   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1200))
274274
275275   MDRV_MACHINE_START(bishi)
276276   MDRV_MACHINE_RESET(bishi)
src/mame/drivers/raiden.c
r869r870
4343#include "sound/3812intf.h"
4444#include "sound/okim6295.h"
4545
46READ8_HANDLER( raiden_background_r );
47READ8_HANDLER( raiden_foreground_r );
48WRITE8_HANDLER( raiden_background_w );
49WRITE8_HANDLER( raiden_foreground_w );
50WRITE8_HANDLER( raiden_text_w );
51WRITE8_HANDLER( raidena_text_w );
46WRITE16_HANDLER( raiden_background_w );
47WRITE16_HANDLER( raiden_foreground_w );
48WRITE16_HANDLER( raiden_text_w );
5249VIDEO_START( raiden );
5350VIDEO_START( raidena );
54WRITE8_HANDLER( raiden_control_w );
51WRITE16_HANDLER( raiden_control_w );
5552VIDEO_UPDATE( raiden );
5653
57static UINT8 *raiden_shared_ram;
58extern UINT8 *raiden_back_data,*raiden_fore_data,*raiden_scroll_ram;
54static UINT16 *raiden_shared_ram;
55extern UINT16 *raiden_back_data,*raiden_fore_data,*raiden_scroll_ram;
5956
6057/******************************************************************************/
6158
62static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
59static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
6360   AM_RANGE(0x00000, 0x06fff) AM_RAM
64   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
61   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
6562   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&raiden_shared_ram)
66   AM_RANGE(0x0b000, 0x0b000) AM_READ(input_port_1_r)
67   AM_RANGE(0x0b001, 0x0b001) AM_READ(input_port_2_r)
68   AM_RANGE(0x0b002, 0x0b002) AM_READ(input_port_3_r)
69   AM_RANGE(0x0b003, 0x0b003) AM_READ(input_port_4_r)
63   AM_RANGE(0x0b000, 0x0b001) AM_READ(input_port_1_word_r)
64   AM_RANGE(0x0b002, 0x0b003) AM_READ(input_port_2_word_r)
7065   AM_RANGE(0x0b000, 0x0b007) AM_WRITE(raiden_control_w)
71   AM_RANGE(0x0c000, 0x0c7ff) AM_WRITE(raiden_text_w) AM_BASE(&videoram)
72   AM_RANGE(0x0d000, 0x0d00d) AM_READWRITE(seibu_main_v30_r, seibu_main_v30_w)
73   AM_RANGE(0x0d060, 0x0d067) AM_WRITE(MWA8_RAM) AM_BASE(&raiden_scroll_ram)
66   AM_RANGE(0x0c000, 0x0c7ff) AM_WRITE(raiden_text_w) AM_BASE(&videoram16)
67   AM_RANGE(0x0d000, 0x0d00d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
68   AM_RANGE(0x0d060, 0x0d067) AM_WRITE(MWA16_RAM) AM_BASE(&raiden_scroll_ram)
7469   AM_RANGE(0xa0000, 0xfffff) AM_ROM
7570ADDRESS_MAP_END
7671
77static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 )
72static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 16 )
7873   AM_RANGE(0x00000, 0x01fff) AM_RAM
79   AM_RANGE(0x02000, 0x027ff) AM_READWRITE(raiden_background_r, raiden_background_w) AM_BASE(&raiden_back_data)
80   AM_RANGE(0x02800, 0x02fff) AM_READWRITE(raiden_foreground_r, raiden_foreground_w) AM_BASE(&raiden_fore_data)
81   AM_RANGE(0x03000, 0x03fff) AM_READWRITE(paletteram_r, paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
74   AM_RANGE(0x02000, 0x027ff) AM_READWRITE(MRA16_RAM, raiden_background_w) AM_BASE(&raiden_back_data)
75   AM_RANGE(0x02800, 0x02fff) AM_READWRITE(MRA16_RAM, raiden_foreground_w) AM_BASE(&raiden_fore_data)
76   AM_RANGE(0x03000, 0x03fff) AM_READWRITE(MRA16_RAM, paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
8277   AM_RANGE(0x04000, 0x04fff) AM_RAM AM_SHARE(1)
83   AM_RANGE(0x07ffe, 0x0afff) AM_WRITE(MWA8_NOP)
78   AM_RANGE(0x07ffe, 0x0afff) AM_WRITE(MWA16_NOP)
8479   AM_RANGE(0xc0000, 0xfffff) AM_ROM
8580ADDRESS_MAP_END
8681
8782/************************* Alternate board set ************************/
8883
89static ADDRESS_MAP_START( alt_map, ADDRESS_SPACE_PROGRAM, 8 )
84static ADDRESS_MAP_START( alt_map, ADDRESS_SPACE_PROGRAM, 16 )
9085   AM_RANGE(0x00000, 0x06fff) AM_RAM
91   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
86   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
9287   AM_RANGE(0x08000, 0x08fff) AM_RAM AM_SHARE(1) AM_BASE(&raiden_shared_ram)
93   AM_RANGE(0x0a000, 0x0a00d) AM_READWRITE(seibu_main_v30_r, seibu_main_v30_w)
88   AM_RANGE(0x0a000, 0x0a00d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
9489   AM_RANGE(0x0b000, 0x0b007) AM_WRITE(raiden_control_w)
95   AM_RANGE(0x0c000, 0x0c7ff) AM_WRITE(raidena_text_w) AM_BASE(&videoram)
96   AM_RANGE(0x0e000, 0x0e000) AM_READ(input_port_1_r)
97   AM_RANGE(0x0e001, 0x0e001) AM_READ(input_port_2_r)
98   AM_RANGE(0x0e002, 0x0e002) AM_READ(input_port_3_r)
99   AM_RANGE(0x0e003, 0x0e003) AM_READ(input_port_4_r)
100   AM_RANGE(0x0f000, 0x0f035) AM_WRITE(MWA8_RAM) AM_BASE(&raiden_scroll_ram)
90   AM_RANGE(0x0c000, 0x0c7ff) AM_WRITE(raiden_text_w) AM_BASE(&videoram16)
91   AM_RANGE(0x0e000, 0x0e001) AM_READ(input_port_1_word_r)
92   AM_RANGE(0x0e002, 0x0e003) AM_READ(input_port_2_word_r)
93   AM_RANGE(0x0f000, 0x0f035) AM_WRITE(MWA16_RAM) AM_BASE(&raiden_scroll_ram)
10194   AM_RANGE(0xa0000, 0xfffff) AM_ROM
10295ADDRESS_MAP_END
10396
r869r870
107100   SEIBU_COIN_INPUTS   /* Must be port 0: coin inputs read through sound cpu */
108101
109102   PORT_START   /* IN0 */
110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
111   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
112   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
113   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
114   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
115   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
116   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
117   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
103   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
104   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
105   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
106   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
107   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
108   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
109   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
110   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
111   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
112   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
113   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
114   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
115   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
116   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
117   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
118   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
118119
119   PORT_START   /* IN1 */
120   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
121   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
122   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
123   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
124   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
125   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
126   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
127   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
128
129120   PORT_START   /* Dip switch A */
130   PORT_DIPNAME( 0x01, 0x01, "Coin Mode" )
131   PORT_DIPSETTING(    0x01, "A" )
132   PORT_DIPSETTING(    0x00, "B" )
121   PORT_DIPNAME( 0x0001, 0x0001, "Coin Mode" )
122   PORT_DIPSETTING(    0x0001, "A" )
123   PORT_DIPSETTING(    0x0000, "B" )
133124   /* Coin Mode A */
134   PORT_DIPNAME( 0x1e, 0x1e, DEF_STR( Coinage ) )
135   PORT_DIPSETTING(    0x14, DEF_STR( 6C_1C ) )
136   PORT_DIPSETTING(    0x16, DEF_STR( 5C_1C ) )
137   PORT_DIPSETTING(    0x18, DEF_STR( 4C_1C ) )
138   PORT_DIPSETTING(    0x1a, DEF_STR( 3C_1C ) )
139   PORT_DIPSETTING(    0x02, DEF_STR( 8C_3C ) )
140   PORT_DIPSETTING(    0x1c, DEF_STR( 2C_1C ) )
141   PORT_DIPSETTING(    0x04, DEF_STR( 5C_3C ) )
142   PORT_DIPSETTING(    0x06, DEF_STR( 3C_2C ) )
143   PORT_DIPSETTING(    0x1e, DEF_STR( 1C_1C ) )
144   PORT_DIPSETTING(    0x08, DEF_STR( 2C_3C ) )
145   PORT_DIPSETTING(    0x12, DEF_STR( 1C_2C ) )
146   PORT_DIPSETTING(    0x10, DEF_STR( 1C_3C ) )
147   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_4C ) )
148   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_5C ) )
149   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
150   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
151
152   /* Coin Mode B */
153/*  PORT_DIPNAME( 0x06, 0x06, DEF_STR( Coin_A ) )
154    PORT_DIPSETTING(    0x00, "5C/1C or Free if Coin B too" )
155    PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
156    PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
157    PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
158    PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) )
159    PORT_DIPSETTING(    0x18, DEF_STR( 1C_2C ) )
160    PORT_DIPSETTING(    0x10, DEF_STR( 1C_3C ) )
161    PORT_DIPSETTING(    0x08, DEF_STR( 1C_5C ) )
162    PORT_DIPSETTING(    0x00, "1C/6C or Free if Coin A too" ) */
163
164   PORT_DIPNAME( 0x20, 0x20, "Credits to Start" )
165   PORT_DIPSETTING(    0x20, "1" )
166   PORT_DIPSETTING(    0x00, "2" )
167   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
168   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
169   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
170   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) )
171   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
172   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
173
174   PORT_START   /* Dip switch B */
175   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
176   PORT_DIPSETTING(    0x02, "1" )
177   PORT_DIPSETTING(    0x01, "2" )
178   PORT_DIPSETTING(    0x03, "3" )
179   PORT_DIPSETTING(    0x00, "5" )
180   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
181   PORT_DIPSETTING(    0x08, "80000 300000" )
182   PORT_DIPSETTING(    0x0c, "150000 400000" )
183   PORT_DIPSETTING(    0x04, "300000 1000000" )
184   PORT_DIPSETTING(    0x00, "1000000 5000000" )
185   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
186   PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
187   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
188   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
189   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
190   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
191   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
192   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
193   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
194   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
195   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
125   PORT_DIPNAME( 0x001e, 0x001e, DEF_STR( Coinage ) )
126   PORT_DIPSETTING(    0x0014, DEF_STR( 6C_1C ) )
127   PORT_DIPSETTING(    0x0016, DEF_STR( 5C_1C ) )
128   PORT_DIPSETTING(    0x0018, DEF_STR( 4C_1C ) )
129   PORT_DIPSETTING(    0x001a, DEF_STR( 3C_1C ) )
130   PORT_DIPSETTING(    0x0002, DEF_STR( 8C_3C ) )
131   PORT_DIPSETTING(    0x001c, DEF_STR( 2C_1C ) )
132   PORT_DIPSETTING(    0x0004, DEF_STR( 5C_3C ) )
133   PORT_DIPSETTING(    0x0006, DEF_STR( 3C_2C ) )
134   PORT_DIPSETTING(    0x001e, DEF_STR( 1C_1C ) )
135   PORT_DIPSETTING(    0x0008, DEF_STR( 2C_3C ) )
136   PORT_DIPSETTING(    0x0012, DEF_STR( 1C_2C ) )
137   PORT_DIPSETTING(    0x0010, DEF_STR( 1C_3C ) )
138   PORT_DIPSETTING(    0x000e, DEF_STR( 1C_4C ) )
139   PORT_DIPSETTING(    0x000c, DEF_STR( 1C_5C ) )
140   PORT_DIPSETTING(    0x000a, DEF_STR( 1C_6C ) )
141   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
142/*  PORT_DIPNAME( 0x0006, 0x0006, DEF_STR( Coin_A ) )
143    PORT_DIPSETTING(    0x0000, "5C/1C or Free if Coin B too" )
144    PORT_DIPSETTING(    0x0002, DEF_STR( 3C_1C ) )
145    PORT_DIPSETTING(    0x0004, DEF_STR( 2C_1C ) )
146    PORT_DIPSETTING(    0x0006, DEF_STR( 1C_1C ) )
147    PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Coin_B ) )
148    PORT_DIPSETTING(    0x0018, DEF_STR( 1C_2C ) )
149    PORT_DIPSETTING(    0x0010, DEF_STR( 1C_3C ) )
150    PORT_DIPSETTING(    0x0008, DEF_STR( 1C_5C ) )
151    PORT_DIPSETTING(    0x0000, "1C/6C or Free if Coin A too" ) */
152   PORT_DIPNAME( 0x0020, 0x0020, "Credits to Start" )
153   PORT_DIPSETTING(    0x0020, "1" )
154   PORT_DIPSETTING(    0x0000, "2" )
155   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unused ) )
156   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
157   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
158   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) )
159   PORT_DIPSETTING(    0x0080, DEF_STR( Off ) )
160   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
161   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) )
162   PORT_DIPSETTING(    0x0200, "1" )
163   PORT_DIPSETTING(    0x0100, "2" )
164   PORT_DIPSETTING(    0x0300, "3" )
165   PORT_DIPSETTING(    0x0000, "5" )
166   PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Bonus_Life ) )
167   PORT_DIPSETTING(    0x0800, "80000 300000" )
168   PORT_DIPSETTING(    0x0c00, "150000 400000" )
169   PORT_DIPSETTING(    0x0400, "300000 1000000" )
170   PORT_DIPSETTING(    0x0000, "1000000 5000000" )
171   PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Difficulty ) )
172   PORT_DIPSETTING(    0x2000, DEF_STR( Easy ) )
173   PORT_DIPSETTING(    0x3000, DEF_STR( Normal ) )
174   PORT_DIPSETTING(    0x1000, DEF_STR( Hard ) )
175   PORT_DIPSETTING(    0x0000, DEF_STR( Very_Hard ) )
176   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Allow_Continue ) )
177   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
178   PORT_DIPSETTING(    0x4000, DEF_STR( Yes ) )
179   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Demo_Sounds ) )
180   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
181   PORT_DIPSETTING(    0x8000, DEF_STR( On ) )
196182INPUT_PORTS_END
197183
198184/******************************************************************************/
r869r870
247233
248234static VIDEO_EOF( raiden )
249235{
250   buffer_spriteram_w(0,0); /* Could be a memory location instead */
236   buffer_spriteram16_w(0,0,0); /* Could be a memory location instead */
251237}
252238
253239static MACHINE_DRIVER_START( raiden )
r869r870
462448/***************************************************************************/
463449
464450/* Spin the sub-cpu if it is waiting on the master cpu */
465static READ8_HANDLER( sub_cpu_spin_r )
451static READ16_HANDLER( sub_cpu_spin_r )
466452{
467453   int pc=activecpu_get_pc();
468   int ret=raiden_shared_ram[0x8];
454   int ret=raiden_shared_ram[0x4];
469455
470   if (offset==1) return raiden_shared_ram[0x9];
471
472456   if (pc==0xfcde6 && ret!=0x40)
473457      cpu_spin();
474458
475459   return ret;
476460}
477461
478static READ8_HANDLER( sub_cpu_spina_r )
462static READ16_HANDLER( sub_cpu_spina_r )
479463{
480464   int pc=activecpu_get_pc();
481   int ret=raiden_shared_ram[0x8];
465   int ret=raiden_shared_ram[0x4];
482466
483   if (offset==1) return raiden_shared_ram[0x9];
484
485467   if (pc==0xfcde8 && ret!=0x40)
486468      cpu_spin();
487469
r869r870
490472
491473static DRIVER_INIT( raiden )
492474{
493   memory_install_read8_handler(1, ADDRESS_SPACE_PROGRAM, 0x4008, 0x4009, 0, 0, sub_cpu_spin_r);
475   memory_install_read16_handler(1, ADDRESS_SPACE_PROGRAM, 0x4008, 0x4009, 0, 0, sub_cpu_spin_r);
494476}
495477
496478static void memory_patcha(void)
497479{
498   memory_install_read8_handler(1, ADDRESS_SPACE_PROGRAM, 0x4008, 0x4009, 0, 0, sub_cpu_spina_r);
480   memory_install_read16_handler(1, ADDRESS_SPACE_PROGRAM, 0x4008, 0x4009, 0, 0, sub_cpu_spina_r);
499481}
500482
501483/* This is based on code by Niclas Karlsson Mate, who figured out the
r869r870
503485bit-swapping */
504486static void common_decrypt(void)
505487{
506   UINT8 *RAM = memory_region(REGION_CPU1);
488   UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1);
507489   int i;
508   UINT8 a;
509490
510   static const UINT8 xor_table[4][16]={
511     {0xF1,0xF9,0xF5,0xFD,0xF1,0xF1,0x3D,0x3D,   /* rom 3 */
512      0x73,0xFB,0x77,0xFF,0x73,0xF3,0x3F,0x3F},
513     {0xDF,0xFF,0xFF,0xFF,0xDB,0xFF,0xFB,0xFF,   /* rom 4 */
514      0xFF,0xFF,0xFF,0xFF,0xFB,0xFF,0xFB,0xFF},
515     {0x7F,0x7F,0xBB,0x77,0x77,0x77,0xBE,0xF6,   /* rom 5 */
516      0x7F,0x7F,0xBB,0x77,0x77,0x77,0xBE,0xF6},
517     {0xFF,0xFF,0xFD,0xFD,0xFD,0xFD,0xEF,0xEF,   /* rom 6 */
518      0xFF,0xFF,0xFD,0xFD,0xFD,0xFD,0xEF,0xEF}
519   };
520
521   /* Rom 3 - main cpu even bytes */
522   for (i=0xc0000; i<0x100000; i+=2) {
523      a=RAM[i];
524      a^=xor_table[0][(i/2) & 0x0f];
525       a^=0xff;
526         a=(a & 0x31) | ((a<<1) & 0x04) | ((a>>5) & 0x02)
527      | ((a<<4) & 0x40) | ((a<<4) & 0x80) | ((a>>4) & 0x08);
528      RAM[i]=a;
491   for (i = 0; i < 0x20000; i++)
492   {
493      static const UINT16 xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0xc000 };
494      UINT16 data = RAM[0xc0000/2 + i];
495      data ^= xor_table[i & 0x0f];
496      data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0);
497      RAM[0xc0000/2 + i] = data;
529498   }
530499
531   /* Rom 4 - main cpu odd bytes */
532   for (i=0xc0001; i<0x100000; i+=2) {
533      a=RAM[i];
534      a^=xor_table[1][(i/2) & 0x0f];
535       a^=0xff;
536         a=(a & 0xdb) | ((a>>3) & 0x04) | ((a<<3) & 0x20);
537      RAM[i]=a;
538   }
500   RAM = (UINT16 *)memory_region(REGION_CPU2);
539501
540   RAM = memory_region(REGION_CPU2);
541
542   /* Rom 5 - sub cpu even bytes */
543   for (i=0xc0000; i<0x100000; i+=2) {
544      a=RAM[i];
545      a^=xor_table[2][(i/2) & 0x0f];
546       a^=0xff;
547         a=(a & 0x32) | ((a>>1) & 0x04) | ((a>>4) & 0x08)
548      | ((a<<5) & 0x80) | ((a>>6) & 0x01) | ((a<<6) & 0x40);
549      RAM[i]=a;
502   for (i = 0; i < 0x20000; i++)
503   {
504      static const UINT16 xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 };
505      UINT16 data = RAM[0xc0000/2 + i];
506      data ^= xor_table[i & 0x07];
507      data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6);
508      RAM[0xc0000/2 + i] = data;
550509   }
551
552   /* Rom 6 - sub cpu odd bytes */
553   for (i=0xc0001; i<0x100000; i+=2) {
554      a=RAM[i];
555      a^=xor_table[3][(i/2) & 0x0f];
556       a^=0xff;
557         a=(a & 0xed) | ((a>>3) & 0x02) | ((a<<3) & 0x10);
558      RAM[i]=a;
559   }
560510}
561511
562512static DRIVER_INIT( raidenk )
src/mame/drivers/alg.c
r869r870
457457   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
458458
459459   MDRV_SCREEN_REFRESH_RATE(59.97)
460   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
460   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
461461
462462   MDRV_MACHINE_START(alg)
463463   MDRV_MACHINE_RESET(alg)
r869r870
503503   MDRV_IMPORT_FROM(alg_r1)
504504
505505   /* adjust for PAL specs */
506   MDRV_CPU_REPLACE("main", M68000, 7090000)
506   MDRV_CPU_REPLACE("main", M68000, 7093790)
507507   MDRV_CPU_PROGRAM_MAP(main_map_picmatic,0)
508508   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312)
509509
src/mame/drivers/vegaeo.c
r869r870
167167   /* sound cpu */
168168
169169   MDRV_SCREEN_REFRESH_RATE(60)
170   MDRV_SCREEN_VBLANK_TIME(0)
170   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
171171
172172   MDRV_NVRAM_HANDLER(at28c16_0)
173173
src/mame/drivers/arcadia.c
r869r870
294294   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
295295
296296   MDRV_SCREEN_REFRESH_RATE(59.997)
297   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
297   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
298298
299299   MDRV_MACHINE_RESET(amiga)
300300   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/segag80v.c
r869r870
418418
419419   AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x04) AM_WRITE(coin_count_w)
420420   AM_RANGE(0xf8, 0xfb) AM_READ(mangled_ports_r)
421   AM_RANGE(0xfc, 0xfc) AM_READ(port_tag_to_handler8("FC"))
421   AM_RANGE(0xfc, 0xfc) AM_READ_PORT("FC")
422422ADDRESS_MAP_END
423423
424424
src/mame/drivers/mrdo.c
r869r870
183183   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
184184
185185   MDRV_SCREEN_REFRESH_RATE(5000000.0/312/262)
186   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(4368))
186   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(4368))
187187
188188   /* video hardware */
189189   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/namcos1.c
r869r870
513513   AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r, hd63701_internal_registers_w)
514514   AM_RANGE(0x0080, 0x00ff) AM_RAM /* built in RAM */
515515   AM_RANGE(0x1000, 0x1003) AM_READ(dsw_r)
516   AM_RANGE(0x1400, 0x1400) AM_READ(port_tag_to_handler8("CONTROL0"))
517   AM_RANGE(0x1401, 0x1401) AM_READ(port_tag_to_handler8("CONTROL1"))
516   AM_RANGE(0x1400, 0x1400) AM_READ_PORT("CONTROL0")
517   AM_RANGE(0x1401, 0x1401) AM_READ_PORT("CONTROL1")
518518   AM_RANGE(0x4000, 0xbfff) AM_ROMBANK(20) /* banked ROM */
519519   AM_RANGE(0xc000, 0xc000) AM_WRITE(namcos1_mcu_patch_w)   /* kludge! see notes */
520520   AM_RANGE(0xc000, 0xc7ff) AM_RAMBANK(19)   /* TRIRAM (shared) */
r869r870
527527ADDRESS_MAP_END
528528
529529static ADDRESS_MAP_START( mcu_port_map, ADDRESS_SPACE_IO, 8 )
530   AM_RANGE(HD63701_PORT1, HD63701_PORT1) AM_READWRITE(port_tag_to_handler8("COIN"), namcos1_coin_w)
530   AM_RANGE(HD63701_PORT1, HD63701_PORT1) AM_READ_PORT("COIN") AM_WRITE(namcos1_coin_w)
531531   AM_RANGE(HD63701_PORT2, HD63701_PORT2) AM_READWRITE(MRA8_NOP, namcos1_dac_gain_w)
532532ADDRESS_MAP_END
533533
src/mame/drivers/m62.c
r869r870
13821382   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
13831383
13841384   MDRV_SCREEN_REFRESH_RATE(55)
1385   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1790) /* frames per second and vblank duration from the Lode Runner manual */)
1385   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1790) /* frames per second and vblank duration from the Lode Runner manual */)
13861386
13871387   /* video hardware */
13881388   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/deco156.c
r869r870
430430   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
431431
432432   MDRV_SCREEN_REFRESH_RATE(58)
433   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
433   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
434434   MDRV_NVRAM_HANDLER(93C46)
435435
436436   /* video hardware */
r869r870
466466   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
467467
468468   MDRV_SCREEN_REFRESH_RATE(58)
469   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
469   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
470470   MDRV_NVRAM_HANDLER(93C46)
471471
472472   /* video hardware */
src/mame/drivers/junofrst.c
r869r870
357357   MDRV_CPU_IO_MAP(mcu_io_map,0)
358358
359359   MDRV_SCREEN_REFRESH_RATE(30)
360   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_30HZ_VBLANK_DURATION))
360   MDRV_SCREEN_VBLANK_TIME(DEFAULT_30HZ_VBLANK_DURATION)
361361
362362   /* video hardware */
363363   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/othunder.c
r869r870
158158- The keyboard leds I'm turning on are actually the gun solenoid outputs, which
159159  would rattle the gun while firing.
160160
161- The newer US set has a dip switch option to continue with only one coin even
162  if coinage is set higher. I don't know if this is the only difference with the
163  older set.
164161
162Stephh's notes (based on the game M68000 code and some tests) :
165163
1641) 'othunder', 'othundrj' and 'othunduo'
165
166  - Region stored at 0x03fffe.w
167  - Sets :
168      * 'othunder' : region = 0x0003
169      * 'othundrj' : region = 0x0001
170      * 'othunduo' : region = 0x0002
171  - These 3 games are 100% the same, only region differs !
172  - Coinage relies on the region (code at 0x000db2) :
173      * 0x0001 (Japan) and 0x0002 (US) use TAITO_COINAGE_JAPAN_OLD
174      * 0x0003 (World) and 0x0004 (licenced to xxx) use TAITO_COINAGE_WORLD
175  - Notice screen only if region = 0x0001
176  - According to the manual, DSWB bit 6 determines continue pricing :
177
178    PORT_DIPNAME( 0x40, 0x00, DEF_STR( Continue_Price ) )
179    PORT_DIPSETTING(    0x40, DEF_STR( 1C_1C ) )
180    PORT_DIPSETTING(    0x00, "Same as Start" )
181
182    However, many conditions are required to make it work due to code at 0x00e0c4 :
183      * region must not be 0x0001
184      * "Allow Continue" Dip Switch must be set to "Yes"
185      * coinage must be 2C_1C for both slots
186    This is why this Dip Switch has NO effect in the following sets :
187      * 'othunder' : coinage can't be 2C_1C for the 2 slots (coin B)
188      * 'othundrj' : region = 0x0001
189
190
1912) 'othundu'
192
193  - Region stored at 0x03fffe.w
194  - Sets :
195      * 'othundu' : region = 0x0002
196  - Comparison with 'othunder' :
197      * slightly different code at 0x023c4c
198      * additional data from 0x023eee to 0x0240ed (0x0200 bytes)
199      * same other notes as for 'othunder'
200
201
166202TODO:
167203-----
168204
r869r870
196232***************************************************************************/
197233
198234#include "driver.h"
235#include "taitoipt.h"
199236#include "cpu/m68000/m68000.h"
200237#include "machine/eeprom.h"
201238#include "video/taitoic.h"
r869r870
372409   }
373410}
374411
412#define P1X_PORT_TAG     "P1X"
413#define P1Y_PORT_TAG     "P1Y"
414#define P2X_PORT_TAG     "P2X"
415#define P2Y_PORT_TAG     "P2Y"
416#define ROTARY_PORT_TAG  "ROTARY"
417
375418static READ16_HANDLER( othunder_lightgun_r )
376419{
377   switch (offset)
378   {
379      case 0x00:
380         return input_port_5_word_r(0,mem_mask);   /* P1X */
381
382      case 0x01:
383         return input_port_6_word_r(0,mem_mask);   /* P1Y */
384
385      case 0x02:
386         return input_port_7_word_r(0,mem_mask);   /* P2X */
387
388      case 0x03:
389         return input_port_8_word_r(0,mem_mask);   /* P2Y */
390   }
391
392//logerror("CPU #0 lightgun_r offset %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),offset);
393
394   return 0x0;
420   static const char *dswname[4] = { P1X_PORT_TAG, P1Y_PORT_TAG, P2X_PORT_TAG, P2Y_PORT_TAG };
421   return readinputportbytag(dswname[offset]);
395422}
396423
397424static WRITE16_HANDLER( othunder_lightgun_w )
r869r870
520547             INPUT PORTS, DIPs
521548***********************************************************/
522549
523INPUT_PORTS_START( othundrj )
524   PORT_START_TAG( "DSWA" )
525   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
526   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
527   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
550INPUT_PORTS_START( othunder )
551   /* 0x090000 -> 0x08a000 */
552   PORT_START_TAG("DSWA")
553   PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )
528554   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Allow_Continue ) )
529   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
530   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
531   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
532   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
533   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
534   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
535   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
536   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
537   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
538   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
539   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
540   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
541   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
542   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
543   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
544   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
555   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
556   PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
557   TAITO_DSWA_BITS_2_TO_3
558   TAITO_COINAGE_WORLD
545559
546   PORT_START_TAG( "DSWB" )
560   /* 0x090002 -> 0x08a002 */
561   PORT_START_TAG("DSWB")
547562   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
548563   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
549564   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
r869r870
559574   PORT_DIPSETTING(    0x10, "35" )
560575   PORT_DIPSETTING(    0x30, "40" )
561576   PORT_DIPSETTING(    0x20, "50" )
562   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
563   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
564   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
565   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
566   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
567   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
577   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )                        /* see notes */
578   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
568579
569   PORT_START      /* IN0 */
580   PORT_START_TAG("IN0")
570581   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
571582   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
572583   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r869r870
576587   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
577588   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
578589
579   PORT_START      /* IN1, unused */
590   PORT_START_TAG("IN1")   /* unused */
580591
581   PORT_START      /* IN2 */
592   PORT_START_TAG("IN2")
582593   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
583594   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
584595   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r869r870
592603       enough and being accurate enough not to miss targets. 20 is too
593604       inaccurate, and 10 is too slow. */
594605
595   PORT_START
606   PORT_START_TAG(P1X_PORT_TAG)
596607   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) PORT_REVERSE PORT_PLAYER(1)
597608
598   PORT_START
609   PORT_START_TAG(P1Y_PORT_TAG)
599610   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_CROSSHAIR(Y, 1.0, -0.057, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) PORT_PLAYER(1)
600611
601   PORT_START
612   PORT_START_TAG(P2X_PORT_TAG)
602613   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) PORT_REVERSE PORT_PLAYER(2)
603614
604   PORT_START
615   PORT_START_TAG(P2Y_PORT_TAG)
605616   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_CROSSHAIR(Y, 1.0, -0.057, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) PORT_PLAYER(2)
606617
607   PORT_START /* fake for rotary volume control */
608   PORT_DIPNAME( 0x07, 0x07, "Stereo Separation" )
609   PORT_DIPSETTING(    0x07, "Maximum" )
610   PORT_DIPSETTING(    0x03, DEF_STR( High ) )
611   PORT_DIPSETTING(    0x01, DEF_STR( Medium ) )
612   PORT_DIPSETTING(    0x00, DEF_STR( Low ) )
618   /* rotary volume control */
619   PORT_START_TAG(ROTARY_PORT_TAG)
620   PORT_CONFNAME( 0x07, 0x07, "Stereo Separation" )
621   PORT_CONFSETTING(    0x07, "Maximum" )
622   PORT_CONFSETTING(    0x03, DEF_STR( High ) )
623   PORT_CONFSETTING(    0x01, DEF_STR( Medium ) )
624   PORT_CONFSETTING(    0x00, DEF_STR( Low ) )
613625INPUT_PORTS_END
614626
615INPUT_PORTS_START( othunder )
616   PORT_INCLUDE( othundrj )
627INPUT_PORTS_START( othundrj )
628   PORT_INCLUDE( othunder )
617629
618630   PORT_MODIFY( "DSWA" )
619   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
620   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
621   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
622   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
623   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
624   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
625   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
626   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
627   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
628   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
631   TAITO_COINAGE_JAPAN_OLD
629632INPUT_PORTS_END
630633
631634INPUT_PORTS_START( othundu )
632635   PORT_INCLUDE( othundrj )
633636
634637   PORT_MODIFY( "DSWB" )
635   PORT_DIPNAME( 0x40, 0x40, "Discounted Continue" )   // e.g. 2 coins to start 1 to continue
636   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
637   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
638    PORT_DIPNAME( 0x40, 0x00, DEF_STR( Continue_Price ) )        /* see notes */
639    PORT_DIPSETTING(    0x40, DEF_STR( 1C_1C ) )
640    PORT_DIPSETTING(    0x00, "Same as Start" )
638641INPUT_PORTS_END
639642
640643
r869r870
795798   ROM_LOAD( "pal20l8b-b67-10.ic33",  0x0600, 0x0144, CRC(4ced09c7) SHA1(519e6152cc5e4cb3ec24c4dc09101dddf22988aa) )
796799ROM_END
797800
798ROM_START( othunduo )
801ROM_START( othundu )
799802   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 512K for 68000 code */
800   ROM_LOAD16_BYTE( "b67-20.63",   0x00000, 0x20000, CRC(21439ea2) SHA1(d5b5a194e9698cf43513c0d56146772e8132ab07) )
801   ROM_LOAD16_BYTE( "b67-22.64",   0x00001, 0x20000, CRC(0f99ad3c) SHA1(dd6c9e822470ca867ec01e642443a871e879bae5) )
803   ROM_LOAD16_BYTE( "b67-20-1.63", 0x00000, 0x20000, CRC(851a453b) SHA1(48b8c379e78cd79463f1e24dc23816a97cf819b8) )
804   ROM_LOAD16_BYTE( "b67-22-1.64", 0x00001, 0x20000, CRC(19480dc0) SHA1(8bbc982c89f0878e7639330970df5aa93ecbb083) )
802805   ROM_LOAD16_BYTE( "b67-14.61",   0x40000, 0x20000, CRC(7f3dd724) SHA1(2f2eeae0ee31e20082237b9a947c6848771eb73c) )
803806   ROM_LOAD16_BYTE( "b67-15.62",   0x40001, 0x20000, CRC(e84f62d0) SHA1(3b4a55a14dee7d592467fde9a75bde64deabd27d) )
804807
r869r870
831834   ROM_LOAD( "pal20l8b-b67-10.ic33",  0x0600, 0x0144, CRC(4ced09c7) SHA1(519e6152cc5e4cb3ec24c4dc09101dddf22988aa) )
832835ROM_END
833836
834ROM_START( othundu )
837ROM_START( othunduo )
835838   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 512K for 68000 code */
836   ROM_LOAD16_BYTE( "b67-20-1.63", 0x00000, 0x20000, CRC(851a453b) SHA1(48b8c379e78cd79463f1e24dc23816a97cf819b8) )
837   ROM_LOAD16_BYTE( "b67-22-1.64", 0x00001, 0x20000, CRC(19480dc0) SHA1(8bbc982c89f0878e7639330970df5aa93ecbb083) )
839   ROM_LOAD16_BYTE( "b67-20.63",   0x00000, 0x20000, CRC(21439ea2) SHA1(d5b5a194e9698cf43513c0d56146772e8132ab07) )
840   ROM_LOAD16_BYTE( "b67-22.64",   0x00001, 0x20000, CRC(0f99ad3c) SHA1(dd6c9e822470ca867ec01e642443a871e879bae5) )
838841   ROM_LOAD16_BYTE( "b67-14.61",   0x40000, 0x20000, CRC(7f3dd724) SHA1(2f2eeae0ee31e20082237b9a947c6848771eb73c) )
839842   ROM_LOAD16_BYTE( "b67-15.62",   0x40001, 0x20000, CRC(e84f62d0) SHA1(3b4a55a14dee7d592467fde9a75bde64deabd27d) )
840843
r869r870
907910
908911GAME( 1988, othunder, 0,        othunder, othunder, 0, ORIENTATION_FLIP_X, "Taito Corporation Japan", "Operation Thunderbolt (World)", 0 )
909912GAME( 1988, othundu,  othunder, othunder, othundu,  0, ORIENTATION_FLIP_X, "Taito America Corporation", "Operation Thunderbolt (US)", 0 )
910GAME( 1988, othunduo, othunder, othunder, othundrj, 0, ORIENTATION_FLIP_X, "Taito America Corporation", "Operation Thunderbolt (US, older)", 0 )
913GAME( 1988, othunduo, othunder, othunder, othundu, 0, ORIENTATION_FLIP_X, "Taito America Corporation", "Operation Thunderbolt (US, older)", 0 )
911914GAME( 1988, othundrj, othunder, othunder, othundrj, 0, ORIENTATION_FLIP_X, "Taito Corporation", "Operation Thunderbolt (Japan)", 0 )
src/mame/drivers/djboy.c
r869r870
770770   AM_RANGE(0x08, 0x08) AM_WRITE(djboy_scrollx_w)
771771   AM_RANGE(0x0a, 0x0a) AM_WRITE(trigger_nmi_on_cpu0)
772772   AM_RANGE(0x0c, 0x0c) AM_READ(beast_status_r)
773   AM_RANGE(0x0e, 0x0e) AM_WRITE(coinplus_w);
773   AM_RANGE(0x0e, 0x0e) AM_WRITE(coinplus_w)
774774ADDRESS_MAP_END
775775
776776/******************************************************************************/
src/mame/drivers/tumblep.c
r869r870
325325   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
326326
327327   MDRV_SCREEN_REFRESH_RATE(58)
328   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
328   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
329329
330330   /* video hardware */
331331   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/vigilant.c
r869r870
9797
9898static ADDRESS_MAP_START( vigilant_writeport, ADDRESS_SPACE_IO, 8 )
9999   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
100   AM_RANGE(0x00, 0x00) AM_WRITE(m72_sound_command_w)  /* SD */
100   AM_RANGE(0x00, 0x00) AM_WRITE(m72_sound_command_byte_w)  /* SD */
101101   AM_RANGE(0x01, 0x01) AM_WRITE(vigilant_out2_w) /* OUT2 */
102102   AM_RANGE(0x04, 0x04) AM_WRITE(vigilant_bank_select_w) /* PBANK */
103103   AM_RANGE(0x80, 0x81) AM_WRITE(vigilant_horiz_scroll_w) /* HSPL, HSPH */
r869r870
135135   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
136136   AM_RANGE(0x00, 0x00) AM_WRITE(kikcubic_coin_w)   /* also flip screen, and...? */
137137   AM_RANGE(0x04, 0x04) AM_WRITE(vigilant_bank_select_w)
138   AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_command_w)
138   AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_command_byte_w)
139139//  AM_RANGE(0x07, 0x07) AM_WRITE(MWA8_NOP) /* ?? */
140140ADDRESS_MAP_END
141141
src/mame/drivers/canyon.c
r869r870
247247   MDRV_WATCHDOG_VBLANK_INIT(8)
248248
249249   MDRV_SCREEN_REFRESH_RATE(60)
250   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(22 * 1000000 / 15750))
250   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(22 * 1000000 / 15750))
251251
252252   /* video hardware */
253253   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/tx1.c
r869r870
6565
6666static int TS, z80_int = 0;
6767
68UINT8 *tx1_vram;
69UINT8 *tx1_object_ram;
68UINT16 *tx1_vram;
69UINT16 *tx1_object_ram;
7070
71UINT8 *buggyboy_vram;   /* Tile RAM (three monitor)   */
72UINT8 *buggyb1_vram;   /* Tile RAM (single monitor)  */
71UINT16 *buggyboy_vram;   /* Tile RAM (three monitor)   */
72UINT16 *buggyb1_vram;   /* Tile RAM (single monitor)  */
7373static UINT8 *z80_ram;   /* Main 8086/Z80 shared RAM   */
74UINT8 *bb_objram;
75UINT8 *bb_sky;      /* Sky register */
76UINT8 *bb_rcram;
74UINT16 *bb_objram;
75UINT16 *bb_sky;      /* Sky register */
76UINT16 *bb_rcram;
7777
7878size_t tx1_objectram_size;
7979size_t bb_objectram_size;
r869r870
8585
8686/* machine/tx1.c */
8787void MMI_74S516(int ins, UINT16 *data);
88READ8_HANDLER( BB_AU_R );
89WRITE8_HANDLER( BB_AU_W );
88READ16_HANDLER( BB_AU_R );
89WRITE16_HANDLER( BB_AU_W );
9090
9191/* video/tx1.c */
92WRITE8_HANDLER( tx1_vram_w );
92WRITE16_HANDLER( tx1_vram_w );
9393VIDEO_START( tx1 );
9494VIDEO_UPDATE( tx1 );
9595
9696PALETTE_INIT( buggyboy );
97WRITE8_HANDLER( buggyboy_vram_w );
98WRITE8_HANDLER( buggyb1_vram_w );
97WRITE16_HANDLER( buggyboy_vram_w );
98WRITE16_HANDLER( buggyb1_vram_w );
9999VIDEO_START( buggyboy );
100100VIDEO_UPDATE( buggyboy );
101101VIDEO_START( buggyb1 );
r869r870
119119
120120/* HD46505S-2 CRT Controller */
121121/* Buggy Boy: The main 8086 at F003C expects non-zero value or else jump to 4000:0000 and execute crap */
122static READ8_HANDLER(crt_read)
122static READ16_HANDLER(crt_read)
123123{
124124       return 1;
125125}
126126
127127/* Remove this eventually */
128static WRITE8_HANDLER(crt_write)
128static WRITE16_HANDLER(crt_write)
129129{
130130#if PRINT_CRT
131   if (ACCESSING_LSB)
132   {
133      data &= 0xff;
131134       if(offset==0)
132135       {
133136        switch (data)
r869r870
170173                  break;
171174        }
172175       }
173        if(offset==2) mame_printf_debug("=         0x%x, %d\n",data,data);
176        if(offset==1) mame_printf_debug("=         0x%x, %d\n",data,data);
177    }
174178#endif
175179}
176180
177181
178182/* Main CPU and Z80 synchronisation*/
179static WRITE8_HANDLER(z80_busreq)
183static WRITE16_HANDLER(z80_busreq)
180184{
181     if(data)
182     {
183        cpunum_set_input_line(2, INPUT_LINE_HALT, CLEAR_LINE);
184     }
185     else
186        cpunum_set_input_line(2, INPUT_LINE_HALT, ASSERT_LINE);
185   if (ACCESSING_LSB)
186   {
187      if (data & 0xff)
188         cpunum_set_input_line(2, INPUT_LINE_HALT, CLEAR_LINE);
189      else
190         cpunum_set_input_line(2, INPUT_LINE_HALT, ASSERT_LINE);
191   }
187192}
188193
189194
190195/* Called by main 8086 to wake up slave */
191static WRITE8_HANDLER(resume_slave)
196static WRITE16_HANDLER(resume_slave)
192197{
193198   cpunum_set_input_line(1, INPUT_LINE_TEST, ASSERT_LINE);
194199}
195200
196static READ8_HANDLER(halt_slave_r)
201static READ16_HANDLER(halt_slave_r)
197202{
198203   cpunum_set_input_line(1, INPUT_LINE_TEST, CLEAR_LINE);
199204   return 0;
r869r870
219224
220225
221226/* Handlers for main CPU<->Z80 RAM */
222static READ8_HANDLER(z80_shared_r)
227static READ16_HANDLER(z80_shared_r)
223228{
224       return z80_ram[offset/2];
229   return z80_ram[offset];
225230}
226231
227static WRITE8_HANDLER(z80_shared_w)
232static WRITE16_HANDLER(z80_shared_w)
228233{
229       if(offset%2 == 0)
230            z80_ram[offset/2]=data;
234   if (ACCESSING_LSB)
235      z80_ram[offset] = data;
231236}
232237
233238INPUT_PORTS_START( tx1 )
234PORT_START_TAG("DSW1")
235        PORT_DIPNAME( 0x07, 0x03,  DEF_STR( Difficulty ) )
236   PORT_DIPSETTING(      0x00, "A" )
237   PORT_DIPSETTING(      0x01, "B" )
238   PORT_DIPSETTING(      0x02, "C" )
239   PORT_DIPSETTING(      0x03, "D" )
240   PORT_DIPSETTING(      0x04, "E" )
241   PORT_DIPSETTING(      0x05, "F" )
242   PORT_DIPSETTING(      0x06, "G" )
243   PORT_DIPSETTING(      0x07, "H" )
239   PORT_START_TAG("DSW1")
240   PORT_DIPNAME( 0x0700, 0x0300,  DEF_STR( Difficulty ) )
241   PORT_DIPSETTING(      0x0000, "A" )
242   PORT_DIPSETTING(      0x0100, "B" )
243   PORT_DIPSETTING(      0x0200, "C" )
244   PORT_DIPSETTING(      0x0300, "D" )
245   PORT_DIPSETTING(      0x0400, "E" )
246   PORT_DIPSETTING(      0x0500, "F" )
247   PORT_DIPSETTING(      0x0600, "G" )
248   PORT_DIPSETTING(      0x0700, "H" )
244249
245   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Game_Time ) )
246   PORT_DIPSETTING(      0x00, "A" )
247   PORT_DIPSETTING(      0x08, "B" )
248   PORT_DIPSETTING(      0x10, "C" )
249   PORT_DIPSETTING(      0x18, "D" )
250   PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Game_Time ) )
251   PORT_DIPSETTING(      0x0000, "A" )
252   PORT_DIPSETTING(      0x0800, "B" )
253   PORT_DIPSETTING(      0x1000, "C" )
254   PORT_DIPSETTING(      0x1800, "D" )
250255
251   PORT_DIPNAME( 0xe0, 0xe0, "Bonus Adder" )
252        PORT_DIPSETTING(    0x00, "No Bonus" )
253   PORT_DIPSETTING(    0x20, "2 Coin Units for 1 Credit" )
254   PORT_DIPSETTING(    0x40, "3 Coin Units for 1 Credit" )
255   PORT_DIPSETTING(    0x60, "4 Coin Units for 1 Credit" )
256   PORT_DIPSETTING(    0x80, "5 Coin Units for 1 Credit" )
257   PORT_DIPSETTING(    0xa0, "4 Coin Units for 2 Credit" )
258   PORT_DIPSETTING(    0xc0, DEF_STR( Free_Play ) )
259   PORT_DIPSETTING(    0xe0, "No Bonus" )
256   PORT_DIPNAME( 0xe000, 0xe000, "Bonus Adder" )
257   PORT_DIPSETTING(    0x0000, "No Bonus" )
258   PORT_DIPSETTING(    0x2000, "2 Coin Units for 1 Credit" )
259   PORT_DIPSETTING(    0x4000, "3 Coin Units for 1 Credit" )
260   PORT_DIPSETTING(    0x6000, "4 Coin Units for 1 Credit" )
261   PORT_DIPSETTING(    0x8000, "5 Coin Units for 1 Credit" )
262   PORT_DIPSETTING(    0xa000, "4 Coin Units for 2 Credit" )
263   PORT_DIPSETTING(    0xc000, DEF_STR( Free_Play ) )
264   PORT_DIPSETTING(    0xe000, "No Bonus" )
260265
261/* These don't correspond to the Atari manual :( */
262PORT_START_TAG("DSW2")
263        PORT_DIPNAME( 0x03, 0x03, "Game Cost" )
264   PORT_DIPSETTING(      0x00, "1 Coin Unit for 1 Credit" )
265   PORT_DIPSETTING(      0x01, "2 Coin Units for 1 Credit" )
266   PORT_DIPSETTING(      0x02, "3 Coin Units for 1 Credit" )
267   PORT_DIPSETTING(      0x03, "4 Coin Units for 1 Credit" )
266   /* These don't correspond to the Atari manual :( */
267   PORT_DIPNAME( 0x0003, 0x0003, "Game Cost" )
268   PORT_DIPSETTING(      0x0000, "1 Coin Unit for 1 Credit" )
269   PORT_DIPSETTING(      0x0001, "2 Coin Units for 1 Credit" )
270   PORT_DIPSETTING(      0x0002, "3 Coin Units for 1 Credit" )
271   PORT_DIPSETTING(      0x0003, "4 Coin Units for 1 Credit" )
268272
269   PORT_DIPNAME( 0x04, 0x04, "Left Coin Mechanism" )
270   PORT_DIPSETTING(    0x00, "1 Coin for 1 Coin Unit" )
271   PORT_DIPSETTING(    0x04, "1 Coin for 2 Coin Units" )
273   PORT_DIPNAME( 0x0004, 0x0004, "Left Coin Mechanism" )
274   PORT_DIPSETTING(    0x0000, "1 Coin for 1 Coin Unit" )
275   PORT_DIPSETTING(    0x0004, "1 Coin for 2 Coin Units" )
272276
273   PORT_DIPNAME( 0x18, 0x00, "Right Coin Mechanism" )
274        PORT_DIPSETTING(    0x00, "1 Coin Units 1 Credit" )
275   PORT_DIPSETTING(    0x08, "1 Coin Units 4 Credit" )
276   PORT_DIPSETTING(    0x10, "1 Coin Units 5 Credit" )
277   PORT_DIPSETTING(    0x18, "1 Coin Unit 6 Credit" )
277   PORT_DIPNAME( 0x0018, 0x0000, "Right Coin Mechanism" )
278   PORT_DIPSETTING(    0x0000, "1 Coin Units 1 Credit" )
279   PORT_DIPSETTING(    0x0008, "1 Coin Units 4 Credit" )
280   PORT_DIPSETTING(    0x0010, "1 Coin Units 5 Credit" )
281   PORT_DIPSETTING(    0x0018, "1 Coin Unit 6 Credit" )
278282
279PORT_START_TAG("ANALOG_A")
280   PORT_BIT( 0x0f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
283   PORT_START_TAG("ANALOG_A")
284   PORT_BIT( 0x000f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
281285   PORT_BIT( 0xf0, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) /* Brake */
282PORT_START_TAG("ANALOG_B")
286   PORT_START_TAG("ANALOG_B")
283287   PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Steering */
284        /* Wire jumper setting on sound PCB */
288   /* Wire jumper setting on sound PCB */
285289   PORT_DIPNAME( 0xf0, 0x80,  DEF_STR( Unknown ) )
286290   PORT_DIPSETTING(      0x10, "1" )
287291   PORT_DIPSETTING(      0x20, "2" )
288292   PORT_DIPSETTING(      0x40, "3" )
289293   PORT_DIPSETTING(      0x80, "4" )
290294
291PORT_START_TAG("INPUTS")
295   PORT_START_TAG("INPUTS")
292296   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
293297   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
294298   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
r869r870
297301
298302
299303INPUT_PORTS_START( buggyboy )
300PORT_START_TAG("DSW1")
301   PORT_DIPNAME( 0xe0, 0x00, DEF_STR( Coin_A ) )
302   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
303   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
304   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
305   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_3C ) )
306   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
307   PORT_DIPSETTING(    0x80, DEF_STR( 1C_5C ) )
308        PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
309   PORT_DIPSETTING(    0xe0, "Free-Play" )
304   PORT_START_TAG("DSW1")
305   PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coin_A ) )
306   PORT_DIPSETTING(    0x4000, DEF_STR( 3C_1C ) )
307   PORT_DIPSETTING(    0x2000, DEF_STR( 2C_1C ) )
308   PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
309   PORT_DIPSETTING(    0xc000, DEF_STR( 2C_3C ) )
310   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_2C ) )
311   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_5C ) )
312   PORT_DIPSETTING(    0xa000, DEF_STR( 1C_6C ) )
313   PORT_DIPSETTING(    0xe000, "Free-Play" )
310314
311   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Coin_B ) )
312   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
313   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
314        PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
315   PORT_DIPSETTING(    0x18, DEF_STR( 1C_5C ) )
315   PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Coin_B ) )
316   PORT_DIPSETTING(    0x0800, DEF_STR( 2C_1C ) )
317   PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
318   PORT_DIPSETTING(    0x1000, DEF_STR( 1C_2C ) )
319   PORT_DIPSETTING(    0x1800, DEF_STR( 1C_5C ) )
316320
317        PORT_DIPNAME( 0x07, 0x07,  "Do not change 1" )
318   PORT_DIPSETTING(      0x00, "0" )
319   PORT_DIPSETTING(      0x01, "1" )
320   PORT_DIPSETTING(      0x02, "2" )
321   PORT_DIPSETTING(      0x03, "3" )
322   PORT_DIPSETTING(      0x04, "4" )
323   PORT_DIPSETTING(      0x05, "5" )
324   PORT_DIPSETTING(      0x06, "6" )
325   PORT_DIPSETTING(      0x07, "7" )
321   PORT_DIPNAME( 0x0700, 0x0700,  "Do not change 1" )
322   PORT_DIPSETTING(      0x0000, "0" )
323   PORT_DIPSETTING(      0x0100, "1" )
324   PORT_DIPSETTING(      0x0200, "2" )
325   PORT_DIPSETTING(      0x0300, "3" )
326   PORT_DIPSETTING(      0x0400, "4" )
327   PORT_DIPSETTING(      0x0500, "5" )
328   PORT_DIPSETTING(      0x0600, "6" )
329   PORT_DIPSETTING(      0x0700, "7" )
326330
327PORT_START_TAG("DSW2")
328        PORT_DIPNAME( 0x03, 0x03,  "Do not change 2" )       /* Dipswitch 0 is unconnected */
329   PORT_DIPSETTING(      0x00, "0" )
330   PORT_DIPSETTING(      0x01, "1" )
331   PORT_DIPSETTING(      0x02, "2" )
332   PORT_DIPSETTING(      0x03, "3" )
331   PORT_DIPNAME( 0x0003, 0x0003,  "Do not change 2" )       /* Dipswitch 0 is unconnected */
332   PORT_DIPSETTING(      0x0000, "0" )
333   PORT_DIPSETTING(      0x0001, "1" )
334   PORT_DIPSETTING(      0x0002, "2" )
335   PORT_DIPSETTING(      0x0003, "3" )
333336
334        PORT_DIPNAME( 0x04, 0x04, "Message" )
335   PORT_DIPSETTING(      0x04, DEF_STR( English ) )
336   PORT_DIPSETTING(      0x00, DEF_STR( Japanese ) )
337   PORT_DIPNAME( 0x0004, 0x0004, "Message" )
338   PORT_DIPSETTING(      0x0004, DEF_STR( English ) )
339   PORT_DIPSETTING(      0x0000, DEF_STR( Japanese ) )
337340
338        PORT_DIPNAME( 0x08, 0x08, "Do not Change 3" )
339   PORT_DIPSETTING(      0x00, DEF_STR( Off ) )
340   PORT_DIPSETTING(      0x08, DEF_STR( On ) )
341   PORT_DIPNAME( 0x0008, 0x0008, "Do not Change 3" )
342   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
343   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
341344
342   PORT_DIPNAME( 0x30, 0x30, "Time Rank" )
343   PORT_DIPSETTING(      0x00, "A" )
344   PORT_DIPSETTING(      0x10, "B" )
345   PORT_DIPSETTING(      0x20, "C" )
346   PORT_DIPSETTING(      0x30, "D" )
345   PORT_DIPNAME( 0x0030, 0x0030, "Time Rank" )
346   PORT_DIPSETTING(      0x0000, "A" )
347   PORT_DIPSETTING(      0x0010, "B" )
348   PORT_DIPSETTING(      0x0020, "C" )
349   PORT_DIPSETTING(      0x0030, "D" )
347350
348   PORT_DIPNAME( 0xc0, 0x40, "Game Rank" )
349   PORT_DIPSETTING(      0x00, "A")
350   PORT_DIPSETTING(      0x40, "B" )
351   PORT_DIPSETTING(      0x80, "C" )
352   PORT_DIPSETTING(      0xc0, "D" )
351   PORT_DIPNAME( 0x00c0, 0x0040, "Game Rank" )
352   PORT_DIPSETTING(      0x0000, "A")
353   PORT_DIPSETTING(      0x0040, "B" )
354   PORT_DIPSETTING(      0x0080, "C" )
355   PORT_DIPSETTING(      0x00c0, "D" )
353356
354PORT_START_TAG("YM2149_IC19_A")
357   PORT_START_TAG("YM2149_IC19_A")
355358   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
356359   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
357360   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
r869r870
359362   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
360363
361364
362/* Read by 8255 I think */
363PORT_START_TAG("YM2149_IC19_B")
365   /* Read by 8255 I think */
366   PORT_START_TAG("YM2149_IC19_B")
364367   PORT_DIPNAME( 0xff, 0x80,  "Sound PCB Jumper:" )
365368   PORT_DIPSETTING(      0x00, "0" )
366369   PORT_DIPSETTING(      0x01, "1" )
r869r870
372375   PORT_DIPSETTING(      0x40, "Buggy Boy/Taito" )
373376   PORT_DIPSETTING(      0x80, "Buggy Boy/Tatsumi" )
374377
375/* Fix me */
376PORT_START_TAG("ANALOG_A")
378   /* Fix me */
379   PORT_START_TAG("ANALOG_A")
377380   PORT_BIT( 0x0f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
378381   PORT_BIT( 0xf0, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Steering */
379PORT_START_TAG("ANALOG_B")
382   PORT_START_TAG("ANALOG_B")
380383   PORT_BIT( 0xf0, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) /* Brake */
381384
382385INPUT_PORTS_END
383386
384387INPUT_PORTS_START( buggyb1 )
385PORT_START_TAG("DSW1")
386   PORT_DIPNAME( 0xe0, 0x00, DEF_STR( Coin_A ) )
387   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
388   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
389   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
390   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_3C ) )
391   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
392   PORT_DIPSETTING(    0x80, DEF_STR( 1C_5C ) )
393        PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
394   PORT_DIPSETTING(    0xe0, "Free-Play" )
388   PORT_START_TAG("DSW1")
389   PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coin_A ) )
390   PORT_DIPSETTING(    0x4000, DEF_STR( 3C_1C ) )
391   PORT_DIPSETTING(    0x2000, DEF_STR( 2C_1C ) )
392   PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
393   PORT_DIPSETTING(    0xc000, DEF_STR( 2C_3C ) )
394   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_2C ) )
395   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_5C ) )
396   PORT_DIPSETTING(    0xa000, DEF_STR( 1C_6C ) )
397   PORT_DIPSETTING(    0xe000, "Free-Play" )
395398
396   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Coin_B ) )
397   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
398        PORT_DIPSETTING(    0x10, DEF_STR( 1C_4C ) )
399   PORT_DIPSETTING(    0x08, DEF_STR( 1C_5C ) )
400   PORT_DIPSETTING(    0x18, DEF_STR( 1C_6C ) )
399   PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Coin_B ) )
400   PORT_DIPSETTING(    0x0000, DEF_STR( 2C_1C ) )
401   PORT_DIPSETTING(    0x1000, DEF_STR( 1C_4C ) )
402   PORT_DIPSETTING(    0x0800, DEF_STR( 1C_5C ) )
403   PORT_DIPSETTING(    0x1800, DEF_STR( 1C_6C ) )
401404
402        PORT_DIPNAME( 0x07, 0x07,  "Do not change 1" )
403   PORT_DIPSETTING(      0x00, "0" )
404   PORT_DIPSETTING(      0x01, "1" )
405   PORT_DIPSETTING(      0x02, "2" )
406   PORT_DIPSETTING(      0x03, "3" )
407   PORT_DIPSETTING(      0x04, "4" )
408   PORT_DIPSETTING(      0x05, "5" )
409   PORT_DIPSETTING(      0x06, "6" )
410   PORT_DIPSETTING(      0x07, "7" )
405   PORT_DIPNAME( 0x0700, 0x0700,  "Do not change 1" )
406   PORT_DIPSETTING(      0x0000, "0" )
407   PORT_DIPSETTING(      0x0100, "1" )
408   PORT_DIPSETTING(      0x0200, "2" )
409   PORT_DIPSETTING(      0x0300, "3" )
410   PORT_DIPSETTING(      0x0400, "4" )
411   PORT_DIPSETTING(      0x0500, "5" )
412   PORT_DIPSETTING(      0x0600, "6" )
413   PORT_DIPSETTING(      0x0700, "7" )
411414
412PORT_START_TAG("DSW2")
413        PORT_DIPNAME( 0x03, 0x03,  "Do not change 2" )       /* Dipswitch 0 is unconnected */
414   PORT_DIPSETTING(      0x00, "0" )
415   PORT_DIPSETTING(      0x01, "1" )
416   PORT_DIPSETTING(      0x02, "2" )
417   PORT_DIPSETTING(      0x03, "3" )
415   PORT_DIPNAME( 0x0003, 0x0003,  "Do not change 2" )       /* Dipswitch 0 is unconnected */
416   PORT_DIPSETTING(      0x0000, "0" )
417   PORT_DIPSETTING(      0x0001, "1" )
418   PORT_DIPSETTING(      0x0002, "2" )
419   PORT_DIPSETTING(      0x0003, "3" )
418420
419        PORT_DIPNAME( 0x04, 0x04, "Message" )
420   PORT_DIPSETTING(      0x04, DEF_STR( English ) )
421   PORT_DIPSETTING(      0x00, DEF_STR( Japanese ) )
421   PORT_DIPNAME( 0x0004, 0x0004, "Message" )
422   PORT_DIPSETTING(      0x0004, DEF_STR( English ) )
423   PORT_DIPSETTING(      0x0000, DEF_STR( Japanese ) )
422424
423        PORT_DIPNAME( 0x08, 0x08, "Do not Change 3" )
424   PORT_DIPSETTING(      0x00, DEF_STR( Off ) )
425   PORT_DIPSETTING(      0x08, DEF_STR( On ) )
425   PORT_DIPNAME( 0x0008, 0x0008, "Do not Change 3" )
426   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
427   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
426428
427   PORT_DIPNAME( 0x30, 0x30, "Time Rank" )
428   PORT_DIPSETTING(      0x00, "A" )
429   PORT_DIPSETTING(      0x10, "B" )
430   PORT_DIPSETTING(      0x20, "C" )
431   PORT_DIPSETTING(      0x30, "D" )
429   PORT_DIPNAME( 0x0030, 0x0030, "Time Rank" )
430   PORT_DIPSETTING(      0x0000, "A" )
431   PORT_DIPSETTING(      0x0010, "B" )
432   PORT_DIPSETTING(      0x0020, "C" )
433   PORT_DIPSETTING(      0x0030, "D" )
432434
433   PORT_DIPNAME( 0xc0, 0x40, "Game Rank" )
434   PORT_DIPSETTING(      0x00, "A")
435   PORT_DIPSETTING(      0x40, "B" )
436   PORT_DIPSETTING(      0x80, "C" )
437   PORT_DIPSETTING(      0xc0, "D" )
435   PORT_DIPNAME( 0x00c0, 0x0040, "Game Rank" )
436   PORT_DIPSETTING(      0x0000, "A")
437   PORT_DIPSETTING(      0x0040, "B" )
438   PORT_DIPSETTING(      0x0080, "C" )
439   PORT_DIPSETTING(      0x00c0, "D" )
438440
439PORT_START_TAG("YM2149_IC19_A")
441   PORT_START_TAG("YM2149_IC19_A")
440442   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
441443   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
442444   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
443445   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_TOGGLE  /* Gear shift */
444446   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
445447
446/* Wire jumper setting on sound PCB */
447PORT_START_TAG("YM2149_IC19_B")
448   /* Wire jumper setting on sound PCB */
449   PORT_START_TAG("YM2149_IC19_B")
448450   PORT_DIPNAME( 0xff, 0x80,  "Sound PCB Jumper:" )
449451   PORT_DIPSETTING(      0x00, "0" )
450452   PORT_DIPSETTING(      0x01, "1" )
r869r870
456458   PORT_DIPSETTING(      0x40, "Buggy Boy/Taito" )
457459   PORT_DIPSETTING(      0x80, "Buggy Boy/Tatsumi" )
458460
459PORT_START_TAG("ANALOG_A")
461   PORT_START_TAG("ANALOG_A")
460462   PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)  /* Steering */
461463   PORT_BIT( 0xf0, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
462PORT_START_TAG("ANALOG_B")
464   PORT_START_TAG("ANALOG_B")
463465   PORT_BIT( 0xf0, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)  /* Brake */
464466INPUT_PORTS_END
465467
r869r870
467469/********************/
468470/* TX-1 Memory Maps */
469471/********************/
470static ADDRESS_MAP_START( tx1_master, ADDRESS_SPACE_PROGRAM, 8 )
471      AM_RANGE(0x00000, 0x00fff) AM_MIRROR(0x1000) AM_RAM              /* RAM */
472      AM_RANGE(0x02000, 0x02fff) AM_MIRROR(0x1000) AM_RAM              /* RAM */
473      AM_RANGE(0x04000, 0x04fff) AM_MIRROR(0x1000) AM_RAM              /* Backup RAM */
474      AM_RANGE(0x06000, 0x06008) AM_READWRITE(crt_read, crt_write)
475      AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA8_RAM,tx1_vram_w) AM_BASE(&tx1_vram)
476      AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1)                    /* Road/common RAM */
477      AM_RANGE(0x0b000, 0x0b000) AM_READWRITE (input_port_1_r, z80_busreq)
478      AM_RANGE(0x0b001, 0x0b001) AM_READWRITE (input_port_0_r, MWA8_NOP)
479      AM_RANGE(0x0c000, 0x0c001) AM_RAM                                 /* /SCOLST */
480      AM_RANGE(0x0d000, 0x0d001) AM_RAM                                 /* /SLINCS */
481      AM_RANGE(0x0e000, 0x0e001) AM_RAM                                 /* /SLOCK  */
482      AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA8_NOP, resume_slave)          /* Watchdog and slave resume */
483      AM_RANGE(0x10000, 0x13fff) AM_ROM                                         /* Z80 ROM */
484      AM_RANGE(0x16000, 0x16fff) AM_READWRITE (z80_shared_r, z80_shared_w)
485      AM_RANGE(0xf0000, 0xfffff) AM_ROM
472static ADDRESS_MAP_START( tx1_master, ADDRESS_SPACE_PROGRAM, 16 )
473   AM_RANGE(0x00000, 0x00fff) AM_MIRROR(0x1000) AM_RAM              /* RAM */
474   AM_RANGE(0x02000, 0x02fff) AM_MIRROR(0x1000) AM_RAM              /* RAM */
475   AM_RANGE(0x04000, 0x04fff) AM_MIRROR(0x1000) AM_RAM              /* Backup RAM */
476   AM_RANGE(0x06000, 0x06009) AM_READWRITE(crt_read, crt_write)
477   AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA16_RAM,tx1_vram_w) AM_BASE(&tx1_vram)
478   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1)                    /* Road/common RAM */
479   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE (input_port_0_word_r, z80_busreq)
480   AM_RANGE(0x0c000, 0x0c001) AM_RAM                                 /* /SCOLST */
481   AM_RANGE(0x0d000, 0x0d001) AM_RAM                                 /* /SLINCS */
482   AM_RANGE(0x0e000, 0x0e001) AM_RAM                                 /* /SLOCK  */
483   AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA16_NOP, resume_slave)          /* Watchdog and slave resume */
484   AM_RANGE(0x10000, 0x13fff) AM_ROM                                         /* Z80 ROM */
485   AM_RANGE(0x16000, 0x16fff) AM_READWRITE (z80_shared_r, z80_shared_w)
486   AM_RANGE(0xf0000, 0xfffff) AM_ROM
486487ADDRESS_MAP_END
487488
488489/* Lot of unknown writes - I haven't investigated further */
489static ADDRESS_MAP_START( tx1_slave, ADDRESS_SPACE_PROGRAM, 8 )
490        AM_RANGE(0x00000, 0x007ff) AM_MIRROR(0x800) AM_RAM               /* Arithmetic RAM (IC169, IC158) A10 is grounded */
491        AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)   /* Common RAM (IC195, IC210) */
492        AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&tx1_object_ram) AM_SIZE(&tx1_objectram_size)   /* Object RAM (IC43, IC68) A10-A8 are grounded*/
493        AM_RANGE(0x02400, 0x027ff) AM_RAM               /* /BANKCS */
494        AM_RANGE(0x02800, 0x02bff) AM_READWRITE(halt_slave_r, MWA8_NOP)  /* /DRAK */
495        AM_RANGE(0x02C00, 0x02fff) AM_RAM               /* /FLGCS */
496        AM_RANGE(0x03000, 0x03fff) AM_RAM               /* SN74S516 arithmetic unit */
497        AM_RANGE(0x04000, 0x07fff) AM_ROM               /* ROM mirror? */
498        AM_RANGE(0x08000, 0x0bfff) AM_ROM               /* ROM mirror? */
499        AM_RANGE(0x0c000, 0x0ffff) AM_ROM               /* ROM mirror? */
490static ADDRESS_MAP_START( tx1_slave, ADDRESS_SPACE_PROGRAM, 16 )
491   AM_RANGE(0x00000, 0x007ff) AM_MIRROR(0x800) AM_RAM               /* Arithmetic RAM (IC169, IC158) A10 is grounded */
492   AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)   /* Common RAM (IC195, IC210) */
493   AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&tx1_object_ram) AM_SIZE(&tx1_objectram_size)   /* Object RAM (IC43, IC68) A10-A8 are grounded*/
494   AM_RANGE(0x02400, 0x027ff) AM_RAM               /* /BANKCS */
495   AM_RANGE(0x02800, 0x02bff) AM_READWRITE(halt_slave_r, MWA16_NOP)  /* /DRAK */
496   AM_RANGE(0x02C00, 0x02fff) AM_RAM               /* /FLGCS */
497   AM_RANGE(0x03000, 0x03fff) AM_RAM               /* SN74S516 arithmetic unit */
498   AM_RANGE(0x04000, 0x07fff) AM_ROM               /* ROM mirror? */
499   AM_RANGE(0x08000, 0x0bfff) AM_ROM               /* ROM mirror? */
500   AM_RANGE(0x0c000, 0x0ffff) AM_ROM               /* ROM mirror? */
500501   AM_RANGE(0xfc000, 0xfffff) AM_ROM
501502ADDRESS_MAP_END
502503
r869r870
509510   AM_RANGE(0x5000, 0x5003) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)
510511   AM_RANGE(0x6000, 0x6003) AM_RAM                                  /* 8253A PIT */
511512   AM_RANGE(0x7000, 0x70DF) AM_RAM                                  /* Propigate input signals into 8255 */
512          AM_RANGE(0xb00b, 0xb00b) AM_RAM                                  /* Read once - TS?*/
513   AM_RANGE(0xb00b, 0xb00b) AM_RAM                                  /* Read once - TS?*/
513514ADDRESS_MAP_END
514515
515516
r869r870
524525/* Buggy Boy Memory Maps */
525526/*************************/
526527
527static READ8_HANDLER(input_port_1A_r)
528static READ16_HANDLER(input_port_0A_r)
528529{
529       return (readinputport(1) & 0xfe) | TS;
530   return (readinputport(0) & 0xfffe) | TS;
530531}
531532
532static ADDRESS_MAP_START( buggyb1_master, ADDRESS_SPACE_PROGRAM, 8 )
533        AM_RANGE(0x00000, 0x03fff) AM_RAM                             /* 1kB RAM - battery backed */
534        AM_RANGE(0x04000, 0x04fff) AM_READWRITE(crt_read, crt_write)  /* HD46505S-2 or equivalent CRT controller */
535        AM_RANGE(0x08000, 0x08fff) AM_READWRITE(MRA8_RAM,buggyb1_vram_w) AM_BASE(&buggyb1_vram)         /* Character mapped RAM */
536        AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&bb_rcram) AM_SIZE(&bb_rcram_size)     /* Road/common RAM - 1800-18ff & 1c00-1cff are read by road H/W */
537        AM_RANGE(0x0b000, 0x0b000) AM_READWRITE (input_port_1A_r, z80_busreq)     /* Dipswitches and Z80 busreq */
538        AM_RANGE(0x0b001, 0x0b001) AM_READWRITE (input_port_0_r, MWA8_NOP)
539        AM_RANGE(0x0c000, 0x0c001) AM_RAM                                         /* /SCOLW  */
540        AM_RANGE(0x0d000, 0x0d003) AM_RAM                                         /* /SLINCS */
541        AM_RANGE(0x0e000, 0x0e001) AM_RAM AM_BASE(&bb_sky)                        /* /SKYCS  */
542        AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA8_NOP, resume_slave)          /* Watchdog and slave resume */
543        AM_RANGE(0x10000, 0x17fff) AM_ROM                                         /* Z80 ROM */
544        AM_RANGE(0x18000, 0x18fff) AM_READWRITE (z80_shared_r, z80_shared_w)
545        AM_RANGE(0x20000, 0x2ffff) AM_ROM
533static ADDRESS_MAP_START( buggyb1_master, ADDRESS_SPACE_PROGRAM, 16 )
534   AM_RANGE(0x00000, 0x03fff) AM_RAM                             /* 1kB RAM - battery backed */
535   AM_RANGE(0x04000, 0x04fff) AM_READWRITE(crt_read, crt_write)  /* HD46505S-2 or equivalent CRT controller */
536   AM_RANGE(0x08000, 0x08fff) AM_READWRITE(MRA16_RAM,buggyb1_vram_w) AM_BASE(&buggyb1_vram)         /* Character mapped RAM */
537   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&bb_rcram) AM_SIZE(&bb_rcram_size)     /* Road/common RAM - 1800-18ff & 1c00-1cff are read by road H/W */
538   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE (input_port_0A_r, z80_busreq)     /* Dipswitches and Z80 busreq */
539   AM_RANGE(0x0c000, 0x0c001) AM_RAM                                         /* /SCOLW  */
540   AM_RANGE(0x0d000, 0x0d003) AM_RAM                                         /* /SLINCS */
541   AM_RANGE(0x0e000, 0x0e001) AM_RAM AM_BASE(&bb_sky)                        /* /SKYCS  */
542   AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA16_NOP, resume_slave)          /* Watchdog and slave resume */
543   AM_RANGE(0x10000, 0x17fff) AM_ROM                                         /* Z80 ROM */
544   AM_RANGE(0x18000, 0x18fff) AM_READWRITE (z80_shared_r, z80_shared_w)
545   AM_RANGE(0x20000, 0x2ffff) AM_ROM
546546   AM_RANGE(0xf0000, 0xfffff) AM_ROM
547547ADDRESS_MAP_END
548548
549549
550static ADDRESS_MAP_START( buggyboy_master, ADDRESS_SPACE_PROGRAM, 8 )
551        AM_RANGE(0x00000, 0x03fff) AM_RAM                             /* 1kB RAM - battery backed */
552        AM_RANGE(0x04000, 0x04fff) AM_READWRITE(crt_read, crt_write)  /* HD46505S-2 or equivalent CRT controller */
553        AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA8_RAM,buggyboy_vram_w) AM_BASE(&buggyboy_vram)           /* Character mapped RAM */
554        AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&bb_rcram) AM_SIZE(&bb_rcram_size)            /* Road/common RAM */
555        AM_RANGE(0x0b000, 0x0b000) AM_READWRITE (input_port_1A_r, z80_busreq)     /* Dipswitches and Z80 busreq */
556        AM_RANGE(0x0b001, 0x0b001) AM_READWRITE (input_port_0_r, MWA8_NOP)
557        AM_RANGE(0x0c000, 0x0c001) AM_RAM                                         /* /SCOLW  */
558        AM_RANGE(0x0d000, 0x0d003) AM_RAM                                         /* /SLINCS */
559        AM_RANGE(0x0e000, 0x0e001) AM_RAM AM_BASE(&bb_sky)                        /* /SKYCS  */
560        AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA8_NOP, resume_slave)          /* Watchdog and slave resume */
561        AM_RANGE(0x10000, 0x17fff) AM_ROM                                         /* Z80 ROM */
562        AM_RANGE(0x18000, 0x18fff) AM_READWRITE (z80_shared_r, z80_shared_w)
563        AM_RANGE(0x20000, 0x2ffff) AM_ROM
550static ADDRESS_MAP_START( buggyboy_master, ADDRESS_SPACE_PROGRAM, 16 )
551   AM_RANGE(0x00000, 0x03fff) AM_RAM                             /* 1kB RAM - battery backed */
552   AM_RANGE(0x04000, 0x04fff) AM_READWRITE(crt_read, crt_write)  /* HD46505S-2 or equivalent CRT controller */
553   AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA16_RAM,buggyboy_vram_w) AM_BASE(&buggyboy_vram)           /* Character mapped RAM */
554   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&bb_rcram) AM_SIZE(&bb_rcram_size)            /* Road/common RAM */
555   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE (input_port_0A_r, z80_busreq)     /* Dipswitches and Z80 busreq */
556   AM_RANGE(0x0c000, 0x0c001) AM_RAM                                         /* /SCOLW  */
557   AM_RANGE(0x0d000, 0x0d003) AM_RAM                                         /* /SLINCS */
558   AM_RANGE(0x0e000, 0x0e001) AM_RAM AM_BASE(&bb_sky)                        /* /SKYCS  */
559   AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA16_NOP, resume_slave)          /* Watchdog and slave resume */
560   AM_RANGE(0x10000, 0x17fff) AM_ROM                                         /* Z80 ROM */
561   AM_RANGE(0x18000, 0x18fff) AM_READWRITE (z80_shared_r, z80_shared_w)
562   AM_RANGE(0x20000, 0x2ffff) AM_ROM
564563   AM_RANGE(0xf0000, 0xfffff) AM_ROM
565564ADDRESS_MAP_END
566565
r869r870
580579-FLAGS  = 24E0-F, 24F0-F
581580*/
582581
583static READ8_HANDLER(GAS_r)
582static READ16_HANDLER(GAS_r)
584583{
585       if(offset >= 0xe0)  halt_slave();
584       if(offset >= 0xe0/2)  halt_slave();
586585       return 0;
587586}
588587
589static WRITE8_HANDLER(GAS_w)
588static WRITE16_HANDLER(GAS_w)
590589{
591       if(offset >= 0xe0)  halt_slave();
590       if(offset >= 0xe0/2)  halt_slave();
592591}
593592
594593
r869r870
619618*/
620619
621620/* Memory map and ROM contents are the same for both versions */
622static ADDRESS_MAP_START( buggyboy_slave, ADDRESS_SPACE_PROGRAM, 8 )
623      AM_RANGE(0x00000, 0x00fff) AM_RAM                           /* 4kB RAM */
624      AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)               /* Road/Common RAM */
625      AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&bb_objram) AM_SIZE(&bb_objectram_size)    /* RAM A10-A8 are grounded */
626      AM_RANGE(0x02400, 0x024ff) AM_READWRITE (GAS_r, GAS_w)      /* Road control registers */
627      AM_RANGE(0x03000, 0x03fff) AM_READWRITE (BB_AU_R, BB_AU_W)  /* SN74S516 arithmetic unit */
628      AM_RANGE(0x04000, 0x07fff) AM_ROM                           /* ROM mirror */
629      AM_RANGE(0x08000, 0x0bfff) AM_ROM                           /* ROM mirror */
630      AM_RANGE(0x0c000, 0x0ffff) AM_ROM                           /* ROM mirror */
631      AM_RANGE(0xfc000, 0xfffff) AM_ROM                           /* ROM */
621static ADDRESS_MAP_START( buggyboy_slave, ADDRESS_SPACE_PROGRAM, 16 )
622   AM_RANGE(0x00000, 0x00fff) AM_RAM                           /* 4kB RAM */
623   AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)               /* Road/Common RAM */
624   AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&bb_objram) AM_SIZE(&bb_objectram_size)    /* RAM A10-A8 are grounded */
625   AM_RANGE(0x02400, 0x024ff) AM_READWRITE (GAS_r, GAS_w)      /* Road control registers */
626   AM_RANGE(0x03000, 0x03fff) AM_READWRITE (BB_AU_R, BB_AU_W)  /* SN74S516 arithmetic unit */
627   AM_RANGE(0x04000, 0x07fff) AM_ROM                           /* ROM mirror */
628   AM_RANGE(0x08000, 0x0bfff) AM_ROM                           /* ROM mirror */
629   AM_RANGE(0x0c000, 0x0ffff) AM_ROM                           /* ROM mirror */
630   AM_RANGE(0xfc000, 0xfffff) AM_ROM                           /* ROM */
632631ADDRESS_MAP_END
633632
634633
r869r870
645644   AM_RANGE(0x4000, 0x47ff) AM_RAM  AM_BASE(&z80_ram)                /* 2kB RAM - shared with Main CPU */
646645   AM_RANGE(0x6000, 0x6000) AM_READ(input_port_4_r)                  /* Steering and accelerator */
647646   AM_RANGE(0x6001, 0x6001) AM_READ(input_port_5_r)                  /* Brake (NOT USED) */
648        AM_RANGE(0x6800, 0x6803) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)   /* Digital inputs (coins etc.) - check me */
647   AM_RANGE(0x6800, 0x6803) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)   /* Digital inputs (coins etc.) - check me */
649648   AM_RANGE(0x7000, 0x7003) AM_RAM                                   /* 8253 Programmable Interval Timer (Engine Sound) */
650649   AM_RANGE(0xc024, 0xc024) AM_WRITE(_TS_)                           /* /TS? */
651650   AM_RANGE(0x7800, 0x7800) AM_WRITE(z80_intreq_w)                     /* /INTREQ? */
r869r870
667666static ADDRESS_MAP_START( buggyboy_sound_io, ADDRESS_SPACE_IO, 8 )
668667   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
669668   AM_RANGE(0x40, 0x40) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
670          AM_RANGE(0x41, 0x41) AM_WRITE(AY8910_control_port_0_w)
669   AM_RANGE(0x41, 0x41) AM_WRITE(AY8910_control_port_0_w)
671670
672671   AM_RANGE(0x80, 0x80) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
673          AM_RANGE(0x81, 0x81) AM_WRITE(AY8910_control_port_1_w)
672   AM_RANGE(0x81, 0x81) AM_WRITE(AY8910_control_port_1_w)
674673ADDRESS_MAP_END
675674
676675
r869r870
906905}
907906
908907static MACHINE_DRIVER_START( tx1 )
909   MDRV_CPU_ADD(I86,5000000 )
908   MDRV_CPU_ADD(I8086,5000000 )
910909   MDRV_CPU_PROGRAM_MAP(tx1_master,0)
911910   MDRV_CPU_PERIODIC_INT(main_irq, 46 )        /* To do: measure HD46505 CUDISP output rate */
912911   //MDRV_WATCHDOG_TIME_INIT(MAME_TIME_IN_SEC(5))  /* To do: measure watchdog time interval */
913912
914   MDRV_CPU_ADD(I86,5000000 )
913   MDRV_CPU_ADD(I8086,5000000 )
915914   MDRV_CPU_PROGRAM_MAP(tx1_slave,0)
916915
917916   MDRV_CPU_ADD(Z80,3750000 )                  /* Guess */
918   /* audio CPU */
919917   MDRV_CPU_PROGRAM_MAP(tx1_sound_prg,0)
920918   MDRV_CPU_IO_MAP(tx1_sound_io,0)
921919   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 915.52734375/2 )         /* Guess */
r869r870
960958MACHINE_DRIVER_END
961959
962960static MACHINE_DRIVER_START( buggyboy )
963   MDRV_CPU_ADD(I86,5000000 )
961   MDRV_CPU_ADD(I8086,5000000 )
964962   MDRV_CPU_PROGRAM_MAP(buggyboy_master,0)
965963   MDRV_CPU_PERIODIC_INT(main_irq, 46 )    /* To do: measure HD46505 CUDISP output rate */
966964   //MDRV_WATCHDOG_TIME_INIT(MAME_TIME_IN_SEC(5))  /* To do: measure watchdog time interval */
967965
968   MDRV_CPU_ADD(I86,5000000 )
966   MDRV_CPU_ADD(I8086,5000000 )
969967   MDRV_CPU_PROGRAM_MAP(buggyboy_slave,0)
970968
971969   MDRV_CPU_ADD(Z80,3750000 ) /* audio CPU */
r869r870
10231021
10241022/* Need to verify clocks on real PCB */
10251023static MACHINE_DRIVER_START( buggyb1 )
1026   MDRV_CPU_ADD(I86,5000000 )
1024   MDRV_CPU_ADD(I8086,5000000 )
10271025   MDRV_CPU_PROGRAM_MAP(buggyb1_master,0)
10281026   MDRV_CPU_PERIODIC_INT(main_irq, 46 )    /* To do: measure HD46505 CUDISP output rate */
10291027   //MDRV_WATCHDOG_TIME_INIT(MAME_TIME_IN_SEC(5))  /* To do: measure watchdog time interval */
10301028
1031   MDRV_CPU_ADD(I86,5000000 )
1029   MDRV_CPU_ADD(I8086,5000000 )
10321030   MDRV_CPU_PROGRAM_MAP(buggyboy_slave,0)
10331031
10341032   MDRV_CPU_ADD(Z80,3750000 ) /* audio CPU */
src/mame/drivers/thayers.c
r869r870
264264   {
265265      SET_Z80_TIMER_INT();
266266      irq_flag = 1;
267      logerror("THE COP IS TRIPPING THE TIMER INTERRUPT\n");
267268   }
269   else
270   {
271      CLEAR_Z80_TIMER_INT();
272   }
268273
269274   /* Pin d1 - DATA READY INT */
270275   if (!(data & 0x02))
271276   {
272277      SET_Z80_DATA_RDY_INT();
273278      irq_flag = 1;
279      logerror("THE COP IS TRIPPING THE DATA READY INTERRUPT\n");
274280   }
281   else
282   {
283      CLEAR_Z80_DATA_RDY_INT();
284   }
275285
276286   /* Assert the Z80's interrupt line if necessary */
277287   if (irq_flag)
278288   {
279      logerror("THE COP IS SETTING THE IRQ LINE\n");
280289      cpunum_set_input_line(0, 0, ASSERT_LINE);
281290   }
282291}
r869r870
332341   AM_RANGE(COP400_PORT_D,  COP400_PORT_D)   AM_WRITE(cop_d_write)
333342   AM_RANGE(COP400_PORT_SK, COP400_PORT_SK)  AM_WRITE(cop_sk_write)
334343   AM_RANGE(COP400_PORT_SIO,COP400_PORT_SIO) AM_READWRITE(port_tag_to_handler8("THAYERS_LETTERS"),cop_sio_write)   /* Unemulated in COP40x core, so nothing happens ATM */
335ADDRESS_MAP_END
344ADDRESS_MAP_END                                                                              /* This is also very wrong.  The keyboard interface needs to
345                                                                                                                       be understood much better than what I have here */
336346
337
338347/* PORTS */
339348INPUT_PORTS_START( thayers )
340349   PORT_START_TAG("DSWA")
r869r870
480489   ROM_LOAD( "tq_cop.bin", 0x000, 0x400, CRC(6748e6b3) SHA1(5d7d1ecb57c1501ef6a2d9691eecc9970586606b) )
481490ROM_END
482491
492ROM_START( thayersa )
493   ROM_REGION( 0xe000, REGION_CPU1, 0 )
494   ROM_LOAD( "tq_u33.bin", 0x0000, 0x8000, CRC(82df5d89) SHA1(58dfd62bf8c5a55d1eba397d2c284e99a4685a3f) )
495   ROM_LOAD( "tq_u1.bin",  0xc000, 0x2000, CRC(33817e25) SHA1(f9750da863dd57fe2f5b6e8fce9c6695dc5c9adc) )
483496
497   ROM_REGION( 0x400, REGION_CPU2, 0 )
498   ROM_LOAD( "tq_cop.bin", 0x000, 0x400, CRC(6748e6b3) SHA1(5d7d1ecb57c1501ef6a2d9691eecc9970586606b) )
499ROM_END
500
484501static DRIVER_INIT( thayers )
485502{
486503   Z80_IRQ_STATUS_CLEAR();
r869r870
489506   cop_g_latch = 0xff;
490507}
491508
492/*    YEAR  NAME     PARENT   MACHINE  INPUT    INIT     MONITOR  COMPANY               FULLNAME           FLAGS) */
493GAME( 1983, thayers, 0,       thayers, thayers, thayers, ROT0,    "RDI Video Systems",  "Thayer's Quest",  GAME_NOT_WORKING|GAME_NO_SOUND)
509/*    YEAR  NAME      PARENT   MACHINE  INPUT    INIT     MONITOR  COMPANY               FULLNAME                           FLAGS) */
510GAME( 1983, thayers,  0,       thayers, thayers, thayers, ROT0,    "RDI Video Systems",  "Thayer's Quest",                  GAME_NOT_WORKING|GAME_NO_SOUND)
511GAME( 1983, thayersa, thayers, thayers, thayers, thayers, ROT0,    "RDI Video Systems",  "Thayer's Quest (Alternate Set)",  GAME_NOT_WORKING|GAME_NO_SOUND)
src/mame/drivers/dassault.c
r869r870
568568   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
569569
570570   MDRV_SCREEN_REFRESH_RATE(60)
571   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
571   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
572572   MDRV_INTERLEAVE(140) /* 140 CPU slices per frame */
573573
574574   /* video hardware */
src/mame/drivers/tatsumi.c
r869r870
7878UINT16 *roundup5_d0000_ram, *roundup5_e0000_ram;
7979UINT8 *tatsumi_rom_sprite_lookup1, *tatsumi_rom_sprite_lookup2;
8080UINT8 *tatsumi_rom_clut0, *tatsumi_rom_clut1;
81UINT8 *roundup5_unknown0, *roundup5_unknown1, *roundup5_unknown2;
81UINT16 *roundup5_unknown0, *roundup5_unknown1, *roundup5_unknown2;
8282UINT8 *apache3_bg_ram;
8383
8484/***************************************************************************/
r869r870
9595
9696/***************************************************************************/
9797
98static ADDRESS_MAP_START( readmem_apache3, ADDRESS_SPACE_PROGRAM, 8 )
99   AM_RANGE(0x00000, 0x07fff) AM_READ(MRA8_RAM)
100   AM_RANGE(0x08000, 0x08fff) AM_READ(MRA8_RAM)
101   AM_RANGE(0x0c000, 0x0dfff) AM_READ(MRA8_RAM)
102//  AM_RANGE(0x0e800, 0x0e803) AM_READ(MRA_NOP) // CRT
103   AM_RANGE(0x0f000, 0x0f000) AM_READ(input_port_3_r) // Dip 1
104   AM_RANGE(0x0f001, 0x0f001) AM_READ(input_port_4_r) // Dip 2
105   AM_RANGE(0x0f800, 0x0f801) AM_READ(apache3_bank_r)
106   AM_RANGE(0x10000, 0x1ffff) AM_READ(apache3_v30_v20_r)
107   AM_RANGE(0x20000, 0x2ffff) AM_READ(tatsumi_v30_68000_r)
108   AM_RANGE(0xa0000, 0xfffff) AM_READ(MRA8_ROM)
98static ADDRESS_MAP_START( apache3_v30_map, ADDRESS_SPACE_PROGRAM, 16 )
99   AM_RANGE(0x00000, 0x07fff) AM_RAM
100   AM_RANGE(0x08000, 0x08fff) AM_READWRITE(MRA16_RAM, apache3_palette_w) AM_BASE(&paletteram16)
101   AM_RANGE(0x0c000, 0x0dfff) AM_READWRITE(MRA16_RAM, roundup5_text_w) AM_BASE(&videoram16)
102   AM_RANGE(0x0e800, 0x0e803) AM_WRITE(MWA16_NOP) // CRT
103   AM_RANGE(0x0f000, 0x0f001) AM_READ(input_port_3_word_r) // Dip 1+2
104   AM_RANGE(0x0f000, 0x0f001) AM_WRITE(MWA16_NOP) // todo
105   AM_RANGE(0x0f800, 0x0f801) AM_READWRITE(apache3_bank_r, apache3_bank_w)
106   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(apache3_v30_v20_r, apache3_v30_v20_w)
107   AM_RANGE(0x20000, 0x2ffff) AM_READWRITE(tatsumi_v30_68000_r, tatsumi_v30_68000_w)
108   AM_RANGE(0xa0000, 0xfffff) AM_ROM
109109ADDRESS_MAP_END
110110
111static ADDRESS_MAP_START( writemem_apache3, ADDRESS_SPACE_PROGRAM, 8 )
112   AM_RANGE(0x00000, 0x07fff) AM_WRITE(MWA8_RAM)
113   AM_RANGE(0x08000, 0x08fff) AM_WRITE(apache3_palette_w) AM_BASE(&paletteram)
114   AM_RANGE(0x0c000, 0x0dfff) AM_WRITE(roundup5_text_w) AM_BASE(&videoram)
115   AM_RANGE(0x0e800, 0x0e803) AM_WRITE(MWA8_NOP) // CRT
116   AM_RANGE(0x0f000, 0x0f001) AM_WRITE(MWA8_NOP) // todo
117   AM_RANGE(0x0f800, 0x0f801) AM_WRITE(apache3_bank_w)
118   AM_RANGE(0x10000, 0x1ffff) AM_WRITE(apache3_v30_v20_w)
119   AM_RANGE(0x20000, 0x23fff) AM_WRITE(tatsumi_v30_68000_w)
120   AM_RANGE(0xa0000, 0xfffff) AM_WRITE(MWA8_ROM)
121ADDRESS_MAP_END
122
123static ADDRESS_MAP_START( sub_readmem_apache3, ADDRESS_SPACE_PROGRAM, 16 )
124   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA16_ROM)
125   AM_RANGE(0x80000, 0x83fff) AM_READ(MRA16_RAM)
126   AM_RANGE(0x90000, 0x93fff) AM_READ(MRA16_RAM)
127   AM_RANGE(0xd0000, 0xdffff) AM_READ(MRA16_RAM)
128   AM_RANGE(0xe0000, 0xe7fff) AM_READ(apache3_z80_r)
129ADDRESS_MAP_END
130
131static ADDRESS_MAP_START( sub_writemem_apache3, ADDRESS_SPACE_PROGRAM, 16 )
132   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA16_ROM)
133   AM_RANGE(0x80000, 0x83fff) AM_WRITE(MWA16_RAM) AM_BASE(&tatsumi_68k_ram)
134   AM_RANGE(0x90000, 0x93fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16)
111static ADDRESS_MAP_START( apache3_68000_map, ADDRESS_SPACE_PROGRAM, 16 )
112   AM_RANGE(0x00000, 0x7ffff) AM_ROM
113   AM_RANGE(0x80000, 0x83fff) AM_RAM AM_BASE(&tatsumi_68k_ram)
114   AM_RANGE(0x90000, 0x93fff) AM_RAM AM_BASE(&spriteram16)
135115   AM_RANGE(0x9a000, 0x9a1ff) AM_WRITE(tatsumi_sprite_control_w) AM_BASE(&tatsumi_sprite_control_ram)
136116   AM_RANGE(0xa0000, 0xa0001) AM_WRITE(apache3_a0000_w)
137117   AM_RANGE(0xb0000, 0xb0001) AM_WRITE(apache3_irq_ack_w) //todo - z80 reset?
138118   AM_RANGE(0xc0000, 0xc0001) AM_WRITE(MWA16_RAM) AM_BASE(&tatsumi_c_ram)
139   AM_RANGE(0xd0000, 0xdffff) AM_WRITE(MWA16_RAM) AM_BASE(&apache3_g_ram)
140   AM_RANGE(0xe0000, 0xe7fff) AM_WRITE(apache3_z80_w)
119   AM_RANGE(0xd0000, 0xdffff) AM_RAM AM_BASE(&apache3_g_ram)
120   AM_RANGE(0xe0000, 0xe7fff) AM_READWRITE(apache3_z80_r, apache3_z80_w)
141121ADDRESS_MAP_END
142122
143static ADDRESS_MAP_START( readmem_iop_apache3, ADDRESS_SPACE_PROGRAM, 8 )
144   AM_RANGE(0x00000, 0x01fff) AM_READ(MRA8_RAM)
145   AM_RANGE(0x04000, 0x04003) AM_READ(MRA8_NOP) // piu select .. ?
146   AM_RANGE(0x06000, 0x06000) AM_READ(input_port_0_r) // esw
147   AM_RANGE(0x08001, 0x08001) AM_READ(tatsumi_hack_ym2151_r) //YM2151_status_port_0_r)
148   AM_RANGE(0x0a000, 0x0a000) AM_READ(tatsumi_hack_oki_r) //OKIM6295_status_0_r)
149   AM_RANGE(0x0e000, 0x0e000) AM_READ(apache3_adc_r) // adc
150   AM_RANGE(0xf0000, 0xfffff) AM_READ(MRA8_ROM)
151ADDRESS_MAP_END
152
153static ADDRESS_MAP_START( writemem_iop_apache3, ADDRESS_SPACE_PROGRAM, 8 )
154   AM_RANGE(0x00000, 0x01fff) AM_WRITE(MWA8_RAM)
155   AM_RANGE(0x04000, 0x04003) AM_WRITE(MWA8_NOP) // piu select .. ?
123static ADDRESS_MAP_START( apache3_v20_map, ADDRESS_SPACE_PROGRAM, 8 )
124   AM_RANGE(0x00000, 0x01fff) AM_RAM
125   AM_RANGE(0x04000, 0x04003) AM_NOP // piu select .. ?
126   AM_RANGE(0x06000, 0x06001) AM_READ(input_port_0_r) // esw
156127   AM_RANGE(0x08000, 0x08000) AM_WRITE(YM2151_register_port_0_w)
157   AM_RANGE(0x08001, 0x08001) AM_WRITE(YM2151_data_port_0_w)
158   AM_RANGE(0x0a000, 0x0a000) AM_WRITE(OKIM6295_data_0_w)
159   AM_RANGE(0x0e000, 0x0e007) AM_WRITE(apache3_adc_w) //adc select
160   AM_RANGE(0xf0000, 0xfffff) AM_WRITE(MWA8_ROM)
128   AM_RANGE(0x08001, 0x08001) AM_READWRITE(tatsumi_hack_ym2151_r, YM2151_data_port_0_w)
129   AM_RANGE(0x0a000, 0x0a000) AM_READWRITE(tatsumi_hack_oki_r, OKIM6295_data_0_w)
130   AM_RANGE(0x0e000, 0x0e007) AM_READWRITE(apache3_adc_r, apache3_adc_w) //adc select
131   AM_RANGE(0xf0000, 0xfffff) AM_ROM
161132ADDRESS_MAP_END
162133
163static ADDRESS_MAP_START( z80_readmem_apache3, ADDRESS_SPACE_PROGRAM, 8 )
164   AM_RANGE(0x00000, 0x1fff) AM_READ(MRA8_RAM)
165   AM_RANGE(0x08000, 0x83ff) AM_READ(MRA8_RAM)
134static ADDRESS_MAP_START( apache3_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
135   AM_RANGE(0x00000, 0x1fff) AM_RAM AM_BASE(&apache3_z80_ram)
136   AM_RANGE(0x08000, 0x83ff) AM_RAM AM_BASE(&apache3_bg_ram)
166137ADDRESS_MAP_END
167138
168static ADDRESS_MAP_START( z80_writemem_apache3, ADDRESS_SPACE_PROGRAM, 8 )
169   AM_RANGE(0x00000, 0x1fff) AM_WRITE(MWA8_RAM) AM_BASE(&apache3_z80_ram)
170   AM_RANGE(0x08000, 0x83ff) AM_WRITE(MWA8_RAM) AM_BASE(&apache3_bg_ram)
171ADDRESS_MAP_END
172
173139/*****************************************************************/
174140
175static ADDRESS_MAP_START( readmem_roundup5, ADDRESS_SPACE_PROGRAM, 8 )
176   AM_RANGE(0x00000, 0x07fff) AM_READ(MRA8_RAM)
177   AM_RANGE(0x08000, 0x0bfff) AM_READ(MRA8_RAM)
178   AM_RANGE(0x0d000, 0x0d000) AM_READ(input_port_3_r) /* Dip 1 */
179   AM_RANGE(0x0d001, 0x0d001) AM_READ(input_port_4_r) /* Dip 2 */
180   AM_RANGE(0x0f000, 0x0ffff) AM_READ(MRA8_RAM)
181   AM_RANGE(0x10000, 0x1ffff) AM_READ(roundup_v30_z80_r)
182   AM_RANGE(0x20000, 0x2ffff) AM_READ(tatsumi_v30_68000_r)
183   AM_RANGE(0x30000, 0x3ffff) AM_READ(roundup5_vram_r)
184   AM_RANGE(0x80000, 0xfffff) AM_READ(MRA8_ROM)
185ADDRESS_MAP_END
186
187static ADDRESS_MAP_START( writemem_roundup5, ADDRESS_SPACE_PROGRAM, 8 )
188   AM_RANGE(0x00000, 0x07fff) AM_WRITE(MWA8_RAM)
189   AM_RANGE(0x08000, 0x0bfff) AM_WRITE(roundup5_text_w) AM_BASE(&videoram)
141static ADDRESS_MAP_START( roundup5_v30_map, ADDRESS_SPACE_PROGRAM, 16 )
142   AM_RANGE(0x00000, 0x07fff) AM_RAM
143   AM_RANGE(0x08000, 0x0bfff) AM_READWRITE(MRA16_RAM, roundup5_text_w) AM_BASE(&videoram16)
190144   AM_RANGE(0x0c000, 0x0c003) AM_WRITE(roundup5_crt_w)
191   AM_RANGE(0x0d400, 0x0d40f) AM_WRITE(MWA8_RAM) AM_BASE(&roundup5_unknown0)
192   AM_RANGE(0x0d800, 0x0d801) AM_WRITE(MWA8_RAM) AM_BASE(&roundup5_unknown1) // VRAM2 X scroll (todo)
193   AM_RANGE(0x0dc00, 0x0dc01) AM_WRITE(MWA8_RAM) AM_BASE(&roundup5_unknown2) // VRAM2 Y scroll (todo)
145   AM_RANGE(0x0d000, 0x0d001) AM_READ(input_port_3_word_r) /* Dip 1+2 */
146   AM_RANGE(0x0d400, 0x0d40f) AM_WRITE(MWA16_RAM) AM_BASE(&roundup5_unknown0)
147   AM_RANGE(0x0d800, 0x0d801) AM_WRITE(MWA16_RAM) AM_BASE(&roundup5_unknown1) // VRAM2 X scroll (todo)
148   AM_RANGE(0x0dc00, 0x0dc01) AM_WRITE(MWA16_RAM) AM_BASE(&roundup5_unknown2) // VRAM2 Y scroll (todo)
194149   AM_RANGE(0x0e000, 0x0e001) AM_WRITE(roundup5_control_w)
195   AM_RANGE(0x0f000, 0x0ffff) AM_WRITE(roundup5_palette_w) AM_BASE(&paletteram)
196   AM_RANGE(0x10000, 0x1ffff) AM_WRITE(roundup_v30_z80_w)
197   AM_RANGE(0x20000, 0x23fff) AM_WRITE(tatsumi_v30_68000_w)
198   AM_RANGE(0x30000, 0x3ffff) AM_WRITE(roundup5_vram_w)
199   AM_RANGE(0x80000, 0xfffff) AM_WRITE(MWA8_ROM)
150   AM_RANGE(0x0f000, 0x0ffff) AM_READWRITE(MRA16_RAM, roundup5_palette_w) AM_BASE(&paletteram16)
151   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(roundup_v30_z80_r, roundup_v30_z80_w)
152   AM_RANGE(0x20000, 0x2ffff) AM_READWRITE(tatsumi_v30_68000_r, tatsumi_v30_68000_w)
153   AM_RANGE(0x30000, 0x3ffff) AM_READWRITE(roundup5_vram_r, roundup5_vram_w)
154   AM_RANGE(0x80000, 0xfffff) AM_ROM
200155ADDRESS_MAP_END
201156
202static ADDRESS_MAP_START( readmem_roundup5_sub, ADDRESS_SPACE_PROGRAM, 16 )
203   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA16_ROM)
204   AM_RANGE(0x80000, 0x83fff) AM_READ(MRA16_RAM)
205   AM_RANGE(0x90000, 0x93fff) AM_READ(MRA16_RAM)
206   AM_RANGE(0xa0000, 0xa0fff) AM_READ(MRA16_RAM)
207   AM_RANGE(0xb0000, 0xb0fff) AM_READ(MRA16_RAM)
208   AM_RANGE(0xc0000, 0xc0fff) AM_READ(MRA16_RAM)
209ADDRESS_MAP_END
210
211static ADDRESS_MAP_START( writemem_roundup5_sub, ADDRESS_SPACE_PROGRAM, 16 )
212   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA16_ROM)
213   AM_RANGE(0x80000, 0x83fff) AM_WRITE(MWA16_RAM) AM_BASE(&tatsumi_68k_ram)
214   AM_RANGE(0x90000, 0x93fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16)
157static ADDRESS_MAP_START( roundup5_68000_map, ADDRESS_SPACE_PROGRAM, 16 )
158   AM_RANGE(0x00000, 0x7ffff) AM_ROM
159   AM_RANGE(0x80000, 0x83fff) AM_RAM AM_BASE(&tatsumi_68k_ram)
160   AM_RANGE(0x90000, 0x93fff) AM_RAM AM_BASE(&spriteram16)
215161   AM_RANGE(0x9a000, 0x9a1ff) AM_WRITE(tatsumi_sprite_control_w) AM_BASE(&tatsumi_sprite_control_ram)
216   AM_RANGE(0xa0000, 0xa0fff) AM_WRITE(MWA16_RAM) AM_BASE(&roundup_r_ram) // Road control data
217   AM_RANGE(0xb0000, 0xb0fff) AM_WRITE(MWA16_RAM) AM_BASE(&roundup_p_ram) // Road pixel data
218   AM_RANGE(0xc0000, 0xc0fff) AM_WRITE(MWA16_RAM) AM_BASE(&roundup_l_ram) // Road colour data
162   AM_RANGE(0xa0000, 0xa0fff) AM_RAM AM_BASE(&roundup_r_ram) // Road control data
163   AM_RANGE(0xb0000, 0xb0fff) AM_RAM AM_BASE(&roundup_p_ram) // Road pixel data
164   AM_RANGE(0xc0000, 0xc0fff) AM_RAM AM_BASE(&roundup_l_ram) // Road colour data
219165   AM_RANGE(0xd0002, 0xd0003) AM_WRITE(roundup5_d0000_w) AM_BASE(&roundup5_d0000_ram)
220166   AM_RANGE(0xe0000, 0xe0001) AM_WRITE(roundup5_e0000_w) AM_BASE(&roundup5_e0000_ram)
221167ADDRESS_MAP_END
222168
223static ADDRESS_MAP_START( readmem_roundup5_sound, ADDRESS_SPACE_PROGRAM, 8 )
224   AM_RANGE(0x0000, 0xdfff) AM_READ(MRA8_ROM)
225   AM_RANGE(0xe000, 0xffef) AM_READ(MRA8_RAM) // maybe less than this...
226   AM_RANGE(0xfff1, 0xfff1) AM_READ(tatsumi_hack_ym2151_r) //YM2151_status_port_0_r)
227   AM_RANGE(0xfff4, 0xfff4) AM_READ(tatsumi_hack_oki_r) //OKIM6295_status_0_r)
169static ADDRESS_MAP_START( roundup5_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
170   AM_RANGE(0x0000, 0xdfff) AM_ROM
171   AM_RANGE(0xe000, 0xffef) AM_RAM
172   AM_RANGE(0xfff0, 0xfff0) AM_WRITE(YM2151_register_port_0_w)
173   AM_RANGE(0xfff1, 0xfff1) AM_READWRITE(tatsumi_hack_ym2151_r, YM2151_data_port_0_w)
174   AM_RANGE(0xfff4, 0xfff4) AM_READWRITE(tatsumi_hack_oki_r, OKIM6295_data_0_w)
228175   AM_RANGE(0xfff8, 0xfff8) AM_READ(input_port_0_r)
229176   AM_RANGE(0xfff9, 0xfff9) AM_READ(input_port_1_r)
230177   AM_RANGE(0xfffc, 0xfffc) AM_READ(input_port_2_r)
231ADDRESS_MAP_END
232
233static ADDRESS_MAP_START( writemem_roundup5_sound, ADDRESS_SPACE_PROGRAM, 8 )
234   AM_RANGE(0x0000, 0xdfff) AM_WRITE(MWA8_ROM)
235   AM_RANGE(0xe000, 0xffef) AM_WRITE(MWA8_RAM)
236   AM_RANGE(0xfff0, 0xfff0) AM_WRITE(YM2151_register_port_0_w)
237   AM_RANGE(0xfff1, 0xfff1) AM_WRITE(YM2151_data_port_0_w)
238   AM_RANGE(0xfff4, 0xfff4) AM_WRITE(OKIM6295_data_0_w)
239
240178   AM_RANGE(0xfff9, 0xfff9) AM_WRITE(MWA8_NOP) //irq ack?
241179   AM_RANGE(0xfffa, 0xfffa) AM_WRITE(MWA8_NOP) //irq ack?
242180ADDRESS_MAP_END
243181
244182/******************************************************************************/
245183
246static ADDRESS_MAP_START( readmem_cyclwarr_a, ADDRESS_SPACE_PROGRAM, 16 )
247   AM_RANGE(0x000000, 0x00ffff) AM_READ(MRA16_RAM)
248   AM_RANGE(0x03e000, 0x03efff) AM_READ(MRA16_RAM)
249   AM_RANGE(0x040000, 0x043fff) AM_READ(cyclwarr_cpu_bb_r)
250   AM_RANGE(0x080000, 0x08ffff) AM_READ(cyclwarr_videoram2_r)
251   AM_RANGE(0x090000, 0x09ffff) AM_READ(cyclwarr_videoram_r)
184static ADDRESS_MAP_START( cyclwarr_68000a_map, ADDRESS_SPACE_PROGRAM, 16 )
185   AM_RANGE(0x000000, 0x00dfff) AM_RAM AM_BASE(&cyclwarr_cpua_ram)
186   AM_RANGE(0x00e000, 0x00ffff) AM_RAM AM_BASE(&videoram16)
187   AM_RANGE(0x03e000, 0x03efff) AM_RAM
188   AM_RANGE(0x040000, 0x043fff) AM_READWRITE(cyclwarr_cpu_bb_r, cyclwarr_cpu_bb_w)
189   AM_RANGE(0x080000, 0x08ffff) AM_READWRITE(cyclwarr_videoram2_r, cyclwarr_videoram2_w) AM_BASE(&cyclwarr_videoram2)
190   AM_RANGE(0x090000, 0x09ffff) AM_READWRITE(cyclwarr_videoram_r, cyclwarr_videoram_w) AM_BASE(&cyclwarr_videoram)
252191   AM_RANGE(0x0b9002, 0x0b9009) AM_READ(cyclwarr_input_r) //b9008 - dips
253192   // ba000 + ba002 - dips
254193   AM_RANGE(0x0ba000, 0x0ba003) AM_READ(cyclwarr_input2_r) //temp
255194   AM_RANGE(0x0ba004, 0x0ba007) AM_READ(cyclwarr_input2_r)
256   AM_RANGE(0x0ba008, 0x0ba009) AM_READ(cyclwarr_control_r)
257   AM_RANGE(0x0c0000, 0x0c3fff) AM_READ(cyclwarr_sprite_r)
258   AM_RANGE(0x0d0000, 0x0d3fff) AM_READ(cyclwarr_palette_r)
259   AM_RANGE(0x140000, 0x1bffff) AM_READ(MRA16_BANK2) /* CPU B ROM */
260   AM_RANGE(0x2c0000, 0x33ffff) AM_READ(MRA16_BANK1) /* CPU A ROM */
261ADDRESS_MAP_END
262
263static ADDRESS_MAP_START( writemem_cyclwarr_a, ADDRESS_SPACE_PROGRAM, 16 )
264   AM_RANGE(0x000000, 0x00dfff) AM_WRITE(MWA16_RAM) AM_BASE(&cyclwarr_cpua_ram)
265   AM_RANGE(0x00e000, 0x00ffff) AM_WRITE(MWA16_RAM) AM_BASE(&videoram16)
266   AM_RANGE(0x03e000, 0x03efff) AM_WRITE(MWA16_RAM)
267   AM_RANGE(0x040000, 0x043fff) AM_WRITE(cyclwarr_cpu_bb_w)
268   AM_RANGE(0x080000, 0x08ffff) AM_WRITE(cyclwarr_videoram2_w) AM_BASE(&cyclwarr_videoram2)
269   AM_RANGE(0x090000, 0x09ffff) AM_WRITE(cyclwarr_videoram_w) AM_BASE(&cyclwarr_videoram)
270   AM_RANGE(0x0ba008, 0x0ba009) AM_WRITE(cyclwarr_control_w)
271   AM_RANGE(0x0c0000, 0x0c3fff) AM_WRITE(cyclwarr_sprite_w) AM_BASE(&spriteram16)
195   AM_RANGE(0x0ba008, 0x0ba009) AM_READWRITE(cyclwarr_control_r, cyclwarr_control_w)
196   AM_RANGE(0x0c0000, 0x0c3fff) AM_READWRITE(cyclwarr_sprite_r, cyclwarr_sprite_w) AM_BASE(&spriteram16)
272197   AM_RANGE(0x0ca000, 0x0ca1ff) AM_WRITE(tatsumi_sprite_control_w) AM_BASE(&tatsumi_sprite_control_ram)
273   AM_RANGE(0x0d0000, 0x0d3fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
198   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
199   AM_RANGE(0x140000, 0x1bffff) AM_ROMBANK(2) /* CPU B ROM */
200   AM_RANGE(0x2c0000, 0x33ffff) AM_ROMBANK(1) /* CPU A ROM */
274201ADDRESS_MAP_END
275202
276static ADDRESS_MAP_START( readmem_cyclwarr_b, ADDRESS_SPACE_PROGRAM, 16 )
277   AM_RANGE(0x000000, 0x00ffff) AM_READ(MRA16_RAM)
278   AM_RANGE(0x080000, 0x08ffff) AM_READ(cyclwarr_videoram2_r)
279   AM_RANGE(0x090000, 0x09ffff) AM_READ(cyclwarr_videoram_r)
280   AM_RANGE(0x0c0000, 0x0c3fff) AM_READ(cyclwarr_sprite_r)
281   AM_RANGE(0x0d0000, 0x0d3fff) AM_READ(cyclwarr_palette_r)
282   AM_RANGE(0x140000, 0x1bffff) AM_READ(MRA16_BANK2)
283   AM_RANGE(0x2c0000, 0x33ffff) AM_READ(MRA16_BANK1)
284ADDRESS_MAP_END
285
286static ADDRESS_MAP_START( writemem_cyclwarr_b, ADDRESS_SPACE_PROGRAM, 16 )
287   AM_RANGE(0x000000, 0x00dfff) AM_WRITE(MWA16_RAM) AM_BASE(&cyclwarr_cpub_ram)
288   AM_RANGE(0x00e000, 0x00ffff) AM_WRITE(MWA16_RAM)
289   AM_RANGE(0x080000, 0x08ffff) AM_WRITE(cyclwarr_videoram2_w)
290   AM_RANGE(0x090000, 0x09ffff) AM_WRITE(cyclwarr_videoram_w)
291   AM_RANGE(0x0c0000, 0x0c3fff) AM_WRITE(cyclwarr_sprite_w)
203static ADDRESS_MAP_START( cyclwarr_68000b_map, ADDRESS_SPACE_PROGRAM, 16 )
204   AM_RANGE(0x000000, 0x00dfff) AM_RAM AM_BASE(&cyclwarr_cpub_ram)
205   AM_RANGE(0x00e000, 0x00ffff) AM_RAM
206   AM_RANGE(0x080000, 0x08ffff) AM_READWRITE(cyclwarr_videoram2_r, cyclwarr_videoram2_w)
207   AM_RANGE(0x090000, 0x09ffff) AM_READWRITE(cyclwarr_videoram_r, cyclwarr_videoram_w)
208   AM_RANGE(0x0c0000, 0x0c3fff) AM_READWRITE(cyclwarr_sprite_r, cyclwarr_sprite_w)
292209   AM_RANGE(0x0ca000, 0x0ca1ff) AM_WRITE(tatsumi_sprite_control_w)
293   AM_RANGE(0x0d0000, 0x0d3fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w)
210   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram16_xRRRRRGGGGGBBBBB_word_w)
211   AM_RANGE(0x140000, 0x1bffff) AM_ROMBANK(2) /* CPU B ROM */
212   AM_RANGE(0x2c0000, 0x33ffff) AM_ROMBANK(1) /* CPU A ROM */
294213ADDRESS_MAP_END
295214
296static ADDRESS_MAP_START( readmem_cyclwarr_c, ADDRESS_SPACE_PROGRAM, 8 )
297   AM_RANGE(0x0000, 0xdfff) AM_READ(MRA8_ROM)
298   AM_RANGE(0xe000, 0xffef) AM_READ(MRA8_RAM) // maybe less than this...
299   AM_RANGE(0xfff1, 0xfff1) AM_READ(tatsumi_hack_ym2151_r) //YM2151_status_port_0_r)
300   AM_RANGE(0xfff4, 0xfff4) AM_READ(tatsumi_hack_oki_r) // OKIM6295_status_0_r)
215static ADDRESS_MAP_START( cyclwarr_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
216   AM_RANGE(0x0000, 0xdfff) AM_ROM
217   AM_RANGE(0xe000, 0xffef) AM_RAM
218   AM_RANGE(0xfff0, 0xfff0) AM_WRITE(YM2151_register_port_0_w)
219   AM_RANGE(0xfff1, 0xfff1) AM_READWRITE(tatsumi_hack_ym2151_r, YM2151_data_port_0_w)
220   AM_RANGE(0xfff4, 0xfff4) AM_READWRITE(tatsumi_hack_oki_r, OKIM6295_data_0_w)
301221   AM_RANGE(0xfff8, 0xfff8) AM_READ(input_port_0_r)
302222   AM_RANGE(0xfff9, 0xfff9) AM_READ(input_port_1_r)
303223//  AM_RANGE(0xfffa, 0xfffa) AM_READ(input_port_0_r)// MRA_NOP) //irq ack???
304224   AM_RANGE(0xfffc, 0xfffc) AM_READ(input_port_2_r)// MRA_NOP)
305ADDRESS_MAP_END
306
307static ADDRESS_MAP_START( writemem_cyclwarr_c, ADDRESS_SPACE_PROGRAM, 8 )
308   AM_RANGE(0x0000, 0xdfff) AM_WRITE(MWA8_ROM)
309   AM_RANGE(0xe000, 0xffef) AM_WRITE(MWA8_RAM)
310   AM_RANGE(0xfff0, 0xfff0) AM_WRITE(YM2151_register_port_0_w)
311   AM_RANGE(0xfff1, 0xfff1) AM_WRITE(YM2151_data_port_0_w)
312   AM_RANGE(0xfff4, 0xfff4) AM_WRITE(OKIM6295_data_0_w)
313225   AM_RANGE(0xfff9, 0xfff9) AM_WRITE(MWA8_NOP) //irq ack?
314226   AM_RANGE(0xfffa, 0xfffa) AM_WRITE(MWA8_NOP) //irq ack?
315227ADDRESS_MAP_END
r869r870
334246   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
335247
336248   PORT_START
337   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
338   PORT_DIPSETTING(    0x00, "3" )
339   PORT_DIPSETTING(    0x01, "4" )
340   PORT_DIPSETTING(    0x02, "5" )
341   PORT_DIPSETTING(    0x03, "6" )
342   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4")
343   PORT_DIPSETTING(    0x04, DEF_STR( Easy ) )
344   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
345   PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )
346   PORT_DIPSETTING(    0x0c, DEF_STR( Hardest ) )
347   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
348   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
349   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
350   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") /* Listed as "Always On" */
351   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
352   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
353   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") /* Listed as "Not Used" */
354   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
355   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
356   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") /* Listed as "Always On" */
357   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
358   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
359
360   PORT_START
361   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3")
362   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
363   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
364   PORT_DIPSETTING(    0x07, DEF_STR( 3C_2C ) )
365   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
366   PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
367   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
368   PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) )
369   PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
370   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") /* Manual only shows a 3-Way dip box, so 4-8 are unknown */
371   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
372   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
373   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
374   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
375   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
376   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6")
377   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
378   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
379   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
380   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
381   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
382   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Test ) ) PORT_DIPLOCATION("SW1:8")
383   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
384   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
249   PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
250   PORT_DIPSETTING(    0x0000, "3" )
251   PORT_DIPSETTING(    0x0001, "4" )
252   PORT_DIPSETTING(    0x0002, "5" )
253   PORT_DIPSETTING(    0x0003, "6" )
254   PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4")
255   PORT_DIPSETTING(    0x0004, DEF_STR( Easy ) )
256   PORT_DIPSETTING(    0x0000, DEF_STR( Normal ) )
257   PORT_DIPSETTING(    0x0008, DEF_STR( Hard ) )
258   PORT_DIPSETTING(    0x000c, DEF_STR( Hardest ) )
259   PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) )
260   PORT_DIPSETTING(    0x0010, DEF_STR( Off ) )
261   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
262   PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") /* Listed as "Always On" */
263   PORT_DIPSETTING(    0x0020, DEF_STR( Off ) )
264   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
265   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") /* Listed as "Not Used" */
266   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
267   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
268   PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") /* Listed as "Always On" */
269   PORT_DIPSETTING(    0x0080, DEF_STR( Off ) )
270   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
271   PORT_DIPNAME( 0x0700, 0x0000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3")
272   PORT_DIPSETTING(    0x0200, DEF_STR( 3C_1C ) )
273   PORT_DIPSETTING(    0x0100, DEF_STR( 2C_1C ) )
274   PORT_DIPSETTING(    0x0700, DEF_STR( 3C_2C ) )
275   PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
276   PORT_DIPSETTING(    0x0600, DEF_STR( 2C_3C ) )
277   PORT_DIPSETTING(    0x0300, DEF_STR( 1C_2C ) )
278   PORT_DIPSETTING(    0x0400, DEF_STR( 1C_5C ) )
279   PORT_DIPSETTING(    0x0500, DEF_STR( 1C_6C ) )
280   PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") /* Manual only shows a 3-Way dip box, so 4-8 are unknown */
281   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
282   PORT_DIPSETTING(    0x0800, DEF_STR( On ) )
283   PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
284   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
285   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
286   PORT_DIPNAME( 0x2000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6")
287   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
288   PORT_DIPSETTING(    0x2000, DEF_STR( On ) )
289   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
290   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
291   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
292   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Test ) ) PORT_DIPLOCATION("SW1:8")
293   PORT_DIPSETTING(    0x8000, DEF_STR( Off ) )
294   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
385295INPUT_PORTS_END
386296
387297INPUT_PORTS_START( roundup5 )
r869r870
409319   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
410320
411321   PORT_START
412   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
413   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
414   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
415   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
416   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
417   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
418   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
419   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
420   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
421   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
422   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
423   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
424   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
425   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
426   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
427   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Language ) )
428   PORT_DIPSETTING(    0x20, DEF_STR( Japanese ) )
429   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
430   PORT_DIPNAME( 0x40, 0x00, "Stage 5 Continue" )
431   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
432   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
433   PORT_DIPNAME( 0x80, 0x00, "Output Mode" )
434   PORT_DIPSETTING(    0x00, "A" )
435   PORT_DIPSETTING(    0x80, "B" )
436
437   PORT_START
438   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
439   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
440   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
441   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
442   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
443   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
444   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
445   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
446   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
447   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
448   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
449   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
450   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
451   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
452   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
453   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
454   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
455   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
456   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
457   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
458   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
459   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Test ) )
460   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
461   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
322   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unknown ) )
323   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
324   PORT_DIPSETTING(    0x0001, DEF_STR( On ) )
325   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Unknown ) )
326   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
327   PORT_DIPSETTING(    0x0002, DEF_STR( On ) )
328   PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) )
329   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
330   PORT_DIPSETTING(    0x0004, DEF_STR( On ) )
331   PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Unknown ) )
332   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
333   PORT_DIPSETTING(    0x0008, DEF_STR( On ) )
334   PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) )
335   PORT_DIPSETTING(    0x0010, DEF_STR( Off ) )
336   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
337   PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Language ) )
338   PORT_DIPSETTING(    0x0020, DEF_STR( Japanese ) )
339   PORT_DIPSETTING(    0x0000, DEF_STR( English ) )
340   PORT_DIPNAME( 0x0040, 0x0000, "Stage 5 Continue" )
341   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
342   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
343   PORT_DIPNAME( 0x0080, 0x0000, "Output Mode" )
344   PORT_DIPSETTING(    0x0000, "A" )
345   PORT_DIPSETTING(    0x0080, "B" )
346   PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Unknown ) )
347   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
348   PORT_DIPSETTING(    0x0100, DEF_STR( On ) )
349   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) )
350   PORT_DIPSETTING(    0x0200, DEF_STR( Off ) )
351   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
352   PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unknown ) )
353   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
354   PORT_DIPSETTING(    0x0400, DEF_STR( On ) )
355   PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Unknown ) )
356   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
357   PORT_DIPSETTING(    0x0800, DEF_STR( On ) )
358   PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) )
359   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
360   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
361   PORT_DIPNAME( 0x2000, 0x0000, DEF_STR( Unknown ) )
362   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
363   PORT_DIPSETTING(    0x2000, DEF_STR( On ) )
364   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
365   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
366   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
367   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Test ) )
368   PORT_DIPSETTING(    0x8000, DEF_STR( Off ) )
369   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
462370INPUT_PORTS_END
463371
464372INPUT_PORTS_START( cyclwarr )
r869r870
609517
610518   /* basic machine hardware */
611519   MDRV_CPU_ADD(V30,20000000 / 2) /* NEC V30 CPU, 20MHz / 2 */
612   MDRV_CPU_PROGRAM_MAP(readmem_apache3,writemem_apache3)
520   MDRV_CPU_PROGRAM_MAP(apache3_v30_map,0)
613521   MDRV_CPU_VBLANK_INT(roundup5_interrupt,1)
614522
615523   MDRV_CPU_ADD(M68000,20000000 / 2) /* 68000 CPU, 20MHz / 2 */
616   MDRV_CPU_PROGRAM_MAP(sub_readmem_apache3,sub_writemem_apache3)
524   MDRV_CPU_PROGRAM_MAP(apache3_68000_map,0)
617525
618526   MDRV_CPU_ADD(V20, 8000000) //???
619   MDRV_CPU_PROGRAM_MAP(readmem_iop_apache3,writemem_iop_apache3)
527   MDRV_CPU_PROGRAM_MAP(apache3_v20_map,0)
620528
621529   MDRV_CPU_ADD(Z80, 8000000) //???
622   MDRV_CPU_PROGRAM_MAP(z80_readmem_apache3,z80_writemem_apache3)
530   MDRV_CPU_PROGRAM_MAP(apache3_z80_map,0)
623531
624532   MDRV_SCREEN_REFRESH_RATE(60)
625533   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
654562
655563   /* basic machine hardware */
656564   MDRV_CPU_ADD(V30,20000000 / 2) /* NEC V30 CPU, 20MHz / 2 */
657   MDRV_CPU_PROGRAM_MAP(readmem_roundup5,writemem_roundup5)
565   MDRV_CPU_PROGRAM_MAP(roundup5_v30_map,0)
658566   MDRV_CPU_VBLANK_INT(roundup5_interrupt,1)
659567
660568   MDRV_CPU_ADD(M68000,20000000 / 2) /* 68000 CPU, 20MHz / 2 */
661   MDRV_CPU_PROGRAM_MAP(readmem_roundup5_sub,writemem_roundup5_sub)
569   MDRV_CPU_PROGRAM_MAP(roundup5_68000_map,0)
662570
663571   MDRV_CPU_ADD(Z80, 4000000) //???
664   MDRV_CPU_PROGRAM_MAP(readmem_roundup5_sound,writemem_roundup5_sound)
572   MDRV_CPU_PROGRAM_MAP(roundup5_z80_map,0)
665573
666574   MDRV_SCREEN_REFRESH_RATE(60)
667575   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
696604
697605   /* basic machine hardware */
698606   MDRV_CPU_ADD(M68000,20000000 / 2) /* NEC V30 CPU, 20MHz / 2 */
699   MDRV_CPU_PROGRAM_MAP(readmem_cyclwarr_a,writemem_cyclwarr_a )
607   MDRV_CPU_PROGRAM_MAP(cyclwarr_68000a_map,0)
700608   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
701609
702610   MDRV_CPU_ADD(M68000,20000000 / 2) /* 68000 CPU, 20MHz / 2 */
703   MDRV_CPU_PROGRAM_MAP(readmem_cyclwarr_b,writemem_cyclwarr_b)
611   MDRV_CPU_PROGRAM_MAP(cyclwarr_68000b_map,0)
704612   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
705613
706614   MDRV_CPU_ADD(Z80, 4000000) //???
707   MDRV_CPU_PROGRAM_MAP(readmem_cyclwarr_c,writemem_cyclwarr_c)
615   MDRV_CPU_PROGRAM_MAP(cyclwarr_z80_map,0)
708616
709617   MDRV_SCREEN_REFRESH_RATE(60)
710618   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
src/mame/drivers/supbtime.c
r869r870
384384   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
385385
386386   MDRV_SCREEN_REFRESH_RATE(58)
387   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
387   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
388388
389389   /* video hardware */
390390   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_BEFORE_VBLANK)
r869r870
423423   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
424424
425425   MDRV_SCREEN_REFRESH_RATE(58)
426   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
426   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
427427
428428   /* video hardware */
429429   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_BEFORE_VBLANK)
src/mame/drivers/m72.c
r869r870
7575#include "audio/m72.h"
7676#include "sound/dac.h"
7777#include "sound/2151intf.h"
78#include "m72.h"
7879
7980
8081/* in video/m72.c */
81extern UINT8 *m72_videoram1,*m72_videoram2,*majtitle_rowscrollram;
82MACHINE_RESET( m72 );
83MACHINE_RESET( xmultipl );
84MACHINE_RESET( kengo );
85INTERRUPT_GEN( m72_interrupt );
86VIDEO_START( m72 );
87VIDEO_START( rtype2 );
88VIDEO_START( majtitle );
89VIDEO_START( hharry );
90VIDEO_START( poundfor );
91READ8_HANDLER( m72_palette1_r );
92READ8_HANDLER( m72_palette2_r );
93WRITE8_HANDLER( m72_palette1_w );
94WRITE8_HANDLER( m72_palette2_w );
95READ8_HANDLER( m72_videoram1_r );
96READ8_HANDLER( m72_videoram2_r );
97WRITE8_HANDLER( m72_videoram1_w );
98WRITE8_HANDLER( m72_videoram2_w );
99WRITE8_HANDLER( m72_irq_line_w );
100WRITE8_HANDLER( m72_scrollx1_w );
101WRITE8_HANDLER( m72_scrollx2_w );
102WRITE8_HANDLER( m72_scrolly1_w );
103WRITE8_HANDLER( m72_scrolly2_w );
104WRITE8_HANDLER( m72_dmaon_w );
105WRITE8_HANDLER( m72_port02_w );
106WRITE8_HANDLER( rtype2_port02_w );
107WRITE8_HANDLER( majtitle_gfx_ctrl_w );
108VIDEO_UPDATE( m72 );
109VIDEO_UPDATE( majtitle );
11082
11183
112static UINT8 *protection_ram;
84static UINT16 *protection_ram;
11385
11486
11587
r869r870
161133}
162134
163135
164static WRITE8_HANDLER( bchopper_sample_trigger_w )
136static WRITE16_HANDLER( bchopper_sample_trigger_w )
165137{
166138   static const int a[6] = { 0x0000, 0x0010, 0x2510, 0x6510, 0x8510, 0x9310 };
167   if (data < 6) m72_set_sample_start(a[data]);
139   if (ACCESSING_LSB && (data & 0xff) < 6) m72_set_sample_start(a[data & 0xff]);
168140}
169141
170static WRITE8_HANDLER( nspirit_sample_trigger_w )
142static WRITE16_HANDLER( nspirit_sample_trigger_w )
171143{
172144   static const int a[9] = { 0x0000, 0x0020, 0x2020, 0, 0x5720, 0, 0x7b60, 0x9b60, 0xc360 };
173   if (data < 9) m72_set_sample_start(a[data]);
145   if (ACCESSING_LSB && (data & 0xff) < 9) m72_set_sample_start(a[data & 0xff]);
174146}
175147
176static WRITE8_HANDLER( imgfight_sample_trigger_w )
148static WRITE16_HANDLER( imgfight_sample_trigger_w )
177149{
178150   static const int a[7] = { 0x0000, 0x0020, 0x44e0, 0x98a0, 0xc820, 0xf7a0, 0x108c0 };
179   if (data < 7) m72_set_sample_start(a[data]);
151   if (ACCESSING_LSB && (data & 0xff) < 7) m72_set_sample_start(a[data & 0xff]);
180152}
181153
182static WRITE8_HANDLER( loht_sample_trigger_w )
154static WRITE16_HANDLER( loht_sample_trigger_w )
183155{
184156   static const int a[7] = { 0x0000, 0x0020, 0, 0x2c40, 0x4320, 0x7120, 0xb200 };
185   if (data < 7) m72_set_sample_start(a[data]);
157   if (ACCESSING_LSB && (data & 0xff) < 7) m72_set_sample_start(a[data & 0xff]);
186158}
187159
188static WRITE8_HANDLER( xmultipl_sample_trigger_w )
160static WRITE16_HANDLER( xmultipl_sample_trigger_w )
189161{
190162   static const int a[3] = { 0x0000, 0x0020, 0x1a40 };
191   if (data < 3) m72_set_sample_start(a[data]);
163   if (ACCESSING_LSB && (data & 0xff) < 3) m72_set_sample_start(a[data & 0xff]);
192164}
193165
194static WRITE8_HANDLER( dbreed72_sample_trigger_w )
166static WRITE16_HANDLER( dbreed72_sample_trigger_w )
195167{
196168   static const int a[9] = { 0x00000, 0x00020, 0x02c40, 0x08160, 0x0c8c0, 0x0ffe0, 0x13000, 0x15820, 0x15f40 };
197   if (data < 9) m72_set_sample_start(a[data]);
169   if (ACCESSING_LSB && (data & 0xff) < 9) m72_set_sample_start(a[data & 0xff]);
198170}
199171
200static WRITE8_HANDLER( airduel_sample_trigger_w )
172static WRITE16_HANDLER( airduel_sample_trigger_w )
201173{
202174   static const int a[16] = {
203175      0x00000, 0x00020, 0x03ec0, 0x05640, 0x06dc0, 0x083a0, 0x0c000, 0x0eb60,
204176      0x112e0, 0x13dc0, 0x16520, 0x16d60, 0x18ae0, 0x1a5a0, 0x1bf00, 0x1c340 };
205   if (data < 16) m72_set_sample_start(a[data]);
177   if (ACCESSING_LSB && (data & 0xff) < 16) m72_set_sample_start(a[data & 0xff]);
206178}
207179
208static WRITE8_HANDLER( dkgenm72_sample_trigger_w )
180static WRITE16_HANDLER( dkgenm72_sample_trigger_w )
209181{
210182   static const int a[28] = {
211183      0x00000, 0x00020, 0x01800, 0x02da0, 0x03be0, 0x05ae0, 0x06100, 0x06de0,
r869r870
213185      0x10fa0, 0x10fc0, 0x10fe0, 0x11f40, 0x12b20, 0x130a0, 0x13c60, 0x14740,
214186      0x153c0, 0x197e0, 0x1af40, 0x1c080 };
215187
216   if (data < 28) m72_set_sample_start(a[data]);
188   if (ACCESSING_LSB && (data & 0xff) < 28) m72_set_sample_start(a[data & 0xff]);
217189}
218190
219static WRITE8_HANDLER( gallop_sample_trigger_w )
191static WRITE16_HANDLER( gallop_sample_trigger_w )
220192{
221193   static const int a[31] = {
222194      0x00000, 0x00020, 0x00040, 0x01360, 0x02580, 0x04f20, 0x06240, 0x076e0,
r869r870
224196      0x10200, 0x10220, 0x10240, 0x11380, 0x12760, 0x12780, 0x127a0, 0x13c40,
225197      0x140a0, 0x16760, 0x17e40, 0x18ee0, 0x19f60, 0x1bbc0, 0x1cee0 };
226198
227   if (data < 31) m72_set_sample_start(a[data]);
199   if (ACCESSING_LSB && (data & 0xff) < 31) m72_set_sample_start(a[data & 0xff]);
228200}
229201
230202
r869r870
410382                                    0x79,0x08,0x1c,0xb3, 0x00,0x00 };
411383
412384
413static UINT8 *protection_code,*protection_crc;
385static const UINT8 *protection_code, *protection_crc;
414386
415static READ8_HANDLER( protection_r )
387static void copy_le(UINT16 *dest, const UINT8 *src, UINT8 bytes)
416388{
417   memcpy(protection_ram,protection_code,CODE_LEN);
418   return protection_ram[0xffb+offset];
389   int i;
390
391   for (i = 0; i < bytes; i += 2)
392      dest[i/2] = src[i+0] | (src[i+1] << 8);
419393}
420394
421static WRITE8_HANDLER( protection_w )
395static READ16_HANDLER( protection_r )
422396{
423   protection_ram[offset] = data ^ 0xff;
397   if (ACCESSING_MSB)
398      copy_le(protection_ram,protection_code,CODE_LEN);
399   return protection_ram[0xffa/2+offset];
400}
424401
425   if (offset == 0x0fff && data == 0)
426      memcpy(&protection_ram[0x0fe0],protection_crc,CRC_LEN);
402static WRITE16_HANDLER( protection_w )
403{
404   data ^= 0xffff;
405   COMBINE_DATA(&protection_ram[offset]);
406   data ^= 0xffff;
407
408   if (offset == 0x0fff/2 && ACCESSING_MSB && (data >> 8) == 0)
409      copy_le(&protection_ram[0x0fe0],protection_crc,CRC_LEN);
427410}
428411
429412static void install_protection_handler(UINT8 *code,UINT8 *crc)
r869r870
431414   protection_ram = auto_malloc(0x1000);
432415   protection_code = code;
433416   protection_crc =  crc;
434   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, MRA8_BANK1);
435   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0ffb, 0xb0ffb, 0, 0, protection_r);
436   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, protection_w);
417   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, MRA16_BANK1);
418   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0ffa, 0xb0ffb, 0, 0, protection_r);
419   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, protection_w);
437420   memory_set_bankptr(1, protection_ram);
438421}
439422
r869r870
441424{
442425   install_protection_handler(bchopper_code,bchopper_crc);
443426
444   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, bchopper_sample_trigger_w);
427   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w);
445428}
446429
447430static DRIVER_INIT( mrheli )
448431{
449432   install_protection_handler(bchopper_code,mrheli_crc);
450433
451   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, bchopper_sample_trigger_w);
434   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w);
452435}
453436
454437static DRIVER_INIT( nspirit )
455438{
456439   install_protection_handler(nspirit_code,nspirit_crc);
457440
458   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, nspirit_sample_trigger_w);
441   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w);
459442}
460443
461444static DRIVER_INIT( nspiritj )
462445{
463446   install_protection_handler(nspirit_code,nspiritj_crc);
464447
465   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, nspirit_sample_trigger_w);
448   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w);
466449}
467450
468451static DRIVER_INIT( imgfight )
469452{
470453   install_protection_handler(imgfight_code,imgfight_crc);
471454
472   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, imgfight_sample_trigger_w);
455   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, imgfight_sample_trigger_w);
473456}
474457
475458static DRIVER_INIT( loht )
476459{
477460   install_protection_handler(loht_code,loht_crc);
478461
479   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, loht_sample_trigger_w);
462   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
480463
481464   /* since we skip the startup tests, clear video RAM to prevent garbage on title screen */
482465   memset(m72_videoram2,0,0x4000);
r869r870
486469{
487470   install_protection_handler(xmultipl_code,xmultipl_crc);
488471
489   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, xmultipl_sample_trigger_w);
472   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, xmultipl_sample_trigger_w);
490473}
491474
492475static DRIVER_INIT( dbreed72 )
493476{
494477   install_protection_handler(dbreed72_code,dbreed72_crc);
495478
496   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, dbreed72_sample_trigger_w);
479   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, dbreed72_sample_trigger_w);
497480}
498481
499482static DRIVER_INIT( airduel )
500483{
501484   install_protection_handler(airduel_code,airduel_crc);
502485
503   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, airduel_sample_trigger_w);
486   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, airduel_sample_trigger_w);
504487}
505488
506489static DRIVER_INIT( dkgenm72 )
507490{
508491   install_protection_handler(dkgenm72_code,dkgenm72_crc);
509492
510   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, dkgenm72_sample_trigger_w);
493   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, dkgenm72_sample_trigger_w);
511494}
512495
513496static DRIVER_INIT( gallop )
514497{
515   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, gallop_sample_trigger_w);
498   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, gallop_sample_trigger_w);
516499}
517500
518501
r869r870
521504static UINT8 *soundram;
522505
523506
524static READ8_HANDLER( soundram_r )
507static READ16_HANDLER( soundram_r )
525508{
526   return soundram[offset];
509   return soundram[offset * 2 + 0] | (soundram[offset * 2 + 1] << 8);
527510}
528511
529static WRITE8_HANDLER( soundram_w )
512static WRITE16_HANDLER( soundram_w )
530513{
531   soundram[offset] = data;
514   if (ACCESSING_LSB)
515      soundram[offset * 2 + 0] = data;
516   if (ACCESSING_MSB)
517      soundram[offset * 2 + 1] = data >> 8;
532518}
533519
534520
535static READ8_HANDLER( poundfor_trackball_r )
521static READ16_HANDLER( poundfor_trackball_r )
536522{
537523   static int prev[4],diff[4];
538524
r869r870
542528
543529      for (i = 0;i < 4;i++)
544530      {
545         curr = readinputport(6+i);
531         curr = readinputport(3+i);
546532         diff[i] = (curr - prev[i]);
547533         prev[i] = curr;
548534      }
r869r870
552538   {
553539      default:
554540      case 0:
555         return diff[0] & 0xff;
541         return (diff[0] & 0xff) | ((diff[2] & 0xff) << 8);
556542      case 1:
557         return diff[2] & 0xff;
543         return ((diff[0] >> 8) & 0x1f) | (diff[2] & 0x1f00) | (readinputport(0) & 0xe0e0);
558544      case 2:
559         return ((diff[0] >> 8) & 0x1f) | (readinputport(0) & 0xe0);
545         return (diff[1] & 0xff) | ((diff[3] & 0xff) << 8);
560546      case 3:
561         return ((diff[2] >> 8) & 0x1f) | (readinputport(1) & 0xe0);
562      case 4:
563         return diff[1] & 0xff;
564      case 5:
565         return diff[3] & 0xff;
566      case 6:
567         return ((diff[1] >> 8) & 0x1f);
568      case 7:
569         return ((diff[3] >> 8) & 0x1f);
547         return ((diff[1] >> 8) & 0x1f) | (diff[3] & 0x1f00);
570548   }
571549}
572550
573551
574#define CPU1_MEMORY(NAME,ROMSIZE,WORKRAM)                   \
575static ADDRESS_MAP_START( NAME##_readmem, ADDRESS_SPACE_PROGRAM, 8 )                  \
576   AM_RANGE(0x00000, ROMSIZE-1) AM_READ(MRA8_ROM)                     \
577   AM_RANGE(WORKRAM, WORKRAM+0x3fff) AM_READ(MRA8_RAM)                  \
578   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)                        \
579   AM_RANGE(0xc8000, 0xc8bff) AM_READ(m72_palette1_r)                  \
580   AM_RANGE(0xcc000, 0xccbff) AM_READ(m72_palette2_r)                  \
581   AM_RANGE(0xd0000, 0xd3fff) AM_READ(m72_videoram1_r)                  \
582   AM_RANGE(0xd8000, 0xdbfff) AM_READ(m72_videoram2_r)                  \
583   AM_RANGE(0xe0000, 0xeffff) AM_READ(soundram_r)                     \
552#define CPU1_MEMORY(NAME,ROMSIZE,WORKRAM)                         \
553static ADDRESS_MAP_START( NAME##_map, ADDRESS_SPACE_PROGRAM, 16 )      \
554   AM_RANGE(0x00000, ROMSIZE-1) AM_ROM                           \
555   AM_RANGE(WORKRAM, WORKRAM+0x3fff) AM_RAM   /* work RAM */         \
556   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)   \
557   AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)         \
558   AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)      \
559   AM_RANGE(0xd0000, 0xd3fff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)      \
560   AM_RANGE(0xd8000, 0xdbfff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)      \
561   AM_RANGE(0xe0000, 0xeffff) AM_READWRITE(soundram_r, soundram_w)                     \
584562   AM_RANGE(0xffff0, 0xfffff) AM_ROM                              \
585ADDRESS_MAP_END                                          \
586                                                \
587static ADDRESS_MAP_START( NAME##_writemem, ADDRESS_SPACE_PROGRAM, 8 )               \
588   AM_RANGE(0x00000, ROMSIZE-1) AM_WRITE(MWA8_ROM)                     \
589   AM_RANGE(WORKRAM, WORKRAM+0x3fff) AM_WRITE(MWA8_RAM)   /* work RAM */      \
590   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)   \
591   AM_RANGE(0xc8000, 0xc8bff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)         \
592   AM_RANGE(0xcc000, 0xccbff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)      \
593   AM_RANGE(0xd0000, 0xd3fff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)      \
594   AM_RANGE(0xd8000, 0xdbfff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)      \
595   AM_RANGE(0xe0000, 0xeffff) AM_WRITE(soundram_w)                     \
596563ADDRESS_MAP_END
597564
598565
r869r870
602569CPU1_MEMORY( xmultipl, 0x80000, 0x80000 )
603570CPU1_MEMORY( dbreed72, 0x80000, 0x90000 )
604571
605static ADDRESS_MAP_START( dbreed_readmem, ADDRESS_SPACE_PROGRAM, 8 )
606   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
607   AM_RANGE(0x88000, 0x8bfff) AM_READ(MRA8_RAM)
608   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)
609   AM_RANGE(0xc8000, 0xc8bff) AM_READ(m72_palette1_r)
610   AM_RANGE(0xcc000, 0xccbff) AM_READ(m72_palette2_r)
611   AM_RANGE(0xd0000, 0xd3fff) AM_READ(m72_videoram1_r)
612   AM_RANGE(0xd8000, 0xdbfff) AM_READ(m72_videoram2_r)
572static ADDRESS_MAP_START( dbreed_map, ADDRESS_SPACE_PROGRAM, 16 )
573   AM_RANGE(0x00000, 0x7ffff) AM_ROM
574   AM_RANGE(0x88000, 0x8bfff) AM_RAM   /* work RAM */
575   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITE(MWA16_RAM)   /* leftover from protection?? */
576   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
577   AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)
578   AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)
579   AM_RANGE(0xd0000, 0xd3fff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)
580   AM_RANGE(0xd8000, 0xdbfff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)
613581   AM_RANGE(0xffff0, 0xfffff) AM_ROM
614582ADDRESS_MAP_END
615583
616static ADDRESS_MAP_START( dbreed_writemem, ADDRESS_SPACE_PROGRAM, 8 )
617   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
618   AM_RANGE(0x88000, 0x8bfff) AM_WRITE(MWA8_RAM)   /* work RAM */
619   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITE(MWA8_RAM)   /* leftover from protection?? */
620   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
621   AM_RANGE(0xc8000, 0xc8bff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)
622   AM_RANGE(0xcc000, 0xccbff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)
623   AM_RANGE(0xd0000, 0xd3fff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)
624   AM_RANGE(0xd8000, 0xdbfff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)
625ADDRESS_MAP_END
626
627static ADDRESS_MAP_START( rtype2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
628   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
629   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)
630   AM_RANGE(0xc8000, 0xc8bff) AM_READ(m72_palette1_r)
631   AM_RANGE(0xd0000, 0xd3fff) AM_READ(m72_videoram1_r)
632   AM_RANGE(0xd4000, 0xd7fff) AM_READ(m72_videoram2_r)
633   AM_RANGE(0xd8000, 0xd8bff) AM_READ(m72_palette2_r)
634   AM_RANGE(0xe0000, 0xe3fff) AM_READ(MRA8_RAM)
635   AM_RANGE(0xffff0, 0xfffff) AM_ROM
636ADDRESS_MAP_END
637
638static ADDRESS_MAP_START( rtype2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
639   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
584static ADDRESS_MAP_START( rtype2_map, ADDRESS_SPACE_PROGRAM, 16 )
585   AM_RANGE(0x00000, 0x7ffff) AM_ROM
640586   AM_RANGE(0xb0000, 0xb0001) AM_WRITE(m72_irq_line_w)
641587   AM_RANGE(0xbc000, 0xbc001) AM_WRITE(m72_dmaon_w)
642   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
643   AM_RANGE(0xc8000, 0xc8bff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)
644   AM_RANGE(0xd0000, 0xd3fff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)
645   AM_RANGE(0xd4000, 0xd7fff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)
646   AM_RANGE(0xd8000, 0xd8bff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)
647   AM_RANGE(0xe0000, 0xe3fff) AM_WRITE(MWA8_RAM)   /* work RAM */
648ADDRESS_MAP_END
649
650static ADDRESS_MAP_START( majtitle_readmem, ADDRESS_SPACE_PROGRAM, 8 )
651   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
652   AM_RANGE(0xa0000, 0xa03ff) AM_READ(MRA8_RAM)
653   AM_RANGE(0xa4000, 0xa4bff) AM_READ(m72_palette2_r)
654   AM_RANGE(0xac000, 0xaffff) AM_READ(m72_videoram1_r)
655   AM_RANGE(0xb0000, 0xbffff) AM_READ(m72_videoram2_r)
656   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)
657   AM_RANGE(0xc8000, 0xc83ff) AM_READ(MRA8_RAM)
658   AM_RANGE(0xcc000, 0xccbff) AM_READ(m72_palette1_r)
659   AM_RANGE(0xd0000, 0xd3fff) AM_READ(MRA8_RAM)
588   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
589   AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)
590   AM_RANGE(0xd0000, 0xd3fff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)
591   AM_RANGE(0xd4000, 0xd7fff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)
592   AM_RANGE(0xd8000, 0xd8bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)
593   AM_RANGE(0xe0000, 0xe3fff) AM_RAM   /* work RAM */
660594   AM_RANGE(0xffff0, 0xfffff) AM_ROM
661595ADDRESS_MAP_END
662596
663static ADDRESS_MAP_START( majtitle_writemem, ADDRESS_SPACE_PROGRAM, 8 )
664   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
665   AM_RANGE(0xa0000, 0xa03ff) AM_WRITE(MWA8_RAM) AM_BASE(&majtitle_rowscrollram)
666   AM_RANGE(0xa4000, 0xa4bff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)
667   AM_RANGE(0xac000, 0xaffff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)
668   AM_RANGE(0xb0000, 0xbffff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)   /* larger than the other games */
669   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
670   AM_RANGE(0xc8000, 0xc83ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram_2)
671   AM_RANGE(0xcc000, 0xccbff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)
672   AM_RANGE(0xd0000, 0xd3fff) AM_WRITE(MWA8_RAM)   /* work RAM */
597static ADDRESS_MAP_START( majtitle_map, ADDRESS_SPACE_PROGRAM, 16 )
598   AM_RANGE(0x00000, 0x7ffff) AM_ROM
599   AM_RANGE(0xa0000, 0xa03ff) AM_RAM AM_BASE(&majtitle_rowscrollram)
600   AM_RANGE(0xa4000, 0xa4bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)
601   AM_RANGE(0xac000, 0xaffff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)
602   AM_RANGE(0xb0000, 0xbffff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)   /* larger than the other games */
603   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
604   AM_RANGE(0xc8000, 0xc83ff) AM_RAM AM_BASE(&spriteram16_2)
605   AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)
606   AM_RANGE(0xd0000, 0xd3fff) AM_RAM   /* work RAM */
673607   AM_RANGE(0xe0000, 0xe0001) AM_WRITE(m72_irq_line_w)
674   AM_RANGE(0xe4000, 0xe4001) AM_WRITE(MWA8_RAM)   /* playfield enable? 1 during screen transitions, 0 otherwise */
608   AM_RANGE(0xe4000, 0xe4001) AM_WRITE(MWA16_RAM)   /* playfield enable? 1 during screen transitions, 0 otherwise */
675609   AM_RANGE(0xec000, 0xec001) AM_WRITE(m72_dmaon_w)
676ADDRESS_MAP_END
677
678static ADDRESS_MAP_START( hharry_readmem, ADDRESS_SPACE_PROGRAM, 8 )
679   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
680   AM_RANGE(0xa0000, 0xa3fff) AM_READ(MRA8_RAM)
681   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)
682   AM_RANGE(0xc8000, 0xc8bff) AM_READ(m72_palette1_r)
683   AM_RANGE(0xcc000, 0xccbff) AM_READ(m72_palette2_r)
684   AM_RANGE(0xd0000, 0xd3fff) AM_READ(m72_videoram1_r)
685   AM_RANGE(0xd8000, 0xdbfff) AM_READ(m72_videoram2_r)
686610   AM_RANGE(0xffff0, 0xfffff) AM_ROM
687611ADDRESS_MAP_END
688612
689static ADDRESS_MAP_START( hharry_writemem, ADDRESS_SPACE_PROGRAM, 8 )
690   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
691   AM_RANGE(0xa0000, 0xa3fff) AM_WRITE(MWA8_RAM)   /* work RAM */
692   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITE(MWA8_RAM)   /* leftover from protection?? */
693   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
694   AM_RANGE(0xc8000, 0xc8bff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)
695   AM_RANGE(0xcc000, 0xccbff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)
696   AM_RANGE(0xd0000, 0xd3fff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)
697   AM_RANGE(0xd8000, 0xdbfff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)
698ADDRESS_MAP_END
699
700static ADDRESS_MAP_START( hharryu_readmem, ADDRESS_SPACE_PROGRAM, 8 )
701   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
702   AM_RANGE(0xa0000, 0xa0bff) AM_READ(m72_palette1_r)
703   AM_RANGE(0xa8000, 0xa8bff) AM_READ(m72_palette2_r)
704   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)
705   AM_RANGE(0xd0000, 0xd3fff) AM_READ(m72_videoram1_r)
706   AM_RANGE(0xd4000, 0xd7fff) AM_READ(m72_videoram2_r)
707   AM_RANGE(0xe0000, 0xe3fff) AM_READ(MRA8_RAM)
613static ADDRESS_MAP_START( hharry_map, ADDRESS_SPACE_PROGRAM, 16 )
614   AM_RANGE(0x00000, 0x7ffff) AM_ROM
615   AM_RANGE(0xa0000, 0xa3fff) AM_RAM   /* work RAM */
616   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITE(MWA16_RAM)   /* leftover from protection?? */
617   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
618   AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)
619   AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)
620   AM_RANGE(0xd0000, 0xd3fff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)
621   AM_RANGE(0xd8000, 0xdbfff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)
708622   AM_RANGE(0xffff0, 0xfffff) AM_ROM
709623ADDRESS_MAP_END
710624
711static ADDRESS_MAP_START( hharryu_writemem, ADDRESS_SPACE_PROGRAM, 8 )
712   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
713   AM_RANGE(0xa0000, 0xa0bff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)
714   AM_RANGE(0xa8000, 0xa8bff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)
625static ADDRESS_MAP_START( hharryu_map, ADDRESS_SPACE_PROGRAM, 16 )
626   AM_RANGE(0x00000, 0x7ffff) AM_ROM
627   AM_RANGE(0xa0000, 0xa0bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)
628   AM_RANGE(0xa8000, 0xa8bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)
715629   AM_RANGE(0xb0000, 0xb0001) AM_WRITE(m72_irq_line_w)
716630   AM_RANGE(0xbc000, 0xbc001) AM_WRITE(m72_dmaon_w)
717   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITE(MWA8_RAM)   /* leftover from protection?? */
718   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
719   AM_RANGE(0xd0000, 0xd3fff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)
720   AM_RANGE(0xd4000, 0xd7fff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)
721   AM_RANGE(0xe0000, 0xe3fff) AM_WRITE(MWA8_RAM)   /* work RAM */
722ADDRESS_MAP_END
723
724static ADDRESS_MAP_START( kengo_readmem, ADDRESS_SPACE_PROGRAM, 8 )
725   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
726   AM_RANGE(0xa0000, 0xa0bff) AM_READ(m72_palette1_r)
727   AM_RANGE(0xa8000, 0xa8bff) AM_READ(m72_palette2_r)
728   AM_RANGE(0xc0000, 0xc03ff) AM_READ(MRA8_RAM)
729   AM_RANGE(0x80000, 0x83fff) AM_READ(m72_videoram1_r)
730   AM_RANGE(0x84000, 0x87fff) AM_READ(m72_videoram2_r)
731   AM_RANGE(0xe0000, 0xe3fff) AM_READ(MRA8_RAM)
631   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITE(MWA16_RAM)   /* leftover from protection?? */
632   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
633   AM_RANGE(0xd0000, 0xd3fff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)
634   AM_RANGE(0xd4000, 0xd7fff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)
635   AM_RANGE(0xe0000, 0xe3fff) AM_RAM   /* work RAM */
732636   AM_RANGE(0xffff0, 0xfffff) AM_ROM
733637ADDRESS_MAP_END
734638
735static ADDRESS_MAP_START( kengo_writemem, ADDRESS_SPACE_PROGRAM, 8 )
736   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
737   AM_RANGE(0xa0000, 0xa0bff) AM_WRITE(m72_palette1_w) AM_BASE(&paletteram)
738   AM_RANGE(0xa8000, 0xa8bff) AM_WRITE(m72_palette2_w) AM_BASE(&paletteram_2)
639static ADDRESS_MAP_START( kengo_map, ADDRESS_SPACE_PROGRAM, 16 )
640   AM_RANGE(0x00000, 0x7ffff) AM_ROM
641   AM_RANGE(0xa0000, 0xa0bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_BASE(&paletteram16)
642   AM_RANGE(0xa8000, 0xa8bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_BASE(&paletteram16_2)
739643   AM_RANGE(0xb0000, 0xb0001) AM_WRITE(m72_irq_line_w)
740AM_RANGE(0xb4000, 0xb4001) AM_WRITE(MWA8_NOP)   /* ??? */
644AM_RANGE(0xb4000, 0xb4001) AM_WRITE(MWA16_NOP)   /* ??? */
741645   AM_RANGE(0xbc000, 0xbc001) AM_WRITE(m72_dmaon_w)
742   AM_RANGE(0xc0000, 0xc03ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
743   AM_RANGE(0x80000, 0x83fff) AM_WRITE(m72_videoram1_w) AM_BASE(&m72_videoram1)
744   AM_RANGE(0x84000, 0x87fff) AM_WRITE(m72_videoram2_w) AM_BASE(&m72_videoram2)
745   AM_RANGE(0xe0000, 0xe3fff) AM_WRITE(MWA8_RAM)   /* work RAM */
646   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
647   AM_RANGE(0x80000, 0x83fff) AM_READWRITE(MRA16_RAM, m72_videoram1_w) AM_BASE(&m72_videoram1)
648   AM_RANGE(0x84000, 0x87fff) AM_READWRITE(MRA16_RAM, m72_videoram2_w) AM_BASE(&m72_videoram2)
649   AM_RANGE(0xe0000, 0xe3fff) AM_RAM   /* work RAM */
650   AM_RANGE(0xffff0, 0xfffff) AM_ROM
746651ADDRESS_MAP_END
747652
748static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
749   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r)
750   AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r)
751   AM_RANGE(0x02, 0x02) AM_READ(input_port_2_r)
752   AM_RANGE(0x03, 0x03) AM_READ(input_port_3_r)
753   AM_RANGE(0x04, 0x04) AM_READ(input_port_4_r)
754   AM_RANGE(0x05, 0x05) AM_READ(input_port_5_r)
755ADDRESS_MAP_END
756
757static ADDRESS_MAP_START( poundfor_readport, ADDRESS_SPACE_IO, 8 )
758   AM_RANGE(0x02, 0x02) AM_READ(input_port_2_r)
759   AM_RANGE(0x03, 0x03) AM_READ(input_port_3_r)
760   AM_RANGE(0x04, 0x04) AM_READ(input_port_4_r)
761   AM_RANGE(0x05, 0x05) AM_READ(input_port_5_r)
762   AM_RANGE(0x08, 0x0f) AM_READ(poundfor_trackball_r)
763ADDRESS_MAP_END
764
765
766static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
653static ADDRESS_MAP_START( m72_portmap, ADDRESS_SPACE_IO, 16 )
654   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)
655   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)
656   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)
767657   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
768658   AM_RANGE(0x02, 0x03) AM_WRITE(m72_port02_w)   /* coin counters, reset sound cpu, other stuff? */
769659   AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w)
770660   AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w)
771   AM_RANGE(0x40, 0x43) AM_WRITE(MWA8_NOP) /* Interrupt controller, only written to at bootup */
661   AM_RANGE(0x40, 0x43) AM_WRITE(MWA16_NOP) /* Interrupt controller, only written to at bootup */
772662   AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w)
773663   AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w)
774664   AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w)
r869r870
776666/*  { 0xc0, 0xc0      trigger sample, filled by init_ function */
777667ADDRESS_MAP_END
778668
779static ADDRESS_MAP_START( xmultipl_writeport, ADDRESS_SPACE_IO, 8 )
669static ADDRESS_MAP_START( rtype2_portmap, ADDRESS_SPACE_IO, 16 )
670   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)
671   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)
672   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)
780673   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
781   AM_RANGE(0x02, 0x03) AM_WRITE(m72_port02_w)   /* coin counters, reset sound cpu, other stuff? */
782   AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w)
783   AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w)
784   AM_RANGE(0x40, 0x43) AM_WRITE(MWA8_NOP) /* Interrupt controller, only written to at bootup */
674   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
675   AM_RANGE(0x40, 0x43) AM_WRITE(MWA16_NOP) /* Interrupt controller, only written to at bootup */
785676   AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w)
786677   AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w)
787678   AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w)
788679   AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w)
789/*  { 0xc0, 0xc0      trigger sample, filled by init_ function */
790680ADDRESS_MAP_END
791681
792static ADDRESS_MAP_START( rtype2_writeport, ADDRESS_SPACE_IO, 8 )
682static ADDRESS_MAP_START( poundfor_portmap, ADDRESS_SPACE_IO, 16 )
683   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)
684   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)
685   AM_RANGE(0x08, 0x0f) AM_READ(poundfor_trackball_r)
793686   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
794687   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
795   AM_RANGE(0x40, 0x43) AM_WRITE(MWA8_NOP) /* Interrupt controller, only written to at bootup */
688   AM_RANGE(0x40, 0x43) AM_WRITE(MWA16_NOP) /* Interrupt controller, only written to at bootup */
796689   AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w)
797690   AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w)
798691   AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w)
799692   AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w)
800693ADDRESS_MAP_END
801694
802static ADDRESS_MAP_START( majtitle_writeport, ADDRESS_SPACE_IO, 8 )
695static ADDRESS_MAP_START( majtitle_portmap, ADDRESS_SPACE_IO, 16 )
696   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)
697   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)
698   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)
803699   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
804700   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
805   AM_RANGE(0x40, 0x43) AM_WRITE(MWA8_NOP) /* Interrupt controller, only written to at bootup */
701   AM_RANGE(0x40, 0x43) AM_WRITE(MWA16_NOP) /* Interrupt controller, only written to at bootup */
806702   AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w)
807703   AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w)
808704   AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w)
r869r870
810706   AM_RANGE(0x8e, 0x8f) AM_WRITE(majtitle_gfx_ctrl_w)
811707ADDRESS_MAP_END
812708
813static ADDRESS_MAP_START( hharry_writeport, ADDRESS_SPACE_IO, 8 )
709static ADDRESS_MAP_START( hharry_portmap, ADDRESS_SPACE_IO, 16 )
710   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)
711   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)
712   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)
814713   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
815714   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)   /* coin counters, reset sound cpu, other stuff? */
816715   AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w)
817716   AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w)
818   AM_RANGE(0x40, 0x43) AM_WRITE(MWA8_NOP) /* Interrupt controller, only written to at bootup */
717   AM_RANGE(0x40, 0x43) AM_WRITE(MWA16_NOP) /* Interrupt controller, only written to at bootup */
819718   AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w)
820719   AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w)
821720   AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w)
822721   AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w)
823722ADDRESS_MAP_END
824723
825static ADDRESS_MAP_START( kengo_writeport, ADDRESS_SPACE_IO, 8 )
724static ADDRESS_MAP_START( kengo_portmap, ADDRESS_SPACE_IO, 16 )
725   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)
726   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)
727   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)
826728   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
827729   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
828730   AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w)
r869r870
842744   AM_RANGE(0xf000, 0xffff) AM_RAM
843745ADDRESS_MAP_END
844746
845static ADDRESS_MAP_START( sound_readport, ADDRESS_SPACE_IO, 8 )
747static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
846748   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
847   AM_RANGE(0x01, 0x01) AM_READ(YM2151_status_port_0_r)
848   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
849   AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
850ADDRESS_MAP_END
851
852static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
853   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
854749   AM_RANGE(0x00, 0x00) AM_WRITE(YM2151_register_port_0_w)
855   AM_RANGE(0x01, 0x01) AM_WRITE(YM2151_data_port_0_w)
750   AM_RANGE(0x01, 0x01) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
751   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
856752   AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_irq_ack_w)
857753   AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w)
858ADDRESS_MAP_END
859
860static ADDRESS_MAP_START( rtype2_sound_readport, ADDRESS_SPACE_IO, 8 )
861   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
862   AM_RANGE(0x01, 0x01) AM_READ(YM2151_status_port_0_r)
863   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
864754   AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
865755ADDRESS_MAP_END
866756
867static ADDRESS_MAP_START( rtype2_sound_writeport, ADDRESS_SPACE_IO, 8 )
757static ADDRESS_MAP_START( rtype2_sound_portmap, ADDRESS_SPACE_IO, 8 )
868758   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
869759   AM_RANGE(0x00, 0x00) AM_WRITE(YM2151_register_port_0_w)
870   AM_RANGE(0x01, 0x01) AM_WRITE(YM2151_data_port_0_w)
760   AM_RANGE(0x01, 0x01) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
761   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
871762   AM_RANGE(0x80, 0x81) AM_WRITE(rtype2_sample_addr_w)
872763   AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w)
873764   AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w)
765   AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
874766ADDRESS_MAP_END
875767
876static ADDRESS_MAP_START( poundfor_sound_readport, ADDRESS_SPACE_IO, 8 )
768static ADDRESS_MAP_START( poundfor_sound_portmap, ADDRESS_SPACE_IO, 8 )
877769   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
878   AM_RANGE(0x41, 0x41) AM_READ(YM2151_status_port_0_r)
879   AM_RANGE(0x42, 0x42) AM_READ(soundlatch_r)
880ADDRESS_MAP_END
881
882static ADDRESS_MAP_START( poundfor_sound_writeport, ADDRESS_SPACE_IO, 8 )
883   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
884770   AM_RANGE(0x10, 0x13) AM_WRITE(poundfor_sample_addr_w)
885771   AM_RANGE(0x40, 0x40) AM_WRITE(YM2151_register_port_0_w)
886   AM_RANGE(0x41, 0x41) AM_WRITE(YM2151_data_port_0_w)
772   AM_RANGE(0x41, 0x41) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
773   AM_RANGE(0x42, 0x42) AM_READ(soundlatch_r)
887774   AM_RANGE(0x42, 0x42) AM_WRITE(m72_sound_irq_ack_w)
888775ADDRESS_MAP_END
889776
890777
891778
892779#define JOYSTICK_1 \
893   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY \
894   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY \
895   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY \
896   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
780   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY \
781   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY \
782   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY \
783   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
897784
898785#define JOYSTICK_2 \
899   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL \
900   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL \
901   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL \
902   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
786   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL \
787   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL \
788   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL \
789   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
903790
904791#define COIN_MODE_1 \
905   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) ) \
906   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) ) \
907   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) ) \
908   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) ) \
909   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) ) \
910   PORT_DIPSETTING(    0x10, DEF_STR( 8C_3C ) ) \
911   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) ) \
912   PORT_DIPSETTING(    0x20, DEF_STR( 5C_3C ) ) \
913   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) ) \
914   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) ) \
915   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) ) \
916   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) ) \
917   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
918   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) ) \
919   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) ) \
920   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) ) \
921   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
792   PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coinage ) ) \
793   PORT_DIPSETTING(    0x00a0, DEF_STR( 6C_1C ) ) \
794   PORT_DIPSETTING(    0x00b0, DEF_STR( 5C_1C ) ) \
795   PORT_DIPSETTING(    0x00c0, DEF_STR( 4C_1C ) ) \
796   PORT_DIPSETTING(    0x00d0, DEF_STR( 3C_1C ) ) \
797   PORT_DIPSETTING(    0x0010, DEF_STR( 8C_3C ) ) \
798   PORT_DIPSETTING(    0x00e0, DEF_STR( 2C_1C ) ) \
799   PORT_DIPSETTING(    0x0020, DEF_STR( 5C_3C ) ) \
800   PORT_DIPSETTING(    0x0030, DEF_STR( 3C_2C ) ) \
801   PORT_DIPSETTING(    0x00f0, DEF_STR( 1C_1C ) ) \
802   PORT_DIPSETTING(    0x0040, DEF_STR( 2C_3C ) ) \
803   PORT_DIPSETTING(    0x0090, DEF_STR( 1C_2C ) ) \
804   PORT_DIPSETTING(    0x0080, DEF_STR( 1C_3C ) ) \
805   PORT_DIPSETTING(    0x0070, DEF_STR( 1C_4C ) ) \
806   PORT_DIPSETTING(    0x0060, DEF_STR( 1C_5C ) ) \
807   PORT_DIPSETTING(    0x0050, DEF_STR( 1C_6C ) ) \
808   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
922809
923810#define COIN_MODE_2 \
924   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
925   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) ) \
926   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
927   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
928   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
929   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
930   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
931   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
932   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) ) \
933   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
811   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) ) \
812   PORT_DIPSETTING(    0x0000, DEF_STR( 5C_1C ) ) \
813   PORT_DIPSETTING(    0x0010, DEF_STR( 3C_1C ) ) \
814   PORT_DIPSETTING(    0x0020, DEF_STR( 2C_1C ) ) \
815   PORT_DIPSETTING(    0x0030, DEF_STR( 1C_1C ) ) \
816   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) ) \
817   PORT_DIPSETTING(    0x00c0, DEF_STR( 1C_2C ) ) \
818   PORT_DIPSETTING(    0x0080, DEF_STR( 1C_3C ) ) \
819   PORT_DIPSETTING(    0x0040, DEF_STR( 1C_5C ) ) \
820   PORT_DIPSETTING(    0x0000, DEF_STR( 1C_6C ) )
934821
935822
936823INPUT_PORTS_START( rtype )
937824   PORT_START
938825   JOYSTICK_1
939   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
940   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
941   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
942   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
943
944   PORT_START
826   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
827   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
828   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
829   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
945830   JOYSTICK_2
946   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
947   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
948   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
949   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
831   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
832   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
833   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
834   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
950835
951836   PORT_START
952   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
953   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
954   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
955   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
956   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
957   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
958   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
959   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
837   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
838   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
839   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
840   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
841   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
842   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
843   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
844   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
845   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
960846
961847   PORT_START
962   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
963
964   PORT_START
965   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
966   PORT_DIPSETTING(    0x02, "2" )
967   PORT_DIPSETTING(    0x03, "3" )
968   PORT_DIPSETTING(    0x01, "4" )
969   PORT_DIPSETTING(    0x00, "5" )
970   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
971   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
972   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
973   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
974   PORT_DIPSETTING(    0x00, "50K 150K 250K 400K 600K" )
975   PORT_DIPSETTING(    0x08, "100K 200K 350K 500K 700K"  )
848   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
849   PORT_DIPSETTING(    0x0002, "2" )
850   PORT_DIPSETTING(    0x0003, "3" )
851   PORT_DIPSETTING(    0x0001, "4" )
852   PORT_DIPSETTING(    0x0000, "5" )
853   PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Demo_Sounds ) )
854   PORT_DIPSETTING(    0x0004, DEF_STR( Off ) )
855   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
856   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Bonus_Life ) )
857   PORT_DIPSETTING(    0x0000, "50K 150K 250K 400K 600K" )
858   PORT_DIPSETTING(    0x0008, "100K 200K 350K 500K 700K"  )
976859    /* Coin Mode 1 */
977860    COIN_MODE_1
978861    /* Coin Mode 2, not supported yet */
979862    // COIN_MODE_2
980
981   PORT_START
982   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
983   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
984   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
985   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
986   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
987   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
988   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
989   PORT_DIPSETTING(    0x04, "Mode 1" )
990   PORT_DIPSETTING(    0x00, "Mode 2" )
991   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) )
992   PORT_DIPSETTING(    0x08, DEF_STR( Normal ) )
993   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
994   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
995   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
996   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
863   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
864   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
865   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
866   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
867   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
868   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
869   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
870   PORT_DIPSETTING(    0x0400, "Mode 1" )
871   PORT_DIPSETTING(    0x0000, "Mode 2" )
872   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Difficulty ) )
873   PORT_DIPSETTING(    0x0800, DEF_STR( Normal ) )
874   PORT_DIPSETTING(    0x0000, DEF_STR( Hard ) )
875   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Allow_Continue ) )
876   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
877   PORT_DIPSETTING(    0x1000, DEF_STR( Yes ) )
997878   /* In stop mode, press 2 to stop and 1 to restart */
998   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
999   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1000   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1001   PORT_DIPNAME( 0x40, 0x40, "Invulnerability" )
1002   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1003   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1004   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
879   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
880   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
881   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
882   PORT_DIPNAME( 0x4000, 0x4000, "Invulnerability" )
883   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
884   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
885   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
1005886INPUT_PORTS_END
1006887
1007888/* identical but Demo Sounds is inverted */
1008889INPUT_PORTS_START( rtypep )
1009890   PORT_START
1010891   JOYSTICK_1
1011   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1012   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1013   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1014   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1015
1016   PORT_START
892   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
893   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
894   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
895   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
1017896   JOYSTICK_2
1018   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1019   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1020   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1021   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
897   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
898   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
899   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
900   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1022901
1023902   PORT_START
1024   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1025   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1026   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1027   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1028   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1029   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1030   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1031   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
903   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
904   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
905   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
906   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
907   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
908   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
909   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
910   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
911   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
1032912
1033913   PORT_START
1034   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1035
1036   PORT_START
1037   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1038   PORT_DIPSETTING(    0x02, "2" )
1039   PORT_DIPSETTING(    0x03, "3" )
1040   PORT_DIPSETTING(    0x01, "4" )
1041   PORT_DIPSETTING(    0x00, "5" )
1042   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
1043   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1044   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1045   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
1046   PORT_DIPSETTING(    0x00, "50K 150K 250K 400K 600K" )
1047   PORT_DIPSETTING(    0x08, "100K 200K 350K 500K 700K"  )
914   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
915   PORT_DIPSETTING(    0x0002, "2" )
916   PORT_DIPSETTING(    0x0003, "3" )
917   PORT_DIPSETTING(    0x0001, "4" )
918   PORT_DIPSETTING(    0x0000, "5" )
919   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Demo_Sounds ) )
920   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
921   PORT_DIPSETTING(    0x0004, DEF_STR( On ) )
922   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Bonus_Life ) )
923   PORT_DIPSETTING(    0x0000, "50K 150K 250K 400K 600K" )
924   PORT_DIPSETTING(    0x0008, "100K 200K 350K 500K 700K"  )
1048925    /* Coin Mode 1 */
1049926    COIN_MODE_1
1050927    /* Coin Mode 2, not supported yet */
1051928    // COIN_MODE_2
1052
1053   PORT_START
1054   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1055   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1056   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1057   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1058   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1059   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
1060   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1061   PORT_DIPSETTING(    0x04, "Mode 1" )
1062   PORT_DIPSETTING(    0x00, "Mode 2" )
1063   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) )
1064   PORT_DIPSETTING(    0x08, DEF_STR( Normal ) )
1065   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
1066   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
1067   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1068   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
929   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
930   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
931   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
932   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
933   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
934   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
935   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
936   PORT_DIPSETTING(    0x0400, "Mode 1" )
937   PORT_DIPSETTING(    0x0000, "Mode 2" )
938   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Difficulty ) )
939   PORT_DIPSETTING(    0x0800, DEF_STR( Normal ) )
940   PORT_DIPSETTING(    0x0000, DEF_STR( Hard ) )
941   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Allow_Continue ) )
942   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
943   PORT_DIPSETTING(    0x1000, DEF_STR( Yes ) )
1069944   /* In stop mode, press 2 to stop and 1 to restart */
1070   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1071   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1072   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1073   PORT_DIPNAME( 0x40, 0x40, "Invulnerability" )
1074   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1075   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1076   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
945   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
946   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
947   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
948   PORT_DIPNAME( 0x4000, 0x4000, "Invulnerability" )
949   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
950   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
951   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
1077952INPUT_PORTS_END
1078953
1079954INPUT_PORTS_START( bchopper )
1080955   PORT_START
1081956   JOYSTICK_1
1082   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1083   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1084   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1085   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1086
1087   PORT_START
957   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
958   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
959   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
960   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
1088961   JOYSTICK_2
1089   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1090   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1091   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1092   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
962   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
963   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
964   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
965   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1093966
1094967   PORT_START
1095   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1096   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1097   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1098   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1099   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1100   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1101   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1102   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
968   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
969   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
970   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
971   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
972   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
973   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
974   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
975   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
976   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
1103977
1104978   PORT_START
1105   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1106
1107   PORT_START
1108   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1109   PORT_DIPSETTING(    0x00, "1" )
1110   PORT_DIPSETTING(    0x02, "2" )
1111   PORT_DIPSETTING(    0x03, "3" )
1112   PORT_DIPSETTING(    0x01, "4" )
1113   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
1114   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1115   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1116   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
1117   PORT_DIPSETTING(    0x08, "80K 200K 350K" )
1118   PORT_DIPSETTING(    0x00, "100K 250K 400K" )
979   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
980   PORT_DIPSETTING(    0x0000, "1" )
981   PORT_DIPSETTING(    0x0002, "2" )
982   PORT_DIPSETTING(    0x0003, "3" )
983   PORT_DIPSETTING(    0x0001, "4" )
984   PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Demo_Sounds ) )
985   PORT_DIPSETTING(    0x0004, DEF_STR( Off ) )
986   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
987   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Bonus_Life ) )
988   PORT_DIPSETTING(    0x0008, "80K 200K 350K" )
989   PORT_DIPSETTING(    0x0000, "100K 250K 400K" )
1119990    /* Coin Mode 1 */
1120991    COIN_MODE_1
1121992    /* Coin Mode 2, not supported yet */
1122993    // COIN_MODE_2
1123
1124   PORT_START
1125   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1126   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1127   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1128   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1129   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1130   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
1131   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1132   PORT_DIPSETTING(    0x04, "Mode 1" )
1133   PORT_DIPSETTING(    0x00, "Mode 2" )
1134   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) )
1135   PORT_DIPSETTING(    0x08, DEF_STR( Normal ) )
1136   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
1137   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
1138   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1139   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
994   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
995   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
996   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
997   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
998   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
999   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
1000   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1001   PORT_DIPSETTING(    0x0400, "Mode 1" )
1002   PORT_DIPSETTING(    0x0000, "Mode 2" )
1003   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Difficulty ) )
1004   PORT_DIPSETTING(    0x0800, DEF_STR( Normal ) )
1005   PORT_DIPSETTING(    0x0000, DEF_STR( Hard ) )
1006   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Allow_Continue ) )
1007   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1008   PORT_DIPSETTING(    0x1000, DEF_STR( Yes ) )
11401009   /* In stop mode, press 2 to stop and 1 to restart */
1141   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1142   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1143   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1144   PORT_DIPNAME( 0x40, 0x40, "Invulnerability" )
1145   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1146   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1147   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1010   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
1011   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
1012   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1013   PORT_DIPNAME( 0x4000, 0x4000, "Invulnerability" )
1014   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
1015   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1016   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
11481017INPUT_PORTS_END
11491018
11501019INPUT_PORTS_START( nspirit )
11511020   PORT_START
11521021   JOYSTICK_1
1153   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1154   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1155   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1156   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1157
1158   PORT_START
1022   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1023   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1024   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1025   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
11591026   JOYSTICK_2
1160   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1161   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1162   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1163   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1027   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1028   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1029   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1030   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
11641031
11651032   PORT_START
1166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1167   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1168   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1169   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1170   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1171   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1172   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1173   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1033   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1034   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1035   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1036   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1037   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1038   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1039   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1040   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1041   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
11741042
11751043   PORT_START
1176   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1177
1178   PORT_START
1179   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1180   PORT_DIPSETTING(    0x02, "2" )
1181   PORT_DIPSETTING(    0x03, "3" )
1182   PORT_DIPSETTING(    0x01, "4" )
1183   PORT_DIPSETTING(    0x00, "5" )
1184   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1185   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1186   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1187   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1188   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1044   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1045   PORT_DIPSETTING(    0x0002, "2" )
1046   PORT_DIPSETTING(    0x0003, "3" )
1047   PORT_DIPSETTING(    0x0001, "4" )
1048   PORT_DIPSETTING(    0x0000, "5" )
1049   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1050   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1051   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1052   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
1053   PORT_DIPSETTING(    0x0000, DEF_STR( Hardest ) )
11891054    /* Coin Mode 1 */
11901055    COIN_MODE_1
11911056    /* Coin Mode 2, not supported yet */
11921057    // COIN_MODE_2
1193
1194   PORT_START
1195   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1196   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1197   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1198   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1199   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1200   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
1201   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1202   PORT_DIPSETTING(    0x04, "Mode 1" )
1203   PORT_DIPSETTING(    0x00, "Mode 2" )
1204   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
1205   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1206   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1207   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
1208   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1209   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
1058   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1059   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1060   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1061   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
1062   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
1063   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
1064   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1065   PORT_DIPSETTING(    0x0400, "Mode 1" )
1066   PORT_DIPSETTING(    0x0000, "Mode 2" )
1067   PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Demo_Sounds ) )
1068   PORT_DIPSETTING(    0x0800, DEF_STR( Off ) )
1069   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1070   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Allow_Continue ) )
1071   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1072   PORT_DIPSETTING(    0x1000, DEF_STR( Yes ) )
12101073   /* In stop mode, press 2 to stop and 1 to restart */
1211   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1212   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1213   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1214   PORT_DIPNAME( 0x40, 0x40, "Invulnerability" )
1215   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1216   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1217   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1074   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
1075   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
1076   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1077   PORT_DIPNAME( 0x4000, 0x4000, "Invulnerability" )
1078   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
1079   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1080   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
12181081INPUT_PORTS_END
12191082
12201083INPUT_PORTS_START( imgfight )
12211084   PORT_START
12221085   JOYSTICK_1
1223   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1224   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1225   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1226   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1227
1228   PORT_START
1086   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1087   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1088   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1089   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
12291090   JOYSTICK_2
1230   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1231   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1091   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1092   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1093   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1094   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
12341095
12351096   PORT_START
1236   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1237   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1238   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1239   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1240   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1241   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1242   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1097   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1098   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1099   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1100   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1101   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1102   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1103   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1104   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1105   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12441106
12451107   PORT_START
1246   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1247
1248   PORT_START
1249   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1250   PORT_DIPSETTING(    0x02, "2" )
1251   PORT_DIPSETTING(    0x03, "3" )
1252   PORT_DIPSETTING(    0x01, "4" )
1253   PORT_DIPSETTING(    0x00, "5" )
1254   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1255   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1256   PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )
1257   PORT_DIPSETTING(    0x04, DEF_STR( Hardest ) )
1258   PORT_DIPSETTING(    0x00, "Debug Mode 2lap" )
1108   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1109   PORT_DIPSETTING(    0x0002, "2" )
1110   PORT_DIPSETTING(    0x0003, "3" )
1111   PORT_DIPSETTING(    0x0001, "4" )
1112   PORT_DIPSETTING(    0x0000, "5" )
1113   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1114   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1115   PORT_DIPSETTING(    0x0008, DEF_STR( Hard ) )
1116   PORT_DIPSETTING(    0x0004, DEF_STR( Hardest ) )
1117   PORT_DIPSETTING(    0x0000, "Debug Mode 2lap" )
12591118    /* Coin Mode 1 */
12601119    COIN_MODE_1
12611120    /* Coin Mode 2, not supported yet */
12621121    // COIN_MODE_2
1263
1264   PORT_START
1265   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1266   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1267   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1268   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1269   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1270   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
1271   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1272   PORT_DIPSETTING(    0x04, "Mode 1" )
1273   PORT_DIPSETTING(    0x00, "Mode 2" )
1274   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
1275   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1276   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1277   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1278   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1279   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1122   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1123   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1124   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1125   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
1126   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
1127   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
1128   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1129   PORT_DIPSETTING(    0x0400, "Mode 1" )
1130   PORT_DIPSETTING(    0x0000, "Mode 2" )
1131   PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Demo_Sounds ) )
1132   PORT_DIPSETTING(    0x0800, DEF_STR( Off ) )
1133   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1134   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
1135   PORT_DIPSETTING(    0x1000, DEF_STR( Off ) )
1136   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
12801137   /* In stop mode, press 2 to stop and 1 to restart */
1281   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1282   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1283   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1284   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1285   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1138   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
1139   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
1140   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1141   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
1142   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
12861143INPUT_PORTS_END
12871144
12881145INPUT_PORTS_START( loht )
12891146   PORT_START
12901147   JOYSTICK_1
1291   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1292   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1293   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1294   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1295
1296   PORT_START
1148   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1149   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1150   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1151   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
12971152   JOYSTICK_2
1298   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1299   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1300   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1301   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1153   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1154   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1155   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1156   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
13021157
13031158   PORT_START
1304   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1305   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1306   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1307   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1308   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1309   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1310   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1311   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1159   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1160   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1161   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1162   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1163   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1164   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1165   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1166   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1167   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13121168
13131169   PORT_START
1314   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1315
1316   PORT_START
1317   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1318   PORT_DIPSETTING(    0x00, "2" )
1319   PORT_DIPSETTING(    0x03, "3" )
1320   PORT_DIPSETTING(    0x02, "4" )
1321   PORT_DIPSETTING(    0x01, "5" )
1322   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
1323   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1324   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1325   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
1170   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1171   PORT_DIPSETTING(    0x0000, "2" )
1172   PORT_DIPSETTING(    0x0003, "3" )
1173   PORT_DIPSETTING(    0x0002, "4" )
1174   PORT_DIPSETTING(    0x0001, "5" )
1175   PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Demo_Sounds ) )
1176   PORT_DIPSETTING(    0x0004, DEF_STR( Off ) )
1177   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1178   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED )
13261179    /* Coin Mode 1 */
13271180    COIN_MODE_1
13281181    /* Coin Mode 2, not supported yet */
13291182    // COIN_MODE_2
1330
1331   PORT_START
1332   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1333   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1334   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1335   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1336   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1337   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
1338   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1339   PORT_DIPSETTING(    0x04, "Mode 1" )
1340   PORT_DIPSETTING(    0x00, "Mode 2" )
1341   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
1342   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
1343   PORT_DIPSETTING(    0x18, DEF_STR( Normal ) )
1344   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
1345   PORT_DIPSETTING(    0x08, DEF_STR( Hardest ) )
1183   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1184   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1185   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1186   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
1187   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
1188   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
1189   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1190   PORT_DIPSETTING(    0x0400, "Mode 1" )
1191   PORT_DIPSETTING(    0x0000, "Mode 2" )
1192   PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
1193   PORT_DIPSETTING(    0x0000, DEF_STR( Easy ) )
1194   PORT_DIPSETTING(    0x1800, DEF_STR( Normal ) )
1195   PORT_DIPSETTING(    0x1000, DEF_STR( Hard ) )
1196   PORT_DIPSETTING(    0x0800, DEF_STR( Hardest ) )
13461197   /* In stop mode, press 2 to stop and 1 to restart */
1347   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1348   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1349   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1350   PORT_DIPNAME( 0x40, 0x40, "Invulnerability" )
1351   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1352   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1353   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1198   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
1199   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
1200   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1201   PORT_DIPNAME( 0x4000, 0x4000, "Invulnerability" )
1202   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
1203   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1204   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
13541205INPUT_PORTS_END
13551206
13561207INPUT_PORTS_START( xmultipl )
13571208   PORT_START
13581209   JOYSTICK_1
1359   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1360   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1361   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1362   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1363
1364   PORT_START
1210   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1211   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1212   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1213   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
13651214   JOYSTICK_2
1366   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1367   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1368   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1369   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1215   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1216   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1217   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1218   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
13701219
13711220   PORT_START
1372   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1373   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1374   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1375   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1376   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1377   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1378   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1379   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1221   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1222   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1223   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1224   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1225   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1226   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1227   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1228   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1229   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13801230
1381   PORT_START
1382   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1383
13841231   PORT_START_TAG("DSW1")
1385   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
1386   PORT_DIPSETTING(    0x02, DEF_STR( Very_Easy ) )
1387   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
1388   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
1389   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
1390   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
1391   PORT_DIPSETTING(    0x08, "1" )
1392   PORT_DIPSETTING(    0x04, "2" )
1393   PORT_DIPSETTING(    0x0c, "3" )
1394   PORT_DIPSETTING(    0x00, "4" )
1232   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
1233   PORT_DIPSETTING(    0x0002, DEF_STR( Very_Easy ) )
1234   PORT_DIPSETTING(    0x0001, DEF_STR( Easy ) )
1235   PORT_DIPSETTING(    0x0003, DEF_STR( Normal ) )
1236   PORT_DIPSETTING(    0x0000, DEF_STR( Hard ) )
1237   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) )
1238   PORT_DIPSETTING(    0x0008, "1" )
1239   PORT_DIPSETTING(    0x0004, "2" )
1240   PORT_DIPSETTING(    0x000c, "3" )
1241   PORT_DIPSETTING(    0x0000, "4" )
13951242    /* Coin Mode 1 */
13961243    COIN_MODE_1
13971244    /* Coin Mode 2, not supported yet */
13981245    // COIN_MODE_2
1399
1400   PORT_START_TAG("DSW2")
1401   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1402   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1403   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1404   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1405   PORT_DIPSETTING(    0x00, "Upright (single)" )        PORT_CONDITION("DSW2", 0x10, PORTCOND_NOTEQUALS, 0x00)
1406   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )       PORT_CONDITION("DSW2", 0x10, PORTCOND_NOTEQUALS, 0x00)
1407   PORT_DIPSETTING(    0x00, "Upright (double) On" )     PORT_CONDITION("DSW2", 0x10, PORTCOND_EQUALS, 0x00)
1408   PORT_DIPSETTING(    0x02, "Upright (double) Off" )    PORT_CONDITION("DSW2", 0x10, PORTCOND_EQUALS, 0x00)
1409   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1410   PORT_DIPSETTING(    0x04, "Mode 1" )
1411   PORT_DIPSETTING(    0x00, "Mode 2" )
1412   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1413   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1414   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1415   PORT_DIPNAME( 0x10, 0x10, "Upright (double) Mode" )
1416   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1417   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1418   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
1419   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1420   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
1421   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1422   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1246   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1247   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1248   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1249   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
1250   PORT_DIPSETTING(    0x0000, "Upright (single)" )        PORT_CONDITION("DSW1", 0x1000, PORTCOND_NOTEQUALS, 0x0000)
1251   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )       PORT_CONDITION("DSW1", 0x1000, PORTCOND_NOTEQUALS, 0x0000)
1252   PORT_DIPSETTING(    0x0000, "Upright (double) On" )     PORT_CONDITION("DSW1", 0x1000, PORTCOND_EQUALS, 0x0000)
1253   PORT_DIPSETTING(    0x0200, "Upright (double) Off" )    PORT_CONDITION("DSW1", 0x1000, PORTCOND_EQUALS, 0x0000)
1254   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1255   PORT_DIPSETTING(    0x0400, "Mode 1" )
1256   PORT_DIPSETTING(    0x0000, "Mode 2" )
1257   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Demo_Sounds ) )
1258   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
1259   PORT_DIPSETTING(    0x0800, DEF_STR( On ) )
1260   PORT_DIPNAME( 0x1000, 0x1000, "Upright (double) Mode" )
1261   PORT_DIPSETTING(    0x1000, DEF_STR( Off ) )
1262   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1263   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Allow_Continue ) )
1264   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1265   PORT_DIPSETTING(    0x2000, DEF_STR( Yes ) )
1266   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
1267   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
14231268INPUT_PORTS_END
14241269
14251270INPUT_PORTS_START( dbreed )
14261271   PORT_START
14271272   JOYSTICK_1
1428   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1429   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1430   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1431   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1432
1433   PORT_START
1273   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1274   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1275   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1276   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
14341277   JOYSTICK_2
1435   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1436   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1437   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1438   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1278   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1279   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1280   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1281   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
14391282
14401283   PORT_START
1441   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1442   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1443   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1444   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1445   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1446   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1447   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1448   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1284   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1285   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1286   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1287   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1288   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1289   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1290   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1291   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1292   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
14491293
14501294   PORT_START
1451   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1452
1453   PORT_START
1454   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1455   PORT_DIPSETTING(    0x02, "2" )
1456   PORT_DIPSETTING(    0x03, "3" )
1457   PORT_DIPSETTING(    0x01, "4" )
1458   PORT_DIPSETTING(    0x00, "5" )
1459   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1460   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy ) )
1461   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1462   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1463   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1295   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1296   PORT_DIPSETTING(    0x0002, "2" )
1297   PORT_DIPSETTING(    0x0003, "3" )
1298   PORT_DIPSETTING(    0x0001, "4" )
1299   PORT_DIPSETTING(    0x0000, "5" )
1300   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1301   PORT_DIPSETTING(    0x0000, DEF_STR( Very_Easy ) )
1302   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1303   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1304   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
14641305    /* Coin Mode 1 */
14651306    COIN_MODE_1
14661307    /* Coin Mode 2, not supported yet */
14671308    // COIN_MODE_2
1468
1469   PORT_START
1470   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1471   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1472   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1473   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
1474   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1475   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
1476   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1477   PORT_DIPSETTING(    0x04, "Mode 1" )
1478   PORT_DIPSETTING(    0x00, "Mode 2" )
1479   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
1480   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1481   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1482   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
1483   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1484   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
1309   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1310   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1311   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1312   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
1313   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
1314   PORT_DIPSETTING(    0x0200, DEF_STR( Cocktail ) )
1315   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1316   PORT_DIPSETTING(    0x0400, "Mode 1" )
1317   PORT_DIPSETTING(    0x0000, "Mode 2" )
1318   PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Demo_Sounds ) )
1319   PORT_DIPSETTING(    0x0800, DEF_STR( Off ) )
1320   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1321   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Allow_Continue ) )
1322   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1323   PORT_DIPSETTING(    0x1000, DEF_STR( Yes ) )
14851324   /* In stop mode, press 2 to stop and 1 to restart */
1486   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1487   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1488   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1489   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1490   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1325   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
1326   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
1327   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1328   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
1329   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
14911330INPUT_PORTS_END
14921331
14931332INPUT_PORTS_START( rtype2 )
14941333   PORT_START
14951334   JOYSTICK_1
1496   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1497   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1498   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1499   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1500
1501   PORT_START
1335   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1336   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1337   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1338   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
15021339   JOYSTICK_2
1503   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1504   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1505   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1506   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1340   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1341   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1342   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1343   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
15071344
15081345   PORT_START
1509   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1510   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1511   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1512   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1513   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1514   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1515   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1516   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1346   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1347   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1348   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1349   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1350   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1351   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x0020 is another test mode */
1352   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1353   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1354   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
15171355
15181356   PORT_START
1519   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1520
1521   PORT_START
1522   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1523   PORT_DIPSETTING(    0x02, "2" )
1524   PORT_DIPSETTING(    0x03, "3" )
1525   PORT_DIPSETTING(    0x01, "4" )
1526   PORT_DIPSETTING(    0x00, "5" )
1527   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1528   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1529   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1530   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1531   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1357   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1358   PORT_DIPSETTING(    0x0002, "2" )
1359   PORT_DIPSETTING(    0x0003, "3" )
1360   PORT_DIPSETTING(    0x0001, "4" )
1361   PORT_DIPSETTING(    0x0000, "5" )
1362   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1363   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1364   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1365   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
1366   PORT_DIPSETTING(    0x0000, DEF_STR( Hardest ) )
15321367    /* Coin Mode 1 */
15331368    COIN_MODE_1
15341369    /* Coin Mode 2, not supported yet */
15351370    // COIN_MODE_2
1536
1537   PORT_START
1538   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1539   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1540   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1541   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
1542   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1543   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1544   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
1545   PORT_DIPSETTING(    0x04, "Mode 1" )
1546   PORT_DIPSETTING(    0x00, "Mode 2" )
1547   PORT_DIPNAME( 0x18, 0x10, DEF_STR( Cabinet ) )
1548   PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
1549   PORT_DIPSETTING(    0x00, "Upright (2P)" )
1550   PORT_DIPSETTING(    0x18, DEF_STR( Cocktail ) )
1371   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1372   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1373   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1374   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) )
1375   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
1376   PORT_DIPSETTING(    0x0200, DEF_STR( On ) )
1377   PORT_DIPNAME( 0x0400, 0x0400, "Coin Mode" )
1378   PORT_DIPSETTING(    0x0400, "Mode 1" )
1379   PORT_DIPSETTING(    0x0000, "Mode 2" )
1380   PORT_DIPNAME( 0x1800, 0x1000, DEF_STR( Cabinet ) )
1381   PORT_DIPSETTING(    0x1000, DEF_STR( Upright ) )
1382   PORT_DIPSETTING(    0x0000, "Upright (2P)" )
1383   PORT_DIPSETTING(    0x1800, DEF_STR( Cocktail ) )
15511384   /* In stop mode, press 2 to stop and 1 to restart */
1552   PORT_DIPNAME( 0x20, 0x20, "Stop Mode" )
1553   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1554   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1555   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1556   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1385   PORT_DIPNAME( 0x2000, 0x2000, "Stop Mode" )
1386   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
1387   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1388   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
1389   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
15571390INPUT_PORTS_END
15581391
15591392INPUT_PORTS_START( hharry )
15601393   PORT_START
15611394   JOYSTICK_1
1562   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1563   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1564   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1565   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1566
1567   PORT_START
1395   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1396   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1397   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1398   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
15681399   JOYSTICK_2
1569   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1570   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1571   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1572   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1400   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1401   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1402   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1403   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
15731404
15741405   PORT_START
1575   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1576   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1577   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1578   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1579   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1580   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1581   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1582   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1406   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1407   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1408   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1409   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1410   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1411   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x0020 is another test mode */
1412   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1413   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1414   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
15831415
15841416   PORT_START
1585   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1586
1587   PORT_START
1588   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1589   PORT_DIPSETTING(    0x02, "2" )
1590   PORT_DIPSETTING(    0x03, "3" )
1591   PORT_DIPSETTING(    0x01, "4" )
1592   PORT_DIPSETTING(    0x00, "5" )
1593   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1594   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy ) )
1595   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1596   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1597   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1598   PORT_DIPNAME( 0x10, 0x10, "Continue Limit" )
1599   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1600   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
1601   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
1602   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1603   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
1604   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
1605   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1606   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1607   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1608
1609   PORT_START
1610   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1611   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1612   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1613   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Cabinet ) )
1614   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
1615   PORT_DIPSETTING(    0x00, "Upright (2P)" )
1616   PORT_DIPSETTING(    0x06, DEF_STR( Cocktail ) )
1617   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" )
1618   PORT_DIPSETTING(    0x08, "Mode 1" )
1619   PORT_DIPSETTING(    0x00, "Mode 2" )
1417   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1418   PORT_DIPSETTING(    0x0002, "2" )
1419   PORT_DIPSETTING(    0x0003, "3" )
1420   PORT_DIPSETTING(    0x0001, "4" )
1421   PORT_DIPSETTING(    0x0000, "5" )
1422   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1423   PORT_DIPSETTING(    0x0000, DEF_STR( Very_Easy ) )
1424   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1425   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1426   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
1427   PORT_DIPNAME( 0x0010, 0x0010, "Continue Limit" )
1428   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1429   PORT_DIPSETTING(    0x0010, DEF_STR( Yes ) )
1430   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
1431   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1432   PORT_DIPSETTING(    0x0020, DEF_STR( Yes ) )
1433   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
1434   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
1435   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1436   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
1437   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1438   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1439   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1440   PORT_DIPNAME( 0x0600, 0x0400, DEF_STR( Cabinet ) )
1441   PORT_DIPSETTING(    0x0400, DEF_STR( Upright ) )
1442   PORT_DIPSETTING(    0x0000, "Upright (2P)" )
1443   PORT_DIPSETTING(    0x0600, DEF_STR( Cocktail ) )
1444   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" )
1445   PORT_DIPSETTING(    0x0800, "Mode 1" )
1446   PORT_DIPSETTING(    0x0000, "Mode 2" )
16201447   /* Coin Mode 1 */
1621   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
1622   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
1623   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
1624   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
1625   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
1626   PORT_DIPSETTING(    0x10, "2 Coins/1 Credit, 1 Coin/Continue" )
1627   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
1628   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) )
1629   PORT_DIPSETTING(    0x20, DEF_STR( 4C_3C ) )
1630   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1631   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
1632   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) )
1633   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
1634   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) )
1635   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
1636   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
1637   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1448   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) )
1449   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) )
1450   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) )
1451   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) )
1452   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) )
1453   PORT_DIPSETTING(    0x1000, "2 Coins/1 Credit, 1 Coin/Continue" )
1454   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) )
1455   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) )
1456   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) )
1457   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) )
1458   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) )
1459   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) )
1460   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) )
1461   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) )
1462   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) )
1463   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) )
1464   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
16381465   /* Coin mode 2, not supported yet */
16391466    // COIN_MODE_2
16401467INPUT_PORTS_END
16411468
16421469INPUT_PORTS_START( poundfor )
16431470   PORT_START
1644   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* high bits of trackball X */
1645   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
1646   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
1647   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1471   PORT_BIT( 0x001f, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* high bits of trackball X */
1472   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
1473   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
1474   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1475   PORT_BIT( 0x1f00, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* high bits of trackball X */
1476   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
1477   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
1478   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
16481479
16491480   PORT_START
1650   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* high bits of trackball X */
1651   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
1652   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
1653   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1481   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1482   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1483   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1484   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1485   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1486   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x0020 is another test mode */
1487   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1488   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1489   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
16541490
16551491   PORT_START
1656   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1657   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1658   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1659   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1660   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1661   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1662   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1663   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1492   PORT_DIPNAME( 0x0003, 0x0003, "Round Time" )
1493   PORT_DIPSETTING(    0x0002, "60" )
1494   PORT_DIPSETTING(    0x0003, "90" )
1495   PORT_DIPSETTING(    0x0001, "120" )
1496   PORT_DIPSETTING(    0x0000, "150" )
1497   PORT_DIPNAME( 0x0004, 0x0004, "Matches/Credit (2P)" )
1498   PORT_DIPSETTING(    0x0004, "1" )
1499   PORT_DIPSETTING(    0x0000, "2" )
1500   PORT_DIPNAME( 0x0008, 0x0008, "Rounds/Match" )
1501   PORT_DIPSETTING(    0x0008, "2" )
1502   PORT_DIPSETTING(    0x0000, "3" )
1503   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Difficulty ) )
1504   PORT_DIPSETTING(    0x0010, DEF_STR( Normal ) )
1505   PORT_DIPSETTING(    0x0000, DEF_STR( Hard ) )
1506   PORT_DIPNAME( 0x0020, 0x0020, "Trackball Size" )
1507   PORT_DIPSETTING(    0x0020, "Small" )
1508   PORT_DIPSETTING(    0x0000, "Large" )
1509   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
1510   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
1511   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1512   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
1513   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1514   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1515   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1516   PORT_DIPNAME( 0x0600, 0x0400, DEF_STR( Cabinet ) )
1517   PORT_DIPSETTING(    0x0400, DEF_STR( Upright ) )
1518   PORT_DIPSETTING(    0x0200, "Upright (2P)" )
1519   PORT_DIPSETTING(    0x0600, DEF_STR( Cocktail ) )
1520   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" )
1521   PORT_DIPSETTING(    0x0800, "Mode 1" )
1522   PORT_DIPSETTING(    0x0000, "Mode 2" )
16641523
1665   PORT_START
1666   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1667
1668   PORT_START
1669   PORT_DIPNAME( 0x03, 0x03, "Round Time" )
1670   PORT_DIPSETTING(    0x02, "60" )
1671   PORT_DIPSETTING(    0x03, "90" )
1672   PORT_DIPSETTING(    0x01, "120" )
1673   PORT_DIPSETTING(    0x00, "150" )
1674   PORT_DIPNAME( 0x04, 0x04, "Matches/Credit (2P)" )
1675   PORT_DIPSETTING(    0x04, "1" )
1676   PORT_DIPSETTING(    0x00, "2" )
1677   PORT_DIPNAME( 0x08, 0x08, "Rounds/Match" )
1678   PORT_DIPSETTING(    0x08, "2" )
1679   PORT_DIPSETTING(    0x00, "3" )
1680   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
1681   PORT_DIPSETTING(    0x10, DEF_STR( Normal ) )
1682   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
1683   PORT_DIPNAME( 0x20, 0x20, "Trackball Size" )
1684   PORT_DIPSETTING(    0x20, "Small" )
1685   PORT_DIPSETTING(    0x00, "Large" )
1686   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
1687   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1688   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1689   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1690
1691   PORT_START
1692   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1693   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1694   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1695   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Cabinet ) )
1696   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
1697   PORT_DIPSETTING(    0x02, "Upright (2P)" )
1698   PORT_DIPSETTING(    0x06, DEF_STR( Cocktail ) )
1699   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" )
1700   PORT_DIPSETTING(    0x08, "Mode 1" )
1701   PORT_DIPSETTING(    0x00, "Mode 2" )
1702
17031524   /* Coin Mode 1 */
1704   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
1705   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
1706   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
1707   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
1708   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
1709   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
1710   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) )
1711   PORT_DIPSETTING(    0x20, DEF_STR( 4C_3C ) )
1712   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1713   PORT_DIPSETTING(    0x10, "1 Coin/1 Credit, 1 Coin/Continue" )
1714   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
1715   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) )
1716   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
1717   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) )
1718   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
1719   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
1720   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1525   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) )
1526   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) )
1527   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) )
1528   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) )
1529   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) )
1530   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) )
1531   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) )
1532   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) )
1533   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) )
1534   PORT_DIPSETTING(    0x1000, "1 Coin/1 Credit, 1 Coin/Continue" )
1535   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) )
1536   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) )
1537   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) )
1538   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) )
1539   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) )
1540   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) )
1541   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
17211542    /* Coin Mode 2, not supported yet */
17221543    // COIN_MODE_2
17231544
r869r870
17371558INPUT_PORTS_START( airduel )
17381559   PORT_START
17391560   JOYSTICK_1
1740   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1741   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1742   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1743   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1744
1745   PORT_START
1561   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1562   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1563   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1564   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
17461565   JOYSTICK_2
1747   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1748   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1749   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1750   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1566   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1567   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1568   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1569   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
17511570
17521571   PORT_START
1753   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1754   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1755   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1756   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1757   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1758   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1759   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1760   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1572   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1573   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1574   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1575   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1576   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1577   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x0020 is another test mode */
1578   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1579   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1580   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
17611581
17621582   PORT_START
1763   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1764
1765   PORT_START
1766   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1767   PORT_DIPSETTING(    0x02, "2" )
1768   PORT_DIPSETTING(    0x03, "3" )
1769   PORT_DIPSETTING(    0x01, "4" )
1770   PORT_DIPSETTING(    0x00, "5" )
1771   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1772   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy ) )
1773   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1774   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1775   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1776   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
1777   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
1778   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1779   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1780   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1781
1782   PORT_START
1783   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1784   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1785   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1786   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
1787   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" )
1788   PORT_DIPSETTING(    0x08, "Mode 1" )
1789   PORT_DIPSETTING(    0x00, "Mode 2" )
1790
1583   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1584   PORT_DIPSETTING(    0x0002, "2" )
1585   PORT_DIPSETTING(    0x0003, "3" )
1586   PORT_DIPSETTING(    0x0001, "4" )
1587   PORT_DIPSETTING(    0x0000, "5" )
1588   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1589   PORT_DIPSETTING(    0x0000, DEF_STR( Very_Easy ) )
1590   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1591   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1592   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
1593   PORT_BIT( 0x0030, IP_ACTIVE_LOW, IPT_UNUSED )
1594   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
1595   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
1596   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1597   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
1598   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1599   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1600   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1601   PORT_BIT( 0x0600, IP_ACTIVE_LOW, IPT_UNUSED )
1602   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" )
1603   PORT_DIPSETTING(    0x0800, "Mode 1" )
1604   PORT_DIPSETTING(    0x0000, "Mode 2" )
17911605   /* Coin Mode 1 */
1792   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
1793   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
1794   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
1795   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
1796   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
1797//  PORT_DIPSETTING(    0x10, DEF_STR( Free-Play ) )  /* another free play */
1798   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
1799   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) )
1800   PORT_DIPSETTING(    0x20, DEF_STR( 4C_3C ) )
1801   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1802   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
1803   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) )
1804   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
1805   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) )
1806   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
1807   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
1808   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1606   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) )
1607   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) )
1608   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) )
1609   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) )
1610   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) )
1611//  PORT_DIPSETTING(    0x1000, DEF_STR( Free-Play ) )  /* another free play */
1612   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) )
1613   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) )
1614   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) )
1615   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) )
1616   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) )
1617   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) )
1618   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) )
1619   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) )
1620   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) )
1621   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) )
1622   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
18091623    /* Coin Mode 2, not supported yet */
18101624    // COIN_MODE_2
18111625INPUT_PORTS_END
r869r870
18131627INPUT_PORTS_START( gallop )
18141628   PORT_START
18151629   JOYSTICK_1
1816   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1817   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1818   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1819   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1820
1821   PORT_START
1630   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1631   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1632   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1633   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
18221634   JOYSTICK_2
1823   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1824   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1825   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1826   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1635   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1636   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1637   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1638   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
18271639
18281640   PORT_START
1829   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1830   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1831   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1832   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1833   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1834   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1835   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1836   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1641   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1642   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1643   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1644   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1645   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1646   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x0020 is another test mode */
1647   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1648   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1649   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
18371650
18381651   PORT_START
1839   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1840
1841   PORT_START
1842   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1843   PORT_DIPSETTING(    0x02, "2" )
1844   PORT_DIPSETTING(    0x03, "3" )
1845   PORT_DIPSETTING(    0x01, "4" )
1846   PORT_DIPSETTING(    0x00, "5" )
1847   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1848   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy ) )
1849   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1850   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1851   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1852   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
1853   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
1854   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1855   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
1856   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
1857   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1858   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1859   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1860
1861   PORT_START
1862   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1863   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1864   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1865   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Cabinet ) )
1866   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1867   PORT_DIPSETTING(    0x02, "Upright (2P)" )
1868   PORT_DIPSETTING(    0x06, DEF_STR( Cocktail ) )
1869   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" )
1870   PORT_DIPSETTING(    0x08, "Mode 1" )
1871   PORT_DIPSETTING(    0x00, "Mode 2" )
1652   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1653   PORT_DIPSETTING(    0x0002, "2" )
1654   PORT_DIPSETTING(    0x0003, "3" )
1655   PORT_DIPSETTING(    0x0001, "4" )
1656   PORT_DIPSETTING(    0x0000, "5" )
1657   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1658   PORT_DIPSETTING(    0x0000, DEF_STR( Very_Easy ) )
1659   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1660   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1661   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
1662   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED )
1663   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
1664   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1665   PORT_DIPSETTING(    0x0020, DEF_STR( Yes ) )
1666   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
1667   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
1668   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1669   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
1670   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1671   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1672   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1673   PORT_DIPNAME( 0x0600, 0x0000, DEF_STR( Cabinet ) )
1674   PORT_DIPSETTING(    0x0000, DEF_STR( Upright ) )
1675   PORT_DIPSETTING(    0x0200, "Upright (2P)" )
1676   PORT_DIPSETTING(    0x0600, DEF_STR( Cocktail ) )
1677   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" )
1678   PORT_DIPSETTING(    0x0800, "Mode 1" )
1679   PORT_DIPSETTING(    0x0000, "Mode 2" )
18721680   /* Coin Mode 1 */
1873   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
1874   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
1875   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
1876   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
1877   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
1878   PORT_DIPSETTING(    0x10, "2 Coins/1 Credit, 1 Coin/Continue" )
1879   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
1880   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) )
1881   PORT_DIPSETTING(    0x20, DEF_STR( 4C_3C ) )
1882   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1883   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
1884   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) )
1885   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
1886   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) )
1887   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
1888   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
1889   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1681   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) )
1682   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) )
1683   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) )
1684   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) )
1685   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) )
1686   PORT_DIPSETTING(    0x1000, "2 Coins/1 Credit, 1 Coin/Continue" )
1687   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) )
1688   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) )
1689   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) )
1690   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) )
1691   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) )
1692   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) )
1693   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) )
1694   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) )
1695   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) )
1696   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) )
1697   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
18901698   /* Coin mode 2, not supported yet */
18911699    // COIN_MODE_2
18921700INPUT_PORTS_END
r869r870
18941702INPUT_PORTS_START( kengo )
18951703   PORT_START
18961704   JOYSTICK_1
1897   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
1898   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
1899   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1900   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
1901
1902   PORT_START
1705   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 )
1706   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 )
1707   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 )
1708   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 )
19031709   JOYSTICK_2
1904   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1905   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1906   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1907   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1710   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1711   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1712   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1713   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
19081714
19091715   PORT_START
1910   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1911   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1912   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1913   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
1914   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1915   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x20 is another test mode */
1916   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1917   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1716   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1717   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
1718   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
1719   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
1720   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
1721   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* 0x0020 is another test mode */
1722   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1723   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sprite DMA complete */
1724   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
19181725
19191726   PORT_START
1920   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1921
1922   PORT_START
1923   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1924   PORT_DIPSETTING(    0x02, "2" )
1925   PORT_DIPSETTING(    0x03, "3" )
1926   PORT_DIPSETTING(    0x01, "4" )
1927   PORT_DIPSETTING(    0x00, "5" )
1928   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1929   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy ) )
1930   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1931   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1932   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1933   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1934   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1935   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1936   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
1937   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1938   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
1939   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
1940   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1941   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1942   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1943
1944   PORT_START
1945   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
1946   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1947   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1948   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1949   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1950   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1951   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1952   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1953   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1954   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" )
1955   PORT_DIPSETTING(    0x08, "Mode 1" )
1956   PORT_DIPSETTING(    0x00, "Mode 2" )
1727   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
1728   PORT_DIPSETTING(    0x0002, "2" )
1729   PORT_DIPSETTING(    0x0003, "3" )
1730   PORT_DIPSETTING(    0x0001, "4" )
1731   PORT_DIPSETTING(    0x0000, "5" )
1732   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
1733   PORT_DIPSETTING(    0x0000, DEF_STR( Very_Easy ) )
1734   PORT_DIPSETTING(    0x0008, DEF_STR( Easy ) )
1735   PORT_DIPSETTING(    0x000c, DEF_STR( Normal ) )
1736   PORT_DIPSETTING(    0x0004, DEF_STR( Hard ) )
1737   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
1738   PORT_DIPSETTING(    0x0010, DEF_STR( Off ) )
1739   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1740   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
1741   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
1742   PORT_DIPSETTING(    0x0020, DEF_STR( Yes ) )
1743   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
1744   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
1745   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1746   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
1747   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
1748   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
1749   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1750   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
1751   PORT_DIPSETTING(    0x0200, DEF_STR( Off ) )
1752   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1753   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
1754   PORT_DIPSETTING(    0x0400, DEF_STR( Off ) )
1755   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
1756   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" )
1757   PORT_DIPSETTING(    0x0800, "Mode 1" )
1758   PORT_DIPSETTING(    0x0000, "Mode 2" )
19571759   /* Coin Mode 1 */
1958   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
1959   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
1960   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
1961   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
1962   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
1963   PORT_DIPSETTING(    0x10, "2 Coins/1 Credit, 1 Coin/Continue" )
1964   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
1965   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) )
1966   PORT_DIPSETTING(    0x20, DEF_STR( 4C_3C ) )
1967   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1968   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
1969   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) )
1970   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
1971   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) )
1972   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
1973   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
1974   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1760   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) )
1761   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) )
1762   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) )
1763   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) )
1764   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) )
1765   PORT_DIPSETTING(    0x1000, "2 Coins/1 Credit, 1 Coin/Continue" )
1766   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) )
1767   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) )
1768   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) )
1769   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) )
1770   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) )
1771   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) )
1772   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) )
1773   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) )
1774   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) )
1775   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) )
1776   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
19751777   /* Coin mode 2, not supported yet */
19761778    // COIN_MODE_2
19771779INPUT_PORTS_END
r869r870
20381840
20391841   /* basic machine hardware */
20401842   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2041   MDRV_CPU_PROGRAM_MAP(rtype_readmem,rtype_writemem)
2042   MDRV_CPU_IO_MAP(readport,writeport)
1843   MDRV_CPU_PROGRAM_MAP(rtype_map,0)
1844   MDRV_CPU_IO_MAP(m72_portmap,0)
20431845   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
20441846
20451847   MDRV_CPU_ADD(Z80, 3579545)
2046   /* audio CPU */   /* 3.579545 MHz */
20471848   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
2048   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
1849   MDRV_CPU_IO_MAP(sound_portmap,0)
20491850                        /* IRQs are generated by main Z80 and YM2151 */
20501851   MDRV_SCREEN_REFRESH_RATE(55)
20511852   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
r869r870
20771878
20781879   /* basic machine hardware */
20791880   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2080   MDRV_CPU_PROGRAM_MAP(m72_readmem,m72_writemem)
2081   MDRV_CPU_IO_MAP(readport,writeport)
1881   MDRV_CPU_PROGRAM_MAP(m72_map,0)
1882   MDRV_CPU_IO_MAP(m72_portmap,0)
20821883   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
20831884
20841885   MDRV_CPU_ADD(Z80, 3579545)
2085   /* audio CPU */   /* 3.579545 MHz */
20861886   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
2087   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
1887   MDRV_CPU_IO_MAP(sound_portmap,0)
20881888   MDRV_CPU_VBLANK_INT(fake_nmi,128)   /* clocked by V1? (Vigilante) */
20891889                        /* IRQs are generated by main Z80 and YM2151 */
20901890   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
21211921
21221922   /* basic machine hardware */
21231923   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2124   MDRV_CPU_PROGRAM_MAP(m72_readmem,m72_writemem)
2125   MDRV_CPU_IO_MAP(readport,xmultipl_writeport)
1924   MDRV_CPU_PROGRAM_MAP(m72_map,0)
1925   MDRV_CPU_IO_MAP(m72_portmap,0)
21261926   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
21271927
21281928   MDRV_CPU_ADD(Z80, 3579545)
2129   /* audio CPU */   /* 3.579545 MHz */
21301929   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
2131   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
1930   MDRV_CPU_IO_MAP(sound_portmap,0)
21321931   MDRV_CPU_VBLANK_INT(fake_nmi,128)   /* clocked by V1? (Vigilante) */
21331932                        /* IRQs are generated by main Z80 and YM2151 */
21341933   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
21651964
21661965   /* basic machine hardware */
21671966   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2168   MDRV_CPU_PROGRAM_MAP(xmultipl_readmem,xmultipl_writemem)
2169   MDRV_CPU_IO_MAP(readport,xmultipl_writeport)
1967   MDRV_CPU_PROGRAM_MAP(xmultipl_map,0)
1968   MDRV_CPU_IO_MAP(m72_portmap,0)
21701969   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
21711970
21721971   MDRV_CPU_ADD(Z80, 3579545)
2173   /* audio CPU */   /* 3.579545 MHz */
21741972   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
2175   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
1973   MDRV_CPU_IO_MAP(sound_portmap,0)
21761974   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
21771975                        /* IRQs are generated by main Z80 and YM2151 */
21781976   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
22092007
22102008   /* basic machine hardware */
22112009   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2212   MDRV_CPU_PROGRAM_MAP(dbreed_readmem,dbreed_writemem)
2213   MDRV_CPU_IO_MAP(readport,hharry_writeport)//xmultipl_writeport)
2010   MDRV_CPU_PROGRAM_MAP(dbreed_map,0)
2011   MDRV_CPU_IO_MAP(hharry_portmap,0)
22142012   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
22152013
22162014   MDRV_CPU_ADD(Z80, 3579545)
2217   /* audio CPU */   /* 3.579545 MHz */
22182015   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2219   MDRV_CPU_IO_MAP(rtype2_sound_readport,rtype2_sound_writeport)
2016   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
22202017   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
22212018                        /* IRQs are generated by main Z80 and YM2151 */
22222019   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
22512048
22522049   /* basic machine hardware */
22532050   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2254   MDRV_CPU_PROGRAM_MAP(dbreed72_readmem,dbreed72_writemem)
2255   MDRV_CPU_IO_MAP(readport,xmultipl_writeport)
2051   MDRV_CPU_PROGRAM_MAP(dbreed72_map,0)
2052   MDRV_CPU_IO_MAP(m72_portmap,0)
22562053   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
22572054
22582055   MDRV_CPU_ADD(Z80, 3579545)
2259   /* audio CPU */   /* 3.579545 MHz */
22602056   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
2261   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
2057   MDRV_CPU_IO_MAP(sound_portmap,0)
22622058   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
22632059                        /* IRQs are generated by main Z80 and YM2151 */
22642060   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
22942090
22952091   /* basic machine hardware */
22962092   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2297   MDRV_CPU_PROGRAM_MAP(rtype2_readmem,rtype2_writemem)
2298   MDRV_CPU_IO_MAP(readport,rtype2_writeport)
2093   MDRV_CPU_PROGRAM_MAP(rtype2_map,0)
2094   MDRV_CPU_IO_MAP(rtype2_portmap,0)
22992095   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
23002096
23012097   MDRV_CPU_ADD(Z80, 3579545)
2302   /* audio CPU */   /* 3.579545 MHz */
23032098   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2304   MDRV_CPU_IO_MAP(rtype2_sound_readport,rtype2_sound_writeport)
2099   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
23052100   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
23062101                        /* IRQs are generated by main Z80 and YM2151 */
23072102   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
23372132
23382133   /* basic machine hardware */
23392134   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2340   MDRV_CPU_PROGRAM_MAP(majtitle_readmem,majtitle_writemem)
2341   MDRV_CPU_IO_MAP(readport,majtitle_writeport)
2135   MDRV_CPU_PROGRAM_MAP(majtitle_map,0)
2136   MDRV_CPU_IO_MAP(majtitle_portmap,0)
23422137   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
23432138
23442139   MDRV_CPU_ADD(Z80, 3579545)
2345   /* audio CPU */   /* 3.579545 MHz */
23462140   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2347   MDRV_CPU_IO_MAP(rtype2_sound_readport,rtype2_sound_writeport)
2141   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
23482142   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
23492143                        /* IRQs are generated by main Z80 and YM2151 */
23502144   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
23802174
23812175   /* basic machine hardware */
23822176   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2383   MDRV_CPU_PROGRAM_MAP(hharry_readmem,hharry_writemem)
2384   MDRV_CPU_IO_MAP(readport,hharry_writeport)
2177   MDRV_CPU_PROGRAM_MAP(hharry_map,0)
2178   MDRV_CPU_IO_MAP(hharry_portmap,0)
23852179   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
23862180
23872181   MDRV_CPU_ADD(Z80, 3579545)
2388   /* audio CPU */   /* 3.579545 MHz */
23892182   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2390   MDRV_CPU_IO_MAP(rtype2_sound_readport,rtype2_sound_writeport)
2183   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
23912184   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
23922185                        /* IRQs are generated by main Z80 and YM2151 */
23932186   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
24242217
24252218   /* basic machine hardware */
24262219   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2427   MDRV_CPU_PROGRAM_MAP(hharryu_readmem,hharryu_writemem)
2428   MDRV_CPU_IO_MAP(readport,rtype2_writeport)
2220   MDRV_CPU_PROGRAM_MAP(hharryu_map,0)
2221   MDRV_CPU_IO_MAP(rtype2_portmap,0)
24292222   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
24302223
24312224   MDRV_CPU_ADD(Z80, 3579545)
2432   /* audio CPU */   /* 3.579545 MHz */
24332225   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2434   MDRV_CPU_IO_MAP(rtype2_sound_readport,rtype2_sound_writeport)
2226   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
24352227   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
24362228                        /* IRQs are generated by main Z80 and YM2151 */
24372229   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
24682260
24692261   /* basic machine hardware */
24702262   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2471   MDRV_CPU_PROGRAM_MAP(rtype2_readmem,rtype2_writemem)
2472   MDRV_CPU_IO_MAP(poundfor_readport,rtype2_writeport)
2263   MDRV_CPU_PROGRAM_MAP(rtype2_map,0)
2264   MDRV_CPU_IO_MAP(poundfor_portmap,0)
24732265   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
24742266
24752267   MDRV_CPU_ADD(Z80, 3579545)
2476   /* audio CPU */   /* 3.579545 MHz */
24772268   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2478   MDRV_CPU_IO_MAP(poundfor_sound_readport,poundfor_sound_writeport)
2269   MDRV_CPU_IO_MAP(poundfor_sound_portmap,0)
24792270   MDRV_CPU_VBLANK_INT(fake_nmi,128)   /* clocked by V1? (Vigilante) */
24802271                        /* IRQs are generated by main Z80 and YM2151 */
24812272   MDRV_SCREEN_REFRESH_RATE(55)
r869r870
25102301
25112302   /* basic machine hardware */
25122303   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz external freq (8MHz internal) */
2513   MDRV_CPU_PROGRAM_MAP(kengo_readmem,kengo_writemem)
2514   MDRV_CPU_IO_MAP(readport,kengo_writeport)
2304   MDRV_CPU_PROGRAM_MAP(kengo_map,0)
2305   MDRV_CPU_IO_MAP(kengo_portmap,0)
25152306   MDRV_CPU_VBLANK_INT(m72_interrupt,256)
25162307
25172308   MDRV_CPU_ADD(Z80, 3579545)
2518   /* audio CPU */   /* 3.579545 MHz */
25192309   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
2520   MDRV_CPU_IO_MAP(rtype2_sound_readport,rtype2_sound_writeport)
2310   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
25212311   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
25222312                        /* IRQs are generated by main Z80 and YM2151 */
25232313   MDRV_SCREEN_REFRESH_RATE(55)
src/mame/drivers/madalien.c
r869r870
665665   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 16)
666666
667667   MDRV_SCREEN_REFRESH_RATE(60)
668   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072))
668   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072))
669669
670670   /* video hardware */
671671   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/igs_180.c
r869r870
105105   ROM_LOAD( "v.u18", 0x00000, 0x40000, CRC(2e2b7d43) SHA1(cc73f4c8f9a6e2219ee04c9910725558a80b4eb2) )
106106
107107   ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* Samples */
108   ROM_LOAD( "speech.u17", 0x00000, 0x40000, CRC(d9e3d39f) SHA1(bec85d1ac2dfca77453cbca0e7dd53fee8fb438b))
108   ROM_LOAD( "speech.u17", 0x00000, 0x40000, CRC(d9e3d39f) SHA1(bec85d1ac2dfca77453cbca0e7dd53fee8fb438b) )
109109
110110   ROM_REGION( 0x80000, REGION_GFX1, 0 )
111   ROM_LOAD( "cg.u7", 0x000000, 0x080000, CRC(cb48a66e) SHA1(6d597193d1333a97957d5ceec8179a24bedfd928) )
111   ROM_LOAD( "cg.u7",   0x000000, 0x080000, CRC(cb48a66e) SHA1(6d597193d1333a97957d5ceec8179a24bedfd928) )
112112   ROM_LOAD( "text.u8", 0x000000, 0x080000, CRC(48c4f4e6) SHA1(b1e1ca62cf6a99c11a5cc56705eef7e22a3b2740) )
113113ROM_END
114114
115ROM_START( iqblockf )
116   ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* DIP28 Code */
117   ROM_LOAD( "v113fr.u18", 0x00000, 0x40000, CRC(346c68af) SHA1(ceae4c0143c288dc9c1dd1e8a51f1e3371ffa439) )
118
119   ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* Samples */
120   ROM_LOAD( "sp.u17", 0x00000, 0x40000, CRC(71357845) SHA1(25f4f7aebdcc0706018f041d3696322df569b0a3) )
121
122   ROM_REGION( 0x80000, REGION_GFX1, 0 )
123   ROM_LOAD( "cg.u7",   0x000000, 0x080000, CRC(cb48a66e) SHA1(6d597193d1333a97957d5ceec8179a24bedfd928) )
124   ROM_LOAD( "text.u8", 0x000000, 0x080000, CRC(48c4f4e6) SHA1(b1e1ca62cf6a99c11a5cc56705eef7e22a3b2740) )
125ROM_END
126
115127/*
116128
117129Mahjong Tian Jiang Shen Bing
r869r870
174186
175187
176188 GAME( 1996, iqblocka, iqblock, igs_180, igs_180, 0, ROT0, "IGS", "IQ-Block (set 2)", GAME_NOT_WORKING )
189 GAME( 1996, iqblockf, iqblock, igs_180, igs_180, 0, ROT0, "IGS", "IQ-Block (set 3, French?)", GAME_NOT_WORKING )
177190 GAME( 1997, tjsb,     0,       igs_180, igs_180, 0, ROT0, "IGS", "Mahjong Tian Jiang Shen Bing", GAME_NOT_WORKING )
src/mame/drivers/konamigv.c
r869r870
346346   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
347347
348348   MDRV_SCREEN_REFRESH_RATE( 60 )
349   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
349   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS( 0 ))
350350
351351   MDRV_MACHINE_RESET( konamigv )
352352   MDRV_NVRAM_HANDLER(konamigv_93C46)
src/mame/drivers/topspeed.c
r869r870
189189
190190Maybe the second area for each layer contains colscroll ?
191191
192
193Stephh's notes (based on the game M68000 code and some tests) :
194
1951) 'topspeed' and 'topspedu'
196
197  - All adresses are for 2nd M68000 CPU !
198  - Region stored at 0x01fffe.w
199  - Sets :
200      * 'topspeed' : region = 0x0003
201      * 'topspedu' : region = 0x0004
202  - Coinage relies on the region (code at 0x00dd10) :
203      * 0x0001 (Japan), 0x0002 (US) and 0x0004 (US, Romstar licence) use TAITO_COINAGE_JAPAN_OLD
204      * 0x0003 (US) use TAITO_COINAGE_WORLD
205  - Notice screen only if region = 0x0001
206  - Game name : "Top Speed"
207  - It's only possible to continue a game when you reach at least level 2
208  - The "Continue Price" Dip Switch is a bit weird when set to 1C_1C :
209      * coin 1 : 1C_1C (normal behaviour)
210      * coin 2 : same number of credits as per Coin B settings, but twice coins
211        for example, when Coin B setting is 1C_2C, when pressing COIN2,
212        you'll get 2 credits, but you'll be able to continue 4 times
213        before needing to insert another coin
214  - There is sort of built-in cheat (code at 0x015332) :
215      * set "Allow Continue" Dip Switch to "No"
216      * set "Continue Price" Dip Switch to 1C_1C
217      * set contents of 0x000402.b to 0x55 (be aware that this adress is in ROM area)
218      * you'll then be awarded infinite time :)
219
220
2212) 'fullthrl'
222
223  - All adresses are for 2nd M68000 CPU !
224  - Region stored at 0x01fffe.w
225  - Sets :
226      * 'fullthrl' : region = 0x0001
227  - Game name : "Full Throttle"
228  - Same other notes as for 'topspeed'
229
192230***************************************************************************/
193231
194232#include "driver.h"
233#include "taitoipt.h"
195234#include "cpu/m68000/m68000.h"
196235#include "video/taitoic.h"
197236#include "audio/taitosnd.h"
r869r870
285324                       GAME INPUTS
286325**********************************************************/
287326
327#define STEER_PORT_TAG   "STEER"
328#define FAKE_PORT_TAG    "FAKE"
329
288330static READ16_HANDLER( topspeed_input_bypass_r )
289331{
290332   UINT8 port = TC0220IOC_port_r(0);   /* read port number */
291333   int steer = 0;
292   int analogue_steer = input_port_5_word_r(0,0);
293   int fake = input_port_6_word_r(0,0);
334   int analogue_steer = readinputportbytag_safe(STEER_PORT_TAG,0x00);
335   int fake = readinputportbytag_safe(FAKE_PORT_TAG,0x00);
294336
295   if (!(fake &0x10))   /* Analogue steer (the real control method) */
337   if (!(fake & 0x10))   /* Analogue steer (the real control method) */
296338   {
297339      steer = analogue_steer;
298340
299341   }
300342   else   /* Digital steer */
301343   {
302      if (fake & 0x8)   /* pressing down */
344      if (fake & 0x08)   /* pressing down */
303345         steer = 0xff40;
304346
305      if (fake & 0x2)   /* pressing right */
347      if (fake & 0x02)   /* pressing right */
306348         steer = 0x007f;
307349
308      if (fake & 0x1)   /* pressing left */
350      if (fake & 0x01)   /* pressing left */
309351         steer = 0xff80;
310352
311353      /* To allow hiscore input we must let you return to
312354           continuous input type while you press up */
313355
314      if (fake & 0x4)   /* pressing up */
356      if (fake & 0x04)   /* pressing up */
315357         steer = analogue_steer;
316358   }
317359
318360   switch (port)
319361   {
320362      case 0x0c:
321         return steer &0xff;
363         return steer & 0xff;
322364
323365      case 0x0d:
324366         return steer >> 8;
r869r870
440482   AM_RANGE(0xb40000, 0xb40003) AM_WRITE(PC080SN_xscroll_word_1_w)
441483   AM_RANGE(0xb50000, 0xb50003) AM_WRITE(PC080SN_ctrl_word_1_w)
442484   AM_RANGE(0xd00000, 0xd00fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
485
443486   AM_RANGE(0xe00000, 0xe0ffff) AM_WRITE(MWA16_RAM) AM_BASE(&topspeed_spritemap)
444487ADDRESS_MAP_END
445488
r869r870
492535                    INPUT PORTS, DIPs
493536***********************************************************/
494537
495#define TAITO_COINAGE_WORLD_8 \
496   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
497   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
498   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
499   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
500   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
501   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
502   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
503   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
504   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
505   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
506
507#define TAITO_COINAGE_JAPAN_8 \
508   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
509   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
510   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
511   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
512   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
513   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
514   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
515   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
516   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
517   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
518
519#define TAITO_COINAGE_US_8 \
520   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) ) \
521   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
522   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
523   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
524   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
525   PORT_DIPNAME( 0xc0, 0xc0, "Price to Continue" ) \
526   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
527   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
528   PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) ) \
529   PORT_DIPSETTING(    0xc0, "Same as Start" )
530
531#define TAITO_DIFFICULTY_8 \
532   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
533   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
534   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
535   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
536   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
537
538538INPUT_PORTS_START( topspeed )
539   PORT_START /* DSW A */
539   /* 0x880000 (port 0) -> 0x400852 (-$77ae,A5) (shared RAM) */
540   PORT_START_TAG("DSWA")
540541   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Cabinet ) )
541542   PORT_DIPSETTING(    0x03, "Deluxe Motorized Cockpit" )
542543   PORT_DIPSETTING(    0x02, "Upright (?)" )
543544   PORT_DIPSETTING(    0x01, "Upright (alt?)" )
544545   PORT_DIPSETTING(    0x00, "Standard Cockpit" )
545   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
546   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
547   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
548   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
549   TAITO_COINAGE_WORLD_8
546   TAITO_DSWA_BITS_2_TO_3
547   TAITO_COINAGE_WORLD
550548
551   PORT_START /* DSW B */
552   TAITO_DIFFICULTY_8
549   /* 0x880000 (port 1) -> 0x400850 (-$77b0,A5) (shared RAM) */
550   PORT_START_TAG("DSWB")
551   TAITO_DIFFICULTY
553552   PORT_DIPNAME( 0x0c, 0x0c, "Initial Time" )
554553   PORT_DIPSETTING(    0x00, "40 seconds" )
555554   PORT_DIPSETTING(    0x04, "50 seconds" )
r869r870
563562   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
564563   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
565564   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
566   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
567   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
568   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
565    PORT_DIPNAME( 0x80, 0x80, DEF_STR( Continue_Price ) )        /* see notes */
566    PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
567    PORT_DIPSETTING(    0x80, "Same as Start" )
569568
570   PORT_START      /* IN0 */
569   PORT_START_TAG("IN0")
571570   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
572571   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
573572   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
574573   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
575574   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE1 )
576575   /* Next bit is brake key (active low) for non-cockpit */
577   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)   /* 3 for brake [7 levels] */
576   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)                     /* 3 for brake [7 levels] */
578577   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1)
579   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* main brake key */
578   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)                     /* main brake key */
580579
581   PORT_START      /* IN1 */
582   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* nitro */
580   PORT_START_TAG("IN1")
581   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)                     /* nitro */
583582   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
584583   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
585584   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
586   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)   /* gear shift lo/hi */
585   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)                     /* gear shift lo/hi */
587586   /* Next bit is accel key (active low/high, depends on cab DSW) for non-cockpit */
588   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)   /* 3 for accel [7 levels] */
587   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)                     /* 3 for accel [7 levels] */
589588   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1)
590   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* main accel key */
589   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)                     /* main accel key */
591590
592   PORT_START      /* IN2, unused */
591   PORT_START_TAG("IN2")   /* unused */
593592
594   /* Note that sensitivity is chosen to suit keyboard control (for
595       sound selection in test mode and hi score name entry). With
596       an analogue wheel, the user will need to adjust this. */
593   /* Note that sensitivity is chosen to suit keyboard control
594       (for sound selection in test mode and hi score name entry).
595       With an analogue wheel, the user will need to adjust this. */
597596
598   PORT_START   /* continuous steer */
597   /* continuous steer */
598   PORT_START_TAG(STEER_PORT_TAG)
599599   PORT_BIT( 0xffff, 0x00, IPT_AD_STICK_X ) PORT_MINMAX(0xff7f,0x80) PORT_SENSITIVITY(10) PORT_KEYDELTA(2) PORT_PLAYER(1)
600600
601   PORT_START      /* fake, allowing digital steer */
602   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
603   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
604   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
605   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
606   PORT_DIPNAME( 0x10, 0x10, "Steering type" )
607   PORT_DIPSETTING(    0x10, "Digital" )
608   PORT_DIPSETTING(    0x00, "Analogue" )
601   /* fake inputs, allowing digital steer etc. */
602   PORT_START_TAG(FAKE_PORT_TAG)
603   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )  PORT_4WAY PORT_PLAYER(1)
604   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
605   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_4WAY PORT_PLAYER(1)
606   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )  PORT_4WAY PORT_PLAYER(1)
607   PORT_CONFNAME( 0x10, 0x10, "Steering type" )
608   PORT_CONFSETTING(    0x10, "Digital" )
609   PORT_CONFSETTING(    0x00, "Analogue" )
609610INPUT_PORTS_END
610611
611INPUT_PORTS_START( topspedu )
612   PORT_START /* DSW A */
613   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Cabinet ) )
614   PORT_DIPSETTING(    0x03, "Deluxe Motorized Cockpit" )
615   PORT_DIPSETTING(    0x02, "Upright (?)" )
616   PORT_DIPSETTING(    0x01, "Upright (alt?)" )
617   PORT_DIPSETTING(    0x00, "Standard Cockpit" )
618   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
619   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
620   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
621   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
622   TAITO_COINAGE_WORLD_8
623
624   PORT_START /* DSW B */
625   TAITO_DIFFICULTY_8
626   PORT_DIPNAME( 0x0c, 0x0c, "Initial Time" )
627   PORT_DIPSETTING(    0x00, "40 seconds" )
628   PORT_DIPSETTING(    0x04, "50 seconds" )
629   PORT_DIPSETTING(    0x0c, "60 seconds" )
630   PORT_DIPSETTING(    0x08, "70 seconds" )
631   PORT_DIPNAME( 0x30, 0x30, "Nitros" )
632   PORT_DIPSETTING(    0x20, "2" )
633   PORT_DIPSETTING(    0x30, "3" )
634   PORT_DIPSETTING(    0x10, "4" )
635   PORT_DIPSETTING(    0x00, "5" )
636   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
637   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
638   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
639   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
640   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
641   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
642
643   PORT_START      /* IN0 */
644   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
645   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
646   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
647   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
648   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE1 )
649   /* Next bit is brake key (active low) for non-cockpit */
650   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)   /* 3 for brake [7 levels] */
651   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1)
652   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* main brake key */
653
654   PORT_START      /* IN1 */
655   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* nitro */
656   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
657   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
658   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
659   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)   /* gear shift lo/hi */
660   /* Next bit is accel key (active low/high, depends on cab DSW) for non-cockpit */
661   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)   /* 3 for accel [7 levels] */
662   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1)
663   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* main accel key */
664
665   PORT_START      /* IN2, unused */
666
667   /* Note that sensitivity is chosen to suit keyboard control (for
668       sound selection in test mode and hi score name entry). With
669       an analogue wheel, the user will need to adjust this. */
670
671   PORT_START   /* continuous steer */
672   PORT_BIT( 0xffff, 0x00, IPT_AD_STICK_X ) PORT_MINMAX(0xff7f,0x80) PORT_SENSITIVITY(10) PORT_KEYDELTA(2) PORT_PLAYER(1)
673
674   PORT_START      /* fake, allowing digital steer */
675   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
676   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
677   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
678   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
679   PORT_DIPNAME( 0x10, 0x10, "Steering type" )
680   PORT_DIPSETTING(    0x10, "Digital" )
681   PORT_DIPSETTING(    0x00, "Analogue" )
682INPUT_PORTS_END
683
684612INPUT_PORTS_START( fullthrl )
685   PORT_START /* DSW A */
686   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Cabinet ) )
687   PORT_DIPSETTING(    0x03, "Deluxe Motorized Cockpit" )
688   PORT_DIPSETTING(    0x02, "Upright (?)" )
689   PORT_DIPSETTING(    0x01, "Upright (alt?)" )
690   PORT_DIPSETTING(    0x00, "Standard Cockpit" )
691   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
692   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
693   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
694   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
695   TAITO_COINAGE_WORLD_8
613   PORT_INCLUDE(topspeed)
696614
697   PORT_START /* DSW B */
698   TAITO_DIFFICULTY_8
699   PORT_DIPNAME( 0x0c, 0x0c, "Initial Time" )
700   PORT_DIPSETTING(    0x00, "40 seconds" )
701   PORT_DIPSETTING(    0x04, "50 seconds" )
702   PORT_DIPSETTING(    0x0c, "60 seconds" )
703   PORT_DIPSETTING(    0x08, "70 seconds" )
704   PORT_DIPNAME( 0x30, 0x30, "Nitros" )
705   PORT_DIPSETTING(    0x20, "2" )
706   PORT_DIPSETTING(    0x30, "3" )
707   PORT_DIPSETTING(    0x10, "4" )
708   PORT_DIPSETTING(    0x00, "5" )
709   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
710   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
711   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
712   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
713   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
714   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
715
716   PORT_START      /* IN0 */
717   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
718   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
719   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
720   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
721   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE1 )
722   /* Next bit is brake key (active low) for non-cockpit */
723   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)   /* 3 for brake [7 levels] */
724   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1)
725   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* main brake key */
726
727   PORT_START      /* IN1 */
728   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* nitro */
729   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
730   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
731   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
732   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)   /* gear shift lo/hi */
733   /* Next bit is accel key (active low/high, depends on cab DSW) for non-cockpit */
734   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)   /* 3 for accel [7 levels] */
735   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1)
736   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* main accel key */
737
738   PORT_START      /* IN2, unused */
739
740   /* Note that sensitivity is chosen to suit keyboard control (for
741       sound selection in test mode and hi score name entry). With
742       an analogue wheel, the user will need to adjust this. */
743
744   PORT_START   /* continuous steer */
745   PORT_BIT( 0xffff, 0x00, IPT_AD_STICK_X ) PORT_MINMAX(0xff7f,0x80) PORT_SENSITIVITY(10) PORT_KEYDELTA(2) PORT_PLAYER(1)
746
747   PORT_START      /* fake, allowing digital steer */
748   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
749   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
750   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
751   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
752   PORT_DIPNAME( 0x10, 0x10, "Steering type" )
753   PORT_DIPSETTING(    0x10, "Digital" )
754   PORT_DIPSETTING(    0x00, "Analogue" )
615   PORT_MODIFY("DSWA")
616   TAITO_COINAGE_JAPAN_OLD
755617INPUT_PORTS_END
756618
757619
r869r870
1014876}
1015877
1016878GAME( 1987, topspeed, 0,        topspeed, topspeed, topspeed, ROT0, "Taito Corporation Japan", "Top Speed (World)", 0 )
1017GAME( 1987, topspedu, topspeed, topspeed, topspedu, topspeed, ROT0, "Taito America Corporation (Romstar license)", "Top Speed (US)", 0 )
879GAME( 1987, topspedu, topspeed, topspeed, fullthrl, topspeed, ROT0, "Taito America Corporation (Romstar license)", "Top Speed (US)", 0 )
1018880GAME( 1987, fullthrl, topspeed, topspeed, fullthrl, topspeed, ROT0, "Taito Corporation", "Full Throttle (Japan)", 0 )
1019881
src/mame/drivers/segae.c
r869r870
16531653   /* IRQ handled via the timers */
16541654
16551655   MDRV_SCREEN_REFRESH_RATE(60)
1656   MDRV_SCREEN_VBLANK_TIME(0) // Vblank handled manually.
1656   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) // Vblank handled manually.
16571657   MDRV_MACHINE_RESET(systeme)
16581658
16591659   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/fantland.c
r869r870
6060      logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", activecpu_get_pc(), data);
6161}
6262
63static WRITE16_HANDLER( fantland_nmi_enable_16_w )
64{
65   if (ACCESSING_LSB)
66      fantland_nmi_enable_w(offset*2,data);
67}
68
6369static WRITE8_HANDLER( fantland_soundlatch_w )
6470{
6571   soundlatch_w(0,data);
6672   cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE);
6773}
6874
75static WRITE16_HANDLER( fantland_soundlatch_16_w )
76{
77   if (ACCESSING_LSB)
78      fantland_soundlatch_w(offset*2, data);
79}
80
6981/***************************************************************************
7082                                Fantasy Land
7183***************************************************************************/
7284
73static ADDRESS_MAP_START( fantland_readmem, ADDRESS_SPACE_PROGRAM, 8 )
74   AM_RANGE(0x00000, 0x07fff) AM_READ(MRA8_RAM         )
75   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM         )
76   AM_RANGE(0xa2000, 0xa21ff) AM_READ(MRA8_RAM         )   // not actually read
77   AM_RANGE(0xa3000, 0xa3000) AM_READ(input_port_0_r   )
78   AM_RANGE(0xa3001, 0xa3001) AM_READ(input_port_1_r   )
79   AM_RANGE(0xa3002, 0xa3002) AM_READ(input_port_2_r   )
80   AM_RANGE(0xa3003, 0xa3003) AM_READ(input_port_3_r   )
81   AM_RANGE(0xa4000, 0xa67ff) AM_READ(MRA8_RAM         )   // not actually read
82   AM_RANGE(0xc0000, 0xcffff) AM_READ(MRA8_RAM         )   // ""
83   AM_RANGE(0xe0000, 0xfffff) AM_READ(MRA8_ROM         )
85static READ16_HANDLER( spriteram_16_r )
86{
87   return spriteram[2*offset+0] | (spriteram[2*offset+1] << 8);
88}
89
90static READ16_HANDLER( spriteram2_16_r )
91{
92   return spriteram_2[2*offset+0] | (spriteram_2[2*offset+1] << 8);
93}
94
95static WRITE16_HANDLER( spriteram_16_w )
96{
97   if (ACCESSING_LSB)
98      spriteram[2*offset+0] = data;
99   if (ACCESSING_MSB)
100      spriteram[2*offset+1] = data >> 8;
101}
102
103static WRITE16_HANDLER( spriteram2_16_w )
104{
105   if (ACCESSING_LSB)
106      spriteram_2[2*offset+0] = data;
107   if (ACCESSING_MSB)
108      spriteram_2[2*offset+1] = data >> 8;
109}
110
111static ADDRESS_MAP_START( fantland_readmem, ADDRESS_SPACE_PROGRAM, 16 )
112   AM_RANGE(0xa4000, 0xa67ff) AM_READ(spriteram_16_r         )   // not actually read
113   AM_RANGE(0xc0000, 0xcffff) AM_READ(spriteram2_16_r         )   // ""
114   AM_RANGE(0xe0000, 0xfffff) AM_READ(MRA16_ROM         )
84115ADDRESS_MAP_END
85116
86static ADDRESS_MAP_START( fantland_writemem, ADDRESS_SPACE_PROGRAM, 8 )
87   AM_RANGE(0x00000, 0x07fff) AM_WRITE(MWA8_RAM               )
88   AM_RANGE(0xa2000, 0xa21ff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_BASE(&paletteram   )
89   AM_RANGE(0xa3000, 0xa3000) AM_WRITE(fantland_nmi_enable_w   )
90   AM_RANGE(0xa3002, 0xa3002) AM_WRITE(fantland_soundlatch_w   )
91   AM_RANGE(0xa4000, 0xa67ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram      )
92   AM_RANGE(0xc0000, 0xcffff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram_2   )
117static ADDRESS_MAP_START( fantland_writemem, ADDRESS_SPACE_PROGRAM, 16 )
118   AM_RANGE(0x00000, 0x07fff) AM_RAM
119   AM_RANGE(0x00000, 0x7ffff) AM_ROM
120   AM_RANGE(0xa2000, 0xa21ff) AM_READWRITE(MRA16_RAM, paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 )
121   AM_RANGE(0xa3000, 0xa3001) AM_READ(input_port_0_word_r   )
122   AM_RANGE(0xa3002, 0xa3003) AM_READ(input_port_1_word_r   )
123   AM_RANGE(0xa3000, 0xa3001) AM_WRITE(fantland_nmi_enable_16_w)
124   AM_RANGE(0xa3002, 0xa3003) AM_WRITE(fantland_soundlatch_16_w)
125   AM_RANGE(0xa4000, 0xa67ff) AM_WRITE(spriteram_16_w) AM_BASE((UINT16 **)&spriteram)
126   AM_RANGE(0xc0000, 0xcffff) AM_WRITE(spriteram2_16_w) AM_BASE((UINT16 **)&spriteram_2)
93127ADDRESS_MAP_END
94128
95129
r869r870
349383
350384INPUT_PORTS_START( fantland )
351385   PORT_START   /* IN0 - a3000 */
352   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1         )
353   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1         )
354   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      )
355   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   )
356   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   )
357   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   )
358   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1         )
359   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2         )
386   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1         )
387   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START1         )
388   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      )
389   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   )
390   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   )
391   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   )
392   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1         )
393   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2         )
360394
361   PORT_START   /* IN1 - a3001 */
362   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2         )
363   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2         )
364   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(2)   // used in test mode only
365   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(2)
366   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(2)
367   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_PLAYER(2)
368   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1         ) PORT_PLAYER(2)
369   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2         ) PORT_PLAYER(2)
395   /* IN1 - a3001 */
396   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2         )
397   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2         )
398   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(2)   // used in test mode only
399   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(2)
400   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(2)
401   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_PLAYER(2)
402   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1         ) PORT_PLAYER(2)
403   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON2         ) PORT_PLAYER(2)
370404
371405   PORT_START   /* IN2 - a3002 */
372   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
373   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
374   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
375   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
376   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
377   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
378   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
379   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
380   PORT_DIPSETTING(    0x00, "Invulnerability" )
381   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
382   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
383   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
384   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
385   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
386   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
387   PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
388   PORT_DIPSETTING(    0x60, DEF_STR( Normal ) )
389   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
390   PORT_DIPSETTING(    0x20, DEF_STR( Harder ) )
391   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
392   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
406   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
407   PORT_DIPSETTING(    0x0001, DEF_STR( 4C_1C ) )
408   PORT_DIPSETTING(    0x0002, DEF_STR( 3C_1C ) )
409   PORT_DIPSETTING(    0x0003, DEF_STR( 2C_1C ) )
410   PORT_DIPSETTING(    0x0007, DEF_STR( 1C_1C ) )
411   PORT_DIPSETTING(    0x0006, DEF_STR( 1C_2C ) )
412   PORT_DIPSETTING(    0x0005, DEF_STR( 1C_3C ) )
413   PORT_DIPSETTING(    0x0004, DEF_STR( 1C_4C ) )
414   PORT_DIPSETTING(    0x0000, "Invulnerability" )
415   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )
416   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
417   PORT_DIPSETTING(    0x0008, DEF_STR( On ) )
418   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Allow_Continue ) )
419   PORT_DIPSETTING(    0x0000, DEF_STR( No ) )
420   PORT_DIPSETTING(    0x0010, DEF_STR( Yes ) )
421   PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Difficulty ) )
422   PORT_DIPSETTING(    0x0060, DEF_STR( Normal ) )
423   PORT_DIPSETTING(    0x0040, DEF_STR( Hard ) )
424   PORT_DIPSETTING(    0x0020, DEF_STR( Harder ) )
425   PORT_DIPSETTING(    0x0000, DEF_STR( Hardest ) )
426   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
393427
394   PORT_START      /* IN3 - a3003 */
395   PORT_DIPNAME( 0x01, 0x01, "Test Sound" )
396   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
397   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
398   PORT_DIPNAME( 0x0e, 0x0c, DEF_STR( Lives ) )
399   PORT_DIPSETTING(    0x0e, "1" )
400   PORT_DIPSETTING(    0x0c, "2" )
401   PORT_DIPSETTING(    0x0a, "3" )
402   PORT_DIPSETTING(    0x08, "4" )
403   PORT_DIPSETTING(    0x06, "5" )
404   PORT_DIPSETTING(    0x04, "6" )
405   PORT_DIPSETTING(    0x02, "7" )
406   PORT_DIPSETTING(    0x00, "8" )
407   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
408   PORT_DIPSETTING(    0x30, "800k" )
409   PORT_DIPSETTING(    0x20, "1600k" )
410   PORT_DIPSETTING(    0x10, "2400k" )
411   PORT_DIPSETTING(    0x00, "3200k" )
412   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )   //unused?
413   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
414   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
415   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )   //unused?
416   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
417   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
428   /* IN3 - a3003 */
429   PORT_DIPNAME( 0x0100, 0x0100, "Test Sound" )
430   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
431   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
432   PORT_DIPNAME( 0x0e00, 0x0c00, DEF_STR( Lives ) )
433   PORT_DIPSETTING(    0x0e00, "1" )
434   PORT_DIPSETTING(    0x0c00, "2" )
435   PORT_DIPSETTING(    0x0a00, "3" )
436   PORT_DIPSETTING(    0x0800, "4" )
437   PORT_DIPSETTING(    0x0600, "5" )
438   PORT_DIPSETTING(    0x0400, "6" )
439   PORT_DIPSETTING(    0x0200, "7" )
440   PORT_DIPSETTING(    0x0000, "8" )
441   PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Bonus_Life ) )
442   PORT_DIPSETTING(    0x3000, "800k" )
443   PORT_DIPSETTING(    0x2000, "1600k" )
444   PORT_DIPSETTING(    0x1000, "2400k" )
445   PORT_DIPSETTING(    0x0000, "3200k" )
446   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )   //unused?
447   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
448   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
449   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )   //unused?
450   PORT_DIPSETTING(    0x8000, DEF_STR( Off ) )
451   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
418452INPUT_PORTS_END
419453
420454/***************************************************************************
r869r870
678712
679713static MACHINE_DRIVER_START( fantland )
680714   /* basic machine hardware */
681   MDRV_CPU_ADD(I86, 8000000)        // ?
715   MDRV_CPU_ADD(I8086, 8000000)        // ?
682716   MDRV_CPU_PROGRAM_MAP(fantland_readmem, fantland_writemem)
683717   MDRV_CPU_VBLANK_INT(fantland_irq,1)
684718
685719   /* audio CPU */
686   MDRV_CPU_ADD(I86, 8000000)        // ?
720   MDRV_CPU_ADD(I8088, 8000000)        // ?
687721   MDRV_CPU_PROGRAM_MAP(fantland_sound_readmem, fantland_sound_writemem)
688722   MDRV_CPU_IO_MAP(fantland_sound_readport,fantland_sound_writeport)
689723   MDRV_CPU_PERIODIC_INT(fantland_sound_irq, 8000)
r869r870
730764
731765static MACHINE_DRIVER_START( galaxygn )
732766   /* basic machine hardware */
733   MDRV_CPU_ADD(I86, 8000000)        // ?
767   MDRV_CPU_ADD(I8088, 8000000)        // ?
734768   MDRV_CPU_PROGRAM_MAP(galaxygn_readmem, galaxygn_writemem)
735769   MDRV_CPU_VBLANK_INT(fantland_irq,1)
736770
737771   /* audio CPU */
738   MDRV_CPU_ADD(I86, 8000000)        // ?
772   MDRV_CPU_ADD(I8088, 8000000)        // ?
739773   MDRV_CPU_PROGRAM_MAP(fantland_sound_readmem, fantland_sound_writemem)
740774   MDRV_CPU_IO_MAP(fantland_sound_readport,fantland_sound_writeport)
741775   // IRQ by YM2151, NMI when soundlatch is written
r869r870
789823   MDRV_CPU_VBLANK_INT(fantland_irq,1)
790824
791825   /* audio CPU */
792   MDRV_CPU_ADD(I88, 18432000/3)        // 8088 - AMD P8088-2 CPU, running at 6.144MHz [18.432/3]
826   MDRV_CPU_ADD(I8088, 18432000/3)        // 8088 - AMD P8088-2 CPU, running at 6.144MHz [18.432/3]
793827   MDRV_CPU_PROGRAM_MAP(borntofi_sound_readmem, borntofi_sound_writemem)
794828
795829   MDRV_SCREEN_REFRESH_RATE(54)   // 54 Hz
r869r870
847881
848882ROM_START( fantland )
849883   ROM_REGION( 0x100000, REGION_CPU1, 0 )               // Main CPU
850   ROMX_LOAD( "fantasyl.ev2", 0x00000, 0x20000, CRC(f5bdca0e) SHA1(d05cf6f68d4d1a3dcc0171f7cf220c4920bd47bb) , ROM_SKIP(1) )
851   ROMX_LOAD( "fantasyl.od2", 0x00001, 0x20000, CRC(9db35023) SHA1(81e2accd67dcf8563a68b2c4e35526f23a40150c) , ROM_SKIP(1) )
884   ROM_LOAD16_BYTE( "fantasyl.ev2", 0x00000, 0x20000, CRC(f5bdca0e) SHA1(d05cf6f68d4d1a3dcc0171f7cf220c4920bd47bb) )
885   ROM_LOAD16_BYTE( "fantasyl.od2", 0x00001, 0x20000, CRC(9db35023) SHA1(81e2accd67dcf8563a68b2c4e35526f23a40150c) )
852886   ROM_COPY( REGION_CPU1,     0x00000, 0x40000, 0x40000 )
853   ROMX_LOAD( "fantasyl.ev1", 0xe0000, 0x10000, CRC(70e0ee30) SHA1(5253213da56b3f97e2811f2b10927d0e542447f0) , ROM_SKIP(1) )
854   ROMX_LOAD( "fantasyl.od1", 0xe0001, 0x10000, CRC(577b4bd7) SHA1(1f08202d99c3e39e0dd1ed4947b928b695a5b411) , ROM_SKIP(1) )
887   ROM_LOAD16_BYTE( "fantasyl.ev1", 0xe0000, 0x10000, CRC(70e0ee30) SHA1(5253213da56b3f97e2811f2b10927d0e542447f0) )
888   ROM_LOAD16_BYTE( "fantasyl.od1", 0xe0001, 0x10000, CRC(577b4bd7) SHA1(1f08202d99c3e39e0dd1ed4947b928b695a5b411) )
855889
856890   ROM_REGION( 0x100000, REGION_CPU2, 0 )               // Sound CPU
857   ROM_LOAD16_WORD( "fantasyl.s2", 0x80000, 0x20000, CRC(f23837d8) SHA1(4048784f759781e50ae445ea61f1ca908e8e6ac1) )   // samples (8 bit unsigned)
858   ROM_LOAD16_WORD( "fantasyl.s1", 0xc0000, 0x20000, CRC(1a324a69) SHA1(06f6877af6cd19bfaac8a4ea8057ef8faee276f5) )
891   ROM_LOAD( "fantasyl.s2", 0x80000, 0x20000, CRC(f23837d8) SHA1(4048784f759781e50ae445ea61f1ca908e8e6ac1) )   // samples (8 bit unsigned)
892   ROM_LOAD( "fantasyl.s1", 0xc0000, 0x20000, CRC(1a324a69) SHA1(06f6877af6cd19bfaac8a4ea8057ef8faee276f5) )
859893   ROM_COPY( REGION_CPU2,          0xc0000, 0xe0000, 0x20000 )
860894
861895   ROM_REGION( 0x480000, REGION_GFX1, ROMREGION_DISPOSE )   // Sprites
r869r870
876910/* this dump had several roms half size however they all appear to be data & gfx roms, the main program looks ok */
877911ROM_START( fantlnda )
878912   ROM_REGION( 0x100000, REGION_CPU1, 0 )               // Main CPU
879   ROMX_LOAD( "fantasyl.ev2", 0x00000, 0x20000, CRC(f5bdca0e) SHA1(d05cf6f68d4d1a3dcc0171f7cf220c4920bd47bb) , ROM_SKIP(1) ) // 04.bin (was first half only)
880   ROMX_LOAD( "fantasyl.od2", 0x00001, 0x20000, CRC(9db35023) SHA1(81e2accd67dcf8563a68b2c4e35526f23a40150c) , ROM_SKIP(1) ) // 03.bin (was first half only)
913   ROM_LOAD16_BYTE( "fantasyl.ev2", 0x00000, 0x20000, CRC(f5bdca0e) SHA1(d05cf6f68d4d1a3dcc0171f7cf220c4920bd47bb) ) // 04.bin (was first half only)
914   ROM_LOAD16_BYTE( "fantasyl.od2", 0x00001, 0x20000, CRC(9db35023) SHA1(81e2accd67dcf8563a68b2c4e35526f23a40150c) ) // 03.bin (was first half only)
881915   ROM_COPY( REGION_CPU1,     0x00000, 0x40000, 0x40000 )
882   ROMX_LOAD( "02.bin",       0xe0000, 0x10000, CRC(8b835eed) SHA1(6a6b3fe116145f685b91dcd5301165f17973697c) , ROM_SKIP(1) )
883   ROMX_LOAD( "01.bin",       0xe0001, 0x10000, CRC(4fa3eb8b) SHA1(56da42a4e2972a696ef28811116cbc20bb5ba3e8) , ROM_SKIP(1) )
916   ROM_LOAD16_BYTE( "02.bin",       0xe0000, 0x10000, CRC(8b835eed) SHA1(6a6b3fe116145f685b91dcd5301165f17973697c) )
917   ROM_LOAD16_BYTE( "01.bin",       0xe0001, 0x10000, CRC(4fa3eb8b) SHA1(56da42a4e2972a696ef28811116cbc20bb5ba3e8) )
884918
885919   ROM_REGION( 0x100000, REGION_CPU2, 0 )               // Sound CPU
886   ROM_LOAD16_WORD( "fantasyl.s2", 0x80000, 0x20000, CRC(f23837d8) SHA1(4048784f759781e50ae445ea61f1ca908e8e6ac1) ) // 05.bin (was first half only)
887   ROM_LOAD16_WORD( "fantasyl.s1", 0xc0000, 0x20000, CRC(1a324a69) SHA1(06f6877af6cd19bfaac8a4ea8057ef8faee276f5) ) // 06.bin (was first half only)
920   ROM_LOAD( "fantasyl.s2", 0x80000, 0x20000, CRC(f23837d8) SHA1(4048784f759781e50ae445ea61f1ca908e8e6ac1) ) // 05.bin (was first half only)
921   ROM_LOAD( "fantasyl.s1", 0xc0000, 0x20000, CRC(1a324a69) SHA1(06f6877af6cd19bfaac8a4ea8057ef8faee276f5) ) // 06.bin (was first half only)
888922   ROM_COPY( REGION_CPU2,          0xc0000, 0xe0000, 0x20000 )
889923
890924   ROM_REGION( 0x480000, REGION_GFX1, ROMREGION_DISPOSE )   // Sprites
src/mame/drivers/ksys573.c
r869r870
27232723   MDRV_CPU_VBLANK_INT( sys573_vblank, 1 )
27242724
27252725   MDRV_SCREEN_REFRESH_RATE( 60 )
2726   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
2726   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS( 0 ))
27272727
27282728   MDRV_MACHINE_RESET( konami573 )
27292729   MDRV_NVRAM_HANDLER( konami573 )
src/mame/drivers/mcr68.c
r869r870
887887   MDRV_CPU_VBLANK_INT(mcr68_interrupt,1)
888888
889889   MDRV_SCREEN_REFRESH_RATE(30)
890   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_30HZ_VBLANK_DURATION))
890   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_30HZ_VBLANK_DURATION)
891891//  MDRV_WATCHDOG_VBLANK_INIT(8)
892892   MDRV_MACHINE_START(zwackery)
893893   MDRV_MACHINE_RESET(zwackery)
r869r870
916916   MDRV_CPU_VBLANK_INT(mcr68_interrupt,1)
917917
918918   MDRV_SCREEN_REFRESH_RATE(30)
919   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_30HZ_VBLANK_DURATION))
919   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_30HZ_VBLANK_DURATION)
920920   MDRV_WATCHDOG_VBLANK_INIT(8)
921921   MDRV_MACHINE_START(mcr68)
922922   MDRV_MACHINE_RESET(mcr68)
src/mame/drivers/jackpool.c
r869r870
114114   AM_RANGE(0x380000, 0x38005f) AM_WRITE(MWA16_RAM)
115115ADDRESS_MAP_END
116116
117#if 0
117118static ADDRESS_MAP_START( roulette_map, ADDRESS_SPACE_PROGRAM, 16 )
118119   AM_RANGE(0x000000, 0x03ffff) AM_ROM
119120ADDRESS_MAP_END
121#endif
120122
121123
122124
src/mame/drivers/atarifb.c
r869r870
534534   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
535535
536536   MDRV_SCREEN_REFRESH_RATE(60)
537   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2037)   /* 16.3ms * 1/8 = 2037.5. Is it 1/8th or 3/32nds? (1528?) */)
537   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2037)   /* 16.3ms * 1/8 = 2037.5. Is it 1/8th or 3/32nds? (1528?) */)
538538
539539   /* video hardware */
540540   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/taitowlf.c
r869r870
422422   MDRV_CPU_IO_MAP(taitowlf_io, 0)
423423
424424   MDRV_SCREEN_REFRESH_RATE(60)
425   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
425   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
426426
427427   MDRV_MACHINE_RESET(taitowlf)
428428
src/mame/drivers/tumbleb.c
r869r870
20382038   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
20392039
20402040   MDRV_SCREEN_REFRESH_RATE(58)
2041   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
2041   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
20422042
20432043   /* video hardware */
20442044   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
20682068   MDRV_CPU_VBLANK_INT(tumbleb2_interrupt,1)
20692069
20702070   MDRV_SCREEN_REFRESH_RATE(58)
2071   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
2071   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
20722072
20732073   /* video hardware */
20742074   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
21012101   MDRV_CPU_PROGRAM_MAP(jumpkids_sound_map,0)
21022102
21032103   MDRV_SCREEN_REFRESH_RATE(60)
2104   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
2104   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
21052105
21062106   /* video hardware */
21072107   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
21292129   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
21302130
21312131   MDRV_SCREEN_REFRESH_RATE(60)
2132   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
2132   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
21332133
21342134   /* video hardware */
21352135   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
21922192   MDRV_CPU_PROGRAM_MAP(semicom_sound_readmem,semicom_sound_writemem)
21932193
21942194   MDRV_SCREEN_REFRESH_RATE(60)
2195   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2400)) // ?? cookbib needs it above ~2400 or the Joystick on the How to Play screen is the wrong colour?!
2195   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2400)) // ?? cookbib needs it above ~2400 or the Joystick on the How to Play screen is the wrong colour?!
21962196
21972197   MDRV_MACHINE_RESET ( htchctch )
21982198
r869r870
22702270   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1953)   /* measured */
22712271
22722272   MDRV_SCREEN_REFRESH_RATE(60)
2273   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
2273   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
22742274
22752275   /* video hardware */
22762276   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
23072307   MDRV_CPU_PROGRAM_MAP(semicom_sound_readmem,semicom_sound_writemem)
23082308
23092309   MDRV_SCREEN_REFRESH_RATE(60)
2310   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
2310   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
23112311
23122312   /* video hardware */
23132313   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
23372337   MDRV_CPU_VBLANK_INT(tumbleb2_interrupt,1)
23382338
23392339   MDRV_SCREEN_REFRESH_RATE(58)
2340   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1529))
2340   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1529))
23412341
23422342   /* video hardware */
23432343   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/m90.c
r869r870
3838
3939static UINT32 bankaddress;
4040
41extern UINT8 *m90_video_data;
41extern UINT16 *m90_video_data;
4242
4343extern int m90_game_kludge;
4444
4545VIDEO_UPDATE( m90 );
4646VIDEO_UPDATE( m90_bootleg );
47WRITE8_HANDLER( m90_video_control_w );
48WRITE8_HANDLER( m90_video_w );
47WRITE16_HANDLER( m90_video_control_w );
48WRITE16_HANDLER( m90_video_w );
4949VIDEO_START( m90 );
5050
5151/***************************************************************************/
r869r870
6262
6363/***************************************************************************/
6464
65static WRITE8_HANDLER( m90_coincounter_w )
65static WRITE16_HANDLER( m90_coincounter_w )
6666{
67   if (offset==0)
67   if (ACCESSING_LSB)
6868   {
6969      coin_counter_w(0,data & 0x01);
7070      coin_counter_w(1,data & 0x02);
r869r870
7373   }
7474}
7575
76static WRITE8_HANDLER( quizf1_bankswitch_w )
76static WRITE16_HANDLER( quizf1_bankswitch_w )
7777{
78   if (offset == 0)
78   if (ACCESSING_LSB)
7979   {
8080      bankaddress = 0x10000 * (data & 0x0f);
8181      set_m90_bank();
r869r870
8484
8585/***************************************************************************/
8686
87static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
88   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
89   AM_RANGE(0x80000, 0x8ffff) AM_READ(MRA8_BANK1)   /* Quiz F1 only */
90   AM_RANGE(0xa0000, 0xa3fff) AM_READ(MRA8_RAM)
91   AM_RANGE(0xd0000, 0xdffff) AM_READ(MRA8_RAM)
92   AM_RANGE(0xe0000, 0xe03ff) AM_READ(paletteram_r)
93   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
87static ADDRESS_MAP_START( main_cpu, ADDRESS_SPACE_PROGRAM, 16 )
88   AM_RANGE(0x00000, 0x7ffff) AM_ROM
89   AM_RANGE(0x80000, 0x8ffff) AM_ROMBANK(1)   /* Quiz F1 only */
90   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
91   AM_RANGE(0xd0000, 0xdffff) AM_RAM AM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
92   AM_RANGE(0xe0000, 0xe03ff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
93   AM_RANGE(0xffff0, 0xfffff) AM_ROM
9494ADDRESS_MAP_END
9595
96static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
97   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
98   AM_RANGE(0x80000, 0x8ffff) AM_WRITE(MWA8_ROM)   /* Quiz F1 only */
99   AM_RANGE(0xa0000, 0xa3fff) AM_WRITE(MWA8_RAM)
100   AM_RANGE(0xd0000, 0xdffff) AM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
101   AM_RANGE(0xe0000, 0xe03ff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_BASE(&paletteram)
102   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
96static ADDRESS_MAP_START( bootleg_main_cpu, ADDRESS_SPACE_PROGRAM, 16 )
97   AM_RANGE(0x00000, 0x3ffff) AM_ROM
98   AM_RANGE(0x6000e, 0x60fff) AM_RAM AM_BASE(&spriteram16)
99   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
100   AM_RANGE(0xd0000, 0xdffff) AM_RAM AM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
101   AM_RANGE(0xe0000, 0xe03ff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
102   AM_RANGE(0xffff0, 0xfffff) AM_ROM
103103ADDRESS_MAP_END
104104
105static ADDRESS_MAP_START( bootleg_readmem, ADDRESS_SPACE_PROGRAM, 8 )
106   AM_RANGE(0x00000, 0x3ffff) AM_READ(MRA8_ROM)
107   AM_RANGE(0x60000, 0x60fff) AM_READ(MRA8_RAM)
108   AM_RANGE(0xa0000, 0xa3fff) AM_READ(MRA8_RAM)
109   AM_RANGE(0xd0000, 0xdffff) AM_READ(MRA8_RAM)
110   AM_RANGE(0xe0000, 0xe03ff) AM_READ(paletteram_r)
111   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
112ADDRESS_MAP_END
113
114static ADDRESS_MAP_START( bootleg_writemem, ADDRESS_SPACE_PROGRAM, 8 )
115   AM_RANGE(0x00000, 0x3ffff) AM_WRITE(MWA8_ROM)
116   AM_RANGE(0x6000e, 0x60fff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram)
117   AM_RANGE(0xa0000, 0xa3fff) AM_WRITE(MWA8_RAM)
118   AM_RANGE(0xd0000, 0xdffff) AM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
119   AM_RANGE(0xe0000, 0xe03ff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_BASE(&paletteram)
120   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
121ADDRESS_MAP_END
122
123static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
124   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r) /* Player 1 */
125   AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r) /* Player 2 */
126   AM_RANGE(0x02, 0x02) AM_READ(input_port_2_r) /* Coins */
127   AM_RANGE(0x03, 0x03) AM_READ(MRA8_NOP)      /* Unused?  High byte of above */
128   AM_RANGE(0x04, 0x04) AM_READ(input_port_3_r) /* Dip 1 */
129   AM_RANGE(0x05, 0x05) AM_READ(input_port_4_r) /* Dip 2 */
130   AM_RANGE(0x06, 0x06) AM_READ(input_port_5_r) /* Player 3 */
131   AM_RANGE(0x07, 0x07) AM_READ(input_port_6_r) /* Player 4 */
132ADDRESS_MAP_END
133
134static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
105static ADDRESS_MAP_START( main_cpu_io, ADDRESS_SPACE_IO, 16 )
135106   AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w)
107   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r) /* Player 1 & Player 2 */
136108   AM_RANGE(0x02, 0x03) AM_WRITE(m90_coincounter_w)
109   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r) /* Coins */
137110   AM_RANGE(0x04, 0x05) AM_WRITE(quizf1_bankswitch_w)
111   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r) /* Dip 1 & Dip 2 */
112   AM_RANGE(0x06, 0x07) AM_READ(input_port_3_word_r) /* Player 3 & Player 4 */
138113   AM_RANGE(0x80, 0x8f) AM_WRITE(m90_video_control_w)
139114ADDRESS_MAP_END
140115
r869r870
186161
187162
188163INPUT_PORTS_START( hasamu )
189   IREM_JOYSTICK_1_2(1)
190   IREM_JOYSTICK_1_2(2)
164   IREM_JOYSTICKS_1_2
165
191166   IREM_COINS
192167
193168   PORT_START   /* Dip switch bank 1 */
194   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")
195   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
196   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
197   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
198   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
199   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
200   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
201   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
202   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
203   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
204   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
205   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
206   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
207   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
208   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
209   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
210   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
211   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
212   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
213   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
214   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
215   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
216
217   PORT_START   /* Dip switch bank 2 */
218   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
219   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
220   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
221   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
222   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
223   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
224   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
225   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
226   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
227   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
228   PORT_DIPSETTING(    0x08, "1" )
229   PORT_DIPSETTING(    0x00, "2" )
169   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")
170   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
171   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
172   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
173   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
174   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
175   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
176   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
177   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
178   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
179   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
180   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
181   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
182   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
183   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
184   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
185   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
186   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
187   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
188   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
189   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
190   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
191   /* Dip switch bank 2 */
192   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
193   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
194   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
195   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
196   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
197   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
198   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
199   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
200   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
201   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
202   PORT_DIPSETTING(      0x0800, "1" )
203   PORT_DIPSETTING(      0x0000, "2" )
230204   /* Coin Mode 1 */
231   IREM_COIN_MODE_1_NEW
205   IREM_COIN_MODE_1_NEW_HIGH
232206   /* Coin Mode 2, not supported yet */
233207//  IREM_COIN_MODE_2
234208INPUT_PORTS_END
235209
236210INPUT_PORTS_START( dynablst )
237   IREM_JOYSTICK_1_2(1)
238   IREM_JOYSTICK_1_2(2)
211   IREM_JOYSTICKS_1_2
212
239213   IREM_COINS
240214
241   PORT_START_TAG("DSWA")    /* Dip switch bank 1 */
242   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
243   PORT_DIPSETTING(    0x02, "2" )
244   PORT_DIPSETTING(    0x03, "3" )
245   PORT_DIPSETTING(    0x01, "4" )
246   PORT_DIPSETTING(    0x00, "5" )
247   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
248   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
249   PORT_DIPSETTING(    0x0c, DEF_STR( Medium ) )
250   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
251   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
252   PORT_DIPNAME( 0x10, 0x10, "Game Title" )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
253   PORT_DIPSETTING(    0x10, "Dynablaster" )
254   PORT_DIPSETTING(    0x00, "Bomber Man" )
255   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
256   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
257   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
258   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
259   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
260   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
261   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
262
263   PORT_START_TAG("DSWB")   /* Dip switch bank 2 */
264   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
265   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
266   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
267   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3")
268   PORT_DIPSETTING(    0x04, "2 Player Upright" )
269   PORT_DIPSETTING(    0x06, "4 Player Upright A" ) /* Seperate Coin Slots */
270   PORT_DIPSETTING(    0x02, "4 Player Upright B" ) /* Shared Coin Slots */
271   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )  /* This setting shows screen with offset, no cocktail support :-( */
272   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
273   PORT_DIPSETTING(    0x08, "1" )
274   PORT_DIPSETTING(    0x00, "2" )
215   PORT_START_TAG("DSW")    /* Dip switch bank 1 */
216   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
217   PORT_DIPSETTING(      0x0002, "2" )
218   PORT_DIPSETTING(      0x0003, "3" )
219   PORT_DIPSETTING(      0x0001, "4" )
220   PORT_DIPSETTING(      0x0000, "5" )
221   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
222   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
223   PORT_DIPSETTING(      0x000c, DEF_STR( Medium ) )
224   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
225   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
226   PORT_DIPNAME( 0x0010, 0x0010, "Game Title" )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
227   PORT_DIPSETTING(      0x0010, "Dynablaster" )
228   PORT_DIPSETTING(      0x0000, "Bomber Man" )
229   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
230   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
231   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
232   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
233   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
234   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
235   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
236   /* Dip switch bank 2 */
237   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
238   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
239   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
240   PORT_DIPNAME( 0x0600, 0x0600, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3")
241   PORT_DIPSETTING(      0x0400, "2 Player Upright" )
242   PORT_DIPSETTING(      0x0600, "4 Player Upright A" ) /* Seperate Coin Slots */
243   PORT_DIPSETTING(      0x0200, "4 Player Upright B" ) /* Shared Coin Slots */
244   PORT_DIPSETTING(      0x0000, DEF_STR( Cocktail ) )  /* This setting shows screen with offset, no cocktail support :-( */
245   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
246   PORT_DIPSETTING(      0x0800, "1" )
247   PORT_DIPSETTING(      0x0000, "2" )
275248   /* Coin Mode 1 */
276   IREM_COIN_MODE_1_NEW
249   IREM_COIN_MODE_1_NEW_HIGH
277250   /* Coin Mode 2, not supported yet */
278251//  IREM_COIN_MODE_2
279252
280   IREM_JOYSTICK_3_4(3)
281   IREM_JOYSTICK_3_4(4)
253   IREM_JOYSTICKS_3_4
282254INPUT_PORTS_END
283255
284256INPUT_PORTS_START( atompunk )
285257   PORT_INCLUDE(dynablst)
286258
287   PORT_MODIFY("DSWA")
288   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
289   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
290   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
259   PORT_MODIFY("DSW")
260   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
261   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
262   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
291263INPUT_PORTS_END
292264
293265INPUT_PORTS_START( bombrman ) /* Does not appear to support 4 players or cocktail mode */
294   IREM_JOYSTICK_1_2(1)
295   IREM_JOYSTICK_1_2(2)
266   IREM_JOYSTICKS_1_2
267
296268   IREM_COINS
297269
298270   PORT_START   /* Dip switch bank 1 */
299   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
300   PORT_DIPSETTING(    0x02, "2" )
301   PORT_DIPSETTING(    0x03, "3" )
302   PORT_DIPSETTING(    0x01, "4" )
303   PORT_DIPSETTING(    0x00, "5" )
304   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
305   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
306   PORT_DIPSETTING(    0x0c, DEF_STR( Medium ) )
307   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
308   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
309   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )   /* Manual says "NOT USE" */
310   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
311   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
312   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
313   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
314   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
315   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
316   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
317   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
318   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
319
320   PORT_START   /* Dip switch bank 2 */
321   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
322   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
323   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
324   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )   /* Manual says "NOT USE" */
325   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
326   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
327   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   /* Manual says "NOT USE" */
328   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
329   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
330   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" )
331   PORT_DIPSETTING(    0x08, "1" )
332   PORT_DIPSETTING(    0x00, "2" )
271   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
272   PORT_DIPSETTING(      0x0002, "2" )
273   PORT_DIPSETTING(      0x0003, "3" )
274   PORT_DIPSETTING(      0x0001, "4" )
275   PORT_DIPSETTING(      0x0000, "5" )
276   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
277   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
278   PORT_DIPSETTING(      0x000c, DEF_STR( Medium ) )
279   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
280   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
281   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )   /* Manual says "NOT USE" */
282   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
283   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
284   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
285   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
286   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
287   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
288   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
289   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
290   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
291   /* Dip switch bank 2 */
292   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
293   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
294   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
295   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )   /* Manual says "NOT USE" */
296   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
297   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
298   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )   /* Manual says "NOT USE" */
299   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
300   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
301   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" )
302   PORT_DIPSETTING(      0x0800, "1" )
303   PORT_DIPSETTING(      0x0000, "2" )
333304   /* Coin Mode 1 */
334   IREM_COIN_MODE_1_NEW
305   IREM_COIN_MODE_1_NEW_HIGH
335306   /* Coin Mode 2, not supported yet */
336307//  IREM_COIN_MODE_2
337308INPUT_PORTS_END
338309
339310INPUT_PORTS_START( bbmanw )
340   IREM_JOYSTICK_1_2(1)
341   IREM_JOYSTICK_1_2(2)
311   IREM_JOYSTICKS_1_2
312
342313   IREM_COINS
343314
344   PORT_START_TAG("DSWA")   /* Dip switch bank 1 */
345   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
346   PORT_DIPSETTING(    0x02, "2" )
347   PORT_DIPSETTING(    0x03, "3" )
348   PORT_DIPSETTING(    0x01, "4" )
349   PORT_DIPSETTING(    0x00, "5" )
350   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
351   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
352   PORT_DIPSETTING(    0x0c, DEF_STR( Medium ) )
353   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
354   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
355   PORT_DIPNAME( 0x10, 0x10, "Game Title" )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
356   PORT_DIPSETTING(    0x10, "Bomber Man World" )
357   PORT_DIPSETTING(    0x00, "New Dyna Blaster Global Quest" )
358   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
359   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
360   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
361   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
362   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
363   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
364   PORT_SERVICE_DIPLOC ( 0x80, IP_ACTIVE_LOW, "SW1:8" )
365
366   PORT_START_TAG("DSWB")   /* Dip switch bank 2 */
367   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
368   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
369   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
370   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3")
371   PORT_DIPSETTING(    0x04, "2 Player" )
372   PORT_DIPSETTING(    0x06, "4 Player Seprate Coins" )      /* Each player has a seperate Coin Slot */
373   PORT_DIPSETTING(    0x02, "4 Player Shared Coins" )      /* All 4 players Share coin 1&2 */
374   PORT_DIPSETTING(    0x00, "4 Player 1&2 3&4 Share Coins" )   /* Players 1&2 share coin 1&2, Players 3&4 share coin 3&4 */
375   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
376   PORT_DIPSETTING(    0x08, "1" )
377   PORT_DIPSETTING(    0x00, "2" )
315   PORT_START_TAG("DSW")   /* Dip switch bank 1 */
316   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
317   PORT_DIPSETTING(      0x0002, "2" )
318   PORT_DIPSETTING(      0x0003, "3" )
319   PORT_DIPSETTING(      0x0001, "4" )
320   PORT_DIPSETTING(      0x0000, "5" )
321   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
322   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
323   PORT_DIPSETTING(      0x000c, DEF_STR( Medium ) )
324   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
325   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
326   PORT_DIPNAME( 0x0010, 0x0010, "Game Title" )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
327   PORT_DIPSETTING(      0x0010, "Bomber Man World" )
328   PORT_DIPSETTING(      0x0000, "New Dyna Blaster Global Quest" )
329   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
330   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
331   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
332   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
333   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
334   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
335   PORT_SERVICE_DIPLOC ( 0x0080, IP_ACTIVE_LOW, "SW1:8" )
336   /* Dip switch bank 2 */
337   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
338   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
339   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
340   PORT_DIPNAME( 0x0600, 0x0600, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3")
341   PORT_DIPSETTING(      0x0400, "2 Player" )
342   PORT_DIPSETTING(      0x0600, "4 Player Seprate Coins" )      /* Each player has a seperate Coin Slot */
343   PORT_DIPSETTING(      0x0200, "4 Player Shared Coins" )      /* All 4 players Share coin 1&2 */
344   PORT_DIPSETTING(      0x0000, "4 Player 1&2 3&4 Share Coins" )   /* Players 1&2 share coin 1&2, Players 3&4 share coin 3&4 */
345   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
346   PORT_DIPSETTING(      0x0800, "1" )
347   PORT_DIPSETTING(      0x0000, "2" )
378348   /* Coin Mode 1 */
379   IREM_COIN_MODE_1_NEW
349   IREM_COIN_MODE_1_NEW_HIGH
380350   /* Coin Mode 2, not supported yet */
381351//  IREM_COIN_MODE_2
382352
383   IREM_JOYSTICK_3_4(3)
384   IREM_JOYSTICK_3_4(4)
353   IREM_JOYSTICKS_3_4
385354INPUT_PORTS_END
386355
387356INPUT_PORTS_START( bbmanwj )
388357   PORT_INCLUDE(bbmanw)
389358
390   PORT_MODIFY("DSWA")
391   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
392   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
393   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
359   PORT_MODIFY("DSW")
360   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
361   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
362   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
394363INPUT_PORTS_END
395364
396365INPUT_PORTS_START( quizf1 )
397366   PORT_START
398   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
399   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
400   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
401   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
402   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
403   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
404   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
405   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
406   PORT_START
407   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
408   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
409   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
410   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
411   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
412   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
413   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
414   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
367   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
368   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
369   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
370   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
371   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
372   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
373   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
374   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
375   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
376   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
377   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
378   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
379   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
380   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
381   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
382   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
383
415384   IREM_COINS
416385
417386   PORT_START   /* Dip switch bank 1 */
418   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
419   PORT_DIPSETTING(    0x02, "2" )
420   PORT_DIPSETTING(    0x03, "3" )
421   PORT_DIPSETTING(    0x01, "4" )
422   PORT_DIPSETTING(    0x00, "5" )
423   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") /* Probably difficulty */
424   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
425   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
426   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
427   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
428   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
429   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
430   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
431   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
432   PORT_DIPNAME( 0x20, 0x00, "Input Device" )    PORT_DIPLOCATION("SW1:6") /* input related (joystick/buttons select?) */
433   PORT_DIPSETTING(    0x20, DEF_STR( Joystick ) )
434   PORT_DIPSETTING(    0x00, "Buttons" )
435   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
436   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
437   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
438   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
439
440   PORT_START   /* Dip switch bank 2 */
441   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
442   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
443   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
444   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
445   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
446   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
447   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
448   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
449   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
450   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
451   PORT_DIPSETTING(    0x08, "1" )
452   PORT_DIPSETTING(    0x00, "2" )
387   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
388   PORT_DIPSETTING(      0x0002, "2" )
389   PORT_DIPSETTING(      0x0003, "3" )
390   PORT_DIPSETTING(      0x0001, "4" )
391   PORT_DIPSETTING(      0x0000, "5" )
392   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") /* Probably difficulty */
393   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
394   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
395   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
396   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
397   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
398   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
399   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
400   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
401   PORT_DIPNAME( 0x0020, 0x0000, "Input Device" )    PORT_DIPLOCATION("SW1:6") /* input related (joystick/buttons select?) */
402   PORT_DIPSETTING(      0x0020, DEF_STR( Joystick ) )
403   PORT_DIPSETTING(      0x0000, "Buttons" )
404   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
405   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
406   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
407   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
408   /* Dip switch bank 2 */
409   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
410   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
411   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
412   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
413   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
414   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
415   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
416   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
417   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
418   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
419   PORT_DIPSETTING(      0x0800, "1" )
420   PORT_DIPSETTING(      0x0000, "2" )
453421   /* Coin Mode 1 */
454   IREM_COIN_MODE_1_NEW
422   IREM_COIN_MODE_1_NEW_HIGH
455423   /* Coin Mode 2, not supported yet */
456424//  IREM_COIN_MODE_2
457425INPUT_PORTS_END
458426
459427INPUT_PORTS_START( matchit2 )
460428   PORT_START
461   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
462   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
463   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
464   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
465   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
466   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
467   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
468   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
429   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
430   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
431   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
432   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
433   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
434   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
435   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
436   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
437   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
438   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
439   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
440   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
441   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
442   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
443   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
444   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
469445
470446   PORT_START
471   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
472   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
473   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
474   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
475   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
476   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
477   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
478   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
479
480   PORT_START
481447   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
482448   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
483449   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r869r870
488454   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
489455
490456   PORT_START   /* Dip switch bank 1 */
491   PORT_DIPNAME( 0x01, 0x01, "Girls Mode" ) PORT_DIPLOCATION("SW1:1")
492   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
493   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
494   PORT_DIPNAME( 0x02, 0x02, "China Tiles" ) PORT_DIPLOCATION("SW1:2")
495   PORT_DIPSETTING(    0x02, "Mahjong" )
496   PORT_DIPSETTING(    0x00, "Alpha-Numeric" )
497   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
498   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
499   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
500   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
501   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
502   PORT_DIPNAME( 0x30, 0x30, "Timer Speed" ) PORT_DIPLOCATION("SW1:5,6")
503   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
504   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
505   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
506   PORT_DIPSETTING(    0x20, DEF_STR( Easy )  )
507   PORT_DIPNAME( 0x40, 0x40, "Title Screen" ) PORT_DIPLOCATION("SW1:7")
508   PORT_DIPSETTING(    0x40, "Match It II" )
509   PORT_DIPSETTING(    0x00, "Shisensho II" )
510   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
511
512   PORT_START   /* Dip switch bank 2 */
513   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
514   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
515   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
516   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:2,3")
517   PORT_DIPSETTING(    0x06, DEF_STR( English ) )
518   PORT_DIPSETTING(    0x04, DEF_STR( German ) )
519   PORT_DIPSETTING(    0x02, "Korean" )
520   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
521   PORT_DIPSETTING(    0x08, "1" )
522   PORT_DIPSETTING(    0x00, "2" )
457   PORT_DIPNAME( 0x0001, 0x0001, "Girls Mode" ) PORT_DIPLOCATION("SW1:1")
458   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
459   PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
460   PORT_DIPNAME( 0x0002, 0x0002, "China Tiles" ) PORT_DIPLOCATION("SW1:2")
461   PORT_DIPSETTING(      0x0002, "Mahjong" )
462   PORT_DIPSETTING(      0x0000, "Alpha-Numeric" )
463   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
464   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
465   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
466   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
467   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
468   PORT_DIPNAME( 0x0030, 0x0030, "Timer Speed" ) PORT_DIPLOCATION("SW1:5,6")
469   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
470   PORT_DIPSETTING(      0x0010, DEF_STR( Hard ) )
471   PORT_DIPSETTING(      0x0030, DEF_STR( Normal ) )
472   PORT_DIPSETTING(      0x0020, DEF_STR( Easy )  )
473   PORT_DIPNAME( 0x0040, 0x0040, "Title Screen" ) PORT_DIPLOCATION("SW1:7")
474   PORT_DIPSETTING(      0x0040, "Match It II" )
475   PORT_DIPSETTING(      0x0000, "Shisensho II" )
476   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
477   /* Dip switch bank 2 */
478   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
479   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
480   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
481   PORT_DIPNAME( 0x0600, 0x0600, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:2,3")
482   PORT_DIPSETTING(      0x0600, DEF_STR( English ) )
483   PORT_DIPSETTING(      0x0400, DEF_STR( German ) )
484   PORT_DIPSETTING(      0x0200, "Korean" )
485   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
486   PORT_DIPSETTING(      0x0800, "1" )
487   PORT_DIPSETTING(      0x0000, "2" )
523488   /* Coin Mode 1 */
524   IREM_COIN_MODE_1_NEW
489   IREM_COIN_MODE_1_NEW_HIGH
525490   /* Coin Mode 2, not supported yet */
526491//  IREM_COIN_MODE_2
527492INPUT_PORTS_END
528493
529494INPUT_PORTS_START( shisen2 )
530495   PORT_START
531   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
532   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
533   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
534   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
535   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
536   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
537   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
538   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
496   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
497   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
498   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
499   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
500   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
501   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
502   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
503   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
504   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
505   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
506   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
507   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
508   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
509   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
510   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
511   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
539512
540513   PORT_START
541   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
542   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
543   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
544   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
545   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
546   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
547   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
548   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
549
550   PORT_START
551514   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
552515   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
553516   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r869r870
558521   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
559522
560523   PORT_START   /* Dip switch bank 1 */
561   PORT_DIPNAME( 0x01, 0x01, "Girls Mode" ) PORT_DIPLOCATION("SW1:1")
562   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
563   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
564   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
565   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
566   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
567   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
568   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
569   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
570   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
571   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
572   PORT_DIPNAME( 0x30, 0x30, "Timer Speed" ) PORT_DIPLOCATION("SW1:5,6")
573   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
574   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
575   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
576   PORT_DIPSETTING(    0x20, DEF_STR( Easy )  )
577   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
578   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
579   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
580   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
581
582   PORT_START   /* Dip switch bank 2 */
583   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
584   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
585   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
586   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
587   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
588   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
589   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
590   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
591   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
592   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
593   PORT_DIPSETTING(    0x08, "1" )
594   PORT_DIPSETTING(    0x00, "2" )
524   PORT_DIPNAME( 0x0001, 0x0001, "Girls Mode" ) PORT_DIPLOCATION("SW1:1")
525   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
526   PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
527   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
528   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
529   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
530   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
531   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
532   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
533   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
534   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
535   PORT_DIPNAME( 0x0030, 0x0030, "Timer Speed" ) PORT_DIPLOCATION("SW1:5,6")
536   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
537   PORT_DIPSETTING(      0x0010, DEF_STR( Hard ) )
538   PORT_DIPSETTING(      0x0030, DEF_STR( Normal ) )
539   PORT_DIPSETTING(      0x0020, DEF_STR( Easy )  )
540   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
541   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
542   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
543   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
544   /* Dip switch bank 2 */
545   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
546   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
547   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
548   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
549   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
550   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
551   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
552   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
553   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
554   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
555   PORT_DIPSETTING(      0x0800, "1" )
556   PORT_DIPSETTING(      0x0000, "2" )
595557   /* Coin Mode 1 */
596   IREM_COIN_MODE_1_NEW
558   IREM_COIN_MODE_1_NEW_HIGH
597559   /* Coin Mode 2, not supported yet */
598560//  IREM_COIN_MODE_2
599561INPUT_PORTS_END
600562
601563INPUT_PORTS_START( riskchal )
602   IREM_JOYSTICK_1_2(1)
603   IREM_JOYSTICK_1_2(2)
564   IREM_JOYSTICKS_1_2
565
604566   IREM_COINS
605567
606568   PORT_START   /* Dip switch bank 1 */
607   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
608   PORT_DIPSETTING(    0x02, "2" )
609   PORT_DIPSETTING(    0x03, "3" )
610   PORT_DIPSETTING(    0x01, "4" )
611   PORT_DIPSETTING(    0x00, "5" )
612   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
613   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
614   PORT_DIPSETTING(    0x0c, DEF_STR( Medium ) )
615   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
616   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
617   PORT_DIPNAME( 0x10, 0x10, "Game Title" )    PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
618   PORT_DIPSETTING(    0x10, "Bomber Man World" )
619   PORT_DIPSETTING(    0x00, "New Dyna Blaster Global Quest" )
620   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
621   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
622   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
623   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
624   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
625   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
626   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
627
628   PORT_START   /* Dip switch bank 2 */
629   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
630   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
631   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
632   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3")
633   PORT_DIPSETTING(    0x04, "2 Player" )
634   PORT_DIPSETTING(    0x06, "4 Player Seprate Coins" )      /* Each player has a seperate Coin Slot */
635   PORT_DIPSETTING(    0x02, "4 Player Shared Coins" )      /* All 4 players Share coin 1&2 */
636   PORT_DIPSETTING(    0x00, "4 Player 1&2 3&4 Share Coins" )   /* Players 1&2 share coin 1&2, Players 3&4 share coin 3&4 */
637   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
638   PORT_DIPSETTING(    0x08, "1" )
639   PORT_DIPSETTING(    0x00, "2" )
569   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
570   PORT_DIPSETTING(      0x0002, "2" )
571   PORT_DIPSETTING(      0x0003, "3" )
572   PORT_DIPSETTING(      0x0001, "4" )
573   PORT_DIPSETTING(      0x0000, "5" )
574   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
575   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
576   PORT_DIPSETTING(      0x000c, DEF_STR( Medium ) )
577   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
578   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
579   PORT_DIPNAME( 0x0010, 0x0010, "Game Title" )    PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */
580   PORT_DIPSETTING(      0x0010, "Bomber Man World" )
581   PORT_DIPSETTING(      0x0000, "New Dyna Blaster Global Quest" )
582   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6")
583   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
584   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
585   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
586   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
587   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
588   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
589   /* Dip switch bank 2 */
590   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
591   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
592   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
593   PORT_DIPNAME( 0x0600, 0x0600, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3")
594   PORT_DIPSETTING(      0x0400, "2 Player" )
595   PORT_DIPSETTING(      0x0600, "4 Player Seprate Coins" )      /* Each player has a seperate Coin Slot */
596   PORT_DIPSETTING(      0x0200, "4 Player Shared Coins" )      /* All 4 players Share coin 1&2 */
597   PORT_DIPSETTING(      0x0000, "4 Player 1&2 3&4 Share Coins" )   /* Players 1&2 share coin 1&2, Players 3&4 share coin 3&4 */
598   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4")
599   PORT_DIPSETTING(      0x0800, "1" )
600   PORT_DIPSETTING(      0x0000, "2" )
640601   /* Coin Mode 1 */
641   IREM_COIN_MODE_1_NEW
602   IREM_COIN_MODE_1_NEW_HIGH
642603   /* Coin Mode 2, not supported yet */
643604//  IREM_COIN_MODE_2
644605
645   IREM_JOYSTICK_3_4(3)
646   IREM_JOYSTICK_3_4(4)
606   IREM_JOYSTICKS_3_4
647607INPUT_PORTS_END
648608
649609/*****************************************************************************/
r869r870
702662
703663   /* basic machine hardware */
704664   MDRV_CPU_ADD(V30,32000000/4)   /* 8 MHz ??????? */
705   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
706   MDRV_CPU_IO_MAP(readport,writeport)
665   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
666   MDRV_CPU_IO_MAP(main_cpu_io,0)
707667   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
708668
709669   MDRV_CPU_ADD(Z80, 3579545)
r869r870
752712
753713   /* basic machine hardware */
754714   MDRV_CPU_ADD(V30,32000000/4)   /* 8 MHz ??????? */
755   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
756   MDRV_CPU_IO_MAP(readport,writeport)
715   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
716   MDRV_CPU_IO_MAP(main_cpu_io,0)
757717   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
758718
759719   MDRV_CPU_ADD(Z80, 3579545)
r869r870
794754
795755   /* basic machine hardware */
796756   MDRV_CPU_ADD_TAG("main",V30,32000000/4)   /* 8 MHz ??????? */
797   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
798   MDRV_CPU_IO_MAP(readport,writeport)
757   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
758   MDRV_CPU_IO_MAP(main_cpu_io,0)
799759   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
800760
801761   MDRV_CPU_ADD(Z80, 3579545)
r869r870
843803
844804   /* basic machine hardware */
845805   MDRV_CPU_ADD(V30,32000000/4)   /* 16 MHz */
846   MDRV_CPU_PROGRAM_MAP(bootleg_readmem,bootleg_writemem)
847   MDRV_CPU_IO_MAP(readport,writeport)
806   MDRV_CPU_PROGRAM_MAP(bootleg_main_cpu,0)
807   MDRV_CPU_IO_MAP(main_cpu_io,0)
848808   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
849809
850810   MDRV_CPU_ADD(Z80, 3579545)
r869r870
11691129}
11701130
11711131/* Bomberman World executes encrypted code from RAM! */
1172static UINT8 *bbmanw_ram_base;
1132static UINT16 *bbmanw_ram_base;
11731133extern UINT8 *irem_cpu_decrypted;
11741134
1175static WRITE8_HANDLER( bbmanw_ram_write )
1135static WRITE16_HANDLER( bbmanw_ram_write )
11761136{
1177   bbmanw_ram_base[offset]=data;
1178   irem_cpu_decrypted[0xa0c00+offset]=dynablaster_decryption_table[data];
1137   COMBINE_DATA(&bbmanw_ram_base[offset]);
1138   if (ACCESSING_LSB)
1139      irem_cpu_decrypted[0xa0c00+offset*2]=dynablaster_decryption_table[data & 0xff];
1140   if (ACCESSING_MSB)
1141      irem_cpu_decrypted[0xa0c00+offset*2+1]=dynablaster_decryption_table[(data >> 8) & 0xff];
11791142}
11801143
1181static READ8_HANDLER( bbmanw_ram_read )
1144static READ16_HANDLER( bbmanw_ram_read )
11821145{
11831146   return bbmanw_ram_base[offset];
11841147}
r869r870
11881151   m90_game_kludge=0;
11891152   irem_cpu_decrypt(0,dynablaster_decryption_table);
11901153
1191   bbmanw_ram_base = memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0c00, 0xa0cff, 0, 0, bbmanw_ram_write);
1192   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0c00, 0xa0cff, 0, 0, bbmanw_ram_read);
1154   bbmanw_ram_base = memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0c00, 0xa0cff, 0, 0, bbmanw_ram_write);
1155   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0c00, 0xa0cff, 0, 0, bbmanw_ram_read);
11931156}
11941157
11951158static DRIVER_INIT( quizf1 )
src/mame/drivers/taito_z.c
r869r870
844844
845845   parse_control();
846846
847   // Chase HQ: handle the lights
848   if ((!strcmp(Machine->gamedrv->name, "chasehq")) || (!strcmp(Machine->gamedrv->name, "chasehqj")))
849   {
850      output_set_lamp_value(0, (data&0x20) ? 1 : 0);
851      output_set_lamp_value(1, (data&0x40) ? 1 : 0);
852   }
853
847854   logerror("CPU #0 PC %06x: write %04x to cpu control\n",activecpu_get_pc(),data);
848855}
849856
src/mame/drivers/lastfght.c
r869r870
182182//  MDRV_CPU_VBLANK_INT(unknown_interrupt,6)
183183
184184   MDRV_SCREEN_REFRESH_RATE( 60 )
185   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
185   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS( 0 ))
186186
187187   MDRV_VIDEO_ATTRIBUTES( VIDEO_TYPE_RASTER )
188188   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mame/drivers/playch10.c
r869r870
16531653ROM_START( playch10 )
16541654    BIOS_CPU
16551655   BIOS_GFX
1656    ROM_REGION( 0x50000, REGION_CPU2, ROMREGION_ERASE00 )
16561657    ROM_REGION( 0x100, REGION_USER1, ROMREGION_ERASE00 )
16571658ROM_END
16581659
src/mame/drivers/cojag.c
r869r870
350350}
351351
352352
353static READ32_HANDLER( jaguar_wave_rom_r )
354{
355   return jaguar_wave_rom[offset];
356}
353357
354358/*************************************
355359 *
r869r870
770774   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w)
771775   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE(jaguar_serial_r, jaguar_serial_w)
772776   AM_RANGE(0xf1b000, 0xf1cfff) AM_RAM AM_SHARE(4)
773   AM_RANGE(0xf1d000, 0xf1dfff) AM_ROM AM_BASE(&jaguar_wave_rom)
777   AM_RANGE(0xf1d000, 0xf1dfff) AM_READ(jaguar_wave_rom_r) AM_BASE(&jaguar_wave_rom)
774778ADDRESS_MAP_END
775779
776780
src/mame/drivers/lockon.c
r869r870
2222#include "driver.h"
2323#include "sound/2203intf.h"
2424
25static UINT8 *lockon_vram0;
26static UINT8 *lockon_vram1;
27static UINT8 *lockon_vram2;
28static UINT8 *object_ram;
29static UINT8 *ground_ram;
25static UINT16 *lockon_vram0;
26static UINT16 *lockon_vram1;
27static UINT16 *lockon_vram2;
28static UINT16 *object_ram;
29static UINT16 *ground_ram;
3030static UINT8 *z80_ram;
31static UINT8 *v30_gnd;
32static UINT8 *v30_obj;
33static UINT8 *clut_ram;
31static UINT16 *v30_gnd;
32static UINT16 *v30_obj;
33static UINT16 *clut_ram;
3434
3535static int v30_obj_addr=0;
3636static int v30_gnd_addr=0;
r869r870
7171        UINT8  *ROM_LUTB = (UINT8 *)memory_region(REGION_USER2);
7272        UINT8  *ROM_LUTC = (UINT8 *)memory_region(REGION_USER2)+0x8000;   // Selected by bit 7...
7373
74          for (offs = 0x0; offs <= (objectram_size); offs += 8)
74          for (offs = 0x0; offs <= (objectram_size/2); offs += 4)
7575      {
76
77
78          int offs0 = object_ram[offs+6] << 8;              // Lower 6-bits go into upper ROM portion
79          int bit7  = (object_ram[offs+6] >> 7) & 0x1;      // Selects which ROM to use in calculating lookup
76          int offs0 = (object_ram[offs+3] & 0x3f) << 8;              // Lower 6-bits go into upper ROM portion
77          int bit7  = (object_ram[offs+3] >> 7) & 0x1;      // Selects which ROM to use in calculating lookup
8078          int lut;
8179
82        if(!object_ram[offs+4] && !object_ram[offs+5])
83                continue;
84        if(object_ram[offs+7] == 0xfc || object_ram[offs+7] == 0xff)   // ?
85                break;
80        if(!object_ram[offs+2])
81           continue;
82         if((object_ram[offs+3] >> 8) == 0xfc || (object_ram[offs+3] >> 8) == 0xff)   // ?
83            break;
8684
8785          if(!bit7)
8886              lut = (ROM_LUTC[offs0 | (index_y<<4) | index_x]) & 0x7f;
r869r870
9391        // Bits 0-11 obj
9492        for(index_y=0; index_y<8; index_y++)
9593        {
96
9794         int index_x;
98        for(index_x=0; index_x<8; index_x++)
99        {
95         for(index_x=0; index_x<8; index_x++)
96         {
10097
101          /* Index into the object lookup table */
98            /* Index into the object lookup table */
99            int ref = object_ram[offs+2] + lut;
102100
103          int ROM_LUT_HI = object_ram[offs+5] << 8;
101            int pix = ROM_LUTA[ref+index_x+(16*index_y)];      // ???
104102
105          /* This is calculated from another LUT and current tile? */
106          int ROM_LUT_LO = object_ram[offs+4] + lut;
103            int flip_x = 0;//(object_ram[offs+1] >> 7) & 0x1;  // Bit 15
104            int flip_y = 0;//(object_ram[offs+1] >> 6) & 0x1;  // Bit 14
107105
108          int ref = ROM_LUT_LO + ROM_LUT_HI;
106            int scale_x = 0xffff; //+ object_ram[offs+1] & 0xff; //0x1ffff;
107            int scale_y = 0xffff; //+ object_ram[offs+1] >> 8; //0x1ffff;
109108
110          int pix = ROM_LUTA[ref+index_x+(16*index_y)];       // ???
109            int sy = 255-(object_ram[offs] & 0xff)+(index_y*8)*(scale_y/0xffff);
110            int sx = (object_ram[offs] >> 8)+(index_x*8)*(scale_x/0xffff);
111111
112          int flip_x = 0;//(object_ram[offs+3] >> 8) & 0x1;  // Bit 15
113          int flip_y = 0;//(object_ram[offs+3] >> 7) & 0x1;  // Bit 14
112            int bank = ((pix >> 12) & 0x7);
113            int index = pix & 0xfff;
114114
115          int scale_x = 0xffff; //+ object_ram[offs+2]; //0x1ffff;
116          int scale_y = 0xffff; //+ object_ram[offs+3]; //0x1ffff;
115            int color = 1;
117116
118          int sy = 255-object_ram[offs]+(index_y*8)*(scale_y/0xffff);
119     int sx = (object_ram[offs+1])+(index_x*8)*(scale_x/0xffff);
117            const gfx_element *gfx = machine->gfx[bank];
120118
121          int bank = ((pix >> 12) & 0x7);
122          int index = pix & 0xfff;
123
124          int color = 1;
125
126          const gfx_element *gfx = machine->gfx[bank];
127
128         drawgfxzoom(bitmap, gfx,
129            index,
130            color,
131            flip_x,flip_y,            // FlipX, flipY
132            sx,sy,
133            cliprect,TRANSPARENCY_PEN,1,
134                                scale_x,scale_y);
135          }
119            drawgfxzoom(bitmap, gfx,
120               index,
121               color,
122               flip_x,flip_y,            // FlipX, flipY
123               sx,sy,
124               cliprect,TRANSPARENCY_PEN,1,
125                             scale_x,scale_y);
126         }
136127        }
137 }
128   }
138129}
139130
140131/* Characters */
141WRITE8_HANDLER( lockon_vram_0_w )
132WRITE16_HANDLER( lockon_vram_0_w )
142133{
143    lockon_vram0[offset] = data;
144      tilemap_mark_tile_dirty(lockon_tilemap0,offset/2);
134    COMBINE_DATA(&lockon_vram0[offset]);
135      tilemap_mark_tile_dirty(lockon_tilemap0,offset);
145136}
146137
147138/* Scene */
148WRITE8_HANDLER( lockon_vram_1_w )
139WRITE16_HANDLER( lockon_vram_1_w )
149140{
150        lockon_vram1[offset] = data;
151          tilemap_mark_tile_dirty(lockon_tilemap1,offset/2);
141   COMBINE_DATA(&lockon_vram1[offset]);
142   tilemap_mark_tile_dirty(lockon_tilemap1,offset);
152143}
153144
154145/* HUD */
155WRITE8_HANDLER( lockon_vram_2_w )
146WRITE16_HANDLER( lockon_vram_2_w )
156147{
157        lockon_vram2[offset] = data;
158          tilemap_mark_tile_dirty(lockon_tilemap2,offset/2);
148   COMBINE_DATA(&lockon_vram2[offset]);
149   tilemap_mark_tile_dirty(lockon_tilemap2,offset);
159150}
160151
161152/* 8*8 characters */
162153static TILE_GET_INFO( get_lockon_tile_info0 )
163154{
164   int upper, lower, tileno, color;
165     tile_index <<= 1;
166   upper = (lockon_vram0[tile_index+1]&0x03)<<8;
167   lower = (lockon_vram0[tile_index]);
168   tileno = (upper + lower);
155   int tileno, color;
156   tileno = lockon_vram0[tile_index];
169157   color = 0;
170158
171159   SET_TILE_INFO(4,tileno,color,0);
r869r870
174162/* Scene tiles */
175163static TILE_GET_INFO( get_lockon_tile_info1 )
176164{
177     int upper, lower, tileno, color;
178    tile_index <<= 1;
179   upper = (lockon_vram1[tile_index+1]<<8);
180   lower = (lockon_vram1[tile_index]);
181   tileno = (upper + lower);
165     int tileno, color;
166   tileno = lockon_vram1[tile_index];
182167   color = 0;
183168
184169   SET_TILE_INFO(5,tileno,color,0);
r869r870
187172/* HUD tiles */
188173static TILE_GET_INFO( get_lockon_tile_info2 )
189174{
190     int upper, lower, tileno, color;
191    tile_index <<= 1;
192   upper = (lockon_vram1[tile_index+1]<<8);
193   lower = (lockon_vram1[tile_index]);
194   tileno = (upper + lower);
175     int tileno, color;
176   tileno = lockon_vram2[tile_index];
195177   color = 0;
196178
197179   SET_TILE_INFO(6,tileno,color,0);
r869r870
208190
209191VIDEO_UPDATE( lockon )
210192{
211       tilemap_draw(bitmap,cliprect,lockon_tilemap1,0,0);       // Scene
212       tilemap_draw(bitmap,cliprect,lockon_tilemap0,0,0);       // Characters
213//     tilemap_draw(bitmap,cliprect,lockon_tilemap2,0,0);       // HUD
214       draw_sprites(machine,bitmap,cliprect);
193   tilemap_draw(bitmap,cliprect,lockon_tilemap1,0,0);       // Scene
194   tilemap_draw(bitmap,cliprect,lockon_tilemap0,0,0);       // Characters
195   //tilemap_draw(bitmap,cliprect,lockon_tilemap2,0,0);       // HUD
196   draw_sprites(machine,bitmap,cliprect);
215197   return 0;
216198}
217199
218200/* Wrong last time I checked */
219201INPUT_PORTS_START( lockon )
220PORT_START_TAG("DSWA")
221   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
222   PORT_DIPSETTING(      0x00, "5"    )
223   PORT_DIPSETTING(      0x01, "4"  )
224   PORT_DIPSETTING(      0x02, "2"    )
225   PORT_DIPSETTING(      0x03, "3" )
202   PORT_START_TAG("DSW")
203   PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( Lives ) )
204   PORT_DIPSETTING(      0x0000, "5"    )
205   PORT_DIPSETTING(      0x0001, "4"  )
206   PORT_DIPSETTING(      0x0002, "2"    )
207   PORT_DIPSETTING(      0x0003, "3" )
226208
227   PORT_DIPNAME( 0x06, 0x08, DEF_STR( Difficulty ) )
228   PORT_DIPSETTING(      0x08, DEF_STR( Easy ) )
229   PORT_DIPSETTING(      0x06, DEF_STR( Normal ) )
230   PORT_DIPSETTING(      0x04, DEF_STR( Hard ) )
231   PORT_DIPSETTING(      0x00, DEF_STR( Hardest ) )
209   PORT_DIPNAME( 0x0006, 0x0008, DEF_STR( Difficulty ) )
210   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
211   PORT_DIPSETTING(      0x0006, DEF_STR( Normal ) )
212   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
213   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
232214
233        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
234   PORT_DIPSETTING(      0x10, "150K & every 200K"  )
235   PORT_DIPSETTING(      0x00, "200K & every 200K"  )
215   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )
216   PORT_DIPSETTING(      0x0010, "150K & every 200K"  )
217   PORT_DIPSETTING(      0x0000, "200K & every 200K"  )
236218
237        PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
238   PORT_DIPSETTING(      0x20, DEF_STR( No )  )
239   PORT_DIPSETTING(      0x00, DEF_STR( Yes ) )
219   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
220   PORT_DIPSETTING(      0x0020, DEF_STR( No )  )
221   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
240222
241        PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
242   PORT_DIPSETTING(      0x00, DEF_STR( Off ) )
243          PORT_DIPSETTING(      0x40, DEF_STR( On ) )
223   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) )
224   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
225   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
244226
245PORT_START_TAG("DSWB")
246   PORT_DIPNAME( 0x03, 0x00, "Coins" )
247   PORT_DIPSETTING(      0x00, "Free" )
248   PORT_DIPSETTING(      0x01, "4"  )
249   PORT_DIPSETTING(      0x02, "2"  )
250   PORT_DIPSETTING(      0x03, "3"  )
227   PORT_DIPNAME( 0x0300, 0x0000, "Coins" )
228   PORT_DIPSETTING(      0x0000, "Free" )
229   PORT_DIPSETTING(      0x0100, "4"  )
230   PORT_DIPSETTING(      0x0200, "2"  )
231   PORT_DIPSETTING(      0x0300, "3"  )
251232
252PORT_START
233   PORT_START
253234   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
254235   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
255236   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )     // Service coin
r869r870
263244   PORT_DIPSETTING(      0x80, DEF_STR( Off ) )
264245   PORT_DIPSETTING(      0x00, DEF_STR( On ) )
265246
266PORT_START_TAG("analog_bank")
247   PORT_START_TAG("analog_bank")
267248   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
268PORT_START_TAG("analog_pitch")
249
250   PORT_START_TAG("analog_pitch")
269251   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
270PORT_START_TAG("analog_missile")
252
253   PORT_START_TAG("analog_missile")
271254   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_BUTTON3 )         // Digital input read by ADC
272PORT_START_TAG("analog_hover")
255
256   PORT_START_TAG("analog_hover")
273257   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_BUTTON4 )         // Digital input read by ADC
274258INPUT_PORTS_END
275259
276260
277261static READ8_HANDLER(adc_r)
278262{
279       switch(offset)
280       {
281          case 0: return readinputportbytag("analog_bank");
282          case 1: return readinputportbytag("analog_pitch");
283          case 2: return readinputportbytag("analog_missile");
284          case 3: return readinputportbytag("analog_hover");
285          default: return 0;
286       }
263   switch(offset)
264   {
265      case 0: return readinputportbytag("analog_bank");
266      case 1: return readinputportbytag("analog_pitch");
267      case 2: return readinputportbytag("analog_missile");
268      case 3: return readinputportbytag("analog_hover");
269      default: return 0;
270   }
287271}
288272
289static READ8_HANDLER(unk_read)
273static READ16_HANDLER(unk_read)
290274{
291       return 1;                    // Main CPU jumps to 18002 otherwise
275   return 1;                    // Main CPU jumps to 18002 otherwise
292276}
293277
294278
r869r870
316300   Bit 7 = /ZCCLR     Clear screen
317301*/
318302
319static WRITE8_HANDLER(adrst_w)
303static WRITE16_HANDLER(adrst_w)
320304{
321       v30_gnd_addr = (data & 0x3);
322       v30_obj_addr = (data & 0x18) >> 3;
305   if (ACCESSING_LSB)
306   {
307      v30_gnd_addr = (data & 0x3);
308      v30_obj_addr = (data & 0x18) >> 3;
323309
324if (data & 0x04)
325      cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
326   else
327      cpunum_set_input_line(1, INPUT_LINE_HALT, CLEAR_LINE);
310      if (data & 0x04)
311         cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
312      else
313         cpunum_set_input_line(1, INPUT_LINE_HALT, CLEAR_LINE);
328314
329if (data & 0x20)
330      cpunum_set_input_line(2, INPUT_LINE_HALT, ASSERT_LINE);
331   else
332      cpunum_set_input_line(2, INPUT_LINE_HALT, CLEAR_LINE);
315      if (data & 0x20)
316         cpunum_set_input_line(2, INPUT_LINE_HALT, ASSERT_LINE);
317      else
318         cpunum_set_input_line(2, INPUT_LINE_HALT, CLEAR_LINE);
333319
334/* Suspend the Z80 when writing to shared RAM */
335if (data & 0x40)
336      cpunum_set_input_line(3, INPUT_LINE_HALT, CLEAR_LINE);
337   else
338      cpunum_set_input_line(3, INPUT_LINE_HALT, ASSERT_LINE);
320      /* Suspend the Z80 when writing to shared RAM */
321      if (data & 0x40)
322         cpunum_set_input_line(3, INPUT_LINE_HALT, CLEAR_LINE);
323      else
324         cpunum_set_input_line(3, INPUT_LINE_HALT, ASSERT_LINE);
325   }
339326}
340327
341static READ8_HANDLER(z80_shared_r)
328static READ16_HANDLER(z80_shared_r)
342329{
343       return z80_ram[offset/2];
330   return z80_ram[offset] | 0xff00;
344331}
345332
346static WRITE8_HANDLER(z80_shared_w)
333static WRITE16_HANDLER(z80_shared_w)
347334{
348       if(offset%2 == 0) z80_ram[offset/2]=data;
335   if (ACCESSING_LSB)
336      z80_ram[offset] = data;
349337}
350338
351static READ8_HANDLER(main_gnd_r)
339static READ16_HANDLER(main_gnd_r)
352340{
353   UINT8 result;
341   UINT16 result;
354342   cpuintrf_push_context(1);
355   result = program_read_byte(offset | (v30_gnd_addr << 16));
343   result = program_read_word((offset * 2) | (v30_gnd_addr << 16));
356344   cpuintrf_pop_context();
357345   return result;
358346}
359347
360static WRITE8_HANDLER(main_gnd_w)
348static WRITE16_HANDLER(main_gnd_w)
361349{
362350   cpuintrf_push_context(1);
363   program_write_byte(offset | (v30_gnd_addr << 16), data);
351   if (ACCESSING_LSB)
352      program_write_byte((offset * 2 + 0) | (v30_gnd_addr << 16), data);
353   if (ACCESSING_MSB)
354      program_write_byte((offset * 2 + 1) | (v30_gnd_addr << 16), data >> 8);
364355   cpuintrf_pop_context();
365356}
366357
367static READ8_HANDLER(main_obj_r)
358static READ16_HANDLER(main_obj_r)
368359{
369   UINT8 result;
360   UINT16 result;
370361   cpuintrf_push_context(2);
371   result = program_read_byte(offset | (v30_obj_addr << 16));
362   result = program_read_word((offset * 2) | (v30_obj_addr << 16));
372363   cpuintrf_pop_context();
373364   return result;
374365}
375366
376static WRITE8_HANDLER(main_obj_w)
367static WRITE16_HANDLER(main_obj_w)
377368{
378369   cpuintrf_push_context(2);
379   program_write_byte(offset | (v30_obj_addr << 16), data);
370   if (ACCESSING_LSB)
371      program_write_byte((offset * 2 + 0) | (v30_obj_addr << 16), data);
372   if (ACCESSING_MSB)
373      program_write_byte((offset * 2 + 1) | (v30_obj_addr << 16), data >> 8);
380374   cpuintrf_pop_context();
381375}
382376
383377
384static WRITE8_HANDLER(testcs_w)
378static WRITE16_HANDLER(testcs_w)
385379{
386   if(offset<0x800)
380   if (offset < 0x400)
387381   {
388382      cpuintrf_push_context(1);
389      program_write_byte(offset | (v30_gnd_addr << 16), data);
383      if (ACCESSING_LSB)
384         program_write_byte((offset*2+0) | (v30_gnd_addr << 16), data);
385      if (ACCESSING_MSB)
386         program_write_byte((offset*2+1) | (v30_gnd_addr << 16), data >> 8);
390387      cpuintrf_pop_context();
391388
392389      cpuintrf_push_context(2);
393      program_write_byte(offset | (v30_obj_addr << 16), data);
390      if (ACCESSING_LSB)
391         program_write_byte((offset*2+0) | (v30_obj_addr << 16), data);
392      if (ACCESSING_MSB)
393         program_write_byte((offset*2+1) | (v30_obj_addr << 16), data >> 8);
394394      cpuintrf_pop_context();
395395   }
396396}
r869r870
4074076 LO3_04A A14
4084087 CS - ROMs
409409*/
410static WRITE8_HANDLER(ground_bank_w)
410static WRITE16_HANDLER(ground_bank_w)
411411{
412412// Nothing here yet
413413}
r869r870
420420}
421421
422422/* Allow /CUDISP to interrupt main CPU */
423static WRITE8_HANDLER(inten_w)
423static WRITE16_HANDLER(inten_w)
424424{
425       main_inten = 1;
425   main_inten = TRUE;
426426}
427427
428428/* Reset watchdog and mask /CUDISP interrupt */
429static WRITE8_HANDLER(emres_w)
429static WRITE16_HANDLER(emres_w)
430430{
431       // Implement watchdog reset here.
432       main_inten = 0;
431   // Implement watchdog reset here.
432   main_inten = FALSE;
433433}
434434
435435
436static ADDRESS_MAP_START( main_v30, ADDRESS_SPACE_PROGRAM, 8 )
437      AM_RANGE(0x00000, 0x03fff) AM_RAM              // IC69/IC70
438      AM_RANGE(0x04000, 0x04003) AM_NOP              // CRT Controller
439      AM_RANGE(0x06000, 0x06000) AM_READ(port_tag_to_handler8("DSWA"))
440      AM_RANGE(0x06001, 0x06001) AM_READ(port_tag_to_handler8("DSWB"))
441      AM_RANGE(0x08000, 0x081ff) AM_READWRITE(MRA8_RAM,lockon_vram_2_w) AM_BASE(&lockon_vram2)  // HUD RAM (IC30/IC31)
442      AM_RANGE(0x09000, 0x09fff) AM_READWRITE(MRA8_RAM,lockon_vram_0_w) AM_BASE(&lockon_vram0)  // Character RAM
443      AM_RANGE(0x0a000, 0x0a001) AM_WRITE(adrst_w)            // /ADRST: CPU access register
444      AM_RANGE(0x0b000, 0x0bfff) AM_RAM                       // /BKBCS - ground control registers
445      AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_BASE(&clut_ram)    // /CCRS - 8kB palette RAM - write only
446      AM_RANGE(0x0e000, 0x0e001) AM_WRITE(inten_w)            // /INTEN: /CUDISP interrupt enable
447      AM_RANGE(0x0f000, 0x0f001) AM_WRITE(emres_w)            // /EMRES: Watchdog reset and interrupt mask
448      AM_RANGE(0x10000, 0x1ffff) AM_WRITE(testcs_w)           // /TESTCS: Write to both object and ground CPU RAM
449      AM_RANGE(0x18000, 0x18001) AM_READ(unk_read)            // Not sure what this is
450      AM_RANGE(0x20000, 0x2dfff) AM_ROM                                        // Z80 ROM
451      AM_RANGE(0x2f000, 0x2ffff) AM_READWRITE(z80_shared_r, z80_shared_w)      // Z80 shared RAM
452      AM_RANGE(0x30000, 0x3ffff) AM_READWRITE(main_gnd_r, main_gnd_w)          // Ground CPU memory access
453      AM_RANGE(0x40000, 0x4ffff) AM_READWRITE(main_obj_r, main_obj_w)          // Object CPU memory access
454      AM_RANGE(0x50000, 0x5ffff) AM_ROM              // IC76/IC77
455      AM_RANGE(0x60000, 0x6ffff) AM_ROM              // IC88/IC89
456      AM_RANGE(0xf0000, 0xfffff) AM_ROM              // IC95/IC96
436static ADDRESS_MAP_START( main_v30, ADDRESS_SPACE_PROGRAM, 16 )
437   AM_RANGE(0x00000, 0x03fff) AM_RAM              // IC69/IC70
438   AM_RANGE(0x04000, 0x04003) AM_NOP              // CRT Controller
439   AM_RANGE(0x06000, 0x06001) AM_READ_PORT("DSW")
440   AM_RANGE(0x08000, 0x081ff) AM_READWRITE(MRA16_RAM,lockon_vram_2_w) AM_BASE(&lockon_vram2)  // HUD RAM (IC30/IC31)
441   AM_RANGE(0x09000, 0x09fff) AM_READWRITE(MRA16_RAM,lockon_vram_0_w) AM_BASE(&lockon_vram0)  // Character RAM
442   AM_RANGE(0x0a000, 0x0a001) AM_WRITE(adrst_w)            // /ADRST: CPU access register
443   AM_RANGE(0x0b000, 0x0bfff) AM_RAM                       // /BKBCS - ground control registers
444   AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_BASE(&clut_ram)    // /CCRS - 8kB palette RAM - write only
445   AM_RANGE(0x0e000, 0x0e001) AM_WRITE(inten_w)            // /INTEN: /CUDISP interrupt enable
446   AM_RANGE(0x0f000, 0x0f001) AM_WRITE(emres_w)            // /EMRES: Watchdog reset and interrupt mask
447   AM_RANGE(0x10000, 0x1ffff) AM_WRITE(testcs_w)           // /TESTCS: Write to both object and ground CPU RAM
448   AM_RANGE(0x18000, 0x18001) AM_READ(unk_read)            // Not sure what this is
449   AM_RANGE(0x20000, 0x2dfff) AM_ROM                                        // Z80 ROM
450   AM_RANGE(0x2f000, 0x2ffff) AM_READWRITE(z80_shared_r, z80_shared_w)      // Z80 shared RAM
451   AM_RANGE(0x30000, 0x3ffff) AM_READWRITE(main_gnd_r, main_gnd_w)          // Ground CPU memory access
452   AM_RANGE(0x40000, 0x4ffff) AM_READWRITE(main_obj_r, main_obj_w)          // Object CPU memory access
453   AM_RANGE(0x50000, 0x5ffff) AM_ROM              // IC76/IC77
454   AM_RANGE(0x60000, 0x6ffff) AM_ROM              // IC88/IC89
455   AM_RANGE(0xf0000, 0xfffff) AM_ROM              // IC95/IC96
457456ADDRESS_MAP_END
458457
459static ADDRESS_MAP_START( ground_v30, ADDRESS_SPACE_PROGRAM, 8 )
460      ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
461      AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&v30_gnd)        // IC31/IC34)
462      AM_RANGE(0x04000, 0x04fff) AM_READWRITE(MRA8_RAM,lockon_vram_1_w) AM_BASE(&lockon_vram1)   // Scene RAM (IC112/IC113)
463      AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(&ground_ram) AM_SIZE(&lockon_ground_size)        // Ground RAM (IC98/IC99)
464      AM_RANGE(0x0C000, 0x0C001) AM_RAM                                          // /SHNH CS: Horizontal Scroll
465      AM_RANGE(0x0C002, 0x0C003) AM_RAM                                          // /SHNV CS: Vertical Scroll
466      AM_RANGE(0x0C004, 0x0C005) AM_RAM AM_WRITE(ground_bank_w)                  // /UNB CS:  Ground ROM Bank select
467      AM_RANGE(0x20000, 0x2ffff) AM_ROM                                          // Ground ROM (IC30/IC33)
468      AM_RANGE(0x30000, 0x3ffff) AM_ROM                                          // Program ROM mirror (use macros?)
469      AM_RANGE(0xe0000, 0xeffff) AM_ROM                                          // Ground ROM mirror
470      AM_RANGE(0xf0000, 0xfffff) AM_ROM
458static ADDRESS_MAP_START( ground_v30, ADDRESS_SPACE_PROGRAM, 16 )
459   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
460   AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&v30_gnd)        // IC31/IC34)
461   AM_RANGE(0x04000, 0x04fff) AM_READWRITE(MRA16_RAM,lockon_vram_1_w) AM_BASE(&lockon_vram1)   // Scene RAM (IC112/IC113)
462   AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(&ground_ram) AM_SIZE(&lockon_ground_size)        // Ground RAM (IC98/IC99)
463   AM_RANGE(0x0c000, 0x0c001) AM_RAM                                          // /SHNH CS: Horizontal Scroll
464   AM_RANGE(0x0c002, 0x0c003) AM_RAM                                          // /SHNV CS: Vertical Scroll
465   AM_RANGE(0x0c004, 0x0c005) AM_RAM AM_WRITE(ground_bank_w)                  // /UNB CS:  Ground ROM Bank select
466   AM_RANGE(0x20000, 0x2ffff) AM_ROM                                          // Ground ROM (IC30/IC33)
467   AM_RANGE(0x30000, 0x3ffff) AM_ROM                                          // Program ROM mirror (use macros?)
468   AM_RANGE(0xe0000, 0xeffff) AM_ROM                                          // Ground ROM mirror
469   AM_RANGE(0xf0000, 0xfffff) AM_ROM
471470ADDRESS_MAP_END
472471
473static ADDRESS_MAP_START( object_v30, ADDRESS_SPACE_PROGRAM, 8 )
474      AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&v30_obj)          // Work RAM (IC29, IC44)
475      AM_RANGE(0x04000, 0x04001) AM_RAM              // Read = assert CPU /POLL input (halt on WAIT instruction)
476      AM_RANGE(0x08000, 0x081ff) AM_RAM              // TZA112 sprite chip write?
477      AM_RANGE(0x0c000, 0x0c1ff) AM_RAM AM_BASE(&object_ram) AM_SIZE(&objectram_size)     // Object RAM (IC39/IC54)
478      AM_RANGE(0x20000, 0x2ffff) AM_ROM             // Program ROM mirror
479      AM_RANGE(0xf0000, 0xfffff) AM_ROM             // Program ROM
472static ADDRESS_MAP_START( object_v30, ADDRESS_SPACE_PROGRAM, 16 )
473   AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&v30_obj)          // Work RAM (IC29, IC44)
474   AM_RANGE(0x04000, 0x04001) AM_RAM              // Read = assert CPU /POLL input (halt on WAIT instruction)
475   AM_RANGE(0x08000, 0x081ff) AM_RAM              // TZA112 sprite chip write?
476   AM_RANGE(0x0c000, 0x0c1ff) AM_RAM AM_BASE(&object_ram) AM_SIZE(&objectram_size)     // Object RAM (IC39/IC54)
477   AM_RANGE(0x20000, 0x2ffff) AM_ROM             // Program ROM mirror
478   AM_RANGE(0xf0000, 0xfffff) AM_ROM             // Program ROM
480479ADDRESS_MAP_END
481480
482481static ADDRESS_MAP_START( sound_prg, ADDRESS_SPACE_PROGRAM, 8 )
483482   AM_RANGE(0x0000, 0x1fff) AM_ROM
484483   AM_RANGE(0xf810, 0xf810) AM_WRITE(MWA8_NOP)           // /TS
485484   AM_RANGE(0x7000, 0x7000) AM_WRITE(MWA8_NOP)           // Attenuate YM3014 output (not used?)
486        AM_RANGE(0x7400, 0x7403) AM_READWRITE(adc_r,MWA8_NOP) // M58990 ADC
485   AM_RANGE(0x7400, 0x7403) AM_READWRITE(adc_r,MWA8_NOP) // M58990 ADC
487486   AM_RANGE(0x7800, 0x7fff) AM_RAM AM_BASE(&z80_ram)
488487ADDRESS_MAP_END
489488
490489static ADDRESS_MAP_START( sound_io, ADDRESS_SPACE_IO, 8 )
491490   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
492        AM_RANGE(0x00, 0x00) AM_READWRITE(YM2203_status_port_0_r, YM2203_control_port_0_w)
491   AM_RANGE(0x00, 0x00) AM_READWRITE(YM2203_status_port_0_r, YM2203_control_port_0_w)
493492   AM_RANGE(0x01, 0x01) AM_READWRITE(YM2203_read_port_0_r, YM2203_write_port_0_w)
494493ADDRESS_MAP_END
495494
r869r870
586585};
587586
588587static MACHINE_DRIVER_START( lockon )
589        MDRV_CPU_ADD(V30,8000000 )
590        MDRV_CPU_PROGRAM_MAP(main_v30,0)
588   MDRV_CPU_ADD(V30,8000000)
589   MDRV_CPU_PROGRAM_MAP(main_v30,0)
591590
592        MDRV_CPU_ADD(V30,8000000 )
591   MDRV_CPU_ADD(V30,8000000)
593592   MDRV_CPU_PROGRAM_MAP(ground_v30,0)
594593
595        MDRV_CPU_ADD(V30,8000000 )
594   MDRV_CPU_ADD(V30,8000000)
596595   MDRV_CPU_PROGRAM_MAP(object_v30,0)
597596
598        MDRV_CPU_ADD(Z80,4000000 )
597   MDRV_CPU_ADD(Z80,4000000)
599598   MDRV_CPU_PROGRAM_MAP(sound_prg,0)
600599   MDRV_CPU_IO_MAP(sound_io,0)
601600
r869r870
606605
607606   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
608607   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
609        MDRV_SCREEN_SIZE(320, 240)
610          MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
608   MDRV_SCREEN_SIZE(320, 240)
609   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
611610   MDRV_GFXDECODE(gfxdecodeinfo)
612611
613612   MDRV_PALETTE_LENGTH(1024)
r869r870
622621   MDRV_SOUND_ROUTE(0, "left",  0.2)
623622   MDRV_SOUND_ROUTE(1, "left",  0.4)
624623   MDRV_SOUND_ROUTE(2, "left",  0.4)
625        MDRV_SOUND_ROUTE(3, "left",  0.4)
624   MDRV_SOUND_ROUTE(3, "left",  0.4)
626625   MDRV_SOUND_ROUTE(0, "right",  0.2)
627626   MDRV_SOUND_ROUTE(1, "right",  0.4)
628627   MDRV_SOUND_ROUTE(2, "right",  0.4)
r869r870
632631
633632ROM_START( lockon )
634633   ROM_REGION( 0x100000, REGION_CPU1, 0 )
635        ROM_LOAD16_BYTE( "lo1_02c", 0x50000, 0x8000, CRC(bbf17263) SHA1(96821a0ecd6efe6764380fef094f87c1d6e1d299) )
636        ROM_LOAD16_BYTE( "lo1_03c", 0x50001, 0x8000, CRC(fa58fd36) SHA1(16af24027610bf6d3fdc4c3df3bf6d94c6776420) )
634   ROM_LOAD16_BYTE( "lo1_02c", 0x50000, 0x8000, CRC(bbf17263) SHA1(96821a0ecd6efe6764380fef094f87c1d6e1d299) )
635   ROM_LOAD16_BYTE( "lo1_03c", 0x50001, 0x8000, CRC(fa58fd36) SHA1(16af24027610bf6d3fdc4c3df3bf6d94c6776420) )
637636
638        ROM_LOAD16_BYTE( "lo1_04c", 0x60000, 0x8000, CRC(4a88576e) SHA1(80a8bd89cedebf080b2c08a6e81d3c2754024d8a) )
639        ROM_LOAD16_BYTE( "lo1_05c", 0x60001, 0x8000, CRC(5a171b02) SHA1(f41f641136574e6af67c2245eb5a84799984474a) )
637   ROM_LOAD16_BYTE( "lo1_04c", 0x60000, 0x8000, CRC(4a88576e) SHA1(80a8bd89cedebf080b2c08a6e81d3c2754024d8a) )
638   ROM_LOAD16_BYTE( "lo1_05c", 0x60001, 0x8000, CRC(5a171b02) SHA1(f41f641136574e6af67c2245eb5a84799984474a) )
640639
641        ROM_LOAD16_BYTE( "lo1_00c", 0xf0000, 0x8000, CRC(e2db493b) SHA1(7491c634b698973ea54c25612d1e79c7efea8a45) )
642        ROM_LOAD16_BYTE( "lo1_01c", 0xf0001, 0x8000, CRC(3e6065e0) SHA1(d870f5b466fab90d5c51dd27ecc807e7b38b5f79))
640   ROM_LOAD16_BYTE( "lo1_00c", 0xf0000, 0x8000, CRC(e2db493b) SHA1(7491c634b698973ea54c25612d1e79c7efea8a45) )
641   ROM_LOAD16_BYTE( "lo1_01c", 0xf0001, 0x8000, CRC(3e6065e0) SHA1(d870f5b466fab90d5c51dd27ecc807e7b38b5f79))
643642
644        // Z80
645        ROM_LOAD16_BYTE( "lo1_08b", 0x20000, 0x8000, CRC(73860ec9) SHA1(a94afa274321b9f9ac2184e133132f9829fb9485) )
643   // Z80
644   ROM_LOAD16_BYTE( "lo1_08b", 0x20000, 0x8000, CRC(73860ec9) SHA1(a94afa274321b9f9ac2184e133132f9829fb9485) )
646645
647        // TF013 V30 (Ground)
648          ROM_REGION( 0x100000, REGION_CPU2, 0 )
649        ROM_LOAD16_BYTE( "lo3_01a", 0x20000, 0x8000, CRC(3eacdb6b) SHA1(7934c36dac9253dec4d8910954f6f2ae85951fe9) )
650          ROM_RELOAD(                 0xe0000, 0x8000 )
651        ROM_LOAD16_BYTE( "lo3_03a", 0x20001, 0x8000, CRC(4ce96d71) SHA1(cedbc33e86a93d11d5e11c2ef18bcf6390790a88) )
652          ROM_RELOAD(                 0xe0001, 0x8000 )
646   // TF013 V30 (Ground)
647   ROM_REGION( 0x100000, REGION_CPU2, 0 )
648   ROM_LOAD16_BYTE( "lo3_01a", 0x20000, 0x8000, CRC(3eacdb6b) SHA1(7934c36dac9253dec4d8910954f6f2ae85951fe9) )
649   ROM_RELOAD(                 0xe0000, 0x8000 )
650   ROM_LOAD16_BYTE( "lo3_03a", 0x20001, 0x8000, CRC(4ce96d71) SHA1(cedbc33e86a93d11d5e11c2ef18bcf6390790a88) )
651   ROM_RELOAD(                 0xe0001, 0x8000 )
653652
654        ROM_LOAD16_BYTE( "lo3_00b", 0xf0000, 0x8000, CRC(1835dccb) SHA1(8dfb0fea61a3e61f4da3b7f0da02cd19df2e68be) )
655          ROM_RELOAD(                 0x30000, 0x8000 )
656        ROM_LOAD16_BYTE( "lo3_02b", 0xf0001, 0x8000, CRC(2b8931d3) SHA1(f6f40b7857f3d47da8626450b1c1d3c46a1072ab) )
657          ROM_RELOAD(                 0x30001, 0x8000 )
653   ROM_LOAD16_BYTE( "lo3_00b", 0xf0000, 0x8000, CRC(1835dccb) SHA1(8dfb0fea61a3e61f4da3b7f0da02cd19df2e68be) )
654   ROM_RELOAD(                 0x30000, 0x8000 )
655   ROM_LOAD16_BYTE( "lo3_02b", 0xf0001, 0x8000, CRC(2b8931d3) SHA1(f6f40b7857f3d47da8626450b1c1d3c46a1072ab) )
656   ROM_RELOAD(                 0x30001, 0x8000 )
658657
659        // TF014 V30 (Object)
658   // TF014 V30 (Object)
660659   ROM_REGION( 0x100000, REGION_CPU3, 0 )
661        ROM_LOAD16_BYTE( "lo4_00b", 0xf0000, 0x8000, CRC(5f6b5a50) SHA1(daf82cafcae86d05587c191b0ff194ca7950e130) )
662        ROM_RELOAD(                 0x30000, 0x8000 )
660   ROM_LOAD16_BYTE( "lo4_00b", 0xf0000, 0x8000, CRC(5f6b5a50) SHA1(daf82cafcae86d05587c191b0ff194ca7950e130) )
661   ROM_RELOAD(                 0x30000, 0x8000 )
663662
664        ROM_LOAD16_BYTE( "lo4_01b", 0xf0001, 0x8000, CRC(7e88bcf2) SHA1(d541458ba6178ec3bce0e9b872b9fa1d8edb107c) )
665        ROM_RELOAD(                 0x30001, 0x8000 )
663   ROM_LOAD16_BYTE( "lo4_01b", 0xf0001, 0x8000, CRC(7e88bcf2) SHA1(d541458ba6178ec3bce0e9b872b9fa1d8edb107c) )
664   ROM_RELOAD(                 0x30001, 0x8000 )
666665
667        // TF014 Z80 (Sound)
668          ROM_REGION( 0x10000, REGION_CPU4, 0 )
669        ROM_LOAD( "lo1_08b", 0x00000, 0x8000, CRC(73860ec9) SHA1(a94afa274321b9f9ac2184e133132f9829fb9485) )
666   // TF014 Z80 (Sound)
667   ROM_REGION( 0x10000, REGION_CPU4, 0 )
668   ROM_LOAD( "lo1_08b", 0x00000, 0x8000, CRC(73860ec9) SHA1(a94afa274321b9f9ac2184e133132f9829fb9485) )
670669
671        // 8x8x8 object chunks
672          ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
673        ROM_LOAD( "lo5_00a", 0x00000, 0x8000, CRC(e9f23ce6) SHA1(4030384a0e8f47e8eea9483482ed1be264aec992) )
674        ROM_LOAD( "lo5_04a", 0x08000, 0x8000, CRC(099323bc) SHA1(001d30f4c3c27277fadac89dcf616ff89eb0ea1c) )
675        ROM_LOAD( "lo5_08a", 0x10000, 0x8000, CRC(9dedeff5) SHA1(53b0917a4fde4053182d38ea7f99f66e52543c10) )
676        ROM_LOAD( "lo5_12a", 0x18000, 0x8000, CRC(2f5164ab) SHA1(df775b9e1c3c605a85d44404e4db42e33e80e664) )
677        ROM_LOAD( "lo5_16a", 0x20000, 0x8000, CRC(c4500159) SHA1(e695e31e363cc954aab449f9d3dbc027e27fe7bf) )
678        ROM_LOAD( "lo5_20a", 0x28000, 0x8000, CRC(3c1a67b5) SHA1(399935830b32a457ad0de243dd3eb4d368d5c6a6) )
679        ROM_LOAD( "lo5_24a", 0x30000, 0x8000, CRC(1892d083) SHA1(8ee92be93ac222ecc2d9f4fcda3099b1db67516c) )
680        ROM_LOAD( "lo5_28a", 0x38000, 0x8000, CRC(1186f9b4) SHA1(55598552dafa8cccfb423fc3b65a7fa15831d75b) )
670   // 8x8x8 object chunks
671   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
672   ROM_LOAD( "lo5_00a", 0x00000, 0x8000, CRC(e9f23ce6) SHA1(4030384a0e8f47e8eea9483482ed1be264aec992) )
673   ROM_LOAD( "lo5_04a", 0x08000, 0x8000, CRC(099323bc) SHA1(001d30f4c3c27277fadac89dcf616ff89eb0ea1c) )
674   ROM_LOAD( "lo5_08a", 0x10000, 0x8000, CRC(9dedeff5) SHA1(53b0917a4fde4053182d38ea7f99f66e52543c10) )
675   ROM_LOAD( "lo5_12a", 0x18000, 0x8000, CRC(2f5164ab) SHA1(df775b9e1c3c605a85d44404e4db42e33e80e664) )
676   ROM_LOAD( "lo5_16a", 0x20000, 0x8000, CRC(c4500159) SHA1(e695e31e363cc954aab449f9d3dbc027e27fe7bf) )
677   ROM_LOAD( "lo5_20a", 0x28000, 0x8000, CRC(3c1a67b5) SHA1(399935830b32a457ad0de243dd3eb4d368d5c6a6) )
678   ROM_LOAD( "lo5_24a", 0x30000, 0x8000, CRC(1892d083) SHA1(8ee92be93ac222ecc2d9f4fcda3099b1db67516c) )
679   ROM_LOAD( "lo5_28a", 0x38000, 0x8000, CRC(1186f9b4) SHA1(55598552dafa8cccfb423fc3b65a7fa15831d75b) )
681680
682        // 8x8x8 object chunks
683          ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )
684        ROM_LOAD( "lo5_01a", 0x00000, 0x8000, CRC(528d1395) SHA1(0221f81900757c10f288807f5c9549b9fdf5390f) )
685        ROM_LOAD( "lo5_06a", 0x08000, 0x8000, CRC(be539b01) SHA1(1eebcbc592c51a676409b5be6c5d6609cd7118c9) )
686        ROM_LOAD( "lo5_10a", 0x10000, 0x8000, CRC(23eeec5a) SHA1(08edd997d773684d329ef554776bc7acff1ac4ce) )
687        ROM_LOAD( "lo5_14a", 0x18000, 0x8000, CRC(e63cd59e) SHA1(0518461acdc6c65dca8f21ca29bf528197e7cabe) )
688        ROM_LOAD( "lo5_17a", 0x20000, 0x8000, CRC(ccf138d3) SHA1(971e7abe5b4d1a9dc8fc71b1ded5d2b81bcffaf2) )
689        ROM_LOAD( "lo5_21a", 0x28000, 0x8000, CRC(39ce2000) SHA1(05f8e6f364ad714232fcea5b535ed5e181febd1e) )
690        ROM_LOAD( "lo5_25a", 0x30000, 0x8000, CRC(7f3418bd) SHA1(5e595500f996b71aa73c637a6fddced30d78e222) )
691        ROM_LOAD( "lo5_29a", 0x38000, 0x8000, CRC(45353d8d) SHA1(45cacd36700d24ae9f6eeaebed2fc860ef2d2978) )
681   // 8x8x8 object chunks
682   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )
683   ROM_LOAD( "lo5_01a", 0x00000, 0x8000, CRC(528d1395) SHA1(0221f81900757c10f288807f5c9549b9fdf5390f) )
684   ROM_LOAD( "lo5_06a", 0x08000, 0x8000, CRC(be539b01) SHA1(1eebcbc592c51a676409b5be6c5d6609cd7118c9) )
685   ROM_LOAD( "lo5_10a", 0x10000, 0x8000, CRC(23eeec5a) SHA1(08edd997d773684d329ef554776bc7acff1ac4ce) )
686   ROM_LOAD( "lo5_14a", 0x18000, 0x8000, CRC(e63cd59e) SHA1(0518461acdc6c65dca8f21ca29bf528197e7cabe) )
687   ROM_LOAD( "lo5_17a", 0x20000, 0x8000, CRC(ccf138d3) SHA1(971e7abe5b4d1a9dc8fc71b1ded5d2b81bcffaf2) )
688   ROM_LOAD( "lo5_21a", 0x28000, 0x8000, CRC(39ce2000) SHA1(05f8e6f364ad714232fcea5b535ed5e181febd1e) )
689   ROM_LOAD( "lo5_25a", 0x30000, 0x8000, CRC(7f3418bd) SHA1(5e595500f996b71aa73c637a6fddced30d78e222) )
690   ROM_LOAD( "lo5_29a", 0x38000, 0x8000, CRC(45353d8d) SHA1(45cacd36700d24ae9f6eeaebed2fc860ef2d2978) )
692691
693        // 8x8x8 object chunks
694          ROM_REGION( 0x400000, REGION_GFX3, ROMREGION_DISPOSE )
695        ROM_LOAD( "lo5_02a", 0x00000, 0x8000, CRC(07aa32a1) SHA1(712b1983747acdd754d3abe934642cbc02ee13f2) )
696        ROM_LOAD( "lo5_05a", 0x08000, 0x8000, CRC(f6b775a2) SHA1(e0146866f2e89675181c5d9d5aba23116daac420) )
697        ROM_LOAD( "lo5_09a", 0x10000, 0x8000, CRC(953289bc) SHA1(197066af45c1193c36cd59b4b72b14f1c3bdd33e) )
698        ROM_LOAD( "lo5_13a", 0x18000, 0x8000, CRC(67fbb061) SHA1(78b071cd54642ee7b6d7b9f6b759a1412bb9eef5) )
699        ROM_LOAD( "lo5_18a", 0x20000, 0x8000, CRC(89884b24) SHA1(23c1fcc97f3a1abcaad413f4448db26f7c55fd5e) )
700        ROM_LOAD( "lo5_22a", 0x28000, 0x8000, CRC(b1ed0361) SHA1(4bdf439026a858fdd929d5a7baac7d76f51550c5) )
701        ROM_LOAD( "lo5_26a", 0x30000, 0x8000, CRC(a0b5c040) SHA1(ef63f89a368bc73eb77fc02d83b499a0231c1989) )
702        ROM_LOAD( "lo5_30a", 0x38000, 0x8000, CRC(7d3993c5) SHA1(fb18daffcfc46bc1e1cfdee928eea861494af221) )
692   // 8x8x8 object chunks
693   ROM_REGION( 0x400000, REGION_GFX3, ROMREGION_DISPOSE )
694   ROM_LOAD( "lo5_02a", 0x00000, 0x8000, CRC(07aa32a1) SHA1(712b1983747acdd754d3abe934642cbc02ee13f2) )
695   ROM_LOAD( "lo5_05a", 0x08000, 0x8000, CRC(f6b775a2) SHA1(e0146866f2e89675181c5d9d5aba23116daac420) )
696   ROM_LOAD( "lo5_09a", 0x10000, 0x8000, CRC(953289bc) SHA1(197066af45c1193c36cd59b4b72b14f1c3bdd33e) )
697   ROM_LOAD( "lo5_13a", 0x18000, 0x8000, CRC(67fbb061) SHA1(78b071cd54642ee7b6d7b9f6b759a1412bb9eef5) )
698   ROM_LOAD( "lo5_18a", 0x20000, 0x8000, CRC(89884b24) SHA1(23c1fcc97f3a1abcaad413f4448db26f7c55fd5e) )
699   ROM_LOAD( "lo5_22a", 0x28000, 0x8000, CRC(b1ed0361) SHA1(4bdf439026a858fdd929d5a7baac7d76f51550c5) )
700   ROM_LOAD( "lo5_26a", 0x30000, 0x8000, CRC(a0b5c040) SHA1(ef63f89a368bc73eb77fc02d83b499a0231c1989) )
701   ROM_LOAD( "lo5_30a", 0x38000, 0x8000, CRC(7d3993c5) SHA1(fb18daffcfc46bc1e1cfdee928eea861494af221) )
703702
704        // 8x8x8 object chunks
705       ROM_REGION( 0x400000, REGION_GFX4, ROMREGION_DISPOSE )
706        ROM_LOAD( "lo5_03a", 0x00000, 0x8000, CRC(7aca5d83) SHA1(95456b6c5adc5b776fbd33fd95cc62d4a83c34b6) )
707        ROM_LOAD( "lo5_07a", 0x08000, 0x8000, CRC(313f127f) SHA1(0782b8dd5f3a3384c3e7bc9cacaadf6804e06a38) )
708        ROM_LOAD( "lo5_11a", 0x10000, 0x8000, CRC(9df0b287) SHA1(6ea3b32a7826186c854cc079711ddea4ebf2ab7c) )
709        ROM_LOAD( "lo5_15a", 0x18000, 0x8000, CRC(66f9c5db) SHA1(cc68da9312ee0a3441b62d14107e1b7de9b04de3) )
710        ROM_LOAD( "lo5_19a", 0x20000, 0x8000, CRC(5aaa6a53) SHA1(f8ff547979883ac9a969e76d90d028ec4286ec4c) )
711        ROM_LOAD( "lo5_23a", 0x28000, 0x8000, CRC(1487895b) SHA1(9d617f37932ca17d902307a97d16cf3b4bb5bc4e) )
712        ROM_LOAD( "lo5_27a", 0x30000, 0x8000, CRC(119ff70a) SHA1(e64d41bc7822c9e99fd025b771551a6c511d13f2) )
713        ROM_LOAD( "lo5_31a", 0x38000, 0x8000, CRC(d3595292) SHA1(9c45be919296626796b07f70b871fba5d444dbb3) )
703   // 8x8x8 object chunks
704   ROM_REGION( 0x400000, REGION_GFX4, ROMREGION_DISPOSE )
705   ROM_LOAD( "lo5_03a", 0x00000, 0x8000, CRC(7aca5d83) SHA1(95456b6c5adc5b776fbd33fd95cc62d4a83c34b6) )
706   ROM_LOAD( "lo5_07a", 0x08000, 0x8000, CRC(313f127f) SHA1(0782b8dd5f3a3384c3e7bc9cacaadf6804e06a38) )
707   ROM_LOAD( "lo5_11a", 0x10000, 0x8000, CRC(9df0b287) SHA1(6ea3b32a7826186c854cc079711ddea4ebf2ab7c) )
708   ROM_LOAD( "lo5_15a", 0x18000, 0x8000, CRC(66f9c5db) SHA1(cc68da9312ee0a3441b62d14107e1b7de9b04de3) )
709   ROM_LOAD( "lo5_19a", 0x20000, 0x8000, CRC(5aaa6a53) SHA1(f8ff547979883ac9a969e76d90d028ec4286ec4c) )
710   ROM_LOAD( "lo5_23a", 0x28000, 0x8000, CRC(1487895b) SHA1(9d617f37932ca17d902307a97d16cf3b4bb5bc4e) )
711   ROM_LOAD( "lo5_27a", 0x30000, 0x8000, CRC(119ff70a) SHA1(e64d41bc7822c9e99fd025b771551a6c511d13f2) )
712   ROM_LOAD( "lo5_31a", 0x38000, 0x8000, CRC(d3595292) SHA1(9c45be919296626796b07f70b871fba5d444dbb3) )
714713
715        // 8x8x2 characters
716        ROM_REGION( 0x20000, REGION_GFX5, ROMREGION_DISPOSE )
717        ROM_LOAD( "lo1_06a", 0x00000, 0x2000, CRC(c8205913) SHA1(c791ff14418873ce68b502440c3d7ccc1f9cc00e) )
718        ROM_LOAD( "lo1_07a", 0x02000, 0x2000, CRC(73673b79) SHA1(246b80f0c465cefb7ce1c87dc90a58f0f0ea3e0d) )
714   // 8x8x2 characters
715   ROM_REGION( 0x20000, REGION_GFX5, ROMREGION_DISPOSE )
716   ROM_LOAD( "lo1_06a", 0x00000, 0x2000, CRC(c8205913) SHA1(c791ff14418873ce68b502440c3d7ccc1f9cc00e) )
717   ROM_LOAD( "lo1_07a", 0x02000, 0x2000, CRC(73673b79) SHA1(246b80f0c465cefb7ce1c87dc90a58f0f0ea3e0d) )
719718
720        // 8x8x3 'scene' tiles
721          ROM_REGION( 0x40000, REGION_GFX6, ROMREGION_DISPOSE )
722        ROM_LOAD( "lo3_10a", 0x00000, 0x10000, CRC(d5f4a8f3) SHA1(fcfaef46ef89c4b97970418a75d110271e94d55f) )
723        ROM_LOAD( "lo3_11a", 0x10000, 0x10000, CRC(018efa36) SHA1(99eec3f06146627c7f7177b854424e7162ab7c8e) )
724        ROM_LOAD( "lo3_12a", 0x20000, 0x10000, CRC(a34262a7) SHA1(08204a4474ab1b07b9114da8af03442737922d3b) )
719   // 8x8x3 'scene' tiles
720   ROM_REGION( 0x40000, REGION_GFX6, ROMREGION_DISPOSE )
721   ROM_LOAD( "lo3_10a", 0x00000, 0x10000, CRC(d5f4a8f3) SHA1(fcfaef46ef89c4b97970418a75d110271e94d55f) )
722   ROM_LOAD( "lo3_11a", 0x10000, 0x10000, CRC(018efa36) SHA1(99eec3f06146627c7f7177b854424e7162ab7c8e) )
723   ROM_LOAD( "lo3_12a", 0x20000, 0x10000, CRC(a34262a7) SHA1(08204a4474ab1b07b9114da8af03442737922d3b) )
725724
726        // 8x8x1 HUD tiles
727          ROM_REGION( 0x40000, REGION_GFX7, ROMREGION_DISPOSE )
728        ROM_LOAD( "lo2_00", 0x00000, 0x2000, CRC(8affea15) SHA1(b7bcf0abde9c933e3f2c75c1f5e2ca3417d50ca1) )
725   // 8x8x1 HUD tiles
726   ROM_REGION( 0x40000, REGION_GFX7, ROMREGION_DISPOSE )
727   ROM_LOAD( "lo2_00", 0x00000, 0x2000, CRC(8affea15) SHA1(b7bcf0abde9c933e3f2c75c1f5e2ca3417d50ca1) )
729728
730        // 8x8 ground GFX
731          ROM_REGION( 0x400000, REGION_GFX8, ROMREGION_DISPOSE )
732        ROM_LOAD( "lo3_05a", 0x00000, 0x10000, CRC(5b6f4c8e) SHA1(fc8b2c929c60fb0177ed3e407e3f0aacc5df8401) )
733        ROM_LOAD( "lo3_06a", 0x10000, 0x10000, CRC(f6b6ebdd) SHA1(30e92da3bf83c4bb30faf00cbf01664b993f137c) )
734        ROM_LOAD( "lo3_07a", 0x20000, 0x10000, CRC(cebc50e1) SHA1(f8b06ce576c3d41b0a8e2cc3ac60d3515d434812) )
729   // 8x8 ground GFX
730   ROM_REGION( 0x400000, REGION_GFX8, ROMREGION_DISPOSE )
731   ROM_LOAD( "lo3_05a", 0x00000, 0x10000, CRC(5b6f4c8e) SHA1(fc8b2c929c60fb0177ed3e407e3f0aacc5df8401) )
732   ROM_LOAD( "lo3_06a", 0x10000, 0x10000, CRC(f6b6ebdd) SHA1(30e92da3bf83c4bb30faf00cbf01664b993f137c) )
733   ROM_LOAD( "lo3_07a", 0x20000, 0x10000, CRC(cebc50e1) SHA1(f8b06ce576c3d41b0a8e2cc3ac60d3515d434812) )
735734
736        // Object chunk LUTs
737        ROM_REGION( 0x30000, REGION_USER1, 0 )
738        ROM_LOAD16_BYTE( "lo4_04a", 0x00000, 0x10000, CRC(098f4151) SHA1(cf38e3c5f3442fbfa97870d25f7c89c465f847a9) )
739        ROM_LOAD16_BYTE( "lo4_05a", 0x00001, 0x10000, CRC(3b21667c) SHA1(b8337f733ede35145602ee3f0de25c2d4db1b2a5) )
735   // Object chunk LUTs
736   ROM_REGION( 0x30000, REGION_USER1, 0 )
737   ROM_LOAD16_BYTE( "lo4_04a", 0x00000, 0x10000, CRC(098f4151) SHA1(cf38e3c5f3442fbfa97870d25f7c89c465f847a9) )
738   ROM_LOAD16_BYTE( "lo4_05a", 0x00001, 0x10000, CRC(3b21667c) SHA1(b8337f733ede35145602ee3f0de25c2d4db1b2a5) )
740739
741        // Object LUTs
742        ROM_REGION( 0x30000, REGION_USER2, 0 )
743        ROM_LOAD( "lo4_02",  0x0000, 0x8000, CRC(0832edde) SHA1(77f9efbe029773417dbc3836a36687e37b5bee4b) )
744        ROM_LOAD( "lo4_03",  0x8000, 0x8000, CRC(1efac891) SHA1(faf305a30cab1c6bf8a9d6e2682b2c3745aec956) )
740   // Object LUTs
741   ROM_REGION( 0x30000, REGION_USER2, 0 )
742   ROM_LOAD( "lo4_02",  0x0000, 0x8000, CRC(0832edde) SHA1(77f9efbe029773417dbc3836a36687e37b5bee4b) )
743   ROM_LOAD( "lo4_03",  0x8000, 0x8000, CRC(1efac891) SHA1(faf305a30cab1c6bf8a9d6e2682b2c3745aec956) )
745744
746        // Ground LUTs
747        ROM_REGION( 0x30000, REGION_USER3, 0 )
748        ROM_LOAD( "lo3_08",  0x00000, 0x10000, CRC(f418cecd) SHA1(6cf2d13c9df86bad9c24609cb8387e817b5d4281) )
749        ROM_LOAD( "lo3_09",  0x10000, 0x10000, CRC(3c245568) SHA1(9ff6a23d83627f55c9d4f68e0bd89927bfe10664) )
750        ROM_LOAD( "lo3_04a", 0x00000, 0x10000, CRC(80b67ba9) SHA1(fdbef463b26cd13c43596310f585432c6e0896d0) )
745   // Ground LUTs
746   ROM_REGION( 0x30000, REGION_USER3, 0 )
747   ROM_LOAD( "lo3_08",  0x00000, 0x10000, CRC(f418cecd) SHA1(6cf2d13c9df86bad9c24609cb8387e817b5d4281) )
748   ROM_LOAD( "lo3_09",  0x10000, 0x10000, CRC(3c245568) SHA1(9ff6a23d83627f55c9d4f68e0bd89927bfe10664) )
749   ROM_LOAD( "lo3_04a", 0x00000, 0x10000, CRC(80b67ba9) SHA1(fdbef463b26cd13c43596310f585432c6e0896d0) )
751750
752        // Scene tiles CLUT
753        ROM_REGION( 0x10000, REGION_USER4, 0 )
754        ROM_LOAD( "lo3_13a", 0x0000, 0x10000, CRC(e44774a7) SHA1(010d95ea497690ddd2406b8fef1b0aee375a165e) )
751   // Scene tiles CLUT
752   ROM_REGION( 0x10000, REGION_USER4, 0 )
753   ROM_LOAD( "lo3_13a", 0x0000, 0x10000, CRC(e44774a7) SHA1(010d95ea497690ddd2406b8fef1b0aee375a165e) )
755754
756        // Colour PROMs
757        ROM_REGION( 0x1000, REGION_PROMS, 0 )
758        ROM_LOAD( "lo1a", 0x400,  0x400, CRC(82391f30) SHA1(d7153c1f3a3e54de4d4d6f432fbcd66449b96b6e) )
759        ROM_LOAD( "lo2a", 0x000,  0x400, CRC(2bfc6288) SHA1(03d293ddc0c614b606be823826a4375b3d35901f) )
755   // Colour PROMs
756   ROM_REGION( 0x1000, REGION_PROMS, 0 )
757   ROM_LOAD( "lo1a", 0x400,  0x400, CRC(82391f30) SHA1(d7153c1f3a3e54de4d4d6f432fbcd66449b96b6e) )
758   ROM_LOAD( "lo2a", 0x000,  0x400, CRC(2bfc6288) SHA1(03d293ddc0c614b606be823826a4375b3d35901f) )
760759ROM_END
761760
762761GAME( 1986, lockon, 0, lockon, lockon, 0, ROT0, "Tatsumi", "Lock-On", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/rastan.c
r869r870
7878TODO:
7979- Unknown writes to 0x350008.
8080
81
82Stephh's notes (based on the game M68000 code and some tests) :
83
841) 'rastan' and 'rastanu'
85
86  - Region stored at 0x05fffe.w
87  - Sets :
88      * 'rastan'  : region = 0x0001
89      * 'rastanu' : region = 0x0000
90  - These 2 games are 100% the same, only region differs !
91    The US version has the copyright message twice in ROM though
92  - Coinage relies on the region (code at 0x05ffa2) :
93      * 0x0001 (World) uses TAITO_COINAGE_WORLD
94      * other uses TAITO_COINAGE_JAPAN_OLD
95  - Game name : "RASTAN"
96  - No notice screen
97  - In "demo mode", you get a scrolling screen with what the various items do
98  - No begining screen when you start a new game
99  - Same "YOU ARE A BRAVE FIGHTER ..." message between levels
100  - No message after beating level 6 boss
101  - No copyright message on scrolling credits screen
102  - Game ends after round 6
103  - There was sort of debug address at 0x05ff9e.w in ROM area :
104      * bits 0 to 2 determine the level (0 to 5)
105      * bits 3 and 5 determine where you start at the level !
106          . OFF & OFF : part 1
107          . OFF & ON  : part 2
108          . ON  & OFF : part 3 (boss)
109          . ON  & ON  : IMPOSSIBLE !
110      * bit 4 doesn't seem to have any effect
111      * bit 6 is the invulnerability flag (stored at 0x10c040.w = $40,A5)
112        surprisingly, it doesn't work when you fall in the water
113      * bit 7 is the infinite energy flag (stored at 0x10c044.w = $44,A5)
114    Be aware that the bits are active low !
115
116
1172) 'rastanu2'
118
119  - Region stored at 0x05fffe.w
120  - Sets :
121      * 'rastanu2' : region = 0xffff
122  - Game uses TAITO_COINAGE_JAPAN_OLD
123  - Game name : "RASTAN"
124  - There was sort of debug address at 0x05fffc.w in ROM area
125    See 'rastan' comments to know what the different bits do
126  - Same other notes as for 'rastan'
127
128
1293) 'rastsaga'
130
131  - Region stored at 0x05fffe.w
132  - Sets :
133      * 'rastsaga' : region = 0xffff
134  - Game uses TAITO_COINAGE_JAPAN_OLD
135  - Game name : "RASTAN SAGA"
136  - Notice screen
137  - In "demo mode", you get no scrolling screen with what the various items do
138  - Begining screen when you start a new game
139  - Different messages between levels
140  - There was sort of debug address at 0x05fffc.w in ROM area
141    See 'rastan' comments to know what the different bits do
142  - Message after beating level 6 boss
143  - Copyright message on scrolling credits screen
144  - There was sort of debug address at 0x05fffc.w in ROM area
145    See 'rastan' comments to know what the different bits do
146  - Different way to handle coins insertion ? See additional code at 0x039f00
147  - Same other notes as for 'rastan'
148
149
1504) 'rastsag1'
151
152  - Region stored at 0x05fffe.w
153  - Sets :
154      * 'rastsaga' : region = 0xffff
155  - Game uses TAITO_COINAGE_JAPAN_OLD
156  - Game name : "RASTAN SAGA"
157  - Same other notes as for 'rastsaga'
158
81159***************************************************************************/
82160
83161#include "driver.h"
162#include "taitoipt.h"
84163#include "video/taitoic.h"
85164#include "audio/taitosnd.h"
86165#include "sound/2151intf.h"
r869r870
181260
182261
183262INPUT_PORTS_START( rastan )
184   PORT_START_TAG( "IN0" )
185   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
186   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
187   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
188   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
189   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
190   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
191   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   // button 3
192   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
263   PORT_START_TAG("IN0")
264   TAITO_JOY_UDLR_2_BUTTONS( 1 )
193265
194   PORT_START_TAG( "IN1" )
195   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
196   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
197   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
198   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
199   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
200   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
201   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   // button 3
202   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
266   PORT_START_TAG("IN1")
267   TAITO_JOY_UDLR_2_BUTTONS( 2 )
203268
204   PORT_START_TAG( "IN2" )
205   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )   // P1 button 4
206   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )   // P1 button 5
207   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )   // P2 button 4
208   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )   // P2 button 5
209   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )   // from PC050 (coin A gets locked if 0)
210   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   // from PC050 (coin B gets locked if 0)
211   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL )   // from PC050 (above 2 bits not checked when 0)
269   PORT_START_TAG("IN2")
270   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
271   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
272   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
273   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
274   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )                // from PC050 (coin A gets locked if 0)
275   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )                // from PC050 (coin B gets locked if 0)
276   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL )                // from PC050 (above 2 bits not checked when 0)
212277   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
213278
214   PORT_START_TAG( "IN3" )
279   PORT_START_TAG("IN3")
215280   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_SERVICE1 )
216281   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
217282   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
r869r870
219284   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
220285   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
221286   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
222   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
287   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
223288
224   PORT_START_TAG( "DSW1" )
289   /* 0x390008 -> 0x10c018 ($18,A5) */
290   PORT_START_TAG("DSWA")
225291   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
226292   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
227293   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
r869r870
229295   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
230296   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
231297   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
232   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
233   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
234   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
235   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
236   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
237   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
238   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
239   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
240   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
241   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
242   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
243   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
244   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
298   PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
299   TAITO_COINAGE_WORLD
245300
246   PORT_START_TAG( "DSW2" )
247   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
248   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
249   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
250   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
251   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
252   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
253   PORT_DIPSETTING(    0x0c, "100000" )
254   PORT_DIPSETTING(    0x08, "150000" )
255   PORT_DIPSETTING(    0x04, "200000" )
256   PORT_DIPSETTING(    0x00, "250000" )
301   /* 0x39000a -> 0x10c01c ($1c,A5) */
302   PORT_START_TAG("DSWB")
303   TAITO_DIFFICULTY
304   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )            /* table at 0x059f2e */
305   PORT_DIPSETTING(    0x0c, "100k 200k 400k 600k 800k" )
306   PORT_DIPSETTING(    0x08, "150k 300k 600k 900k 1200k" )
307   PORT_DIPSETTING(    0x04, "200k 400k 800k 1200k 1600k" )
308   PORT_DIPSETTING(    0x00, "250k 500k 1000k 1500k 2000k" )
257309   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
258310   PORT_DIPSETTING(    0x30, "3" )
259311   PORT_DIPSETTING(    0x20, "4" )
r869r870
262314   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
263315   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
264316   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
265   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
266   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
267   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
317   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
268318INPUT_PORTS_END
269319
270INPUT_PORTS_START( rastsaga )      /* same as rastan, coinage is different */
320INPUT_PORTS_START( rastsaga )
271321   PORT_INCLUDE( rastan )
272322
273   PORT_MODIFY( "DSW1" )
274   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
275   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
276   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
277   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
278   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
279   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
280   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
281   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
282   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
283   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
323   PORT_MODIFY("DSWA")
324   TAITO_COINAGE_JAPAN_OLD
284325INPUT_PORTS_END
285326
286327
r869r870
531572
532573
533574GAME( 1987, rastan,   0,      rastan, rastan,   0, ROT0, "Taito Corporation Japan", "Rastan (World)", 0)
534/* IDENTICAL to rastan, only difference is copyright notice and Coin B coinage */
535GAME( 1987, rastanu,  rastan, rastan, rastsaga, 0, ROT0, "Taito America Corporation", "Rastan (US set 1)", 0)
536GAME( 1987, rastanu2, rastan, rastan, rastsaga, 0, ROT0, "Taito America Corporation", "Rastan (US set 2)", 0)
575GAME( 1987, rastanu,  rastan, rastan, rastsaga, 0, ROT0, "Taito America Corporation", "Rastan (US, set 1)", 0)
576GAME( 1987, rastanu2, rastan, rastan, rastsaga, 0, ROT0, "Taito America Corporation", "Rastan (US, set 2)", 0)
537577GAME( 1987, rastsaga, rastan, rastan, rastsaga, 0, ROT0, "Taito Corporation", "Rastan Saga (Japan)", 0)
538578GAME( 1987, rastsag1, rastan, rastan, rastsaga, 0, ROT0, "Taito Corporation", "Rastan Saga (Japan Rev 1)", 0)
src/mame/drivers/segas32.c
r869r870
20892089MACHINE_DRIVER_END
20902090
20912091
2092static MACHINE_DRIVER_START( system32_v20 )
2092static MACHINE_DRIVER_START( system32_v25 )
20932093   MDRV_IMPORT_FROM(system32)
20942094
20952095   /* add a V25 for protection */
2096   MDRV_CPU_ADD(V20, 10000000)
2096   MDRV_CPU_ADD(V25, 10000000)
20972097   MDRV_CPU_PROGRAM_MAP(ga2_v25_map,0)
20982098MACHINE_DRIVER_END
20992099
r869r870
38453845GAME( 1994, dbzvrvs,  0,        system32,     dbzvrvs,  dbzvrvs,  ROT0, "Sega / Banpresto", "Dragon Ball Z V.R.V.S.", GAME_IMPERFECT_GRAPHICS)
38463846GAME( 1991, f1en,     0,        system32,     f1en,     f1en,     ROT0, "Sega",   "F1 Exhaust Note", GAME_IMPERFECT_GRAPHICS )
38473847GAME( 1993, f1lap,    0,        system32,     f1lap,    f1lap,    ROT0, "Sega",   "F1 Super Lap", GAME_NOT_WORKING )
3848GAME( 1992, ga2,      0,        system32_v20, ga2,      ga2,      ROT0, "Sega",   "Golden Axe: The Revenge of Death Adder (World)", GAME_IMPERFECT_GRAPHICS )
3849GAME( 1992, ga2u,     ga2,      system32_v20, ga2u,     ga2,      ROT0, "Sega",   "Golden Axe: The Revenge of Death Adder (US)", GAME_IMPERFECT_GRAPHICS )
3850GAME( 1992, ga2j,     ga2,      system32_v20, ga2,      ga2,      ROT0, "Sega",   "Golden Axe: The Revenge of Death Adder (Japan)", GAME_IMPERFECT_GRAPHICS )
3848GAME( 1992, ga2,      0,        system32_v25, ga2,      ga2,      ROT0, "Sega",   "Golden Axe: The Revenge of Death Adder (World)", GAME_IMPERFECT_GRAPHICS )
3849GAME( 1992, ga2u,     ga2,      system32_v25, ga2u,     ga2,      ROT0, "Sega",   "Golden Axe: The Revenge of Death Adder (US)", GAME_IMPERFECT_GRAPHICS )
3850GAME( 1992, ga2j,     ga2,      system32_v25, ga2,      ga2,      ROT0, "Sega",   "Golden Axe: The Revenge of Death Adder (Japan)", GAME_IMPERFECT_GRAPHICS )
38513851GAME( 1992, holo,     0,        system32,     holo,     holo,     ORIENTATION_FLIP_Y, "Sega",   "Holosseum (US)", GAME_IMPERFECT_GRAPHICS )
38523852GAME( 1994, jpark,    0,        system32,     jpark,    jpark,    ROT0, "Sega",   "Jurassic Park", GAME_IMPERFECT_GRAPHICS )
38533853GAME( 1994, kokoroj2, 0,        system32,     radr,     radr,     ROT0, "Sega",   "Kokoroji 2", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING) // uses an Audio CD
src/mame/drivers/psikyosh.c
r869r870
635635   MDRV_CPU_PROGRAM_MAP(ps5_readmem,ps5_writemem)
636636MACHINE_DRIVER_END
637637
638#if 0
638639static MACHINE_DRIVER_START( psikyo5_240 )
639640   /* basic machine hardware */
640641   MDRV_IMPORT_FROM(psikyo3v1)
r869r870
645646   /* It probably has a register to change visarea */
646647   MDRV_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 30*8-1)
647648MACHINE_DRIVER_END
649#endif
648650
649651
650652#define UNUSED_PORT \
src/mame/drivers/mpatrol.c
r869r870
413413   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
414414
415415   MDRV_SCREEN_REFRESH_RATE(57)
416   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1790)   /* accurate frequency, measured on a real board, is 56.75Hz. */)
416   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1790)   /* accurate frequency, measured on a real board, is 56.75Hz. */)
417417            /* the Lode Runner manual (similar but different hardware) */
418418            /* talks about 55Hz and 1790ms vblank duration. */
419419
r869r870
444444   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
445445
446446   MDRV_SCREEN_REFRESH_RATE(57)
447   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1790)   /* accurate frequency, measured on a real board, is 56.75Hz. */)
447   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1790)   /* accurate frequency, measured on a real board, is 56.75Hz. */)
448448            /* the Lode Runner manual (similar but different hardware) */
449449            /* talks about 55Hz and 1790ms vblank duration. */
450450
src/mame/drivers/upscope.c
r869r870
293293   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
294294
295295   MDRV_SCREEN_REFRESH_RATE(59.997)
296   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
296   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
297297
298298   MDRV_MACHINE_RESET(amiga)
299299   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/equites.c
r869r870
720720   MDRV_CPU_VBLANK_INT(equites_interrupt, 2)
721721
722722   MDRV_SCREEN_REFRESH_RATE(60)
723   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))
723   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))
724724
725725   /* video hardware */
726726   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK)
r869r870
748748   MDRV_CPU_VBLANK_INT(splndrbt_interrupt, 2)
749749
750750   MDRV_SCREEN_REFRESH_RATE(60)
751   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))
751   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))
752752   MDRV_MACHINE_RESET(splndrbt)
753753
754754   /* video hardware */
src/mame/drivers/decocass.c
r869r870
393393   MDRV_CPU_IO_MAP(decocass_mcu_portmap,0)
394394
395395   MDRV_SCREEN_REFRESH_RATE(57)
396   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3072)      /* frames per second, vblank duration */)
396   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072)      /* frames per second, vblank duration */)
397397   MDRV_INTERLEAVE(7)            /* interleave CPUs */
398398
399399   MDRV_MACHINE_RESET(decocass)
src/mame/drivers/mystwarr.c
r869r870
943943
944944   MDRV_INTERLEAVE(32);
945945   MDRV_SCREEN_REFRESH_RATE(60)
946   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))
946   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))
947947
948948   MDRV_NVRAM_HANDLER(mystwarr)
949949   MDRV_MACHINE_START(mystwarr)
r869r870
982982   MDRV_CPU_MODIFY("main")
983983   MDRV_CPU_PROGRAM_MAP(vsreadmem,vswritemem)
984984   MDRV_CPU_VBLANK_INT(metamrph_interrupt, 40)
985   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(900))
985   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(900))
986986
987987   /* video hardware */
988988   MDRV_VIDEO_START(viostorm)
r869r870
10001000   MDRV_CPU_MODIFY("main")
10011001   MDRV_CPU_PROGRAM_MAP(mmreadmem,mmwritemem)
10021002   MDRV_CPU_VBLANK_INT(metamrph_interrupt, 40)
1003   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(900))
1003   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(900))
10041004
10051005   /* video hardware */
10061006   MDRV_VIDEO_START(metamrph)
r869r870
10181018   MDRV_CPU_MODIFY("main")
10191019   MDRV_CPU_PROGRAM_MAP(dddreadmem, dddwritemem)
10201020   MDRV_CPU_VBLANK_INT(ddd_interrupt, 1)
1021   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))
1021   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))
10221022
10231023   MDRV_GFXDECODE(gfxdecodeinfo_dadandrn)
10241024
r869r870
10381038   MDRV_CPU_MODIFY("main")
10391039   MDRV_CPU_PROGRAM_MAP(gaiareadmem,gaiawritemem)
10401040   MDRV_CPU_VBLANK_INT(ddd_interrupt, 1)
1041   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))
1041   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))
10421042
10431043   MDRV_GFXDECODE(gfxdecodeinfo_gaiapols)
10441044
r869r870
10601060   MDRV_CPU_MODIFY("main")
10611061   MDRV_CPU_PROGRAM_MAP(mcreadmem,mcwritemem)
10621062   MDRV_CPU_VBLANK_INT(mchamp_interrupt, 2)
1063   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1063   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
10641064
10651065   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS | VIDEO_UPDATE_BEFORE_VBLANK)
10661066   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
src/mame/drivers/neogeo.c
r869r870
10291029   /* some games have protection devices in the 0x200000 region, it appears to map to cart space, not surprising, the ROM is read here too */
10301030   AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK(NEOGEO_BANK_CARTRIDGE)
10311031   AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
1032   AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ff7e) AM_READ(port_tag_to_handler16("IN0"))
1033   AM_RANGE(0x300080, 0x300081) AM_MIRROR(0x01ff7e) AM_READ(port_tag_to_handler16("IN4"))
1032   AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ff7e) AM_READ_PORT("IN0")
1033   AM_RANGE(0x300080, 0x300081) AM_MIRROR(0x01ff7e) AM_READ_PORT("IN4")
10341034   AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READWRITE(neogeo_unmapped_r, watchdog_w)
1035   AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READWRITE(port_tag_to_handler16("IN3"), audio_command_w)
1036   AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ(port_tag_to_handler16("IN1"))
1035   AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN3") AM_WRITE(audio_command_w)
1036   AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN1")
10371037   AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r)
1038   AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(port_tag_to_handler16("IN2"))
1038   AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN2")
10391039   AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE(io_control_w)
10401040   AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READWRITE(neogeo_unmapped_r, system_control_w)
10411041   AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(neogeo_video_register_r)
r869r870
10751075
10761076static ADDRESS_MAP_START( auido_io_map, ADDRESS_SPACE_IO, 8 )
10771077  /*AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, audio_cpu_clear_nmi_w);*/  /* may not and NMI clear */
1078   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r);
1078   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r)
10791079   AM_RANGE(0x04, 0x04) AM_MIRROR(0xff00) AM_READWRITE(YM2610_status_port_0_A_r, YM2610_control_port_0_A_w)
10801080   AM_RANGE(0x05, 0x05) AM_MIRROR(0xff00) AM_READWRITE(YM2610_read_port_0_r, YM2610_data_port_0_A_w)
10811081   AM_RANGE(0x06, 0x06) AM_MIRROR(0xff00) AM_READWRITE(YM2610_status_port_0_B_r, YM2610_control_port_0_B_w)
src/mame/drivers/konamigx.c
r869r870
13281328
13291329   MDRV_INTERLEAVE(32);
13301330   MDRV_SCREEN_REFRESH_RATE(60)
1331   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))
1331   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))
13321332
13331333   MDRV_MACHINE_START(konamigx)
13341334   MDRV_MACHINE_RESET(konamigx)
src/mame/drivers/statriv2.c
r869r870
1/****************************************************************\
1/*****************************************************************
22* Status Triv Two driver by David Haywood, MooglyGuy, and Stephh *
33* Super Triv II driver by MooglyGuy                              *
44* Triv Quiz driver by MooglyGuy                                  *
r869r870
2424*     sound seems to make sense. Can someone with a PCB stomach  *
2525*     the game long enough to verify one way or the other?       *
2626*                                                                *
27\****************************************************************/
27******************************************************************
2828
29/****************************************************************\
30*                                                                *
29******************************************************************
30*      U21 U22 DSW U17                                           *
3131*                       1982 status game corp                    *
3232*                         8085  12.4 MHz                         *
3333* 8910 crt5037 8255                                              *
r869r870
4444* u1 u2 u3 u4 u5 u6 u7 u8                                        *
4545*                                                                *
4646*                                                                *
47\****************************************************************/
47******************************************************************
4848
49CTR5037 is also labelled as a TMS9937NL
50DSW is a 4 position dipswitch
4951
52U17 is a socketted 74s288 (compatible with 82s123)
53U21 is a soldered in 74s288 (compatible with 82s123)
54U22 is a soldered in 74s287 (compatible with 82s129)
55
56PROM use is unknown
57
58*/
59
60
5061#include "driver.h"
5162#include "cpu/i8085/i8085.h"
5263#include "sound/ay8910.h"
r869r870
718729   ROM_LOAD( "statuspb.u6", 0x0a000, 0x02000, CRC(7ee1cea0) SHA1(00ef768524e54890ebd1fdb3dd52d0080a18fc03) )
719730   ROM_LOAD( "statuspb.u7", 0x0c000, 0x02000, CRC(121d6976) SHA1(2e4da8f2c3620c8f46fd4951551b0747b3c38caf) )
720731   ROM_LOAD( "statuspb.u8", 0x0e000, 0x02000, CRC(5080df10) SHA1(b5cb0868d844bbb598159177fd5ce65ff3f18eda) )
732
733   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
734   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, BAD_DUMP CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted, not verified the same! */
735   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
736   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
721737ROM_END
722738
723739ROM_START( statriv4 )
r869r870
738754   ROM_LOAD( "triv4.u46",    0x0a000, 0x02000, CRC(fa53158a) SHA1(3814b60d999ad234f6c08ace2c84893fcb745a3c) )
739755   ROM_LOAD( "triv4.u47",    0x0c000, 0x02000, CRC(fddbb113) SHA1(a88a1afdb1be035fc71929ef0236b61b8403cc1b) )
740756   ROM_LOAD( "triv4.u48",    0x0e000, 0x02000, CRC(30ca8393) SHA1(dfb2f16f9b014d23793efe085be1ed75342c00dc) )
757
758   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
759   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, BAD_DUMP CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted, not verified the same! */
760   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
761   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
741762ROM_END
742763
743764ROM_START( trivquiz )
r869r870
758779   ROM_LOAD( "qmt16.rom",    0x0a000, 0x02000, CRC(1d2ecf1d) SHA1(1d833b57bf4b3ccb3dc60307641ef9476289fe07) )
759780   ROM_LOAD( "qmt17.rom",    0x0c000, 0x02000, CRC(01840f9c) SHA1(d9b4f7f931657d4e16cf981d887508fd1db5e4c0) )
760781   ROM_LOAD( "qmt18.rom",    0x0e000, 0x02000, CRC(004a9480) SHA1(7adff194a1549fa42577f969706aab6bb6a58851) )
782
783   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
784   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, BAD_DUMP CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted, not verified the same! */
785   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
786   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
761787ROM_END
762788
763789ROM_START( supertr2 )
r869r870
779805   ROM_LOAD( "astq2-6.rom", 0x28000, 0x08000, CRC(c0f61b5f) SHA1(65398f9d22fce95c4146a2cb8174edd6b336b9e4) )
780806   ROM_LOAD( "astq2-7.rom", 0x30000, 0x08000, CRC(72461937) SHA1(2f95a708b24f56d9b1293a88aa53eb4a32f89869) )
781807   ROM_LOAD( "astq2-8.rom", 0x38000, 0x08000, CRC(cd2674d5) SHA1(7fb6513172ffe8e3b9e0f4dc9ecdb42d954b1ff0) )
808
809   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
810   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, BAD_DUMP CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted, not verified the same! */
811   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
812   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
782813ROM_END
783814
784815ROM_START( supertr3 )
r869r870
800831   ROM_LOAD( "triv3.u46",    0x28000, 0x08000, CRC(86cffc1f) SHA1(06557bcc51b415349e5f7440f753ef2f66dcfde2) )
801832   ROM_LOAD( "triv3.u47",    0x30000, 0x08000, CRC(f316803c) SHA1(31edb97bad7083ed32e0ee75256bc7d488fa234b) )
802833   ROM_LOAD( "triv3.u48",    0x38000, 0x08000, CRC(1a99b268) SHA1(6369c79f645962b4a2f85b18e9d93c3cc65defc1) )
834
835   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
836   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, BAD_DUMP CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted, not verified the same! */
837   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
838   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
803839ROM_END
804840
805841ROM_START( quaquiz2 )
r869r870
821857   ROM_LOAD( "gst.06",    0x28000, 0x08000, CRC(18855c6d) SHA1(0454eaebc42838c75e7748f8e2c2eb5f58380f51) )
822858   ROM_LOAD( "gst.07",    0x30000, 0x08000, CRC(1270d5bd) SHA1(826162e37c233639b1f545f4d215a4bf9fcba065) )
823859   ROM_LOAD( "gst.08",    0x38000, 0x08000, CRC(64a54915) SHA1(13bbdff3617ec14595bc72891f56d327d76f539d) )
860
861   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
862   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, BAD_DUMP CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted, not verified the same! */
863   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
864   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
824865ROM_END
825866
826867ROM_START( hangman )
r869r870
842883   ROM_LOAD( "aux_2764.6",   0x12000, 0x2000, CRC(d1732f3b) SHA1(c4e862bd98f237e1d2ecad430226cba6aba4ebb8) )
843884   ROM_LOAD( "aux_2764.7",   0x14000, 0x2000, CRC(e51d45b8) SHA1(7cd0ced0245dbd55a225182e43b89d55d8d33197) )
844885
845   ROM_REGION( 0x0020, REGION_PROMS, 0 ) /* unknown */
846   ROM_LOAD( "main_74s288.u17", 0x0000, 0x0020, CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) )
886   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
887   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted */
888   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
889   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
847890ROM_END
848891
849892ROM_START( sextriv )
r869r870
864907   ROM_LOAD( "sex6.bin",     0x0a000, 0x2000, CRC(02653058) SHA1(e830562d9b720f49fbb0079a00799958245e1d96) )
865908   ROM_LOAD( "sex7.bin",     0x0c000, 0x2000, CRC(4bddbe3c) SHA1(391012de04e8a3638fac6f173a81cf1f86d8f751) )
866909   ROM_LOAD( "sex8.bin",     0x0e000, 0x2000, CRC(d4221641) SHA1(d2c0f66c4fe3a77c73cdcc71bbd8c48342d29431) )
910
911   ROM_REGION( 0x0140, REGION_PROMS, 0 ) /* unknown */
912   ROM_LOAD( "dm74s288.u17", 0x0000, 0x0020, CRC(63b8a63e) SHA1(d59ad84edd583f7befce73b79e12dfb58a204c4f) ) /* Socketted */
913   ROM_LOAD( "dm74s288.u21", 0x0020, 0x0020, CRC(853d6172) SHA1(4aaab0faeaa1a07ee883fbed021f8dcd7e0ba549) ) /* Soldered in (Color?) */
914   ROM_LOAD( "dm74s282.u22", 0x0040, 0x0100, CRC(0421b8e0) SHA1(8b786eed86397a1463ad37b9b011edf83d76dd63) ) /* Soldered in */
867915ROM_END
868916
869917GAME( 1984, hangman,  0, hangman,  hangman,  0, ROT0, "Status Games", "Hangman", 0 )
src/mame/drivers/ttchamp.c
r869r870
4242*/
4343
4444#include "driver.h"
45static UINT8*peno_vram;
45static UINT16 *peno_vram;
4646
4747
4848VIDEO_START(ttchamp)
r869r870
7373   {
7474      for(x=0;x<xxx;x++)
7575      {
76         /*if(hotblock_port0&0x40)*/*BITMAP_ADDR16(bitmap, y, x) = peno_vram[count]+0x300;
76         /*if(hotblock_port0&0x40)*/*BITMAP_ADDR16(bitmap, y, x) = ((UINT8 *)peno_vram)[BYTE_XOR_LE(count)]+0x300;
7777            count++;
7878        }
7979    }
8080    return 0;
8181}
8282
83static UINT8 paloff_l;
84static UINT8 paloff_h;
85static UINT8 paldat_l;
86static UINT8 paldat_h;
83static UINT16 paloff;
8784
88
89static WRITE8_HANDLER( paloff_l_w )
85static WRITE16_HANDLER( paloff_w )
9086{
91    paloff_l = data;
87    COMBINE_DATA(&paloff);
9288}
9389
94static WRITE8_HANDLER( paloff_h_w )
90static WRITE16_HANDLER( pcup_prgbank_w )
9591{
96    paloff_h = data;
97}
98
99static WRITE8_HANDLER( pcup_prgbank_w )
100{
10192    int bank;
10293    UINT8 *ROM1 = memory_region(REGION_USER1);
10394
104    bank = (data>>4) &0x07;
105    memory_set_bankptr(2,&ROM1[0x80000*(bank)]);
106
95    if (ACCESSING_LSB)
96    {
97        bank = (data>>4) &0x07;
98        memory_set_bankptr(2,&ROM1[0x80000*(bank)]);
99    }
107100}
108101
109
110static WRITE8_HANDLER( paldat_l_w )
102static WRITE16_HANDLER( paldat_w )
111103{
112    paldat_l = data;
104    palette_set_color_rgb(Machine,paloff & 0x7fff,pal5bit(data>>0),pal5bit(data>>5),pal5bit(data>>10));
113105}
114106
115static WRITE8_HANDLER( paldat_h_w )
107static READ16_HANDLER( peno_rand )
116108{
117    int paldat;
118    int paloff;
119
120    paldat_h = data;
121
122    paldat = (paldat_h <<8)|paldat_l;
123    paloff = (paloff_h <<8)|paloff_l;
124    paloff &=0x7fff;
125
126    palette_set_color_rgb(Machine,paloff,pal5bit(paldat>>0),pal5bit(paldat>>5),pal5bit(paldat>>10));
109    return 0xffff;// mame_rand(Machine);
127110}
128111
129static READ8_HANDLER( peno_rand )
112static READ16_HANDLER( peno_rand2 )
130113{
131    return 0xff;// mame_rand(Machine);
132}
133
134static READ8_HANDLER( peno_rand2 )
135{
136114    return mame_rand(Machine);
137115}
138116
139static ADDRESS_MAP_START( ttchamp_map, ADDRESS_SPACE_PROGRAM, 8 )
117static ADDRESS_MAP_START( ttchamp_map, ADDRESS_SPACE_PROGRAM, 16 )
140118    AM_RANGE(0x00000, 0x0ffff) AM_RAM
141119    AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE(&peno_vram)
142    AM_RANGE(0x20000, 0x7ffff) AM_READ(MRA8_BANK1) // ?
143    AM_RANGE(0x80000, 0xfffff) AM_READ(MRA8_BANK2) // ?
120    AM_RANGE(0x20000, 0x7ffff) AM_READ(MRA16_BANK1) // ?
121    AM_RANGE(0x80000, 0xfffff) AM_READ(MRA16_BANK2) // ?
144122ADDRESS_MAP_END
145123
146static ADDRESS_MAP_START( ttchamp_io, ADDRESS_SPACE_IO, 8 )
147    AM_RANGE(0x0000, 0x0000) AM_WRITE(MWA8_NOP)
124static ADDRESS_MAP_START( ttchamp_io, ADDRESS_SPACE_IO, 16 )
125    AM_RANGE(0x0000, 0x0001) AM_WRITE(MWA16_NOP)
148126
149    AM_RANGE(0x0002, 0x0002) AM_READ(input_port_0_r)
150    AM_RANGE(0x0003, 0x0003) AM_READ(input_port_1_r)
151    AM_RANGE(0x0004, 0x0004) AM_READ(input_port_2_r)
152    AM_RANGE(0x0005, 0x0005) AM_READ(input_port_3_r)
127    AM_RANGE(0x0002, 0x0003) AM_READ(input_port_0_word_r)
128    AM_RANGE(0x0004, 0x0005) AM_READ(input_port_1_word_r)
153129
154//  AM_RANGE(0x0018, 0x0018) AM_READ(peno_rand2)
155//  AM_RANGE(0x001e, 0x001e) AM_READ(peno_rand2)
130//  AM_RANGE(0x0018, 0x0019) AM_READ(peno_rand2)
131//  AM_RANGE(0x001e, 0x001f) AM_READ(peno_rand2)
156132
157    AM_RANGE(0x0008, 0x0008) AM_WRITE(paldat_l_w)
158    AM_RANGE(0x0009, 0x0009) AM_WRITE(paldat_h_w)
133    AM_RANGE(0x0008, 0x0009) AM_WRITE(paldat_w)
134    AM_RANGE(0x000a, 0x000b) AM_WRITE(paloff_w)
159135
160    AM_RANGE(0x000a, 0x000a) AM_WRITE(paloff_l_w)
161    AM_RANGE(0x000b, 0x000b) AM_WRITE(paloff_h_w)
162
163136//  AM_RANGE(0x0010, 0x0010) AM_WRITE(pcup_prgbank_w)
164    AM_RANGE(0x0010, 0x0010) AM_WRITE(MWA8_NOP)
165    AM_RANGE(0x0011, 0x0011) AM_WRITE(MWA8_NOP)
137    AM_RANGE(0x0010, 0x0011) AM_WRITE(MWA16_NOP)
166138
167    AM_RANGE(0x0020, 0x0020) AM_WRITE(MWA8_NOP)
168    AM_RANGE(0x0021, 0x0021) AM_WRITE(MWA8_NOP)
139    AM_RANGE(0x0020, 0x0021) AM_WRITE(MWA16_NOP)
169140
170
171    AM_RANGE(0x0034, 0x0034) AM_READ(peno_rand) AM_WRITE(MWA8_NOP)
172    AM_RANGE(0x0035, 0x0035) AM_READ(peno_rand)
173
141    AM_RANGE(0x0034, 0x0035) AM_READ(peno_rand) AM_WRITE(MWA16_NOP)
174142ADDRESS_MAP_END
175143
176144
177145
178146INPUT_PORTS_START(ttchamp)
179147    PORT_START  /* 8bit */
180   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
182   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
183   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
184   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
185   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
186   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
187   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
188   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
189   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
190   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
191   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
192   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
193   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
195   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
196   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
197   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
198   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
199   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
148   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
149   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
150   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
151   PORT_DIPSETTING(    0x0004, DEF_STR( Off ) )
152   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
153   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
154   PORT_DIPSETTING(    0x0008, DEF_STR( Off ) )
155   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
156   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
157   PORT_DIPSETTING(    0x0010, DEF_STR( Off ) )
158   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
159   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
160   PORT_DIPSETTING(    0x0020, DEF_STR( Off ) )
161   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
162   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
163   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
164   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
165   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
166   PORT_DIPSETTING(    0x0080, DEF_STR( Off ) )
167   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
168   PORT_DIPNAME( 0x0100, 0x0100, "0x000003" )
169   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
170   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
171   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
172   PORT_DIPSETTING(    0x0200, DEF_STR( Off ) )
173   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
174   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
175   PORT_DIPSETTING(    0x0400, DEF_STR( Off ) )
176   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
177   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
178   PORT_DIPSETTING(    0x0800, DEF_STR( Off ) )
179   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
180   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
181   PORT_DIPSETTING(    0x1000, DEF_STR( Off ) )
182   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
183   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
184   PORT_DIPSETTING(    0x2000, DEF_STR( Off ) )
185   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
186   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
187   PORT_DIPSETTING(    0x4000, DEF_STR( Off ) )
188   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
189   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
190   PORT_DIPSETTING(    0x8000, DEF_STR( Off ) )
191   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
200192
201193   PORT_START   /* 8bit */
202   PORT_DIPNAME( 0x01, 0x01, "0x0003" )
203   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
204   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
205   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
206   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
207   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
208   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
209   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
210   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
211   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
212   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
213   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
214   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
215   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
216   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
217   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
218   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
219   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
220   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
221   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
222   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
223   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
224   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
225   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
195   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
196   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
197   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
198   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
199   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
200   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
201   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
202   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
203   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
204   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
205   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
206   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
207   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
208   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
209   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
226210
227   PORT_START   /* 8bit */
228   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
229   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
230   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
231   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
232   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
233   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
234   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
235   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
236
237   PORT_START   /* 8bit */
238   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
239   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
240   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
241   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
242   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
243   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
244   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
245   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
246
247211INPUT_PORTS_END
248212
249213
r869r870
277241
278242   /* hopefully this is a good dump */
279243
280   ROM_REGION( 0x200000, REGION_USER1, 0 )
244   ROM_REGION16_LE( 0x200000, REGION_USER1, 0 )
281245   ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x080000,  CRC(6a6c6d75) SHA1(3742b82462176d77732a69e142db9e6f61f25dc5) )
282246   ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x080000,  CRC(6062c0b2) SHA1(c5f0ac58c847ce2588c805f40180f2586a6477b7) )
283247   ROM_LOAD16_BYTE( "4.bin", 0x100000, 0x080000,  CRC(4388dead) SHA1(1965e4b84452b244e32c8d218aace8d287c67ec2) )
r869r870
337301ROM_START( ttchampa )
338302   /* this is from a different board */
339303
340   ROM_REGION( 0x200000, REGION_USER1, 0 )
304   ROM_REGION16_BE( 0x200000, REGION_USER1, 0 )
341305   ROM_LOAD16_BYTE( "ttennis2.bin", 0x000000, 0x080000,  CRC(b060e72c) SHA1(376e71bb4b1687fec4b719cbc5a7b25b64d159ac) )
342306   ROM_LOAD16_BYTE( "ttennis3.bin", 0x000001, 0x080000,  CRC(33e085a8) SHA1(ea6af05690b4b0803c303a3c858df10e4d907fb1) )
343307   ROM_LOAD16_BYTE( "4.bin", 0x100000, 0x080000,  CRC(4388dead) SHA1(1965e4b84452b244e32c8d218aace8d287c67ec2) )
src/mame/drivers/gberet.c
r869r870
557557   MDRV_CPU_VBLANK_INT(gberet_interrupt, 32)   // 1 IRQ + 16 NMI (generated by a custom IC)
558558
559559   MDRV_SCREEN_REFRESH_RATE(30)
560   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_30HZ_VBLANK_DURATION))
560   MDRV_SCREEN_VBLANK_TIME(DEFAULT_30HZ_VBLANK_DURATION)
561561
562562   // video hardware
563563   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/gottlieb.c
r869r870
709709   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
710710
711711   PORT_START_TAG("IN4")      /* joystick */
712   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_ROTATED
713   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_ROTATED
714   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_ROTATED
715   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_ROTATED
716   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_ROTATED PORT_COCKTAIL
717   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_ROTATED PORT_COCKTAIL
718   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_ROTATED PORT_COCKTAIL
719   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_ROTATED PORT_COCKTAIL
712   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY
713   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY
714   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY
715   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY
716   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
717   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
718   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
719   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
720720INPUT_PORTS_END
721721
722722INPUT_PORTS_START( qbertqub )
r869r870
768768   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
769769
770770   PORT_START_TAG("IN4")      /* joystick */
771   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_ROTATED
772   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_ROTATED
773   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_ROTATED
774   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_ROTATED
771   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY
772   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY
773   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY
774   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY
775775   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
776776   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
777777   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r869r870
15501550static MACHINE_DRIVER_START( gottlieb )
15511551
15521552   /* basic machine hardware */
1553   MDRV_CPU_ADD_TAG("main", I86, 5000000)   /* 5 MHz */
1553   MDRV_CPU_ADD_TAG("main", I8088, 5000000)   /* 5 MHz */
15541554   MDRV_CPU_PROGRAM_MAP(gottlieb_map,0)
15551555   MDRV_CPU_VBLANK_INT(gottlieb_interrupt,1)
15561556
r869r870
15591559   MDRV_CPU_PROGRAM_MAP(gottlieb_sound_readmem,gottlieb_sound_writemem)
15601560                        /* NMIs are triggered by the Votrax SC-01 */
15611561   MDRV_SCREEN_REFRESH_RATE(61)
1562   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1018)   /* frames per second, vblank duration */)
1562   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1018)   /* frames per second, vblank duration */)
15631563
15641564   MDRV_MACHINE_RESET(gottlieb)
15651565   MDRV_NVRAM_HANDLER(generic_1fill)
r869r870
16271627static MACHINE_DRIVER_START( gottlieb2 )
16281628
16291629   /* basic machine hardware */
1630   MDRV_CPU_ADD_TAG("main", I86, 5000000)   /* 5 MHz */
1630   MDRV_CPU_ADD_TAG("main", I8088, 5000000)   /* 5 MHz */
16311631   MDRV_CPU_PROGRAM_MAP(gottlieb_map,0)
16321632   MDRV_CPU_VBLANK_INT(gottlieb_interrupt,1)
16331633
r869r870
16401640   MDRV_CPU_PROGRAM_MAP(stooges_sound2_readmem,stooges_sound2_writemem)
16411641
16421642   MDRV_SCREEN_REFRESH_RATE(61)
1643   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1018)   /* frames per second, vblank duration */)
1643   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1018)   /* frames per second, vblank duration */)
16441644
16451645   MDRV_MACHINE_RESET(gottlieb)
16461646   MDRV_NVRAM_HANDLER(generic_1fill)
r869r870
20962096   ROM_LOAD( "bh01",   0xc000, 0x2000, CRC(7d86ab08) SHA1(26b7eb089ca3fe3f8b1531316ce8f95e33b380e5) )
20972097   ROM_LOAD( "bh00",   0xe000, 0x2000, CRC(c19ad038) SHA1(4d20ae70d8ad1eaa61cb91d7a0cff6932fce30d2) )
20982098
2099   ROM_REGION( 0x10000, REGION_CPU2, ROMREGION_ERASE00 )
2100   ROM_REGION( 0x10000, REGION_CPU3, ROMREGION_ERASE00 )
2101
20992102   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
21002103   ROM_LOAD( "bh09",   0x0000, 0x1000, CRC(8c5dfac0) SHA1(5be28f807c4eb9df76a8f7519086ae57953d8c6f) )
21012104   ROM_LOAD( "bh0a",   0x1000, 0x1000, CRC(8b8da8dc) SHA1(9f03ac0e6b6396cd44843ea394d55d79848d6a27) )
src/mame/drivers/ddragon.c
r869r870
980980   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
981981
982982   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
983   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
983   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
984984   MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */
985985
986986   MDRV_MACHINE_START(ddragon)
r869r870
10321032   MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem)
10331033
10341034   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
1035   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1035   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
10361036   MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */
10371037
10381038   MDRV_MACHINE_RESET(ddragon)
r869r870
10801080   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
10811081
10821082   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
1083   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1083   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
10841084   MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */
10851085
10861086   MDRV_MACHINE_START(ddragon)
r869r870
11291129   MDRV_CPU_PROGRAM_MAP(dd2_sound_readmem,dd2_sound_writemem)
11301130
11311131   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
1132   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1132   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
11331133   MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */
11341134
11351135   MDRV_MACHINE_RESET(ddragon2)
r869r870
11701170   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
11711171
11721172   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
1173   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1173   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
11741174
11751175   /* video hardware */
11761176   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER )
src/mame/drivers/exidy.c
r869r870
194194   AM_RANGE(0x5040, 0x507f) AM_WRITE(exidy_sprite1_ypos_w)
195195   AM_RANGE(0x5080, 0x50bf) AM_WRITE(exidy_sprite2_xpos_w)
196196   AM_RANGE(0x50c0, 0x50ff) AM_WRITE(exidy_sprite2_ypos_w)
197   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0xfc) AM_READ(port_tag_to_handler8("DSW"))
198   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0xfc) AM_READ(port_tag_to_handler8("IN0"))
197   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0xfc) AM_READ_PORT("DSW")
198   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0xfc) AM_READ_PORT("IN0")
199199   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0xfc) AM_WRITE(exidy_spriteno_w)
200200   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0xfc) AM_WRITE(exidy_sprite_enable_w)
201201   AM_RANGE(0x5103, 0x5103) AM_MIRROR(0xfc) AM_READ(exidy_interrupt_r)
202202   AM_RANGE(0x5210, 0x5212) AM_WRITE(exidy_color_w)
203   AM_RANGE(0x5213, 0x5213) AM_READ(port_tag_to_handler8("IN2"))
203   AM_RANGE(0x5213, 0x5213) AM_READ_PORT("IN2")
204204ADDRESS_MAP_END
205205
206206
r869r870
228228
229229static ADDRESS_MAP_START( fax_map, ADDRESS_SPACE_PROGRAM, 8 )
230230   AM_RANGE(0x0400, 0x07ff) AM_RAM
231   AM_RANGE(0x1a00, 0x1a00) AM_READ(port_tag_to_handler8("IN4"))
232   AM_RANGE(0x1c00, 0x1c00) AM_READ(port_tag_to_handler8("IN3"))
231   AM_RANGE(0x1a00, 0x1a00) AM_READ_PORT("IN4")
232   AM_RANGE(0x1c00, 0x1c00) AM_READ_PORT("IN3")
233233   AM_RANGE(0x2000, 0x2000) AM_WRITE(fax_bank_select_w)
234234   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK(1)
235235   AM_RANGE(0x5200, 0x520f) AM_READWRITE(pia_0_r, pia_0_w)
src/mame/drivers/hng64.c
r869r870
450450static UINT32 *hng_mainram;
451451static UINT32 *hng_cart;
452452static UINT32 *hng64_dualport;
453static UINT32 *hng64_soundram;
453static UINT16 *hng64_soundram;
454454
455455static UINT8  com_cpu_rom[0x8000] ;
456456
r869r870
924924
925925WRITE32_HANDLER( hng64_soundram_w )
926926{
927   UINT32 mem_mask32 = mem_mask;
928   UINT32 data32 = data;
929
927930   /* swap data around.. keep the v30 happy ;-) */
928   data =
929   (
930   ((data & 0xff000000) >> 24) |
931   ((data & 0x00ff0000) >> 8 ) |
932   ((data & 0x0000ff00) << 8 ) |
933   ((data & 0x000000ff) << 24)
934   );
931   data = data32 >> 16;
932   data = FLIPENDIAN_INT16(data);
933   mem_mask = mem_mask32 >> 16;
934   mem_mask = FLIPENDIAN_INT16(mem_mask);
935   COMBINE_DATA(&hng64_soundram[offset * 2 + 0]);
935936
936   /* mem mask too */
937   mem_mask =
938   (
939   ((mem_mask & 0xff000000) >> 24) |
940   ((mem_mask & 0x00ff0000) >> 8 ) |
941   ((mem_mask & 0x0000ff00) << 8 ) |
942   ((mem_mask & 0x000000ff) << 24)
943   );
944
945   COMBINE_DATA(&hng64_soundram[offset]);
937   data = data32 & 0xffff;
938   data = FLIPENDIAN_INT16(data);
939   mem_mask = mem_mask32 & 0xffff;
940   mem_mask = FLIPENDIAN_INT16(mem_mask);
941   COMBINE_DATA(&hng64_soundram[offset * 2 + 1]);
946942}
947943
948944READ32_HANDLER( hng64_soundram_r )
949945{
950   int data = hng64_soundram[offset];
946   UINT16 datalo = hng64_soundram[offset * 2 + 0];
947   UINT16 datahi = hng64_soundram[offset * 2 + 1];
951948
952   /* we had to swap it when we wrote it, we have to swap it when we read it */
953   data =
954   (
955   ((data & 0xff000000) >> 24) |
956   ((data & 0x00ff0000) >> 8 ) |
957   ((data & 0x0000ff00) << 8 ) |
958   ((data & 0x000000ff) << 24)
959   );
960
961   return data;
949   return FLIPENDIAN_INT16(datahi) | (FLIPENDIAN_INT16(datalo) << 16);
962950}
963951
964952static ADDRESS_MAP_START( hng_map, ADDRESS_SPACE_PROGRAM, 32 )
r869r870
972960   AM_RANGE(0x1F70101C, 0x1F70101F) AM_WRITE(MWA32_NOP)      // ?? often
973961   AM_RANGE(0x1F70106C, 0x1F70106F) AM_WRITE(MWA32_NOP)      // fatfur,strange
974962   AM_RANGE(0x1F70111C, 0x1F70111F) AM_WRITE(MWA32_NOP)      // irq ack
975   AM_RANGE(0x1F701204, 0x1F701207) AM_WRITE(hng_dma_start_w);
976   AM_RANGE(0x1F701214, 0x1F701217) AM_WRITE(hng_dma_dst_w);
977   AM_RANGE(0x1F701224, 0x1F701227) AM_WRITE(hng_dma_len_w);
963   AM_RANGE(0x1F701204, 0x1F701207) AM_WRITE(hng_dma_start_w)
964   AM_RANGE(0x1F701214, 0x1F701217) AM_WRITE(hng_dma_dst_w)
965   AM_RANGE(0x1F701224, 0x1F701227) AM_WRITE(hng_dma_len_w)
978966   AM_RANGE(0x1F70124C, 0x1F70124F) AM_WRITE(MWA32_NOP)      // dma related?
979967   AM_RANGE(0x1F70125C, 0x1F70125F) AM_WRITE(MWA32_NOP)      // dma related?
980968
r869r870
11361124index=00000004  pagesize=01000000  vaddr=00000000C9000000  paddr=0000000069000000  asid=00  r=0  c=2  dvg=dvg
11371125*/
11381126
1139static ADDRESS_MAP_START( hng_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
1140   AM_RANGE(0x00000, 0x3ffff) AM_READ(MRA8_BANK2)
1141   AM_RANGE(0xe0000, 0xfffff) AM_READ(MRA8_BANK1)
1127static ADDRESS_MAP_START( hng_sound_map, ADDRESS_SPACE_PROGRAM, 16 )
1128   AM_RANGE(0x00000, 0x3ffff) AM_READ(MRA16_BANK2)
1129   AM_RANGE(0xe0000, 0xfffff) AM_READ(MRA16_BANK1)
11421130ADDRESS_MAP_END
11431131
11441132
src/mame/drivers/moo.c
r869r870
635635   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
636636
637637   MDRV_SCREEN_REFRESH_RATE(60)
638   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1200))    // should give IRQ4 sufficient time to update scroll registers
638   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1200))    // should give IRQ4 sufficient time to update scroll registers
639639
640640   MDRV_MACHINE_START(moo)
641641   MDRV_MACHINE_RESET(moo)
r869r870
674674   MDRV_CPU_VBLANK_INT(moobl_interrupt, 1)
675675
676676   MDRV_SCREEN_REFRESH_RATE(60)
677   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1200)) // should give IRQ4 sufficient time to update scroll registers
677   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1200)) // should give IRQ4 sufficient time to update scroll registers
678678
679679   MDRV_MACHINE_START(moo)
680680   MDRV_MACHINE_RESET(moo)
src/mame/drivers/eolith16.c
r869r870
168168   MDRV_CPU_VBLANK_INT(eolith_speedup,262)
169169
170170   MDRV_SCREEN_REFRESH_RATE(60)
171   MDRV_SCREEN_VBLANK_TIME(0)
171   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
172172
173173   MDRV_NVRAM_HANDLER(eolith16_eeprom)
174174
src/mame/drivers/segald.c
r869r870
222222
223223   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(astron_OBJ_read,astron_OBJ_write) AM_BASE(&obj_RAM)   /* OBJ according to the schematics (sprite) */
224224   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(astron_DISC_read,astron_DISC_write)               /* DISC interface according to schematics */
225   AM_RANGE(0xd000, 0xd000) AM_READ(port_tag_to_handler8("DSWA"))                        /* SW bank 2 (DIPs) */
226   AM_RANGE(0xd001, 0xd001) AM_READ(port_tag_to_handler8("DSWB"))                        /* SW bank 3 (DIPs) */
227   AM_RANGE(0xd002, 0xd002) AM_READ(port_tag_to_handler8("IN0"))                        /* SW bank 0 (IO) */
228   AM_RANGE(0xd003, 0xd003) AM_READ(port_tag_to_handler8("IN1"))                        /* SW bank 1 (IO) */
225   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("DSWA")                        /* SW bank 2 (DIPs) */
226   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("DSWB")                        /* SW bank 3 (DIPs) */
227   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN0")                        /* SW bank 0 (IO) */
228   AM_RANGE(0xd003, 0xd003) AM_READ_PORT("IN1")                        /* SW bank 1 (IO) */
229229   AM_RANGE(0xd800, 0xd803) AM_READWRITE(astron_OUT_read, astron_OUT_write) AM_BASE(&out_RAM)   /* OUT according to schematics (output port) */
230230   AM_RANGE(0xe000, 0xe1ff) AM_READWRITE(astron_COLOR_read, astron_COLOR_write) AM_BASE(&color_RAM) /* COLOR according to the schematics */
231231   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(astron_FIX_write)   AM_BASE(&fix_RAM)                  /* FIX according to schematics (characters) */
src/mame/drivers/hotblock.c
r869r870
185185
186186static MACHINE_DRIVER_START( hotblock )
187187   /* basic machine hardware */
188   MDRV_CPU_ADD(I88, 10000000)
188   MDRV_CPU_ADD(I8088, 10000000)
189189   MDRV_CPU_PROGRAM_MAP(hotblock_map, 0)
190190   MDRV_CPU_IO_MAP(hotblock_io,0)
191191   MDRV_CPU_VBLANK_INT(hotblocks_irq,1)
src/mame/drivers/suprloco.c
r869r870
195195   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)         /* NMIs are caused by the main CPU */
196196
197197   MDRV_SCREEN_REFRESH_RATE(60)
198   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(5000))
198   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(5000))
199199
200200   /* video hardware */
201201   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/m92.c
r869r870
4444        * Scrolling water in Undercover Cops
4545        * Score display in R-Type Leo
4646
47    These are slow to emulate, and can be turned on/off by pressing
48    F1 - they are on by default.
49    Todo:  Raster effects don't work in flipscreen mode.
50
5147Glitch list!
5248
5349    Gunforce:
r869r870
193189*****************************************************************************/
194190
195191#include "driver.h"
196#include "m92.h"
192#include "includes/m92.h"
193#include "drivers/m92.h"
197194#include "machine/irem_cpu.h"
198195#include "sound/2151intf.h"
199196#include "sound/iremga20.h"
r869r870
201198static UINT8 irqvector;
202199static UINT16 sound_status;
203200static UINT32 bankaddress;
201static mame_timer *scanline_timer;
204202
205static int m92_irq_vectorbase;
206static UINT8 *m92_ram,*m92_snd_ram;
203static UINT8 m92_irq_vectorbase;
207204
208205#define M92_IRQ_0 ((m92_irq_vectorbase+0)/4)  /* VBL interrupt*/
209206#define M92_IRQ_1 ((m92_irq_vectorbase+4)/4)  /* Sprite buffer complete interrupt */
210207#define M92_IRQ_2 ((m92_irq_vectorbase+8)/4)  /* Raster interrupt */
211208#define M92_IRQ_3 ((m92_irq_vectorbase+12)/4) /* Sound cpu interrupt */
212209
213#define M92_SCANLINES   256
214210
215/* From video/m92.c */
216WRITE8_HANDLER( m92_spritecontrol_w );
217WRITE8_HANDLER( m92_videocontrol_w );
218READ8_HANDLER( m92_paletteram_r );
219WRITE8_HANDLER( m92_paletteram_w );
220READ8_HANDLER( m92_vram_r );
221WRITE8_HANDLER( m92_vram_w );
222WRITE8_HANDLER( m92_pf1_control_w );
223WRITE8_HANDLER( m92_pf2_control_w );
224WRITE8_HANDLER( m92_pf3_control_w );
225WRITE8_HANDLER( m92_master_control_w );
226VIDEO_START( m92 );
227VIDEO_UPDATE( m92 );
211static TIMER_CALLBACK( m92_scanline_interrupt );
228212
229extern int m92_raster_irq_position,m92_raster_enable;
230extern UINT8 *m92_vram_data,*m92_spritecontrol;
231
232extern int m92_sprite_buffer_busy,m92_game_kludge;
233
234213/*****************************************************************************/
235214
236215static void set_m92_bank(void)
r869r870
245224   state_save_register_global(sound_status);
246225   state_save_register_global(bankaddress);
247226   state_save_register_func_postload(set_m92_bank);
227
228   scanline_timer = mame_timer_alloc(m92_scanline_interrupt);
248229}
249230
231static MACHINE_RESET( m92 )
232{
233   mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_never);
234}
250235
251236/*****************************************************************************/
252237
253static READ8_HANDLER( m92_eeprom_r )
238static TIMER_CALLBACK( m92_scanline_interrupt )
254239{
240   int scanline = param;
241
242   /* raster interrupt */
243   if (scanline == m92_raster_irq_position)
244   {
245      video_screen_update_partial(0, scanline);
246      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_2);
247   }
248
249   /* VBLANK interrupt */
250   else if (scanline == machine->screen[0].visarea.max_y + 1)
251   {
252      video_screen_update_partial(0, scanline);
253      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_0);
254   }
255
256   /* adjust for next scanline */
257   if (++scanline >= machine->screen[0].height)
258      scanline = 0;
259   mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, time_never);
260}
261
262/*****************************************************************************/
263
264static READ16_HANDLER( m92_eeprom_r )
265{
255266   UINT8 *RAM = memory_region(REGION_USER1);
256267//  logerror("%05x: EEPROM RE %04x\n",activecpu_get_pc(),offset);
257   return RAM[offset/2];
268   return RAM[offset] | 0xff00;
258269}
259270
260static WRITE8_HANDLER( m92_eeprom_w )
271static WRITE16_HANDLER( m92_eeprom_w )
261272{
262273   UINT8 *RAM = memory_region(REGION_USER1);
263274//  logerror("%05x: EEPROM WR %04x\n",activecpu_get_pc(),offset);
264   RAM[offset/2]=data;
275   if (ACCESSING_LSB)
276      RAM[offset] = data;
265277}
266278
267static WRITE8_HANDLER( m92_coincounter_w )
279static WRITE16_HANDLER( m92_coincounter_w )
268280{
269   if (offset==0) {
270      coin_counter_w(0,data & 0x01);
271      coin_counter_w(1,data & 0x02);
281   if (ACCESSING_LSB)
282   {
283      coin_counter_w(0, data & 0x01);
284      coin_counter_w(1, data & 0x02);
272285      /* Bit 0x8 is Motor(?!), used in Hook, In The Hunt, UCops */
273286      /* Bit 0x8 is Memcard related in RTypeLeo */
274287      /* Bit 0x40 set in Blade Master test mode input check */
275288   }
276289}
277290
278static WRITE8_HANDLER( m92_bankswitch_w )
291static WRITE16_HANDLER( m92_bankswitch_w )
279292{
280   if (offset==1) return; /* Unused top byte */
281   bankaddress = 0x100000 + ((data&0x7)*0x10000);
282   set_m92_bank();
293   if (ACCESSING_LSB)
294   {
295      bankaddress = 0x100000 + ((data & 0x7) * 0x10000);
296      set_m92_bank();
297   }
283298}
284299
285static READ8_HANDLER( m92_port_4_r )
300static UINT32 m92_sprite_busy_r(void *param)
286301{
287   return readinputport(4) | m92_sprite_buffer_busy; /* Bit 7 low indicates busy */
302   return m92_sprite_buffer_busy;
288303}
289304
290305/*****************************************************************************/
r869r870
303318   }
304319
305320   if (irqvector & 0x2)      /* YM2151 has precedence */
306      cpunum_set_input_line_vector(1,0,0x18);
321      cpunum_set_input_line_vector(1, 0, 0x18);
307322   else if (irqvector & 0x1)   /* V30 */
308      cpunum_set_input_line_vector(1,0,0x19);
323      cpunum_set_input_line_vector(1, 0, 0x19);
309324
310325   if (irqvector == 0)   /* no IRQs pending */
311      cpunum_set_input_line(1,0,CLEAR_LINE);
326      cpunum_set_input_line(1, 0, CLEAR_LINE);
312327   else   /* IRQ pending */
313      cpunum_set_input_line(1,0,ASSERT_LINE);
328      cpunum_set_input_line(1, 0, ASSERT_LINE);
314329}
315330
316static WRITE8_HANDLER( m92_soundlatch_w )
331static WRITE16_HANDLER( m92_soundlatch_w )
317332{
318   if (offset==0)
319   {
320      timer_call_after_resynch(V30_ASSERT,setvector_callback);
321      soundlatch_w(0,data);
322//      logerror("soundlatch_w %02x\n",data);
323   }
333   timer_call_after_resynch(V30_ASSERT, setvector_callback);
334   soundlatch_w(0, data & 0xff);
324335}
325336
326static READ8_HANDLER( m92_sound_status_r )
337static READ16_HANDLER( m92_sound_status_r )
327338{
328339//logerror("%06x: read sound status\n",activecpu_get_pc());
329   if (offset == 0)
330      return sound_status&0xff;
331   return sound_status>>8;
340   return sound_status;
332341}
333342
334static READ8_HANDLER( m92_soundlatch_r )
343static READ16_HANDLER( m92_soundlatch_r )
335344{
336   if (offset == 0)
337   {
338      int res = soundlatch_r(offset);
339//      logerror("soundlatch_r %02x\n",res);
340      return res;
341   }
342   else return 0xff;
345   return soundlatch_r(offset) | 0xff00;
343346}
344347
345static WRITE8_HANDLER( m92_sound_irq_ack_w )
348static WRITE16_HANDLER( m92_sound_irq_ack_w )
346349{
347   if (offset == 0)
348      timer_call_after_resynch(V30_CLEAR,setvector_callback);
350   timer_call_after_resynch(V30_CLEAR, setvector_callback);
349351}
350352
351static WRITE8_HANDLER( m92_sound_status_w )
353static WRITE16_HANDLER( m92_sound_status_w )
352354{
353   if (offset == 0) {
354      sound_status = data | (sound_status&0xff00);
355      cpunum_set_input_line_and_vector(0,0,HOLD_LINE,M92_IRQ_3);
356   }
357   else
358      sound_status = (data<<8) | (sound_status&0xff);
355   COMBINE_DATA(&sound_status);
356   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_3);
359357}
360358
361359/*****************************************************************************/
362360
363static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
364   AM_RANGE(0x00000, 0x9ffff) AM_READ(MRA8_ROM)
365   AM_RANGE(0xa0000, 0xbffff) AM_READ(MRA8_BANK1)
366   AM_RANGE(0xc0000, 0xcffff) AM_READ(MRA8_BANK2) /* Mirror of rom:  Used by In The Hunt as protection */
367   AM_RANGE(0xd0000, 0xdffff) AM_READ(m92_vram_r)
368   AM_RANGE(0xe0000, 0xeffff) AM_READ(MRA8_RAM)
369   AM_RANGE(0xf8000, 0xf87ff) AM_READ(MRA8_RAM)
370   AM_RANGE(0xf8800, 0xf8fff) AM_READ(m92_paletteram_r)
371   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
372ADDRESS_MAP_END
373
374static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
375   AM_RANGE(0x00000, 0xbffff) AM_WRITE(MWA8_ROM)
376   AM_RANGE(0xd0000, 0xdffff) AM_WRITE(m92_vram_w) AM_BASE(&m92_vram_data)
377   AM_RANGE(0xe0000, 0xeffff) AM_WRITE(MWA8_RAM) AM_BASE(&m92_ram) /* System ram */
378   AM_RANGE(0xf8000, 0xf87ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
379   AM_RANGE(0xf8800, 0xf8fff) AM_WRITE(m92_paletteram_w)
361/* appears to be an earlier board */
362static ADDRESS_MAP_START( lethalth_map, ADDRESS_SPACE_PROGRAM, 16 )
363   AM_RANGE(0x00000, 0x7ffff) AM_ROM
364   AM_RANGE(0x80000, 0x8ffff) AM_READWRITE(MRA16_RAM, m92_vram_w) AM_BASE(&m92_vram_data)
365   AM_RANGE(0xe0000, 0xeffff) AM_RAM /* System ram */
366   AM_RANGE(0xf8000, 0xf87ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
367   AM_RANGE(0xf8800, 0xf8fff) AM_READWRITE(m92_paletteram_r, m92_paletteram_w)
380368   AM_RANGE(0xf9000, 0xf900f) AM_WRITE(m92_spritecontrol_w) AM_BASE(&m92_spritecontrol)
381369   AM_RANGE(0xf9800, 0xf9801) AM_WRITE(m92_videocontrol_w)
382   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
370   AM_RANGE(0xffff0, 0xfffff) AM_ROM
383371ADDRESS_MAP_END
384372
385static ADDRESS_MAP_START( lethalth_readmem, ADDRESS_SPACE_PROGRAM, 8 ) /* Same as above but with different VRAM addressing PAL */
386   AM_RANGE(0x00000, 0x7ffff) AM_READ(MRA8_ROM)
387   AM_RANGE(0x80000, 0x8ffff) AM_READ(m92_vram_r)
388   AM_RANGE(0xe0000, 0xeffff) AM_READ(MRA8_RAM)
389   AM_RANGE(0xf8000, 0xf87ff) AM_READ(MRA8_RAM)
390   AM_RANGE(0xf8800, 0xf8fff) AM_READ(paletteram_r)
391   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
392ADDRESS_MAP_END
393
394static ADDRESS_MAP_START( lethalth_writemem, ADDRESS_SPACE_PROGRAM, 8 )
395   AM_RANGE(0x00000, 0x7ffff) AM_WRITE(MWA8_ROM)
396   AM_RANGE(0x80000, 0x8ffff) AM_WRITE(m92_vram_w) AM_BASE(&m92_vram_data)
397   AM_RANGE(0xe0000, 0xeffff) AM_WRITE(MWA8_RAM) AM_BASE(&m92_ram) /* System ram */
398   AM_RANGE(0xf8000, 0xf87ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
399   AM_RANGE(0xf8800, 0xf8fff) AM_WRITE(m92_paletteram_w)
373static ADDRESS_MAP_START( m92_map, ADDRESS_SPACE_PROGRAM, 16 )
374   AM_RANGE(0x00000, 0x9ffff) AM_ROM
375   AM_RANGE(0xa0000, 0xbffff) AM_ROMBANK(1)
376   AM_RANGE(0xc0000, 0xcffff) AM_ROMBANK(2)   /* Mirror of rom:  Used by In The Hunt as protection */
377   AM_RANGE(0xd0000, 0xdffff) AM_READWRITE(MRA16_RAM, m92_vram_w) AM_BASE(&m92_vram_data)
378   AM_RANGE(0xe0000, 0xeffff) AM_RAM /* System ram */
379   AM_RANGE(0xf8000, 0xf87ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
380   AM_RANGE(0xf8800, 0xf8fff) AM_READWRITE(m92_paletteram_r, m92_paletteram_w)
400381   AM_RANGE(0xf9000, 0xf900f) AM_WRITE(m92_spritecontrol_w) AM_BASE(&m92_spritecontrol)
401382   AM_RANGE(0xf9800, 0xf9801) AM_WRITE(m92_videocontrol_w)
402   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
383   AM_RANGE(0xffff0, 0xfffff) AM_ROM
403384ADDRESS_MAP_END
404385
405static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
406   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r) /* Player 1 */
407   AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r) /* Player 2 */
408   AM_RANGE(0x02, 0x02) AM_READ(m92_port_4_r)   /* Coins & VBL */
409   AM_RANGE(0x03, 0x03) AM_READ(input_port_7_r) /* Dip 3 */
410   AM_RANGE(0x04, 0x04) AM_READ(input_port_6_r) /* Dip 2 */
411   AM_RANGE(0x05, 0x05) AM_READ(input_port_5_r) /* Dip 1 */
412   AM_RANGE(0x06, 0x06) AM_READ(input_port_2_r) /* Player 3 */
413   AM_RANGE(0x07, 0x07) AM_READ(input_port_3_r)   /* Player 4 */
386static ADDRESS_MAP_START( m92_portmap, ADDRESS_SPACE_IO, 16 )
387   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r)    /* Player 1/2 */
388   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r)   /* Coins & VBL, DIP3 */
389   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r)   /* Dip 2,1 */
390   AM_RANGE(0x06, 0x07) AM_READ(input_port_3_word_r)    /* Player 3/4 */
414391   AM_RANGE(0x08, 0x09) AM_READ(m92_sound_status_r)   /* answer from sound CPU */
415ADDRESS_MAP_END
416
417static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
418392   AM_RANGE(0x00, 0x01) AM_WRITE(m92_soundlatch_w)
419393   AM_RANGE(0x02, 0x03) AM_WRITE(m92_coincounter_w)
420394   AM_RANGE(0x20, 0x21) AM_WRITE(m92_bankswitch_w)
421   AM_RANGE(0x40, 0x43) AM_WRITE(MWA8_NOP) /* Interrupt controller, only written to at bootup */
395   AM_RANGE(0x40, 0x43) AM_WRITE(MWA16_NOP) /* Interrupt controller, only written to at bootup */
422396   AM_RANGE(0x80, 0x87) AM_WRITE(m92_pf1_control_w)
423397   AM_RANGE(0x88, 0x8f) AM_WRITE(m92_pf2_control_w)
424398   AM_RANGE(0x90, 0x97) AM_WRITE(m92_pf3_control_w)
r869r870
428402
429403/******************************************************************************/
430404
431static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
432   AM_RANGE(0x00000, 0x1ffff) AM_READ(MRA8_ROM)
433   AM_RANGE(0xa0000, 0xa3fff) AM_READ(MRA8_RAM)
434   AM_RANGE(0xa8000, 0xa803f) AM_READ(IremGA20_r)
435   AM_RANGE(0xa8042, 0xa8043) AM_READ(YM2151_status_port_0_r)
436   AM_RANGE(0xa8044, 0xa8045) AM_READ(m92_soundlatch_r)
437   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
438ADDRESS_MAP_END
439
440static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
441   AM_RANGE(0x00000, 0x1ffff) AM_WRITE(MWA8_ROM)
442   AM_RANGE(0x9ff00, 0x9ffff) AM_WRITE(MWA8_NOP) /* Irq controller? */
443   AM_RANGE(0xa0000, 0xa3fff) AM_WRITE(MWA8_RAM) AM_BASE(&m92_snd_ram)
444   AM_RANGE(0xa8000, 0xa803f) AM_WRITE(IremGA20_w)
445   AM_RANGE(0xa8040, 0xa8041) AM_WRITE(YM2151_register_port_0_w)
446   AM_RANGE(0xa8042, 0xa8043) AM_WRITE(YM2151_data_port_0_w)
447   AM_RANGE(0xa8044, 0xa8045) AM_WRITE(m92_sound_irq_ack_w)
405static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
406   AM_RANGE(0x00000, 0x1ffff) AM_ROM
407   AM_RANGE(0x9ff00, 0x9ffff) AM_WRITE(MWA16_NOP) /* Irq controller? */
408   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
409   AM_RANGE(0xa8000, 0xa803f) AM_READWRITE(IremGA20_r, IremGA20_w)
410   AM_RANGE(0xa8040, 0xa8041) AM_WRITE(YM2151_register_port_0_lsb_w)
411   AM_RANGE(0xa8042, 0xa8043) AM_READWRITE(YM2151_status_port_0_lsb_r, YM2151_data_port_0_lsb_w)
412   AM_RANGE(0xa8044, 0xa8045) AM_READWRITE(m92_soundlatch_r, m92_sound_irq_ack_w)
448413   AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m92_sound_status_w)
449   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
414   AM_RANGE(0xffff0, 0xfffff) AM_ROM
450415ADDRESS_MAP_END
451416
452417/******************************************************************************/
453418
454INPUT_PORTS_START( bmaster )
455   IREM_JOYSTICK_1_2(1)
456   IREM_JOYSTICK_1_2(2)
457   IREM_PORT_UNUSED
458   IREM_PORT_UNUSED
459   IREM_COINS
460   IREM_SYSTEM_DIPSWITCH
419static INPUT_PORTS_START( m92_2player )
420   PORT_START_TAG("JOY12")
421   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
422   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
423   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
424   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
425   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED )
426   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
427   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
428   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
429   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
430   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
431   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
432   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
433   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED )
434   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED )
435   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
436   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
461437
462   PORT_START   /* Dip switch bank 1 */
463   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
464   PORT_DIPSETTING(    0x00, "1" )
465   PORT_DIPSETTING(    0x03, "2" )
466   PORT_DIPSETTING(    0x02, "3" )
467   PORT_DIPSETTING(    0x01, "4" )
468   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
469   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
470   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
471   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
472   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
473   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
474   PORT_DIPSETTING(    0x10, "300k only" )
475   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
476   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
477   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
478   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
479   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
480   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
481   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
482   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
438   PORT_START_TAG("COINS_DIPS")
439   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
440   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
441   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
442   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
443   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
444   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE )
445   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
446   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(m92_sprite_busy_r, 0)
447   /* DIP switch bank 3 */
448   PORT_DIPUNKNOWN( 0x0100, 0x0100 )
449   PORT_DIPUNKNOWN( 0x0200, 0x0200 )
450   PORT_DIPUNKNOWN( 0x0400, 0x0400 )
451   PORT_DIPUNKNOWN( 0x0800, 0x0800 )
452   PORT_DIPUNKNOWN( 0x1000, 0x1000 )
453   PORT_DIPUNKNOWN( 0x2000, 0x2000 )
454   PORT_DIPUNKNOWN( 0x4000, 0x4000 )
455   PORT_DIPUNKNOWN( 0x8000, 0x8000 )
483456
457   PORT_START_TAG("DIPS21")
458   /* Dip switch bank 1 */
459   PORT_DIPUNKNOWN( 0x0001, 0x0001 )
460   PORT_DIPUNKNOWN( 0x0002, 0x0002 )
461   PORT_DIPUNKNOWN( 0x0004, 0x0004 )
462   PORT_DIPUNKNOWN( 0x0008, 0x0008 )
463   PORT_DIPUNKNOWN( 0x0010, 0x0010 )
464   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
465   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
466   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
467   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
468   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
469   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
470   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
471   /* Dip switch bank 2 */
472   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
473   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
474   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
475   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
476   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
477   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
478   PORT_DIPNAME( 0x0400, 0x0400, "Coin Slots" )
479   PORT_DIPSETTING(      0x0400, "Common" )
480   PORT_DIPSETTING(      0x0000, "Separate" )
481   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) /* Default 1 */
482   PORT_DIPSETTING(      0x0800, "1" )
483   PORT_DIPSETTING(      0x0000, "2" )
484   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:5,6,7,8")
485   PORT_DIPSETTING(      0xa000, DEF_STR( 6C_1C ) )
486   PORT_DIPSETTING(      0xb000, DEF_STR( 5C_1C ) )
487   PORT_DIPSETTING(      0xc000, DEF_STR( 4C_1C ) )
488   PORT_DIPSETTING(      0xd000, DEF_STR( 3C_1C ) )
489   PORT_DIPSETTING(      0xe000, DEF_STR( 2C_1C ) )
490   PORT_DIPSETTING(      0x1000, "2 Coins to Start/1 to Continue")
491   PORT_DIPSETTING(      0x3000, DEF_STR( 3C_2C ) )
492   PORT_DIPSETTING(      0x2000, DEF_STR( 4C_3C ) )
493   PORT_DIPSETTING(      0xf000, DEF_STR( 1C_1C ) )
494   PORT_DIPSETTING(      0x4000, DEF_STR( 2C_3C ) )
495   PORT_DIPSETTING(      0x9000, DEF_STR( 1C_2C ) )
496   PORT_DIPSETTING(      0x8000, DEF_STR( 1C_3C ) )
497   PORT_DIPSETTING(      0x7000, DEF_STR( 1C_4C ) )
498   PORT_DIPSETTING(      0x6000, DEF_STR( 1C_5C ) )
499   PORT_DIPSETTING(      0x5000, DEF_STR( 1C_6C ) )
500   PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
484501
485   IREM_PORT_UNUSED   /* Game manual specificly mentions dip switch bank 3 is unused */
502   PORT_START_TAG("JOY34")
503   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
486504INPUT_PORTS_END
487505
488INPUT_PORTS_START( gunforce )
489   IREM_JOYSTICK_1_2(1)
490   IREM_JOYSTICK_1_2(2)
491   IREM_PORT_UNUSED
492   IREM_PORT_UNUSED
493   IREM_COINS
494   IREM_SYSTEM_DIPSWITCH
495506
496   PORT_START   /* Dip switch bank 1 */
497   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
498   PORT_DIPSETTING(    0x02, "2" )
499   PORT_DIPSETTING(    0x03, "3" )
500   PORT_DIPSETTING(    0x01, "4" )
501   PORT_DIPSETTING(    0x00, "5" )
502   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
503   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
504   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
505   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
506   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
507   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
508   PORT_DIPSETTING(    0x00, "15000 35000 75000 120000" )
509   PORT_DIPSETTING(    0x10, "20000 40000 90000 150000" )
510   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
511   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
512   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
513   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
514   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
515   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
516   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
507static INPUT_PORTS_START( m92_3player )
508   PORT_INCLUDE(m92_2player)
517509
518   IREM_PORT_UNUSED   /* Game manual only mentions 2 dips */
510   PORT_MODIFY("DIPS21")
511   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Cabinet ) )
512   PORT_DIPSETTING(      0x0200, "2 Players" )
513   PORT_DIPSETTING(      0x0000, "3 Players" )
514
515   PORT_MODIFY("JOY34")
516   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
517   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
518   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
519   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
520   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START3 ) /* If common slots, Coin3 if separate */
521   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN3 )
522   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
523   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
524   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
519525INPUT_PORTS_END
520526
521INPUT_PORTS_START( lethalth )
522   IREM_JOYSTICK_1_2(1)
523   IREM_JOYSTICK_1_2(2)
524   IREM_PORT_UNUSED
525   IREM_PORT_UNUSED
526   IREM_COINS
527   IREM_SYSTEM_DIPSWITCH
528527
529   PORT_START   /* Dip switch bank 1 */
530   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
531   PORT_DIPSETTING(    0x02, "2" )
532   PORT_DIPSETTING(    0x03, "3" )
533   PORT_DIPSETTING(    0x01, "4" )
534   PORT_DIPSETTING(    0x00, "5" )
535   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
536   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
537   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
538   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
539   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
540   PORT_DIPNAME( 0x10, 0x10, "Continuous Play" )
541   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
542   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
543   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
544   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
545   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
546   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
547   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
548   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
549   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
528static INPUT_PORTS_START( m92_4player )
529   PORT_INCLUDE(m92_3player)
550530
551   PORT_START   /* Dip switch bank 3 */
552   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
553   PORT_DIPSETTING(    0x02, "500K & 1M" )
554   PORT_DIPSETTING(    0x03, "700K & 1.5M" )
555   PORT_DIPSETTING(    0x00, "700K, 1.5M, 3M & 4.5M" )
556   PORT_DIPSETTING(    0x01, "1M & 2M" )
557   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) /* Manual states the rest are "Unused" */
558   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
559   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
560   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
561   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
562   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
563   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
564   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
565   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
566   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
567   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
568   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
569   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
570   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
571   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
572   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
573   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
574   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
531   PORT_MODIFY("DIPS21")
532   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Cabinet ) )
533   PORT_DIPSETTING(      0x0200, "2 Players" )
534   PORT_DIPSETTING(      0x0000, "4 Players" )
535
536   PORT_MODIFY("JOY34")
537   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
538   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
539   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
540   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
541   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START4 ) /* If common slots, Coin3 if separate */
542   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN4 )
543   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
544   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
575545INPUT_PORTS_END
576546
577INPUT_PORTS_START( hook )
578   IREM_JOYSTICK_1_2(1)
579   IREM_JOYSTICK_1_2(2)
580   IREM_JOYSTICK_3_4(3)
581   IREM_JOYSTICK_3_4(4)
582   IREM_COINS
583   IREM_SYSTEM_DIPSWITCH_4PLAYERS
547/******************************************************************************/
584548
585   PORT_START   /* Dip switch bank 1 */
586   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
587   PORT_DIPSETTING(    0x00, "1" )
588   PORT_DIPSETTING(    0x03, "2" )
589   PORT_DIPSETTING(    0x02, "3" )
590   PORT_DIPSETTING(    0x01, "4" )
591   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
592   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
593   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
594   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
595   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
596   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
597   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
598   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
599   PORT_DIPNAME( 0x20, 0x20, "Any Button to Start" )
600   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
601   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
602   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
603   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
604   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
605   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
549static INPUT_PORTS_START( bmaster )
550   PORT_INCLUDE(m92_2player)
606551
607   IREM_PORT_UNUSED   /* Game manual only mentions 2 dips */
552   /* Game manual specificly mentions dip switch bank 3 is unused */
553
554   PORT_MODIFY("DIPS21")
555   /* Dip switch bank 1 */
556   PORT_DIPNAME( 0x0003, 0x0002, DEF_STR( Lives ) )
557   PORT_DIPSETTING(      0x0000, "1" )
558   PORT_DIPSETTING(      0x0003, "2" )
559   PORT_DIPSETTING(      0x0002, "3" )
560   PORT_DIPSETTING(      0x0001, "4" )
561   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
562   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy ) )
563   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
564   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
565   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
566   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )
567   PORT_DIPSETTING(      0x0010, "300k only" )
568   PORT_DIPSETTING(      0x0000, DEF_STR( None ) )
608569INPUT_PORTS_END
609570
610INPUT_PORTS_START( majtitl2 )
611   IREM_JOYSTICK_1_2(1)
612   IREM_JOYSTICK_1_2(2)
613   IREM_JOYSTICK_3_4(3)
614   IREM_JOYSTICK_3_4(4)
615   IREM_COINS
616   IREM_SYSTEM_DIPSWITCH_CABINET
617571
618   PORT_START   /* Dip switch bank 1 */
619   PORT_DIPNAME( 0x01, 0x01, "Given Holes/Stroke Play" )
620   PORT_DIPSETTING(    0x00, "1" )
621   PORT_DIPSETTING(    0x01, "2" )
622   PORT_DIPNAME( 0x02, 0x02, "Given Holes/Match or Skins" )
623   PORT_DIPSETTING(    0x00, "1" )
624   PORT_DIPSETTING(    0x02, "2" )
625   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Difficulty ) )
626   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
627   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
628   PORT_DIPNAME( 0x08, 0x08, "Joystick Configuration" )    /* Listed as "Joysticks on" */
629   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )          /* "One Side" */
630   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )         /* "Both Sides" */
631   PORT_DIPNAME( 0x10, 0x10, "Number of Joysticks" )   /* 4 Way joysticks with 2 buttons each player */
632   PORT_DIPSETTING(    0x10, "2 Joysticks" )
633   PORT_DIPSETTING(    0x00, "4 Joysticks" )
634   PORT_DIPNAME( 0x20, 0x00, "Any Button to Start" )
635   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
636   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
637   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
638   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
639   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
640   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
572INPUT_PORTS_START( gunforce )
573   PORT_INCLUDE(m92_2player)
641574
642   PORT_START   /* Dip switch bank 3 */
643   PORT_DIPNAME( 0x01, 0x01, "Ticket Dispenser" )
644   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )   /* "Ticket payout function is not working now" will be shown on screen */
645   PORT_DIPSETTING(    0x00, DEF_STR( On ) )   /* Stored data is shown on screen with the option to clear data */
646   PORT_DIPNAME( 0x02, 0x06, "Points Per Ticket" ) /* Conversion Rate for Ticket */
647   PORT_DIPSETTING(    0x06, "1 Point - 1 Ticket" )
648   PORT_DIPSETTING(    0x06, "2 Points - 1 Ticket" )
649   PORT_DIPSETTING(    0x02, "5 Points - 1 Ticket" )
650   PORT_DIPSETTING(    0x00, "10 Points - 1 Ticket" )
651   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) /* Game manual states dips 4, 5, 6 & 7 are "Unused" */
652   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
653   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
654   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
655   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
656   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
657   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
658   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
659   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
660   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
661   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
662   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
663   PORT_DIPNAME( 0x80, 0x80, "Deltronics Model" ) /* Ticket Despenser Model Type */
664   PORT_DIPSETTING(    0x80, "DL 1275" )
665   PORT_DIPSETTING(    0x00, "DL 4SS" )
575   PORT_MODIFY("DIPS21")
576   /* Dip switch bank 1 */
577   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
578   PORT_DIPSETTING(      0x0002, "2" )
579   PORT_DIPSETTING(      0x0003, "3" )
580   PORT_DIPSETTING(      0x0001, "4" )
581   PORT_DIPSETTING(      0x0000, "5" )
582   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
583   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy ) )
584   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
585   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
586   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
587   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )
588   PORT_DIPSETTING(      0x0000, "15000 35000 75000 120000" )
589   PORT_DIPSETTING(      0x0010, "20000 40000 90000 150000" )
666590INPUT_PORTS_END
667591
668INPUT_PORTS_START( mysticri )
669   IREM_JOYSTICK_1_2(1)
670   IREM_JOYSTICK_1_2(2)
671   IREM_PORT_UNUSED
672   IREM_PORT_UNUSED
673   IREM_COINS
674   IREM_SYSTEM_DIPSWITCH
675592
676   PORT_START   /* Dip switch bank 1 */
677   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
678   PORT_DIPSETTING(    0x02, "2" )
679   PORT_DIPSETTING(    0x03, "3" )
680   PORT_DIPSETTING(    0x01, "4" )
681   PORT_DIPSETTING(    0x00, "5" )
682   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
683   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
684   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
685   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
686   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
687   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
688   PORT_DIPSETTING(    0x00, "15000 35000 60000" )
689   PORT_DIPSETTING(    0x10, "20000 50000 90000" )
690   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
691   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
692   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
693   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
694   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
695   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
696   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
593INPUT_PORTS_START( lethalth )
594   PORT_INCLUDE(m92_2player)
697595
698   IREM_PORT_UNUSED   /* Game manual specificly mentions dip switch bank 3 is unused */
596   PORT_MODIFY("COINS_DIPS")
597   /* Dip switch bank 3 */
598   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Bonus_Life ) )
599   PORT_DIPSETTING(      0x0200, "500K & 1M" )
600   PORT_DIPSETTING(      0x0300, "700K & 1.5M" )
601   PORT_DIPSETTING(      0x0000, "700K, 1.5M, 3M & 4.5M" )
602   PORT_DIPSETTING(      0x0100, "1M & 2M" )
603
604   PORT_MODIFY("DIPS21")
605   /* Dip switch bank 1 */
606   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
607   PORT_DIPSETTING(      0x0002, "2" )
608   PORT_DIPSETTING(      0x0003, "3" )
609   PORT_DIPSETTING(      0x0001, "4" )
610   PORT_DIPSETTING(      0x0000, "5" )
611   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
612   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy) )
613   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
614   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
615   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
616   PORT_DIPNAME( 0x0010, 0x0010, "Continuous Play" )
617   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
618   PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
699619INPUT_PORTS_END
700620
701INPUT_PORTS_START( uccops )
702   IREM_JOYSTICK_1_2(1)
703   IREM_JOYSTICK_1_2(2)
704   IREM_JOYSTICK_3_4(3)
705   IREM_PORT_UNUSED
706   IREM_COINS
707   IREM_SYSTEM_DIPSWITCH_3PLAYERS
708621
709   PORT_START   /* Dip switch bank 1 */
710   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
711   PORT_DIPSETTING(    0x00, "1" )
712   PORT_DIPSETTING(    0x03, "2" )
713   PORT_DIPSETTING(    0x02, "3" )
714   PORT_DIPSETTING(    0x01, "4" )
715   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
716   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
717   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
718   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
719   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
720   /* There is ALLWAYS a Bonus Life at 300K */
721   /* It does not depends on the value of bit 0x10 */
722   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
723   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
724   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
725   PORT_DIPNAME( 0x20, 0x20, "Any Button to Start" )
726   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
727   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
728   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
729   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
730   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
731   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
622INPUT_PORTS_START( hook )
623   PORT_INCLUDE(m92_4player)
732624
733   IREM_PORT_UNUSED   /* Game manual only mentions 2 dips */
625   PORT_MODIFY("DIPS21")
626   /* Dip switch bank 1 */
627   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
628   PORT_DIPSETTING(      0x0000, "1" )
629   PORT_DIPSETTING(      0x0003, "2" )
630   PORT_DIPSETTING(      0x0002, "3" )
631   PORT_DIPSETTING(      0x0001, "4" )
632   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
633   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy) )
634   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
635   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
636   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
637   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
638   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
639   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
640   PORT_DIPNAME( 0x0020, 0x0020, "Any Button to Start" )
641   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
642   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
734643INPUT_PORTS_END
735644
736INPUT_PORTS_START( rtypeleo )
737   IREM_JOYSTICK_1_2(1)
738   IREM_JOYSTICK_1_2(2)
739   IREM_PORT_UNUSED
740   IREM_PORT_UNUSED
741   IREM_COINS
742   IREM_SYSTEM_DIPSWITCH
743645
744   PORT_START   /* Dip switch bank 1 */
745   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
746   PORT_DIPSETTING(    0x02, "2" )
747   PORT_DIPSETTING(    0x03, "3" )
748   PORT_DIPSETTING(    0x01, "4" )
749   PORT_DIPSETTING(    0x00, "5" )
750   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
751   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
752   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
753   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
754   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
755   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
756   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
757   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
758   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
759   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
760   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
761   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
762   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
763   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
764   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
646INPUT_PORTS_START( majtitl2 )
647   PORT_INCLUDE(m92_4player)
765648
766   IREM_PORT_UNUSED   /* Game manual only mentions 2 dips */
649   PORT_MODIFY("COINS_DIPS")
650   /* Dip switch bank 3 */
651   PORT_DIPNAME( 0x0100, 0x0100, "Ticket Dispenser" )
652   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )   /* "Ticket payout function is not working now" will be shown on screen */
653   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )   /* Stored data is shown on screen with the option to clear data */
654   PORT_DIPNAME( 0x0200, 0x0600, "Points Per Ticket" ) /* Conversion Rate for Ticket */
655   PORT_DIPSETTING(      0x0600, "1 Point - 1 Ticket" )
656   PORT_DIPSETTING(      0x0600, "2 Points - 1 Ticket" )
657   PORT_DIPSETTING(      0x0200, "5 Points - 1 Ticket" )
658   PORT_DIPSETTING(      0x0000, "10 Points - 1 Ticket" )
659   PORT_DIPUNUSED( 0x0800, 0x0800 ) /* Game manual states dips 4, 5, 6 & 7 are "Unused" */
660   PORT_DIPUNUSED( 0x1000, 0x1000 )
661   PORT_DIPUNUSED( 0x2000, 0x2000 )
662   PORT_DIPUNUSED( 0x4000, 0x4000 )
663   PORT_DIPNAME( 0x8000, 0x8000, "Deltronics Model" ) /* Ticket Despenser Model Type */
664   PORT_DIPSETTING(      0x8000, "DL 1275" )
665   PORT_DIPSETTING(      0x0000, "DL 4SS" )
666
667   PORT_MODIFY("DIPS21")
668   /* Dip switch bank 2 */
669   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Cabinet ) )
670   PORT_DIPSETTING(      0x0000, DEF_STR( Upright ) )
671   PORT_DIPSETTING(      0x0200, DEF_STR( Cocktail ) )
672
673   /* Dip switch bank 1 */
674   PORT_DIPNAME( 0x0001, 0x0001, "Given Holes/Stroke Play" )
675   PORT_DIPSETTING(      0x0000, "1" )
676   PORT_DIPSETTING(      0x0001, "2" )
677   PORT_DIPNAME( 0x0002, 0x0002, "Given Holes/Match or Skins" )
678   PORT_DIPSETTING(      0x0000, "1" )
679   PORT_DIPSETTING(      0x0002, "2" )
680   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Difficulty ) )
681   PORT_DIPSETTING(      0x0004, DEF_STR( Normal ) )
682   PORT_DIPSETTING(      0x0000, DEF_STR( Hard ) )
683   PORT_DIPNAME( 0x0008, 0x0008, "Joystick Configuration" )    /* Listed as "Joysticks on" */
684   PORT_DIPSETTING(      0x0008, DEF_STR( Upright ) )          /* "One Side" */
685   PORT_DIPSETTING(      0x0000, DEF_STR( Cocktail ) )         /* "Both Sides" */
686   PORT_DIPNAME( 0x0010, 0x0010, "Number of Joysticks" )   /* 4 Way joysticks with 2 buttons each player */
687   PORT_DIPSETTING(      0x0010, "2 Joysticks" )
688   PORT_DIPSETTING(      0x0000, "4 Joysticks" )
689   PORT_DIPNAME( 0x0020, 0x0000, "Any Button to Start" )
690   PORT_DIPSETTING(      0x0020, DEF_STR( No ) )
691   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
767692INPUT_PORTS_END
768693
769INPUT_PORTS_START( inthunt )
770   IREM_JOYSTICK_1_2(1)
771   IREM_JOYSTICK_1_2(2)
772   IREM_PORT_UNUSED
773   IREM_PORT_UNUSED
774   IREM_COINS
775   IREM_SYSTEM_DIPSWITCH
776694
777   PORT_START   /* Dip switch bank 1 */
778   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
779   PORT_DIPSETTING(    0x02, "2" )
780   PORT_DIPSETTING(    0x03, "3" )
781   PORT_DIPSETTING(    0x01, "4" )
782   PORT_DIPSETTING(    0x00, "5" )
783   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
784   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
785   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
786   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
787   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
788   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
789   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
790   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
791   PORT_DIPNAME( 0x20, 0x20, "Any Button to Start" )
792   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
793   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
794   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
795   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
796   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
797   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
695INPUT_PORTS_START( mysticri )
696   PORT_INCLUDE(m92_2player)
798697
799   IREM_PORT_UNUSED   /* Game manual only mentions 2 dips */
698   PORT_MODIFY("DIPS21")
699   /* Dip switch bank 1 */
700   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
701   PORT_DIPSETTING(      0x0002, "2" )
702   PORT_DIPSETTING(      0x0003, "3" )
703   PORT_DIPSETTING(      0x0001, "4" )
704   PORT_DIPSETTING(      0x0000, "5" )
705   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
706   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
707   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
708   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
709   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
710   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )
711   PORT_DIPSETTING(      0x0000, "15000 35000 60000" )
712   PORT_DIPSETTING(      0x0010, "20000 50000 90000" )
800713INPUT_PORTS_END
801714
802INPUT_PORTS_START( nbbatman )
803   IREM_JOYSTICK_1_2(1)
804   IREM_JOYSTICK_1_2(2)
805   IREM_JOYSTICK_3_4(3)
806   IREM_JOYSTICK_3_4(4)
807   IREM_COINS
808   IREM_SYSTEM_DIPSWITCH_4PLAYERS
809715
810   PORT_START   /* Dip switch bank 1 */
811   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
812   PORT_DIPSETTING(    0x00, "1" )
813   PORT_DIPSETTING(    0x03, "2" )
814   PORT_DIPSETTING(    0x02, "3" )
815   PORT_DIPSETTING(    0x01, "4" )
816   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
817   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
818   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
819   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
820   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
821   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) /* One of these is continue */
822   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
823   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
824   PORT_DIPNAME( 0x20, 0x00, "Any Button to Start" )
825   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
826   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
827   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
828   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
829   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
830   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
716INPUT_PORTS_START( uccops )
717   PORT_INCLUDE(m92_3player)
831718
832   PORT_START   /* Dip switch bank 3 */
833   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
834   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
835   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
836   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
837   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
838   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
839   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
840   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
841   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
842   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
843   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
844   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
845   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
846   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
847   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
848   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
849   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
850   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
851   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
852   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
853   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
854   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
855   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
856   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
719   PORT_MODIFY("DIPS21")
720   /* Dip switch bank 1 */
721   PORT_DIPNAME( 0x0003, 0x0002, DEF_STR( Lives ) )
722   PORT_DIPSETTING(      0x0000, "1" )
723   PORT_DIPSETTING(      0x0003, "2" )
724   PORT_DIPSETTING(      0x0002, "3" )
725   PORT_DIPSETTING(      0x0001, "4" )
726   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
727   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy) )
728   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
729   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
730   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
731   /* There is ALLWAYS a Bonus Life at 300K */
732   /* It does not depends on the value of bit 0x0010 */
733   PORT_DIPNAME( 0x0020, 0x0020, "Any Button to Start" )
734   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
735   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
857736INPUT_PORTS_END
858737
859INPUT_PORTS_START( psoldier )
860   PORT_START
861   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
862   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
863   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
864   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
865   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
866   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
867   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
868   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
869738
870   PORT_START
871   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
872   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
873   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
874   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
875   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
876   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
877   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
878   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
739INPUT_PORTS_START( rtypeleo )
740   PORT_INCLUDE(m92_2player)
879741
880   IREM_PORT_UNUSED
742   PORT_MODIFY("DIPS21")
743   /* Dip switch bank 1 */
744   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
745   PORT_DIPSETTING(      0x0002, "2" )
746   PORT_DIPSETTING(      0x0003, "3" )
747   PORT_DIPSETTING(      0x0001, "4" )
748   PORT_DIPSETTING(      0x0000, "5" )
749   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
750   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy ) )
751   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
752   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
753   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
754INPUT_PORTS_END
881755
882   PORT_START /* Extra connector for kick buttons */
883   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
884   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
885   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
886   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
887   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
888   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
889   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
890   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
891756
892   IREM_COINS
893   IREM_SYSTEM_DIPSWITCH
757INPUT_PORTS_START( inthunt )
758   PORT_INCLUDE(m92_2player)
894759
895   PORT_START   /* Dip switch bank 1 */
896   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
897   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
898   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
899   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
900   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
901   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
902   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) /* Probably difficulty */
903   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
904   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
905   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
906   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
907   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
908   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
909   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
910   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
911   PORT_DIPNAME( 0x20, 0x00, "Any Button to Start" )
912   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
913   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
914   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
915   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
916   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
917   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
760   PORT_MODIFY("DIPS21")
761   /* Dip switch bank 1 */
762   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
763   PORT_DIPSETTING(      0x0002, "2" )
764   PORT_DIPSETTING(      0x0003, "3" )
765   PORT_DIPSETTING(      0x0001, "4" )
766   PORT_DIPSETTING(      0x0000, "5" )
767   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
768   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy) )
769   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
770   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
771   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
772   PORT_DIPNAME( 0x0020, 0x0020, "Any Button to Start" )
773   PORT_DIPSETTING(      0x0020, DEF_STR( No ) )
774   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
775INPUT_PORTS_END
918776
919   PORT_START   /* Dip switch bank 3 */
920   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
921   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
922   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
923   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
924   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
925   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
926   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
927   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
928   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
929   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
930   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
931   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
932   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
933   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
934   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
935   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
936   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
937   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
938   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
939   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
940   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
941   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
942   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
943   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
777
778INPUT_PORTS_START( nbbatman )
779   PORT_INCLUDE(m92_4player)
780
781   PORT_MODIFY("DIPS21")
782   /* Dip switch bank 1 */
783   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
784   PORT_DIPSETTING(      0x0000, "1" )
785   PORT_DIPSETTING(      0x0003, "2" )
786   PORT_DIPSETTING(      0x0002, "3" )
787   PORT_DIPSETTING(      0x0001, "4" )
788   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
789   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
790   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
791   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
792   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
793   PORT_DIPNAME( 0x0020, 0x0000, "Any Button to Start" )
794   PORT_DIPSETTING(      0x0020, DEF_STR( No ) )
795   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
944796INPUT_PORTS_END
945797
798
799INPUT_PORTS_START( psoldier )
800   PORT_INCLUDE(m92_2player)
801
802   PORT_MODIFY("DIPS21")
803   /* Dip switch bank 1 */
804   PORT_DIPNAME( 0x0020, 0x0000, "Any Button to Start" )
805   PORT_DIPSETTING(      0x0020, DEF_STR( No ) )
806   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
807
808   PORT_MODIFY("JOY34")   /* Extra connector for kick buttons */
809   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
810   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
811   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
812   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
813   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED )
814   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
815   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
816   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
817INPUT_PORTS_END
818
819
946820INPUT_PORTS_START( dsccr94j )
947   IREM_JOYSTICK_1_2(1)
948   IREM_JOYSTICK_1_2(2)
949   IREM_JOYSTICK_3_4(3)
950   IREM_JOYSTICK_3_4(4)
951   IREM_COINS
952   IREM_SYSTEM_DIPSWITCH /* Dip Switch 2, dip 2 is listed as "Don't Change" and is "OFF" */
821   PORT_INCLUDE(m92_4player)
822   /* Dip Switch 2, dip 2 is listed as "Don't Change" and is "OFF" */
953823
954   PORT_START   /* Dip switch bank 1 */
955   PORT_DIPNAME( 0x03, 0x03, "Time" )
956   PORT_DIPSETTING(    0x00, "1:30" )
957   PORT_DIPSETTING(    0x03, "2:00" )
958   PORT_DIPSETTING(    0x02, "2:30" )
959   PORT_DIPSETTING(    0x01, "3:00" )
960   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
961   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
962   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
963   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
964   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
965   PORT_DIPNAME( 0x10, 0x10, "Game Mode" )
966   PORT_DIPSETTING(    0x10, "Match Mode" )
967   PORT_DIPSETTING(    0x00, "Power Mode" )
824   PORT_MODIFY("COINS_DIPS")
825   /* Dip switch bank 3 */
826   PORT_DIPNAME( 0x0300, 0x0300, "Player Power" )
827   PORT_DIPSETTING(      0x0000, "500" )
828   PORT_DIPSETTING(      0x0300, "1000" )
829   PORT_DIPSETTING(      0x0100, "1500" )
830   PORT_DIPSETTING(      0x0200, "2000" )
831
832   PORT_MODIFY("DIPS21")
833   /* Dip switch bank 1 */
834   PORT_DIPNAME( 0x0003, 0x0003, "Time" )
835   PORT_DIPSETTING(      0x0000, "1:30" )
836   PORT_DIPSETTING(      0x0003, "2:00" )
837   PORT_DIPSETTING(      0x0002, "2:30" )
838   PORT_DIPSETTING(      0x0001, "3:00" )
839   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
840   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy) )
841   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
842   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
843   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
844   PORT_DIPNAME( 0x0010, 0x0010, "Game Mode" )
845   PORT_DIPSETTING(      0x0010, "Match Mode" )
846   PORT_DIPSETTING(      0x0000, "Power Mode" )
968847/*
969848   Match Mode: Winner advances to the next game.  Game Over for the loser
970849   Power Mode: The Players can play the game until their respective powers run
r869r870
972851               Player 2 can join in any time during the game
973852               Player power (time) can be adjusted by dip switch #3
974853*/
975   PORT_DIPNAME( 0x20, 0x20, "Starting Button" )
976   PORT_DIPSETTING(    0x00, "Button 1" )
977   PORT_DIPSETTING(    0x20, "Start Button" )
978   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
979   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
980   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
981   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
982
983   PORT_START   /* Dip switch bank 3 */
984   PORT_DIPNAME( 0x03, 0x03, "Player Power" )
985   PORT_DIPSETTING(    0x00, "500" )
986   PORT_DIPSETTING(    0x03, "1000" )
987   PORT_DIPSETTING(    0x01, "1500" )
988   PORT_DIPSETTING(    0x02, "2000" )
989   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
990   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
991   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
992   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
993   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
994   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
995   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
996   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
997   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
998   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
999   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1000   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1001   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1002   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1003   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1004   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1005   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1006   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
854   PORT_DIPNAME( 0x0020, 0x0020, "Starting Button" )
855   PORT_DIPSETTING(      0x0000, "Button 1" )
856   PORT_DIPSETTING(      0x0020, "Start Button" )
1007857INPUT_PORTS_END
1008858
859
1009860INPUT_PORTS_START( gunforc2 )
1010   IREM_JOYSTICK_1_2(1)
1011   IREM_JOYSTICK_1_2(2)
1012   IREM_PORT_UNUSED
1013   IREM_PORT_UNUSED
1014   IREM_COINS
1015   IREM_SYSTEM_DIPSWITCH
861   PORT_INCLUDE(m92_2player)
1016862
1017   PORT_START   /* Dip switch bank 1 */
1018   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1019   PORT_DIPSETTING(    0x02, "3" )
1020   PORT_DIPSETTING(    0x03, "2" )
1021   PORT_DIPSETTING(    0x01, "4" )
1022   PORT_DIPSETTING(    0x00, "1" )
1023   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
1024   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
1025   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
1026   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
1027   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
1028   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
1029   PORT_DIPSETTING(    0x00, "15000 35000 75000 120000" )
1030   PORT_DIPSETTING(    0x10, "20000 40000 90000 150000" )
1031   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) )
1032   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1033   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
1034   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
1035   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1036   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1037   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1038
1039   IREM_PORT_UNUSED   /* Game manual only mentions 2 dips */
863   PORT_MODIFY("DIPS21")
864   /* Dip switch bank 1 */
865   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
866   PORT_DIPSETTING(      0x0002, "3" )
867   PORT_DIPSETTING(      0x0003, "2" )
868   PORT_DIPSETTING(      0x0001, "4" )
869   PORT_DIPSETTING(      0x0000, "1" )
870   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
871   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy) )
872   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
873   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
874   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
875   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )
876   PORT_DIPSETTING(      0x0000, "15000 35000 75000 120000" )
877   PORT_DIPSETTING(      0x0010, "20000 40000 90000 150000" )
1040878INPUT_PORTS_END
1041879
880
1042881/***************************************************************************/
1043882
1044883static const gfx_layout charlayout =
r869r870
1093932static void sound_irq(int state)
1094933{
1095934   if (state)
1096      timer_call_after_resynch(YM2151_ASSERT,setvector_callback);
935      timer_call_after_resynch(YM2151_ASSERT, setvector_callback);
1097936   else
1098      timer_call_after_resynch(YM2151_CLEAR,setvector_callback);
937      timer_call_after_resynch(YM2151_CLEAR, setvector_callback);
1099938}
1100939
1101940static struct YM2151interface ym2151_interface =
r869r870
1110949
1111950/***************************************************************************/
1112951
1113static INTERRUPT_GEN( m92_interrupt )
1114{
1115   video_screen_update_partial(0, 249+128);
1116   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_0); /* VBL */
1117}
1118
1119static INTERRUPT_GEN( m92_raster_interrupt )
1120{
1121   int line = M92_SCANLINES - cpu_getiloops();
1122
1123   /* Raster interrupt */
1124   if (m92_raster_enable && line==m92_raster_irq_position) {
1125      video_screen_update_partial(0, line+128);
1126      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_2);
1127   }
1128
1129   /* Redraw screen, then set vblank and trigger the VBL interrupt */
1130   else if (line==249) { /* 248 is last visible line */
1131      video_screen_update_partial(0, 249+128);
1132      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_0);
1133   }
1134}
1135
1136952void m92_sprite_interrupt(void)
1137953{
1138   cpunum_set_input_line_and_vector(0,0,HOLD_LINE,M92_IRQ_1);
954   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M92_IRQ_1);
1139955}
1140956
1141static MACHINE_DRIVER_START( raster )
957static MACHINE_DRIVER_START( m92 )
1142958
1143959   /* basic machine hardware */
1144   MDRV_CPU_ADD(V33,18000000/2)   /* NEC V33, 18 MHz clock */
1145   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1146   MDRV_CPU_IO_MAP(readport,writeport)
1147   MDRV_CPU_VBLANK_INT(m92_raster_interrupt,M92_SCANLINES) /* First visible line 8? */
960   MDRV_CPU_ADD_TAG("main",V33,18000000/2)   /* NEC V33, 18 MHz clock */
961   MDRV_CPU_PROGRAM_MAP(m92_map,0)
962   MDRV_CPU_IO_MAP(m92_portmap,0)
1148963
1149964   MDRV_CPU_ADD(V30, 14318180/2)   /* 14.31818 MHz */
1150   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
965   MDRV_CPU_PROGRAM_MAP(sound_map,0)
1151966
1152967   MDRV_MACHINE_START(m92)
968   MDRV_MACHINE_RESET(m92)
1153969   MDRV_SCREEN_REFRESH_RATE(60)
1154970   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
1155971
1156972   /* video hardware */
1157973   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
1158974   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1159   MDRV_SCREEN_SIZE(512, 512)
1160   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 128+8, 511-128-8) /* 320 x 240 */
975   MDRV_SCREEN_SIZE(512, 256)
976   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 8, 247) /* 320 x 240 */
1161977   MDRV_GFXDECODE(gfxdecodeinfo)
1162978   MDRV_PALETTE_LENGTH(2048)
1163979
r869r870
1178994MACHINE_DRIVER_END
1179995
1180996
1181static MACHINE_DRIVER_START( nonraster )
1182
1183   /* basic machine hardware */
1184   MDRV_CPU_ADD(V33, 18000000/2)    /* NEC V33, 18 MHz clock */
1185   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1186   MDRV_CPU_IO_MAP(readport,writeport)
1187   MDRV_CPU_VBLANK_INT(m92_interrupt,1)
1188
1189   MDRV_CPU_ADD(V30, 14318180/2)
1190   /* audio CPU */   /* 14.31818 MHz */
1191   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
1192
1193   MDRV_MACHINE_START(m92)
1194   MDRV_SCREEN_REFRESH_RATE(60)
1195   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
1196
1197   /* video hardware */
1198   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
1199   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1200   MDRV_SCREEN_SIZE(512, 512)
1201   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 128+8, 511-128-8) /* 320 x 240 */
1202   MDRV_GFXDECODE(gfxdecodeinfo)
1203   MDRV_PALETTE_LENGTH(2048)
1204
1205   MDRV_VIDEO_START(m92)
1206   MDRV_VIDEO_UPDATE(m92)
1207
1208   /* sound hardware */
1209   MDRV_SPEAKER_STANDARD_MONO("mono")
1210
1211   MDRV_SOUND_ADD(YM2151, 14318180/4)
1212   MDRV_SOUND_CONFIG(ym2151_interface)
1213   MDRV_SOUND_ROUTE(0, "mono", 0.40)
1214   MDRV_SOUND_ROUTE(1, "mono", 0.40)
1215
1216   MDRV_SOUND_ADD(IREMGA20, 14318180/4)
1217   MDRV_SOUND_CONFIG(iremGA20_interface)
1218   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1219MACHINE_DRIVER_END
1220
1221
1222997static MACHINE_DRIVER_START( lethalth )
998   MDRV_IMPORT_FROM(m92)
1223999
12241000   /* basic machine hardware */
1225   MDRV_CPU_ADD(V33, 18000000/2)   /* NEC V33, 18 MHz clock */
1226   MDRV_CPU_PROGRAM_MAP(lethalth_readmem,lethalth_writemem)
1227   MDRV_CPU_IO_MAP(readport,writeport)
1228   MDRV_CPU_VBLANK_INT(m92_interrupt,1)
1229
1230   MDRV_CPU_ADD(V30, 14318180/2)
1231   /* audio CPU */   /* 14.31818 MHz */
1232   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
1233
1234   MDRV_MACHINE_START(m92)
1235   MDRV_SCREEN_REFRESH_RATE(60)
1236   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
1237
1238   /* video hardware */
1239   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
1240   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1241   MDRV_SCREEN_SIZE(512, 512)
1242   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 128+8, 511-128-8) /* 320 x 240 */
1243   MDRV_GFXDECODE(gfxdecodeinfo)
1244   MDRV_PALETTE_LENGTH(2048)
1245
1246   MDRV_VIDEO_START(m92)
1247   MDRV_VIDEO_UPDATE(m92)
1248
1249   /* sound hardware */
1250   MDRV_SPEAKER_STANDARD_MONO("mono")
1251
1252   MDRV_SOUND_ADD(YM2151, 14318180/4)
1253   MDRV_SOUND_CONFIG(ym2151_interface)
1254   MDRV_SOUND_ROUTE(0, "mono", 0.40)
1255   MDRV_SOUND_ROUTE(1, "mono", 0.40)
1256
1257   MDRV_SOUND_ADD(IREMGA20, 14318180/4)
1258   MDRV_SOUND_CONFIG(iremGA20_interface)
1259   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1001   MDRV_CPU_MODIFY("main")
1002   MDRV_CPU_PROGRAM_MAP(lethalth_map,0)
12601003MACHINE_DRIVER_END
12611004
12621005
12631006static MACHINE_DRIVER_START( psoldier )
1007   MDRV_IMPORT_FROM(m92)
12641008
1265   /* basic machine hardware */
1266   MDRV_CPU_ADD(V33, 18000000/2)      /* NEC V33, 18 MHz clock */
1267   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1268   MDRV_CPU_IO_MAP(readport,writeport)
1269   MDRV_CPU_VBLANK_INT(m92_interrupt,1)
1270
1271   MDRV_CPU_ADD(V30, 14318180/2)
1272   /* audio CPU */   /* 14.31818 MHz */
1273   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
1274
1275   MDRV_MACHINE_START(m92)
1276   MDRV_SCREEN_REFRESH_RATE(60)
1277   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
1278
12791009   /* video hardware */
1280   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
1281   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1282   MDRV_SCREEN_SIZE(512, 512)
1283   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 128+8, 511-128-8) /* 320 x 240 */
12841010   MDRV_GFXDECODE(gfxdecodeinfo2)
1285   MDRV_PALETTE_LENGTH(2048)
1286
1287   MDRV_VIDEO_START(m92)
1288   MDRV_VIDEO_UPDATE(m92)
1289
1290   /* sound hardware */
1291   MDRV_SPEAKER_STANDARD_MONO("mono")
1292
1293   MDRV_SOUND_ADD(YM2151, 14318180/4)
1294   MDRV_SOUND_CONFIG(ym2151_interface)
1295   MDRV_SOUND_ROUTE(0, "mono", 0.40)
1296   MDRV_SOUND_ROUTE(1, "mono", 0.40)
1297
1298   MDRV_SOUND_ADD(IREMGA20, 14318180/4)
1299   MDRV_SOUND_CONFIG(iremGA20_interface)
1300   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
13011011MACHINE_DRIVER_END
13021012
13031013/***************************************************************************/
r869r870
21651875ROM_END
21661876
21671877
2168static void m92_startup(int hasbanks)
1878static void init_m92(running_machine *machine, const UINT8 *decryption_table, int hasbanks)
21691879{
21701880   UINT8 *RAM = memory_region(REGION_CPU1);
21711881
r869r870
21811891   }
21821892
21831893   RAM = memory_region(REGION_CPU2);
2184   memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */
1894   memcpy(RAM+0xffff0, RAM+0x1fff0, 0x10); /* Sound cpu Start vector */
21851895
21861896   m92_game_kludge=0;
21871897   m92_irq_vectorbase=0x80;
2188   m92_raster_enable=1;
2189   m92_sprite_buffer_busy=0x80;
2190}
1898   m92_sprite_buffer_busy=1;
21911899
2192static void init_m92(running_machine *machine, const UINT8 *decryption_table, int hasbanks)
2193{
2194   m92_startup(hasbanks);
21951900   setvector_callback(machine, VECTOR_INIT);
21961901   irem_cpu_decrypt(1,decryption_table);
21971902}
r869r870
22381943   init_m92(machine, majtitl2_decryption_table, 1);
22391944
22401945   /* This game has an eprom on the game board */
2241   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xf0000, 0xf3fff, 0, 0, m92_eeprom_r);
2242   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xf0000, 0xf3fff, 0, 0, m92_eeprom_w);
1946   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf0000, 0xf3fff, 0, 0, m92_eeprom_r);
1947   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf0000, 0xf3fff, 0, 0, m92_eeprom_w);
22431948
22441949   m92_game_kludge=2;
22451950}
r869r870
22611966   m92_irq_vectorbase=0x20;
22621967
22631968   /* NOP out the bankswitcher */
2264   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0x20, 0x21, 0, 0, MWA8_NOP);
2265
2266   /* This game sets the raster IRQ position, but the interrupt routine
2267        is just an iret, no need to emulate it */
2268   m92_raster_enable=0;
2269   m92_game_kludge=3; /* No upper palette bank? It could be a different motherboard */
1969   memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0x20, 0x21, 0, 0, MWA16_NOP);
22701970}
22711971
22721972static DRIVER_INIT( nbbatman )
r869r870
23082008
23092009/***************************************************************************/
23102010
2311/* The 'nonraster' machine is for games that don't use the raster interrupt feature - slightly faster to emulate */
2312GAME( 1991, gunforce, 0,        raster,    gunforce, gunforce, ROT0,   "Irem",         "Gunforce - Battle Fire Engulfed Terror Island (World)", 0 )
2313GAME( 1991, gunforcj, gunforce, raster,    gunforce, gunforce, ROT0,   "Irem",         "Gunforce - Battle Fire Engulfed Terror Island (Japan)", 0 )
2314GAME( 1991, gunforcu, gunforce, raster,    gunforce, gunforce, ROT0,   "Irem America", "Gunforce - Battle Fire Engulfed Terror Island (US)", 0 )
2315GAME( 1991, bmaster,  0,        nonraster, bmaster,  bmaster,  ROT0,   "Irem",         "Blade Master (World)", 0 )
2316GAME( 1991, crossbld, bmaster,  nonraster, bmaster,  bmaster,  ROT0,   "Irem",         "Cross Blades! (Japan)", 0 )
2317GAME( 1991, lethalth, 0,        lethalth,  lethalth, lethalth, ROT270, "Irem",         "Lethal Thunder (World)", 0 )
2318GAME( 1991, thndblst, lethalth, lethalth,  lethalth, lethalth, ROT270, "Irem",         "Thunder Blaster (Japan)", 0 )
2319GAME( 1992, uccops,   0,        raster,    uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (World)", 0 )
2320GAME( 1992, uccopsj,  uccops,   raster,    uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (Japan)", 0 )
2321GAME( 1992, mysticri, 0,        nonraster, mysticri, mysticri, ROT0,   "Irem",         "Mystic Riders (World)", 0 )
2322GAME( 1992, gunhohki, mysticri, nonraster, mysticri, mysticri, ROT0,   "Irem",         "Gun Hohki (Japan)", 0 )
2323GAME( 1992, majtitl2, 0,        raster,    majtitl2, majtitl2, ROT0,   "Irem",         "Major Title 2 (World)", 0 )
2324GAME( 1992, majtit2j, majtitl2, raster,    majtitl2, majtitl2, ROT0,   "Irem",         "Major Title 2 (Japan)", 0 )
2325GAME( 1992, skingame, majtitl2, raster,    majtitl2, majtitl2, ROT0,   "Irem America", "The Irem Skins Game (US set 1)", 0 )
2326GAME( 1992, skingam2, majtitl2, raster,    majtitl2, majtitl2, ROT0,   "Irem America", "The Irem Skins Game (US set 2)", 0 )
2327GAME( 1992, hook,     0,        nonraster, hook,     hook,     ROT0,   "Irem",         "Hook (World)", 0 )
2328GAME( 1992, hooku,    hook,     nonraster, hook,     hook,     ROT0,   "Irem America", "Hook (US)", 0 )
2329GAME( 1992, hookj,    hook,     nonraster, hook,     hook,     ROT0,   "Irem",         "Hook (Japan)", 0 )
2330GAME( 1992, rtypeleo, 0,        raster,    rtypeleo, rtypeleo, ROT0,   "Irem",         "R-Type Leo (World)", 0 )
2331GAME( 1992, rtypelej, rtypeleo, raster,    rtypeleo, rtypelej, ROT0,   "Irem",         "R-Type Leo (Japan)", 0 )
2332GAME( 1993, inthunt,  0,        raster,    inthunt,  inthunt,  ROT0,   "Irem",         "In The Hunt (World)", 0 )
2333GAME( 1993, inthuntu, inthunt,  raster,    inthunt,  inthunt,  ROT0,   "Irem America", "In The Hunt (US)", 0 )
2334GAME( 1993, kaiteids, inthunt,  raster,    inthunt,  kaiteids, ROT0,   "Irem",         "Kaitei Daisensou (Japan)", 0 )
2335GAME( 1993, nbbatman, 0,        raster,    nbbatman, nbbatman, ROT0,   "Irem America", "Ninja Baseball Batman (US)", GAME_IMPERFECT_GRAPHICS )
2336GAME( 1993, leaguemn, nbbatman, raster,    nbbatman, nbbatman, ROT0,   "Irem",         "Yakyuu Kakutou League-Man (Japan)", GAME_IMPERFECT_GRAPHICS )
2337GAME( 1993, ssoldier, 0,        psoldier,  psoldier, ssoldier, ROT0,   "Irem America", "Superior Soldiers (US)", GAME_IMPERFECT_SOUND )
2338GAME( 1993, psoldier, ssoldier, psoldier,  psoldier, psoldier, ROT0,   "Irem",         "Perfect Soldiers (Japan)", GAME_IMPERFECT_SOUND )
2339GAME( 1994, dsccr94j, dsoccr94, psoldier,  dsccr94j, dsccr94j, ROT0,   "Irem",         "Dream Soccer '94 (Japan)", 0 )
2340GAME( 1994, gunforc2, 0,        raster,    gunforc2, gunforc2, ROT0,   "Irem",         "Gunforce 2 (US)", 0 )
2341GAME( 1994, geostorm, gunforc2, raster,    gunforc2, gunforc2, ROT0,   "Irem",         "Geostorm (Japan)", 0 )
2011GAME( 1991, gunforce, 0,        m92,      gunforce, gunforce, ROT0,   "Irem",         "Gunforce - Battle Fire Engulfed Terror Island (World)", 0 )
2012GAME( 1991, gunforcj, gunforce, m92,      gunforce, gunforce, ROT0,   "Irem",         "Gunforce - Battle Fire Engulfed Terror Island (Japan)", 0 )
2013GAME( 1991, gunforcu, gunforce, m92,      gunforce, gunforce, ROT0,   "Irem America", "Gunforce - Battle Fire Engulfed Terror Island (US)", 0 )
2014GAME( 1991, bmaster,  0,        m92,      bmaster,  bmaster,  ROT0,   "Irem",         "Blade Master (World)", 0 )
2015GAME( 1991, crossbld, bmaster,  m92,      bmaster,  bmaster,  ROT0,   "Irem",         "Cross Blades! (Japan)", 0 )
2016GAME( 1991, lethalth, 0,        lethalth, lethalth, lethalth, ROT270, "Irem",         "Lethal Thunder (World)", 0 )
2017GAME( 1991, thndblst, lethalth, lethalth, lethalth, lethalth, ROT270, "Irem",         "Thunder Blaster (Japan)", 0 )
2018GAME( 1992, uccops,   0,        m92,      uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (World)", 0 )
2019GAME( 1992, uccopsj,  uccops,   m92,      uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (Japan)", 0 )
2020GAME( 1992, mysticri, 0,        m92,      mysticri, mysticri, ROT0,   "Irem",         "Mystic Riders (World)", 0 )
2021GAME( 1992, gunhohki, mysticri, m92,      mysticri, mysticri, ROT0,   "Irem",         "Gun Hohki (Japan)", 0 )
2022GAME( 1992, majtitl2, 0,        m92,      majtitl2, majtitl2, ROT0,   "Irem",         "Major Title 2 (World)", 0 )
2023GAME( 1992, majtit2j, majtitl2, m92,      majtitl2, majtitl2, ROT0,   "Irem",         "Major Title 2 (Japan)", 0 )
2024GAME( 1992, skingame, majtitl2, m92,      majtitl2, majtitl2, ROT0,   "Irem America", "The Irem Skins Game (US set 1)", 0 )
2025GAME( 1992, skingam2, majtitl2, m92,      majtitl2, majtitl2, ROT0,   "Irem America", "The Irem Skins Game (US set 2)", 0 )
2026GAME( 1992, hook,     0,        m92,      hook,     hook,     ROT0,   "Irem",         "Hook (World)", 0 )
2027GAME( 1992, hooku,    hook,     m92,      hook,     hook,     ROT0,   "Irem America", "Hook (US)", 0 )
2028GAME( 1992, hookj,    hook,     m92,      hook,     hook,     ROT0,   "Irem",         "Hook (Japan)", 0 )
2029GAME( 1992, rtypeleo, 0,        m92,      rtypeleo, rtypeleo, ROT0,   "Irem",         "R-Type Leo (World)", 0 )
2030GAME( 1992, rtypelej, rtypeleo, m92,      rtypeleo, rtypelej, ROT0,   "Irem",         "R-Type Leo (Japan)", 0 )
2031GAME( 1993, inthunt,  0,        m92,      inthunt,  inthunt,  ROT0,   "Irem",         "In The Hunt (World)", 0 )
2032GAME( 1993, inthuntu, inthunt,  m92,      inthunt,  inthunt,  ROT0,   "Irem America", "In The Hunt (US)", 0 )
2033GAME( 1993, kaiteids, inthunt,  m92,      inthunt,  kaiteids, ROT0,   "Irem",         "Kaitei Daisensou (Japan)", 0 )
2034GAME( 1993, nbbatman, 0,        m92,      nbbatman, nbbatman, ROT0,   "Irem America", "Ninja Baseball Batman (US)", GAME_IMPERFECT_GRAPHICS )
2035GAME( 1993, leaguemn, nbbatman, m92,      nbbatman, nbbatman, ROT0,   "Irem",         "Yakyuu Kakutou League-Man (Japan)", GAME_IMPERFECT_GRAPHICS )
2036GAME( 1993, ssoldier, 0,        psoldier, psoldier, ssoldier, ROT0,   "Irem America", "Superior Soldiers (US)", GAME_IMPERFECT_SOUND )
2037GAME( 1993, psoldier, ssoldier, psoldier, psoldier, psoldier, ROT0,   "Irem",         "Perfect Soldiers (Japan)", GAME_IMPERFECT_SOUND )
2038GAME( 1994, dsccr94j, dsoccr94, psoldier, dsccr94j, dsccr94j, ROT0,   "Irem",         "Dream Soccer '94 (Japan)", 0 )
2039GAME( 1994, gunforc2, 0,        m92,      gunforc2, gunforc2, ROT0,   "Irem",         "Gunforce 2 (US)", 0 )
2040GAME( 1994, geostorm, gunforc2, m92,      gunforc2, gunforc2, ROT0,   "Irem",         "Geostorm (Japan)", 0 )
src/mame/drivers/m92.h
r869r870
1818   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(_n_) \
1919   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(_n_)
2020
21#define IREM_JOYSTICKS_1_2 \
22   PORT_START_TAG("JOY12")   \
23   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) \
24   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) \
25   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) \
26   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) \
27   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) \
28   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) \
29   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \
30   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \
31   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) \
32   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) \
33   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) \
34   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) \
35   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) \
36   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED ) \
37   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) \
38   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
39
2140/* Player 3 and 4 have IN similar to Player 1 and 2, but have the COIN and START buttons */
2241#define IREM_JOYSTICK_3_4(_n_) \
2342   PORT_START   \
r869r870
3049   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(_n_) \
3150   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(_n_)
3251
52#define IREM_JOYSTICKS_3_4 \
53   PORT_START_TAG("JOY34")   \
54   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) \
55   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) \
56   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) \
57   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) \
58   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START3 ) /* If common slots, Coin3 if separate */ \
59   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN3 ) \
60   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) \
61   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) \
62   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) \
63   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) \
64   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) \
65   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) \
66   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START4 ) /* If common slots, Coin3 if separate */ \
67   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN4 ) \
68   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) \
69   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
70
3371#define IREM_COINS \
3472   PORT_START   \
3573   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) \
r869r870
6199   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) ) \
62100   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
63101
102#define IREM_COIN_MODE_1_NEW_HIGH \
103   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:5,6,7,8") \
104   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) ) \
105   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) ) \
106   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) ) \
107   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) ) \
108   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) ) \
109   PORT_DIPSETTING(    0x1000, "2 Coins to Start/1 to Continue") \
110   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) ) \
111   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) ) \
112   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) ) \
113   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) ) \
114   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) ) \
115   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) ) \
116   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) ) \
117   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) ) \
118   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) ) \
119   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
120
64121#define IREM_COIN_MODE_2 \
65122   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
66123   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) ) \
r869r870
138195   PORT_DIPSETTING(    0x00, "2" ) \
139196   IREM_COIN_MODE_1_NEW
140197
198#define IREM_COINS_SYSTEMDIPS(custom) \
199   PORT_START_TAG("COINS_DIPS")   \
200   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) \
201   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 ) \
202   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 ) \
203   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 ) \
204   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
205   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE )  \
206   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )  \
207   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom, 0) /* Actually vblank, handled above */ \
208   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) \
209   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) ) \
210   PORT_DIPSETTING(      0x0000, DEF_STR( On ) ) \
211   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) \
212   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) ) \
213   PORT_DIPSETTING(      0x0000, DEF_STR( On ) ) \
214   PORT_DIPNAME( 0x0400, 0x0400, "Coin Slots" ) \
215   PORT_DIPSETTING(      0x0400, "Common" ) \
216   PORT_DIPSETTING(      0x0000, "Separate" ) \
217   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) /* Default 1 */ \
218   PORT_DIPSETTING(      0x0800, "1" ) \
219   PORT_DIPSETTING(      0x0000, "2" ) \
220   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:5,6,7,8") \
221   PORT_DIPSETTING(      0xa000, DEF_STR( 6C_1C ) ) \
222   PORT_DIPSETTING(      0xb000, DEF_STR( 5C_1C ) ) \
223   PORT_DIPSETTING(      0xc000, DEF_STR( 4C_1C ) ) \
224   PORT_DIPSETTING(      0xd000, DEF_STR( 3C_1C ) ) \
225   PORT_DIPSETTING(      0xe000, DEF_STR( 2C_1C ) ) \
226   PORT_DIPSETTING(      0x1000, "2 Coins to Start/1 to Continue") \
227   PORT_DIPSETTING(      0x3000, DEF_STR( 3C_2C ) ) \
228   PORT_DIPSETTING(      0x2000, DEF_STR( 4C_3C ) ) \
229   PORT_DIPSETTING(      0xf000, DEF_STR( 1C_1C ) ) \
230   PORT_DIPSETTING(      0x4000, DEF_STR( 2C_3C ) ) \
231   PORT_DIPSETTING(      0x9000, DEF_STR( 1C_2C ) ) \
232   PORT_DIPSETTING(      0x8000, DEF_STR( 1C_3C ) ) \
233   PORT_DIPSETTING(      0x7000, DEF_STR( 1C_4C ) ) \
234   PORT_DIPSETTING(      0x6000, DEF_STR( 1C_5C ) ) \
235   PORT_DIPSETTING(      0x5000, DEF_STR( 1C_6C ) ) \
236   PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
237
238
141239#define IREM_PORT_UNUSED \
142240   PORT_START   \
143   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
241   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
144242
src/mame/drivers/marineb.c
r869r870
524524   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
525525
526526   MDRV_SCREEN_REFRESH_RATE(60)
527   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(5000)   /* frames per second, vblank duration */)
527   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(5000)   /* frames per second, vblank duration */)
528528
529529   MDRV_MACHINE_RESET(marineb)
530530
src/mame/drivers/circus.c
r869r870
279279   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
280280
281281   MDRV_SCREEN_REFRESH_RATE(57)
282   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3500)  /* frames per second, vblank duration (complete guess) */)
282   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3500)  /* frames per second, vblank duration (complete guess) */)
283283
284284   /* video hardware */
285285   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
314314   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
315315
316316   MDRV_SCREEN_REFRESH_RATE(57)
317   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3500)  /* frames per second, vblank duration (complete guess) */)
317   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3500)  /* frames per second, vblank duration (complete guess) */)
318318
319319   /* video hardware */
320320   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
348348   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
349349
350350   MDRV_SCREEN_REFRESH_RATE(57)
351   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3500)  /* frames per second, vblank duration (complete guess) */)
351   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3500)  /* frames per second, vblank duration (complete guess) */)
352352
353353   /* video hardware */
354354   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
r869r870
382382   //MDRV_CPU_VBLANK_INT(ripcord_interrupt,1) //AT
383383
384384   MDRV_SCREEN_REFRESH_RATE(57)
385   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(3500)  /* frames per second, vblank duration (complete guess) */)
385   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3500)  /* frames per second, vblank duration (complete guess) */)
386386
387387   /* video hardware */
388388   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/zac2650.c
r869r870
329329   MDRV_CPU_IO_MAP(readport,0)
330330
331331   MDRV_SCREEN_REFRESH_RATE(55)
332   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1041))
332   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1041))
333333
334334   /* video hardware */
335335   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mame/drivers/gunpey.c
r869r870
4747
4848#include "driver.h"
4949
50static UINT8 *unkram;
51static UINT8 *mainram;
50static UINT16 *unkram;
51static UINT16 *mainram;
5252
5353VIDEO_START( gunpey )
5454{
r869r870
6060   return 0;
6161}
6262
63static WRITE8_HANDLER(unk_w)
63static WRITE16_HANDLER(unk_w)
6464{
65   unkram[offset]=data;
65   COMBINE_DATA(&unkram[offset]);
6666}
6767
6868
69static READ8_HANDLER(unk_r)
69static READ16_HANDLER(unk_r)
7070{
7171   // c9 = status ? //40 10 04=start ?
7272   // 40,41,44 = ?
7373   // 4a = flags?
74      if(offset==0xc9 )//|| offset==0x40 || offset==0x41 || offset==0x44)
74      if(offset==0xc9/2 )//|| offset==0x40 || offset==0x41 || offset==0x44)
7575         return mame_rand(Machine);
7676   return unkram[offset];
7777}
7878
7979
80static WRITE8_HANDLER(main_w)
80static WRITE16_HANDLER(main_w)
8181{
82   mainram[offset]=data;
82   COMBINE_DATA(&mainram[offset]);
8383}
8484
8585
86static READ8_HANDLER(main_r)
86static READ16_HANDLER(main_r)
8787{
88
89   if(offset>0x502d && offset<0x56c0)
90      logerror("R %x @%x\n",offset,activecpu_get_pc());
88   if(offset>0x502d/2 && offset<0x56c0/2)
89      logerror("R %x @%x\n",offset*2,activecpu_get_pc());
9190   return mainram[offset];
9291}
9392
9493
9594/***************************************************************************************/
9695
97static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 8 )
98   AM_RANGE(0x00000, 0x0ffff) AM_READ(main_r) AM_WRITE(main_w) AM_BASE(&mainram)
96static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 16 )
97   AM_RANGE(0x00000, 0x0ffff) AM_READWRITE(main_r, main_w) AM_BASE(&mainram)
9998   AM_RANGE(0x50000, 0x500ff) AM_RAM AM_BASE(&unkram)
10099   AM_RANGE(0x50100, 0x502ff) AM_NOP
101100   AM_RANGE(0x80000, 0xfffff) AM_ROM
102101ADDRESS_MAP_END
103102
104static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
105   AM_RANGE(0x7f00, 0x7fff) AM_READ(unk_r) AM_WRITE(unk_w)
103static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 16 )
104   AM_RANGE(0x7f00, 0x7fff) AM_READWRITE(unk_r, unk_w)
106105ADDRESS_MAP_END
107106
108107
src/mame/drivers/taito_f3.c
r869r870
448448   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
449449
450450   MDRV_SCREEN_REFRESH_RATE(58.97)
451   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(624) /* 58.97 Hz, 624us vblank time */)
451   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(624) /* 58.97 Hz, 624us vblank time */)
452452
453453   MDRV_MACHINE_START(f3)
454454   MDRV_MACHINE_RESET(f3)
src/mame/drivers/mcr.c
r869r870
15061506   MDRV_CPU_VBLANK_INT(mcr_interrupt,2)
15071507
15081508   MDRV_SCREEN_REFRESH_RATE(30)
1509   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_REAL_30HZ_VBLANK_DURATION))
1509   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_30HZ_VBLANK_DURATION)
15101510   MDRV_WATCHDOG_VBLANK_INIT(16)
15111511   MDRV_MACHINE_START(mcr)
15121512   MDRV_MACHINE_RESET(mcr)
src/mame/drivers/m107.c
r869r870
1414*******************************************************************************/
1515
1616#include "driver.h"
17#include "m92.h"
17#include "m107.h"
1818#include "machine/irem_cpu.h"
1919#include "sound/2151intf.h"
2020#include "sound/iremga20.h"
2121
22extern UINT8 *m107_vram_data;
23extern int m107_spritesystem;
24static UINT8 *m107_ram;
25static int m107_irq_vectorbase,m107_vblank,raster_enable;
26extern int m107_raster_irq_position,m107_sprite_list;
2722
28#define m107_IRQ_0 ((m107_irq_vectorbase+0)/4) /* VBL interrupt*/
29#define m107_IRQ_1 ((m107_irq_vectorbase+4)/4) /* ??? */
30#define m107_IRQ_2 ((m107_irq_vectorbase+8)/4) /* Raster interrupt */
31#define m107_IRQ_3 ((m107_irq_vectorbase+12)/4) /* ??? */
23#define M107_IRQ_0 ((m107_irq_vectorbase+0)/4) /* VBL interrupt*/
24#define M107_IRQ_1 ((m107_irq_vectorbase+4)/4) /* ??? */
25#define M107_IRQ_2 ((m107_irq_vectorbase+8)/4) /* Raster interrupt */
26#define M107_IRQ_3 ((m107_irq_vectorbase+12)/4) /* ??? */
3227
33WRITE8_HANDLER( m107_spritebuffer_w );
34void m107_screenrefresh(mame_bitmap *bitmap,const rectangle *clip);
35VIDEO_UPDATE( m107 );
36VIDEO_UPDATE( dsoccr );
37VIDEO_START( m107 );
38WRITE8_HANDLER( m107_control_w );
39WRITE8_HANDLER( m107_vram_w );
40READ8_HANDLER( m107_vram_r );
4128
29
30static mame_timer *scanline_timer;
31static UINT8 m107_irq_vectorbase;
32
33static TIMER_CALLBACK( m107_scanline_interrupt );
34
4235/*****************************************************************************/
4336
44static WRITE8_HANDLER( bankswitch_w )
37static WRITE16_HANDLER( bankswitch_w )
4538{
46   UINT8 *RAM = memory_region(REGION_CPU1);
39   if (ACCESSING_LSB)
40   {
41      UINT8 *RAM = memory_region(REGION_CPU1);
42      memory_set_bankptr(1,&RAM[0x100000 + ((data&0x7)*0x10000)]);
43   }
44}
4745
48   if (offset==1) return; /* Unused top byte */
49   memory_set_bankptr(1,&RAM[0x100000 + ((data&0x7)*0x10000)]);
46static MACHINE_START( m107 )
47{
48   scanline_timer = mame_timer_alloc(m107_scanline_interrupt);
5049}
5150
52static READ8_HANDLER( m107_port_4_r )
51static MACHINE_RESET( m107 )
5352{
54   if (m107_vblank) return readinputport(4) | 0;
55   return readinputport(4) | 0x80;
53   mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_never);
5654}
5755
58static WRITE8_HANDLER( m107_coincounter_w )
56/*****************************************************************************/
57
58static TIMER_CALLBACK( m107_scanline_interrupt )
5959{
60   if (offset==0) {
60   int scanline = param;
61
62   /* raster interrupt */
63   if (scanline == m107_raster_irq_position)
64   {
65      video_screen_update_partial(0, scanline);
66      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M107_IRQ_2);
67   }
68
69   /* VBLANK interrupt */
70   else if (scanline == machine->screen[0].visarea.max_y + 1)
71   {
72      video_screen_update_partial(0, scanline);
73      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M107_IRQ_0);
74   }
75
76   /* adjust for next scanline */
77   if (++scanline >= machine->screen[0].height)
78      scanline = 0;
79   mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, time_never);
80}
81
82
83static WRITE16_HANDLER( m107_coincounter_w )
84{
85   if (ACCESSING_LSB)
86   {
6187      coin_counter_w(0,data & 0x01);
6288      coin_counter_w(1,data & 0x02);
6389   }
r869r870
91117      cpunum_set_input_line(1,0,ASSERT_LINE);
92118}
93119
94static WRITE8_HANDLER( m92_soundlatch_w )
120static WRITE16_HANDLER( m107_soundlatch_w )
95121{
96   if (offset==0)
97   {
98      timer_call_after_resynch(V30_ASSERT,setvector_callback);
99      soundlatch_w(0,data);
122   timer_call_after_resynch(V30_ASSERT,setvector_callback);
123   soundlatch_w(0, data & 0xff);
100124//      logerror("soundlatch_w %02x\n",data);
101   }
102125}
103126
104127static int sound_status;
105128
106static READ8_HANDLER( m92_sound_status_r )
129static READ16_HANDLER( m107_sound_status_r )
107130{
108   return 0xff;
131   return sound_status;
109132}
110133
111static READ8_HANDLER( m92_soundlatch_r )
134static READ16_HANDLER( m107_soundlatch_r )
112135{
113   if (offset == 0)
114   {
115      int res = soundlatch_r(offset);
116//      logerror("soundlatch_r %02x\n",res);
117      return res;
118   }
119   else return 0xff;
136   return soundlatch_r(offset) | 0xff00;
120137}
121138
122static WRITE8_HANDLER( m92_sound_irq_ack_w )
139static WRITE16_HANDLER( m107_sound_irq_ack_w )
123140{
124   if (offset == 0)
125   {
126      timer_call_after_resynch(V30_CLEAR,setvector_callback);
127   }
141   timer_call_after_resynch(V30_CLEAR,setvector_callback);
128142}
129143
130static WRITE8_HANDLER( m92_sound_status_w )
144static WRITE16_HANDLER( m107_sound_status_w )
131145{
132   if (offset == 0)
133   {
134//      popmessage("sound answer %02x",data);
135      sound_status = data;
136   }
146   COMBINE_DATA(&sound_status);
147   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, M107_IRQ_3);
137148}
138149
139150/*****************************************************************************/
140151
141static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
142   AM_RANGE(0x00000, 0x9ffff) AM_READ(MRA8_ROM)
143   AM_RANGE(0xa0000, 0xbffff) AM_READ(MRA8_BANK1)
144   AM_RANGE(0xd0000, 0xdffff) AM_READ(m107_vram_r)
145   AM_RANGE(0xe0000, 0xeffff) AM_READ(MRA8_RAM)
146   AM_RANGE(0xf8000, 0xf8fff) AM_READ(MRA8_RAM)
147   AM_RANGE(0xf9000, 0xf9fff) AM_READ(paletteram_r)
148   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
152static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
153   AM_RANGE(0x00000, 0x9ffff) AM_ROM
154   AM_RANGE(0xa0000, 0xbffff) AM_ROMBANK(1)
155   AM_RANGE(0xd0000, 0xdffff) AM_READWRITE(MRA16_RAM, m107_vram_w) AM_BASE(&m107_vram_data)
156   AM_RANGE(0xe0000, 0xeffff) AM_RAM /* System ram */
157   AM_RANGE(0xf8000, 0xf8fff) AM_RAM AM_BASE(&spriteram16)
158   AM_RANGE(0xf9000, 0xf9fff) AM_READWRITE(MRA16_RAM, paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
159   AM_RANGE(0xffff0, 0xfffff) AM_ROM
149160ADDRESS_MAP_END
150161
151static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
152   AM_RANGE(0x00000, 0xbffff) AM_WRITE(MWA8_ROM)
153   AM_RANGE(0xd0000, 0xdffff) AM_WRITE(m107_vram_w) AM_BASE(&m107_vram_data)
154   AM_RANGE(0xe0000, 0xeffff) AM_WRITE(MWA8_RAM) AM_BASE(&m107_ram) /* System ram */
155   AM_RANGE(0xf8000, 0xf8fff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram)
156   AM_RANGE(0xf9000, 0xf9fff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_BASE(&paletteram)
157   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
158ADDRESS_MAP_END
159
160static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
161   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r) /* Player 1 */
162   AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r) /* Player 2 */
163   AM_RANGE(0x02, 0x02) AM_READ(m107_port_4_r)   /* Coins */
164   AM_RANGE(0x03, 0x03) AM_READ(input_port_7_r) /* Dip 3 */
165   AM_RANGE(0x04, 0x04) AM_READ(input_port_6_r) /* Dip 2 */
166   AM_RANGE(0x05, 0x05) AM_READ(input_port_5_r) /* Dip 1 */
167   AM_RANGE(0x06, 0x06) AM_READ(input_port_2_r) /* Player 3 */
168   AM_RANGE(0x07, 0x07) AM_READ(input_port_3_r) /* Player 4 */
169   AM_RANGE(0x08, 0x09) AM_READ(m92_sound_status_r)   /* answer from sound CPU */
170   AM_RANGE(0xc0, 0xc2) AM_READ(MRA8_NOP) /* Only wpksoc: ticket related? */
171ADDRESS_MAP_END
172
173static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
174   AM_RANGE(0x00, 0x01) AM_WRITE(m92_soundlatch_w)
162static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 16 )
163   AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r) /* Player 1+2 */
164   AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r) /* Coins + DIP 3 */
165   AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r) /* Dip 2+1 */
166   AM_RANGE(0x06, 0x07) AM_READ(input_port_3_word_r) /* Player 3+4 */
167   AM_RANGE(0x08, 0x09) AM_READ(m107_sound_status_r)   /* answer from sound CPU */
168   AM_RANGE(0x00, 0x01) AM_WRITE(m107_soundlatch_w)
175169   AM_RANGE(0x02, 0x03) AM_WRITE(m107_coincounter_w)
176   AM_RANGE(0x04, 0x05) AM_WRITE(MWA8_NOP) /* ??? 0008 */
170   AM_RANGE(0x04, 0x05) AM_WRITE(MWA16_NOP) /* ??? 0008 */
177171   AM_RANGE(0x06, 0x07) AM_WRITE(bankswitch_w)
178172   AM_RANGE(0x80, 0x9f) AM_WRITE(m107_control_w)
179   AM_RANGE(0xa0, 0xaf) AM_WRITE(MWA8_NOP) /* Written with 0's in interrupt */
173   AM_RANGE(0xa0, 0xaf) AM_WRITE(MWA16_NOP) /* Written with 0's in interrupt */
180174   AM_RANGE(0xb0, 0xb1) AM_WRITE(m107_spritebuffer_w)
175   AM_RANGE(0xc0, 0xc3) AM_READ(MRA16_NOP) /* Only wpksoc: ticket related? */
181176ADDRESS_MAP_END
182177
183178/******************************************************************************/
184179
185static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
186   AM_RANGE(0x00000, 0x1ffff) AM_READ(MRA8_ROM)
187   AM_RANGE(0xa0000, 0xa3fff) AM_READ(MRA8_RAM)
188   AM_RANGE(0xa8000, 0xa803f) AM_READ(IremGA20_r)
189   AM_RANGE(0xa8042, 0xa8043) AM_READ(YM2151_status_port_0_r)
190   AM_RANGE(0xa8044, 0xa8045) AM_READ(m92_soundlatch_r)
191   AM_RANGE(0xffff0, 0xfffff) AM_READ(MRA8_ROM)
180static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
181   AM_RANGE(0x00000, 0x1ffff) AM_ROM
182   AM_RANGE(0x9ff00, 0x9ffff) AM_WRITE(MWA16_NOP) /* Irq controller? */
183   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
184   AM_RANGE(0xa8000, 0xa803f) AM_READWRITE(IremGA20_r, IremGA20_w)
185   AM_RANGE(0xa8040, 0xa8041) AM_WRITE(YM2151_register_port_0_lsb_w)
186   AM_RANGE(0xa8042, 0xa8043) AM_READWRITE(YM2151_status_port_0_lsb_r, YM2151_data_port_0_lsb_w)
187   AM_RANGE(0xa8044, 0xa8045) AM_READWRITE(m107_soundlatch_r, m107_sound_irq_ack_w)
188   AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m107_sound_status_w)
189   AM_RANGE(0xffff0, 0xfffff) AM_ROM
192190ADDRESS_MAP_END
193191
194static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
195   AM_RANGE(0x00000, 0x1ffff) AM_WRITE(MWA8_ROM)
196   AM_RANGE(0x9ff00, 0x9ffff) AM_WRITE(MWA8_NOP) /* Irq controller? */
197   AM_RANGE(0xa0000, 0xa3fff) AM_WRITE(MWA8_RAM)
198   AM_RANGE(0xa8000, 0xa803f) AM_WRITE(IremGA20_w)
199   AM_RANGE(0xa8040, 0xa8041) AM_WRITE(YM2151_register_port_0_w)
200   AM_RANGE(0xa8042, 0xa8043) AM_WRITE(YM2151_data_port_0_w)
201   AM_RANGE(0xa8044, 0xa8045) AM_WRITE(m92_sound_irq_ack_w)
202   AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m92_sound_status_w)
203   AM_RANGE(0xffff0, 0xfffff) AM_WRITE(MWA8_ROM)
204ADDRESS_MAP_END
192/******************************************************************************/
205193
194static INPUT_PORTS_START( m107_2player )
195   PORT_START_TAG("JOY12")
196   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
197   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
198   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
199   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
200   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED )
201   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
202   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
203   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
204   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
205   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
206   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
207   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
208   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED )
209   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED )
210   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
211   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
212
213   PORT_START_TAG("COINS_DIPS")
214   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
215   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
216   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
217   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
218   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
219   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE )
220   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
221   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_VBLANK )
222
223   /* DIP switch bank 3 */
224   PORT_DIPUNKNOWN( 0x0100, 0x0100 )
225   PORT_DIPUNKNOWN( 0x0200, 0x0200 )
226   PORT_DIPUNKNOWN( 0x0400, 0x0400 )
227   PORT_DIPUNKNOWN( 0x0800, 0x0800 )
228   PORT_DIPUNKNOWN( 0x1000, 0x1000 )
229   PORT_DIPUNKNOWN( 0x2000, 0x2000 )
230   PORT_DIPUNKNOWN( 0x4000, 0x4000 )
231   PORT_DIPUNKNOWN( 0x8000, 0x8000 )
232
233   PORT_START_TAG("DIPS21")
234   /* Dip switch bank 1 */
235   PORT_DIPUNKNOWN( 0x0001, 0x0001 )
236   PORT_DIPUNKNOWN( 0x0002, 0x0002 )
237   PORT_DIPUNKNOWN( 0x0004, 0x0004 )
238   PORT_DIPUNKNOWN( 0x0008, 0x0008 )
239   PORT_DIPUNKNOWN( 0x0010, 0x0010 )
240   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) )
241   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
242   PORT_DIPSETTING(      0x0020, DEF_STR( Yes ) )
243   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
244   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
245   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
246   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
247   /* Dip switch bank 2 */
248   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
249   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
250   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
251   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
252   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
253   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
254   PORT_DIPNAME( 0x0400, 0x0400, "Coin Slots" )
255   PORT_DIPSETTING(      0x0400, "Common" )
256   PORT_DIPSETTING(      0x0000, "Separate" )
257   PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) /* Default 1 */
258   PORT_DIPSETTING(      0x0800, "1" )
259   PORT_DIPSETTING(      0x0000, "2" )
260   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:5,6,7,8")
261   PORT_DIPSETTING(      0xa000, DEF_STR( 6C_1C ) )
262   PORT_DIPSETTING(      0xb000, DEF_STR( 5C_1C ) )
263   PORT_DIPSETTING(      0xc000, DEF_STR( 4C_1C ) )
264   PORT_DIPSETTING(      0xd000, DEF_STR( 3C_1C ) )
265   PORT_DIPSETTING(      0xe000, DEF_STR( 2C_1C ) )
266   PORT_DIPSETTING(      0x1000, "2 Coins to Start/1 to Continue")
267   PORT_DIPSETTING(      0x3000, DEF_STR( 3C_2C ) )
268   PORT_DIPSETTING(      0x2000, DEF_STR( 4C_3C ) )
269   PORT_DIPSETTING(      0xf000, DEF_STR( 1C_1C ) )
270   PORT_DIPSETTING(      0x4000, DEF_STR( 2C_3C ) )
271   PORT_DIPSETTING(      0x9000, DEF_STR( 1C_2C ) )
272   PORT_DIPSETTING(      0x8000, DEF_STR( 1C_3C ) )
273   PORT_DIPSETTING(      0x7000, DEF_STR( 1C_4C ) )
274   PORT_DIPSETTING(      0x6000, DEF_STR( 1C_5C ) )
275   PORT_DIPSETTING(      0x5000, DEF_STR( 1C_6C ) )
276   PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
277
278   PORT_START_TAG("JOY34")
279   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
280INPUT_PORTS_END
281
282
283static INPUT_PORTS_START( m107_3player )
284   PORT_INCLUDE(m107_2player)
285
286   PORT_MODIFY("DIPS21")
287   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Cabinet ) )
288   PORT_DIPSETTING(      0x0200, "2 Players" )
289   PORT_DIPSETTING(      0x0000, "3 Players" )
290
291   PORT_MODIFY("JOY34")
292   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
293   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
294   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
295   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
296   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START3 ) /* If common slots, Coin3 if separate */
297   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN3 )
298   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
299   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
300   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
301INPUT_PORTS_END
302
303
304static INPUT_PORTS_START( m107_4player )
305   PORT_INCLUDE(m107_3player)
306
307   PORT_MODIFY("DIPS21")
308   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Cabinet ) )
309   PORT_DIPSETTING(      0x0200, "2 Players" )
310   PORT_DIPSETTING(      0x0000, "4 Players" )
311
312   PORT_MODIFY("JOY34")
313   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
314   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
315   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
316   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
317   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START4 ) /* If common slots, Coin3 if separate */
318   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN4 )
319   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
320   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
321INPUT_PORTS_END
322
206323/******************************************************************************/
207324
208325INPUT_PORTS_START( firebarr )
209   IREM_JOYSTICK_1_2(1)
210   IREM_JOYSTICK_1_2(2)
211   IREM_PORT_UNUSED
212   IREM_PORT_UNUSED
213   IREM_COINS
214   IREM_SYSTEM_DIPSWITCH
326   PORT_INCLUDE(m107_2player)
215327
216   PORT_START
217   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
218   PORT_DIPSETTING(    0x00, "2" )
219   PORT_DIPSETTING(    0x03, "3" )
220   PORT_DIPSETTING(    0x02, "4" )
221   PORT_DIPSETTING(    0x01, "5" )
222   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
223   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
224   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
225   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
226   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
227   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
228   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
229   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
230   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
231   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
232   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
233   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
234   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
235   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
236   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
237   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
328   PORT_MODIFY("COINS_DIPS")
329   PORT_DIPNAME( 0x1000, 0x0000, "Continuous Play" )
330   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
331   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
238332
239   PORT_START
240   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
241   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
242   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
243   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
244   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
245   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
246   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
247   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
248   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
249   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
250   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
251   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
252   PORT_DIPNAME( 0x10, 0x00, "Continuous Play" )
253   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
254   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
255   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
256   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
257   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
258   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
259   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
260   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
261   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
262   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
263   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
333   PORT_MODIFY("DIPS21")
334   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )
335   PORT_DIPSETTING(      0x0000, "2" )
336   PORT_DIPSETTING(      0x0003, "3" )
337   PORT_DIPSETTING(      0x0002, "4" )
338   PORT_DIPSETTING(      0x0001, "5" )
264339INPUT_PORTS_END
265340
341
266342INPUT_PORTS_START( dsoccr94 )
267   IREM_JOYSTICK_1_2(1)
268   IREM_JOYSTICK_1_2(2)
269   IREM_JOYSTICK_3_4(3)
270   IREM_JOYSTICK_3_4(4)
271   IREM_COINS
272   IREM_SYSTEM_DIPSWITCH /* Dip Switch 2, dip 2 is listed as "Don't Change" and is "OFF" */
343   PORT_INCLUDE(m107_4player)
273344
274   PORT_START   /* Dip switch bank 1 */
275   PORT_DIPNAME( 0x03, 0x03, "Time" )
276   PORT_DIPSETTING(    0x00, "1:30" )
277   PORT_DIPSETTING(    0x03, "2:00" )
278   PORT_DIPSETTING(    0x02, "2:30" )
279   PORT_DIPSETTING(    0x01, "3:00" )
280   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
281   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
282   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
283   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
284   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
285   PORT_DIPNAME( 0x10, 0x10, "Game Mode" )
286   PORT_DIPSETTING(    0x10, "Match Mode" )
287   PORT_DIPSETTING(    0x00, "Power Mode" )
345   PORT_MODIFY("COINS_DIPS")
346   PORT_DIPNAME( 0x0300, 0x0300, "Player Power" )
347   PORT_DIPSETTING(      0x0000, "500" )
348   PORT_DIPSETTING(      0x0300, "1000" )
349   PORT_DIPSETTING(      0x0100, "1500" )
350   PORT_DIPSETTING(      0x0200, "2000" )
351
352   PORT_MODIFY("DIPS21")
353   /* Dip switch bank 1 */
354   PORT_DIPNAME( 0x0003, 0x0003, "Time" )
355   PORT_DIPSETTING(      0x0000, "1:30" )
356   PORT_DIPSETTING(      0x0003, "2:00" )
357   PORT_DIPSETTING(      0x0002, "2:30" )
358   PORT_DIPSETTING(      0x0001, "3:00" )
359   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
360   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Easy ) )
361   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
362   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
363   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
364   PORT_DIPNAME( 0x0010, 0x0010, "Game Mode" )
365   PORT_DIPSETTING(      0x0010, "Match Mode" )
366   PORT_DIPSETTING(      0x0000, "Power Mode" )
288367/*
289368   Match Mode: Winner advances to the next game.  Game Over for the loser
290369   Power Mode: The Players can play the game until their respective powers run
r869r870
292371               Player 2 can join in any time during the game
293372               Player power (time) can be adjusted by dip switch #3
294373*/
295   PORT_DIPNAME( 0x20, 0x20, "Starting Button" )
296   PORT_DIPSETTING(    0x00, "Button 1" )
297   PORT_DIPSETTING(    0x20, "Start Button" )
298   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
299   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
300   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
301   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
374   PORT_DIPNAME( 0x0020, 0x0020, "Starting Button" )
375   PORT_DIPSETTING(      0x0000, "Button 1" )
376   PORT_DIPSETTING(      0x0020, "Start Button" )
377   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
378   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
379   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
380   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
302381
303382   PORT_START   /* Dip switch bank 3 */
304   PORT_DIPNAME( 0x03, 0x03, "Player Power" )
305   PORT_DIPSETTING(    0x00, "500" )
306   PORT_DIPSETTING(    0x03, "1000" )
307   PORT_DIPSETTING(    0x01, "1500" )
308   PORT_DIPSETTING(    0x02, "2000" )
309383   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
310384   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
311385   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r869r870
327401INPUT_PORTS_END
328402
329403INPUT_PORTS_START( wpksoc )
330   IREM_JOYSTICK_1_2(1)
331   IREM_JOYSTICK_1_2(2)
332   PORT_START /* not used */
333   PORT_START /* not used*/
334   IREM_COINS
335   IREM_SYSTEM_DIPSWITCH_4PLAYERS
336
337   PORT_START
338   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
339   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
340   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
341   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
342   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
343   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
344   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
345   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
346   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
347   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
348   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
349   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
350   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
351   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
352   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
353   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
354   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
355   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
356   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
357   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
358   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
359   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
360   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
361   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
362
363   PORT_START
364   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
365   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
366   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
367   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
368   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
369   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
370   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
371   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
372   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
373   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
374   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
375   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
376   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
377   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
378   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
379   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
380   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
381   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
382   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
383   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
384   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
385   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
386   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
387   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
404   PORT_INCLUDE(m107_2player)
388405INPUT_PORTS_END
389406
390407/***************************************************************************/
r869r870
461478
462479/***************************************************************************/
463480
464static INTERRUPT_GEN( m107_interrupt )
465{
466   m107_vblank=0;
467   video_screen_update_partial(0, 248+128);
468   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_0); /* VBL */
469}
470
471static INTERRUPT_GEN( m107_raster_interrupt )
472{
473   int line = 256 - cpu_getiloops();
474
475   if (input_code_pressed_once(KEYCODE_F1)) {
476      raster_enable ^= 1;
477      if (raster_enable)
478         popmessage("Raster IRQ enabled");
479      else
480         popmessage("Raster IRQ disabled");
481   }
482
483   /* Raster interrupt */
484   if (raster_enable && line==m107_raster_irq_position) {
485      video_screen_update_partial(0, line);
486      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_2);
487   }
488
489   /* Kludge to get Fire Barrel running */
490   else if (line==118)
491   {
492      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_3);
493   }
494
495   /* Redraw screen, then set vblank and trigger the VBL interrupt */
496   else if (line==248) {
497      video_screen_update_partial(0, 248);
498      m107_vblank=1;
499      cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_0);
500   }
501
502   /* End of vblank */
503   else if (line==255)
504      m107_vblank=0;
505}
506
507481static MACHINE_DRIVER_START( firebarr )
508482
509483   /* basic machine hardware */
510   MDRV_CPU_ADD(V33, 28000000/2)   /* NEC V33, 28MHz clock */
511   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
512   MDRV_CPU_IO_MAP(readport,writeport)
513   MDRV_CPU_VBLANK_INT(m107_raster_interrupt,256) /* 8 prelines, 240 visible lines, 8 for vblank? */
484   MDRV_CPU_ADD_TAG("main", V33, 28000000/2)   /* NEC V33, 28MHz clock */
485   MDRV_CPU_PROGRAM_MAP(main_map,0)
486   MDRV_CPU_IO_MAP(main_portmap,0)
514487
515488   MDRV_CPU_ADD(V30, 14318000/2)
516489   /* audio CPU */   /* 14.318 MHz */
517   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
490   MDRV_CPU_PROGRAM_MAP(sound_map,0)
518491
492   MDRV_MACHINE_START(m107)
493   MDRV_MACHINE_RESET(m107)
519494   MDRV_SCREEN_REFRESH_RATE(60)
520495   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
521496
522497   /* video hardware */
523498   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
524499   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
525   MDRV_SCREEN_SIZE(512, 512)
526   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 128+8, 511-128-8) /* 320 x 240 */
500   MDRV_SCREEN_SIZE(512, 256)
501   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 8, 247) /* 320 x 240 */
527502   MDRV_GFXDECODE(firebarr_gfxdecodeinfo)
528503   MDRV_PALETTE_LENGTH(2048)
529504
r869r870
546521
547522
548523static MACHINE_DRIVER_START( dsoccr94 )
524   MDRV_IMPORT_FROM(firebarr)
549525
550526   /* basic machine hardware */
551   MDRV_CPU_ADD(V33, 20000000/2)   /* NEC V33, Could be 28MHz clock? */
552   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
553   MDRV_CPU_IO_MAP(readport,writeport)
554   MDRV_CPU_VBLANK_INT(m107_interrupt,1)
527   MDRV_CPU_REPLACE("main", V33, 20000000/2)   /* NEC V33, Could be 28MHz clock? */
555528
556   MDRV_CPU_ADD(V30, 14318000/2)
557   /* audio CPU */   /* 14.318 MHz */
558   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
559
560   MDRV_SCREEN_REFRESH_RATE(60)
561   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
562
563529   /* video hardware */
564   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
565   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
566   MDRV_SCREEN_SIZE(512, 512)
567   MDRV_SCREEN_VISIBLE_AREA(80, 511-112, 128+8, 511-128-8) /* 320 x 240 */
568530   MDRV_GFXDECODE(gfxdecodeinfo)
569   MDRV_PALETTE_LENGTH(2048)
570
571   MDRV_VIDEO_START(m107)
572   MDRV_VIDEO_UPDATE(m107)
573
574   /* sound hardware */
575   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
576
577   MDRV_SOUND_ADD(YM2151, 14318180/4)
578   MDRV_SOUND_CONFIG(ym2151_interface)
579   MDRV_SOUND_ROUTE(0, "left", 0.40)
580   MDRV_SOUND_ROUTE(1, "right", 0.40)
581
582   MDRV_SOUND_ADD(IREMGA20, 14318180/4)
583   MDRV_SOUND_CONFIG(iremGA20_interface)
584   MDRV_SOUND_ROUTE(0, "left", 1.0)
585   MDRV_SOUND_ROUTE(1, "right", 1.0)
586531MACHINE_DRIVER_END
587532
588533/***************************************************************************/
r869r870
694639
695640   m107_irq_vectorbase=0x20;
696641   m107_spritesystem = 1;
697
698   raster_enable=1;
699642}
700643
701644static DRIVER_INIT( dsoccr94 )
r869r870
712655
713656   m107_irq_vectorbase=0x80;
714657   m107_spritesystem = 0;
715
716   /* This game doesn't use raster IRQ's */
717   raster_enable=0;
718658}
719659
720660static DRIVER_INIT( wpksoc )
r869r870
731671
732672   m107_irq_vectorbase=0x80;
733673   m107_spritesystem = 0;
734
735   raster_enable=0;
736674}
737675
738676/***************************************************************************/
src/mame/drivers/ninjaw.c
r869r870
122122
1231231) 'ninjaw*'
124124
125  - Regoin stored at 0x01fffe.w
125  - Region stored at 0x01fffe.w
126126  - Sets :
127127      * 'ninjaw' : region = 0x0003
128128      * 'ninjawj' : region = 0x0000
r869r870
147147
1481482) 'darius2'
149149
150  - Regoin stored at 0x03fffe.w
150  - Region stored at 0x03fffe.w
151151  - Sets :
152152      * 'darius2' : region = 0x0001
153153  - Coinage relies on the region (code at 0x00f37a) :
154      * 0x0000 (Asia ?), 0x0001 (Japan) and 0x0002 (US) use TAITO_COINAGE_JAPAN_OLD
155      * 0x0002 (US, licenced to ROMSTAR) use slighlty different TAITO_COINAGE_US :
156          . coin A : 4C_3C instead of 4C_1C, same other settings otherwise
157          . coin B : same settings
154      * 0x0000 (?), 0x0001 (Japan) and 0x0002 (US) use TAITO_COINAGE_JAPAN_OLD
155      * 0x0002 (US, licenced to ROMSTAR) uses slighlty different TAITO_COINAGE_US :
156        4C_3C instead of 4C_1C, same other settings otherwise
158157      * 0x0003 (World) and 0x0004 to 0x0007 (?) use TAITO_COINAGE_WORLD
159158  - Texts and game name rely on the region :
160159      * 0x0001 : some texts in Japanese - game name is "Darius II"
r869r870
463462   /* 0x200000 (port 0) -> 0x0c2291.b and 0x24122c (shared RAM) */
464463   PORT_START_TAG("DSWA")
465464   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:1")
466   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
467   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
465   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
466   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
468467   PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" )
469468   TAITO_DSWA_BITS_2_TO_3_LOC(SW1)
470469   TAITO_COINAGE_WORLD_LOC(SW1)
r869r870
479478   PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" )        /* see notes */
480479   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" )
481480
482   PORT_START_TAG("IN2")
481   PORT_START_TAG("IN0")
483482   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )                /* Stops working if this is high */
484483   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
485484   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
r869r870
489488   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
490489   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
491490
492   PORT_START_TAG("IN3")
491   PORT_START_TAG("IN1")
493492   TAITO_JOY_DUAL_UDRL( 1, 2 )
494493
495   PORT_START_TAG("IN4")
494   PORT_START_TAG("IN2")
496495   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
497496   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
498497   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r869r870
520519   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")    /* code at 0x00c20e */
521520   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
522521   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
523   PORT_DIPNAME( 0x02, 0x02, "Continuous Fire" ) PORT_DIPLOCATION("SW1:2")
522   PORT_DIPNAME( 0x02, 0x02, "Auto Fire" ) PORT_DIPLOCATION("SW1:2")
524523   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
525524   PORT_DIPSETTING(    0x00, "Fast" )
526525   TAITO_DSWA_BITS_2_TO_3_LOC(SW1)
r869r870
543542   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
544543   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
545544   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:8")
546   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
547   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
545   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
546   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
548547INPUT_PORTS_END
549548
550549
src/mame/drivers/bwing.c
r869r870
406406   MDRV_CPU_PERIODIC_INT(bwp3_interrupt, 1000)
407407
408408   MDRV_SCREEN_REFRESH_RATE(60)
409   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(600))   // must be long enough for polling
409   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(600))   // must be long enough for polling
410410   MDRV_INTERLEAVE(300)      // high enough?
411411
412412   MDRV_MACHINE_RESET(bwing)
src/mame/drivers/konamim2.c
r869r870
10521052   MDRV_CPU_PROGRAM_MAP(m2_main, 0)
10531053
10541054   MDRV_SCREEN_REFRESH_RATE(60)
1055   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
1055   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
10561056
10571057    /* video hardware */
10581058   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER )
src/mame/drivers/sengokmj.c
r869r870
5252#include "audio/seibu.h"
5353#include "sound/3812intf.h"
5454
55extern UINT8 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram;
56static UINT8 sengokumj_mux_data;
55extern UINT16 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram;
56static UINT16 sengokumj_mux_data;
5757
58WRITE8_HANDLER( sengokmj_bgvram_w );
59WRITE8_HANDLER( sengokmj_fgvram_w );
60WRITE8_HANDLER( sengokmj_mdvram_w );
61WRITE8_HANDLER( sengokmj_txvram_w );
58WRITE16_HANDLER( sengokmj_bgvram_w );
59WRITE16_HANDLER( sengokmj_fgvram_w );
60WRITE16_HANDLER( sengokmj_mdvram_w );
61WRITE16_HANDLER( sengokmj_txvram_w );
6262VIDEO_START( sengokmj );
6363VIDEO_UPDATE( sengokmj );
6464
6565/* Multiplexer device for the mahjong panel */
66static READ8_HANDLER( mahjong_panel_r )
66static READ16_HANDLER( mahjong_panel_r )
6767{
68   if(!offset)
68   switch(sengokumj_mux_data)
6969   {
70      switch(sengokumj_mux_data)
71      {
72         case 1:    return readinputport(3);
73         case 2:    return readinputport(4);
74         case 4:    return readinputport(5);
75         case 8:    return readinputport(6);
76         case 0x10: return readinputport(7);
77         case 0x20: return readinputport(8);
78      }
70      case 1:    return readinputport(2);
71      case 2:    return readinputport(3);
72      case 4:    return readinputport(4);
73      case 8:    return readinputport(5);
74      case 0x10: return readinputport(6);
75      case 0x20: return readinputport(7);
7976   }
8077
81   return 0xff;
78   return 0xffff;
8279}
8380
84static WRITE8_HANDLER( mahjong_panel_w )
81static WRITE16_HANDLER( mahjong_panel_w )
8582{
86   if(offset)   { sengokumj_mux_data = data; }
83   if (ACCESSING_MSB)
84      sengokumj_mux_data = data >> 8;
8785}
8886
89static WRITE8_HANDLER( sengokmj_out_w )
87static WRITE16_HANDLER( sengokmj_out_w )
9088{
9189   static UINT8 old = 0;
9290   static int coins_used = 0;
9391
94   if(!offset)
92   if(ACCESSING_LSB)
9593   {
9694      if((old & 4) == 0 && (data & 4) == 4)
9795      {
r869r870
106104}
107105
108106
109static ADDRESS_MAP_START( sengokmj_map, ADDRESS_SPACE_PROGRAM, 8 )
107static ADDRESS_MAP_START( sengokmj_map, ADDRESS_SPACE_PROGRAM, 16 )
110108   AM_RANGE(0x00000, 0x003ff) AM_RAM
111109   AM_RANGE(0x01000, 0x011ff) AM_RAM
112110   AM_RANGE(0x01234, 0x01239) AM_NOP // ?
r869r870
117115   AM_RANGE(0x0c800, 0x0cfff) AM_RAM AM_WRITE(sengokmj_fgvram_w) AM_BASE(&sengokmj_fgvram)
118116   AM_RANGE(0x0d000, 0x0d7ff) AM_RAM AM_WRITE(sengokmj_mdvram_w) AM_BASE(&sengokmj_mdvram)
119117   AM_RANGE(0x0d800, 0x0e7ff) AM_RAM AM_WRITE(sengokmj_txvram_w) AM_BASE(&sengokmj_txvram)
120   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_BASE(&paletteram)
121   AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram)
118   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
119   AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16)
122120   AM_RANGE(0xc0000, 0xfffff) AM_ROM
123121ADDRESS_MAP_END
124122
125123
126static ADDRESS_MAP_START( sengokmj_io_map, ADDRESS_SPACE_IO, 8 )
127   AM_RANGE(0x4000, 0x400f) AM_READWRITE(seibu_main_v30_r, seibu_main_v30_w)
128   AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x30) AM_WRITE(seibu_main_v30_w)
129   AM_RANGE(0x8040, 0x804f) AM_WRITE(seibu_main_v30_w)
124static ADDRESS_MAP_START( sengokmj_io_map, ADDRESS_SPACE_IO, 16 )
125   AM_RANGE(0x4000, 0x400f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
126   AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x30) AM_WRITE(seibu_main_word_w)
127   AM_RANGE(0x8040, 0x804f) AM_WRITE(seibu_main_word_w)
130128   AM_RANGE(0x8100, 0x8101) AM_WRITENOP // always 0
131129   AM_RANGE(0x8180, 0x8181) AM_WRITE(sengokmj_out_w)
132130   AM_RANGE(0x8080, 0x8081) AM_WRITENOP // ?
133131   AM_RANGE(0x80c0, 0x80c1) AM_WRITENOP // ?
134132   AM_RANGE(0x8140, 0x8141) AM_WRITE(mahjong_panel_w)
135   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_1_r)
136   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_2_r)
133   AM_RANGE(0xc000, 0xc001) AM_READ(input_port_1_word_r)
137134   AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r)
138   AM_RANGE(0xc004, 0xc004) AM_READ(input_port_9_r)
139   AM_RANGE(0xc005, 0xc005) AM_READ(input_port_10_r)
135   AM_RANGE(0xc004, 0xc005) AM_READ(input_port_8_word_r)
140136ADDRESS_MAP_END
141137
142138
r869r870
145141   SEIBU_COIN_INPUTS
146142
147143   PORT_START
148   PORT_DIPNAME( 0x01,   0x00, DEF_STR( Demo_Sounds ) )
149   PORT_DIPSETTING(     0x01, DEF_STR( Off ) )
150   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
151   PORT_DIPNAME( 0x02,   0x02, "Re-start" )
152   PORT_DIPSETTING(     0x02, DEF_STR( Off ) )
153   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
154   PORT_DIPNAME( 0x04,   0x04, "Double G" )
155   PORT_DIPSETTING(     0x04, DEF_STR( Off ) )
156   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
157   PORT_DIPNAME( 0x08,   0x08, "Double L" )
158   PORT_DIPSETTING(     0x08, DEF_STR( Off ) )
159   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
160   PORT_DIPNAME( 0x10,   0x10, "Kamon" )
161   PORT_DIPSETTING(     0x10, DEF_STR( Off ) )
162   PORT_DIPSETTING(        0x00, DEF_STR( On ) )
163   PORT_DIPNAME( 0x20,   0x20, DEF_STR( Unused ) )
164   PORT_DIPSETTING(     0x20, DEF_STR( Off ) )
165   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
166   PORT_DIPNAME( 0x40,   0x40, "Out Sw" )
167   PORT_DIPSETTING(     0x40, DEF_STR( Off ) )
168   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
169   PORT_DIPNAME( 0x80,   0x80, "Hopper" )
170   PORT_DIPSETTING(     0x80, DEF_STR( Off ) )
171   PORT_DIPSETTING(     0x00, DEF_STR( On ) )
144   PORT_DIPNAME( 0x0001,   0x0000, DEF_STR( Demo_Sounds ) )
145   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
146   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
147   PORT_DIPNAME( 0x0002,   0x0002, "Re-start" )
148   PORT_DIPSETTING(     0x0002, DEF_STR( Off ) )
149   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
150   PORT_DIPNAME( 0x0004,   0x0004, "Double G" )
151   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
152   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
153   PORT_DIPNAME( 0x0008,   0x0008, "Double L" )
154   PORT_DIPSETTING(     0x0008, DEF_STR( Off ) )
155   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
156   PORT_DIPNAME( 0x0010,   0x0010, "Kamon" )
157   PORT_DIPSETTING(     0x0010, DEF_STR( Off ) )
158   PORT_DIPSETTING(        0x0000, DEF_STR( On ) )
159   PORT_DIPNAME( 0x0020,   0x0020, DEF_STR( Unused ) )
160   PORT_DIPSETTING(     0x0020, DEF_STR( Off ) )
161   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
162   PORT_DIPNAME( 0x0040,   0x0040, "Out Sw" )
163   PORT_DIPSETTING(     0x0040, DEF_STR( Off ) )
164   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
165   PORT_DIPNAME( 0x0080,   0x0080, "Hopper" )
166   PORT_DIPSETTING(     0x0080, DEF_STR( Off ) )
167   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
168   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
172169
173170   PORT_START
174   PORT_BIT(  0xff, IP_ACTIVE_LOW, IPT_UNUSED )
175
176   PORT_START
177171   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
178172   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
179173   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r869r870
227221   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
228222
229223   PORT_START
230   PORT_DIPNAME( 0x01, 0x01, "Door" )
231   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
232   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
233   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
234   PORT_DIPNAME( 0x04, 0x04, "Opt. 1st" )
235   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
236   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
237   PORT_DIPNAME( 0x08, 0x08, "Reset" )
238   PORT_DIPSETTING(   0x08, DEF_STR( Off ) )
239   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
240   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
241   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
242   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
243   PORT_DIPNAME( 0x20, 0x20, "Cash" )
244   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
245   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
224   PORT_DIPNAME( 0x0001, 0x0001, "Door" )
225   PORT_DIPSETTING(   0x0001, DEF_STR( Off ) )
226   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
227   PORT_SERVICE_NO_TOGGLE( 0x0002, IP_ACTIVE_LOW )
228   PORT_DIPNAME( 0x0004, 0x0004, "Opt. 1st" )
229   PORT_DIPSETTING(   0x0004, DEF_STR( Off ) )
230   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
231   PORT_DIPNAME( 0x0008, 0x0008, "Reset" )
232   PORT_DIPSETTING(   0x0008, DEF_STR( Off ) )
233   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
234   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
235   PORT_DIPSETTING(   0x0010, DEF_STR( Off ) )
236   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
237   PORT_DIPNAME( 0x0020, 0x0020, "Cash" )
238   PORT_DIPSETTING(    0x0020, DEF_STR( Off ) )
239   PORT_DIPSETTING(    0x0000, DEF_STR( On ) )
246240   /* Used, causes "Hopper RunAway" message if you toggle it */
247   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
248   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
249   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
250   PORT_DIPNAME( 0x80, 0x80, "Meter" )
251   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
252   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
253
254   PORT_START
255   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
241   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
242   PORT_DIPSETTING(    0x0040, DEF_STR( Off ) )
243   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
244   PORT_DIPNAME( 0x0080, 0x0080, "Meter" )
245   PORT_DIPSETTING(   0x0080, DEF_STR( Off ) )
246   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
247   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
256248INPUT_PORTS_END
257249
258250
src/mame/drivers/cham24.c
r869r870
285285MACHINE_DRIVER_END
286286
287287ROM_START( cham24 )
288   ROM_REGION(0x10000, REGION_CPU1, ROMREGION_ERASE00)
289
288290   ROM_REGION(0x100000, REGION_USER1, 0)
289291   ROM_LOAD( "24-2.u2", 0x000000, 0x100000, CRC(686e9d05) SHA1(a55b9850a4b47f1b4495710e71534ca0287b05ee) )
290292
src/mame/drivers/williams.c
r869r870
22872287   ROM_LOAD( "aarom07",   0x16000, 0x1000, CRC(f9812be4) SHA1(5f116345f09cd79790612672aa48ede63fc91f56) )
22882288   ROM_LOAD( "aarom08",   0x17000, 0x1000, CRC(cd7f3a87) SHA1(59577059308931139ecc036d06953660a148d91c) )
22892289   ROM_LOAD( "aarom09",   0x18000, 0x1000, CRC(e6ce77b4) SHA1(bd4354100067654d0ad2e590591582dbdfb845b6) )
2290
2291   ROM_REGION( 0x10000, REGION_CPU2, ROMREGION_ERASE00 )
22902292ROM_END
22912293
22922294
src/mame/drivers/dec8.c
r869r870
20882088   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,dec8_s_writemem)
20892089                        /* NMIs are caused by the main CPU */
20902090   MDRV_SCREEN_REFRESH_RATE(58)
2091   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
2091   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 58Hz, 529ms Vblank duration */)
20922092
20932093   /* video hardware */
20942094   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
r869r870
21272127   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,dec8_s_writemem)
21282128                        /* NMIs are caused by the main CPU */
21292129   MDRV_SCREEN_REFRESH_RATE(58)
2130   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
2130   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2500) /* 58Hz, 529ms Vblank duration */)
21312131
21322132   /* video hardware */
21332133   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
r869r870
21682168   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,dec8_s_writemem)
21692169                        /* NMIs are caused by the main CPU */
21702170   MDRV_SCREEN_REFRESH_RATE(58)
2171   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
2171   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 58Hz, 529ms Vblank duration */)
21722172
21732173   /* video hardware */
21742174   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
r869r870
22072207   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem)
22082208                        /* NMIs are caused by the main CPU */
22092209   MDRV_SCREEN_REFRESH_RATE(58)
2210   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
2210   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 58Hz, 529ms Vblank duration */)
22112211
22122212   /* video hardware */
22132213   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
r869r870
22502250   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem)
22512251                        /* NMIs are caused by the main CPU */
22522252   MDRV_SCREEN_REFRESH_RATE(58)
2253   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
2253   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2500) /* 58Hz, 529ms Vblank duration */)
22542254   MDRV_INTERLEAVE(40) /* 40 CPU slices per frame */
22552255
22562256   /* video hardware */
r869r870
22922292   MDRV_CPU_PROGRAM_MAP(ym3526_s_readmem,ym3526_s_writemem)
22932293                        /* NMIs are caused by the main CPU */
22942294   MDRV_SCREEN_REFRESH_RATE(58)
2295   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
2295   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2500) /* 58Hz, 529ms Vblank duration */)
22962296   MDRV_INTERLEAVE(200)
22972297
22982298   /* video hardware */
r869r870
23342334   MDRV_CPU_PROGRAM_MAP(ym3526_s_readmem,ym3526_s_writemem)
23352335                        /* NMIs are caused by the main CPU */
23362336   MDRV_SCREEN_REFRESH_RATE(58)
2337   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
2337   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(2500) /* 58Hz, 529ms Vblank duration */)
23382338   MDRV_INTERLEAVE(80)
23392339
23402340   /* video hardware */
r869r870
23772377   MDRV_CPU_PROGRAM_MAP(csilver_s_readmem,csilver_s_writemem)
23782378                        /* NMIs are caused by the main CPU */
23792379   MDRV_SCREEN_REFRESH_RATE(58)
2380   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
2380   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 58Hz, 529ms Vblank duration */)
23812381   MDRV_INTERLEAVE(100)
23822382
23832383   /* video hardware */
r869r870
24212421   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem)
24222422                        /* NMIs are caused by the main CPU */
24232423   MDRV_SCREEN_REFRESH_RATE(58)
2424   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
2424   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529) /* 58Hz, 529ms Vblank duration */)
24252425
24262426   /* video hardware */
24272427   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/mnight.c
r869r870
353353   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
354354
355355   MDRV_SCREEN_REFRESH_RATE(60)
356   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(10000))
356   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(10000))
357357   MDRV_INTERLEAVE(10)
358358
359359   MDRV_MACHINE_RESET(mnight)
src/mame/drivers/genesis.c
r869r870
627627
628628}
629629
630#if 0
630631static ADDRESS_MAP_START( genesis_readmem, ADDRESS_SPACE_PROGRAM, 16 )
631632   AM_RANGE(0x000000, 0x3fffff) AM_READ(MRA16_ROM)               /* Cartridge Program Rom */
632633   AM_RANGE(0xa10000, 0xa1001f) AM_READ(genesis_io_r)            /* Genesis Input */
r869r870
646647   AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(MWA16_BANK3)            /* Main Ram */
647648   AM_RANGE(0xff0000, 0xffffff) AM_WRITE(MWA16_RAM) AM_BASE(&genesis_68k_ram)/* Main Ram */
648649ADDRESS_MAP_END
650#endif
649651
650652/* Z80 Sound Hardware - based on MESS code, to be improved, it can do some strange things */
651653
r869r870
768770}
769771
770772
771
773#if 0
772774static ADDRESS_MAP_START( genesis_z80_readmem, ADDRESS_SPACE_PROGRAM, 8 )
773775    AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_BANK1)
774776    AM_RANGE(0x2000, 0x3fff) AM_READ(MRA8_BANK2) /* mirror */
r869r870
817819   MDRV_SOUND_ROUTE(0, "mono", 0.50)
818820   MDRV_SOUND_ROUTE(1, "mono", 0.50)
819821MACHINE_DRIVER_END
820
822#endif
src/mame/drivers/yard.c
r869r870
201201   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
202202
203203   MDRV_SCREEN_REFRESH_RATE(57)
204   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(1790))
204   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(1790))
205205   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz.
206206       the Lode Runner manual (similar but different hardware)
207207       talks about 55Hz and 1790ms vblank duration. */
src/mame/drivers/asuka.c
r869r870
7474TC0100SCN do use the FG layer for text (Driftout is an exception).
7575
7676
77Notes on Bonze DIPs by Stephane Humbert
78---------------------------------------
77Stephh's notes (based on the game M68000 code and some tests) :
7978
80The 2nd bonus life may be awarded at the wrong score because of a bug in
81the game code at $961E; and the unused DIP switch enables the built-in
82map editor if the branch at $7572 is skipped.
791) 'bonzeadv', 'jigkmgri' and 'bonzeadu'
8380
81  - Region stored at 0x03fffe.w
82  - Sets :
83      * 'bonzeadv' : region = 0x0002
84      * 'jigkmgri' : region = 0x0000
85      * 'bonzeadu' : region = 0x0001
86  - These 3 games are 100% the same, only region differs !
87  - Coinage relies on the region (code at 0x02d344) :
88      * 0x0000 (Japan) and 0x0001 (US) use TAITO_COINAGE_JAPAN_OLD
89      * 0x0002 (World) uses TAITO_COINAGE_WORLD
90  - Notice screen only if region = 0x0000
91  - Most texts in Japanese and alternate title screen only if region = 0x0000
92  - Bonus lives aren't awarded correctly due to bogus code at 0x00961e :
8493
94      00961E: 302D 0B7E                  move.w  ($b7e,A5), D0
95      009622: 0240 0018                  andi.w  #$18, D0
96      009626: E648                       lsr.w   #3, D0
97
98    Here is what the correct code should be :
99
100      00961E: 302D 0B7E                  move.w  ($b7e,A5), D0
101      009622: 0240 0030                  andi.w  #$30, D0
102      009626: E848                       lsr.w   #4, D0
103
104  - DSWB bit 7 was previously used to allow map viewing (C-Chip test ?),
105    but it is now unused due to "bra" instruction at 0x007572
106
107
1082) 'bonzeado'
109
110  - Region stored at 0x03fffe.w
111  - Sets :
112      * 'bonzeado' : region = 0x0002
113  - The only difference is that the following code is missing :
114
115      00D218: 08AD 0004 15DE             bclr    #$4, ($15de,A5)
116
117    So the "crouch" bit wasn't always reset, which may cause you
118    to consume all your magic powers in less than 4 frames !
119    See bonzeadv0107u1ora full report on MAME Testers site
120  - Same other notes as for 'bonzeadv'
121
122
1233) 'asuka*'
124
125  - No region
126  - BOTH sets use TAITO_COINAGE_JAPAN_OLD for coinage,
127    so I wonder if the World version isn't a US version
128  - Additional notice screen in 'asukaj'
129
130
1314) 'mofflott'
132
133  - Region stored at 0x03fffe.w
134  - Sets :
135      * 'mofflott' : region = 0x0001
136  - Coinage relies on the region (code at 0x0145ec) :
137      * 0x0001 (Japan) and 0x0002 (US ?) use TAITO_COINAGE_JAPAN_OLD
138      * 0x0003 (World) uses TAITO_COINAGE_WORLD
139  - Notice screen only if region = 0x0001
140
141
1425) 'cadash*'
143
144  - Region stored at 0x07fffe.w
145  - Sets :
146      * 'cadash'   : region = 0x0003
147      * 'cadashj'  : region = 0x0001
148      * 'cadashu'  : region = 0x0002
149      * 'cadashfr' : region = 0x0003
150      * 'cadashit' : region = 0x0003
151  - These 5 games are 100% the same, only region differs !
152    However each version requires its specific texts
153  - Coinage relies on the region (code at 0x0013d6) :
154      * 0x0001 (Japan) uses TAITO_COINAGE_JAPAN_OLD
155      * 0x0002 (US) uses TAITO_COINAGE_JAPAN_OLD
156      * 0x0003 (World) uses TAITO_COINAGE_WORLD
157  - Notice screen only if region = 0x0001 or region = 0x0002
158  - FBI logo only if region = 0x0002
159  - I can't tell about the Italian and Japanese versions,
160    but translation in the French version is really poor !
161
162
1636) 'galmedes'
164
165  - No region (not a Taito game anyway)
166  - Coinage relies on "Coin Mode" Dip Switch (code at 0x0801c0) :
167      * "Mode A" uses TAITO_COINAGE_JAPAN_OLD
168      * "Mode B" uses TAITO_COINAGE_WORLD
169  - Notice screen
170
171
1727) 'earthjkr'
173
174  - No region (not a Taito game anyway)
175  - Game uses TAITO_COINAGE_JAPAN_OLD
176  - Notice screen only if "Copyright" Dip Switch set to "Visco"
177
178
1798) 'eto'
180
181  - No region (not a Taito game anyway)
182  - Game uses TAITO_COINAGE_JAPAN_OLD
183  - No notice screen
184
185
85186TODO
86187----
87188
88DIPs
89
90189Mofflot: $14c46 sub inits sound system: in a pause loop during this
91190it reads a dummy address.
92191
r869r870
121220VIDEO_UPDATE( asuka );
122221VIDEO_UPDATE( bonzeadv );
123222
124WRITE16_HANDLER( bonzeadv_c_chip_w );
125READ16_HANDLER( bonzeadv_c_chip_r );
223READ16_HANDLER( bonzeadv_cchip_r );
224READ16_HANDLER( bonzeadv_cchip_ctrl_r );
225READ16_HANDLER( bonzeadv_cchip_ram_r );
226WRITE16_HANDLER( bonzeadv_cchip_ctrl_w );
227WRITE16_HANDLER( bonzeadv_cchip_bank_w );
228WRITE16_HANDLER( bonzeadv_cchip_ram_w );
126229
127230
128231/***********************************************************
r869r870
202305   AM_RANGE(0x3b0000, 0x3b0001) AM_READ(input_port_1_word_r)
203306   AM_RANGE(0x3d0000, 0x3d0001) AM_READ(MRA16_NOP)
204307   AM_RANGE(0x3e0002, 0x3e0003) AM_READ(taitosound_comm16_lsb_r)
205   AM_RANGE(0x800000, 0x800803) AM_READ(bonzeadv_c_chip_r)
308   AM_RANGE(0x800000, 0x8007ff) AM_READ(bonzeadv_cchip_ram_r)
309   AM_RANGE(0x800802, 0x800803) AM_READ(bonzeadv_cchip_ctrl_r)
206310   AM_RANGE(0xc00000, 0xc0ffff) AM_READ(TC0100SCN_word_0_r)   /* tilemaps */
207311   AM_RANGE(0xc20000, 0xc2000f) AM_READ(TC0100SCN_ctrl_word_0_r)
208312   AM_RANGE(0xd00000, 0xd03fff) AM_READ(PC090OJ_word_0_r)   /* sprite ram */
r869r870
216320   AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(watchdog_reset16_w)
217321   AM_RANGE(0x3e0000, 0x3e0001) AM_WRITE(taitosound_port16_lsb_w)
218322   AM_RANGE(0x3e0002, 0x3e0003) AM_WRITE(taitosound_comm16_lsb_w)
219   AM_RANGE(0x800000, 0x800c01) AM_WRITE(bonzeadv_c_chip_w)
323   AM_RANGE(0x800000, 0x8007ff) AM_WRITE(bonzeadv_cchip_ram_w)
324   AM_RANGE(0x800802, 0x800803) AM_WRITE(bonzeadv_cchip_ctrl_w)
325   AM_RANGE(0x800c00, 0x800c01) AM_WRITE(bonzeadv_cchip_bank_w)
220326   AM_RANGE(0xc00000, 0xc0ffff) AM_WRITE(TC0100SCN_word_0_w)   /* tilemaps */
221327   AM_RANGE(0xc20000, 0xc2000f) AM_WRITE(TC0100SCN_ctrl_word_0_w)
222328   AM_RANGE(0xd00000, 0xd03fff) AM_WRITE(PC090OJ_word_0_w)   /* sprite ram */
r869r870
386492   /* 0x3b0000 -> 0x10cb7e ($b7e,A5) */
387493   PORT_START_TAG("DSWB")
388494   TAITO_DIFFICULTY
389   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )            /* bogus due to code at 0x00961e */
495   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )            /* see notes */
390496   PORT_DIPSETTING(    0x08, "40k 100k" )                       /* 300k 1000k 1500k 2000k 2500k 3000k 3500k 5000k */
391497   PORT_DIPSETTING(    0x0c, "50k 150k" )                       /* 500k 1000k 2000k 3000k 4000k 5000k 6000k 7000k */
392498   PORT_DIPSETTING(    0x04, "60k 200k" )                       /* 500k 1000k 2000k 3000k 4000k 5000k 6000k 7000k */
r869r870
399505   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )
400506   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
401507   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
402   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )                        /* previously map editor */
508   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )                        /* see notes */
403509
404510   PORT_START_TAG("800007")
405511   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
r869r870
422528
423529   PORT_START_TAG("80000D")
424530   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
425   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
426   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
427   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
428   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
429   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
430   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
531   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
532   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
533   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
534   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
535   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
536   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
431537   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
432538INPUT_PORTS_END
433539
r869r870
651757   TAITO_MACHINE_NO_COCKTAIL
652758   TAITO_COINAGE_JAPAN_OLD
653759
654   /* 0x400002 -> 0x200916 */
760   /* 0x300002 -> 0x200916 */
655761   PORT_MODIFY("DSWB")
656762   TAITO_DIFFICULTY
657763   PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )
src/mame/drivers/backfire.c
r869r870
489489   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
490490
491491   MDRV_SCREEN_REFRESH_RATE(58)
492   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(529))
492   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(529))
493493   MDRV_NVRAM_HANDLER(93C46)
494494
495495   /* video hardware */
src/mame/drivers/mquake.c
r869r870
158158
159159   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
160160   AM_RANGE(0x204000, 0x2041ff) AM_READWRITE(es5503_word_lsb_r, es5503_word_lsb_w)
161   AM_RANGE(0x282000, 0x282001) AM_READ(port_tag_to_handler16("SW.LO"))
162   AM_RANGE(0x282002, 0x282003) AM_READ(port_tag_to_handler16("SW.HI"))
161   AM_RANGE(0x282000, 0x282001) AM_READ_PORT("SW.LO")
162   AM_RANGE(0x282002, 0x282003) AM_READ_PORT("SW.HI")
163163   AM_RANGE(0x284000, 0x28400f) AM_WRITE(output_w)
164164   AM_RANGE(0x286000, 0x28600f) AM_READWRITE(coin_chip_r, coin_chip_w)
165165   AM_RANGE(0x300000, 0x3bffff) AM_ROM AM_REGION(REGION_USER2, 0)
r869r870
355355   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
356356
357357   MDRV_SCREEN_REFRESH_RATE(59.997)
358   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
358   MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(0))
359359
360360   MDRV_MACHINE_RESET(mquake)
361361   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/shisen.c
r869r870
7272static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
7373   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
7474   AM_RANGE(0x00, 0x00) AM_WRITE(sichuan2_coin_w)
75   AM_RANGE(0x01, 0x01) AM_WRITE(m72_sound_command_w)
75   AM_RANGE(0x01, 0x01) AM_WRITE(m72_sound_command_byte_w)
7676   AM_RANGE(0x02, 0x02) AM_WRITE(sichuan2_bankswitch_w)
7777ADDRESS_MAP_END
7878
src/mame/drivers/tutankhm.c
r869r870
340340   MDRV_CPU_PROGRAM_MAP(timeplt_sound_readmem,timeplt_sound_writemem)
341341
342342   MDRV_SCREEN_REFRESH_RATE(30)
343   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(DEFAULT_30HZ_VBLANK_DURATION))
343   MDRV_SCREEN_VBLANK_TIME(DEFAULT_30HZ_VBLANK_DURATION)
344344
345345   /* video hardware */
346346   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/osd/windows/mamex64.rc
r869r870
11//
2//   mame.rc - Minimal resource file for Win32 MAME
2//   mamex64.rc - Minimal resource file for Win32 MAME
33//
44//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
55//  Visit http://mamedev.org for licensing and usage restrictions.
66//
77
8#define NOWINRES
9#include "windows.h"
10#include "commctrl.h"
11
12#include "mamevers.rc"
13
8141                       24      MOVEABLE PURE   "mamex64.man"
src/osd/windows/verinfo.c
r0r870
1//============================================================
2//
3//  verinfo.c - Version resource emitter code
4//
5//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//============================================================
9
10#include <ctype.h>
11#include <stdio.h>
12
13#include "osdcore.h"
14
15
16extern char build_version[];
17
18
19
20//============================================================
21//  TYPE DEFINITIONS
22//============================================================
23
24typedef struct _version_info version_info;
25struct _version_info
26{
27   int version_major;
28   int version_minor;
29   int version_build;
30   int version_subbuild;
31   const char *author;
32   const char *comments;
33   const char *company_name;
34   const char *file_description;
35   const char *internal_name;
36   const char *legal_copyright;
37   const char *original_filename;
38   const char *product_name;
39};
40
41
42
43//============================================================
44//  emit_version_info
45//============================================================
46
47static void emit_version_info(const version_info *v)
48{
49   printf("VS_VERSION_INFO VERSIONINFO\n");
50   printf("\tFILEVERSION %d,%d,%d,%d\n", v->version_major, v->version_minor, v->version_build, v->version_subbuild);
51   printf("\tPRODUCTVERSION %d,%d,%d,%d\n", v->version_major, v->version_minor, v->version_build, v->version_subbuild);
52   printf("\tFILEFLAGSMASK 0x3fL\n");
53#ifdef MAME_DEBUG
54   if (v->version_build == 0)
55      printf("\tFILEFLAGS VS_FF_DEBUG\n");
56   else
57      printf("\tFILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG\n");
58#else
59   if (v->version_build == 0)
60      printf("\tFILEFLAGS 0x0L\n");
61   else
62      printf("\tFILEFLAGS VS_FF_PRERELEASE\n");
63#endif
64   printf("\tFILEOS VOS_NT_WINDOWS32\n");
65   printf("\tFILETYPE VFT_APP\n");
66   printf("\tFILESUBTYPE VFT2_UNKNOWN\n");
67   printf("BEGIN\n");
68   printf("\tBLOCK \"StringFileInfo\"\n");
69   printf("\tBEGIN\n");
70   printf("#ifdef UNICODE\n");
71   printf("\t\tBLOCK \"040904b0\"\n");
72   printf("#else\n");
73   printf("\t\tBLOCK \"040904E4\"\n");
74   printf("#endif\n");
75   printf("\t\tBEGIN\n");
76   if (v->author != NULL)
77      printf("\t\t\tVALUE \"Author\", \"%s\\0\"\n", v->author);
78   if (v->comments != NULL)
79      printf("\t\t\tVALUE \"Comments\", \"%s\\0\"\n", v->comments);
80   if (v->company_name != NULL)
81      printf("\t\t\tVALUE \"CompanyName\", \"%s\\0\"\n", v->company_name);
82   if (v->file_description != NULL)
83      printf("\t\t\tVALUE \"FileDescription\", \"%s\\0\"\n", v->file_description);
84   printf("\t\t\tVALUE \"FileVersion\", \"%d, %d, %d, %d\\0\"\n", v->version_major, v->version_minor, v->version_build, v->version_subbuild);
85   if (v->internal_name != NULL)
86      printf("\t\t\tVALUE \"InternalName\", \"%s\\0\"\n", v->internal_name);
87   if (v->legal_copyright != NULL)
88      printf("\t\t\tVALUE \"LegalCopyright\", \"%s\\0\"\n", v->legal_copyright);
89   if (v->original_filename != NULL)
90      printf("\t\t\tVALUE \"OriginalFilename\", \"%s\\0\"\n", v->original_filename);
91   if (v->product_name != NULL)
92      printf("\t\t\tVALUE \"ProductName\", \"%s\\0\"\n", v->product_name);
93   printf("\t\t\tVALUE \"ProductVersion\", \"%s\\0\"\n", build_version);
94   printf("\t\tEND\n");
95   printf("\tEND\n");
96   printf("\tBLOCK \"VarFileInfo\"\n");
97   printf("\tBEGIN\n");
98   printf("#ifdef UNICODE\n");
99   printf("\t\tVALUE \"Translation\", 0x409, 1200\n");
100   printf("#else\n");
101   printf("\t\tVALUE \"Translation\", 0x409, 1252\n");
102   printf("#endif\n");
103   printf("\tEND\n");
104   printf("END\n");
105}
106
107
108
109//============================================================
110//  parse_version_digit
111//============================================================
112
113static int parse_version_digit(const char *str, int *position)
114{
115   int value = 0;
116
117   while(str[*position] && !isspace(str[*position]) && !isdigit(str[*position]))
118   {
119      (*position)++;
120   }
121   if (str[*position] && isdigit(str[*position]))
122   {
123      sscanf(&str[*position], "%d", &value);
124      while(isdigit(str[*position]))
125         (*position)++;
126   }
127   return value;
128}
129
130
131
132//============================================================
133//  parse_version
134//============================================================
135
136static void parse_version(const char *str, int *version_major, int *version_minor,
137   int *version_micro, int *year)
138{
139   int position = 0;
140   int day = 0;
141   char month[3];
142
143   *version_major = parse_version_digit(str, &position);
144   *version_minor = parse_version_digit(str, &position);
145   *version_micro = parse_version_digit(str, &position);
146
147   *year = 0;
148   sscanf(&str[position], " (%c%c%c %d %d)", &month[0], &month[1], &month[2], &day, year);
149}
150
151
152
153//============================================================
154//  main
155//============================================================
156
157int CLIB_DECL main(int argc, char **argv)
158{
159   version_info v;
160   int begin_year, current_year;
161   char legal_copyright[512];
162
163   memset(&v, 0, sizeof(v));
164
165   // parse out version string
166   parse_version(build_version, &v.version_major, &v.version_minor, &v.version_build, &current_year);
167
168#ifdef MESS
169   // MESS
170   v.author = "MESS Team";
171   v.comments = "Multi Emulation Super System";
172   v.company_name = "MESS Team";
173   v.file_description = "Multi Emulation Super System";
174   v.internal_name = "MESS";
175   v.original_filename = "MESS";
176   v.product_name = "MESS";
177   begin_year = 1998;
178#elif defined(WINUI)
179   // MAME32
180   v.author = "Christopher Kirmse and Michael Soderstrom";
181   v.comments = "Multiple Arcade Machine Emulator for Win32";
182   v.company_name = "MAME Team";
183   v.file_description = "Multiple Arcade Machine Emulator for Win32";
184   v.internal_name = "MAME32";
185   v.original_filename = "MAME32";
186   v.product_name = "MAME32";
187   begin_year = 1997;
188#else
189   // MAME
190   v.author = "Nicola Salmoria and the MAME Team";
191   v.comments = "Multiple Arcade Machine Emulator";
192   v.company_name = "MAME Team";
193   v.file_description = "Multiple Arcade Machine Emulator";
194   v.internal_name = "MAME";
195   v.original_filename = "MAME";
196   v.product_name = "MAME";
197   begin_year = 1996;
198#endif
199
200   // build legal_copyright string
201   v.legal_copyright = legal_copyright;
202   snprintf(legal_copyright, ARRAY_LENGTH(legal_copyright), "Copyright %d-%d Nicola Salmoria and the MAME team", begin_year, current_year);
203
204   // emit the info
205   emit_version_info(&v);
206   return 0;
207}
src/osd/windows/windows.mak
r869r870
6060
6161RCDEFS = -DNDEBUG -D_WIN32_IE=0x0400
6262
63RCFLAGS = -O coff --include-dir $(WINSRC)
63RCFLAGS = -O coff -I $(WINSRC) -I $(WINOBJ)
6464
6565
6666
r869r870
272272
273273
274274#-------------------------------------------------
275# rule for making the verinfo tool
276#-------------------------------------------------
277
278VERINFO = $(WINOBJ)/verinfo$(EXE)
279
280$(VERINFO): $(WINOBJ)/verinfo.o $(VERSIONOBJ) $(LIBOCORE)
281   @echo Linking $@...
282   $(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@
283
284BUILD += $(VERINFO)
285
286
287
288#-------------------------------------------------
275289# generic rule for the resource compiler
276290#-------------------------------------------------
277291
278292$(WINOBJ)/%.res: $(WINSRC)/%.rc | $(OSPREBUILD)
279293   @echo Compiling resources $<...
280294   $(RC) $(RCDEFS) $(RCFLAGS) -o $@ -i $<
295
296
297
298#-------------------------------------------------
299# rules for resource file
300#-------------------------------------------------
301
302$(WINOBJ)/mame.res: $(WINSRC)/mame.rc $(WINOBJ)/mamevers.rc
303
304$(WINOBJ)/mamevers.rc: $(VERINFO)
305   @echo Emitting $@...
306   @$(VERINFO) > $@
src/osd/windows/vconv.c
r869r870
112112{
113113   { 0,      "-D*",            "/D*" },
114114   { 0,      "-U*",            "/U*" },
115   { 0,      "-I*",            "/I*" },
115116   { 0,      "--include-dir*",   "/I*" },
116117   { 0,      "-o*",            "/fo*" },
117118   { 0,      "-O*",            "" },
src/osd/windows/mame.rc
r869r870
55//  Visit http://mamedev.org for licensing and usage restrictions.
66//
77
8#define NOWINRES
9#include "windows.h"
10#include "commctrl.h"
11#include "mamevers.rc"
12
8131                       24      MOVEABLE PURE   "mame.man"
src/emu/cpu/h83002/h83002.c
r869r870
36753675   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;                  break;
36763676
36773677      // Internal maps
3678   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_h8_internal_map; break;
3678   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_h8_internal_map; break;
36793679   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map = 0;      break;
36803680   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map = 0;      break;
36813681
src/emu/cpu/cpu.mak
r869r870
579579
580580
581581#-------------------------------------------------
582# Intel 8086 series
582# Intel 80x86 series
583583#-------------------------------------------------
584584
585CPUDEFS += -DHAS_I86=$(if $(filter I86,$(CPUS)),1,0)
586CPUDEFS += -DHAS_I88=$(if $(filter I88,$(CPUS)),1,0)
587CPUDEFS += -DHAS_I186=$(if $(filter I186,$(CPUS)),1,0)
588CPUDEFS += -DHAS_I188=$(if $(filter I188,$(CPUS)),1,0)
589CPUDEFS += -DHAS_I286=$(if $(filter I286,$(CPUS)),1,0)
585CPUDEFS += -DHAS_I8086=$(if $(filter I8086,$(CPUS)),1,0)
586CPUDEFS += -DHAS_I8088=$(if $(filter I8088,$(CPUS)),1,0)
587CPUDEFS += -DHAS_I80186=$(if $(filter I80186,$(CPUS)),1,0)
588CPUDEFS += -DHAS_I80188=$(if $(filter I80188,$(CPUS)),1,0)
589CPUDEFS += -DHAS_I80286=$(if $(filter I80286,$(CPUS)),1,0)
590590CPUDEFS += -DHAS_I386=$(if $(filter I386,$(CPUS)),1,0)
591591CPUDEFS += -DHAS_I486=$(if $(filter I486,$(CPUS)),1,0)
592592CPUDEFS += -DHAS_PENTIUM=$(if $(filter PENTIUM,$(CPUS)),1,0)
593593CPUDEFS += -DHAS_MEDIAGX=$(if $(filter MEDIAGX,$(CPUS)),1,0)
594594
595ifneq ($(filter I86 I88 I186 I188,$(CPUS)),)
595ifneq ($(filter I8086 I8088 I80186 I80188,$(CPUS)),)
596596OBJDIRS += $(CPUOBJ)/i86 $(CPUOBJ)/i386
597597CPUOBJS += $(CPUOBJ)/i86/i86.o
598598DBGOBJS += $(CPUOBJ)/i386/i386dasm.o
599599endif
600600
601601
602ifneq ($(filter I286,$(CPUS)),)
602ifneq ($(filter I80286,$(CPUS)),)
603603OBJDIRS += $(CPUOBJ)/i86 $(CPUOBJ)/i386
604604CPUOBJS += $(CPUOBJ)/i86/i286.o
605605DBGOBJS += $(CPUOBJ)/i386/i386dasm.o
r869r870
786786
787787ifneq ($(filter R4600 R4650 R4700 R5000 QED5271 RM7000,$(CPUS)),)
788788OBJDIRS += $(CPUOBJ)/mips
789CPUOBJS += $(CPUOBJ)/mips/mips3com.o
790DBGOBJS += $(CPUOBJ)/mips/mips3dsm.o
791
789792ifdef X86_MIPS3_DRC
790793CPUOBJS += $(CPUOBJ)/mips/mips3drc.o $(CPUOBJ)/x86drc.o
791794else
792795CPUOBJS += $(CPUOBJ)/mips/mips3.o
793796endif
794DBGOBJS += $(CPUOBJ)/mips/mips3dsm.o
795797endif
796798
797799$(CPUOBJ)/mips/mips3.o:      $(CPUSRC)/mips/mips3.c \
798                     $(CPUSRC)/mips/mips3.h
800                     $(CPUSRC)/mips/mips3.h \
801                     $(CPUSRC)/mips/mips3com.h
799802
800803$(CPUOBJ)/mips/mips3drc.o:   $(CPUSRC)/mips/mips3drc.c \
801804                     $(CPUSRC)/mips/mdrcold.c \
802805                     $(CPUSRC)/mips/mips3.h \
806                     $(CPUSRC)/mips/mips3com.h \
803807                     $(CPUSRC)/x86drc.c \
804808                     $(CPUSRC)/x86drc.h
805809
r869r870
11151119#-------------------------------------------------
11161120
11171121CPUDEFS += -DHAS_V20=$(if $(filter V20,$(CPUS)),1,0)
1122CPUDEFS += -DHAS_V25=$(if $(filter V25,$(CPUS)),1,0)
11181123CPUDEFS += -DHAS_V30=$(if $(filter V30,$(CPUS)),1,0)
11191124CPUDEFS += -DHAS_V30MZ=$(if $(filter V30MZ,$(CPUS)),1,0)
11201125CPUDEFS += -DHAS_V33=$(if $(filter V33,$(CPUS)),1,0)
1126CPUDEFS += -DHAS_V35=$(if $(filter V35,$(CPUS)),1,0)
11211127
1122ifneq ($(filter V20 V30 V33,$(CPUS)),)
1123OBJDIRS += $(CPUOBJ)/nec $(CPUOBJ)/i386
1128ifneq ($(filter V20 V25 V30 V33 V35,$(CPUS)),)
1129OBJDIRS += $(CPUOBJ)/nec
11241130CPUOBJS += $(CPUOBJ)/nec/nec.o
1125DBGOBJS += $(CPUOBJ)/i386/i386dasm.o
1131DBGOBJS += $(CPUOBJ)/nec/necdasm.o
11261132endif
11271133
11281134ifneq ($(filter V30MZ,$(CPUS)),)
1129OBJDIRS += $(CPUOBJ)/v30mz $(CPUOBJ)/i386
1135OBJDIRS += $(CPUOBJ)/v30mz
11301136CPUOBJS += $(CPUOBJ)/v30mz/v30mz.o
1131DBGOBJS += $(CPUOBJ)/i386/i386dasm.o
1137DBGOBJS += $(CPUOBJ)/nec/necdasm.o
11321138endif
11331139
11341140$(CPUOBJ)/nec/nec.o:   $(CPUSRC)/nec/nec.c \
src/emu/cpu/m37710/m37710.c
r869r870
12211221#endif /* MAME_DEBUG */
12221222      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &m37710_ICount;         break;
12231223
1224      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_m37710_internal_map; break;
1224      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_m37710_internal_map; break;
12251225      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map = 0;   break;
12261226      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map = 0;   break;
12271227
src/emu/cpu/i86/i88intf.h
r869r870
44#include "i86intf.h"
55
66/* Public functions */
7void i88_get_info(UINT32 state, cpuinfo *info);
7void i8088_get_info(UINT32 state, cpuinfo *info);
88
99#endif
src/emu/cpu/i86/i186intf.h
r869r870
55#include "i86intf.h"
66
77/* Public functions */
8void i186_get_info(UINT32 state, cpuinfo *info);
8void i80186_get_info(UINT32 state, cpuinfo *info);
99
1010#endif
src/emu/cpu/i86/i286intf.h
r869r870
44
55#include "i86intf.h"
66
7enum {
8      I286_PC=0,
9        I286_IP, I286_AX, I286_CX, I286_DX, I286_BX, I286_SP, I286_BP, I286_SI, I286_DI,
10        I286_FLAGS,
11      I286_ES, I286_CS, I286_SS, I286_DS,
12      I286_ES_2, I286_CS_2, I286_SS_2, I286_DS_2,
13      I286_MSW,
14      I286_GDTR, I286_IDTR, I286_LDTR, I286_TR,
15      I286_GDTR_2, I286_IDTR_2, I286_LDTR_2, I286_TR_2,
16        I286_VECTOR, I286_PENDING, I286_NMI_STATE, I286_IRQ_STATE, I286_EMPTY
7enum
8{
9   I80286_PC=0,
10   I80286_IP,
11   I80286_AX,
12   I80286_CX,
13   I80286_DX,
14   I80286_BX,
15   I80286_SP,
16   I80286_BP,
17   I80286_SI,
18   I80286_DI,
19   I80286_FLAGS,
20   I80286_ES,
21   I80286_CS,
22   I80286_SS,
23   I80286_DS,
24   I80286_ES_2,
25   I80286_CS_2,
26   I80286_SS_2,
27   I80286_DS_2,
28   I80286_MSW,
29   I80286_GDTR_BASE,
30   I80286_IDTR_BASE,
31   I80286_LDTR_BASE,
32   I80286_TR_BASE,
33   I80286_GDTR_LIMIT,
34   I80286_IDTR_LIMIT,
35   I80286_LDTR_LIMIT,
36   I80286_TR_LIMIT,
37   I80286_VECTOR,
38   I80286_PENDING,
39   I80286_NMI_STATE,
40   I80286_IRQ_STATE
1741};
1842
1943/* Public functions */
20extern void i286_set_irq_line(int irqline, int state);
21extern void i286_set_irq_callback(int (*callback)(int irqline));
22extern const char *i286_info(void *context, int regnum);
23void i286_get_info(UINT32 state, cpuinfo *info);
44extern void i80286_set_irq_line(int irqline, int state);
45extern void i80286_set_irq_callback(int (*callback)(int irqline));
46extern const char *i80286_info(void *context, int regnum);
47void i80286_get_info(UINT32 state, cpuinfo *info);
2448
2549#endif
src/emu/cpu/i86/i188intf.h
r869r870
44#include "i186intf.h"
55
66/* Public functions */
7void i188_get_info(UINT32 state, cpuinfo *info);
7void i80188_get_info(UINT32 state, cpuinfo *info);
88
99#endif
src/emu/cpu/i86/instr186.c
r869r870
99
1010#undef ICOUNT
1111
12#ifdef V20
13#define ICOUNT nec_ICount
14#else
15#define ICOUNT i86_ICount
16#endif
12#define ICOUNT i8086_ICount
1713
1814
1915static void PREFIX186(_pusha)(void)    /* Opcode 0x60 */
r869r870
5349    int high= (INT16)GetnextRMWord;
5450   int tmp= (INT16)RegWord(ModRM);
5551   if (tmp<low || tmp>high) {
56      /* OB: on NECs CS:IP points to instruction
57           FOLLOWING the BOUND instruction ! */
58#if !defined(V20)
5952      I.pc-=2;
6053      PREFIX86(_interrupt)(5);
61#else
62      PREFIX(_interrupt)(5,0);
63#endif
6454   }
6555   ICOUNT -= cycles.bound;
6656}
r869r870
111101static void PREFIX186(_insb)(void)    /* Opcode 0x6c */
112102{
113103   ICOUNT -= cycles.ins8;
114   PutMemB(ES,I.regs.w[DI],read_port(I.regs.w[DX]));
104   PutMemB(ES,I.regs.w[DI],read_port_byte(I.regs.w[DX]));
115105   I.regs.w[DI] += I.DirVal;
116106}
117107
118108static void PREFIX186(_insw)(void)    /* Opcode 0x6d */
119109{
120110   ICOUNT -= cycles.ins16;
121   PutMemB(ES,I.regs.w[DI],read_port(I.regs.w[DX]));
122   PutMemB(ES,I.regs.w[DI]+1,read_port(I.regs.w[DX]+1));
111   PutMemW(ES,I.regs.w[DI],read_port_word(I.regs.w[DX]));
123112   I.regs.w[DI] += 2 * I.DirVal;
124113}
125114
126115static void PREFIX186(_outsb)(void)    /* Opcode 0x6e */
127116{
128117   ICOUNT -= cycles.outs8;
129   write_port(I.regs.w[DX],GetMemB(DS,I.regs.w[SI]));
118   write_port_byte(I.regs.w[DX],GetMemB(DS,I.regs.w[SI]));
130119   I.regs.w[SI] += I.DirVal; /* GOL 11/27/01 */
131120}
132121
133122static void PREFIX186(_outsw)(void)    /* Opcode 0x6f */
134123{
135124   ICOUNT -= cycles.outs16;
136   write_port(I.regs.w[DX],GetMemB(DS,I.regs.w[SI]));
137   write_port(I.regs.w[DX]+1,GetMemB(DS,I.regs.w[SI]+1));
125   write_port_word(I.regs.w[DX],GetMemW(DS,I.regs.w[SI]));
138126   I.regs.w[SI] += 2 * I.DirVal; /* GOL 11/27/01 */
139127}
140128
src/emu/cpu/i86/instr286.c
r869r870
2020#define WRITEABLE(a) ((a&0xa)==2)
2121#define READABLE(a) ( ((a&0xa)==0xa)|| ((a&8)==0) )
2222
23static void i286_trap2(int number)
23static void i80286_trap2(int number)
2424{
25   i286_interrupt(number);
25   i80286_interrupt(number);
2626}
2727
28static int i286_selector_okay(UINT16 selector)
28static int i80286_selector_okay(UINT16 selector)
2929{
3030   if (selector&4) {
3131      return (selector&~7)<I.ldtr.limit;
r869r870
3434   }
3535}
3636
37static offs_t i286_selector_to_address(UINT16 selector)
37static offs_t i80286_selector_to_address(UINT16 selector)
3838{
3939   if (selector&4) {
4040      return I.ldtr.base+(selector&~7);
r869r870
4343   }
4444}
4545
46static void i286_data_descriptor(int reg, UINT16 selector)
46static void i80286_data_descriptor(int reg, UINT16 selector)
4747{
4848   if (PM) {
4949      UINT16 help;
r869r870
5353           1,0: requested privileg level
5454           must be higher or same as current privileg level in code selector */
5555      if (selector&4) { /* local descriptor table */
56         if (selector>I.ldtr.limit) i286_trap2(GENERAL_PROTECTION_FAULT);
56         if (selector>I.ldtr.limit) i80286_trap2(GENERAL_PROTECTION_FAULT);
5757         I.sregs[reg]=selector;
5858         I.limit[reg]=ReadWord(I.ldtr.base+(selector&~7));
5959         I.base[reg]=ReadWord(I.ldtr.base+(selector&~7)+2)
r869r870
6161         I.rights[reg]=I.base[reg]>>24;
6262         I.base[reg]&=0xffffff;
6363      } else { /* global descriptor table */
64         if (!(selector&~7)||(selector>I.gdtr.limit)) i286_trap2(GENERAL_PROTECTION_FAULT);
64         if (!(selector&~7)||(selector>I.gdtr.limit)) i80286_trap2(GENERAL_PROTECTION_FAULT);
6565         I.sregs[reg]=selector;
6666         I.limit[reg]=ReadWord(I.gdtr.base+(selector&~7));
6767         I.base[reg]=ReadWord(I.gdtr.base+(selector&~7)+2);
r869r870
7575   }
7676}
7777
78static void i286_code_descriptor(UINT16 selector, UINT16 offset)
78static void i80286_code_descriptor(UINT16 selector, UINT16 offset)
7979{
8080   UINT16 word1, word2, word3;
8181   if (PM) {
r869r870
8585           1,0: requested privileg level
8686           must be higher or same as current privileg level in code selector */
8787      if (selector&4) { /* local descriptor table */
88         if (selector>I.ldtr.limit) i286_trap2(GENERAL_PROTECTION_FAULT);
88         if (selector>I.ldtr.limit) i80286_trap2(GENERAL_PROTECTION_FAULT);
8989         word1=ReadWord(I.ldtr.base+(selector&~7));
9090         word2=ReadWord(I.ldtr.base+(selector&~7)+2);
9191         word3=ReadWord(I.ldtr.base+(selector&~7)+4);
9292      } else { /* global descriptor table */
93         if (!(selector&~7)||(selector>I.gdtr.limit)) i286_trap2(GENERAL_PROTECTION_FAULT);
93         if (!(selector&~7)||(selector>I.gdtr.limit)) i80286_trap2(GENERAL_PROTECTION_FAULT);
9494         word1=ReadWord(I.gdtr.base+(selector&~7));
9595         word2=ReadWord(I.gdtr.base+(selector&~7)+2);
9696         word3=ReadWord(I.gdtr.base+(selector&~7)+4);
r869r870
105105         switch (word3&0xf00) {
106106         case 0x400: // call gate
107107            // word3&0x1f words to be copied from stack to stack
108            i286_data_descriptor(CS, word2);
108            i80286_data_descriptor(CS, word2);
109109            I.pc=I.base[CS]+word1;
110110            break;
111111         case 0x500: // task gate
112            i286_data_descriptor(CS, word2);
112            i80286_data_descriptor(CS, word2);
113113            I.pc=I.base[CS]+word1;
114114            break;
115115         case 0x600: // interrupt gate
116116            I.TF = I.IF = 0;
117            i286_data_descriptor(CS, word2);
117            i80286_data_descriptor(CS, word2);
118118            I.pc=I.base[CS]+word1;
119119            break;
120120         case 0x700: // trap gate
121            i286_data_descriptor(CS, word2);
121            i80286_data_descriptor(CS, word2);
122122            I.pc=I.base[CS]+word1;
123123            break;
124124         }
r869r870
130130   }
131131}
132132
133static void i286_interrupt_descriptor(UINT16 number)
133static void i80286_interrupt_descriptor(UINT16 number)
134134{
135135   UINT16 word1,word2,word3;
136136   if ((number<<3)>=I.idtr.limit) {
r869r870
145145   word3=ReadWord(I.idtr.base+(number<<3)+4);
146146   switch (word3&0xf00) {
147147   case 0x500: // task gate
148      i286_data_descriptor(CS, word2);
148      i80286_data_descriptor(CS, word2);
149149      I.pc=I.base[CS]+word1;
150150      break;
151151   case 0x600: // interrupt gate
152152      I.TF = I.IF = 0;
153      i286_data_descriptor(CS, word2);
153      i80286_data_descriptor(CS, word2);
154154      I.pc=I.base[CS]+word1;
155155      break;
156156   case 0x700: // trap gate
157      i286_data_descriptor(CS, word2);
157      i80286_data_descriptor(CS, word2);
158158      I.pc=I.base[CS]+word1;
159159      break;
160160   }
r869r870
172172      ModRM=FETCHOP;
173173      switch (ModRM&0x38) {
174174      case 0: /* sldt */
175         if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
175         if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
176176         PutRMWord(ModRM, I.ldtr.sel);
177177         break;
178178      case 8: /* str */
179         if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
179         if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
180180         PutRMWord(ModRM, I.tr.sel);
181181         break;
182182      case 0x10: /* lldt */
183         if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
184         if (PM&&(CPL!=0)) i286_trap2(GENERAL_PROTECTION_FAULT);
183         if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
184         if (PM&&(CPL!=0)) i80286_trap2(GENERAL_PROTECTION_FAULT);
185185         I.ldtr.sel=GetRMWord(ModRM);
186         if ((I.ldtr.sel&~7)>=I.gdtr.limit) i286_trap2(GENERAL_PROTECTION_FAULT);
186         if ((I.ldtr.sel&~7)>=I.gdtr.limit) i80286_trap2(GENERAL_PROTECTION_FAULT);
187187         I.ldtr.limit=ReadWord(I.gdtr.base+(I.ldtr.sel&~7));
188188         I.ldtr.base=ReadWord(I.gdtr.base+(I.ldtr.sel&~7)+2)
189189            |(ReadWord(I.gdtr.base+(I.ldtr.sel&~7)+4)<<16);
r869r870
191191         I.ldtr.base&=0xffffff;
192192         break;
193193      case 0x18: /* ltr */
194         if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
195         if (CPL!=0) i286_trap2(GENERAL_PROTECTION_FAULT);
194         if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
195         if (CPL!=0) i80286_trap2(GENERAL_PROTECTION_FAULT);
196196         I.tr.sel=GetRMWord(ModRM);
197         if ((I.tr.sel&~7)>=I.gdtr.limit) i286_trap2(GENERAL_PROTECTION_FAULT);
197         if ((I.tr.sel&~7)>=I.gdtr.limit) i80286_trap2(GENERAL_PROTECTION_FAULT);
198198         I.tr.limit=ReadWord(I.gdtr.base+(I.tr.sel&~7));
199199         I.tr.base=ReadWord(I.gdtr.base+(I.tr.sel&~7)+2)
200200            |(ReadWord(I.gdtr.base+(I.tr.sel&~7)+4)<<16);
r869r870
202202         I.tr.base&=0xffffff;
203203         break;
204204      case 0x20: /* verr */
205         if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
205         if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
206206         tmp=GetRMWord(ModRM);
207207         if (tmp&4) {
208208            I.ZeroVal=( ((tmp&~7)<I.ldtr.limit)
r869r870
213213         }
214214         break;
215215      case 0x28: /* verw */
216         if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
216         if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
217217         tmp=GetRMWord(ModRM);
218218         if (tmp&4) {
219219            I.ZeroVal=( ((tmp&~7)<I.ldtr.limit)
r869r870
224224         }
225225         break;
226226      default:
227         i286_trap2(ILLEGAL_INSTRUCTION);
227         i80286_trap2(ILLEGAL_INSTRUCTION);
228228         break;
229229      }
230230      break;
r869r870
244244         PutRMByteOffset(4,I.idtr.base>>16);
245245         break;
246246      case 0x10: /* lgdt */
247         if (PM&&(CPL!=0)) i286_trap2(GENERAL_PROTECTION_FAULT);
247         if (PM&&(CPL!=0)) i80286_trap2(GENERAL_PROTECTION_FAULT);
248248         I.gdtr.limit=GetRMWord(ModRM);
249249         I.gdtr.base=GetRMWordOffset(2)|(GetRMByteOffset(4)<<16);
250250         break;
251251      case 0x18: /* lidt */
252         if (PM&&(CPL!=0)) i286_trap2(GENERAL_PROTECTION_FAULT);
252         if (PM&&(CPL!=0)) i80286_trap2(GENERAL_PROTECTION_FAULT);
253253         I.idtr.limit=GetRMWord(ModRM);
254254         I.idtr.base=GetRMWordOffset(2)|(GetRMByteOffset(4)<<16);
255255         break;
r869r870
257257         PutRMWord(ModRM, I.msw);
258258         break;
259259      case 0x30: /* lmsw */
260         if (PM&&(CPL!=0)) i286_trap2(GENERAL_PROTECTION_FAULT);
260         if (PM&&(CPL!=0)) i80286_trap2(GENERAL_PROTECTION_FAULT);
261261         I.msw=(I.msw&1)|GetRMWord(ModRM);
262262         break;
263263      default:
264         i286_trap2(ILLEGAL_INSTRUCTION);
264         i80286_trap2(ILLEGAL_INSTRUCTION);
265265         break;
266266      }
267267      break;
268268   case 2: /* LAR */
269269      ModRM = FETCHOP;
270270      tmp=GetRMWord(ModRM);
271      I.ZeroVal=i286_selector_okay(tmp);
271      I.ZeroVal=i80286_selector_okay(tmp);
272272      if (I.ZeroVal) {
273273         RegWord(ModRM)=tmp;
274274      }
275275      break;
276276   case 3: /* LSL */
277      if (!PM) i286_trap2(ILLEGAL_INSTRUCTION);
277      if (!PM) i80286_trap2(ILLEGAL_INSTRUCTION);
278278      ModRM = FETCHOP;
279279      tmp=GetRMWord(ModRM);
280      I.ZeroVal=i286_selector_okay(tmp);
280      I.ZeroVal=i80286_selector_okay(tmp);
281281      if (I.ZeroVal) {
282         addr=i286_selector_to_address(tmp);
282         addr=i80286_selector_to_address(tmp);
283283         RegWord(ModRM)=ReadWord(addr);
284284      }
285285      break;
286286   case 6: /* clts */
287      if (PM&&(CPL!=0)) i286_trap2(GENERAL_PROTECTION_FAULT);
287      if (PM&&(CPL!=0)) i80286_trap2(GENERAL_PROTECTION_FAULT);
288288      I.msw=~8;
289289      break;
290290   default:
291      i286_trap2(ILLEGAL_INSTRUCTION);
291      i80286_trap2(ILLEGAL_INSTRUCTION);
292292      break;
293293   }
294294}
r869r870
298298   if (PM) {
299299      UINT16 ModRM=FETCHOP, tmp=GetRMWord(ModRM);
300300
301      I.ZeroVal=i286_selector_okay(RegWord(ModRM))
302           &&i286_selector_okay(RegWord(ModRM))
301      I.ZeroVal=i80286_selector_okay(RegWord(ModRM))
302           &&i80286_selector_okay(RegWord(ModRM))
303303           &&((tmp&3)<(RegWord(ModRM)&3));
304304      if (I.ZeroVal) PutbackRMWord(ModRM, (tmp&~3)|(RegWord(ModRM)&3));
305305   } else {
306      i286_trap2(ILLEGAL_INSTRUCTION);
306      i80286_trap2(ILLEGAL_INSTRUCTION);
307307   }
308308}
src/emu/cpu/i86/instr286.h
r869r870
55#define CPL (I.sregs[CS]&3)
66#define IOPL ((I.flags&0x3000)>>12)
77
8static void i286_trap2(int number);
9static void i286_interrupt_descriptor(UINT16 number);
10static void i286_code_descriptor(UINT16 selector, UINT16 offset);
11static void i286_data_descriptor(int reg, UINT16 selector);
8static void i80286_trap2(int number);
9static void i80286_interrupt_descriptor(UINT16 number);
10static void i80286_code_descriptor(UINT16 selector, UINT16 offset);
11static void i80286_data_descriptor(int reg, UINT16 selector);
1212static void PREFIX286(_0fpre)(void);
1313static void PREFIX286(_arpl)(void);
src/emu/cpu/i86/i86mem.c
r0r870
1/*****************************************************************************
2    8-bit memory accessors
3 *****************************************************************************/
4
5static UINT16 read_word_8(offs_t addr)
6{
7   UINT16 result = program_read_byte_8(addr);
8   return result | (program_read_byte_8(addr + 1) << 8);
9}
10
11static void write_word_8(offs_t addr, UINT16 data)
12{
13   program_write_byte_8(addr, data);
14   program_write_byte_8(addr + 1, data >> 8);
15}
16
17static UINT16 read_port_word_8(offs_t addr)
18{
19   UINT16 result = io_read_byte_8(addr);
20   return result | (io_read_byte_8(addr + 1) << 8);
21}
22
23static void write_port_word_8(offs_t addr, UINT16 data)
24{
25   io_write_byte_8(addr, data);
26   io_write_byte_8(addr + 1, data >> 8);
27}
28
29static void configure_memory_8bit(void)
30{
31   I.mem.fetch_xor = 0;
32
33   I.mem.rbyte = program_read_byte_8;
34   I.mem.rword = read_word_8;
35   I.mem.wbyte = program_write_byte_8;
36   I.mem.wword = write_word_8;
37
38   I.mem.rbyte_port = io_read_byte_8;
39   I.mem.rword_port = read_port_word_8;
40   I.mem.wbyte_port = io_write_byte_8;
41   I.mem.wword_port = write_port_word_8;
42}
43
44
45/*****************************************************************************
46    16-bit memory accessors
47 *****************************************************************************/
48
49static UINT16 read_word_16le(offs_t addr)
50{
51   if (!(addr & 1))
52      return program_read_word_16le(addr);
53   else
54   {
55      UINT16 result = program_read_byte_16le(addr);
56      return result | (program_read_byte_16le(addr + 1) << 8);
57   }
58}
59
60static void write_word_16le(offs_t addr, UINT16 data)
61{
62   if (!(addr & 1))
63      program_write_word_16le(addr, data);
64   else
65   {
66      program_write_byte_16le(addr, data);
67      program_write_byte_16le(addr + 1, data >> 8);
68   }
69}
70
71static UINT16 read_port_word_16le(offs_t addr)
72{
73   if (!(addr & 1))
74      return io_read_word_16le(addr);
75   else
76   {
77      UINT16 result = io_read_byte_16le(addr);
78      return result | (io_read_byte_16le(addr + 1) << 8);
79   }
80}
81
82static void write_port_word_16le(offs_t addr, UINT16 data)
83{
84   if (!(addr & 1))
85      io_write_word_16le(addr, data);
86   else
87   {
88      io_write_byte_16le(addr, data);
89      io_write_byte_16le(addr + 1, data >> 8);
90   }
91}
92
93static void configure_memory_16bit(void)
94{
95   I.mem.fetch_xor = BYTE_XOR_LE(0);
96
97   I.mem.rbyte = program_read_byte_16le;
98   I.mem.rword = read_word_16le;
99   I.mem.wbyte = program_write_byte_16le;
100   I.mem.wword = write_word_16le;
101
102   I.mem.rbyte_port = io_read_byte_16le;
103   I.mem.rword_port = read_port_word_16le;
104   I.mem.wbyte_port = io_write_byte_16le;
105   I.mem.wword_port = write_port_word_16le;
106}
src/emu/cpu/i86/i86.c
r869r870
1010#include "i86.h"
1111#include "i86intf.h"
1212
13#include "i86mem.h"
14
1315extern int i386_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, int mode);
1416
1517
r869r870
2325   UINT16 w[8];                  /* viewed as 16 bits registers */
2426   UINT8 b[16];                  /* or as 8 bit registers */
2527}
26i86basicregs;
28i8086basicregs;
2729
2830typedef struct
2931{
30   i86basicregs regs;
32   i8086basicregs regs;
3133   UINT32 pc;
3234   UINT32 prevpc;
3335   UINT32 base[4];
r869r870
4345   INT8 irq_state;
4446   INT8 test_state;   /* PJB 03/05 */
4547   INT32 extra_cycles;       /* extra cycles for interrupts */
48
49   memory_interface   mem;
4650}
47i86_Regs;
51i8086_Regs;
4852
4953
5054#include "i86time.c"
r869r870
5357/* cpu state                                                               */
5458/***************************************************************************/
5559
56int i86_ICount;
60int i8086_ICount;
5761
58static i86_Regs I;
62static i8086_Regs I;
5963static unsigned prefix_base;         /* base address of the latest prefix segment */
6064static char seg_prefix;               /* prefix segment indicator */
6165
6266static UINT8 parity_table[256];
6367
64static struct i86_timing cycles;
68static struct i80x86_timing cycles;
6569
6670/* The interrupt number of a pending external interrupt pending NMI is 2.   */
6771/* For INTR interrupts, the level is caught on the bus during an INTA cycle */
6872
69#define PREFIX(name) i86##name
70#define PREFIX86(name) i86##name
73#define PREFIX(name) i8086##name
74#define PREFIX86(name) i8086##name
7175
72#define I86
76#define I8086
7377#include "instr86.h"
7478#include "ea.h"
7579#include "modrm.h"
7680#include "table86.h"
7781
7882#include "instr86.c"
79#undef I86
83#undef I8086
8084
85#include "i86mem.c"
86
8187/***************************************************************************/
82static void i86_state_register(int index)
88static void i8086_state_register(int index)
8389{
84   static const char type[] = "I86";
90   static const char type[] = "I8086";
8591   state_save_register_item_array(type, index, I.regs.w);
8692   state_save_register_item(type, index, I.pc);
8793   state_save_register_item(type, index, I.prevpc);
r869r870
105111   state_save_register_item(type, index, I.test_state);   /* PJB 03/05 */
106112}
107113
108static void i86_init(int index, int clock, const void *config, int (*irqcallback)(int))
114static void i8086_init(int index, int clock, const void *config, int (*irqcallback)(int))
109115{
110116   unsigned int i, j, c;
111117   static const BREGS reg_name[8] = {AL, CL, DL, BL, AH, CH, DH, BH};
r869r870
132138
133139   I.irq_callback = irqcallback;
134140
135   i86_state_register(index);
141   i8086_state_register(index);
142   configure_memory_16bit();
136143}
137144
138static void i86_reset(void)
145static void i8088_init(int index, int clock, const void *config, int (*irqcallback)(int))
139146{
147   i8086_init(index, clock, config, irqcallback);
148   configure_memory_8bit();
149}
150
151static void i8086_reset(void)
152{
140153   int (*save_irqcallback)(int);
154    memory_interface save_mem;
141155
142156   save_irqcallback = I.irq_callback;
157   save_mem = I.mem;
143158   memset(&I, 0, sizeof (I));
144159   I.irq_callback = save_irqcallback;
160   I.mem = save_mem;
145161
146162   I.sregs[CS] = 0xf000;
147163   I.base[CS] = SegBase(CS);
r869r870
151167   change_pc(I.pc);
152168}
153169
154static void i86_exit(void)
170static void i8086_exit(void)
155171{
156172   /* nothing to do ? */
157173}
158174
159175/* ASG 971222 -- added these interface functions */
160176
161static void i86_get_context(void *dst)
177static void i8086_get_context(void *dst)
162178{
163179   if (dst)
164      *(i86_Regs *) dst = I;
180      *(i8086_Regs *) dst = I;
165181}
166182
167static void i86_set_context(void *src)
183static void i8086_set_context(void *src)
168184{
169185   if (src)
170186   {
171      I = *(i86_Regs *)src;
187      I = *(i8086_Regs *)src;
172188      I.base[CS] = SegBase(CS);
173189      I.base[DS] = SegBase(DS);
174190      I.base[ES] = SegBase(ES);
r869r870
187203
188204      /* on a rising edge, signal the NMI */
189205      if (state != CLEAR_LINE)
190         PREFIX(_interrupt)(I86_NMI_INT_VECTOR);
206         PREFIX(_interrupt)(I8086_NMI_INT_VECTOR);
191207   }
192208   else
193209   {
r869r870
205221        I.test_state = !state;
206222}
207223
208static int i86_execute(int num_cycles)
224static int i8086_execute(int num_cycles)
209225{
210226   /* copy over the cycle counts if they're not correct */
211227   if (cycles.id != 8086)
212      cycles = i86_cycles;
228      cycles = i8086_cycles;
213229
214230   /* adjust for any interrupts that came in */
215   i86_ICount = num_cycles;
216   i86_ICount -= I.extra_cycles;
231   i8086_ICount = num_cycles;
232   i8086_ICount -= I.extra_cycles;
217233   I.extra_cycles = 0;
218234
219235   /* run until we're out */
220   while (i86_ICount > 0)
236   while (i8086_ICount > 0)
221237   {
222238//#define VERBOSE_DEBUG
223239#ifdef VERBOSE_DEBUG
r869r870
233249   }
234250
235251   /* adjust for any interrupts that came in */
236   i86_ICount -= I.extra_cycles;
252   i8086_ICount -= I.extra_cycles;
237253   I.extra_cycles = 0;
238254
239   return num_cycles - i86_ICount;
255   return num_cycles - i8086_ICount;
240256}
241257
242258
243259#ifdef MAME_DEBUG
244static offs_t i86_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
260static offs_t i8086_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
245261{
246262   return i386_dasm_one(buffer, pc, oprom, 16);
247263}
248264#endif /* MAME_DEBUG */
249265
250266
251#if (HAS_I186 || HAS_I188)
267#if (HAS_I80186 || HAS_I80188)
252268
253269#include "i186intf.h"
254270
255271#undef PREFIX
256#define PREFIX(name) i186##name
257#define PREFIX186(name) i186##name
272#define PREFIX(name) i80186##name
273#define PREFIX186(name) i80186##name
258274
259#define I186
275#define I80186
260276#include "instr186.h"
261277#include "table186.h"
262278
263279#include "instr86.c"
264280#include "instr186.c"
265#undef I186
281#undef I80186
266282
267static int i186_execute(int num_cycles)
283static int i80186_execute(int num_cycles)
268284{
269285   /* copy over the cycle counts if they're not correct */
270286   if (cycles.id != 80186)
271      cycles = i186_cycles;
287      cycles = i80186_cycles;
272288
273289   /* adjust for any interrupts that came in */
274   i86_ICount = num_cycles;
275   i86_ICount -= I.extra_cycles;
290   i8086_ICount = num_cycles;
291   i8086_ICount -= I.extra_cycles;
276292   I.extra_cycles = 0;
277293
278294   /* run until we're out */
279   while (i86_ICount > 0)
295   while (i8086_ICount > 0)
280296   {
281297#ifdef VERBOSE_DEBUG
282298      mame_printf_debug("[%04x:%04x]=%02x\tAX=%04x\tBX=%04x\tCX=%04x\tDX=%04x\n", I.sregs[CS], I.pc, ReadByte(I.pc), I.regs.w[AX],
r869r870
290306   }
291307
292308   /* adjust for any interrupts that came in */
293   i86_ICount -= I.extra_cycles;
309   i8086_ICount -= I.extra_cycles;
294310   I.extra_cycles = 0;
295311
296   return num_cycles - i86_ICount;
312   return num_cycles - i8086_ICount;
297313}
298314
299315#endif
300316
301317
302318
303#if defined(INCLUDE_V20) && (HAS_V20 || HAS_V30 || HAS_V33)
304
305#include "v30.h"
306#include "v30intf.h"
307
308/* compile the opcode emulating instruction new with v20 timing value */
309/* MF flag -> opcode must be compiled new */
310#undef PREFIX
311#define PREFIX(name) v30##name
312#undef PREFIX86
313#define PREFIX86(name) v30##name
314#undef PREFIX186
315#define PREFIX186(name) v30##name
316#define PREFIXV30(name) v30##name
317
318#define nec_ICount i86_ICount
319
320static UINT16 bytes[] =
321{
322      1,    2,    4,    8,
323     16,   32,   64,  128,
324    256,  512, 1024, 2048,
325   4096, 8192,16384,32768   /*,65536 */
326};
327
328#undef IncWordReg
329#undef DecWordReg
330#define V20
331#include "instr86.h"
332#include "instr186.h"
333#include "instrv30.h"
334#include "tablev30.h"
335
336static void v30_interrupt(unsigned int_num, BOOLEAN md_flag)
337{
338   unsigned dest_seg, dest_off;
339
340#if 0
341   logerror("PC=%05x : NEC Interrupt %02d", activecpu_get_pc(), int_num);
342#endif
343
344   v30_pushf();
345   I.TF = I.IF = 0;
346   if (md_flag)
347      SetMD(0);                  /* clear Mode-flag = start 8080 emulation mode */
348
349   if (int_num == -1)
350   {
351      int_num = (*I.irq_callback) (0);
352/*      logerror(" (indirect ->%02d) ",int_num); */
353   }
354
355   dest_off = ReadWord(int_num * 4);
356   dest_seg = ReadWord(int_num * 4 + 2);
357
358   PUSH(I.sregs[CS]);
359   PUSH(I.pc - I.base[CS]);
360   I.sregs[CS] = (WORD) dest_seg;
361   I.base[CS] = SegBase(CS);
362   I.pc = (I.base[CS] + dest_off) & AMASK;
363   change_pc(I.pc);
364/*  logerror("=%06x\n",activecpu_get_pc()); */
365}
366
367static void v30_trap(void)
368{
369   (*v30_instruction[FETCHOP])();
370   v30_interrupt(1, 0);
371}
372
373
374#include "instr86.c"
375#include "instr186.c"
376#include "instrv30.c"
377#undef V20
378
379static void v30_reset(void)
380{
381   i86_reset(param);
382   SetMD(1);
383}
384
385static int v30_execute(int num_cycles)
386{
387   /* copy over the cycle counts if they're not correct */
388   if (cycles.id != 30)
389      cycles = v30_cycles;
390
391   /* adjust for any interrupts that came in */
392   i86_ICount = num_cycles;
393   i86_ICount -= I.extra_cycles;
394   I.extra_cycles = 0;
395
396   /* run until we're out */
397   while (i86_ICount > 0)
398   {
399#ifdef VERBOSE_DEBUG
400      mame_printf_debug("[%04x:%04x]=%02x\tAX=%04x\tBX=%04x\tCX=%04x\tDX=%04x\n", I.sregs[CS], I.pc, ReadByte(I.pc), I.regs.w[AX],
401            I.regs.w[BX], I.regs.w[CX], I.regs.w[DX]);
402#endif
403      CALL_MAME_DEBUG;
404
405      seg_prefix = FALSE;
406      I.prevpc = I.pc;
407      TABLEV30;
408   }
409
410   /* adjust for any interrupts that came in */
411   i86_ICount -= I.extra_cycles;
412   I.extra_cycles = 0;
413
414   return num_cycles - i86_ICount;
415}
416
417#endif
418
419
420
421319/**************************************************************************
422320 * Generic set_info
423321 **************************************************************************/
424322
425static void i86_set_info(UINT32 state, cpuinfo *info)
323static void i8086_set_info(UINT32 state, cpuinfo *info)
426324{
427325   switch (state)
428326   {
r869r870
432330      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_TEST:   set_test_line(info->i);               break; /* PJB 03/05 */
433331
434332      case CPUINFO_INT_PC:
435      case CPUINFO_INT_REGISTER + I86_PC:
333      case CPUINFO_INT_REGISTER + I8086_PC:
436334         if (info->i - I.base[CS] >= 0x10000)
437335         {
438336            I.base[CS] = info->i & 0xffff0;
r869r870
440338         }
441339         I.pc = info->i;
442340         break;
443      case CPUINFO_INT_REGISTER + I86_IP:            I.pc = I.base[CS] + info->i;         break;
341      case CPUINFO_INT_REGISTER + I8086_IP:         I.pc = I.base[CS] + info->i;         break;
444342      case CPUINFO_INT_SP:
445343         if (info->i - I.base[SS] < 0x10000)
446344         {
r869r870
453351            I.regs.w[SP] = info->i & 0x0000f;
454352         }
455353         break;
456      case CPUINFO_INT_REGISTER + I86_SP:            I.regs.w[SP] = info->i;             break;
457      case CPUINFO_INT_REGISTER + I86_FLAGS:          I.flags = info->i;   ExpandFlags(info->i); break;
458      case CPUINFO_INT_REGISTER + I86_AX:            I.regs.w[AX] = info->i;             break;
459      case CPUINFO_INT_REGISTER + I86_CX:            I.regs.w[CX] = info->i;             break;
460      case CPUINFO_INT_REGISTER + I86_DX:            I.regs.w[DX] = info->i;             break;
461      case CPUINFO_INT_REGISTER + I86_BX:            I.regs.w[BX] = info->i;             break;
462      case CPUINFO_INT_REGISTER + I86_BP:            I.regs.w[BP] = info->i;             break;
463      case CPUINFO_INT_REGISTER + I86_SI:            I.regs.w[SI] = info->i;             break;
464      case CPUINFO_INT_REGISTER + I86_DI:            I.regs.w[DI] = info->i;             break;
465      case CPUINFO_INT_REGISTER + I86_ES:            I.sregs[ES] = info->i;   I.base[ES] = SegBase(ES); break;
466      case CPUINFO_INT_REGISTER + I86_CS:            I.sregs[CS] = info->i;   I.base[CS] = SegBase(CS); break;
467      case CPUINFO_INT_REGISTER + I86_SS:            I.sregs[SS] = info->i;   I.base[SS] = SegBase(SS); break;
468      case CPUINFO_INT_REGISTER + I86_DS:            I.sregs[DS] = info->i;   I.base[DS] = SegBase(DS); break;
469      case CPUINFO_INT_REGISTER + I86_VECTOR:         I.int_vector = info->i;             break;
354      case CPUINFO_INT_REGISTER + I8086_SP:         I.regs.w[SP] = info->i;             break;
355      case CPUINFO_INT_REGISTER + I8086_FLAGS:       I.flags = info->i;   ExpandFlags(info->i); break;
356      case CPUINFO_INT_REGISTER + I8086_AX:         I.regs.w[AX] = info->i;             break;
357      case CPUINFO_INT_REGISTER + I8086_CX:         I.regs.w[CX] = info->i;             break;
358      case CPUINFO_INT_REGISTER + I8086_DX:         I.regs.w[DX] = info->i;             break;
359      case CPUINFO_INT_REGISTER + I8086_BX:         I.regs.w[BX] = info->i;             break;
360      case CPUINFO_INT_REGISTER + I8086_BP:         I.regs.w[BP] = info->i;             break;
361      case CPUINFO_INT_REGISTER + I8086_SI:         I.regs.w[SI] = info->i;             break;
362      case CPUINFO_INT_REGISTER + I8086_DI:         I.regs.w[DI] = info->i;             break;
363      case CPUINFO_INT_REGISTER + I8086_ES:         I.sregs[ES] = info->i;   I.base[ES] = SegBase(ES); break;
364      case CPUINFO_INT_REGISTER + I8086_CS:         I.sregs[CS] = info->i;   I.base[CS] = SegBase(CS); break;
365      case CPUINFO_INT_REGISTER + I8086_SS:         I.sregs[SS] = info->i;   I.base[SS] = SegBase(SS); break;
366      case CPUINFO_INT_REGISTER + I8086_DS:         I.sregs[DS] = info->i;   I.base[DS] = SegBase(DS); break;
367      case CPUINFO_INT_REGISTER + I8086_VECTOR:      I.int_vector = info->i;             break;
470368   }
471369}
472370
r869r870
476374 * Generic get_info
477375 **************************************************************************/
478376
479void i86_get_info(UINT32 state, cpuinfo *info)
377void i8086_get_info(UINT32 state, cpuinfo *info)
480378{
481379   switch (state)
482380   {
r869r870
491389      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
492390      case CPUINFO_INT_MAX_CYCLES:               info->i = 50;                     break;
493391
494      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
392      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
495393      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
496394      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
497395      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
498396      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
499397      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
500      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
398      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
501399      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
502400      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
503401
r869r870
509407      case CPUINFO_INT_PREVIOUSPC:               info->i = I.prevpc;                  break;
510408
511409      case CPUINFO_INT_PC:
512      case CPUINFO_INT_REGISTER + I86_PC:            info->i = I.pc;                     break;
513      case CPUINFO_INT_REGISTER + I86_IP:            info->i = I.pc - I.base[CS];         break;
410      case CPUINFO_INT_REGISTER + I8086_PC:         info->i = I.pc;                     break;
411      case CPUINFO_INT_REGISTER + I8086_IP:         info->i = I.pc - I.base[CS];         break;
514412      case CPUINFO_INT_SP:                     info->i = I.base[SS] + I.regs.w[SP];   break;
515      case CPUINFO_INT_REGISTER + I86_SP:            info->i = I.regs.w[SP];               break;
516      case CPUINFO_INT_REGISTER + I86_FLAGS:          I.flags = CompressFlags(); info->i = I.flags; break;
517      case CPUINFO_INT_REGISTER + I86_AX:            info->i = I.regs.w[AX];               break;
518      case CPUINFO_INT_REGISTER + I86_CX:            info->i = I.regs.w[CX];               break;
519      case CPUINFO_INT_REGISTER + I86_DX:            info->i = I.regs.w[DX];               break;
520      case CPUINFO_INT_REGISTER + I86_BX:            info->i = I.regs.w[BX];               break;
521      case CPUINFO_INT_REGISTER + I86_BP:            info->i = I.regs.w[BP];               break;
522      case CPUINFO_INT_REGISTER + I86_SI:            info->i = I.regs.w[SI];               break;
523      case CPUINFO_INT_REGISTER + I86_DI:            info->i = I.regs.w[DI];               break;
524      case CPUINFO_INT_REGISTER + I86_ES:            info->i = I.sregs[ES];               break;
525      case CPUINFO_INT_REGISTER + I86_CS:            info->i = I.sregs[CS];               break;
526      case CPUINFO_INT_REGISTER + I86_SS:            info->i = I.sregs[SS];               break;
527      case CPUINFO_INT_REGISTER + I86_DS:            info->i = I.sregs[DS];               break;
528      case CPUINFO_INT_REGISTER + I86_VECTOR:         info->i = I.int_vector;               break;
413      case CPUINFO_INT_REGISTER + I8086_SP:         info->i = I.regs.w[SP];               break;
414      case CPUINFO_INT_REGISTER + I8086_FLAGS:       I.flags = CompressFlags(); info->i = I.flags; break;
415      case CPUINFO_INT_REGISTER + I8086_AX:         info->i = I.regs.w[AX];               break;
416      case CPUINFO_INT_REGISTER + I8086_CX:         info->i = I.regs.w[CX];               break;
417      case CPUINFO_INT_REGISTER + I8086_DX:         info->i = I.regs.w[DX];               break;
418      case CPUINFO_INT_REGISTER + I8086_BX:         info->i = I.regs.w[BX];               break;
419      case CPUINFO_INT_REGISTER + I8086_BP:         info->i = I.regs.w[BP];               break;
420      case CPUINFO_INT_REGISTER + I8086_SI:         info->i = I.regs.w[SI];               break;
421      case CPUINFO_INT_REGISTER + I8086_DI:         info->i = I.regs.w[DI];               break;
422      case CPUINFO_INT_REGISTER + I8086_ES:         info->i = I.sregs[ES];               break;
423      case CPUINFO_INT_REGISTER + I8086_CS:         info->i = I.sregs[CS];               break;
424      case CPUINFO_INT_REGISTER + I8086_SS:         info->i = I.sregs[SS];               break;
425      case CPUINFO_INT_REGISTER + I8086_DS:         info->i = I.sregs[DS];               break;
426      case CPUINFO_INT_REGISTER + I8086_VECTOR:      info->i = I.int_vector;               break;
529427
530428      /* --- the following bits of info are returned as pointers to data or functions --- */
531      case CPUINFO_PTR_SET_INFO:                  info->setinfo = i86_set_info;         break;
532      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = i86_get_context;      break;
533      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = i86_set_context;      break;
534      case CPUINFO_PTR_INIT:                     info->init = i86_init;               break;
535      case CPUINFO_PTR_RESET:                     info->reset = i86_reset;            break;
536      case CPUINFO_PTR_EXIT:                     info->exit = i86_exit;               break;
537      case CPUINFO_PTR_EXECUTE:                  info->execute = i86_execute;         break;
429      case CPUINFO_PTR_SET_INFO:                  info->setinfo = i8086_set_info;         break;
430      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = i8086_get_context;   break;
431      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = i8086_set_context;   break;
432      case CPUINFO_PTR_INIT:                     info->init = i8086_init;            break;
433      case CPUINFO_PTR_RESET:                     info->reset = i8086_reset;            break;
434      case CPUINFO_PTR_EXIT:                     info->exit = i8086_exit;            break;
435      case CPUINFO_PTR_EXECUTE:                  info->execute = i8086_execute;         break;
538436      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
539437#ifdef MAME_DEBUG
540      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = i86_dasm;         break;
438      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = i8086_dasm;         break;
541439#endif /* MAME_DEBUG */
542      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &i86_ICount;            break;
440      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &i8086_ICount;         break;
543441
544442      /* --- the following bits of info are returned as NULL-terminated strings --- */
545      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8086");            break;
443      case CPUINFO_STR_NAME:                     strcpy(info->s, "8086");            break;
546444      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Intel 80x86");         break;
547445      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.4");               break;
548446      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
r869r870
569467               I.flags & 0x0001 ? 'C' : '.');
570468         break;
571469
572      case CPUINFO_STR_REGISTER + I86_PC:          sprintf(info->s, "PC:%04X", I.pc); break;
573      case CPUINFO_STR_REGISTER + I86_IP:          sprintf(info->s, "IP: %04X", I.pc - I.base[CS]); break;
574      case CPUINFO_STR_REGISTER + I86_SP:          sprintf(info->s, "SP: %04X", I.regs.w[SP]); break;
575      case CPUINFO_STR_REGISTER + I86_FLAGS:         sprintf(info->s, "F:%04X", I.flags); break;
576      case CPUINFO_STR_REGISTER + I86_AX:          sprintf(info->s, "AX:%04X", I.regs.w[AX]); break;
577      case CPUINFO_STR_REGISTER + I86_CX:          sprintf(info->s, "CX:%04X", I.regs.w[CX]); break;
578      case CPUINFO_STR_REGISTER + I86_DX:          sprintf(info->s, "DX:%04X", I.regs.w[DX]); break;
579      case CPUINFO_STR_REGISTER + I86_BX:          sprintf(info->s, "BX:%04X", I.regs.w[BX]); break;
580      case CPUINFO_STR_REGISTER + I86_BP:          sprintf(info->s, "BP:%04X", I.regs.w[BP]); break;
581      case CPUINFO_STR_REGISTER + I86_SI:          sprintf(info->s, "SI: %04X", I.regs.w[SI]); break;
582      case CPUINFO_STR_REGISTER + I86_DI:          sprintf(info->s, "DI: %04X", I.regs.w[DI]); break;
583      case CPUINFO_STR_REGISTER + I86_ES:          sprintf(info->s, "ES:%04X", I.sregs[ES]); break;
584      case CPUINFO_STR_REGISTER + I86_CS:          sprintf(info->s, "CS:%04X", I.sregs[CS]); break;
585      case CPUINFO_STR_REGISTER + I86_SS:          sprintf(info->s, "SS:%04X", I.sregs[SS]); break;
586      case CPUINFO_STR_REGISTER + I86_DS:          sprintf(info->s, "DS:%04X", I.sregs[DS]); break;
587      case CPUINFO_STR_REGISTER + I86_VECTOR:          sprintf(info->s, "V:%02X", I.int_vector); break;
470      case CPUINFO_STR_REGISTER + I8086_PC:          sprintf(info->s, "PC:%04X", I.pc); break;
471      case CPUINFO_STR_REGISTER + I8086_IP:          sprintf(info->s, "IP: %04X", I.pc - I.base[CS]); break;
472      case CPUINFO_STR_REGISTER + I8086_SP:          sprintf(info->s, "SP: %04X", I.regs.w[SP]); break;
473      case CPUINFO_STR_REGISTER + I8086_FLAGS:      sprintf(info->s, "F:%04X", I.flags); break;
474      case CPUINFO_STR_REGISTER + I8086_AX:          sprintf(info->s, "AX:%04X", I.regs.w[AX]); break;
475      case CPUINFO_STR_REGISTER + I8086_CX:          sprintf(info->s, "CX:%04X", I.regs.w[CX]); break;
476      case CPUINFO_STR_REGISTER + I8086_DX:          sprintf(info->s, "DX:%04X", I.regs.w[DX]); break;
477      case CPUINFO_STR_REGISTER + I8086_BX:          sprintf(info->s, "BX:%04X", I.regs.w[BX]); break;
478      case CPUINFO_STR_REGISTER + I8086_BP:          sprintf(info->s, "BP:%04X", I.regs.w[BP]); break;
479      case CPUINFO_STR_REGISTER + I8086_SI:          sprintf(info->s, "SI: %04X", I.regs.w[SI]); break;
480      case CPUINFO_STR_REGISTER + I8086_DI:          sprintf(info->s, "DI: %04X", I.regs.w[DI]); break;
481      case CPUINFO_STR_REGISTER + I8086_ES:          sprintf(info->s, "ES:%04X", I.sregs[ES]); break;
482      case CPUINFO_STR_REGISTER + I8086_CS:          sprintf(info->s, "CS:%04X", I.sregs[CS]); break;
483      case CPUINFO_STR_REGISTER + I8086_SS:          sprintf(info->s, "SS:%04X", I.sregs[SS]); break;
484      case CPUINFO_STR_REGISTER + I8086_DS:          sprintf(info->s, "DS:%04X", I.sregs[DS]); break;
485      case CPUINFO_STR_REGISTER + I8086_VECTOR:      sprintf(info->s, "V:%02X", I.int_vector); break;
588486   }
589487}
590488
591489
592#if (HAS_I88)
490#if (HAS_I8088)
593491/**************************************************************************
594492 * CPU-specific get_info/set_info
595493 **************************************************************************/
596494
597void i88_get_info(UINT32 state, cpuinfo *info)
495void i8088_get_info(UINT32 state, cpuinfo *info)
598496{
599497   switch (state)
600498   {
601      /* --- the following bits of info are returned as NULL-terminated strings --- */
602      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8088");            break;
499      /* --- the following bits of info are returned as 64-bit signed integers --- */
500      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
501      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
603502
604      default:                              i86_get_info(state, info);            break;
605   }
606}
607#endif
608
609
610#if (HAS_I186)
611/**************************************************************************
612 * CPU-specific get_info/set_info
613 **************************************************************************/
614
615void i186_get_info(UINT32 state, cpuinfo *info)
616{
617   switch (state)
618   {
619503      /* --- the following bits of info are returned as pointers to data or functions --- */
620      case CPUINFO_PTR_EXECUTE:                  info->execute = i186_execute;         break;
504      case CPUINFO_PTR_INIT:                     info->init = i8088_init;            break;
621505
622506      /* --- the following bits of info are returned as NULL-terminated strings --- */
623      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80186");            break;
507      case CPUINFO_STR_NAME:                     strcpy(info->s, "8088");            break;
624508
625      default:                              i86_get_info(state, info);            break;
509      default:                              i8086_get_info(state, info);         break;
626510   }
627511}
628512#endif
629513
630514
631#if (HAS_I188)
515#if (HAS_I80186)
632516/**************************************************************************
633517 * CPU-specific get_info/set_info
634518 **************************************************************************/
635519
636void i188_get_info(UINT32 state, cpuinfo *info)
520void i80186_get_info(UINT32 state, cpuinfo *info)
637521{
638522   switch (state)
639523   {
640524      /* --- the following bits of info are returned as pointers to data or functions --- */
641      case CPUINFO_PTR_EXECUTE:                  info->execute = i186_execute;         break;
525      case CPUINFO_PTR_EXECUTE:                  info->execute = i80186_execute;         break;
642526
643527      /* --- the following bits of info are returned as NULL-terminated strings --- */
644      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80188");            break;
528      case CPUINFO_STR_NAME:                     strcpy(info->s, "80186");            break;
645529
646      default:                              i86_get_info(state, info);            break;
530      default:                              i8086_get_info(state, info);         break;
647531   }
648532}
649533#endif
650534
651535
652#if defined(INCLUDE_V20) && (HAS_V20)
536#if (HAS_I80188)
653537/**************************************************************************
654538 * CPU-specific get_info/set_info
655539 **************************************************************************/
656540
657void v20_get_info(UINT32 state, cpuinfo *info)
541void i80188_get_info(UINT32 state, cpuinfo *info)
658542{
659543   switch (state)
660544   {
661      /* --- the following bits of info are returned as pointers to data or functions --- */
662      case CPUINFO_PTR_INIT:                     info->init = v30_init;               break;
663      case CPUINFO_PTR_RESET:                     info->reset = v30_reset;            break;
664      case CPUINFO_PTR_EXECUTE:                  info->execute = v30_execute;         break;
665      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = v30_dasm;         break;
545      /* --- the following bits of info are returned as 64-bit signed integers --- */
546      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
547      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
666548
667      /* --- the following bits of info are returned as NULL-terminated strings --- */
668      case CPUINFO_STR_NAME:                     strcpy(info->s, "V20");               break;
669      case CPUINFO_STR_FLAGS:
670         I.flags = CompressFlags();
671         sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
672               I.flags & 0x8000 ? 'M' : '.',
673               I.flags & 0x4000 ? '?' : '.',
674               I.flags & 0x2000 ? '?' : '.',
675               I.flags & 0x1000 ? '?' : '.',
676               I.flags & 0x0800 ? 'O' : '.',
677               I.flags & 0x0400 ? 'D' : '.',
678               I.flags & 0x0200 ? 'I' : '.',
679               I.flags & 0x0100 ? 'T' : '.',
680               I.flags & 0x0080 ? 'S' : '.',
681               I.flags & 0x0040 ? 'Z' : '.',
682               I.flags & 0x0020 ? '?' : '.',
683               I.flags & 0x0010 ? 'A' : '.',
684               I.flags & 0x0008 ? '?' : '.',
685               I.flags & 0x0004 ? 'P' : '.',
686               I.flags & 0x0002 ? 'N' : '.',
687               I.flags & 0x0001 ? 'C' : '.');
688         break;
689
690      default:
691         i86_get_info(state, info);
692         break;
693   }
694}
695#endif
696
697
698#if defined(INCLUDE_V20) && (HAS_V30)
699/**************************************************************************
700 * CPU-specific get_info/set_info
701 **************************************************************************/
702
703void v30_get_info(UINT32 state, cpuinfo *info)
704{
705   switch (state)
706   {
707549      /* --- the following bits of info are returned as pointers to data or functions --- */
708      case CPUINFO_PTR_INIT:                     info->init = v30_init;               break;
709      case CPUINFO_PTR_RESET:                     info->reset = v30_reset;            break;
710      case CPUINFO_PTR_EXECUTE:                  info->execute = v30_execute;         break;
550      case CPUINFO_PTR_INIT:                     info->init = i8088_init;            break;
551      case CPUINFO_PTR_EXECUTE:                  info->execute = i80186_execute;         break;
711552
712553      /* --- the following bits of info are returned as NULL-terminated strings --- */
713      case CPUINFO_STR_NAME:                     strcpy(info->s, "V30");               break;
714      case CPUINFO_STR_FLAGS:
715         I.flags = CompressFlags();
716         sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
717               I.flags & 0x8000 ? 'M' : '.',
718               I.flags & 0x4000 ? '?' : '.',
719               I.flags & 0x2000 ? '?' : '.',
720               I.flags & 0x1000 ? '?' : '.',
721               I.flags & 0x0800 ? 'O' : '.',
722               I.flags & 0x0400 ? 'D' : '.',
723               I.flags & 0x0200 ? 'I' : '.',
724               I.flags & 0x0100 ? 'T' : '.',
725               I.flags & 0x0080 ? 'S' : '.',
726               I.flags & 0x0040 ? 'Z' : '.',
727               I.flags & 0x0020 ? '?' : '.',
728               I.flags & 0x0010 ? 'A' : '.',
729               I.flags & 0x0008 ? '?' : '.',
730               I.flags & 0x0004 ? 'P' : '.',
731               I.flags & 0x0002 ? 'N' : '.',
732               I.flags & 0x0001 ? 'C' : '.');
733         break;
554      case CPUINFO_STR_NAME:                     strcpy(info->s, "80188");            break;
734555
735      default:
736         i86_get_info(state, info);
737         break;
556      default:                              i8086_get_info(state, info);         break;
738557   }
739558}
740559#endif
741
742
743#if defined(INCLUDE_V20) && (HAS_V33)
744/**************************************************************************
745 * CPU-specific get_info/set_info
746 **************************************************************************/
747
748void v33_get_info(UINT32 state, cpuinfo *info)
749{
750   switch (state)
751   {
752      /* --- the following bits of info are returned as pointers to data or functions --- */
753      case CPUINFO_PTR_INIT:                     info->init = v33_init;               break;
754      case CPUINFO_PTR_RESET:                     info->reset = v33_reset;            break;
755      case CPUINFO_PTR_EXECUTE:                  info->execute = v33_execute;         break;
756
757      /* --- the following bits of info are returned as NULL-terminated strings --- */
758      case CPUINFO_STR_NAME:                     strcpy(info->s, "V33");               break;
759      case CPUINFO_STR_FLAGS:
760         I.flags = CompressFlags();
761         sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
762               I.flags & 0x8000 ? 'M' : '.',
763               I.flags & 0x4000 ? '?' : '.',
764               I.flags & 0x2000 ? '?' : '.',
765               I.flags & 0x1000 ? '?' : '.',
766               I.flags & 0x0800 ? 'O' : '.',
767               I.flags & 0x0400 ? 'D' : '.',
768               I.flags & 0x0200 ? 'I' : '.',
769               I.flags & 0x0100 ? 'T' : '.',
770               I.flags & 0x0080 ? 'S' : '.',
771               I.flags & 0x0040 ? 'Z' : '.',
772               I.flags & 0x0020 ? '?' : '.',
773               I.flags & 0x0010 ? 'A' : '.',
774               I.flags & 0x0008 ? '?' : '.',
775               I.flags & 0x0004 ? 'P' : '.',
776               I.flags & 0x0002 ? 'N' : '.',
777               I.flags & 0x0001 ? 'C' : '.');
778         break;
779
780      default:
781         i86_get_info(state, info);
782         break;
783   }
784}
785#endif
src/emu/cpu/i86/i86mem.h
r0r870
1typedef struct
2{
3   offs_t   fetch_xor;
4
5   UINT8   (*rbyte)(offs_t);
6   UINT16   (*rword)(offs_t);
7   void   (*wbyte)(offs_t, UINT8);
8   void   (*wword)(offs_t, UINT16);
9
10   UINT8   (*rbyte_port)(offs_t);
11   UINT16   (*rword_port)(offs_t);
12   void   (*wbyte_port)(offs_t, UINT8);
13   void   (*wword_port)(offs_t, UINT16);
14} memory_interface;
src/emu/cpu/i86/i86.h
r869r870
66#ifndef __I86_H_
77#define __I86_H_
88
9/* compile with V20,V30,V33 when configured (HAS_V20,...) */
10//#define INCLUDE_V20
11
12#define I86_NMI_INT_VECTOR 2
9#define I8086_NMI_INT_VECTOR 2
1310#define INPUT_LINE_TEST 20    /* PJB 03/05 */
1411
1512typedef enum { ES, CS, SS, DS } SREGS;
r869r870
7269
7370/************************************************************************/
7471
72#define read_byte(a)         (*I.mem.rbyte)(a)
73#define read_word(a)         (*I.mem.rword)(a)
74#define write_byte(a,d)         (*I.mem.wbyte)((a),(d))
75#define write_word(a,d)         (*I.mem.wword)((a),(d))
76
77#define read_port_byte(a)      (*I.mem.rbyte_port)(a)
78#define read_port_word(a)      (*I.mem.rword_port)(a)
79#define write_port_byte(a,d)   (*I.mem.wbyte_port)((a),(d))
80#define write_port_word(a,d)   (*I.mem.wword_port)((a),(d))
81
82/************************************************************************/
83
7584#define SegBase(Seg)          (I.sregs[Seg] << 4)
7685
7786#define DefaultBase(Seg)       ((seg_prefix && (Seg == DS || Seg == SS)) ? prefix_base : I.base[Seg])
7887
79#define GetMemB(Seg,Off)      (program_read_byte_8((DefaultBase(Seg) + (Off)) & AMASK))
80#define GetMemW(Seg,Off)      ((WORD)GetMemB(Seg, Off) + (WORD)(GetMemB(Seg, (Off) + 1) << 8))
81#define PutMemB(Seg,Off,x)      program_write_byte_8((DefaultBase(Seg) + (Off)) & AMASK, (x))
82#define PutMemW(Seg,Off,x)      { PutMemB(Seg, Off, (x) & 0xff); PutMemB(Seg, (Off) + 1, ((x) >> 8) & 0xff); }
88#define GetMemB(Seg,Off)      (read_byte((DefaultBase(Seg) + (Off)) & AMASK))
89#define GetMemW(Seg,Off)      (read_word((DefaultBase(Seg) + (Off)) & AMASK))
90#define PutMemB(Seg,Off,x)      write_byte((DefaultBase(Seg) + (Off)) & AMASK, (x))
91#define PutMemW(Seg,Off,x)      write_word((DefaultBase(Seg) + (Off)) & AMASK, (x))
8392
84#define PEEKBYTE(ea)          (program_read_byte_8((ea) & AMASK))
85#define ReadByte(ea)          (program_read_byte_8((ea) & AMASK))
86#define ReadWord(ea)         (program_read_byte_8((ea) & AMASK) + (program_read_byte_8(((ea) + 1) & AMASK) << 8))
87#define WriteByte(ea,val)      program_write_byte_8((ea) & AMASK, val);
88#define WriteWord(ea,val)      { program_write_byte_8((ea) & AMASK, (val) & 0xff); program_write_byte_8(((ea) + 1) & AMASK, ((val) >> 8) & 0xff); }
93#define PEEKBYTE(ea)          (read_byte((ea) & AMASK))
94#define ReadByte(ea)          (read_byte((ea) & AMASK))
95#define ReadWord(ea)         (read_word((ea) & AMASK))
96#define WriteByte(ea,val)      write_byte((ea) & AMASK, val);
97#define WriteWord(ea,val)      write_word((ea) & AMASK, val);
8998
90#define read_port(port)       io_read_byte_8(port)
91#define write_port(port,val)    io_write_byte_8(port,val)
92
93#define FETCH               (cpu_readop_arg(I.pc++))
94#define FETCHOP               (cpu_readop(I.pc++))
95#define PEEKOP(addr)         (cpu_readop(addr))
96#define FETCHWORD(var)          { var = cpu_readop_arg(I.pc); var += (cpu_readop_arg(I.pc + 1) << 8); I.pc += 2; }
99#define FETCH_XOR(a)         ((a) ^ I.mem.fetch_xor)
100#define FETCH               (cpu_readop_arg(FETCH_XOR(I.pc++)))
101#define FETCHOP               (cpu_readop(FETCH_XOR(I.pc++)))
102#define PEEKOP(addr)         (cpu_readop(FETCH_XOR(addr)))
103#define FETCHWORD(var)          { var = cpu_readop_arg(FETCH_XOR(I.pc)); var += (cpu_readop_arg(FETCH_XOR(I.pc + 1)) << 8); I.pc += 2; }
97104#define CHANGE_PC(addr)         change_pc(addr)
98105#define PUSH(val)            { I.regs.w[SP] -= 2; WriteWord(((I.base[SS] + I.regs.w[SP]) & AMASK), val); }
99106#define POP(var)            { var = ReadWord(((I.base[SS] + I.regs.w[SP]) & AMASK)); I.regs.w[SP] += 2; }
src/emu/cpu/i86/instr86.c
r869r870
1212
1313#undef ICOUNT
1414
15#ifdef V20
16#define ICOUNT nec_ICount
17#else
18#define ICOUNT i86_ICount
19#endif
15#define ICOUNT i8086_ICount
2016
2117
22#if !defined(V20) && !defined(I186)
18#if !defined(I80186)
2319static void PREFIX86(_interrupt)(unsigned int_num)
2420{
2521   unsigned dest_seg, dest_off;
r869r870
2824   if (int_num == -1)
2925      int_num = (*I.irq_callback)(0);
3026
31#ifdef I286
27#ifdef I80286
3228   if (PM) {
33      i286_interrupt_descriptor(int_num);
29      i80286_interrupt_descriptor(int_num);
3430   } else {
3531#endif
3632      dest_off = ReadWord(int_num*4);
r869r870
4339      I.sregs[CS] = (WORD)dest_seg;
4440      I.base[CS] = SegBase(CS);
4541      I.pc = (I.base[CS] + dest_off) & AMASK;
46#ifdef I286
42#ifdef I80286
4743   }
4844#endif
4945   CHANGE_PC(I.pc);
r869r870
5854}
5955#endif
6056
61#ifndef I186
57#ifndef I80186
6258static void PREFIX86(_rotate_shift_Byte)(unsigned ModRM, unsigned count)
6359{
6460   unsigned src = (unsigned)GetRMByte(ModRM);
r869r870
418414      ICOUNT -= cycles.override;
419415      PREFIX(rep)(flagval);
420416      break;
421#ifndef I86
417#ifndef I8086
422418   case 0x6c:   /* REP INSB */
423419      ICOUNT -= cycles.rep_ins8_base;
424420      for (; count > 0; count--)
425421      {
426422         if (ICOUNT <= 0) { I.pc = I.prevpc; break; }
427         PutMemB(ES,I.regs.w[DI],read_port(I.regs.w[DX]));
423         PutMemB(ES,I.regs.w[DI],read_port_byte(I.regs.w[DX]));
428424         I.regs.w[DI] += I.DirVal;
429425         ICOUNT -= cycles.rep_ins8_count;
430426      }
r869r870
435431      for (; count > 0; count--)
436432      {
437433         if (ICOUNT <= 0) { I.pc = I.prevpc; break; }
438         PutMemB(ES,I.regs.w[DI],read_port(I.regs.w[DX]));
439         PutMemB(ES,I.regs.w[DI]+1,read_port(I.regs.w[DX]+1));
434         PutMemW(ES,I.regs.w[DI],read_port_word(I.regs.w[DX]));
440435         I.regs.w[DI] += 2 * I.DirVal;
441436         ICOUNT -= cycles.rep_ins16_count;
442437      }
r869r870
447442      for (; count > 0; count--)
448443      {
449444         if (ICOUNT <= 0) { I.pc = I.prevpc; break; }
450         write_port(I.regs.w[DX],GetMemB(DS,I.regs.w[SI]));
445         write_port_byte(I.regs.w[DX],GetMemB(DS,I.regs.w[SI]));
451446         I.regs.w[SI] += I.DirVal; /* GOL 11/27/01 */
452447         ICOUNT -= cycles.rep_outs8_count;
453448      }
r869r870
458453      for (; count > 0; count--)
459454      {
460455         if (ICOUNT <= 0) { I.pc = I.prevpc; break; }
461         write_port(I.regs.w[DX],GetMemB(DS,I.regs.w[SI]));
462         write_port(I.regs.w[DX]+1,GetMemB(DS,I.regs.w[SI]+1));
456         write_port_word(I.regs.w[DX],GetMemW(DS,I.regs.w[SI]));
463457         I.regs.w[SI] += 2 * I.DirVal; /* GOL 11/27/01 */
464458         ICOUNT -= cycles.rep_outs16_count;
465459      }
r869r870
608602   }
609603}
610604
611#ifndef I186
605#ifndef I80186
612606static void PREFIX86(_add_br8)(void)    /* Opcode 0x00 */
613607{
614608   DEF_br8(dst,src);
r869r870
792786
793787static void PREFIX86(_pop_ss)(void)    /* Opcode 0x17 */
794788{
795#ifdef I286
789#ifdef I80286
796790   UINT16 tmp;
797791   POP(tmp);
798   i286_data_descriptor(SS, tmp);
792   i80286_data_descriptor(SS, tmp);
799793#else
800794   POP(I.sregs[SS]);
801795   I.base[SS] = SegBase(SS);
r869r870
866860
867861static void PREFIX86(_pop_ds)(void)    /* Opcode 0x1f */
868862{
869#ifdef I286
863#ifdef I80286
870864   UINT16 tmp;
871865   POP(tmp);
872   i286_data_descriptor(DS,tmp);
866   i80286_data_descriptor(DS,tmp);
873867#else
874868   POP(I.sregs[DS]);
875869   I.base[DS] = SegBase(DS);
r869r870
18301824{
18311825   unsigned ModRM = FETCH;
18321826   ICOUNT -= (ModRM >= 0xc0) ? cycles.mov_rs : cycles.mov_ms;
1833#ifdef I286
1827#ifdef I80286
18341828   if (ModRM & 0x20) {   /* HJB 12/13/98 1xx is invalid */
1835      i286_trap2(ILLEGAL_INSTRUCTION);
1829      i80286_trap2(ILLEGAL_INSTRUCTION);
18361830      return;
18371831   }
18381832#else
r869r870
18551849    WORD src = GetRMWord(ModRM);
18561850
18571851   ICOUNT -= (ModRM >= 0xc0) ? cycles.mov_sr : cycles.mov_sm;
1858#ifdef I286
1852#ifdef I80286
18591853    switch (ModRM & 0x38)
18601854    {
18611855    case 0x00:  /* mov es,ew */
1862      i286_data_descriptor(ES,src);
1856      i80286_data_descriptor(ES,src);
18631857      break;
18641858    case 0x18:  /* mov ds,ew */
1865      i286_data_descriptor(DS,src);
1859      i80286_data_descriptor(DS,src);
18661860      break;
18671861    case 0x10:  /* mov ss,ew */
1868      i286_data_descriptor(SS,src);
1862      i80286_data_descriptor(SS,src);
18691863      PREFIX(_instruction)[FETCHOP]();
18701864      break;
18711865    case 0x08:  /* mov cs,ew */
r869r870
19811975   PUSH(I.sregs[CS]);
19821976   PUSH(ip);
19831977
1984#ifdef I286
1985   i286_code_descriptor(tmp2, tmp);
1978#ifdef I80286
1979   i80286_code_descriptor(tmp2, tmp);
19861980#else
19871981   I.sregs[CS] = (WORD)tmp2;
19881982   I.base[CS] = SegBase(CS);
r869r870
20082002   ICOUNT -= cycles.pushf;
20092003
20102004   tmp = CompressFlags();
2011#ifdef I286
2005#ifdef I80286
20122006    PUSH( tmp &= ~0xf000 );
2013#elif defined V20
2014    PUSH( tmp | 0xe000 );
20152007#else
20162008    PUSH( tmp | 0xf000 );
20172009#endif
r869r870
20282020
20292021   /* if the IF is set, and an interrupt is pending, signal an interrupt */
20302022   if (I.IF && I.irq_state)
2031#ifdef V20
2032      PREFIX(_interrupt)(-1, 0);
2033#else
20342023      PREFIX(_interrupt)(-1);
2035#endif
20362024}
20372025
20382026static void PREFIX86(_sahf)(void)    /* Opcode 0x9e */
r869r870
23232311    WORD tmp = GetRMWord(ModRM);
23242312
23252313    RegWord(ModRM)= tmp;
2326#ifdef I286
2327   i286_data_descriptor(ES,GetnextRMWord);
2314#ifdef I80286
2315   i80286_data_descriptor(ES,GetnextRMWord);
23282316#else
23292317   I.sregs[ES] = GetnextRMWord;
23302318   I.base[ES] = SegBase(ES);
r869r870
23382326    WORD tmp = GetRMWord(ModRM);
23392327
23402328    RegWord(ModRM)=tmp;
2341#ifdef I286
2342   i286_data_descriptor(DS,GetnextRMWord);
2329#ifdef I80286
2330   i80286_data_descriptor(DS,GetnextRMWord);
23432331#else
23442332   I.sregs[DS] = GetnextRMWord;
23452333   I.base[DS] = SegBase(DS);
r869r870
23662354   unsigned count = FETCH;
23672355   count += FETCH << 8;
23682356
2369#ifdef I286
2357#ifdef I80286
23702358   {
23712359      int tmp, tmp2;
23722360      POP(tmp2);
23732361      POP(tmp);
2374      i286_code_descriptor(tmp, tmp2);
2362      i80286_code_descriptor(tmp, tmp2);
23752363   }
23762364#else
23772365   POP(I.pc);
r869r870
23862374
23872375static void PREFIX86(_retf)(void)    /* Opcode 0xcb */
23882376{
2389#ifdef I286
2377#ifdef I80286
23902378   {
23912379      int tmp, tmp2;
23922380      POP(tmp2);
23932381      POP(tmp);
2394      i286_code_descriptor(tmp, tmp2);
2382      i80286_code_descriptor(tmp, tmp2);
23952383   }
23962384#else
23972385   POP(I.pc);
r869r870
24062394static void PREFIX86(_int3)(void)    /* Opcode 0xcc */
24072395{
24082396   ICOUNT -= cycles.int3;
2409#ifdef V20
2410   PREFIX(_interrupt)(3,0);
2411#else
24122397   PREFIX(_interrupt)(3);
2413#endif
24142398}
24152399
24162400static void PREFIX86(_int)(void)    /* Opcode 0xcd */
24172401{
24182402   unsigned int_num = FETCH;
24192403   ICOUNT -= cycles.int_imm;
2420#ifdef V20
2421   PREFIX(_interrupt)(int_num,0);
2422#else
24232404   PREFIX(_interrupt)(int_num);
2424#endif
24252405}
24262406
24272407static void PREFIX86(_into)(void)    /* Opcode 0xce */
24282408{
24292409   if (OF) {
24302410      ICOUNT -= cycles.into_t;
2431#ifdef V20
2432      PREFIX(_interrupt)(4,0);
2433#else
24342411      PREFIX(_interrupt)(4);
2435#endif
24362412   } else ICOUNT -= cycles.into_nt;
24372413}
24382414
24392415static void PREFIX86(_iret)(void)    /* Opcode 0xcf */
24402416{
24412417   ICOUNT -= cycles.iret;
2442#ifdef I286
2418#ifdef I80286
24432419   {
24442420      int tmp, tmp2;
24452421      POP(tmp2);
24462422      POP(tmp);
2447      i286_code_descriptor(tmp, tmp2);
2423      i80286_code_descriptor(tmp, tmp2);
24482424   }
24492425#else
24502426   POP(I.pc);
r869r870
24572433
24582434   /* if the IF is set, and an interrupt is pending, signal an interrupt */
24592435   if (I.IF && I.irq_state)
2460#ifdef V20
2461      PREFIX(_interrupt)(-1, 0);
2462#else
24632436      PREFIX(_interrupt)(-1);
2464#endif
24652437}
24662438
24672439static void PREFIX86(_rotshft_b)(void)    /* Opcode 0xd0 */
r869r870
24942466   unsigned mult = FETCH;
24952467
24962468   ICOUNT -= cycles.aam;
2497#ifndef V20
24982469   if (mult == 0)
24992470      PREFIX(_interrupt)(0);
25002471   else
r869r870
25042475
25052476      SetSZPF_Word(I.regs.w[AX]);
25062477   }
2507#else
2508
2509   if (mult == 0)
2510      PREFIX(_interrupt)(0,0);
2511    else
2512    {
2513      I.regs.b[AH] = I.regs.b[AL] / 10;
2514      I.regs.b[AL] %= 10;
2515      SetSZPF_Word(I.regs.w[AX]);
2516    }
2517#endif
25182478}
25192479
25202480static void PREFIX86(_aad)(void)    /* Opcode 0xd5 */
r869r870
25232483
25242484   ICOUNT -= cycles.aad;
25252485
2526#ifndef V20
25272486   I.regs.b[AL] = I.regs.b[AH] * mult + I.regs.b[AL];
25282487   I.regs.b[AH] = 0;
25292488
25302489   SetZF(I.regs.b[AL]);
25312490   SetPF(I.regs.b[AL]);
25322491   I.SignVal = 0;
2533#else
2534/* OB: Opcode works on NEC V-Series but not the Variants    */
2535/*     one could specify any byte value as operand but the NECs */
2536/*     always substitute 0x0a.                  */
2537   I.regs.b[AL] = I.regs.b[AH] * 10 + I.regs.b[AL];
2538   I.regs.b[AH] = 0;
2539
2540   SetZF(I.regs.b[AL]);
2541   SetPF(I.regs.b[AL]);
2542   I.SignVal = 0;
2543   mult=0;
2544#endif
25452492}
25462493
25472494
r869r870
26232570   unsigned port = FETCH;
26242571
26252572   ICOUNT -= cycles.in_imm8;
2626   I.regs.b[AL] = read_port(port);
2573   I.regs.b[AL] = read_port_byte(port);
26272574}
26282575
26292576static void PREFIX86(_inax)(void)    /* Opcode 0xe5 */
r869r870
26312578   unsigned port = FETCH;
26322579
26332580   ICOUNT -= cycles.in_imm16;
2634   I.regs.b[AL] = read_port(port);
2635   I.regs.b[AH] = read_port(port+1);
2581   I.regs.w[AX] = read_port_word(port);
26362582}
26372583
26382584static void PREFIX86(_outal)(void)    /* Opcode 0xe6 */
r869r870
26402586   unsigned port = FETCH;
26412587
26422588   ICOUNT -= cycles.out_imm8;
2643   write_port(port, I.regs.b[AL]);
2589   write_port_byte(port, I.regs.b[AL]);
26442590}
26452591
26462592static void PREFIX86(_outax)(void)    /* Opcode 0xe7 */
r869r870
26482594   unsigned port = FETCH;
26492595
26502596   ICOUNT -= cycles.out_imm16;
2651   write_port(port, I.regs.b[AL]);
2652   write_port(port+1, I.regs.b[AH]);
2597   write_port_word(port, I.regs.w[AX]);
26532598}
26542599
26552600static void PREFIX86(_call_d16)(void)    /* Opcode 0xe8 */
r869r870
26862631   tmp1 = FETCH;
26872632   tmp1 += FETCH << 8;
26882633
2689#ifdef I286
2690   i286_code_descriptor(tmp1,tmp);
2634#ifdef I80286
2635   i80286_code_descriptor(tmp1,tmp);
26912636#else
26922637   I.sregs[CS] = (WORD)tmp1;
26932638   I.base[CS] = SegBase(CS);
r869r870
27092654static void PREFIX86(_inaldx)(void)    /* Opcode 0xec */
27102655{
27112656   ICOUNT -= cycles.in_dx8;
2712   I.regs.b[AL] = read_port(I.regs.w[DX]);
2657   I.regs.b[AL] = read_port_byte(I.regs.w[DX]);
27132658}
27142659
27152660static void PREFIX86(_inaxdx)(void)    /* Opcode 0xed */
r869r870
27172662   unsigned port = I.regs.w[DX];
27182663
27192664   ICOUNT -= cycles.in_dx16;
2720   I.regs.b[AL] = read_port(port);
2721   I.regs.b[AH] = read_port(port+1);
2665   I.regs.w[AX] = read_port_word(port);
27222666}
27232667
27242668static void PREFIX86(_outdxal)(void)    /* Opcode 0xee */
27252669{
27262670   ICOUNT -= cycles.out_dx8;
2727   write_port(I.regs.w[DX], I.regs.b[AL]);
2671   write_port_byte(I.regs.w[DX], I.regs.b[AL]);
27282672}
27292673
27302674static void PREFIX86(_outdxax)(void)    /* Opcode 0xef */
r869r870
27322676   unsigned port = I.regs.w[DX];
27332677
27342678   ICOUNT -= cycles.out_dx16;
2735   write_port(port, I.regs.b[AL]);
2736   write_port(port+1, I.regs.b[AH]);
2679   write_port_word(port, I.regs.w[AX]);
27372680}
27382681
27392682/* I think thats not a V20 instruction...*/
r869r870
27542697    PREFIX(rep)(1);
27552698}
27562699
2757#ifndef I186
2700#ifndef I80186
27582701static void PREFIX86(_hlt)(void)    /* Opcode 0xf4 */
27592702{
27602703   I.pc--;
r869r870
28422785         {
28432786            if ((result / tmp) > 0xff)
28442787            {
2845#ifdef V20
2846               PREFIX(_interrupt)(0,0);
2847#else
28482788               PREFIX(_interrupt)(0);
2849#endif
28502789               break;
28512790            }
28522791            else
r869r870
28572796         }
28582797         else
28592798         {
2860#ifdef V20
2861            PREFIX(_interrupt)(0,0);
2862#else
28632799            PREFIX(_interrupt)(0);
2864#endif
28652800            break;
28662801         }
28672802      }
r869r870
28802815
28812816            if ((result /= (INT16)((INT8)tmp)) > 0xff)
28822817            {
2883#ifdef V20
2884               PREFIX(_interrupt)(0,0);
2885#else
28862818               PREFIX(_interrupt)(0);
2887#endif
28882819               break;
28892820            }
28902821            else
r869r870
28952826         }
28962827         else
28972828         {
2898#ifdef V20
2899            PREFIX(_interrupt)(0,0);
2900#else
29012829            PREFIX(_interrupt)(0);
2902#endif
29032830            break;
29042831         }
29052832      }
r869r870
29932920            tmp2 = result % tmp;
29942921            if ((result / tmp) > 0xffff)
29952922            {
2996#ifdef V20
2997               PREFIX(_interrupt)(0,0);
2998#else
29992923               PREFIX(_interrupt)(0);
3000#endif
30012924               break;
30022925            }
30032926            else
r869r870
30092932         }
30102933         else
30112934         {
3012#ifdef V20
3013            PREFIX(_interrupt)(0,0);
3014#else
30152935            PREFIX(_interrupt)(0);
3016#endif
30172936            break;
30182937         }
30192938      }
r869r870
30302949            tmp2 = result % (INT32)((INT16)tmp);
30312950            if ((result /= (INT32)((INT16)tmp)) > 0xffff)
30322951            {
3033#ifdef V20
3034               PREFIX(_interrupt)(0,0);
3035#else
30362952               PREFIX(_interrupt)(0);
3037#endif
30382953               break;
30392954            }
30402955            else
r869r870
30452960         }
30462961         else
30472962         {
3048#ifdef V20
3049            PREFIX(_interrupt)(0,0);
3050#else
30512963            PREFIX(_interrupt)(0);
3052#endif
30532964            break;
30542965         }
30552966      }
r869r870
30842995
30852996   /* if an interrupt is pending, signal an interrupt */
30862997   if (I.irq_state)
3087#ifdef V20
3088      PREFIX(_interrupt)(-1, 0);
3089#else
30902998      PREFIX(_interrupt)(-1);
3091#endif
30922999}
30933000
30943001static void PREFIX86(_cld)(void)    /* Opcode 0xfc */
r869r870
31773084      ip = I.pc - I.base[CS];
31783085      PUSH(tmp);
31793086      PUSH(ip);
3180#ifdef I286
3181      i286_code_descriptor(GetnextRMWord, tmp1);
3087#ifdef I80286
3088      i80286_code_descriptor(GetnextRMWord, tmp1);
31823089#else
31833090      I.sregs[CS] = GetnextRMWord;
31843091      I.base[CS] = SegBase(CS);
r869r870
31973104    case 0x28:  /* JMP FAR ea */
31983105      ICOUNT -= cycles.jmp_m32;
31993106
3200#ifdef I286
3107#ifdef I80286
32013108      tmp = GetRMWord(ModRM);
3202      i286_code_descriptor(GetnextRMWord, tmp);
3109      i80286_code_descriptor(GetnextRMWord, tmp);
32033110#else
32043111      I.pc = GetRMWord(ModRM);
32053112      I.sregs[CS] = GetnextRMWord;
r869r870
32203127
32213128static void PREFIX86(_invalid)(void)
32223129{
3223#ifdef I286
3224   i286_trap2(ILLEGAL_INSTRUCTION);
3130#ifdef I80286
3131   i80286_trap2(ILLEGAL_INSTRUCTION);
32253132#else
32263133    /* makes the cpu loops forever until user resets it */
32273134   /*{ DEBUGGER_BREAK; } */
src/emu/cpu/i86/i86time.c
r869r870
33*               (initial work based on David Hedley's pcemu)                *
44****************************************************************************/
55
6struct i86_timing
6struct i80x86_timing
77{
88   int      id;
99
r869r870
8484
8585/* these come from the 8088 timings in OPCODE.LST, but with the
8686   penalty for 16-bit memory accesses removed wherever possible */
87static const struct i86_timing i86_cycles =
87static const struct i80x86_timing i8086_cycles =
8888{
8989   8086,
9090
r869r870
152152
153153
154154/* these come from the Intel 80186 datasheet */
155static const struct i86_timing i186_cycles =
155static const struct i80x86_timing i80186_cycles =
156156{
157157   80186,
158158
r869r870
233233
234234/* these come from the 80286 timings in OPCODE.LST */
235235/* many of these numbers are suspect */
236static const struct i86_timing i286_cycles =
236static const struct i80x86_timing i80286_cycles =
237237{
238238   80286,
239239
src/emu/cpu/i86/i286.c
r869r870
1111#define AMASK   I.amask
1212
1313
14#define i86_ICount i286_ICount
14#define i8086_ICount i80286_ICount
1515
1616#include "i286.h"
1717#include "i286intf.h"
1818
1919
2020#include "i86time.c"
21#include "i86mem.h"
2122
2223/***************************************************************************/
2324/* cpu state                                                               */
r869r870
2728{                   /* eight general registers */
2829    UINT16 w[8];    /* viewed as 16 bits registers */
2930    UINT8  b[16];   /* or as 8 bit registers */
30} i286basicregs;
31} i80286basicregs;
3132
3233typedef struct
3334{
34    i286basicregs regs;
35    i80286basicregs regs;
3536   UINT32    amask;         /* address mask */
3637    UINT32  pc;
3738    UINT32  prevpc;
r869r870
6061   INT8   irq_state;
6162   INT8   test_state;      /* PJB 03/05 */
6263   INT32    extra_cycles;       /* extra cycles for interrupts */
63} i286_Regs;
6464
65int i286_ICount;
65   memory_interface   mem;
66} i80286_Regs;
6667
67static i286_Regs I;
68int i80286_ICount;
69
70static i80286_Regs I;
6871static unsigned prefix_base;   /* base address of the latest prefix segment */
6972static char seg_prefix;         /* prefix segment indicator */
7073
r869r870
7376
7477static UINT8 parity_table[256];
7578
76static struct i86_timing cycles;
79static struct i80x86_timing cycles;
7780
7881/***************************************************************************/
7982
80#define I286
81#define PREFIX(fname) i286##fname
82#define PREFIX86(fname) i286##fname
83#define PREFIX186(fname) i286##fname
84#define PREFIX286(fname) i286##fname
83#define I80286
84#define PREFIX(fname) i80286##fname
85#define PREFIX86(fname) i80286##fname
86#define PREFIX186(fname) i80286##fname
87#define PREFIX286(fname) i80286##fname
8588
8689#include "ea.h"
8790#include "modrm.h"
r869r870
9295#include "instr86.c"
9396#include "instr186.c"
9497#include "instr286.c"
98#include "i86mem.c"
9599
96static void i286_urinit(void)
100static void i80286_urinit(void)
97101{
98102   unsigned int i,j,c;
99103   static const BREGS reg_name[8]={ AL, CL, DL, BL, AH, CH, DH, BH };
r869r870
119123   }
120124}
121125
122static void i286_set_a20_line(int state)
126static void i80286_set_a20_line(int state)
123127{
124128   I.amask = state ? 0x00ffffff : 0x000fffff;
125129}
126130
127static void i286_reset (void)
131static void i80286_reset (void)
128132{
129133   static int urinit=1;
130134
131135   /* in my docu not all registers are initialized! */
132136   if (urinit) {
133      i286_urinit();
137      i80286_urinit();
134138      urinit=0;
135139
136140   }
r869r870
156160
157161/* ASG 971222 -- added these interface functions */
158162
159static void i286_get_context(void *dst)
163static void i80286_get_context(void *dst)
160164{
161165   if( dst )
162      *(i286_Regs*)dst = I;
166      *(i80286_Regs*)dst = I;
163167}
164168
165static void i286_set_context(void *src)
169static void i80286_set_context(void *src)
166170{
167171   if( src )
168172   {
169      I = *(i286_Regs*)src;
173      I = *(i80286_Regs*)src;
170174      if (PM) {
171175
172176      } else {
r869r870
189193
190194      /* on a rising edge, signal the NMI */
191195      if (state != CLEAR_LINE)
192         PREFIX(_interrupt)(I86_NMI_INT_VECTOR);
196         PREFIX(_interrupt)(I8086_NMI_INT_VECTOR);
193197   }
194198   else
195199   {
r869r870
201205   }
202206}
203207
204static int i286_execute(int num_cycles)
208static int i80286_execute(int num_cycles)
205209{
206210   /* copy over the cycle counts if they're not correct */
207211   if (cycles.id != 80286)
208      cycles = i286_cycles;
212      cycles = i80286_cycles;
209213
210214   /* adjust for any interrupts that came in */
211   i286_ICount = num_cycles;
212   i286_ICount -= I.extra_cycles;
215   i80286_ICount = num_cycles;
216   i80286_ICount -= I.extra_cycles;
213217   I.extra_cycles = 0;
214218
215219   /* run until we're out */
216   while(i286_ICount>0)
220   while(i80286_ICount>0)
217221   {
218222
219223//#define VERBOSE_DEBUG
r869r870
230234    }
231235
232236   /* adjust for any interrupts that came in */
233   i286_ICount -= I.extra_cycles;
237   i80286_ICount -= I.extra_cycles;
234238   I.extra_cycles = 0;
235239
236   return num_cycles - i286_ICount;
240   return num_cycles - i80286_ICount;
237241}
238242
239243extern int i386_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, int mode);
240244
241245#ifdef MAME_DEBUG
242static offs_t i286_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
246static offs_t i80286_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
243247{
244248   return i386_dasm_one(buffer, pc, oprom, 16);
245249}
246250#endif /* MAME_DEBUG */
247251
248static void i286_init(int index, int clock, const void *config, int (*irqcallback)(int))
252static void i80286_init(int index, int clock, const void *config, int (*irqcallback)(int))
249253{
250   static const char type[] = "I286";
254   static const char type[] = "80286";
251255   state_save_register_item_array(type, index, I.regs.w);
252256   state_save_register_item(type, index, I.amask);
253257   state_save_register_item(type, index, I.pc);
r869r870
290294      I.amask = *(unsigned*)config;
291295   else
292296      I.amask = 0x00ffff;
297
298   configure_memory_16bit();
293299}
294300
295301
r869r870
300306 * Generic set_info
301307 **************************************************************************/
302308
303static void i286_set_info(UINT32 state, cpuinfo *info)
309static void i80286_set_info(UINT32 state, cpuinfo *info)
304310{
305311   switch (state)
306312   {
r869r870
308314      case CPUINFO_INT_INPUT_STATE + 0:            set_irq_line(0, info->i);            break;
309315      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   set_irq_line(INPUT_LINE_NMI, info->i);   break;
310316
311      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_A20:   i286_set_a20_line(info->i);            break;
317      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_A20:   i80286_set_a20_line(info->i);         break;
312318
313319      case CPUINFO_INT_PC:
314      case CPUINFO_INT_REGISTER + I286_PC:
320      case CPUINFO_INT_REGISTER + I80286_PC:
315321         if (PM)
316322         {
317323            /* protected mode NYI */
r869r870
327333         }
328334         break;
329335
330      case CPUINFO_INT_REGISTER + I286_IP:         I.pc = I.base[CS] + info->i;         break;
336      case CPUINFO_INT_REGISTER + I80286_IP:         I.pc = I.base[CS] + info->i;         break;
331337      case CPUINFO_INT_SP:
332338         if (PM)
333339         {
r869r870
348354         }
349355         break;
350356
351      case CPUINFO_INT_REGISTER + I286_SP:         I.regs.w[SP] = info->i;             break;
352      case CPUINFO_INT_REGISTER + I286_FLAGS:       I.flags = info->i;   ExpandFlags(info->i); break;
353      case CPUINFO_INT_REGISTER + I286_AX:         I.regs.w[AX] = info->i;             break;
354      case CPUINFO_INT_REGISTER + I286_CX:         I.regs.w[CX] = info->i;             break;
355      case CPUINFO_INT_REGISTER + I286_DX:         I.regs.w[DX] = info->i;             break;
356      case CPUINFO_INT_REGISTER + I286_BX:         I.regs.w[BX] = info->i;             break;
357      case CPUINFO_INT_REGISTER + I286_BP:         I.regs.w[BP] = info->i;             break;
358      case CPUINFO_INT_REGISTER + I286_SI:         I.regs.w[SI] = info->i;             break;
359      case CPUINFO_INT_REGISTER + I286_DI:         I.regs.w[DI] = info->i;             break;
360      case CPUINFO_INT_REGISTER + I286_ES:         I.sregs[ES] = info->i;   I.base[ES] = SegBase(ES); break;
361      case CPUINFO_INT_REGISTER + I286_CS:         I.sregs[CS] = info->i;   I.base[CS] = SegBase(CS); break;
362      case CPUINFO_INT_REGISTER + I286_SS:         I.sregs[SS] = info->i;   I.base[SS] = SegBase(SS); break;
363      case CPUINFO_INT_REGISTER + I286_DS:         I.sregs[DS] = info->i;   I.base[DS] = SegBase(DS); break;
364      case CPUINFO_INT_REGISTER + I286_VECTOR:      I.int_vector = info->i;             break;
357      case CPUINFO_INT_REGISTER + I80286_SP:         I.regs.w[SP] = info->i;             break;
358      case CPUINFO_INT_REGISTER + I80286_FLAGS:       I.flags = info->i;   ExpandFlags(info->i); break;
359      case CPUINFO_INT_REGISTER + I80286_AX:         I.regs.w[AX] = info->i;             break;
360      case CPUINFO_INT_REGISTER + I80286_CX:         I.regs.w[CX] = info->i;             break;
361      case CPUINFO_INT_REGISTER + I80286_DX:         I.regs.w[DX] = info->i;             break;
362      case CPUINFO_INT_REGISTER + I80286_BX:         I.regs.w[BX] = info->i;             break;
363      case CPUINFO_INT_REGISTER + I80286_BP:         I.regs.w[BP] = info->i;             break;
364      case CPUINFO_INT_REGISTER + I80286_SI:         I.regs.w[SI] = info->i;             break;
365      case CPUINFO_INT_REGISTER + I80286_DI:         I.regs.w[DI] = info->i;             break;
366      case CPUINFO_INT_REGISTER + I80286_ES:         I.sregs[ES] = info->i;   I.base[ES] = SegBase(ES); break;
367      case CPUINFO_INT_REGISTER + I80286_CS:         I.sregs[CS] = info->i;   I.base[CS] = SegBase(CS); break;
368      case CPUINFO_INT_REGISTER + I80286_SS:         I.sregs[SS] = info->i;   I.base[SS] = SegBase(SS); break;
369      case CPUINFO_INT_REGISTER + I80286_DS:         I.sregs[DS] = info->i;   I.base[DS] = SegBase(DS); break;
370      case CPUINFO_INT_REGISTER + I80286_VECTOR:      I.int_vector = info->i;             break;
365371   }
366372}
367373
r869r870
371377 * Generic get_info
372378 ****************************************************************************/
373379
374void i286_get_info(UINT32 state, cpuinfo *info)
380void i80286_get_info(UINT32 state, cpuinfo *info)
375381{
376382   switch (state)
377383   {
r869r870
402408      case CPUINFO_INT_PREVIOUSPC:               info->i = I.prevpc;                  break;
403409
404410      case CPUINFO_INT_PC:
405      case CPUINFO_INT_REGISTER + I286_PC:         info->i = I.pc;                     break;
406      case CPUINFO_INT_REGISTER + I286_IP:         info->i = I.pc - I.base[CS];         break;
411      case CPUINFO_INT_REGISTER + I80286_PC:         info->i = I.pc;                     break;
412      case CPUINFO_INT_REGISTER + I80286_IP:         info->i = I.pc - I.base[CS];         break;
407413      case CPUINFO_INT_SP:                     info->i = I.base[SS] + I.regs.w[SP];   break;
408      case CPUINFO_INT_REGISTER + I286_SP:         info->i = I.regs.w[SP];               break;
409      case CPUINFO_INT_REGISTER + I286_FLAGS:       I.flags = CompressFlags(); info->i = I.flags; break;
410      case CPUINFO_INT_REGISTER + I286_AX:         info->i = I.regs.w[AX];               break;
411      case CPUINFO_INT_REGISTER + I286_CX:         info->i = I.regs.w[CX];               break;
412      case CPUINFO_INT_REGISTER + I286_DX:         info->i = I.regs.w[DX];               break;
413      case CPUINFO_INT_REGISTER + I286_BX:         info->i = I.regs.w[BX];               break;
414      case CPUINFO_INT_REGISTER + I286_BP:         info->i = I.regs.w[BP];               break;
415      case CPUINFO_INT_REGISTER + I286_SI:         info->i = I.regs.w[SI];               break;
416      case CPUINFO_INT_REGISTER + I286_DI:         info->i = I.regs.w[DI];               break;
417      case CPUINFO_INT_REGISTER + I286_ES:         info->i = I.sregs[ES];               break;
418      case CPUINFO_INT_REGISTER + I286_CS:         info->i = I.sregs[CS];               break;
419      case CPUINFO_INT_REGISTER + I286_SS:         info->i = I.sregs[SS];               break;
420      case CPUINFO_INT_REGISTER + I286_DS:         info->i = I.sregs[DS];               break;
421      case CPUINFO_INT_REGISTER + I286_VECTOR:      info->i = I.int_vector;               break;
422      case CPUINFO_INT_REGISTER + I286_MSW:         info->i = I.msw;                  break;
423      case CPUINFO_INT_REGISTER + I286_GDTR:         info->i = I.gdtr.base;               break;
424      case CPUINFO_INT_REGISTER + I286_GDTR_2:      info->i = I.gdtr.limit;               break;
425      case CPUINFO_INT_REGISTER + I286_IDTR:         info->i = I.idtr.base;               break;
426      case CPUINFO_INT_REGISTER + I286_IDTR_2:      info->i = I.idtr.limit;               break;
427      case CPUINFO_INT_REGISTER + I286_LDTR:         info->i = I.ldtr.base;               break;
428      case CPUINFO_INT_REGISTER + I286_LDTR_2:      info->i = I.ldtr.limit;               break;
429      case CPUINFO_INT_REGISTER + I286_TR:         info->i = I.tr.base;               break;
430      case CPUINFO_INT_REGISTER + I286_TR_2:         info->i = I.tr.limit;               break;
414      case CPUINFO_INT_REGISTER + I80286_SP:         info->i = I.regs.w[SP];               break;
415      case CPUINFO_INT_REGISTER + I80286_FLAGS:       I.flags = CompressFlags(); info->i = I.flags; break;
416      case CPUINFO_INT_REGISTER + I80286_AX:         info->i = I.regs.w[AX];               break;
417      case CPUINFO_INT_REGISTER + I80286_CX:         info->i = I.regs.w[CX];               break;
418      case CPUINFO_INT_REGISTER + I80286_DX:         info->i = I.regs.w[DX];               break;
419      case CPUINFO_INT_REGISTER + I80286_BX:         info->i = I.regs.w[BX];               break;
420      case CPUINFO_INT_REGISTER + I80286_BP:         info->i = I.regs.w[BP];               break;
421      case CPUINFO_INT_REGISTER + I80286_SI:         info->i = I.regs.w[SI];               break;
422      case CPUINFO_INT_REGISTER + I80286_DI:         info->i = I.regs.w[DI];               break;
423      case CPUINFO_INT_REGISTER + I80286_ES:         info->i = I.sregs[ES];               break;
424      case CPUINFO_INT_REGISTER + I80286_CS:         info->i = I.sregs[CS];               break;
425      case CPUINFO_INT_REGISTER + I80286_SS:         info->i = I.sregs[SS];               break;
426      case CPUINFO_INT_REGISTER + I80286_DS:         info->i = I.sregs[DS];               break;
427      case CPUINFO_INT_REGISTER + I80286_VECTOR:      info->i = I.int_vector;               break;
428      case CPUINFO_INT_REGISTER + I80286_MSW:         info->i = I.msw;                  break;
429      case CPUINFO_INT_REGISTER + I80286_GDTR_BASE:   info->i = I.gdtr.base;               break;
430      case CPUINFO_INT_REGISTER + I80286_GDTR_LIMIT:   info->i = I.gdtr.limit;               break;
431      case CPUINFO_INT_REGISTER + I80286_IDTR_BASE:   info->i = I.idtr.base;               break;
432      case CPUINFO_INT_REGISTER + I80286_IDTR_LIMIT:   info->i = I.idtr.limit;               break;
433      case CPUINFO_INT_REGISTER + I80286_LDTR_BASE:   info->i = I.ldtr.base;               break;
434      case CPUINFO_INT_REGISTER + I80286_LDTR_LIMIT:   info->i = I.ldtr.limit;               break;
435      case CPUINFO_INT_REGISTER + I80286_TR_BASE:      info->i = I.tr.base;               break;
436      case CPUINFO_INT_REGISTER + I80286_TR_LIMIT:   info->i = I.tr.limit;               break;
431437
432438      /* --- the following bits of info are returned as pointers to data or functions --- */
433      case CPUINFO_PTR_SET_INFO:                  info->setinfo = i286_set_info;         break;
434      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = i286_get_context;   break;
435      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = i286_set_context;   break;
436      case CPUINFO_PTR_INIT:                     info->init = i286_init;               break;
437      case CPUINFO_PTR_RESET:                     info->reset = i286_reset;            break;
439      case CPUINFO_PTR_SET_INFO:                  info->setinfo = i80286_set_info;      break;
440      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = i80286_get_context;   break;
441      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = i80286_set_context;   break;
442      case CPUINFO_PTR_INIT:                     info->init = i80286_init;            break;
443      case CPUINFO_PTR_RESET:                     info->reset = i80286_reset;            break;
438444      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                  break;
439      case CPUINFO_PTR_EXECUTE:                  info->execute = i286_execute;         break;
445      case CPUINFO_PTR_EXECUTE:                  info->execute = i80286_execute;         break;
440446      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
441447#ifdef MAME_DEBUG
442      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = i286_dasm;         break;
448      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = i80286_dasm;      break;
443449#endif /* MAME_DEBUG */
444      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &i286_ICount;         break;
450      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &i80286_ICount;         break;
445451
446452      /* --- the following bits of info are returned as NULL-terminated strings --- */
447      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80286");            break;
453      case CPUINFO_STR_NAME:                     strcpy(info->s, "80286");            break;
448454      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Intel 80286");         break;
449455      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.4");               break;
450456      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
r869r870
471477               I.flags & 0x0001 ? 'C' : '.');
472478         break;
473479
474      case CPUINFO_STR_REGISTER + I286_PC:          sprintf(info->s, "PC:%04X", I.pc); break;
475      case CPUINFO_STR_REGISTER + I286_IP:          sprintf(info->s, "IP: %04X", I.pc - I.base[CS]); break;
476      case CPUINFO_STR_REGISTER + I286_SP:          sprintf(info->s, "SP: %04X", I.regs.w[SP]); break;
477      case CPUINFO_STR_REGISTER + I286_FLAGS:         sprintf(info->s, "F:%04X", I.flags); break;
478      case CPUINFO_STR_REGISTER + I286_AX:          sprintf(info->s, "AX:%04X", I.regs.w[AX]); break;
479      case CPUINFO_STR_REGISTER + I286_CX:          sprintf(info->s, "CX:%04X", I.regs.w[CX]); break;
480      case CPUINFO_STR_REGISTER + I286_DX:          sprintf(info->s, "DX:%04X", I.regs.w[DX]); break;
481      case CPUINFO_STR_REGISTER + I286_BX:          sprintf(info->s, "BX:%04X", I.regs.w[BX]); break;
482      case CPUINFO_STR_REGISTER + I286_BP:          sprintf(info->s, "BP:%04X", I.regs.w[BP]); break;
483      case CPUINFO_STR_REGISTER + I286_SI:          sprintf(info->s, "SI: %04X", I.regs.w[SI]); break;
484      case CPUINFO_STR_REGISTER + I286_DI:          sprintf(info->s, "DI: %04X", I.regs.w[DI]); break;
485      case CPUINFO_STR_REGISTER + I286_CS:          sprintf(info->s, "CS:  %04X %02X", I.sregs[CS], I.rights[CS]); break;
486      case CPUINFO_STR_REGISTER + I286_CS_2:          sprintf(info->s, "%06X %04X", I.base[CS], I.limit[CS]); break;
487      case CPUINFO_STR_REGISTER + I286_SS:          sprintf(info->s, "SS:  %04X %02X", I.sregs[SS], I.rights[SS]); break;
488      case CPUINFO_STR_REGISTER + I286_SS_2:          sprintf(info->s, "%06X %04X", I.base[SS], I.limit[SS]); break;
489      case CPUINFO_STR_REGISTER + I286_DS:          sprintf(info->s, "DS:  %04X %02X", I.sregs[DS], I.rights[DS]); break;
490      case CPUINFO_STR_REGISTER + I286_DS_2:          sprintf(info->s, "%06X %04X", I.base[DS], I.limit[DS]); break;
491      case CPUINFO_STR_REGISTER + I286_ES:          sprintf(info->s, "ES:  %04X %02X", I.sregs[ES], I.rights[ES]); break;
492      case CPUINFO_STR_REGISTER + I286_ES_2:          sprintf(info->s, "%06X %04X", I.base[ES], I.limit[ES]); break;
493      case CPUINFO_STR_REGISTER + I286_VECTOR:      sprintf(info->s, "V:%02X", I.int_vector); break;
494      case CPUINFO_STR_REGISTER + I286_MSW:         sprintf(info->s, "MSW:%04X", I.msw); break;
495      case CPUINFO_STR_REGISTER + I286_TR:         sprintf(info->s, "GDTR: %06X", I.gdtr.base); break;
496      case CPUINFO_STR_REGISTER + I286_TR_2:         sprintf(info->s, "%04X", I.gdtr.limit); break;
497      case CPUINFO_STR_REGISTER + I286_GDTR:         sprintf(info->s, "IDTR: %06X", I.idtr.base); break;
498      case CPUINFO_STR_REGISTER + I286_GDTR_2:      sprintf(info->s, "%04X", I.idtr.limit); break;
499      case CPUINFO_STR_REGISTER + I286_LDTR:         sprintf(info->s, "LDTR:%04X %02X", I.ldtr.sel, I.ldtr.rights); break;
500      case CPUINFO_STR_REGISTER + I286_LDTR_2:      sprintf(info->s, "%06X %04X", I.ldtr.base, I.ldtr.limit); break;
501      case CPUINFO_STR_REGISTER + I286_IDTR:         sprintf(info->s, "IDTR: %06X", I.idtr.base); break;
502      case CPUINFO_STR_REGISTER + I286_IDTR_2:      sprintf(info->s, "%04X", I.idtr.limit); break;
503      case CPUINFO_STR_REGISTER + I286_EMPTY:         sprintf(info->s, " "); break;
480      case CPUINFO_STR_REGISTER + I80286_PC:          sprintf(info->s, "PC:%04X", I.pc); break;
481      case CPUINFO_STR_REGISTER + I80286_IP:          sprintf(info->s, "IP: %04X", I.pc - I.base[CS]); break;
482      case CPUINFO_STR_REGISTER + I80286_SP:          sprintf(info->s, "SP: %04X", I.regs.w[SP]); break;
483      case CPUINFO_STR_REGISTER + I80286_FLAGS:      sprintf(info->s, "F:%04X", I.flags); break;
484      case CPUINFO_STR_REGISTER + I80286_AX:          sprintf(info->s, "AX:%04X", I.regs.w[AX]); break;
485      case CPUINFO_STR_REGISTER + I80286_CX:          sprintf(info->s, "CX:%04X", I.regs.w[CX]); break;
486      case CPUINFO_STR_REGISTER + I80286_DX:          sprintf(info->s, "DX:%04X", I.regs.w[DX]); break;
487      case CPUINFO_STR_REGISTER + I80286_BX:          sprintf(info->s, "BX:%04X", I.regs.w[BX]); break;
488      case CPUINFO_STR_REGISTER + I80286_BP:          sprintf(info->s, "BP:%04X", I.regs.w[BP]); break;
489      case CPUINFO_STR_REGISTER + I80286_SI:          sprintf(info->s, "SI: %04X", I.regs.w[SI]); break;
490      case CPUINFO_STR_REGISTER + I80286_DI:          sprintf(info->s, "DI: %04X", I.regs.w[DI]); break;
491      case CPUINFO_STR_REGISTER + I80286_CS:          sprintf(info->s, "CS:  %04X %02X", I.sregs[CS], I.rights[CS]); break;
492      case CPUINFO_STR_REGISTER + I80286_CS_2:       sprintf(info->s, "%06X %04X", I.base[CS], I.limit[CS]); break;
493      case CPUINFO_STR_REGISTER + I80286_SS:          sprintf(info->s, "SS:  %04X %02X", I.sregs[SS], I.rights[SS]); break;
494      case CPUINFO_STR_REGISTER + I80286_SS_2:       sprintf(info->s, "%06X %04X", I.base[SS], I.limit[SS]); break;
495      case CPUINFO_STR_REGISTER + I80286_DS:          sprintf(info->s, "DS:  %04X %02X", I.sregs[DS], I.rights[DS]); break;
496      case CPUINFO_STR_REGISTER + I80286_DS_2:       sprintf(info->s, "%06X %04X", I.base[DS], I.limit[DS]); break;
497      case CPUINFO_STR_REGISTER + I80286_ES:          sprintf(info->s, "ES:  %04X %02X", I.sregs[ES], I.rights[ES]); break;
498      case CPUINFO_STR_REGISTER + I80286_ES_2:       sprintf(info->s, "%06X %04X", I.base[ES], I.limit[ES]); break;
499      case CPUINFO_STR_REGISTER + I80286_VECTOR:      sprintf(info->s, "V:%02X", I.int_vector); break;
500      case CPUINFO_STR_REGISTER + I80286_MSW:         sprintf(info->s, "MSW:%04X", I.msw); break;
501      case CPUINFO_STR_REGISTER + I80286_TR_BASE:      sprintf(info->s, "GDTR: %06X", I.gdtr.base); break;
502      case CPUINFO_STR_REGISTER + I80286_TR_LIMIT:   sprintf(info->s, "%04X", I.gdtr.limit); break;
503      case CPUINFO_STR_REGISTER + I80286_GDTR_BASE:   sprintf(info->s, "IDTR: %06X", I.idtr.base); break;
504      case CPUINFO_STR_REGISTER + I80286_GDTR_LIMIT:   sprintf(info->s, "%04X", I.idtr.limit); break;
505      case CPUINFO_STR_REGISTER + I80286_LDTR_BASE:   sprintf(info->s, "LDTR:%04X %02X", I.ldtr.sel, I.ldtr.rights); break;
506      case CPUINFO_STR_REGISTER + I80286_LDTR_LIMIT:   sprintf(info->s, "%06X %04X", I.ldtr.base, I.ldtr.limit); break;
507      case CPUINFO_STR_REGISTER + I80286_IDTR_BASE:   sprintf(info->s, "IDTR: %06X", I.idtr.base); break;
508      case CPUINFO_STR_REGISTER + I80286_IDTR_LIMIT:   sprintf(info->s, "%04X", I.idtr.limit); break;
504509   }
505510}
src/emu/cpu/i86/ea.h
r869r870
11static unsigned EA;
22static UINT16 EO; /* HJB 12/13/98 effective offset of the address (before segment is added) */
33
4static unsigned EA_000(void) { i86_ICount-=7; EO=(WORD)(I.regs.w[BX]+I.regs.w[SI]); EA=DefaultBase(DS)+EO; return EA; }
5static unsigned EA_001(void) { i86_ICount-=8; EO=(WORD)(I.regs.w[BX]+I.regs.w[DI]); EA=DefaultBase(DS)+EO; return EA; }
6static unsigned EA_002(void) { i86_ICount-=8; EO=(WORD)(I.regs.w[BP]+I.regs.w[SI]); EA=DefaultBase(SS)+EO; return EA; }
7static unsigned EA_003(void) { i86_ICount-=7; EO=(WORD)(I.regs.w[BP]+I.regs.w[DI]); EA=DefaultBase(SS)+EO; return EA; }
8static unsigned EA_004(void) { i86_ICount-=5; EO=I.regs.w[SI]; EA=DefaultBase(DS)+EO; return EA; }
9static unsigned EA_005(void) { i86_ICount-=5; EO=I.regs.w[DI]; EA=DefaultBase(DS)+EO; return EA; }
10static unsigned EA_006(void) { i86_ICount-=6; EO=FETCHOP; EO+=FETCHOP<<8; EA=DefaultBase(DS)+EO; return EA; }
11static unsigned EA_007(void) { i86_ICount-=5; EO=I.regs.w[BX]; EA=DefaultBase(DS)+EO; return EA; }
4static unsigned EA_000(void) { i8086_ICount-=7; EO=(WORD)(I.regs.w[BX]+I.regs.w[SI]); EA=DefaultBase(DS)+EO; return EA; }
5static unsigned EA_001(void) { i8086_ICount-=8; EO=(WORD)(I.regs.w[BX]+I.regs.w[DI]); EA=DefaultBase(DS)+EO; return EA; }
6static unsigned EA_002(void) { i8086_ICount-=8; EO=(WORD)(I.regs.w[BP]+I.regs.w[SI]); EA=DefaultBase(SS)+EO; return EA; }
7static unsigned EA_003(void) { i8086_ICount-=7; EO=(WORD)(I.regs.w[BP]+I.regs.w[DI]); EA=DefaultBase(SS)+EO; return EA; }
8static unsigned EA_004(void) { i8086_ICount-=5; EO=I.regs.w[SI]; EA=DefaultBase(DS)+EO; return EA; }
9static unsigned EA_005(void) { i8086_ICount-=5; EO=I.regs.w[DI]; EA=DefaultBase(DS)+EO; return EA; }
10static unsigned EA_006(void) { i8086_ICount-=6; EO=FETCHOP; EO+=FETCHOP<<8; EA=DefaultBase(DS)+EO; return EA; }
11static unsigned EA_007(void) { i8086_ICount-=5; EO=I.regs.w[BX]; EA=DefaultBase(DS)+EO; return EA; }
1212
13static unsigned EA_100(void) { i86_ICount-=11; EO=(WORD)(I.regs.w[BX]+I.regs.w[SI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
14static unsigned EA_101(void) { i86_ICount-=12; EO=(WORD)(I.regs.w[BX]+I.regs.w[DI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
15static unsigned EA_102(void) { i86_ICount-=12; EO=(WORD)(I.regs.w[BP]+I.regs.w[SI]+(INT8)FETCHOP); EA=DefaultBase(SS)+EO; return EA; }
16static unsigned EA_103(void) { i86_ICount-=11; EO=(WORD)(I.regs.w[BP]+I.regs.w[DI]+(INT8)FETCHOP); EA=DefaultBase(SS)+EO; return EA; }
17static unsigned EA_104(void) { i86_ICount-=9; EO=(WORD)(I.regs.w[SI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
18static unsigned EA_105(void) { i86_ICount-=9; EO=(WORD)(I.regs.w[DI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
19static unsigned EA_106(void) { i86_ICount-=9; EO=(WORD)(I.regs.w[BP]+(INT8)FETCHOP); EA=DefaultBase(SS)+EO; return EA; }
20static unsigned EA_107(void) { i86_ICount-=9; EO=(WORD)(I.regs.w[BX]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
13static unsigned EA_100(void) { i8086_ICount-=11; EO=(WORD)(I.regs.w[BX]+I.regs.w[SI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
14static unsigned EA_101(void) { i8086_ICount-=12; EO=(WORD)(I.regs.w[BX]+I.regs.w[DI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
15static unsigned EA_102(void) { i8086_ICount-=12; EO=(WORD)(I.regs.w[BP]+I.regs.w[SI]+(INT8)FETCHOP); EA=DefaultBase(SS)+EO; return EA; }
16static unsigned EA_103(void) { i8086_ICount-=11; EO=(WORD)(I.regs.w[BP]+I.regs.w[DI]+(INT8)FETCHOP); EA=DefaultBase(SS)+EO; return EA; }
17static unsigned EA_104(void) { i8086_ICount-=9; EO=(WORD)(I.regs.w[SI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
18static unsigned EA_105(void) { i8086_ICount-=9; EO=(WORD)(I.regs.w[DI]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
19static unsigned EA_106(void) { i8086_ICount-=9; EO=(WORD)(I.regs.w[BP]+(INT8)FETCHOP); EA=DefaultBase(SS)+EO; return EA; }
20static unsigned EA_107(void) { i8086_ICount-=9; EO=(WORD)(I.regs.w[BX]+(INT8)FETCHOP); EA=DefaultBase(DS)+EO; return EA; }
2121
22static unsigned EA_200(void) { i86_ICount-=11; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BX]+I.regs.w[SI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
23static unsigned EA_201(void) { i86_ICount-=12; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BX]+I.regs.w[DI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
24static unsigned EA_202(void) { i86_ICount-=12; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BP]+I.regs.w[SI]; EA=DefaultBase(SS)+(WORD)EO; return EA; }
25static unsigned EA_203(void) { i86_ICount-=11; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BP]+I.regs.w[DI]; EA=DefaultBase(SS)+(WORD)EO; return EA; }
26static unsigned EA_204(void) { i86_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[SI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
27static unsigned EA_205(void) { i86_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[DI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
28static unsigned EA_206(void) { i86_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BP]; EA=DefaultBase(SS)+(WORD)EO; return EA; }
29static unsigned EA_207(void) { i86_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BX]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
22static unsigned EA_200(void) { i8086_ICount-=11; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BX]+I.regs.w[SI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
23static unsigned EA_201(void) { i8086_ICount-=12; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BX]+I.regs.w[DI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
24static unsigned EA_202(void) { i8086_ICount-=12; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BP]+I.regs.w[SI]; EA=DefaultBase(SS)+(WORD)EO; return EA; }
25static unsigned EA_203(void) { i8086_ICount-=11; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BP]+I.regs.w[DI]; EA=DefaultBase(SS)+(WORD)EO; return EA; }
26static unsigned EA_204(void) { i8086_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[SI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
27static unsigned EA_205(void) { i8086_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[DI]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
28static unsigned EA_206(void) { i8086_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BP]; EA=DefaultBase(SS)+(WORD)EO; return EA; }
29static unsigned EA_207(void) { i8086_ICount-=9; EO=FETCHOP; EO+=FETCHOP<<8; EO+=I.regs.w[BX]; EA=DefaultBase(DS)+(WORD)EO; return EA; }
3030
3131static unsigned (*GetEA[192])(void)={
3232   EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
src/emu/cpu/i86/i86intf.h
r869r870
44
55#include "cpuintrf.h"
66
7enum {
8   I86_PC=0,
9   I86_IP, I86_AX, I86_CX, I86_DX, I86_BX, I86_SP, I86_BP, I86_SI, I86_DI,
10   I86_FLAGS, I86_ES, I86_CS, I86_SS, I86_DS,
11   I86_VECTOR
7enum
8{
9   I8086_PC=0,
10   I8086_IP,
11   I8086_AX,
12   I8086_CX,
13   I8086_DX,
14   I8086_BX,
15   I8086_SP,
16   I8086_BP,
17   I8086_SI,
18   I8086_DI,
19   I8086_FLAGS,
20   I8086_ES,
21   I8086_CS,
22   I8086_SS,
23   I8086_DS,
24   I8086_VECTOR
1225};
1326
1427/* Public functions */
15void i86_get_info(UINT32 state, cpuinfo *info);
28void i8086_get_info(UINT32 state, cpuinfo *info);
1629
1730#endif
src/emu/cpu/e132xs/e132xs.c
r869r870
52785278      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
52795279      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
52805280
5281      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e116_4k_iram_map; break;
5281      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break;
52825282
52835283      /* --- the following bits of info are returned as pointers to data or functions --- */
52845284      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
r869r870
53015301      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
53025302      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
53035303
5304      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e116_8k_iram_map; break;
5304      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break;
53055305
53065306      /* --- the following bits of info are returned as pointers to data or functions --- */
53075307      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
r869r870
53245324      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
53255325      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
53265326
5327      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e116_16k_iram_map; break;
5327      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break;
53285328
53295329      /* --- the following bits of info are returned as pointers to data or functions --- */
53305330      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
r869r870
53475347      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
53485348      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
53495349
5350      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e116_16k_iram_map; break;
5350      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break;
53515351
53525352      /* --- the following bits of info are returned as pointers to data or functions --- */
53535353      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
r869r870
53705370      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
53715371      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
53725372
5373      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_4k_iram_map; break;
5373      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break;
53745374
53755375      /* --- the following bits of info are returned as pointers to data or functions --- */
53765376      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
53935393      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
53945394      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
53955395
5396      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_4k_iram_map; break;
5396      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break;
53975397
53985398      /* --- the following bits of info are returned as pointers to data or functions --- */
53995399      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
54165416      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
54175417      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
54185418
5419      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_8k_iram_map; break;
5419      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break;
54205420
54215421      /* --- the following bits of info are returned as pointers to data or functions --- */
54225422      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
54395439      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
54405440      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
54415441
5442      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_8k_iram_map; break;
5442      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break;
54435443
54445444      /* --- the following bits of info are returned as pointers to data or functions --- */
54455445      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
54625462      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
54635463      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
54645464
5465      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_16k_iram_map; break;
5465      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break;
54665466
54675467      /* --- the following bits of info are returned as pointers to data or functions --- */
54685468      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
54855485      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
54865486      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
54875487
5488      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_16k_iram_map; break;
5488      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break;
54895489
54905490      /* --- the following bits of info are returned as pointers to data or functions --- */
54915491      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
55085508      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
55095509      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
55105510
5511      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e116_4k_iram_map; break;
5511      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break;
55125512
55135513      /* --- the following bits of info are returned as pointers to data or functions --- */
55145514      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
r869r870
55315531      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
55325532      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
55335533
5534      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_4k_iram_map; break;
5534      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break;
55355535
55365536      /* --- the following bits of info are returned as pointers to data or functions --- */
55375537      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
r869r870
55545554      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
55555555      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
55565556
5557      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e116_8k_iram_map; break;
5557      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break;
55585558
55595559      /* --- the following bits of info are returned as pointers to data or functions --- */
55605560      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
r869r870
55775577      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
55785578      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
55795579
5580      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_e132_8k_iram_map; break;
5580      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break;
55815581
55825582      /* --- the following bits of info are returned as pointers to data or functions --- */
55835583      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
src/emu/cpu/i386/i386dasm.c
r869r870
22   i386 Disassembler
33
44   Written by Ville Linde
5   NEC V-Series support by Bryan McPhail (currently incomplete)
65*/
76
87#include "cpuintrf.h"
r869r870
1817   PARAM_RM16,         /* 16-bit memory or register */
1918   PARAM_M64,         /* 64-bit memory */
2019   PARAM_MMXM,         /* 64-bit memory or MMX register */
20   PARAM_I4,         /* 4-bit signed immediate */
2121   PARAM_I8,         /* 8-bit signed immediate */
2222   PARAM_I16,         /* 16-bit signed immediate */
2323   PARAM_UI8,         /* 8-bit unsigned immediate */
r869r870
8686
8787static const UINT8 *opcode_ptr;
8888static const UINT8 *opcode_ptr_base;
89static const I386_OPCODE *opcode_table1 = 0;
90static const I386_OPCODE *opcode_table2 = 0;
9189
9290static const I386_OPCODE i386_opcode_table1[256] =
9391{
r869r870
641639   {"???",            0,            0,               0,               0            }
642640};
643641
644static const I386_OPCODE necv_opcode_table2[256] =
645{
646   // 0x00
647   {"group0F00",      GROUP,         0,               0,               0            },
648   {"group0F01",      GROUP,         0,               0,               0            },
649   {"lar",            MODRM,         PARAM_REG,         PARAM_RM,         0            },
650   {"lsl",            MODRM,         PARAM_REG,         PARAM_RM,         0            },
651   {"???",            0,            0,               0,               0            },
652   {"???",            0,            0,               0,               0            },
653   {"clts",         0,            0,               0,               0            },
654   {"???",            0,            0,               0,               0            },
655   {"???",            0,            0,               0,               0            },
656   {"???",            0,            0,               0,               0            },
657   {"???",            0,            0,               0,               0            },
658   {"ud2",            0,            0,               0,               0            },
659   {"???",            0,            0,               0,               0            },
660   {"???",            0,            0,               0,               0            },
661   {"???",            0,            0,               0,               0            },
662   {"???",            0,            0,               0,               0            },
663   // 0x10 - NEC V series only
664   {"test1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
665   {"test1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
666   {"clr1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
667   {"clr1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
668   {"set1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
669   {"set1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
670   {"not1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
671   {"not1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
672   {"test1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
673   {"test1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
674   {"clr1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
675   {"clr1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
676   {"set1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
677   {"set1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
678   {"not1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
679   {"not1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
680   // 0x20
681   {"mov",            MODRM,         PARAM_REG,         PARAM_CREG,         0            },
682   {"mov",            MODRM,         PARAM_REG,         PARAM_DREG,         0            },
683   {"mov",            MODRM,         PARAM_CREG,         PARAM_REG,         0            },
684   {"mov",            MODRM,         PARAM_DREG,         PARAM_REG,         0            },
685   {"mov",            MODRM,         PARAM_REG,         PARAM_TREG,         0            },
686   {"???",            0,            0,               0,               0            },
687   {"mov",            MODRM,         PARAM_TREG,         PARAM_REG,         0            },
688   {"???",            0,            0,               0,               0            },
689   {"???",            0,            0,               0,               0            },
690   {"???",            0,            0,               0,               0            },
691   {"???",            0,            0,               0,               0            },
692   {"???",            0,            0,               0,               0            },
693   {"???",            0,            0,               0,               0            },
694   {"???",            0,            0,               0,               0            },
695   {"???",            0,            0,               0,               0            },
696   {"???",            0,            0,               0,               0            },
697   // 0x30
698   {"???",            0,            0,               0,               0            },
699   {"???",            0,            0,               0,               0            },
700   {"???",            0,            0,               0,               0            },
701   {"???",            0,            0,               0,               0            },
702   {"???",            0,            0,               0,               0            },
703   {"???",            0,            0,               0,               0            },
704   {"???",            0,            0,               0,               0            },
705   {"???",            0,            0,               0,               0            },
706   {"???",            0,            0,               0,               0            },
707   {"???",            0,            0,               0,               0            },
708   {"???",            0,            0,               0,               0            },
709   {"???",            0,            0,               0,               0            },
710   {"???",            0,            0,               0,               0            },
711   {"???",            0,            0,               0,               0            },
712   {"???",            0,            0,               0,               0            },
713   {"???",            0,            0,               0,               0            },
714   // 0x40
715   {"???",            0,            0,               0,               0            },
716   {"???",            0,            0,               0,               0            },
717   {"???",            0,            0,               0,               0            },
718   {"???",            0,            0,               0,               0            },
719   {"???",            0,            0,               0,               0            },
720   {"???",            0,            0,               0,               0            },
721   {"???",            0,            0,               0,               0            },
722   {"???",            0,            0,               0,               0            },
723   {"???",            0,            0,               0,               0            },
724   {"???",            0,            0,               0,               0            },
725   {"???",            0,            0,               0,               0            },
726   {"???",            0,            0,               0,               0            },
727   {"???",            0,            0,               0,               0            },
728   {"???",            0,            0,               0,               0            },
729   {"???",            0,            0,               0,               0            },
730   {"???",            0,            0,               0,               0            },
731   // 0x50
732   {"???",            0,            0,               0,               0            },
733   {"???",            0,            0,               0,               0            },
734   {"???",            0,            0,               0,               0            },
735   {"???",            0,            0,               0,               0            },
736   {"???",            0,            0,               0,               0            },
737   {"???",            0,            0,               0,               0            },
738   {"???",            0,            0,               0,               0            },
739   {"???",            0,            0,               0,               0            },
740   {"???",            0,            0,               0,               0            },
741   {"???",            0,            0,               0,               0            },
742   {"???",            0,            0,               0,               0            },
743   {"???",            0,            0,               0,               0            },
744   {"???",            0,            0,               0,               0            },
745   {"???",            0,            0,               0,               0            },
746   {"???",            0,            0,               0,               0            },
747   {"???",            0,            0,               0,               0            },
748   // 0x60
749   {"???",            0,            0,               0,               0            },
750   {"???",            0,            0,               0,               0            },
751   {"???",            0,            0,               0,               0            },
752   {"???",            0,            0,               0,               0            },
753   {"???",            0,            0,               0,               0            },
754   {"???",            0,            0,               0,               0            },
755   {"???",            0,            0,               0,               0            },
756   {"???",            0,            0,               0,               0            },
757   {"???",            0,            0,               0,               0            },
758   {"???",            0,            0,               0,               0            },
759   {"???",            0,            0,               0,               0            },
760   {"???",            0,            0,               0,               0            },
761   {"???",            0,            0,               0,               0            },
762   {"???",            0,            0,               0,               0            },
763   {"???",            0,            0,               0,               0            },
764   {"???",            0,            0,               0,               0            },
765   // 0x70
766   {"???",            0,            0,               0,               0            },
767   {"???",            0,            0,               0,               0            },
768   {"???",            0,            0,               0,               0            },
769   {"???",            0,            0,               0,               0            },
770   {"???",            0,            0,               0,               0            },
771   {"???",            0,            0,               0,               0            },
772   {"???",            0,            0,               0,               0            },
773   {"???",            0,            0,               0,               0            },
774   {"???",            0,            0,               0,               0            },
775   {"???",            0,            0,               0,               0            },
776   {"???",            0,            0,               0,               0            },
777   {"???",            0,            0,               0,               0            },
778   {"???",            0,            0,               0,               0            },
779   {"???",            0,            0,               0,               0            },
780   {"???",            0,            0,               0,               0            },
781   {"???",            0,            0,               0,               0            },
782   // 0x80
783   {"jo",            0,            PARAM_REL,         0,               0            },
784   {"jno",            0,            PARAM_REL,         0,               0            },
785   {"jb",            0,            PARAM_REL,         0,               0            },
786   {"jae",            0,            PARAM_REL,         0,               0            },
787   {"je",            0,            PARAM_REL,         0,               0            },
788   {"jne",            0,            PARAM_REL,         0,               0            },
789   {"jbe",            0,            PARAM_REL,         0,               0            },
790   {"ja",            0,            PARAM_REL,         0,               0            },
791   {"js",            0,            PARAM_REL,         0,               0            },
792   {"jns",            0,            PARAM_REL,         0,               0            },
793   {"jp",            0,            PARAM_REL,         0,               0            },
794   {"jnp",            0,            PARAM_REL,         0,               0            },
795   {"jl",            0,            PARAM_REL,         0,               0            },
796   {"jge",            0,            PARAM_REL,         0,               0            },
797   {"jle",            0,            PARAM_REL,         0,               0            },
798   {"jg",            0,            PARAM_REL,         0,               0            },
799   // 0x90
800   {"???",            0,            0,               0,               0            },
801   {"???",            0,            0,               0,               0            },
802   {"fint",         0,            0,               0,               0            },
803   {"???",            0,            0,               0,               0            },
804   {"???",            0,            0,               0,               0            },
805   {"???",            0,            0,               0,               0            },
806   {"???",            0,            0,               0,               0            },
807   {"???",            0,            0,               0,               0            },
808   {"???",            0,            0,               0,               0            },
809   {"???",            0,            0,               0,               0            },
810   {"???",            0,            0,               0,               0            },
811   {"???",            0,            0,               0,               0            },
812   {"???",            0,            0,               0,               0            },
813   {"???",            0,            0,               0,               0            },
814   {"???",            0,            0,               0,               0            },
815   {"???",            0,            0,               0,               0            },
816   // 0xa0
817   {"push   fs",      0,            0,               0,               0            },
818   {"pop    fs",      0,            0,               0,               0            },
819   {"???",            0,            0,               0,               0            },
820   {"bt",            MODRM,         PARAM_RM,         PARAM_REG,         0            },
821   {"shld",         MODRM,         PARAM_RM,         PARAM_REG,         PARAM_I8      },
822   {"shld",         MODRM,         PARAM_RM,         PARAM_REG,         PARAM_CL      },
823   {"???",            0,            0,               0,               0            },
824   {"???",            0,            0,               0,               0            },
825   {"push   gs",      0,            0,               0,               0            },
826   {"pop    gs",      0,            0,               0,               0            },
827   {"???",            0,            0,               0,               0            },
828   {"bts",            MODRM,         PARAM_RM,         PARAM_REG,         0            },
829   {"shrd",         MODRM,         PARAM_RM,         PARAM_REG,         PARAM_I8      },
830   {"shrd",         MODRM,         PARAM_RM,         PARAM_REG,         PARAM_CL      },
831   {"???",            0,            0,               0,               0            },
832   {"imul",         MODRM,         PARAM_REG,         PARAM_RM,         0            },
833   // 0xb0
834   {"???",            0,            0,               0,               0            },
835   {"???",            0,            0,               0,               0            },
836   {"lss",            MODRM,         PARAM_REG,         PARAM_RM,         0            },
837   {"btr",            MODRM,         PARAM_RM,         PARAM_REG,         0            },
838   {"lfs",            MODRM,         PARAM_REG,         PARAM_RM,         0            },
839   {"lgs",            MODRM,         PARAM_REG,         PARAM_RM,         0            },
840   {"movzx",         MODRM,         PARAM_REG,         PARAM_RM8,         0            },
841   {"movzx",         MODRM,         PARAM_REG,         PARAM_RM16,         0            },
842   {"???",            0,            0,               0,               0            },
843   {"???",            0,            0,               0,               0            },
844   {"group0FBA",      GROUP,         0,               0,               0            },
845   {"btc",            MODRM,         PARAM_RM,         PARAM_REG,         0            },
846   {"bsf",            MODRM,         PARAM_REG,         PARAM_RM,         0            },
847   {"bsr",            MODRM,         PARAM_REG,         PARAM_RM,         0,            DASMFLAG_STEP_OVER},
848   {"movsx",         MODRM,         PARAM_REG,         PARAM_RM8,         0            },
849   {"movsx",         MODRM,         PARAM_REG,         PARAM_RM16,         0            },
850   // 0xc0
851   {"???",            0,            0,               0,               0            },
852   {"???",            0,            0,               0,               0            },
853   {"???",            0,            0,               0,               0            },
854   {"???",            0,            0,               0,               0            },
855   {"???",            0,            0,               0,               0            },
856   {"???",            0,            0,               0,               0            },
857   {"???",            0,            0,               0,               0            },
858   {"???",            0,            0,               0,               0            },
859   {"???",            0,            0,               0,               0            },
860   {"???",            0,            0,               0,               0            },
861   {"???",            0,            0,               0,               0            },
862   {"???",            0,            0,               0,               0            },
863   {"???",            0,            0,               0,               0            },
864   {"???",            0,            0,               0,               0            },
865   {"???",            0,            0,               0,               0            },
866   {"???",            0,            0,               0,               0            },
867   // 0xd0
868   {"???",            0,            0,               0,               0            },
869   {"???",            0,            0,               0,               0            },
870   {"???",            0,            0,               0,               0            },
871   {"???",            0,            0,               0,               0            },
872   {"???",            0,            0,               0,               0            },
873   {"???",            0,            0,               0,               0            },
874   {"???",            0,            0,               0,               0            },
875   {"???",            0,            0,               0,               0            },
876   {"???",            0,            0,               0,               0            },
877   {"???",            0,            0,               0,               0            },
878   {"???",            0,            0,               0,               0            },
879   {"???",            0,            0,               0,               0            },
880   {"???",            0,            0,               0,               0            },
881   {"???",            0,            0,               0,               0            },
882   {"???",            0,            0,               0,               0            },
883   {"???",            0,            0,               0,               0            },
884   // 0xe0
885   {"???",            0,            0,               0,               0            },
886   {"???",            0,            0,               0,               0            },
887   {"???",            0,            0,               0,               0            },
888   {"???",            0,            0,               0,               0            },
889   {"???",            0,            0,               0,               0            },
890   {"???",            0,            0,               0,               0            },
891   {"???",            0,            0,               0,               0            },
892   {"???",            0,            0,               0,               0            },
893   {"???",            0,            0,               0,               0            },
894   {"???",            0,            0,               0,               0            },
895   {"???",            0,            0,               0,               0            },
896   {"???",            0,            0,               0,               0            },
897   {"???",            0,            0,               0,               0            },
898   {"???",            0,            0,               0,               0            },
899   {"???",            0,            0,               0,               0            },
900   {"???",            0,            0,               0,               0            },
901   // 0xf0
902   {"???",            0,            0,               0,               0            },
903   {"???",            0,            0,               0,               0            },
904   {"???",            0,            0,               0,               0            },
905   {"???",            0,            0,               0,               0            },
906   {"???",            0,            0,               0,               0            },
907   {"???",            0,            0,               0,               0            },
908   {"???",            0,            0,               0,               0            },
909   {"???",            0,            0,               0,               0            },
910   {"???",            0,            0,               0,               0            },
911   {"???",            0,            0,               0,               0            },
912   {"???",            0,            0,               0,               0            },
913   {"???",            0,            0,               0,               0            },
914   {"???",            0,            0,               0,               0            },
915   {"???",            0,            0,               0,               0            },
916   {"???",            0,            0,               0,               0            },
917   {"???",            0,            0,               0,               0            }
918};
919
920642static const I386_OPCODE group80_table[8] =
921643{
922644   {"add",            0,            PARAM_RM8,         PARAM_I8,         0            },
r869r870
1066788   {"inc",            0,            PARAM_RM,         0,               0            },
1067789   {"dec",            0,            PARAM_RM,         0,               0            },
1068790   {"call",         0,            PARAM_RM,         0,               0,            DASMFLAG_STEP_OVER},
1069   {"call",         0,            PARAM_RM,         0,               0,            DASMFLAG_STEP_OVER},
791   {"call    far ptr ",0,            PARAM_RM,         0,               0,            DASMFLAG_STEP_OVER},
1070792   {"jmp",            0,            PARAM_RM,         0,               0            },
1071   {"jmp",            0,            PARAM_RM,         0,               0            },
793   {"jmp     far ptr ",0,            PARAM_RM,         0,               0            },
1072794   {"push",         0,            PARAM_RM,         0,               0            },
1073795   {"???",            0,            0,               0,               0            }
1074796};
r869r870
14701192         }
14711193         break;
14721194
1195      case PARAM_I4:
1196         i8 = FETCHD();
1197         s += sprintf( s, "%d", i8 & 0x0f );
1198         break;
1199
14731200      case PARAM_I8:
14741201         i8 = FETCHD();
14751202         s += sprintf( s, "%s", shexstring((INT8)i8, 0, FALSE) );
r869r870
19741701      sibex = (op1 << 2) & 8;
19751702      rmex = (op1 << 3) & 8;
19761703      op2 = FETCH();
1977      decode_opcode( s, &opcode_table1[op2], op1 );
1704      decode_opcode( s, &i386_opcode_table1[op2], op1 );
19781705      return;
19791706   }
19801707
r869r870
19841711         if (operand_size < 2)
19851712            operand_size ^= 1;
19861713         op2 = FETCH();
1987         decode_opcode( s, &opcode_table1[op2], op1 );
1714         decode_opcode( s, &i386_opcode_table1[op2], op1 );
19881715         return;
19891716
19901717      case ADDR_SIZE:
r869r870
19931720         else
19941721            address_size ^= 3;
19951722         op2 = FETCH();
1996         decode_opcode( s, &opcode_table1[op2], op1 );
1723         decode_opcode( s, &i386_opcode_table1[op2], op1 );
19971724         return;
19981725
19991726      case TWO_BYTE:
20001727         op2 = FETCHD();
2001         decode_opcode( s, &opcode_table2[op2], op1 );
1728         decode_opcode( s, &i386_opcode_table2[op2], op1 );
20021729         return;
20031730
20041731      case SEG_CS:
r869r870
20091736      case SEG_SS:
20101737         segment = op->flags;
20111738         op2 = FETCH();
2012         decode_opcode( s, &opcode_table1[op2], op1 );
1739         decode_opcode( s, &i386_opcode_table1[op2], op1 );
20131740         return;
20141741
20151742      case PREFIX:
20161743         s += sprintf( s, "%-8s", op->mnemonic );
20171744         op2 = FETCH();
2018         decode_opcode( s, &opcode_table1[op2], op1 );
1745         decode_opcode( s, &i386_opcode_table1[op2], op1 );
20191746         return;
20201747
20211748      case VAR_NAME:
r869r870
20841811   UINT8 op;
20851812
20861813   opcode_ptr = opcode_ptr_base = oprom;
2087   opcode_table1 = i386_opcode_table1;
2088   opcode_table2 = i386_opcode_table2;
20891814   address_size = (mode == 16) ? 0 : (mode == 32) ? 1 : 2;
20901815   operand_size = (mode == 16) ? 0 : 1;
20911816   pc = eip;
r869r870
20961821
20971822   op = FETCH();
20981823
2099   decode_opcode( buffer, &opcode_table1[op], op );
1824   decode_opcode( buffer, &i386_opcode_table1[op], op );
21001825   return (pc-eip) | dasm_flags | DASMFLAG_SUPPORTED;
21011826}
2102
2103int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom)
2104{
2105   UINT8 op;
2106
2107   opcode_ptr = opcode_ptr_base = oprom;
2108   opcode_table1 = i386_opcode_table1;
2109   opcode_table2 = necv_opcode_table2;
2110   address_size = 0;
2111   operand_size = 0;
2112   pc = eip;
2113   dasm_flags = 0;
2114   segment = 0;
2115   curmode = 16;
2116   rex = regex = sibex = rmex = 0;
2117
2118   op = FETCH();
2119
2120   decode_opcode( buffer, &opcode_table1[op], op );
2121   return (pc-eip) | dasm_flags | DASMFLAG_SUPPORTED;
2122}
src/emu/cpu/cop400/cop420.c
r869r870
88
99    TODO:
1010
11    - counter
1211    - serial I/O
1312    - interrupt
1413
r869r870
150149   R.G_mask = 0x0F;
151150   R.D_mask = 0x0F;
152151
152   R.counter = 0x00;
153
153154   for (i=0; i<256; i++) InstLen[i]=1;
154155
155156   InstLen[0x60] = InstLen[0x61] = InstLen[0x62] = InstLen[0x63] =
r869r870
238239            skipLBI = 0;
239240         }
240241         else {
241            cop420_ICount -=cop420_opcode_main[opcode].cycles;
242            cop420_ICount -= cop420_opcode_main[opcode].cycles;
242243
243244            PC += InstLen[opcode];
244245         }
r869r870
253254
254255         if (skip == 1) {
255256            opcode=ROM(PC);
256            cop420_ICount -=cop420_opcode_main[opcode].cycles;
257            cop420_ICount -= cop420_opcode_main[opcode].cycles;
257258            PC += InstLen[opcode];
258259            skip = 0;
259260         }
260261      }
262
263      /* counter handling */
264      R.counter += cop420_opcode_main[opcode].cycles;
265      if (R.counter > 1024)
266      {
267         R.timerlatch = 1;
268         R.counter = 0;
269      }
270
261271   } while (cop420_ICount > 0);
262272
263273   return cycles - cop420_ICount;
src/emu/cpu/sh4/sh4.c
r869r870
42044204      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
42054205      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
42064206
4207      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = &construct_map_sh4_internal_map; break;
4207      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_sh4_internal_map; break;
42084208
42094209      case CPUINFO_INT_INPUT_STATE + SH4_IRL0:      info->i = sh4.irq_line_state[SH4_IRL0]; break;
42104210      case CPUINFO_INT_INPUT_STATE + SH4_IRL1:      info->i = sh4.irq_line_state[SH4_IRL1]; break;
src/emu/cpu/nec/necea.h
r869r870
33static UINT16 EO;
44static UINT16 E16;
55
6static unsigned EA_000(void) { EO=I.regs.w[BW]+I.regs.w[IX]; EA=DefaultBase(DS)+EO; return EA; }
7static unsigned EA_001(void) { EO=I.regs.w[BW]+I.regs.w[IY]; EA=DefaultBase(DS)+EO; return EA; }
6static unsigned EA_000(void) { EO=I.regs.w[BW]+I.regs.w[IX]; EA=DefaultBase(DS0)+EO; return EA; }
7static unsigned EA_001(void) { EO=I.regs.w[BW]+I.regs.w[IY]; EA=DefaultBase(DS0)+EO; return EA; }
88static unsigned EA_002(void) { EO=I.regs.w[BP]+I.regs.w[IX]; EA=DefaultBase(SS)+EO; return EA; }
99static unsigned EA_003(void) { EO=I.regs.w[BP]+I.regs.w[IY]; EA=DefaultBase(SS)+EO; return EA; }
10static unsigned EA_004(void) { EO=I.regs.w[IX]; EA=DefaultBase(DS)+EO; return EA; }
11static unsigned EA_005(void) { EO=I.regs.w[IY]; EA=DefaultBase(DS)+EO; return EA; }
12static unsigned EA_006(void) { EO=FETCH; EO+=FETCH<<8; EA=DefaultBase(DS)+EO; return EA; }
13static unsigned EA_007(void) { EO=I.regs.w[BW]; EA=DefaultBase(DS)+EO; return EA; }
10static unsigned EA_004(void) { EO=I.regs.w[IX]; EA=DefaultBase(DS0)+EO; return EA; }
11static unsigned EA_005(void) { EO=I.regs.w[IY]; EA=DefaultBase(DS0)+EO; return EA; }
12static unsigned EA_006(void) { EO=FETCH; EO+=FETCH<<8; EA=DefaultBase(DS0)+EO; return EA; }
13static unsigned EA_007(void) { EO=I.regs.w[BW]; EA=DefaultBase(DS0)+EO; return EA; }
1414
15static unsigned EA_100(void) { EO=(I.regs.w[BW]+I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
16static unsigned EA_101(void) { EO=(I.regs.w[BW]+I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
15static unsigned EA_100(void) { EO=(I.regs.w[BW]+I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(DS0)+EO; return EA; }
16static unsigned EA_101(void) { EO=(I.regs.w[BW]+I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(DS0)+EO; return EA; }
1717static unsigned EA_102(void) { EO=(I.regs.w[BP]+I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(SS)+EO; return EA; }
1818static unsigned EA_103(void) { EO=(I.regs.w[BP]+I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(SS)+EO; return EA; }
19static unsigned EA_104(void) { EO=(I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
20static unsigned EA_105(void) { EO=(I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
19static unsigned EA_104(void) { EO=(I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(DS0)+EO; return EA; }
20static unsigned EA_105(void) { EO=(I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(DS0)+EO; return EA; }
2121static unsigned EA_106(void) { EO=(I.regs.w[BP]+(INT8)FETCH); EA=DefaultBase(SS)+EO; return EA; }
22static unsigned EA_107(void) { EO=(I.regs.w[BW]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
22static unsigned EA_107(void) { EO=(I.regs.w[BW]+(INT8)FETCH); EA=DefaultBase(DS0)+EO; return EA; }
2323
24static unsigned EA_200(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+I.regs.w[IX]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
25static unsigned EA_201(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+I.regs.w[IY]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
24static unsigned EA_200(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+I.regs.w[IX]+(INT16)E16; EA=DefaultBase(DS0)+EO; return EA; }
25static unsigned EA_201(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+I.regs.w[IY]+(INT16)E16; EA=DefaultBase(DS0)+EO; return EA; }
2626static unsigned EA_202(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BP]+I.regs.w[IX]+(INT16)E16; EA=DefaultBase(SS)+EO; return EA; }
2727static unsigned EA_203(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BP]+I.regs.w[IY]+(INT16)E16; EA=DefaultBase(SS)+EO; return EA; }
28static unsigned EA_204(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[IX]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
29static unsigned EA_205(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[IY]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
28static unsigned EA_204(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[IX]+(INT16)E16; EA=DefaultBase(DS0)+EO; return EA; }
29static unsigned EA_205(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[IY]+(INT16)E16; EA=DefaultBase(DS0)+EO; return EA; }
3030static unsigned EA_206(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BP]+(INT16)E16; EA=DefaultBase(SS)+EO; return EA; }
31static unsigned EA_207(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
31static unsigned EA_207(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+(INT16)E16; EA=DefaultBase(DS0)+EO; return EA; }
3232
3333static unsigned (*GetEA[192])(void)={
3434   EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
src/emu/cpu/nec/nec.c
r869r870
22
33    NEC V20/V30/V33 emulator
44
5    ---------------------------------------------
6
7    V20 = uPD70108 = 8-bit data bus @ 5MHz or 8MHz
8    V20HL = uPD70108H = V20 with EMS support (24-bit address bus)
9
10    V25 = uPD70320 = V20 with on-chip features:
11            - 256 bytes on-chip RAM
12            - 8 register banks
13            - 4-bit input port
14            - 20-bit I/O port
15            - 2 channel serial interface
16            - interrupt controller
17            - 2 channel DMA controller
18            - 2 channel 16-bit timer
19            - new instructions: BTCLR, RETRBI, STOP, BRKCS, TSKSW,
20                                MOVSPA, MOVSPB
21
22    V25+ = uPD70325 = V25 @ 8MHz or 10MHz plus changes:
23            - faster DMA
24            - improved serial interface
25
26    ---------------------------------------------
27
28    V30 = uPD70116 = 16-bit data bus version of V20
29    V30HL = uPD70116H = 16-bit data bus version of V20HL
30    V30MX = V30HL with separate address and data busses
31
32    V35 = uPD70330 = 16-bit data bus version of V25
33
34    V35+ = uPD70335 = 16-bit data bus version of V25+
35
36    ---------------------------------------------
37
38    V40 = uPD70208 = 8-bit data bus @ 10MHz
39    V40HL = uPD70208H = V40 with support up to 20Mhz
40
41    ---------------------------------------------
42
43    V50 = uPD70216 = 16-bit data bus version of V40
44    V50HL = uPD70216H = 16-bit data bus version of V40HL
45
46    ---------------------------------------------
47
48    V41 = uPD70270
49
50    V51 = uPD70280
51
52
53
54    V33A = uPD70136A
55
56    V53A = uPD70236A
57
58
59
60    Instruction differences:
61        V20, V30, V40, V50 have dedicated emulation instructions
62            (BRKEM, RETEM, CALLN)
63
64        V33A, V53A has dedicated address mode instructions
65            (BRKXA, RETXA)
66
67
68
569    (Re)Written June-September 2000 by Bryan McPhail (mish@tendril.co.uk) based
670    on code by Oliver Bergmann (Raul_Bloodworth@hotmail.com) who based code
771    on the i286 emulator by Fabrice Frances which had initial work based on
r869r870
36100
37101    Todo!
38102        Double check cycle timing is 100%.
39        Fix memory interface (should be 16 bit).
40103
41104****************************************************************************/
42105
r869r870
61124
62125typedef struct
63126{
127   offs_t   fetch_xor;
128
129   UINT8   (*rbyte)(offs_t);
130   UINT16   (*rword)(offs_t);
131   void   (*wbyte)(offs_t, UINT8);
132   void   (*wword)(offs_t, UINT16);
133
134   UINT8   (*rbyte_port)(offs_t);
135   UINT16   (*rword_port)(offs_t);
136   void   (*wbyte_port)(offs_t, UINT8);
137   void   (*wword_port)(offs_t, UINT16);
138} memory_interface;
139
140typedef struct
141{
64142   necbasicregs regs;
65143    UINT16   sregs[4];
66144
r869r870
76154   UINT8   no_interrupt;
77155
78156   int     (*irq_callback)(int irqline);
157
158   memory_interface   mem;
79159} nec_Regs;
80160
81161/***************************************************************************/
r869r870
110190    unsigned int i,j,c;
111191    static const BREGS reg_name[8]={ AL, CL, DL, BL, AH, CH, DH, BH };
112192    int (*save_irqcallback)(int);
193    memory_interface save_mem;
113194
114195   save_irqcallback = I.irq_callback;
196   save_mem = I.mem;
115197   memset( &I, 0, sizeof(I) );
116198   I.irq_callback = save_irqcallback;
199   I.mem = save_mem;
117200
118   I.sregs[CS] = 0xffff;
201   I.sregs[PS] = 0xffff;
119202
120203   CHANGE_PC;
121204
r869r870
163246      I.pending_irq &= ~INT_IRQ;
164247   }
165248
166    dest_off = ReadWord(int_num*4);
167    dest_seg = ReadWord(int_num*4+2);
249    dest_off = read_word(int_num*4);
250    dest_seg = read_word(int_num*4+2);
168251
169   PUSH(I.sregs[CS]);
252   PUSH(I.sregs[PS]);
170253   PUSH(I.ip);
171254   I.ip = (WORD)dest_off;
172   I.sregs[CS] = (WORD)dest_seg;
255   I.sregs[PS] = (WORD)dest_seg;
173256   CHANGE_PC;
174257}
175258
r869r870
206289OP( 0x03, i_add_r16w ) { DEF_r16w;   ADDW;   RegWord(ModRM)=dst;         CLKR(15,15,8,15,11,6,2,EA);   }
207290OP( 0x04, i_add_ald8 ) { DEF_ald8;   ADDB;   I.regs.b[AL]=dst;         CLKS(4,4,2);            }
208291OP( 0x05, i_add_axd16) { DEF_axd16;   ADDW;   I.regs.w[AW]=dst;         CLKS(4,4,2);            }
209OP( 0x06, i_push_es  ) { PUSH(I.sregs[ES]);   CLKS(12,8,3);    }
210OP( 0x07, i_pop_es   ) { POP(I.sregs[ES]);   CLKS(12,8,5);   }
292OP( 0x06, i_push_es  ) { PUSH(I.sregs[DS1]);   CLKS(12,8,3);    }
293OP( 0x07, i_pop_es   ) { POP(I.sregs[DS1]);   CLKS(12,8,5);   }
211294
212295OP( 0x08, i_or_br8   ) { DEF_br8;   ORB;   PutbackRMByte(ModRM,dst);   CLKM(2,2,2,16,13,7);      }
213296OP( 0x09, i_or_wr16  ) { DEF_wr16;   ORW;   PutbackRMWord(ModRM,dst);   CLKR(24,24,11,24,16,7,2,EA);}
r869r870
215298OP( 0x0b, i_or_r16w  ) { DEF_r16w;   ORW;   RegWord(ModRM)=dst;         CLKR(15,15,8,15,11,6,2,EA);   }
216299OP( 0x0c, i_or_ald8  ) { DEF_ald8;   ORB;   I.regs.b[AL]=dst;         CLKS(4,4,2);            }
217300OP( 0x0d, i_or_axd16 ) { DEF_axd16;   ORW;   I.regs.w[AW]=dst;         CLKS(4,4,2);            }
218OP( 0x0e, i_push_cs  ) { PUSH(I.sregs[CS]);   CLKS(12,8,5);   }
301OP( 0x0e, i_push_cs  ) { PUSH(I.sregs[PS]);   CLKS(12,8,5);   }
219302OP( 0x0f, i_pre_nec  ) { UINT32 ModRM, tmp, tmp2;
220303   switch (FETCH) {
221304      case 0x10 : BITOP_BYTE;   CLKS(3,3,4); tmp2 = I.regs.b[CL] & 0x7;   I.ZeroVal = (tmp & (1<<tmp2)) ? 1 : 0;   I.CarryVal=I.OverVal=0; break; /* Test */
r869r870
266349OP( 0x1b, i_sbb_r16w ) { DEF_r16w;   src+=CF;   SUBW;   RegWord(ModRM)=dst;         CLKR(15,15,8,15,11,6,2,EA);   }
267350OP( 0x1c, i_sbb_ald8 ) { DEF_ald8;   src+=CF;   SUBB;   I.regs.b[AL]=dst;         CLKS(4,4,2);             }
268351OP( 0x1d, i_sbb_axd16) { DEF_axd16;   src+=CF;   SUBW;   I.regs.w[AW]=dst;         CLKS(4,4,2);   }
269OP( 0x1e, i_push_ds  ) { PUSH(I.sregs[DS]);      CLKS(12,8,3);   }
270OP( 0x1f, i_pop_ds   ) { POP(I.sregs[DS]);      CLKS(12,8,5);   }
352OP( 0x1e, i_push_ds  ) { PUSH(I.sregs[DS0]);      CLKS(12,8,3);   }
353OP( 0x1f, i_pop_ds   ) { POP(I.sregs[DS0]);      CLKS(12,8,5);   }
271354
272355OP( 0x20, i_and_br8  ) { DEF_br8;   ANDB;   PutbackRMByte(ModRM,dst);   CLKM(2,2,2,16,13,7);       }
273356OP( 0x21, i_and_wr16 ) { DEF_wr16;   ANDW;   PutbackRMWord(ModRM,dst);   CLKR(24,24,11,24,16,7,2,EA);}
r869r870
275358OP( 0x23, i_and_r16w ) { DEF_r16w;   ANDW;   RegWord(ModRM)=dst;         CLKR(15,15,8,15,11,6,2,EA);   }
276359OP( 0x24, i_and_ald8 ) { DEF_ald8;   ANDB;   I.regs.b[AL]=dst;         CLKS(4,4,2);            }
277360OP( 0x25, i_and_axd16) { DEF_axd16;   ANDW;   I.regs.w[AW]=dst;         CLKS(4,4,2);   }
278OP( 0x26, i_es       ) { seg_prefix=TRUE;   prefix_base=I.sregs[ES]<<4;   CLK(2);      nec_instruction[FETCHOP]();   seg_prefix=FALSE; }
361OP( 0x26, i_es       ) { seg_prefix=TRUE;   prefix_base=I.sregs[DS1]<<4;   CLK(2);      nec_instruction[FETCHOP]();   seg_prefix=FALSE; }
279362OP( 0x27, i_daa      ) { ADJ4(6,0x60);                           CLKS(3,3,2);   }
280363
281364OP( 0x28, i_sub_br8  ) { DEF_br8;   SUBB;   PutbackRMByte(ModRM,dst);   CLKM(2,2,2,16,13,7);       }
r869r870
284367OP( 0x2b, i_sub_r16w ) { DEF_r16w;   SUBW;   RegWord(ModRM)=dst;         CLKR(15,15,8,15,11,6,2,EA);   }
285368OP( 0x2c, i_sub_ald8 ) { DEF_ald8;   SUBB;   I.regs.b[AL]=dst;         CLKS(4,4,2);             }
286369OP( 0x2d, i_sub_axd16) { DEF_axd16;   SUBW;   I.regs.w[AW]=dst;         CLKS(4,4,2);   }
287OP( 0x2e, i_cs       ) { seg_prefix=TRUE;   prefix_base=I.sregs[CS]<<4;   CLK(2);      nec_instruction[FETCHOP]();   seg_prefix=FALSE; }
370OP( 0x2e, i_cs       ) { seg_prefix=TRUE;   prefix_base=I.sregs[PS]<<4;   CLK(2);      nec_instruction[FETCHOP]();   seg_prefix=FALSE; }
288371OP( 0x2f, i_das      ) { ADJ4(-6,-0x60);                        CLKS(3,3,2);   }
289372
290373OP( 0x30, i_xor_br8  ) { DEF_br8;   XORB;   PutbackRMByte(ModRM,dst);   CLKM(2,2,2,16,13,7);      }
r869r870
302385OP( 0x3b, i_cmp_r16w ) { DEF_r16w;   SUBW;               CLKR(15,15,8,15,11,6,2,EA);   }
303386OP( 0x3c, i_cmp_ald8 ) { DEF_ald8;   SUBB;               CLKS(4,4,2); }
304387OP( 0x3d, i_cmp_axd16) { DEF_axd16;   SUBW;               CLKS(4,4,2);   }
305OP( 0x3e, i_ds       ) { seg_prefix=TRUE;   prefix_base=I.sregs[DS]<<4;   CLK(2);      nec_instruction[FETCHOP]();   seg_prefix=FALSE; }
388OP( 0x3e, i_ds       ) { seg_prefix=TRUE;   prefix_base=I.sregs[DS0]<<4;   CLK(2);      nec_instruction[FETCHOP]();   seg_prefix=FALSE; }
306389OP( 0x3f, i_aas      ) { ADJB(-6, (I.regs.b[AL] < 6) ? -2 : -1);      CLKS(7,7,4);   }
307390
308391OP( 0x40, i_inc_ax  ) { IncWordReg(AW);                  CLK(2);   }
r869r870
379462}
380463OP( 0x64, i_repnc  ) {    UINT32 next = FETCHOP;   UINT16 c = I.regs.w[CW];
381464    switch(next) { /* Segments */
382       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[ES]<<4;   next = FETCHOP;   CLK(2); break;
383       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[CS]<<4;   next = FETCHOP;   CLK(2); break;
465       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[DS1]<<4;   next = FETCHOP;   CLK(2); break;
466       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[PS]<<4;   next = FETCHOP;   CLK(2); break;
384467       case 0x36:   seg_prefix=TRUE;   prefix_base=I.sregs[SS]<<4;   next = FETCHOP;   CLK(2); break;
385       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS]<<4;   next = FETCHOP;   CLK(2); break;
468       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS0]<<4;   next = FETCHOP;   CLK(2); break;
386469   }
387470
388471    switch(next) {
r869r870
407490
408491OP( 0x65, i_repc  ) {    UINT32 next = FETCHOP;   UINT16 c = I.regs.w[CW];
409492    switch(next) { /* Segments */
410       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[ES]<<4;   next = FETCHOP;   CLK(2); break;
411       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[CS]<<4;   next = FETCHOP;   CLK(2); break;
493       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[DS1]<<4;   next = FETCHOP;   CLK(2); break;
494       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[PS]<<4;   next = FETCHOP;   CLK(2); break;
412495       case 0x36:   seg_prefix=TRUE;   prefix_base=I.sregs[SS]<<4;   next = FETCHOP;   CLK(2); break;
413       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS]<<4;   next = FETCHOP;   CLK(2); break;
496       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS0]<<4;   next = FETCHOP;   CLK(2); break;
414497   }
415498
416499    switch(next) {
r869r870
437520OP( 0x69, i_imul_d16 ) { UINT32 tmp;   DEF_r16w;    FETCHWORD(tmp); dst = (INT32)((INT16)src)*(INT32)((INT16)tmp); I.CarryVal = I.OverVal = (((INT32)dst) >> 15 != 0) && (((INT32)dst) >> 15 != -1);     RegWord(ModRM)=(WORD)dst;     nec_ICount-=(ModRM >=0xc0 )?38:47;}
438521OP( 0x6a, i_push_d8  ) { UINT32 tmp = (WORD)((INT16)((INT8)FETCH));    PUSH(tmp);   CLKW(11,11,5,11,7,3,I.regs.w[SP]);   }
439522OP( 0x6b, i_imul_d8  ) { UINT32 src2; DEF_r16w; src2= (WORD)((INT16)((INT8)FETCH)); dst = (INT32)((INT16)src)*(INT32)((INT16)src2); I.CarryVal = I.OverVal = (((INT32)dst) >> 15 != 0) && (((INT32)dst) >> 15 != -1); RegWord(ModRM)=(WORD)dst; nec_ICount-=(ModRM >=0xc0 )?31:39; }
440OP( 0x6c, i_insb     ) { PutMemB(ES,I.regs.w[IY],read_port(I.regs.w[DW])); I.regs.w[IY]+= -2 * I.DF + 1; CLK(8); }
441OP( 0x6d, i_insw     ) { PutMemB(ES,I.regs.w[IY],read_port(I.regs.w[DW])); PutMemB(ES,(I.regs.w[IY]+1)&0xffff,read_port((I.regs.w[DW]+1)&0xffff)); I.regs.w[IY]+= -4 * I.DF + 2; CLKS(18,10,8); }
442OP( 0x6e, i_outsb    ) { write_port(I.regs.w[DW],GetMemB(DS,I.regs.w[IX])); I.regs.w[IX]+= -2 * I.DF + 1; CLK(8); }
443OP( 0x6f, i_outsw    ) { write_port(I.regs.w[DW],GetMemB(DS,I.regs.w[IX])); write_port((I.regs.w[DW]+1)&0xffff,GetMemB(DS,(I.regs.w[IX]+1)&0xffff)); I.regs.w[IX]+= -4 * I.DF + 2; CLKS(18,10,8); }
523OP( 0x6c, i_insb     ) { PutMemB(DS1,I.regs.w[IY],read_port_byte(I.regs.w[DW])); I.regs.w[IY]+= -2 * I.DF + 1; CLK(8); }
524OP( 0x6d, i_insw     ) { PutMemW(DS1,I.regs.w[IY],read_port_word(I.regs.w[DW])); I.regs.w[IY]+= -4 * I.DF + 2; CLKS(18,10,8); }
525OP( 0x6e, i_outsb    ) { write_port_byte(I.regs.w[DW],GetMemB(DS0,I.regs.w[IX])); I.regs.w[IX]+= -2 * I.DF + 1; CLK(8); }
526OP( 0x6f, i_outsw    ) { write_port_word(I.regs.w[DW],GetMemW(DS0,I.regs.w[IX])); I.regs.w[IX]+= -4 * I.DF + 2; CLKS(18,10,8); }
444527
445528OP( 0x70, i_jo      ) { JMP( OF);            CLKS(4,4,3); }
446529OP( 0x71, i_jno     ) { JMP(!OF);            CLKS(4,4,3); }
r869r870
528611OP( 0x8d, i_lea       ) { UINT16 ModRM = FETCH; (void)(*GetEA[ModRM])(); RegWord(ModRM)=EO;    CLKS(4,4,2); }
529612OP( 0x8e, i_mov_sregw ) { UINT16 src; GetModRM; src = GetRMWord(ModRM); CLKR(15,15,7,15,11,5,2,EA);
530613    switch (ModRM & 0x38) {
531       case 0x00: I.sregs[ES] = src; break; /* mov es,ew */
532      case 0x08: I.sregs[CS] = src; break; /* mov cs,ew */
614       case 0x00: I.sregs[DS1] = src; break; /* mov es,ew */
615      case 0x08: I.sregs[PS] = src; break; /* mov cs,ew */
533616       case 0x10: I.sregs[SS] = src; break; /* mov ss,ew */
534       case 0x18: I.sregs[DS] = src; break; /* mov ds,ew */
617       case 0x18: I.sregs[DS0] = src; break; /* mov ds,ew */
535618      default:   logerror("%06x: Mov Sreg - Invalid register\n",activecpu_get_pc());
536619    }
537620   I.no_interrupt=1;
r869r870
539622OP( 0x8f, i_popw ) { UINT16 tmp; GetModRM; POP(tmp); PutRMWord(ModRM,tmp); nec_ICount-=21; }
540623OP( 0x90, i_nop  ) { CLK(3);
541624   /* Cycle skip for idle loops (0: NOP  1:  JMP 0) */
542   if (I.no_interrupt==0 && nec_ICount>0 && (I.pending_irq==0) && (PEEKOP((I.sregs[CS]<<4)+I.ip))==0xeb && (PEEK((I.sregs[CS]<<4)+I.ip+1))==0xfd)
625   if (I.no_interrupt==0 && nec_ICount>0 && (I.pending_irq==0) && (PEEKOP((I.sregs[PS]<<4)+I.ip))==0xeb && (PEEK((I.sregs[PS]<<4)+I.ip+1))==0xfd)
543626      nec_ICount%=15;
544627}
545628OP( 0x91, i_xchg_axcx ) { XchgAWReg(CW); CLK(3); }
r869r870
552635
553636OP( 0x98, i_cbw       ) { I.regs.b[AH] = (I.regs.b[AL] & 0x80) ? 0xff : 0;      CLK(2);   }
554637OP( 0x99, i_cwd       ) { I.regs.w[DW] = (I.regs.b[AH] & 0x80) ? 0xffff : 0;   CLK(4);   }
555OP( 0x9a, i_call_far  ) { UINT32 tmp, tmp2;   FETCHWORD(tmp); FETCHWORD(tmp2); PUSH(I.sregs[CS]); PUSH(I.ip); I.ip = (WORD)tmp; I.sregs[CS] = (WORD)tmp2; CHANGE_PC; CLKW(29,29,13,29,21,9,I.regs.w[SP]); }
638OP( 0x9a, i_call_far  ) { UINT32 tmp, tmp2;   FETCHWORD(tmp); FETCHWORD(tmp2); PUSH(I.sregs[PS]); PUSH(I.ip); I.ip = (WORD)tmp; I.sregs[PS] = (WORD)tmp2; CHANGE_PC; CLKW(29,29,13,29,21,9,I.regs.w[SP]); }
556639OP( 0x9b, i_wait      ) { logerror("%06x: Hardware POLL\n",activecpu_get_pc()); }
557640OP( 0x9c, i_pushf     ) { UINT16 tmp = CompressFlags(); PUSH( tmp ); CLKS(12,8,3); }
558641OP( 0x9d, i_popf      ) { UINT32 tmp; POP(tmp); ExpandFlags(tmp); CLKS(12,8,5); if (I.TF) nec_trap(); }
559642OP( 0x9e, i_sahf      ) { UINT32 tmp = (CompressFlags() & 0xff00) | (I.regs.b[AH] & 0xd5); ExpandFlags(tmp); CLKS(3,3,2); }
560643OP( 0x9f, i_lahf      ) { I.regs.b[AH] = CompressFlags() & 0xff; CLKS(3,3,2); }
561644
562OP( 0xa0, i_mov_aldisp ) { UINT32 addr; FETCHWORD(addr); I.regs.b[AL] = GetMemB(DS, addr); CLKS(10,10,5); }
563OP( 0xa1, i_mov_axdisp ) { UINT32 addr; FETCHWORD(addr); I.regs.b[AL] = GetMemB(DS, addr); I.regs.b[AH] = GetMemB(DS, (addr+1)&0xffff); CLKW(14,14,7,14,10,5,addr); }
564OP( 0xa2, i_mov_dispal ) { UINT32 addr; FETCHWORD(addr); PutMemB(DS, addr, I.regs.b[AL]);  CLKS(9,9,3); }
565OP( 0xa3, i_mov_dispax ) { UINT32 addr; FETCHWORD(addr); PutMemB(DS, addr, I.regs.b[AL]);  PutMemB(DS, (addr+1)&0xffff, I.regs.b[AH]); CLKW(13,13,5,13,9,3,addr); }
566OP( 0xa4, i_movsb      ) { UINT32 tmp = GetMemB(DS,I.regs.w[IX]); PutMemB(ES,I.regs.w[IY], tmp); I.regs.w[IY] += -2 * I.DF + 1; I.regs.w[IX] += -2 * I.DF + 1; CLKS(8,8,6); }
567OP( 0xa5, i_movsw      ) { UINT32 tmp = GetMemW(DS,I.regs.w[IX]); PutMemW(ES,I.regs.w[IY], tmp); I.regs.w[IY] += -4 * I.DF + 2; I.regs.w[IX] += -4 * I.DF + 2; CLKS(16,16,10); }
568OP( 0xa6, i_cmpsb      ) { UINT32 src = GetMemB(ES, I.regs.w[IY]); UINT32 dst = GetMemB(DS, I.regs.w[IX]); SUBB; I.regs.w[IY] += -2 * I.DF + 1; I.regs.w[IX] += -2 * I.DF + 1; CLKS(14,14,14); }
569OP( 0xa7, i_cmpsw      ) { UINT32 src = GetMemW(ES, I.regs.w[IY]); UINT32 dst = GetMemW(DS, I.regs.w[IX]); SUBW; I.regs.w[IY] += -4 * I.DF + 2; I.regs.w[IX] += -4 * I.DF + 2; CLKS(14,14,14); }
645OP( 0xa0, i_mov_aldisp ) { UINT32 addr; FETCHWORD(addr); I.regs.b[AL] = GetMemB(DS0, addr); CLKS(10,10,5); }
646OP( 0xa1, i_mov_axdisp ) { UINT32 addr; FETCHWORD(addr); I.regs.b[AL] = GetMemB(DS0, addr); I.regs.b[AH] = GetMemB(DS0, (addr+1)&0xffff); CLKW(14,14,7,14,10,5,addr); }
647OP( 0xa2, i_mov_dispal ) { UINT32 addr; FETCHWORD(addr); PutMemB(DS0, addr, I.regs.b[AL]);  CLKS(9,9,3); }
648OP( 0xa3, i_mov_dispax ) { UINT32 addr; FETCHWORD(addr); PutMemB(DS0, addr, I.regs.b[AL]);  PutMemB(DS0, (addr+1)&0xffff, I.regs.b[AH]); CLKW(13,13,5,13,9,3,addr); }
649OP( 0xa4, i_movsb      ) { UINT32 tmp = GetMemB(DS0,I.regs.w[IX]); PutMemB(DS1,I.regs.w[IY], tmp); I.regs.w[IY] += -2 * I.DF + 1; I.regs.w[IX] += -2 * I.DF + 1; CLKS(8,8,6); }
650OP( 0xa5, i_movsw      ) { UINT32 tmp = GetMemW(DS0,I.regs.w[IX]); PutMemW(DS1,I.regs.w[IY], tmp); I.regs.w[IY] += -4 * I.DF + 2; I.regs.w[IX] += -4 * I.DF + 2; CLKS(16,16,10); }
651OP( 0xa6, i_cmpsb      ) { UINT32 src = GetMemB(DS1, I.regs.w[IY]); UINT32 dst = GetMemB(DS0, I.regs.w[IX]); SUBB; I.regs.w[IY] += -2 * I.DF + 1; I.regs.w[IX] += -2 * I.DF + 1; CLKS(14,14,14); }
652OP( 0xa7, i_cmpsw      ) { UINT32 src = GetMemW(DS1, I.regs.w[IY]); UINT32 dst = GetMemW(DS0, I.regs.w[IX]); SUBW; I.regs.w[IY] += -4 * I.DF + 2; I.regs.w[IX] += -4 * I.DF + 2; CLKS(14,14,14); }
570653
571654OP( 0xa8, i_test_ald8  ) { DEF_ald8;  ANDB; CLKS(4,4,2); }
572655OP( 0xa9, i_test_axd16 ) { DEF_axd16; ANDW; CLKS(4,4,2); }
573OP( 0xaa, i_stosb      ) { PutMemB(ES,I.regs.w[IY],I.regs.b[AL]);    I.regs.w[IY] += -2 * I.DF + 1; CLKS(4,4,3);  }
574OP( 0xab, i_stosw      ) { PutMemW(ES,I.regs.w[IY],I.regs.w[AW]);    I.regs.w[IY] += -4 * I.DF + 2; CLKW(8,8,5,8,4,3,I.regs.w[IY]); }
575OP( 0xac, i_lodsb      ) { I.regs.b[AL] = GetMemB(DS,I.regs.w[IX]); I.regs.w[IX] += -2 * I.DF + 1; CLKS(4,4,3);  }
576OP( 0xad, i_lodsw      ) { I.regs.w[AW] = GetMemW(DS,I.regs.w[IX]); I.regs.w[IX] += -4 * I.DF + 2; CLKW(8,8,5,8,4,3,I.regs.w[IX]); }
577OP( 0xae, i_scasb      ) { UINT32 src = GetMemB(ES, I.regs.w[IY]);    UINT32 dst = I.regs.b[AL]; SUBB; I.regs.w[IY] += -2 * I.DF + 1; CLKS(4,4,3);  }
578OP( 0xaf, i_scasw      ) { UINT32 src = GetMemW(ES, I.regs.w[IY]);    UINT32 dst = I.regs.w[AW]; SUBW; I.regs.w[IY] += -4 * I.DF + 2; CLKW(8,8,5,8,4,3,I.regs.w[IY]); }
656OP( 0xaa, i_stosb      ) { PutMemB(DS1,I.regs.w[IY],I.regs.b[AL]);    I.regs.w[IY] += -2 * I.DF + 1; CLKS(4,4,3);  }
657OP( 0xab, i_stosw      ) { PutMemW(DS1,I.regs.w[IY],I.regs.w[AW]);    I.regs.w[IY] += -4 * I.DF + 2; CLKW(8,8,5,8,4,3,I.regs.w[IY]); }
658OP( 0xac, i_lodsb      ) { I.regs.b[AL] = GetMemB(DS0,I.regs.w[IX]); I.regs.w[IX] += -2 * I.DF + 1; CLKS(4,4,3);  }
659OP( 0xad, i_lodsw      ) { I.regs.w[AW] = GetMemW(DS0,I.regs.w[IX]); I.regs.w[IX] += -4 * I.DF + 2; CLKW(8,8,5,8,4,3,I.regs.w[IX]); }
660OP( 0xae, i_scasb      ) { UINT32 src = GetMemB(DS1, I.regs.w[IY]);    UINT32 dst = I.regs.b[AL]; SUBB; I.regs.w[IY] += -2 * I.DF + 1; CLKS(4,4,3);  }
661OP( 0xaf, i_scasw      ) { UINT32 src = GetMemW(DS1, I.regs.w[IY]);    UINT32 dst = I.regs.w[AW]; SUBW; I.regs.w[IY] += -4 * I.DF + 2; CLKW(8,8,5,8,4,3,I.regs.w[IY]); }
579662
580663OP( 0xb0, i_mov_ald8  ) { I.regs.b[AL] = FETCH;   CLKS(4,4,2); }
581664OP( 0xb1, i_mov_cld8  ) { I.regs.b[CL] = FETCH; CLKS(4,4,2); }
r869r870
631714
632715OP( 0xc2, i_ret_d16  ) { UINT32 count = FETCH; count += FETCH << 8; POP(I.ip); I.regs.w[SP]+=count; CHANGE_PC; CLKS(24,24,10); }
633716OP( 0xc3, i_ret      ) { POP(I.ip); CHANGE_PC; CLKS(19,19,10); }
634OP( 0xc4, i_les_dw   ) { GetModRM; WORD tmp = GetRMWord(ModRM); RegWord(ModRM)=tmp; I.sregs[ES] = GetnextRMWord; CLKW(26,26,14,26,18,10,EA); }
635OP( 0xc5, i_lds_dw   ) { GetModRM; WORD tmp = GetRMWord(ModRM); RegWord(ModRM)=tmp; I.sregs[DS] = GetnextRMWord; CLKW(26,26,14,26,18,10,EA); }
717OP( 0xc4, i_les_dw   ) { GetModRM; WORD tmp = GetRMWord(ModRM); RegWord(ModRM)=tmp; I.sregs[DS1] = GetnextRMWord; CLKW(26,26,14,26,18,10,EA); }
718OP( 0xc5, i_lds_dw   ) { GetModRM; WORD tmp = GetRMWord(ModRM); RegWord(ModRM)=tmp; I.sregs[DS0] = GetnextRMWord; CLKW(26,26,14,26,18,10,EA); }
636719OP( 0xc6, i_mov_bd8  ) { GetModRM; PutImmRMByte(ModRM); nec_ICount-=(ModRM >=0xc0 )?4:11; }
637720OP( 0xc7, i_mov_wd16 ) { GetModRM; PutImmRMWord(ModRM); nec_ICount-=(ModRM >=0xc0 )?4:15; }
638721
r869r870
657740   POP(I.regs.w[BP]);
658741   nec_ICount-=8;
659742}
660OP( 0xca, i_retf_d16  ) { UINT32 count = FETCH; count += FETCH << 8; POP(I.ip); POP(I.sregs[CS]); I.regs.w[SP]+=count; CHANGE_PC; CLKS(32,32,16); }
661OP( 0xcb, i_retf      ) { POP(I.ip); POP(I.sregs[CS]); CHANGE_PC; CLKS(29,29,16); }
743OP( 0xca, i_retf_d16  ) { UINT32 count = FETCH; count += FETCH << 8; POP(I.ip); POP(I.sregs[PS]); I.regs.w[SP]+=count; CHANGE_PC; CLKS(32,32,16); }
744OP( 0xcb, i_retf      ) { POP(I.ip); POP(I.sregs[PS]); CHANGE_PC; CLKS(29,29,16); }
662745OP( 0xcc, i_int3      ) { nec_interrupt(3,0); CLKS(50,50,24); }
663746OP( 0xcd, i_int       ) { nec_interrupt(FETCH,0); CLKS(50,50,24); }
664747OP( 0xce, i_into      ) { if (OF) { nec_interrupt(4,0); CLKS(52,52,26); } else CLK(3); }
665OP( 0xcf, i_iret      ) { POP(I.ip); POP(I.sregs[CS]); i_popf(); CHANGE_PC; CLKS(39,39,19); }
748OP( 0xcf, i_iret      ) { POP(I.ip); POP(I.sregs[PS]); i_popf(); CHANGE_PC; CLKS(39,39,19); }
666749
667750OP( 0xd0, i_rotshft_b ) {
668751   UINT32 src, dst; GetModRM; src = (UINT32)GetRMByte(ModRM); dst=src;
r869r870
729812OP( 0xd4, i_aam    ) { UINT32 mult=FETCH; mult=0; I.regs.b[AH] = I.regs.b[AL] / 10; I.regs.b[AL] %= 10; SetSZPF_Word(I.regs.w[AW]); CLKS(15,15,12); }
730813OP( 0xd5, i_aad    ) { UINT32 mult=FETCH; mult=0; I.regs.b[AL] = I.regs.b[AH] * 10 + I.regs.b[AL]; I.regs.b[AH] = 0; SetSZPF_Byte(I.regs.b[AL]); CLKS(7,7,8); }
731814OP( 0xd6, i_setalc ) { I.regs.b[AL] = (CF)?0xff:0x00; nec_ICount-=3; logerror("%06x: Undefined opcode (SETALC)\n",activecpu_get_pc()); }
732OP( 0xd7, i_trans  ) { UINT32 dest = (I.regs.w[BW]+I.regs.b[AL])&0xffff; I.regs.b[AL] = GetMemB(DS, dest); CLKS(9,9,5); }
815OP( 0xd7, i_trans  ) { UINT32 dest = (I.regs.w[BW]+I.regs.b[AL])&0xffff; I.regs.b[AL] = GetMemB(DS0, dest); CLKS(9,9,5); }
733816OP( 0xd8, i_fpo    ) { GetModRM; nec_ICount-=2;   logerror("%06x: Unimplemented floating point control %04x\n",activecpu_get_pc(),ModRM); }
734817
735818OP( 0xe0, i_loopne ) { INT8 disp = (INT8)FETCH; I.regs.w[CW]--; if (!ZF && I.regs.w[CW]) { I.ip = (WORD)(I.ip+disp); /*CHANGE_PC;*/ CLKS(14,14,6); } else CLKS(5,5,3); }
736819OP( 0xe1, i_loope  ) { INT8 disp = (INT8)FETCH; I.regs.w[CW]--; if ( ZF && I.regs.w[CW]) { I.ip = (WORD)(I.ip+disp); /*CHANGE_PC;*/ CLKS(14,14,6); } else CLKS(5,5,3); }
737820OP( 0xe2, i_loop   ) { INT8 disp = (INT8)FETCH; I.regs.w[CW]--; if (I.regs.w[CW]) { I.ip = (WORD)(I.ip+disp); /*CHANGE_PC;*/ CLKS(13,13,6); } else CLKS(5,5,3); }
738821OP( 0xe3, i_jcxz   ) { INT8 disp = (INT8)FETCH; if (I.regs.w[CW] == 0) { I.ip = (WORD)(I.ip+disp); /*CHANGE_PC;*/ CLKS(13,13,6); } else CLKS(5,5,3); }
739OP( 0xe4, i_inal   ) { UINT8 port = FETCH; I.regs.b[AL] = read_port(port); CLKS(9,9,5);   }
740OP( 0xe5, i_inax   ) { UINT8 port = FETCH; I.regs.b[AL] = read_port(port); I.regs.b[AH] = read_port(port+1); CLKW(13,13,7,13,9,5,port); }
741OP( 0xe6, i_outal  ) { UINT8 port = FETCH; write_port(port, I.regs.b[AL]); CLKS(8,8,3);   }
742OP( 0xe7, i_outax  ) { UINT8 port = FETCH; write_port(port, I.regs.b[AL]); write_port(port+1, I.regs.b[AH]); CLKW(12,12,5,12,8,3,port);   }
822OP( 0xe4, i_inal   ) { UINT8 port = FETCH; I.regs.b[AL] = read_port_byte(port); CLKS(9,9,5);   }
823OP( 0xe5, i_inax   ) { UINT8 port = FETCH; I.regs.w[AW] = read_port_word(port); CLKW(13,13,7,13,9,5,port); }
824OP( 0xe6, i_outal  ) { UINT8 port = FETCH; write_port_byte(port, I.regs.b[AL]); CLKS(8,8,3);   }
825OP( 0xe7, i_outax  ) { UINT8 port = FETCH; write_port_word(port, I.regs.w[AW]); CLKW(12,12,5,12,8,3,port);   }
743826
744827OP( 0xe8, i_call_d16 ) { UINT32 tmp; FETCHWORD(tmp); PUSH(I.ip); I.ip = (WORD)(I.ip+(INT16)tmp); CHANGE_PC; nec_ICount-=24; }
745828OP( 0xe9, i_jmp_d16  ) { UINT32 tmp; FETCHWORD(tmp); I.ip = (WORD)(I.ip+(INT16)tmp); CHANGE_PC; nec_ICount-=15; }
746OP( 0xea, i_jmp_far  ) { UINT32 tmp,tmp1; FETCHWORD(tmp); FETCHWORD(tmp1); I.sregs[CS] = (WORD)tmp1;    I.ip = (WORD)tmp; CHANGE_PC; nec_ICount-=27;  }
829OP( 0xea, i_jmp_far  ) { UINT32 tmp,tmp1; FETCHWORD(tmp); FETCHWORD(tmp1); I.sregs[PS] = (WORD)tmp1;    I.ip = (WORD)tmp; CHANGE_PC; nec_ICount-=27;  }
747830OP( 0xeb, i_jmp_d8   ) { int tmp = (int)((INT8)FETCH); nec_ICount-=12;
748831   if (tmp==-2 && I.no_interrupt==0 && (I.pending_irq==0) && nec_ICount>0) nec_ICount%=12; /* cycle skip */
749832   I.ip = (WORD)(I.ip+tmp);
750833}
751OP( 0xec, i_inaldx   ) { I.regs.b[AL] = read_port(I.regs.w[DW]); CLKS(8,8,5);}
752OP( 0xed, i_inaxdx   ) { UINT32 port = I.regs.w[DW];   I.regs.b[AL] = read_port(port);   I.regs.b[AH] = read_port(port+1); CLKW(12,12,7,12,8,5,port); }
753OP( 0xee, i_outdxal  ) { write_port(I.regs.w[DW], I.regs.b[AL]); CLKS(8,8,3);   }
754OP( 0xef, i_outdxax  ) { UINT32 port = I.regs.w[DW];   write_port(port, I.regs.b[AL]);   write_port(port+1, I.regs.b[AH]); CLKW(12,12,5,12,8,3,port); }
834OP( 0xec, i_inaldx   ) { I.regs.b[AL] = read_port_byte(I.regs.w[DW]); CLKS(8,8,5);}
835OP( 0xed, i_inaxdx   ) { I.regs.w[AW] = read_port_word(I.regs.w[DW]); CLKW(12,12,7,12,8,5,I.regs.w[DW]); }
836OP( 0xee, i_outdxal  ) { write_port_byte(I.regs.w[DW], I.regs.b[AL]); CLKS(8,8,3);   }
837OP( 0xef, i_outdxax  ) { write_port_word(I.regs.w[DW], I.regs.w[AW]); CLKW(12,12,5,12,8,3,I.regs.w[DW]); }
755838
756839OP( 0xf0, i_lock     ) { logerror("%06x: Warning - BUSLOCK\n",activecpu_get_pc()); I.no_interrupt=1; CLK(2); }
757840OP( 0xf2, i_repne    ) { UINT32 next = FETCHOP; UINT16 c = I.regs.w[CW];
758841    switch(next) { /* Segments */
759       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[ES]<<4;   next = FETCHOP;   CLK(2); break;
760       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[CS]<<4;   next = FETCHOP;   CLK(2); break;
842       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[DS1]<<4;   next = FETCHOP;   CLK(2); break;
843       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[PS]<<4;   next = FETCHOP;   CLK(2); break;
761844       case 0x36:   seg_prefix=TRUE;   prefix_base=I.sregs[SS]<<4;   next = FETCHOP;   CLK(2); break;
762       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS]<<4;   next = FETCHOP;   CLK(2); break;
845       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS0]<<4;   next = FETCHOP;   CLK(2); break;
763846   }
764847
765848    switch(next) {
r869r870
783866}
784867OP( 0xf3, i_repe     ) { UINT32 next = FETCHOP; UINT16 c = I.regs.w[CW];
785868    switch(next) { /* Segments */
786       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[ES]<<4;   next = FETCHOP;   CLK(2); break;
787       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[CS]<<4;   next = FETCHOP;   CLK(2); break;
869       case 0x26:   seg_prefix=TRUE;   prefix_base=I.sregs[DS1]<<4;   next = FETCHOP;   CLK(2); break;
870       case 0x2e:   seg_prefix=TRUE;   prefix_base=I.sregs[PS]<<4;   next = FETCHOP;   CLK(2); break;
788871       case 0x36:   seg_prefix=TRUE;   prefix_base=I.sregs[SS]<<4;   next = FETCHOP;   CLK(2); break;
789       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS]<<4;   next = FETCHOP;   CLK(2); break;
872       case 0x3e:   seg_prefix=TRUE;   prefix_base=I.sregs[DS0]<<4;   next = FETCHOP;   CLK(2); break;
790873   }
791874
792875    switch(next) {
r869r870
856939       case 0x00: tmp1 = tmp+1; I.OverVal = (tmp==0x7fff); SetAF(tmp1,tmp,1); SetSZPF_Word(tmp1); PutbackRMWord(ModRM,(WORD)tmp1); CLKM(2,2,2,24,16,7); break; /* INC */
857940      case 0x08: tmp1 = tmp-1; I.OverVal = (tmp==0x8000); SetAF(tmp1,tmp,1); SetSZPF_Word(tmp1); PutbackRMWord(ModRM,(WORD)tmp1); CLKM(2,2,2,24,16,7); break; /* DEC */
858941      case 0x10: PUSH(I.ip);   I.ip = (WORD)tmp; CHANGE_PC; nec_ICount-=(ModRM >=0xc0 )?16:20; break; /* CALL */
859      case 0x18: tmp1 = I.sregs[CS]; I.sregs[CS] = GetnextRMWord; PUSH(tmp1); PUSH(I.ip); I.ip = tmp; CHANGE_PC; nec_ICount-=(ModRM >=0xc0 )?16:26; break; /* CALL FAR */
942      case 0x18: tmp1 = I.sregs[PS]; I.sregs[PS] = GetnextRMWord; PUSH(tmp1); PUSH(I.ip); I.ip = tmp; CHANGE_PC; nec_ICount-=(ModRM >=0xc0 )?16:26; break; /* CALL FAR */
860943      case 0x20: I.ip = tmp; CHANGE_PC; nec_ICount-=13; break; /* JMP */
861      case 0x28: I.ip = tmp; I.sregs[CS] = GetnextRMWord; CHANGE_PC; nec_ICount-=15; break; /* JMP FAR */
944      case 0x28: I.ip = tmp; I.sregs[PS] = GetnextRMWord; CHANGE_PC; nec_ICount-=15; break; /* JMP FAR */
862945      case 0x30: PUSH(tmp); nec_ICount-=4; break;
863946      default:   logerror("%06x: FF Pre with unimplemented mod\n",activecpu_get_pc());
864947   }
r869r870
9471030   I.irq_callback = irqcallback;
9481031}
9491032
1033
1034/*****************************************************************************
1035    8-bit memory accessors
1036 *****************************************************************************/
1037
1038static UINT16 read_word_8(offs_t addr)
1039{
1040   UINT16 result = program_read_byte_8(addr);
1041   return result | (program_read_byte_8(addr + 1) << 8);
1042}
1043
1044static void write_word_8(offs_t addr, UINT16 data)
1045{
1046   program_write_byte_8(addr, data);
1047   program_write_byte_8(addr + 1, data >> 8);
1048}
1049
1050static UINT16 read_port_word_8(offs_t addr)
1051{
1052   UINT16 result = io_read_byte_8(addr);
1053   return result | (io_read_byte_8(addr + 1) << 8);
1054}
1055
1056static void write_port_word_8(offs_t addr, UINT16 data)
1057{
1058   io_write_byte_8(addr, data);
1059   io_write_byte_8(addr + 1, data >> 8);
1060}
1061
1062static void configure_memory_8bit(void)
1063{
1064   I.mem.fetch_xor = 0;
1065
1066   I.mem.rbyte = program_read_byte_8;
1067   I.mem.rword = read_word_8;
1068   I.mem.wbyte = program_write_byte_8;
1069   I.mem.wword = write_word_8;
1070
1071   I.mem.rbyte_port = io_read_byte_8;
1072   I.mem.rword_port = read_port_word_8;
1073   I.mem.wbyte_port = io_write_byte_8;
1074   I.mem.wword_port = write_port_word_8;
1075}
1076
1077
1078/*****************************************************************************
1079    16-bit memory accessors
1080 *****************************************************************************/
1081
1082static UINT16 read_word_16le(offs_t addr)
1083{
1084   if (!(addr & 1))
1085      return program_read_word_16le(addr);
1086   else
1087   {
1088      UINT16 result = program_read_byte_16le(addr);
1089      return result | (program_read_byte_16le(addr + 1) << 8);
1090   }
1091}
1092
1093static void write_word_16le(offs_t addr, UINT16 data)
1094{
1095   if (!(addr & 1))
1096      program_write_word_16le(addr, data);
1097   else
1098   {
1099      program_write_byte_16le(addr, data);
1100      program_write_byte_16le(addr + 1, data >> 8);
1101   }
1102}
1103
1104static UINT16 read_port_word_16le(offs_t addr)
1105{
1106   if (!(addr & 1))
1107      return io_read_word_16le(addr);
1108   else
1109   {
1110      UINT16 result = io_read_byte_16le(addr);
1111      return result | (io_read_byte_16le(addr + 1) << 8);
1112   }
1113}
1114
1115static void write_port_word_16le(offs_t addr, UINT16 data)
1116{
1117   if (!(addr & 1))
1118      io_write_word_16le(addr, data);
1119   else
1120   {
1121      io_write_byte_16le(addr, data);
1122      io_write_byte_16le(addr + 1, data >> 8);
1123   }
1124}
1125
1126static void configure_memory_16bit(void)
1127{
1128   I.mem.fetch_xor = BYTE_XOR_LE(0);
1129
1130   I.mem.rbyte = program_read_byte_16le;
1131   I.mem.rword = read_word_16le;
1132   I.mem.wbyte = program_write_byte_16le;
1133   I.mem.wword = write_word_16le;
1134
1135   I.mem.rbyte_port = io_read_byte_16le;
1136   I.mem.rword_port = read_port_word_16le;
1137   I.mem.wbyte_port = io_write_byte_16le;
1138   I.mem.wword_port = write_port_word_16le;
1139}
1140
1141
9501142/* Wrappers for the different CPU types */
9511143#if (HAS_V20)
952void v20_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 0); }
1144void v20_init(int index, int clock, const void *config, int (*irqcallback)(int))
1145{
1146   nec_init(index, clock, config, irqcallback, 0);
1147   configure_memory_8bit();
1148}
9531149int v20_execute(int cycles)
9541150{
9551151   nec_ICount=cycles;
r869r870
9771173#endif
9781174
9791175#if (HAS_V30)
980void v30_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 1); }
1176void v30_init(int index, int clock, const void *config, int (*irqcallback)(int))
1177{
1178   nec_init(index, clock, config, irqcallback, 1);
1179   configure_memory_16bit();
1180}
9811181int v30_execute(int cycles) {
9821182   nec_ICount=cycles;
9831183   cpu_type=V30;
r869r870
10041204#endif
10051205
10061206#if (HAS_V33)
1007void v33_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 2); }
1207void v33_init(int index, int clock, const void *config, int (*irqcallback)(int))
1208{
1209   nec_init(index, clock, config, irqcallback, 2);
1210   configure_memory_16bit();
1211}
10081212int v33_execute(int cycles)
10091213{
10101214   nec_ICount=cycles;
r869r870
10481252
10491253      case CPUINFO_INT_PC:
10501254      case CPUINFO_INT_REGISTER + NEC_PC:
1051         if( info->i - (I.sregs[CS]<<4) < 0x10000 )
1255         if( info->i - (I.sregs[PS]<<4) < 0x10000 )
10521256         {
1053            I.ip = info->i - (I.sregs[CS]<<4);
1257            I.ip = info->i - (I.sregs[PS]<<4);
10541258         }
10551259         else
10561260         {
1057            I.sregs[CS] = info->i >> 4;
1261            I.sregs[PS] = info->i >> 4;
10581262            I.ip = info->i & 0x0000f;
10591263         }
10601264         break;
r869r870
10791283      case CPUINFO_INT_REGISTER + NEC_BP:            I.regs.w[BP] = info->i;               break;
10801284      case CPUINFO_INT_REGISTER + NEC_IX:            I.regs.w[IX] = info->i;               break;
10811285      case CPUINFO_INT_REGISTER + NEC_IY:            I.regs.w[IY] = info->i;               break;
1082      case CPUINFO_INT_REGISTER + NEC_ES:            I.sregs[ES] = info->i;               break;
1083      case CPUINFO_INT_REGISTER + NEC_CS:            I.sregs[CS] = info->i;               break;
1286      case CPUINFO_INT_REGISTER + NEC_ES:            I.sregs[DS1] = info->i;               break;
1287      case CPUINFO_INT_REGISTER + NEC_CS:            I.sregs[PS] = info->i;               break;
10841288      case CPUINFO_INT_REGISTER + NEC_SS:            I.sregs[SS] = info->i;               break;
1085      case CPUINFO_INT_REGISTER + NEC_DS:            I.sregs[DS] = info->i;               break;
1289      case CPUINFO_INT_REGISTER + NEC_DS:            I.sregs[DS0] = info->i;               break;
10861290      case CPUINFO_INT_REGISTER + NEC_VECTOR:         I.int_vector = info->i;               break;
10871291   }
10881292}
r869r870
11101314      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
11111315      case CPUINFO_INT_MAX_CYCLES:               info->i = 80;                     break;
11121316
1113      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1317      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
11141318      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
11151319      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
11161320      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
11171321      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
11181322      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1119      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1323      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
11201324      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
11211325      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
11221326
r869r870
11261330      case CPUINFO_INT_PREVIOUSPC:               /* not supported */                  break;
11271331
11281332      case CPUINFO_INT_PC:
1129      case CPUINFO_INT_REGISTER + NEC_PC:            info->i = ((I.sregs[CS]<<4) + I.ip);   break;
1333      case CPUINFO_INT_REGISTER + NEC_PC:            info->i = ((I.sregs[PS]<<4) + I.ip);   break;
11301334      case CPUINFO_INT_REGISTER + NEC_IP:            info->i = I.ip;                     break;
11311335      case CPUINFO_INT_SP:                     info->i = (I.sregs[SS]<<4) + I.regs.w[SP]; break;
11321336      case CPUINFO_INT_REGISTER + NEC_SP:            info->i = I.regs.w[SP];               break;
r869r870
11381342      case CPUINFO_INT_REGISTER + NEC_BP:            info->i = I.regs.w[BP];               break;
11391343      case CPUINFO_INT_REGISTER + NEC_IX:            info->i = I.regs.w[IX];               break;
11401344      case CPUINFO_INT_REGISTER + NEC_IY:            info->i = I.regs.w[IY];               break;
1141      case CPUINFO_INT_REGISTER + NEC_ES:            info->i = I.sregs[ES];               break;
1142      case CPUINFO_INT_REGISTER + NEC_CS:            info->i = I.sregs[CS];               break;
1345      case CPUINFO_INT_REGISTER + NEC_ES:            info->i = I.sregs[DS1];               break;
1346      case CPUINFO_INT_REGISTER + NEC_CS:            info->i = I.sregs[PS];               break;
11431347      case CPUINFO_INT_REGISTER + NEC_SS:            info->i = I.sregs[SS];               break;
1144      case CPUINFO_INT_REGISTER + NEC_DS:            info->i = I.sregs[DS];               break;
1348      case CPUINFO_INT_REGISTER + NEC_DS:            info->i = I.sregs[DS0];               break;
11451349      case CPUINFO_INT_REGISTER + NEC_VECTOR:         info->i = I.int_vector;               break;
11461350      case CPUINFO_INT_REGISTER + NEC_PENDING:      info->i = I.pending_irq;            break;
11471351
r869r870
11871391                flags & 0x0001 ? 'C':'.');
11881392            break;
11891393
1190        case CPUINFO_STR_REGISTER + NEC_PC:            sprintf(info->s, "PC:%04X", (I.sregs[CS]<<4) + I.ip); break;
1394        case CPUINFO_STR_REGISTER + NEC_PC:            sprintf(info->s, "PC:%04X", (I.sregs[PS]<<4) + I.ip); break;
11911395        case CPUINFO_STR_REGISTER + NEC_IP:            sprintf(info->s, "IP:%04X", I.ip); break;
11921396        case CPUINFO_STR_REGISTER + NEC_SP:            sprintf(info->s, "SP:%04X", I.regs.w[SP]); break;
11931397        case CPUINFO_STR_REGISTER + NEC_FLAGS:         sprintf(info->s, "F:%04X", CompressFlags()); break;
r869r870
11981402        case CPUINFO_STR_REGISTER + NEC_BP:            sprintf(info->s, "BP:%04X", I.regs.w[BP]); break;
11991403        case CPUINFO_STR_REGISTER + NEC_IX:            sprintf(info->s, "IX:%04X", I.regs.w[IX]); break;
12001404        case CPUINFO_STR_REGISTER + NEC_IY:            sprintf(info->s, "IY:%04X", I.regs.w[IY]); break;
1201        case CPUINFO_STR_REGISTER + NEC_ES:            sprintf(info->s, "ES:%04X", I.sregs[ES]); break;
1202        case CPUINFO_STR_REGISTER + NEC_CS:            sprintf(info->s, "CS:%04X", I.sregs[CS]); break;
1405        case CPUINFO_STR_REGISTER + NEC_ES:            sprintf(info->s, "DS1:%04X", I.sregs[DS1]); break;
1406        case CPUINFO_STR_REGISTER + NEC_CS:            sprintf(info->s, "PS:%04X", I.sregs[PS]); break;
12031407        case CPUINFO_STR_REGISTER + NEC_SS:            sprintf(info->s, "SS:%04X", I.sregs[SS]); break;
1204        case CPUINFO_STR_REGISTER + NEC_DS:            sprintf(info->s, "DS:%04X", I.sregs[DS]); break;
1408        case CPUINFO_STR_REGISTER + NEC_DS:            sprintf(info->s, "DS0:%04X", I.sregs[DS0]); break;
12051409        case CPUINFO_STR_REGISTER + NEC_VECTOR:         sprintf(info->s, "V:%02X", I.int_vector); break;
12061410   }
12071411}
r869r870
12161420{
12171421   switch (state)
12181422   {
1423      /* --- the following bits of info are returned as 64-bit signed integers --- */
1424      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1425      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1426
12191427      /* --- the following bits of info are returned as pointers to data or functions --- */
12201428      case CPUINFO_PTR_INIT:                     info->init = v20_init;               break;
12211429      case CPUINFO_PTR_EXECUTE:                  info->execute = v20_execute;         break;
r869r870
12291437#endif
12301438
12311439
1440#if (HAS_V25)
1441/**************************************************************************
1442 * CPU-specific set_info
1443 **************************************************************************/
1444
1445void v25_get_info(UINT32 state, cpuinfo *info)
1446{
1447   switch (state)
1448   {
1449      /* --- the following bits of info are returned as 64-bit signed integers --- */
1450      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1451      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1452
1453      /* --- the following bits of info are returned as pointers to data or functions --- */
1454      case CPUINFO_PTR_INIT:                     info->init = v20_init;               break;
1455      case CPUINFO_PTR_EXECUTE:                  info->execute = v20_execute;         break;
1456
1457      /* --- the following bits of info are returned as NULL-terminated strings --- */
1458      case CPUINFO_STR_NAME:                     strcpy(info->s, "V25");               break;
1459
1460      default:                              nec_get_info(state, info);            break;
1461   }
1462}
1463#endif
1464
1465
12321466#if (HAS_V30)
12331467/**************************************************************************
12341468 * CPU-specific set_info
r869r870
12711505   }
12721506}
12731507#endif
1508
1509
1510#if (HAS_V35)
1511/**************************************************************************
1512 * CPU-specific set_info
1513 **************************************************************************/
1514
1515void v35_get_info(UINT32 state, cpuinfo *info)
1516{
1517   switch (state)
1518   {
1519      /* --- the following bits of info are returned as pointers to data or functions --- */
1520      case CPUINFO_PTR_INIT:                     info->init = v30_init;               break;
1521      case CPUINFO_PTR_EXECUTE:                  info->execute = v30_execute;         break;
1522
1523      /* --- the following bits of info are returned as NULL-terminated strings --- */
1524      case CPUINFO_STR_NAME:                     strcpy(info->s, "V35");               break;
1525
1526      default:                              nec_get_info(state, info);            break;
1527   }
1528}
1529#endif
src/emu/cpu/nec/necmodrm.h
r869r870
1313#define RegByte(ModRM) I.regs.b[Mod_RM.reg.b[ModRM]]
1414
1515#define GetRMWord(ModRM) \
16   ((ModRM) >= 0xc0 ? I.regs.w[Mod_RM.RM.w[ModRM]] : ( (*GetEA[ModRM])(), ReadWord( EA ) ))
16   ((ModRM) >= 0xc0 ? I.regs.w[Mod_RM.RM.w[ModRM]] : ( (*GetEA[ModRM])(), read_word( EA ) ))
1717
1818#define PutbackRMWord(ModRM,val)               \
1919{                           \
2020   if (ModRM >= 0xc0) I.regs.w[Mod_RM.RM.w[ModRM]]=val; \
21    else WriteWord(EA,val);  \
21    else write_word(EA,val);  \
2222}
2323
24#define GetnextRMWord ReadWord((EA&0xf0000)|((EA+2)&0xffff))
24#define GetnextRMWord read_word((EA&0xf0000)|((EA+2)&0xffff))
2525
2626#define PutRMWord(ModRM,val)            \
2727{                     \
r869r870
2929      I.regs.w[Mod_RM.RM.w[ModRM]]=val;   \
3030   else {                  \
3131      (*GetEA[ModRM])();         \
32      WriteWord( EA ,val);         \
32      write_word( EA ,val);         \
3333   }                  \
3434}
3535
r869r870
4141   else {                  \
4242      (*GetEA[ModRM])();         \
4343      FETCHWORD(val)            \
44      WriteWord( EA , val);         \
44      write_word( EA , val);         \
4545   }                  \
4646}
4747
4848#define GetRMByte(ModRM) \
49   ((ModRM) >= 0xc0 ? I.regs.b[Mod_RM.RM.b[ModRM]] : ReadByte( (*GetEA[ModRM])() ))
49   ((ModRM) >= 0xc0 ? I.regs.b[Mod_RM.RM.b[ModRM]] : read_byte( (*GetEA[ModRM])() ))
5050
5151#define PutRMByte(ModRM,val)            \
5252{                     \
5353   if (ModRM >= 0xc0)            \
5454      I.regs.b[Mod_RM.RM.b[ModRM]]=val;   \
5555   else                  \
56      WriteByte( (*GetEA[ModRM])() ,val);    \
56      write_byte( (*GetEA[ModRM])() ,val);    \
5757}
5858
5959#define PutImmRMByte(ModRM)             \
r869r870
6262      I.regs.b[Mod_RM.RM.b[ModRM]]=FETCH;    \
6363   else {                  \
6464      (*GetEA[ModRM])();         \
65      WriteByte( EA , FETCH );      \
65      write_byte( EA , FETCH );      \
6666   }                  \
6767}
6868
r869r870
7171   if (ModRM >= 0xc0)            \
7272      I.regs.b[Mod_RM.RM.b[ModRM]]=val;   \
7373   else                  \
74      WriteByte(EA,val);         \
74      write_byte(EA,val);         \
7575}
7676
7777#define DEF_br8                     \
src/emu/cpu/nec/nec.h
r869r870
1typedef enum { ES, CS, SS, DS } SREGS;
1#include "cpuintrf.h"
2
3typedef enum { DS1, PS, SS, DS0 } SREGS;
24typedef enum { AW, CW, DW, BW, SP, BP, IX, IY } WREGS;
35
46#define NEC_NMI_INT_VECTOR 2
r869r870
6668
6769/************************************************************************/
6870
69#define CHANGE_PC change_pc((I.sregs[CS]<<4) + I.ip)
71#define read_byte(a)         (*I.mem.rbyte)(a)
72#define read_word(a)         (*I.mem.rword)(a)
73#define write_byte(a,d)         (*I.mem.wbyte)((a),(d))
74#define write_word(a,d)         (*I.mem.wword)((a),(d))
7075
71#define SegBase(Seg) (I.sregs[Seg] << 4)
76#define read_port_byte(a)      (*I.mem.rbyte_port)(a)
77#define read_port_word(a)      (*I.mem.rword_port)(a)
78#define write_port_byte(a,d)   (*I.mem.wbyte_port)((a),(d))
79#define write_port_word(a,d)   (*I.mem.wword_port)((a),(d))
7280
73#define DefaultBase(Seg) ((seg_prefix && (Seg==DS || Seg==SS)) ? prefix_base : I.sregs[Seg] << 4)
81/************************************************************************/
7482
75#define GetMemB(Seg,Off) ((UINT8)program_read_byte_8((DefaultBase(Seg)+(Off))))
76#define GetMemW(Seg,Off) ((UINT16) program_read_byte_8((DefaultBase(Seg)+(Off))) + (program_read_byte_8((DefaultBase(Seg)+((Off)+1)))<<8) )
83#define CHANGE_PC change_pc((I.sregs[PS]<<4) + I.ip)
7784
78#define PutMemB(Seg,Off,x) { program_write_byte_8((DefaultBase(Seg)+(Off)),(x)); }
79#define PutMemW(Seg,Off,x) { PutMemB(Seg,Off,(x)&0xff); PutMemB(Seg,(Off)+1,(BYTE)((x)>>8)); }
85#define SegBase(Seg) (I.sregs[Seg] << 4)
8086
81/* Todo:  Remove these later - plus readword could overflow */
82#define ReadByte(ea) ((BYTE)program_read_byte_8((ea)))
83#define ReadWord(ea) (program_read_byte_8((ea))+(program_read_byte_8(((ea)+1))<<8))
84#define WriteByte(ea,val) { program_write_byte_8((ea),val); }
85#define WriteWord(ea,val) { program_write_byte_8((ea),(BYTE)(val)); program_write_byte_8(((ea)+1),(val)>>8); }
87#define DefaultBase(Seg) ((seg_prefix && (Seg==DS0 || Seg==SS)) ? prefix_base : I.sregs[Seg] << 4)
8688
87#define read_port(port) io_read_byte_8(port)
88#define write_port(port,val) io_write_byte_8(port,val)
89#define GetMemB(Seg,Off) (read_byte(DefaultBase(Seg) + (Off)))
90#define GetMemW(Seg,Off) (read_word(DefaultBase(Seg) + (Off)))
8991
90#define FETCH (cpu_readop_arg((I.sregs[CS]<<4)+I.ip++))
91#define FETCHOP (cpu_readop((I.sregs[CS]<<4)+I.ip++))
92#define FETCHWORD(var) { var=cpu_readop_arg((((I.sregs[CS]<<4)+I.ip)))+(cpu_readop_arg((((I.sregs[CS]<<4)+I.ip+1)))<<8); I.ip+=2; }
93#define PUSH(val) { I.regs.w[SP]-=2; WriteWord((((I.sregs[SS]<<4)+I.regs.w[SP])),val); }
94#define POP(var) { var = ReadWord((((I.sregs[SS]<<4)+I.regs.w[SP]))); I.regs.w[SP]+=2; }
95#define PEEK(addr) ((BYTE)cpu_readop_arg(addr))
96#define PEEKOP(addr) ((BYTE)cpu_readop(addr))
92#define PutMemB(Seg,Off,x) { write_byte(DefaultBase(Seg) + (Off), (x)); }
93#define PutMemW(Seg,Off,x) { write_word(DefaultBase(Seg) + (Off), (x)); }
9794
98#define GetModRM UINT32 ModRM=cpu_readop_arg((I.sregs[CS]<<4)+I.ip++)
95#define FETCH_XOR(a)      ((a) ^ I.mem.fetch_xor)
96#define FETCH (cpu_readop_arg(FETCH_XOR((I.sregs[PS]<<4)+I.ip++)))
97#define FETCHOP (cpu_readop(FETCH_XOR((I.sregs[PS]<<4)+I.ip++)))
98#define FETCHWORD(var) { var=cpu_readop_arg(FETCH_XOR((I.sregs[PS]<<4)+I.ip))+(cpu_readop_arg(FETCH_XOR((I.sregs[PS]<<4)+I.ip+1))<<8); I.ip+=2; }
99#define PUSH(val) { I.regs.w[SP]-=2; write_word((((I.sregs[SS]<<4)+I.regs.w[SP])),val); }
100#define POP(var) { var = read_word((((I.sregs[SS]<<4)+I.regs.w[SP]))); I.regs.w[SP]+=2; }
101#define PEEK(addr) ((BYTE)cpu_readop_arg(FETCH_XOR(addr)))
102#define PEEKOP(addr) ((BYTE)cpu_readop(FETCH_XOR(addr)))
99103
104#define GetModRM UINT32 ModRM=cpu_readop_arg(FETCH_XOR((I.sregs[PS]<<4)+I.ip++))
105
100106/* Cycle count macros:
101107    CLK  - cycle count is the same on all processors
102108    CLKS - cycle count differs between processors, list all counts
r869r870
199205   }                              \
200206   else {                           \
201207      (*GetEA[ModRM])();               \
202      tmp=ReadByte(EA);               \
208      tmp=read_byte(EA);               \
203209    }
204210
205211#define BITOP_WORD                     \
r869r870
209215   }                              \
210216   else {                           \
211217      (*GetEA[ModRM])();               \
212      tmp=ReadWord(EA);               \
218      tmp=read_word(EA);               \
213219    }
214220
215221#define BIT_NOT                        \
r869r870
289295   I.ZeroVal = I.CarryVal = 0;                        \
290296   for (i=0;i<count;i++) {                           \
291297      nec_ICount-=table[cpu_type/8];                  \
292      tmp = GetMemB(DS, si);                        \
293      tmp2 = GetMemB(ES, di);                        \
298      tmp = GetMemB(DS0, si);                        \
299      tmp2 = GetMemB(DS1, di);                        \
294300      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
295301      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
296302      result = v1+v2+I.CarryVal;                     \
297303      I.CarryVal = result > 99 ? 1 : 0;               \
298304      result = result % 100;                        \
299305      v1 = ((result/10)<<4) | (result % 10);            \
300      PutMemB(ES, di,v1);                           \
306      PutMemB(DS1, di,v1);                           \
301307      if (v1) I.ZeroVal = 1;                        \
302308      si++;                                    \
303309      di++;                                    \
r869r870
314320   I.ZeroVal = I.CarryVal = 0;                        \
315321   for (i=0;i<count;i++) {                           \
316322      nec_ICount-=table[cpu_type/8];                  \
317      tmp = GetMemB(ES, di);                        \
318      tmp2 = GetMemB(DS, si);                        \
323      tmp = GetMemB(DS1, di);                        \
324      tmp2 = GetMemB(DS0, si);                        \
319325      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
320326      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
321327      if (v1 < (v2+I.CarryVal)) {                     \
r869r870
327333         I.CarryVal = 0;                           \
328334      }                                       \
329335      v1 = ((result/10)<<4) | (result % 10);            \
330      PutMemB(ES, di,v1);                           \
336      PutMemB(DS1, di,v1);                           \
331337      if (v1) I.ZeroVal = 1;                        \
332338      si++;                                    \
333339      di++;                                    \
r869r870
344350   I.ZeroVal = I.CarryVal = 0;                        \
345351   for (i=0;i<count;i++) {                           \
346352      nec_ICount-=table[cpu_type/8];                  \
347      tmp = GetMemB(ES, di);                        \
348      tmp2 = GetMemB(DS, si);                        \
353      tmp = GetMemB(DS1, di);                        \
354      tmp2 = GetMemB(DS0, si);                        \
349355      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
350356      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
351357      if (v1 < (v2+I.CarryVal)) {                     \
src/emu/cpu/nec/necdasm.c
r0r870
1/*
2   NEC V-series Disassembler
3
4   Originally Written for i386 by Ville Linde
5   Converted to NEC-V by Aaron Giles
6*/
7
8#include "cpuintrf.h"
9
10enum {
11   PARAM_REG8 = 1,      /* 8-bit register */
12   PARAM_REG16,      /* 16-bit register */
13   PARAM_REG2_8,      /* 8-bit register */
14   PARAM_REG2_16,      /* 16-bit register */
15   PARAM_RM8,         /* 8-bit memory or register */
16   PARAM_RM16,         /* 16-bit memory or register */
17   PARAM_I4,         /* 4-bit signed immediate */
18   PARAM_I8,         /* 8-bit signed immediate */
19   PARAM_I16,         /* 16-bit signed immediate */
20   PARAM_UI8,         /* 8-bit unsigned immediate */
21   PARAM_UI16,         /* 16-bit unsigned immediate */
22   PARAM_IMM,         /* 16-bit immediate */
23   PARAM_ADDR,         /* 16:16 address */
24   PARAM_REL8,         /* 8-bit PC-relative displacement */
25   PARAM_REL16,      /* 16-bit PC-relative displacement */
26   PARAM_MEM_OFFS_B,   /* 8-bit mem offset */
27   PARAM_MEM_OFFS_W,   /* 16-bit mem offset */
28   PARAM_SREG,         /* segment register */
29   PARAM_RBANK,      /* register bank (V25) */
30   PARAM_1,         /* used by shift/rotate instructions */
31   PARAM_AL,
32   PARAM_CL,
33   PARAM_DL,
34   PARAM_BL,
35   PARAM_AH,
36   PARAM_CH,
37   PARAM_DH,
38   PARAM_BH,
39   PARAM_AW,
40   PARAM_CW,
41   PARAM_DW,
42   PARAM_BW,
43   PARAM_SP,
44   PARAM_BP,
45   PARAM_IX,
46   PARAM_IY
47};
48
49enum {
50   MODRM = 1,
51   GROUP,
52   FPU,
53   TWO_BYTE,
54   PREFIX,
55   SEG_PS,
56   SEG_DS0,
57   SEG_DS1,
58   SEG_SS
59};
60
61typedef struct {
62   char mnemonic[32];
63   UINT32 flags;
64   UINT32 param1;
65   UINT32 param2;
66   UINT32 param3;
67   offs_t dasm_flags;
68} I386_OPCODE;
69
70typedef struct {
71   char mnemonic[32];
72   const I386_OPCODE *opcode;
73} GROUP_OP;
74
75static const UINT8 *opcode_ptr;
76static const UINT8 *opcode_ptr_base;
77
78static const I386_OPCODE necv_opcode_table1[256] =
79{
80   // 0x00
81   {"add",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
82   {"add",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
83   {"add",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
84   {"add",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
85   {"add",            0,            PARAM_AL,         PARAM_UI8,         0            },
86   {"add",            0,            PARAM_AW,         PARAM_IMM,         0            },
87   {"push    ds1",      0,            0,               0,               0            },
88   {"pop     ds1",      0,            0,               0,               0            },
89   {"or",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
90   {"or",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
91   {"or",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
92   {"or",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
93   {"or",            0,            PARAM_AL,         PARAM_UI8,         0            },
94   {"or",            0,            PARAM_AW,         PARAM_IMM,         0            },
95   {"push    ps",      0,            0,               0,               0            },
96   {"two_byte",      TWO_BYTE,      0,               0,               0            },
97   // 0x10
98   {"addc",         MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
99   {"addc",         MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
100   {"addc",         MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
101   {"addc",         MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
102   {"addc",         0,            PARAM_AL,         PARAM_UI8,         0            },
103   {"addc",         0,            PARAM_AW,         PARAM_IMM,         0            },
104   {"push    ss",      0,            0,               0,               0            },
105   {"pop     ss",      0,            0,               0,               0            },
106   {"subc",         MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
107   {"subc",         MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
108   {"subc",         MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
109   {"subc",         MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
110   {"subc",         0,            PARAM_AL,         PARAM_UI8,         0            },
111   {"subc",         0,            PARAM_AW,         PARAM_IMM,         0            },
112   {"push    ds0",      0,            0,               0,               0            },
113   {"pop     ds0",      0,            0,               0,               0            },
114   // 0x20
115   {"and",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
116   {"and",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
117   {"and",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
118   {"and",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
119   {"and",            0,            PARAM_AL,         PARAM_UI8,         0            },
120   {"and",            0,            PARAM_AW,         PARAM_IMM,         0            },
121   {"ds1:",         SEG_DS1,      0,               0,               0            },
122   {"adj4a",         0,            0,               0,               0            },
123   {"sub",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
124   {"sub",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
125   {"sub",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
126   {"sub",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
127   {"sub",            0,            PARAM_AL,         PARAM_I8,         0            },
128   {"sub",            0,            PARAM_AW,         PARAM_IMM,         0            },
129   {"ps:",            SEG_PS,         0,               0,               0            },
130   {"adj4s",         0,            0,               0,               0            },
131   // 0x30
132   {"xor",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
133   {"xor",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
134   {"xor",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
135   {"xor",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
136   {"xor",            0,            PARAM_AL,         PARAM_UI8,         0            },
137   {"xor",            0,            PARAM_AW,         PARAM_IMM,         0            },
138   {"ss:",            SEG_SS,         0,               0,               0            },
139   {"adjba",         0,            0,               0,               0            },
140   {"cmp",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
141   {"cmp",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
142   {"cmp",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
143   {"cmp",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
144   {"cmp",            0,            PARAM_AL,         PARAM_UI8,         0            },
145   {"cmp",            0,            PARAM_AW,         PARAM_IMM,         0            },
146   {"ds0:",         SEG_DS0,      0,               0,               0            },
147   {"adjbs",         0,            0,               0,               0            },
148   // 0x40
149   {"inc",            0,            PARAM_AW,         0,               0            },
150   {"inc",            0,            PARAM_CW,         0,               0            },
151   {"inc",            0,            PARAM_DW,         0,               0            },
152   {"inc",            0,            PARAM_BW,         0,               0            },
153   {"inc",            0,            PARAM_SP,         0,               0            },
154   {"inc",            0,            PARAM_BP,         0,               0            },
155   {"inc",            0,            PARAM_IX,         0,               0            },
156   {"inc",            0,            PARAM_IY,         0,               0            },
157   {"dec",            0,            PARAM_AW,         0,               0            },
158   {"dec",            0,            PARAM_CW,         0,               0            },
159   {"dec",            0,            PARAM_DW,         0,               0            },
160   {"dec",            0,            PARAM_BW,         0,               0            },
161   {"dec",            0,            PARAM_SP,         0,               0            },
162   {"dec",            0,            PARAM_BP,         0,               0            },
163   {"dec",            0,            PARAM_IX,         0,               0            },
164   {"dec",            0,            PARAM_IY,         0,               0            },
165   // 0x50
166   {"push",         0,            PARAM_AW,         0,               0            },
167   {"push",         0,            PARAM_CW,         0,               0            },
168   {"push",         0,            PARAM_DW,         0,               0            },
169   {"push",         0,            PARAM_BW,         0,               0            },
170   {"push",         0,            PARAM_SP,         0,               0            },
171   {"push",         0,            PARAM_BP,         0,               0            },
172   {"push",         0,            PARAM_IX,         0,               0            },
173   {"push",         0,            PARAM_IY,         0,               0            },
174   {"pop",            0,            PARAM_AW,         0,               0            },
175   {"pop",            0,            PARAM_CW,         0,               0            },
176   {"pop",            0,            PARAM_DW,         0,               0            },
177   {"pop",            0,            PARAM_BW,         0,               0            },
178   {"pop",            0,            PARAM_SP,         0,               0            },
179   {"pop",            0,            PARAM_BP,         0,               0            },
180   {"pop",            0,            PARAM_IX,         0,               0            },
181   {"pop",            0,            PARAM_IY,         0,               0            },
182   // 0x60
183   {"push    r",      0,            0,               0,               0            },
184   {"pop     r",      0,            0,               0,               0            },
185   {"chkind",         MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
186   {"brkn",         MODRM,         PARAM_RM16,         PARAM_REG16,      0            },   /* break into native */
187   {"repnc",         PREFIX,         0,               0,               0            },
188   {"repc",         PREFIX,         0,               0,               0            },
189   {"fpo2    0",      0,/*OP_SIZE*/   0,               0,               0            },
190   {"fpo2    1",      0,/*ADDR_SIZE*/   0,               0,               0            },
191   {"push",         0,            PARAM_IMM,         0,               0            },
192   {"mul",            MODRM,         PARAM_REG16,      PARAM_RM16,         PARAM_IMM      },
193   {"push",         0,            PARAM_I8,         0,               0            },
194   {"mul",            MODRM,         PARAM_REG16,      PARAM_RM16,         PARAM_I8      },
195   {"inmb",         0,            0,               0,               0            },
196   {"inmw",         0,            0,               0,               0            },
197   {"outmb",         0,            0,               0,               0            },
198   {"outmw",         0,            0,               0,               0            },
199   // 0x70
200   {"bv",            0,            PARAM_REL8,         0,               0            },
201   {"bnv",            0,            PARAM_REL8,         0,               0            },
202   {"bc",            0,            PARAM_REL8,         0,               0            },
203   {"bnc",            0,            PARAM_REL8,         0,               0            },
204   {"be",            0,            PARAM_REL8,         0,               0            },
205   {"bne",            0,            PARAM_REL8,         0,               0            },
206   {"bnh",            0,            PARAM_REL8,         0,               0            },
207   {"bh",            0,            PARAM_REL8,         0,               0            },
208   {"bn",            0,            PARAM_REL8,         0,               0            },
209   {"bp",            0,            PARAM_REL8,         0,               0            },
210   {"bpe",            0,            PARAM_REL8,         0,               0            },
211   {"bpo",            0,            PARAM_REL8,         0,               0            },
212   {"blt",            0,            PARAM_REL8,         0,               0            },
213   {"bge",            0,            PARAM_REL8,         0,               0            },
214   {"ble",            0,            PARAM_REL8,         0,               0            },
215   {"bgt",            0,            PARAM_REL8,         0,               0            },
216   // 0x80
217   {"immb",         GROUP,         0,               0,               0            },
218   {"immw",         GROUP,         0,               0,               0            },
219   {"immb",         GROUP,         0,               0,               0            },
220   {"immws",         GROUP,         0,               0,               0            },
221   {"test",         MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
222   {"test",         MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
223   {"xch",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
224   {"xch",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
225   {"mov",            MODRM,         PARAM_RM8,         PARAM_REG8,         0            },
226   {"mov",            MODRM,         PARAM_RM16,         PARAM_REG16,      0            },
227   {"mov",            MODRM,         PARAM_REG8,         PARAM_RM8,         0            },
228   {"mov",            MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
229   {"mov",            MODRM,         PARAM_RM16,         PARAM_SREG,         0            },
230   {"ldea",         MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
231   {"mov",            MODRM,         PARAM_SREG,         PARAM_RM16,         0            },
232   {"pop",            MODRM,         PARAM_RM16,         0,               0            },
233   // 0x90
234   {"nop",            0,            0,               0,               0            },
235   {"xch",            0,            PARAM_AW,         PARAM_CW,         0            },
236   {"xch",            0,            PARAM_AW,         PARAM_DW,         0            },
237   {"xch",            0,            PARAM_AW,         PARAM_BW,         0            },
238   {"xch",            0,            PARAM_AW,         PARAM_SP,         0            },
239   {"xch",            0,            PARAM_AW,         PARAM_BP,         0            },
240   {"xch",            0,            PARAM_AW,         PARAM_IX,         0            },
241   {"xch",            0,            PARAM_AW,         PARAM_IY,         0            },
242   {"cvtbw",         0,            0,               0,               0            },
243   {"cvtwl",         0,            0,               0,               0            },
244   {"call",         0,            PARAM_ADDR,         0,               0,            DASMFLAG_STEP_OVER},
245   {"poll",         0,            0,               0,               0            },
246   {"push    psw",      0,            0,               0,               0            },
247   {"pop     psw",      0,            0,               0,               0            },
248   {"mov     psw,ah",   0,            0,               0,               0            },
249   {"mov     ah,psw",   0,            0,               0,               0            },
250   // 0xa0
251   {"mov",            0,            PARAM_AL,         PARAM_MEM_OFFS_W,   0            },
252   {"mov",            0,            PARAM_AW,         PARAM_MEM_OFFS_W,   0            },
253   {"mov",            0,            PARAM_MEM_OFFS_W,   PARAM_AL,         0            },
254   {"mov",            0,            PARAM_MEM_OFFS_W,   PARAM_AW,         0            },
255   {"movbkb",         0,            0,               0,               0            },
256   {"movbkw",         0,            0,               0,               0            },
257   {"cmpbkb",         0,            0,               0,               0            },
258   {"cmpbkw",         0,            0,               0,               0            },
259   {"test",         0,            PARAM_AL,         PARAM_UI8,         0            },
260   {"test",         0,            PARAM_AW,         PARAM_IMM,         0            },
261   {"stmb",         0,            0,               0,               0            },
262   {"stmw",         0,            0,               0,               0            },
263   {"ldmb",         0,            0,               0,               0            },
264   {"ldmw",         0,            0,               0,               0            },
265   {"cmpmb",         0,            0,               0,               0            },
266   {"cmpmw",         0,            0,               0,               0            },
267   // 0xb0
268   {"mov",            0,            PARAM_AL,         PARAM_UI8,         0            },
269   {"mov",            0,            PARAM_CL,         PARAM_UI8,         0            },
270   {"mov",            0,            PARAM_DL,         PARAM_UI8,         0            },
271   {"mov",            0,            PARAM_BL,         PARAM_UI8,         0            },
272   {"mov",            0,            PARAM_AH,         PARAM_UI8,         0            },
273   {"mov",            0,            PARAM_CH,         PARAM_UI8,         0            },
274   {"mov",            0,            PARAM_DH,         PARAM_UI8,         0            },
275   {"mov",            0,            PARAM_BH,         PARAM_UI8,         0            },
276   {"mov",            0,            PARAM_AW,         PARAM_IMM,         0            },
277   {"mov",            0,            PARAM_CW,         PARAM_IMM,         0            },
278   {"mov",            0,            PARAM_DW,         PARAM_IMM,         0            },
279   {"mov",            0,            PARAM_BW,         PARAM_IMM,         0            },
280   {"mov",            0,            PARAM_SP,         PARAM_IMM,         0            },
281   {"mov",            0,            PARAM_BP,         PARAM_IMM,         0            },
282   {"mov",            0,            PARAM_IX,         PARAM_IMM,         0            },
283   {"mov",            0,            PARAM_IY,         PARAM_IMM,         0            },
284   // 0xc0
285   {"shiftbi",         GROUP,         0,               0,               0            },
286   {"shiftwi",         GROUP,         0,               0,               0            },
287   {"ret",            0,            PARAM_I16,         0,               0,            DASMFLAG_STEP_OUT},
288   {"ret",            0,            0,               0,               0,            DASMFLAG_STEP_OUT},
289   {"mov     ds1,",   MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
290   {"mov     ds0,",   MODRM,         PARAM_REG16,      PARAM_RM16,         0            },
291   {"mov",            MODRM,         PARAM_RM8,         PARAM_UI8,         0            },
292   {"mov",            MODRM,         PARAM_RM16,         PARAM_IMM,         0            },
293   {"prepare",         0,            PARAM_I16,         PARAM_UI8,         0            },
294   {"dispose",         0,            0,               0,               0            },
295   {"retf",         0,            PARAM_I16,         0,               0,            DASMFLAG_STEP_OUT},
296   {"retf",         0,            0,               0,               0,            DASMFLAG_STEP_OUT},
297   {"brk     3",      0,            0,               0,               0,            DASMFLAG_STEP_OVER},
298   {"brk",            0,            PARAM_UI8,         0,               0,            DASMFLAG_STEP_OVER},
299   {"brkv",         0,            0,               0,               0            },
300   {"reti",         0,            0,               0,               0,            DASMFLAG_STEP_OUT},
301   // 0xd0
302   {"shiftb",         GROUP,         0,               0,               0            },
303   {"shiftw",         GROUP,         0,               0,               0            },
304   {"shiftbv",         GROUP,         0,               0,               0            },
305   {"shiftwv",         GROUP,         0,               0,               0            },
306   {"cvtbd",         0,            PARAM_I8,         0,               0            },
307   {"cvtdb",         0,            PARAM_I8,         0,               0            },
308   {"???",            0,            0,               0,               0            },
309   {"trans",         0,            0,               0,               0            },
310   {"escape",         FPU,         0,               0,               0            },
311   {"escape",         FPU,         0,               0,               0            },
312   {"escape",         FPU,         0,               0,               0            },
313   {"escape",         FPU,         0,               0,               0            },
314   {"escape",         FPU,         0,               0,               0            },
315   {"escape",         FPU,         0,               0,               0            },
316   {"escape",         FPU,         0,               0,               0            },
317   {"escape",         FPU,         0,               0,               0            },
318   // 0xe0
319   {"dbnzne",         0,            PARAM_REL8,         0,               0,            DASMFLAG_STEP_OVER},
320   {"dbnze",         0,            PARAM_REL8,         0,               0,            DASMFLAG_STEP_OVER},
321   {"dbnz",         0,            PARAM_REL8,         0,               0,            DASMFLAG_STEP_OVER},
322   {"bcwz",         0,            PARAM_REL8,         0,               0            },
323   {"in",            0,            PARAM_AL,         PARAM_UI8,         0            },
324   {"in",            0,            PARAM_AW,         PARAM_UI8,         0            },
325   {"out",            0,            PARAM_UI8,         PARAM_AL,         0            },
326   {"out",            0,            PARAM_UI8,         PARAM_AW,         0            },
327   {"call",         0,            PARAM_REL16,      0,               0,            DASMFLAG_STEP_OVER},
328   {"br",            0,            PARAM_REL16,      0,               0            },
329   {"br",            0,            PARAM_ADDR,         0,               0            },
330   {"br",            0,            PARAM_REL8,         0,               0            },
331   {"in",            0,            PARAM_AL,         PARAM_DW,         0            },
332   {"in",            0,            PARAM_AW,         PARAM_DW,         0            },
333   {"out",            0,            PARAM_DW,         PARAM_AL,         0            },
334   {"out",            0,            PARAM_DW,         PARAM_AW,         0            },
335   // 0xf0
336   {"buslock",         PREFIX,         0,               0,               0            },
337   {"brks",         0,            0,               0,               0            },   /* break into secure mode */
338   {"repne",         PREFIX,         0,               0,               0            },
339   {"rep",            PREFIX,         0,               0,               0            },
340   {"halt",         0,            0,               0,               0            },
341   {"not1    cy",      0,            0,               0,               0            },
342   {"group1b",         GROUP,         0,               0,               0            },
343   {"group1w",         GROUP,         0,               0,               0            },
344   {"clr1    cy",      0,            0,               0,               0            },
345   {"set1    cy",      0,            0,               0,               0            },
346   {"di",            0,            0,               0,               0            },
347   {"ei",            0,            0,               0,               0            },
348   {"clr1    dir",      0,            0,               0,               0            },
349   {"set1    dir",      0,            0,               0,               0            },
350   {"group2b",         GROUP,         0,               0,               0            },
351   {"group2w",         GROUP,         0,               0,               0            }
352};
353
354static const I386_OPCODE necv_opcode_table2[256] =
355{
356   // 0x00
357   {"???",            0,            0,               0,               0            },
358   {"???",            0,            0,               0,               0            },
359   {"???",            0,            0,               0,               0            },
360   {"???",            0,            0,               0,               0            },
361   {"???",            0,            0,               0,               0            },
362   {"???",            0,            0,               0,               0            },
363   {"???",            0,            0,               0,               0            },
364   {"???",            0,            0,               0,               0            },
365   {"???",            0,            0,               0,               0            },
366   {"???",            0,            0,               0,               0            },
367   {"???",            0,            0,               0,               0            },
368   {"???",            0,            0,               0,               0            },
369   {"???",            0,            0,               0,               0            },
370   {"???",            0,            0,               0,               0            },
371   {"???",            0,            0,               0,               0            },
372   {"???",            0,            0,               0,               0            },
373   // 0x10 - NEC V series only
374   {"test1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
375   {"test1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
376   {"clr1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
377   {"clr1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
378   {"set1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
379   {"set1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
380   {"not1",         MODRM,         PARAM_RM8,         PARAM_1,         0            },
381   {"not1",         MODRM,         PARAM_RM16,         PARAM_1,         0            },
382   {"test1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
383   {"test1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
384   {"clr1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
385   {"clr1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
386   {"set1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
387   {"set1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
388   {"not1",         MODRM,         PARAM_RM8,         PARAM_I8,         0            },
389   {"not1",         MODRM,         PARAM_RM16,         PARAM_I8,         0            },
390   // 0x20
391   {"add4s",         0,            0,               0,               0            },
392   {"???",            0,            0,               0,               0            },
393   {"sub4s",         0,            0,               0,               0            },
394   {"???",            0,            0,               0,               0            },
395   {"???",            0,            0,               0,               0            },
396   {"movspa",         0,            0,               0,               0            },   /* V25/35 only */
397   {"cmp4s",         0,            0,               0,               0            },
398   {"???",            0,            0,               0,               0            },
399   {"rol4",         MODRM,         PARAM_RM8,         0,               0            },
400   {"???",            0,            0,               0,               0            },
401   {"ror4",         MODRM,         PARAM_RM8,         0,               0            },
402   {"???",            0,            0,               0,               0            },
403   {"???",            0,            0,               0,               0            },
404   {"brkcs",         MODRM,         PARAM_REG2_8,      0,               0            },   /* V25/35 only */
405   {"???",            0,            0,               0,               0            },
406   {"???",            0,            0,               0,               0            },
407   // 0x30
408   {"???",            0,            0,               0,               0            },
409   {"ins",            MODRM,         PARAM_REG2_8,      PARAM_REG8,         0            },
410   {"???",            0,            0,               0,               0            },
411   {"ext",            MODRM,         PARAM_REG2_8,      PARAM_REG8,         0            },
412   {"???",            0,            0,               0,               0            },
413   {"???",            0,            0,               0,               0            },
414   {"???",            0,            0,               0,               0            },
415   {"???",            0,            0,               0,               0            },
416   {"???",            0,            0,               0,               0            },
417   {"ins",            MODRM,         PARAM_REG2_8,      PARAM_I4,         0            },
418   {"???",            0,            0,               0,               0            },
419   {"ext",            MODRM,         PARAM_REG2_8,      PARAM_I4,         0            },
420   {"???",            0,            0,               0,               0            },
421   {"???",            0,            0,               0,               0            },
422   {"???",            0,            0,               0,               0            },
423   {"???",            0,            0,               0,               0            },
424   // 0x40
425   {"???",            0,            0,               0,               0            },
426   {"???",            0,            0,               0,               0            },
427   {"???",            0,            0,               0,               0            },
428   {"???",            0,            0,               0,               0            },
429   {"???",            0,            0,               0,               0            },
430   {"???",            0,            0,               0,               0            },
431   {"???",            0,            0,               0,               0            },
432   {"???",            0,            0,               0,               0            },
433   {"???",            0,            0,               0,               0            },
434   {"???",            0,            0,               0,               0            },
435   {"???",            0,            0,               0,               0            },
436   {"???",            0,            0,               0,               0            },
437   {"???",            0,            0,               0,               0            },
438   {"???",            0,            0,               0,               0            },
439   {"???",            0,            0,               0,               0            },
440   {"???",            0,            0,               0,               0            },
441   // 0x50
442   {"???",            0,            0,               0,               0            },
443   {"???",            0,            0,               0,               0            },
444   {"???",            0,            0,               0,               0            },
445   {"???",            0,            0,               0,               0            },
446   {"???",            0,            0,               0,               0            },
447   {"???",            0,            0,               0,               0            },
448   {"???",            0,            0,               0,               0            },
449   {"???",            0,            0,               0,               0            },
450   {"???",            0,            0,               0,               0            },
451   {"???",            0,            0,               0,               0            },
452   {"???",            0,            0,               0,               0            },
453   {"???",            0,            0,               0,               0            },
454   {"???",            0,            0,               0,               0            },
455   {"???",            0,            0,               0,               0            },
456   {"???",            0,            0,               0,               0            },
457   {"???",            0,            0,               0,               0            },
458   // 0x60
459   {"???",            0,            0,               0,               0            },
460   {"???",            0,            0,               0,               0            },
461   {"???",            0,            0,               0,               0            },
462   {"???",            0,            0,               0,               0            },
463   {"???",            0,            0,               0,               0            },
464   {"???",            0,            0,               0,               0            },
465   {"???",            0,            0,               0,               0            },
466   {"???",            0,            0,               0,               0            },
467   {"???",            0,            0,               0,               0            },
468   {"???",            0,            0,               0,               0            },
469   {"???",            0,            0,               0,               0            },
470   {"???",            0,            0,               0,               0            },
471   {"???",            0,            0,               0,               0            },
472   {"???",            0,            0,               0,               0            },
473   {"???",            0,            0,               0,               0            },
474   {"???",            0,            0,               0,               0            },
475   // 0x70
476   {"???",            0,            0,               0,               0            },
477   {"???",            0,            0,               0,               0            },
478   {"???",            0,            0,               0,               0            },
479   {"???",            0,            0,               0,               0            },
480   {"???",            0,            0,               0,               0            },
481   {"???",            0,            0,               0,               0            },
482   {"???",            0,            0,               0,               0            },
483   {"???",            0,            0,               0,               0            },
484   {"???",            0,            0,               0,               0            },
485   {"???",            0,            0,               0,               0            },
486   {"???",            0,            0,               0,               0            },
487   {"???",            0,            0,               0,               0            },
488   {"???",            0,            0,               0,               0            },
489   {"???",            0,            0,               0,               0            },
490   {"???",            0,            0,               0,               0            },
491   {"???",            0,            0,               0,               0            },
492   // 0x80
493   {"???",            0,            0,               0,               0            },
494   {"???",            0,            0,               0,               0            },
495   {"???",            0,            0,               0,               0            },
496   {"???",            0,            0,               0,               0            },
497   {"???",            0,            0,               0,               0            },
498   {"???",            0,            0,               0,               0            },
499   {"???",            0,            0,               0,               0            },
500   {"???",            0,            0,               0,               0            },
501   {"???",            0,            0,               0,               0            },
502   {"???",            0,            0,               0,               0            },
503   {"???",            0,            0,               0,               0            },
504   {"???",            0,            0,               0,               0            },
505   {"???",            0,            0,               0,               0            },
506   {"???",            0,            0,               0,               0            },
507   {"???",            0,            0,               0,               0            },
508   {"???",            0,            0,               0,               0            },
509   // 0x90
510   {"???",            0,            0,               0,               0            },
511   {"retrbi",         0,            0,               0,               0            },   /* V25/35 only */
512   {"fint",         0,            0,               0,               0            },   /* V25/35 only */
513   {"???",            0,            0,               0,               0            },
514   {"tsksw",         MODRM,         PARAM_REG2_8,      0,               0            },   /* V25/35 only */
515   {"movspb",         0,            PARAM_RBANK,      0,               0            },   /* V25/35 only */
516   {"???",            0,            0,               0,               0            },
517   {"???",            0,            0,               0,               0            },
518   {"???",            0,            0,               0,               0            },
519   {"???",            0,            0,               0,               0            },
520   {"???",            0,            0,               0,               0            },
521   {"???",            0,            0,               0,               0            },
522   {"btclr",         MODRM,         PARAM_REG2_8,      PARAM_I8,         PARAM_REL8      },   /* V25/35 only */
523   {"???",            0,            0,               0,               0            },
524   {"stop",         0,            0,               0,               0            },   /* V25/35 only */
525   {"???",            0,            0,               0,               0            },
526   // 0xa0
527   {"???",            0,            0,               0,               0            },
528   {"???",            0,            0,               0,               0            },
529   {"???",            0,            0,               0,               0            },
530   {"???",            0,            0,               0,               0            },
531   {"???",            0,            0,               0,               0            },
532   {"???",            0,            0,               0,               0            },
533   {"???",            0,            0,               0,               0            },
534   {"???",            0,            0,               0,               0            },
535   {"???",            0,            0,               0,               0            },
536   {"???",            0,            0,               0,               0            },
537   {"???",            0,            0,               0,               0            },
538   {"???",            0,            0,               0,               0            },
539   {"???",            0,            0,               0,               0            },
540   {"???",            0,            0,               0,               0            },
541   {"???",            0,            0,               0,               0            },
542   {"???",            0,            0,               0,               0            },
543   // 0xb0
544   {"???",            0,            0,               0,               0            },
545   {"???",            0,            0,               0,               0            },
546   {"???",            0,            0,               0,               0            },
547   {"???",            0,            0,               0,               0            },
548   {"???",            0,            0,               0,               0            },
549   {"???",            0,            0,               0,               0            },
550   {"???",            0,            0,               0,               0            },
551   {"???",            0,            0,               0,               0            },
552   {"???",            0,            0,               0,               0            },
553   {"???",            0,            0,               0,               0            },
554   {"???",            0,            0,               0,               0            },
555   {"???",            0,            0,               0,               0            },
556   {"???",            0,            0,               0,               0            },
557   {"???",            0,            0,               0,               0            },
558   {"???",            0,            0,               0,               0            },
559   {"???",            0,            0,               0,               0            },
560   // 0xc0
561   {"???",            0,            0,               0,               0            },
562   {"???",            0,            0,               0,               0            },
563   {"???",            0,            0,               0,               0            },
564   {"???",            0,            0,               0,               0            },
565   {"???",            0,            0,               0,               0            },
566   {"???",            0,            0,               0,               0            },
567   {"???",            0,            0,               0,               0            },
568   {"???",            0,            0,               0,               0            },
569   {"???",            0,            0,               0,               0            },
570   {"???",            0,            0,               0,               0            },
571   {"???",            0,            0,               0,               0            },
572   {"???",            0,            0,               0,               0            },
573   {"???",            0,            0,               0,               0            },
574   {"???",            0,            0,               0,               0            },
575   {"???",            0,            0,               0,               0            },
576   {"???",            0,            0,               0,               0            },
577   // 0xd0
578   {"???",            0,            0,               0,               0            },
579   {"???",            0,            0,               0,               0            },
580   {"???",            0,            0,               0,               0            },
581   {"???",            0,            0,               0,               0            },
582   {"???",            0,            0,               0,               0            },
583   {"???",            0,            0,               0,               0            },
584   {"???",            0,            0,               0,               0            },
585   {"???",            0,            0,               0,               0            },
586   {"???",            0,            0,               0,               0            },
587   {"???",            0,            0,               0,               0            },
588   {"???",            0,            0,               0,               0            },
589   {"???",            0,            0,               0,               0            },
590   {"???",            0,            0,               0,               0            },
591   {"???",            0,            0,               0,               0            },
592   {"???",            0,            0,               0,               0            },
593   {"???",            0,            0,               0,               0            },
594   // 0xe0
595   {"brkxa",         0,            PARAM_UI8,         0,               0            },   /* V33,53 only */
596   {"???",            0,            0,               0,               0            },
597   {"???",            0,            0,               0,               0            },
598   {"???",            0,            0,               0,               0            },
599   {"???",            0,            0,               0,               0            },
600   {"???",            0,            0,               0,               0            },
601   {"???",            0,            0,               0,               0            },
602   {"???",            0,            0,               0,               0            },
603   {"???",            0,            0,               0,               0            },
604   {"???",            0,            0,               0,               0            },
605   {"???",            0,            0,               0,               0            },
606   {"???",            0,            0,               0,               0            },
607   {"???",            0,            0,               0,               0            },
608   {"???",            0,            0,               0,               0            },
609   {"???",            0,            0,               0,               0            },
610   {"???",            0,            0,               0,               0            },
611   // 0xf0
612   {"retxa",         0,            PARAM_UI8,         0,               0            },   /* V33,53 only */
613   {"???",            0,            0,               0,               0            },
614   {"???",            0,            0,               0,               0            },
615   {"???",            0,            0,               0,               0            },
616   {"???",            0,            0,               0,               0            },
617   {"???",            0,            0,               0,               0            },
618   {"???",            0,            0,               0,               0            },
619   {"???",            0,            0,               0,               0            },
620   {"???",            0,            0,               0,               0            },
621   {"???",            0,            0,               0,               0            },
622   {"???",            0,            0,               0,               0            },
623   {"???",            0,            0,               0,               0            },
624   {"???",            0,            0,               0,               0            },
625   {"???",            0,            0,               0,               0            },
626   {"???",            0,            0,               0,               0            },
627   {"brkem",         0,            PARAM_UI8,         0,               0            }   /* V20,30,40,50 only */
628};
629
630static const I386_OPCODE immb_table[8] =
631{
632   {"add",            0,            PARAM_RM8,         PARAM_I8,         0            },
633   {"or",            0,            PARAM_RM8,         PARAM_I8,         0            },
634   {"addc",         0,            PARAM_RM8,         PARAM_I8,         0            },
635   {"subc",         0,            PARAM_RM8,         PARAM_I8,         0            },
636   {"and",            0,            PARAM_RM8,         PARAM_I8,         0            },
637   {"sub",            0,            PARAM_RM8,         PARAM_I8,         0            },
638   {"xor",            0,            PARAM_RM8,         PARAM_I8,         0            },
639   {"cmp",            0,            PARAM_RM8,         PARAM_I8,         0            }
640};
641
642static const I386_OPCODE immw_table[8] =
643{
644   {"add",            0,            PARAM_RM16,         PARAM_IMM,         0            },
645   {"or",            0,            PARAM_RM16,         PARAM_IMM,         0            },
646   {"addc",         0,            PARAM_RM16,         PARAM_IMM,         0            },
647   {"subc",         0,            PARAM_RM16,         PARAM_IMM,         0            },
648   {"and",            0,            PARAM_RM16,         PARAM_IMM,         0            },
649   {"sub",            0,            PARAM_RM16,         PARAM_IMM,         0            },
650   {"xor",            0,            PARAM_RM16,         PARAM_IMM,         0            },
651   {"cmp",            0,            PARAM_RM16,         PARAM_IMM,         0            }
652};
653
654static const I386_OPCODE immws_table[8] =
655{
656   {"add",            0,            PARAM_RM16,         PARAM_I8,         0            },
657   {"or",            0,            PARAM_RM16,         PARAM_I8,         0            },
658   {"addc",         0,            PARAM_RM16,         PARAM_I8,         0            },
659   {"subc",         0,            PARAM_RM16,         PARAM_I8,         0            },
660   {"and",            0,            PARAM_RM16,         PARAM_I8,         0            },
661   {"sub",            0,            PARAM_RM16,         PARAM_I8,         0            },
662   {"xor",            0,            PARAM_RM16,         PARAM_I8,         0            },
663   {"cmp",            0,            PARAM_RM16,         PARAM_I8,         0            }
664};
665
666static const I386_OPCODE shiftbi_table[8] =
667{
668   {"rol",            0,            PARAM_RM8,         PARAM_I8,         0            },
669   {"ror",            0,            PARAM_RM8,         PARAM_I8,         0            },
670   {"rolc",         0,            PARAM_RM8,         PARAM_I8,         0            },
671   {"rorc",         0,            PARAM_RM8,         PARAM_I8,         0            },
672   {"shl",            0,            PARAM_RM8,         PARAM_I8,         0            },
673   {"shr",            0,            PARAM_RM8,         PARAM_I8,         0            },
674   {"???",            0,            PARAM_RM8,         PARAM_I8,         0            },
675   {"shra",         0,            PARAM_RM8,         PARAM_I8,         0            }
676};
677
678static const I386_OPCODE shiftwi_table[8] =
679{
680   {"rol",            0,            PARAM_RM16,         PARAM_I8,         0            },
681   {"ror",            0,            PARAM_RM16,         PARAM_I8,         0            },
682   {"rolc",         0,            PARAM_RM16,         PARAM_I8,         0            },
683   {"rorc",         0,            PARAM_RM16,         PARAM_I8,         0            },
684   {"shl",            0,            PARAM_RM16,         PARAM_I8,         0            },
685   {"shr",            0,            PARAM_RM16,         PARAM_I8,         0            },
686   {"???",            0,            PARAM_RM16,         PARAM_I8,         0            },
687   {"shra",         0,            PARAM_RM16,         PARAM_I8,         0            }
688};
689
690static const I386_OPCODE shiftb_table[8] =
691{
692   {"rol",            0,            PARAM_RM8,         PARAM_1,         0            },
693   {"ror",            0,            PARAM_RM8,         PARAM_1,         0            },
694   {"rolc",         0,            PARAM_RM8,         PARAM_1,         0            },
695   {"rorc",         0,            PARAM_RM8,         PARAM_1,         0            },
696   {"shl",            0,            PARAM_RM8,         PARAM_1,         0            },
697   {"shr",            0,            PARAM_RM8,         PARAM_1,         0            },
698   {"???",            0,            PARAM_RM8,         PARAM_1,         0            },
699   {"shra",         0,            PARAM_RM8,         PARAM_1,         0            }
700};
701
702static const I386_OPCODE shiftw_table[8] =
703{
704   {"rol",            0,            PARAM_RM16,         PARAM_1,         0            },
705   {"ror",            0,            PARAM_RM16,         PARAM_1,         0            },
706   {"rolc",         0,            PARAM_RM16,         PARAM_1,         0            },
707   {"rorc",         0,            PARAM_RM16,         PARAM_1,         0            },
708   {"shl",            0,            PARAM_RM16,         PARAM_1,         0            },
709   {"shr",            0,            PARAM_RM16,         PARAM_1,         0            },
710   {"???",            0,            PARAM_RM16,         PARAM_1,         0            },
711   {"shra",         0,            PARAM_RM16,         PARAM_1,         0            }
712};
713
714static const I386_OPCODE shiftbv_table[8] =
715{
716   {"rol",            0,            PARAM_RM8,         PARAM_CL,         0            },
717   {"ror",            0,            PARAM_RM8,         PARAM_CL,         0            },
718   {"rolc",         0,            PARAM_RM8,         PARAM_CL,         0            },
719   {"rorc",         0,            PARAM_RM8,         PARAM_CL,         0            },
720   {"shl",            0,            PARAM_RM8,         PARAM_CL,         0            },
721   {"shr",            0,            PARAM_RM8,         PARAM_CL,         0            },
722   {"???",            0,            PARAM_RM8,         PARAM_CL,         0            },
723   {"shra",         0,            PARAM_RM8,         PARAM_CL,         0            }
724};
725
726static const I386_OPCODE shiftwv_table[8] =
727{
728   {"rol",            0,            PARAM_RM16,         PARAM_CL,         0            },
729   {"ror",            0,            PARAM_RM16,         PARAM_CL,         0            },
730   {"rolc",         0,            PARAM_RM16,         PARAM_CL,         0            },
731   {"rorc",         0,            PARAM_RM16,         PARAM_CL,         0            },
732   {"shl",            0,            PARAM_RM16,         PARAM_CL,         0            },
733   {"shr",            0,            PARAM_RM16,         PARAM_CL,         0            },
734   {"???",            0,            PARAM_RM16,         PARAM_CL,         0            },
735   {"shra",         0,            PARAM_RM16,         PARAM_CL,         0            }
736};
737
738static const I386_OPCODE group1b_table[8] =
739{
740   {"test",         0,            PARAM_RM8,         PARAM_I8,         0            },
741   {"???",            0,            0,               0,               0            },
742   {"not",            0,            PARAM_RM8,         0,               0            },
743   {"neg",            0,            PARAM_RM8,         0,               0            },
744   {"mulu",         0,            PARAM_RM8,         0,               0            },
745   {"mul",            0,            PARAM_RM8,         0,               0            },
746   {"divu",         0,            PARAM_RM8,         0,               0            },
747   {"div",            0,            PARAM_RM8,         0,               0            }
748};
749
750static const I386_OPCODE group1w_table[8] =
751{
752   {"test",         0,            PARAM_RM16,         PARAM_IMM,         0            },
753   {"???",            0,            0,               0,               0            },
754   {"not",            0,            PARAM_RM16,         0,               0            },
755   {"neg",            0,            PARAM_RM16,         0,               0            },
756   {"mulu",         0,            PARAM_RM16,         0,               0            },
757   {"mul",            0,            PARAM_RM16,         0,               0            },
758   {"divu",         0,            PARAM_RM16,         0,               0            },
759   {"div",            0,            PARAM_RM16,         0,               0            }
760};
761
762static const I386_OPCODE group2b_table[8] =
763{
764   {"inc",            0,            PARAM_RM8,         0,               0            },
765   {"dec",            0,            PARAM_RM8,         0,               0            },
766   {"???",            0,            0,               0,               0            },
767   {"???",            0,            0,               0,               0            },
768   {"???",            0,            0,               0,               0            },
769   {"???",            0,            0,               0,               0            },
770   {"???",            0,            0,               0,               0            },
771   {"???",            0,            0,               0,               0            }
772};
773
774static const I386_OPCODE group2w_table[8] =
775{
776   {"inc",            0,            PARAM_RM16,         0,               0            },
777   {"dec",            0,            PARAM_RM16,         0,               0            },
778   {"call",         0,            PARAM_RM16,         0,               0,            DASMFLAG_STEP_OVER},
779   {"call    far ptr ",0,            PARAM_RM16,         0,               0,            DASMFLAG_STEP_OVER},
780   {"br",            0,            PARAM_RM16,         0,               0            },
781   {"br      far ptr ",0,            PARAM_RM16,         0,               0            },
782   {"push",         0,            PARAM_RM16,         0,               0            },
783   {"???",            0,            0,               0,               0            }
784};
785
786static const GROUP_OP group_op_table[] =
787{
788   { "immb",            immb_table            },
789   { "immw",            immw_table            },
790   { "immws",            immws_table            },
791   { "shiftbi",         shiftbi_table         },
792   { "shiftwi",         shiftwi_table         },
793   { "shiftb",            shiftb_table         },
794   { "shiftw",            shiftw_table         },
795   { "shiftbv",         shiftbv_table         },
796   { "shiftwv",         shiftwv_table         },
797   { "group1b",         group1b_table         },
798   { "group1w",         group1w_table         },
799   { "group2b",         group2b_table         },
800   { "group2w",         group2w_table         }
801};
802
803
804
805static const char *nec_reg[8] = { "aw",  "cw",  "dw",  "bw",  "sp",  "bp",  "ix",  "iy" };
806static const char *neg_reg8[8] = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
807static const char *nec_sreg[8] = { "ds1", "ps", "ss", "ds0", "???", "???", "???", "???" };
808
809static UINT32 pc;
810static UINT8 modrm;
811static UINT32 segment;
812static offs_t dasm_flags;
813static char modrm_string[256];
814
815#define MODRM_REG1   ((modrm >> 3) & 0x7)
816#define MODRM_REG2   (modrm & 0x7)
817
818INLINE UINT8 FETCH(void)
819{
820   if ((opcode_ptr - opcode_ptr_base) + 1 > 15)
821      return 0xff;
822   pc++;
823   return *opcode_ptr++;
824}
825
826INLINE UINT16 FETCH16(void)
827{
828   UINT16 d;
829   if ((opcode_ptr - opcode_ptr_base) + 2 > 15)
830      return 0xffff;
831   d = opcode_ptr[0] | (opcode_ptr[1] << 8);
832   opcode_ptr += 2;
833   pc += 2;
834   return d;
835}
836
837INLINE UINT8 FETCHD(void)
838{
839   if ((opcode_ptr - opcode_ptr_base) + 1 > 15)
840      return 0xff;
841   pc++;
842   return *opcode_ptr++;
843}
844
845INLINE UINT16 FETCHD16(void)
846{
847   UINT16 d;
848   if ((opcode_ptr - opcode_ptr_base) + 2 > 15)
849      return 0xffff;
850   d = opcode_ptr[0] | (opcode_ptr[1] << 8);
851   opcode_ptr += 2;
852   pc += 2;
853   return d;
854}
855
856static char *hexstring(UINT32 value, int digits)
857{
858   static char buffer[20];
859   buffer[0] = '0';
860   if (digits)
861      sprintf(&buffer[1], "%0*Xh", digits, value);
862   else
863      sprintf(&buffer[1], "%Xh", value);
864   return (buffer[1] >= '0' && buffer[1] <= '9') ? &buffer[1] : &buffer[0];
865}
866
867static char *shexstring(UINT32 value, int digits, int always)
868{
869   static char buffer[20];
870   if (value >= 0x80000000)
871      sprintf(buffer, "-%s", hexstring(-value, digits));
872   else if (always)
873      sprintf(buffer, "+%s", hexstring(value, digits));
874   else
875      return hexstring(value, digits);
876   return buffer;
877}
878
879static void handle_modrm(char* s)
880{
881   INT8 disp8;
882   INT16 disp16;
883   UINT8 mod, rm;
884
885   modrm = FETCHD();
886   mod = (modrm >> 6) & 0x3;
887   rm = (modrm & 0x7);
888
889   if( modrm >= 0xc0 )
890      return;
891
892   switch(segment)
893   {
894      case SEG_PS: s += sprintf( s, "ps:" ); break;
895      case SEG_DS0: s += sprintf( s, "ds0:" ); break;
896      case SEG_DS1: s += sprintf( s, "ds1:" ); break;
897      case SEG_SS: s += sprintf( s, "ss:" ); break;
898   }
899
900   s += sprintf( s, "[" );
901   switch( rm )
902   {
903      case 0: s += sprintf( s, "bw+ix" ); break;
904      case 1: s += sprintf( s, "bw+iy" ); break;
905      case 2: s += sprintf( s, "bw+ix" ); break;
906      case 3: s += sprintf( s, "bw+iy" ); break;
907      case 4: s += sprintf( s, "ix" ); break;
908      case 5: s += sprintf( s, "iy" ); break;
909      case 6:
910         if( mod == 0 ) {
911            disp16 = FETCHD16();
912            s += sprintf( s, "%s", hexstring((unsigned) (UINT16) disp16, 0) );
913         } else {
914            s += sprintf( s, "bp" );
915         }
916         break;
917      case 7: s += sprintf( s, "bw" ); break;
918   }
919   if( mod == 1 ) {
920      disp8 = FETCHD();
921      s += sprintf( s, "%s", shexstring((INT32)disp8, 0, TRUE) );
922   } else if( mod == 2 ) {
923      disp16 = FETCHD16();
924      s += sprintf( s, "%s", shexstring((INT32)disp16, 0, TRUE) );
925   }
926   s += sprintf( s, "]" );
927}
928
929static char* handle_param(char* s, UINT32 param)
930{
931   UINT8 i8;
932   UINT16 i16;
933   UINT16 ptr;
934   UINT32 addr;
935   INT8 d8;
936   INT16 d16;
937
938   switch(param)
939   {
940      case PARAM_REG8:
941         s += sprintf( s, "%s", neg_reg8[MODRM_REG1] );
942         break;
943
944      case PARAM_REG16:
945         s += sprintf( s, "%s", nec_reg[MODRM_REG1] );
946         break;
947
948      case PARAM_REG2_8:
949         s += sprintf( s, "%s", neg_reg8[MODRM_REG2] );
950         break;
951
952      case PARAM_REG2_16:
953         s += sprintf( s, "%s", nec_reg[MODRM_REG2] );
954         break;
955
956      case PARAM_RM8:
957         if( modrm >= 0xc0 ) {
958            s += sprintf( s, "%s", neg_reg8[MODRM_REG2] );
959         } else {
960            s += sprintf( s, "byte ptr " );
961            s += sprintf( s, "%s", modrm_string );
962         }
963         break;
964
965      case PARAM_RM16:
966         if( modrm >= 0xc0 ) {
967            s += sprintf( s, "%s", nec_reg[MODRM_REG2] );
968         } else {
969            s += sprintf( s, "word ptr " );
970            s += sprintf( s, "%s", modrm_string );
971         }
972         break;
973
974      case PARAM_I4:
975         i8 = FETCHD();
976         s += sprintf( s, "%d", i8 & 0x0f );
977         break;
978
979      case PARAM_I8:
980         i8 = FETCHD();
981         s += sprintf( s, "%s", shexstring((INT8)i8, 0, FALSE) );
982         break;
983
984      case PARAM_I16:
985         i16 = FETCHD16();
986         s += sprintf( s, "%s", shexstring((INT16)i16, 0, FALSE) );
987         break;
988
989      case PARAM_UI8:
990         i8 = FETCHD();
991         s += sprintf( s, "%s", shexstring((UINT8)i8, 0, FALSE) );
992         break;
993
994      case PARAM_UI16:
995         i16 = FETCHD16();
996         s += sprintf( s, "%s", shexstring((UINT16)i16, 0, FALSE) );
997         break;
998
999      case PARAM_IMM:
1000         i16 = FETCHD16();
1001         s += sprintf( s, "%s", hexstring(i16, 0) );
1002         break;
1003
1004      case PARAM_ADDR:
1005         addr = FETCHD16();
1006         ptr = FETCHD16();
1007         s += sprintf( s, "%s:", hexstring(ptr, 4) );
1008         s += sprintf( s, "%s", hexstring(addr, 0) );
1009         break;
1010
1011      case PARAM_REL16:
1012         /* make sure to keep the relative offset within the segment */
1013         d16 = FETCHD16();
1014         s += sprintf( s, "%s", hexstring((pc & 0xFFFF0000) | ((pc + d16) & 0x0000FFFF), 0) );
1015         break;
1016
1017      case PARAM_REL8:
1018         d8 = FETCHD();
1019         s += sprintf( s, "%s", hexstring(pc + d8, 0) );
1020         break;
1021
1022      case PARAM_MEM_OFFS_B:
1023         d8 = FETCHD();
1024         s += sprintf( s, "[%s]", hexstring(d8, 0) );
1025         break;
1026
1027      case PARAM_MEM_OFFS_W:
1028         d16 = FETCHD16();
1029         s += sprintf( s, "[%s]", hexstring(d16, 0) );
1030         break;
1031
1032      case PARAM_SREG:
1033         s += sprintf( s, "%s", nec_sreg[MODRM_REG1] );
1034         break;
1035
1036      case PARAM_1:
1037         s += sprintf( s, "1" );
1038         break;
1039
1040      case PARAM_RBANK:
1041         s += sprintf( s, "%d", FETCHD() & 7 );
1042         break;
1043
1044      case PARAM_AL: s += sprintf( s, "al" ); break;
1045      case PARAM_CL: s += sprintf( s, "cl" ); break;
1046      case PARAM_DL: s += sprintf( s, "dl" ); break;
1047      case PARAM_BL: s += sprintf( s, "bl" ); break;
1048      case PARAM_AH: s += sprintf( s, "ah" ); break;
1049      case PARAM_CH: s += sprintf( s, "ch" ); break;
1050      case PARAM_DH: s += sprintf( s, "dh" ); break;
1051      case PARAM_BH: s += sprintf( s, "bh" ); break;
1052
1053      case PARAM_AW: s += sprintf( s, "aw" ); break;
1054      case PARAM_CW: s += sprintf( s, "cw" ); break;
1055      case PARAM_DW: s += sprintf( s, "dw" ); break;
1056      case PARAM_BW: s += sprintf( s, "bw" ); break;
1057      case PARAM_SP: s += sprintf( s, "sp" ); break;
1058      case PARAM_BP: s += sprintf( s, "bp" ); break;
1059      case PARAM_IX: s += sprintf( s, "ix" ); break;
1060      case PARAM_IY: s += sprintf( s, "iy" ); break;
1061   }
1062   return s;
1063}
1064
1065static void handle_fpu(char *s, UINT8 op1, UINT8 op2)
1066{
1067   switch (op1 & 0x7)
1068   {
1069      case 0:      // Group D8
1070      {
1071         if (op2 < 0xc0)
1072         {
1073            pc--;      // adjust fetch pointer, so modrm byte read again
1074            opcode_ptr--;
1075            handle_modrm( modrm_string );
1076            switch ((op2 >> 3) & 0x7)
1077            {
1078               case 0: sprintf(s, "fadd    dword ptr %s", modrm_string); break;
1079               case 1: sprintf(s, "fmul    dword ptr %s", modrm_string); break;
1080               case 2: sprintf(s, "fcom    dword ptr %s", modrm_string); break;
1081               case 3: sprintf(s, "fcomp   dword ptr %s", modrm_string); break;
1082               case 4: sprintf(s, "fsub    dword ptr %s", modrm_string); break;
1083               case 5: sprintf(s, "fsubr   dword ptr %s", modrm_string); break;
1084               case 6: sprintf(s, "fdiv    dword ptr %s", modrm_string); break;
1085               case 7: sprintf(s, "fdivr   dword ptr %s", modrm_string); break;
1086            }
1087         }
1088         else
1089         {
1090            switch ((op2 >> 3) & 0x7)
1091            {
1092               case 0: sprintf(s, "fadd    st(0),st(%d)", op2 & 0x7); break;
1093               case 1: sprintf(s, "fcom    st(0),st(%d)", op2 & 0x7); break;
1094               case 2: sprintf(s, "fsub    st(0),st(%d)", op2 & 0x7); break;
1095               case 3: sprintf(s, "fdiv    st(0),st(%d)", op2 & 0x7); break;
1096               case 4: sprintf(s, "fmul    st(0),st(%d)", op2 & 0x7); break;
1097               case 5: sprintf(s, "fcomp   st(0),st(%d)", op2 & 0x7); break;
1098               case 6: sprintf(s, "fsubr   st(0),st(%d)", op2 & 0x7); break;
1099               case 7: sprintf(s, "fdivr   st(0),st(%d)", op2 & 0x7); break;
1100            }
1101         }
1102         break;
1103      }
1104
1105      case 1:      // Group D9
1106      {
1107         if (op2 < 0xc0)
1108         {
1109            pc--;      // adjust fetch pointer, so modrm byte read again
1110            opcode_ptr--;
1111            handle_modrm( modrm_string );
1112            switch ((op2 >> 3) & 0x7)
1113            {
1114               case 0: sprintf(s, "fld     dword ptr %s", modrm_string); break;
1115               case 1: sprintf(s, "??? (FPU)"); break;
1116               case 2: sprintf(s, "fst     dword ptr %s", modrm_string); break;
1117               case 3: sprintf(s, "fstp    dword ptr %s", modrm_string); break;
1118               case 4: sprintf(s, "fldenv  word ptr %s", modrm_string); break;
1119               case 5: sprintf(s, "fldcw   word ptr %s", modrm_string); break;
1120               case 6: sprintf(s, "fstenv  word ptr %s", modrm_string); break;
1121               case 7: sprintf(s, "fstcw   word ptr %s", modrm_string); break;
1122            }
1123         }
1124         else
1125         {
1126            switch (op2 & 0x3f)
1127            {
1128               case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
1129                  sprintf(s, "fld     st(0),st(%d)", op2 & 0x7); break;
1130
1131               case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1132                  sprintf(s, "fxch    st(0),st(%d)", op2 & 0x7); break;
1133
1134               case 0x10: sprintf(s, "fnop"); break;
1135               case 0x20: sprintf(s, "fchs"); break;
1136               case 0x21: sprintf(s, "fabs"); break;
1137               case 0x24: sprintf(s, "ftst"); break;
1138               case 0x25: sprintf(s, "fxam"); break;
1139               case 0x28: sprintf(s, "fld1"); break;
1140               case 0x29: sprintf(s, "fldl2t"); break;
1141               case 0x2a: sprintf(s, "fldl2e"); break;
1142               case 0x2b: sprintf(s, "fldpi"); break;
1143               case 0x2c: sprintf(s, "fldlg2"); break;
1144               case 0x2d: sprintf(s, "fldln2"); break;
1145               case 0x2e: sprintf(s, "fldz"); break;
1146               case 0x30: sprintf(s, "f2xm1"); break;
1147               case 0x31: sprintf(s, "fyl2x"); break;
1148               case 0x32: sprintf(s, "fptan"); break;
1149               case 0x33: sprintf(s, "fpatan"); break;
1150               case 0x34: sprintf(s, "fxtract"); break;
1151               case 0x35: sprintf(s, "fprem1"); break;
1152               case 0x36: sprintf(s, "fdecstp"); break;
1153               case 0x37: sprintf(s, "fincstp"); break;
1154               case 0x38: sprintf(s, "fprem"); break;
1155               case 0x39: sprintf(s, "fyl2xp1"); break;
1156               case 0x3a: sprintf(s, "fsqrt"); break;
1157               case 0x3b: sprintf(s, "fsincos"); break;
1158               case 0x3c: sprintf(s, "frndint"); break;
1159               case 0x3d: sprintf(s, "fscale"); break;
1160               case 0x3e: sprintf(s, "fsin"); break;
1161               case 0x3f: sprintf(s, "fcos"); break;
1162
1163               default: sprintf(s, "??? (FPU)"); break;
1164            }
1165         }
1166         break;
1167      }
1168
1169      case 2:      // Group DA
1170      {
1171         if (op2 < 0xc0)
1172         {
1173            pc--;      // adjust fetch pointer, so modrm byte read again
1174            opcode_ptr--;
1175            handle_modrm( modrm_string );
1176            switch ((op2 >> 3) & 0x7)
1177            {
1178               case 0: sprintf(s, "fiadd   dword ptr %s", modrm_string); break;
1179               case 1: sprintf(s, "fimul   dword ptr %s", modrm_string); break;
1180               case 2: sprintf(s, "ficom   dword ptr %s", modrm_string); break;
1181               case 3: sprintf(s, "ficomp  dword ptr %s", modrm_string); break;
1182               case 4: sprintf(s, "fisub   dword ptr %s", modrm_string); break;
1183               case 5: sprintf(s, "fisubr  dword ptr %s", modrm_string); break;
1184               case 6: sprintf(s, "fidiv   dword ptr %s", modrm_string); break;
1185               case 7: sprintf(s, "fidivr  dword ptr %s", modrm_string); break;
1186            }
1187         }
1188         else
1189         {
1190            switch (op2 & 0x3f)
1191            {
1192               case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
1193                  sprintf(s, "fcmovb  st(0),st(%d)", op2 & 0x7); break;
1194
1195               case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1196                  sprintf(s, "fcmove  st(0),st(%d)", op2 & 0x7); break;
1197
1198               case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
1199                  sprintf(s, "fcmovbe st(0),st(%d)", op2 & 0x7); break;
1200
1201               case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
1202                  sprintf(s, "fcmovu  st(0),st(%d)", op2 & 0x7); break;
1203
1204               default: sprintf(s, "??? (FPU)"); break;
1205
1206            }
1207         }
1208         break;
1209      }
1210
1211      case 3:      // Group DB
1212      {
1213         if (op2 < 0xc0)
1214         {
1215            pc--;      // adjust fetch pointer, so modrm byte read again
1216            opcode_ptr--;
1217            handle_modrm( modrm_string );
1218            switch ((op2 >> 3) & 0x7)
1219            {
1220               case 0: sprintf(s, "fild    dword ptr %s", modrm_string); break;
1221               case 1: sprintf(s, "??? (FPU)"); break;
1222               case 2: sprintf(s, "fist    dword ptr %s", modrm_string); break;
1223               case 3: sprintf(s, "fistp   dword ptr %s", modrm_string); break;
1224               case 4: sprintf(s, "??? (FPU)"); break;
1225               case 5: sprintf(s, "fld     tword ptr %s", modrm_string); break;
1226               case 6: sprintf(s, "??? (FPU)"); break;
1227               case 7: sprintf(s, "fstp    tword ptr %s", modrm_string); break;
1228            }
1229         }
1230         else
1231         {
1232            switch (op2 & 0x3f)
1233            {
1234               case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
1235                  sprintf(s, "fcmovnb st(0),st(%d)", op2 & 0x7); break;
1236
1237               case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1238                  sprintf(s, "fcmovne st(0),st(%d)", op2 & 0x7); break;
1239
1240               case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
1241                  sprintf(s, "fcmovnbe st(0),st(%d)", op2 & 0x7); break;
1242
1243               case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
1244                  sprintf(s, "fcmovnu st(0),st(%d)", op2 & 0x7); break;
1245
1246               case 0x22: sprintf(s, "fclex"); break;
1247               case 0x23: sprintf(s, "finit"); break;
1248
1249               case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1250                  sprintf(s, "fucomi  st(0),st(%d)", op2 & 0x7); break;
1251
1252               case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
1253                  sprintf(s, "fcomi   st(0),st(%d)", op2 & 0x7); break;
1254
1255               default: sprintf(s, "??? (FPU)"); break;
1256            }
1257         }
1258         break;
1259      }
1260
1261      case 4:      // Group DC
1262      {
1263         if (op2 < 0xc0)
1264         {
1265            pc--;      // adjust fetch pointer, so modrm byte read again
1266            opcode_ptr--;
1267            handle_modrm( modrm_string );
1268            switch ((op2 >> 3) & 0x7)
1269            {
1270               case 0: sprintf(s, "fadd    qword ptr %s", modrm_string); break;
1271               case 1: sprintf(s, "fmul    qword ptr %s", modrm_string); break;
1272               case 2: sprintf(s, "fcom    qword ptr %s", modrm_string); break;
1273               case 3: sprintf(s, "fcomp   qword ptr %s", modrm_string); break;
1274               case 4: sprintf(s, "fsub    qword ptr %s", modrm_string); break;
1275               case 5: sprintf(s, "fsubr   qword ptr %s", modrm_string); break;
1276               case 6: sprintf(s, "fdiv    qword ptr %s", modrm_string); break;
1277               case 7: sprintf(s, "fdivr   qword ptr %s", modrm_string); break;
1278            }
1279         }
1280         else
1281         {
1282            switch (op2 & 0x3f)
1283            {
1284               case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
1285                  sprintf(s, "fadd    st(%d),st(0)", op2 & 0x7); break;
1286
1287               case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1288                  sprintf(s, "fmul    st(%d),st(0)", op2 & 0x7); break;
1289
1290               case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
1291                  sprintf(s, "fsubr   st(%d),st(0)", op2 & 0x7); break;
1292
1293               case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1294                  sprintf(s, "fsub    st(%d),st(0)", op2 & 0x7); break;
1295
1296               case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
1297                  sprintf(s, "fdivr   st(%d),st(0)", op2 & 0x7); break;
1298
1299               case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
1300                  sprintf(s, "fdiv    st(%d),st(0)", op2 & 0x7); break;
1301
1302               default: sprintf(s, "??? (FPU)"); break;
1303            }
1304         }
1305         break;
1306      }
1307
1308      case 5:      // Group DD
1309      {
1310         if (op2 < 0xc0)
1311         {
1312            pc--;      // adjust fetch pointer, so modrm byte read again
1313            opcode_ptr--;
1314            handle_modrm( modrm_string );
1315            switch ((op2 >> 3) & 0x7)
1316            {
1317               case 0: sprintf(s, "fld     qword ptr %s", modrm_string); break;
1318               case 1: sprintf(s, "??? (FPU)"); break;
1319               case 2: sprintf(s, "fst     qword ptr %s", modrm_string); break;
1320               case 3: sprintf(s, "fstp    qword ptr %s", modrm_string); break;
1321               case 4: sprintf(s, "frstor  %s", modrm_string); break;
1322               case 5: sprintf(s, "??? (FPU)"); break;
1323               case 6: sprintf(s, "fsave   %s", modrm_string); break;
1324               case 7: sprintf(s, "fstsw   word ptr %s", modrm_string); break;
1325            }
1326         }
1327         else
1328         {
1329            switch (op2 & 0x3f)
1330            {
1331               case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
1332                  sprintf(s, "ffree   st(%d)", op2 & 0x7); break;
1333
1334               case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
1335                  sprintf(s, "fst     st(%d)", op2 & 0x7); break;
1336
1337               case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
1338                  sprintf(s, "fstp    st(%d)", op2 & 0x7); break;
1339
1340               case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
1341                  sprintf(s, "fucom   st(%d), st(0)", op2 & 0x7); break;
1342
1343               case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1344                  sprintf(s, "fucomp  st(%d)", op2 & 0x7); break;
1345
1346               default: sprintf(s, "??? (FPU)"); break;
1347            }
1348         }
1349         break;
1350      }
1351
1352      case 6:      // Group DE
1353      {
1354         if (op2 < 0xc0)
1355         {
1356            pc--;      // adjust fetch pointer, so modrm byte read again
1357            opcode_ptr--;
1358            handle_modrm( modrm_string );
1359            switch ((op2 >> 3) & 0x7)
1360            {
1361               case 0: sprintf(s, "fiadd   word ptr %s", modrm_string); break;
1362               case 1: sprintf(s, "fimul   word ptr %s", modrm_string); break;
1363               case 2: sprintf(s, "ficom   word ptr %s", modrm_string); break;
1364               case 3: sprintf(s, "ficomp  word ptr %s", modrm_string); break;
1365               case 4: sprintf(s, "fisub   word ptr %s", modrm_string); break;
1366               case 5: sprintf(s, "fisubr  word ptr %s", modrm_string); break;
1367               case 6: sprintf(s, "fidiv   word ptr %s", modrm_string); break;
1368               case 7: sprintf(s, "fidivr  word ptr %s", modrm_string); break;
1369            }
1370         }
1371         else
1372         {
1373            switch (op2 & 0x3f)
1374            {
1375               case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
1376                  sprintf(s, "faddp   st(%d)", op2 & 0x7); break;
1377
1378               case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1379                  sprintf(s, "fmulp   st(%d)", op2 & 0x7); break;
1380
1381               case 0x19: sprintf(s, "fcompp"); break;
1382
1383               case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
1384                  sprintf(s, "fsubrp  st(%d)", op2 & 0x7); break;
1385
1386               case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1387                  sprintf(s, "fsubp   st(%d)", op2 & 0x7); break;
1388
1389               case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
1390                  sprintf(s, "fdivrp  st(%d), st(0)", op2 & 0x7); break;
1391
1392               case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
1393                  sprintf(s, "fdivp   st(%d)", op2 & 0x7); break;
1394
1395               default: sprintf(s, "??? (FPU)"); break;
1396            }
1397         }
1398         break;
1399      }
1400
1401      case 7:      // Group DF
1402      {
1403         if (op2 < 0xc0)
1404         {
1405            pc--;      // adjust fetch pointer, so modrm byte read again
1406            opcode_ptr--;
1407            handle_modrm( modrm_string );
1408            switch ((op2 >> 3) & 0x7)
1409            {
1410               case 0: sprintf(s, "fild    word ptr %s", modrm_string); break;
1411               case 1: sprintf(s, "??? (FPU)"); break;
1412               case 2: sprintf(s, "fist    word ptr %s", modrm_string); break;
1413               case 3: sprintf(s, "fistp   word ptr %s", modrm_string); break;
1414               case 4: sprintf(s, "fbld    %s", modrm_string); break;
1415               case 5: sprintf(s, "fild    qword ptr %s", modrm_string); break;
1416               case 6: sprintf(s, "fbstp   %s", modrm_string); break;
1417               case 7: sprintf(s, "fistp   qword ptr %s", modrm_string); break;
1418            }
1419         }
1420         else
1421         {
1422            switch (op2 & 0x3f)
1423            {
1424               case 0x20: sprintf(s, "fstsw   aw"); break;
1425
1426               case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1427                  sprintf(s, "fucomip st(%d)", op2 & 0x7); break;
1428
1429               case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
1430                  sprintf(s, "fcomip  st(%d),st(0)", op2 & 0x7); break;
1431
1432               default: sprintf(s, "??? (FPU)"); break;
1433            }
1434         }
1435         break;
1436      }
1437   }
1438}
1439
1440static void decode_opcode(char *s, const I386_OPCODE *op, UINT8 op1)
1441{
1442   int i;
1443   UINT8 op2;
1444
1445   switch( op->flags )
1446   {
1447      case TWO_BYTE:
1448         op2 = FETCHD();
1449         decode_opcode( s, &necv_opcode_table2[op2], op1 );
1450         return;
1451
1452      case SEG_PS:
1453      case SEG_DS0:
1454      case SEG_DS1:
1455      case SEG_SS:
1456         segment = op->flags;
1457         op2 = FETCH();
1458         decode_opcode( s, &necv_opcode_table1[op2], op1 );
1459         return;
1460
1461      case PREFIX:
1462         s += sprintf( s, "%-8s", op->mnemonic );
1463         op2 = FETCH();
1464         decode_opcode( s, &necv_opcode_table1[op2], op1 );
1465         return;
1466
1467      case GROUP:
1468         handle_modrm( modrm_string );
1469         for( i=0; i < ARRAY_LENGTH(group_op_table); i++ ) {
1470            if( mame_stricmp(op->mnemonic, group_op_table[i].mnemonic) == 0 ) {
1471               decode_opcode( s, &group_op_table[i].opcode[MODRM_REG1], op1 );
1472               return;
1473            }
1474         }
1475         goto handle_unknown;
1476
1477      case FPU:
1478         op2 = FETCHD();
1479         handle_fpu( s, op1, op2);
1480         return;
1481
1482      case MODRM:
1483         handle_modrm( modrm_string );
1484         break;
1485   }
1486
1487   s += sprintf( s, "%-8s", op->mnemonic );
1488   dasm_flags = op->dasm_flags;
1489
1490   if( op->param1 != 0 ) {
1491      s = handle_param( s, op->param1 );
1492   }
1493
1494   if( op->param2 != 0 ) {
1495      s += sprintf( s, "," );
1496      s = handle_param( s, op->param2 );
1497   }
1498
1499   if( op->param3 != 0 ) {
1500      s += sprintf( s, "," );
1501      s = handle_param( s, op->param3 );
1502   }
1503   return;
1504
1505handle_unknown:
1506   sprintf(s, "???");
1507}
1508
1509int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom)
1510{
1511   UINT8 op;
1512
1513   opcode_ptr = opcode_ptr_base = oprom;
1514   pc = eip;
1515   dasm_flags = 0;
1516   segment = 0;
1517
1518   op = FETCH();
1519
1520   decode_opcode( buffer, &necv_opcode_table1[op], op );
1521   return (pc-eip) | dasm_flags | DASMFLAG_SUPPORTED;
1522}
src/emu/cpu/mips/mips3com.h
r0r870
1/***************************************************************************
2
3    mips3com.h
4
5    Common MIPS III/IV definitions and functions
6
7***************************************************************************/
8
9#include "cpuintrf.h"
10#include "mips3.h"
11
12
13/***************************************************************************
14    CONSTANTS
15***************************************************************************/
16
17/* core parameters */
18#define MIPS3_MIN_PAGE_SHIFT   12
19#define MIPS3_MIN_PAGE_SIZE      (1 << MIPS3_MIN_PAGE_SHIFT)
20#define MIPS3_MIN_PAGE_MASK      (MIPS3_MIN_PAGE_SIZE - 1)
21#define MIPS3_MAX_PADDR_SHIFT   32
22
23/* MIPS flavors */
24enum _mips3_flavor
25{
26   /* MIPS III variants */
27   MIPS3_TYPE_MIPS_III,
28   MIPS3_TYPE_R4600,
29   MIPS3_TYPE_R4650,
30   MIPS3_TYPE_R4700,
31
32   /* MIPS IV variants */
33   MIPS3_TYPE_MIPS_IV,
34   MIPS3_TYPE_R5000,
35   MIPS3_TYPE_QED5271,
36   MIPS3_TYPE_RM7000
37};
38typedef enum _mips3_flavor mips3_flavor;
39
40/* COP0 registers */
41#define COP0_Index         0
42#define COP0_Random         1
43#define COP0_EntryLo      2
44#define COP0_EntryLo0      2
45#define COP0_EntryLo1      3
46#define COP0_Context      4
47#define COP0_PageMask      5
48#define COP0_Wired         6
49#define COP0_BadVAddr      8
50#define COP0_Count         9
51#define COP0_EntryHi      10
52#define COP0_Compare      11
53#define COP0_Status         12
54#define COP0_Cause         13
55#define COP0_EPC         14
56#define COP0_PRId         15
57#define COP0_Config         16
58#define COP0_XContext      20
59
60/* Status register bits */
61#define SR_IE            0x00000001
62#define SR_EXL            0x00000002
63#define SR_ERL            0x00000004
64#define SR_KSU_MASK         0x00000018
65#define SR_KSU_KERNEL      0x00000000
66#define SR_KSU_SUPERVISOR   0x00000008
67#define SR_KSU_USER         0x00000010
68#define SR_IMSW0         0x00000100
69#define SR_IMSW1         0x00000200
70#define SR_IMEX0         0x00000400
71#define SR_IMEX1         0x00000800
72#define SR_IMEX2         0x00001000
73#define SR_IMEX3         0x00002000
74#define SR_IMEX4         0x00004000
75#define SR_IMEX5         0x00008000
76#define SR_DE            0x00010000
77#define SR_CE            0x00020000
78#define SR_CH            0x00040000
79#define SR_SR            0x00100000
80#define SR_TS            0x00200000
81#define SR_BEV            0x00400000
82#define SR_RE            0x02000000
83#define SR_FR            0x04000000
84#define SR_RP            0x08000000
85#define SR_COP0            0x10000000
86#define SR_COP1            0x20000000
87#define SR_COP2            0x40000000
88#define SR_COP3            0x80000000
89
90/* exception types */
91#define EXCEPTION_INTERRUPT   0
92#define EXCEPTION_TLBMOD   1
93#define EXCEPTION_TLBLOAD   2
94#define EXCEPTION_TLBSTORE   3
95#define EXCEPTION_ADDRLOAD   4
96#define EXCEPTION_ADDRSTORE   5
97#define EXCEPTION_BUSINST   6
98#define EXCEPTION_BUSDATA   7
99#define EXCEPTION_SYSCALL   8
100#define EXCEPTION_BREAK      9
101#define EXCEPTION_INVALIDOP   10
102#define EXCEPTION_BADCOP   11
103#define EXCEPTION_OVERFLOW   12
104#define EXCEPTION_TRAP      13
105
106
107
108/***************************************************************************
109    HELPER MACROS
110***************************************************************************/
111
112#define RSREG         ((op >> 21) & 31)
113#define RTREG         ((op >> 16) & 31)
114#define RDREG         ((op >> 11) & 31)
115#define SHIFT         ((op >> 6) & 31)
116
117#define FRREG         ((op >> 21) & 31)
118#define FTREG         ((op >> 16) & 31)
119#define FSREG         ((op >> 11) & 31)
120#define FDREG         ((op >> 6) & 31)
121
122#define IS_SINGLE(o)    (((o) & (1 << 21)) == 0)
123#define IS_DOUBLE(o)    (((o) & (1 << 21)) != 0)
124#define IS_FLOAT(o)    (((o) & (1 << 23)) == 0)
125#define IS_INTEGRAL(o)    (((o) & (1 << 23)) != 0)
126
127#define SIMMVAL         ((INT16)op)
128#define UIMMVAL         ((UINT16)op)
129#define LIMMVAL         (op & 0x03ffffff)
130
131
132
133/***************************************************************************
134    STRUCTURES & TYPEDEFS
135***************************************************************************/
136
137/* memory access function table */
138typedef struct _memory_handlers memory_handlers;
139struct _memory_handlers
140{
141   UINT8         (*readbyte)(offs_t);
142   UINT16         (*readword)(offs_t);
143   UINT32         (*readlong)(offs_t);
144   UINT64         (*readdouble)(offs_t);
145   void         (*writebyte)(offs_t, UINT8);
146   void         (*writeword)(offs_t, UINT16);
147   void         (*writelong)(offs_t, UINT32);
148   void         (*writedouble)(offs_t, UINT64);
149};
150
151
152/* MIPS3 TLB entry */
153typedef struct _mips3_tlb_entry mips3_tlb_entry;
154struct _mips3_tlb_entry
155{
156   UINT64         page_mask;
157   UINT64         entry_hi;
158   UINT64         entry_lo[2];
159};
160
161
162/* MIPS3 state */
163typedef struct _mips3_state mips3_state;
164struct _mips3_state
165{
166   /* core registers */
167   UINT32         pc;
168   UINT64         hi;
169   UINT64         lo;
170   UINT64         r[32];
171
172   /* COP registers */
173   UINT64         cpr[3][32];
174   UINT64         ccr[3][32];
175   UINT8         cf[3][8];
176
177   /* internal stuff */
178   mips3_flavor   flavor;
179   int          (*irq_callback)(int irqline);
180   UINT32         system_clock;
181   UINT32         cpu_clock;
182   UINT64         count_zero_time;
183   mame_timer *   compare_int_timer;
184
185   /* memory accesses */
186   UINT8         bigendian;
187   memory_handlers memory;
188
189   /* cache memory */
190   UINT32 *      icache;
191   UINT32 *      dcache;
192   size_t         icache_size;
193   size_t         dcache_size;
194
195   /* MMU */
196   mips3_tlb_entry tlb[48];
197   UINT32 *      tlb_table;
198};
199
200
201
202/***************************************************************************
203    GLOBAL VARIABLES
204***************************************************************************/
205
206extern int mips3_icount;
207
208
209
210/***************************************************************************
211    FUNCTION PROTOTYPES
212***************************************************************************/
213
214void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int));
215void mips3com_reset(mips3_state *mips);
216#ifdef MAME_DEBUG
217offs_t mips3com_dasm(mips3_state *mips, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
218#endif
219void mips3com_update_cycle_counting(mips3_state *mips);
220
221void mips3com_map_tlb_entries(mips3_state *mips);
222void mips3com_unmap_tlb_entries(mips3_state *mips);
223void mips3com_recompute_tlb_table(mips3_state *mips);
224int mips3com_translate_address(mips3_state *mips, int space, offs_t *address);
225void mips3com_tlbr(mips3_state *mips);
226void mips3com_tlbwi(mips3_state *mips);
227void mips3com_tlbwr(mips3_state *mips);
228void mips3com_tlbp(mips3_state *mips);
229
230void mips3com_set_info(mips3_state *mips, UINT32 state, cpuinfo *info);
231void mips3com_get_info(mips3_state *mips, UINT32 state, cpuinfo *info);
232
233
234
235/***************************************************************************
236    INLINE FUNCTIONS
237***************************************************************************/
238
239/*-------------------------------------------------
240    mips3com_set_irq_line - set or clear the given
241    IRQ line
242-------------------------------------------------*/
243
244INLINE void mips3com_set_irq_line(mips3_state *mips, int irqline, int state)
245{
246   if (state != CLEAR_LINE)
247      mips->cpr[0][COP0_Cause] |= 0x400 << irqline;
248   else
249      mips->cpr[0][COP0_Cause] &= ~(0x400 << irqline);
250}
src/emu/cpu/mips/mips3.h
r869r870
1818
1919enum
2020{
21   MIPS3_PC=1,MIPS3_SR,
21   MIPS3_PC = 1,
2222   MIPS3_R0,
2323   MIPS3_R1,
2424   MIPS3_R2,
r869r870
5353   MIPS3_R31,
5454   MIPS3_HI,
5555   MIPS3_LO,
56   MIPS3_EPC,   MIPS3_CAUSE,
57   MIPS3_COUNT, MIPS3_COMPARE,
58   MIPS3_INDEX, MIPS3_RANDOM,
56   MIPS3_FPR0,
57   MIPS3_FPR1,
58   MIPS3_FPR2,
59   MIPS3_FPR3,
60   MIPS3_FPR4,
61   MIPS3_FPR5,
62   MIPS3_FPR6,
63   MIPS3_FPR7,
64   MIPS3_FPR8,
65   MIPS3_FPR9,
66   MIPS3_FPR10,
67   MIPS3_FPR11,
68   MIPS3_FPR12,
69   MIPS3_FPR13,
70   MIPS3_FPR14,
71   MIPS3_FPR15,
72   MIPS3_FPR16,
73   MIPS3_FPR17,
74   MIPS3_FPR18,
75   MIPS3_FPR19,
76   MIPS3_FPR20,
77   MIPS3_FPR21,
78   MIPS3_FPR22,
79   MIPS3_FPR23,
80   MIPS3_FPR24,
81   MIPS3_FPR25,
82   MIPS3_FPR26,
83   MIPS3_FPR27,
84   MIPS3_FPR28,
85   MIPS3_FPR29,
86   MIPS3_FPR30,
87   MIPS3_FPR31,
88   MIPS3_SR,
89   MIPS3_EPC,
90   MIPS3_CAUSE,
91   MIPS3_COUNT,
92   MIPS3_COMPARE,
93   MIPS3_INDEX,
94   MIPS3_RANDOM,
5995   MIPS3_ENTRYHI,
60   MIPS3_ENTRYLO0, MIPS3_ENTRYLO1,
96   MIPS3_ENTRYLO0,
97   MIPS3_ENTRYLO1,
6198   MIPS3_PAGEMASK,
62   MIPS3_WIRED, MIPS3_BADVADDR
99   MIPS3_WIRED,
100   MIPS3_BADVADDR
63101};
64102
65103#define MIPS3_MAX_FASTRAM      4
r869r870
95133#define MIPS3_IRQ5      5      /* IRQ5 */
96134
97135
136
98137/***************************************************************************
99138    STRUCTURES
100139***************************************************************************/
r869r870
107146};
108147
109148
149
110150/***************************************************************************
111151    PUBLIC FUNCTIONS
112152***************************************************************************/
r869r870
137177#endif
138178
139179
180
140181/***************************************************************************
141182    COMPILER-SPECIFIC OPTIONS
142183***************************************************************************/
src/emu/cpu/mips/mdrcold.c
r869r870
1#include "cpu/x86drc.h"
2
3
14/***************************************************************************
25    CONFIGURATION
36***************************************************************************/
r869r870
47
58#define STRIP_NOPS         1      /* 1 is faster */
69#define USE_SSE            0      /* can't tell any speed difference here */
10#define CACHE_SIZE         (16 * 1024 * 1024)
711
812
913
r869r870
2428
2529
2630/***************************************************************************
31    TYPEDEFS
32***************************************************************************/
33
34struct _mips3drc_data
35{
36   drc_core *      core;
37
38   void *         generate_interrupt_exception;
39   void *         generate_cop_exception;
40   void *         generate_overflow_exception;
41   void *         generate_invalidop_exception;
42   void *         generate_syscall_exception;
43   void *         generate_break_exception;
44   void *         generate_trap_exception;
45   void *         generate_tlbload_exception;
46   void *         generate_tlbstore_exception;
47   void *         handle_pc_tlb_mismatch;
48   void *         read_and_translate_byte_signed;
49   void *         read_and_translate_byte_unsigned;
50   void *         read_and_translate_word_signed;
51   void *         read_and_translate_word_unsigned;
52   void *         read_and_translate_long;
53   void *         read_and_translate_double;
54   void *         write_and_translate_byte;
55   void *         write_and_translate_word;
56   void *         write_and_translate_long;
57   void *         write_and_translate_double;
58   void *         write_back_long;
59   void *         write_back_double;
60};
61
62
63
64/***************************************************************************
2765    FUNCTION PROTOTYPES
2866***************************************************************************/
2967
68static void drc_reset_callback(drc_core *drc);
69static void drc_recompile_callback(drc_core *drc);
70static void drc_entrygen_callback(drc_core *drc);
71
3072static UINT32 compile_one(drc_core *drc, UINT32 pc, UINT32 physpc);
3173
3274static void append_generate_exception(drc_core *drc, UINT8 exception);
r869r870
59101
60102
61103/***************************************************************************
62    RECOMPILER CALLBACKS
104    CORE RECOMPILER SYSTEMS
63105***************************************************************************/
64106
65/*------------------------------------------------------------------
66    mips3drc_init
67------------------------------------------------------------------*/
107/*-------------------------------------------------
108    mips3drc_init - initialize the drc-specific
109    state
110-------------------------------------------------*/
68111
69112static void mips3drc_init(void)
70113{
71114   drc_config drconfig;
72115
116   /* allocate our data */
117   mips3.drc = auto_malloc(sizeof(*mips3.drc));
118   memset(mips3.drc, 0, sizeof(*mips3.drc));
119
73120   /* fill in the config */
74121   memset(&drconfig, 0, sizeof(drconfig));
75122   drconfig.cache_size       = CACHE_SIZE;
r869r870
80127   drconfig.uses_sse         = USE_SSE;
81128   drconfig.pc_in_memory     = 0;
82129   drconfig.icount_in_memory = 0;
83   drconfig.pcptr            = (UINT32 *)&mips3.pc;
130   drconfig.pcptr            = (UINT32 *)&mips3.core.pc;
84131   drconfig.icountptr        = (UINT32 *)&mips3_icount;
85132   drconfig.esiptr           = NULL;
86   drconfig.cb_reset         = mips3drc_reset;
87   drconfig.cb_recompile     = mips3drc_recompile;
88   drconfig.cb_entrygen      = mips3drc_entrygen;
133   drconfig.cb_reset         = drc_reset_callback;
134   drconfig.cb_recompile     = drc_recompile_callback;
135   drconfig.cb_entrygen      = drc_entrygen_callback;
89136
90137   /* initialize the compiler */
91   mips3.drc = drc_init(cpu_getactivecpu(), &drconfig);
138   mips3.drc->core = drc_init(cpu_getactivecpu(), &drconfig);
92139   mips3.drcoptions = MIPS3DRC_FASTEST_OPTIONS;
93140}
94141
95142
143/*-------------------------------------------------
144    mips3drc_reset - reset the drc-specific state
145-------------------------------------------------*/
96146
147static void mips3drc_reset(void)
148{
149   /* reset the cache */
150   drc_cache_reset(mips3.drc->core);
151}
152
153
154/*-------------------------------------------------
155    mips3drc_execute - execute the code
156-------------------------------------------------*/
157
158static void mips3drc_execute(void)
159{
160   drc_execute(mips3.drc->core);
161}
162
163
164/*-------------------------------------------------
165    mips3drc_exit - clean up the drc-specific
166    state
167-------------------------------------------------*/
168
169static void mips3drc_exit(void)
170{
171   drc_exit(mips3.drc->core);
172}
173
174
175
176/***************************************************************************
177    RECOMPILER CALLBACKS
178***************************************************************************/
179
97180/*------------------------------------------------------------------
98    mips3drc_reset
181    drc_reset_callback
99182------------------------------------------------------------------*/
100183
101static void mips3drc_reset(drc_core *drc)
184static void drc_reset_callback(drc_core *drc)
102185{
103186   code_log_reset();
104187
105   mips3.generate_interrupt_exception = drc->cache_top;
188   mips3.drc->generate_interrupt_exception = drc->cache_top;
106189   append_generate_exception(drc, EXCEPTION_INTERRUPT);
107   code_log(drc, "generate_interrupt_exception:", mips3.generate_interrupt_exception);
190   code_log("generate_interrupt_exception:", mips3.drc->generate_interrupt_exception, drc->cache_top);
108191
109   mips3.generate_cop_exception = drc->cache_top;
192   mips3.drc->generate_cop_exception = drc->cache_top;
110193   append_generate_exception(drc, EXCEPTION_BADCOP);
111   code_log(drc, "generate_cop_exception:", mips3.generate_cop_exception);
194   code_log("generate_cop_exception:", mips3.drc->generate_cop_exception, drc->cache_top);
112195
113   mips3.generate_overflow_exception = drc->cache_top;
196   mips3.drc->generate_overflow_exception = drc->cache_top;
114197   append_generate_exception(drc, EXCEPTION_OVERFLOW);
115   code_log(drc, "generate_overflow_exception:", mips3.generate_overflow_exception);
198   code_log("generate_overflow_exception:", mips3.drc->generate_overflow_exception, drc->cache_top);
116199
117   mips3.generate_invalidop_exception = drc->cache_top;
200   mips3.drc->generate_invalidop_exception = drc->cache_top;
118201   append_generate_exception(drc, EXCEPTION_INVALIDOP);
119   code_log(drc, "generate_invalidop_exception:", mips3.generate_invalidop_exception);
202   code_log("generate_invalidop_exception:", mips3.drc->generate_invalidop_exception, drc->cache_top);
120203
121   mips3.generate_syscall_exception = drc->cache_top;
204   mips3.drc->generate_syscall_exception = drc->cache_top;
122205   append_generate_exception(drc, EXCEPTION_SYSCALL);
123   code_log(drc, "generate_syscall_exception:", mips3.generate_syscall_exception);
206   code_log("generate_syscall_exception:", mips3.drc->generate_syscall_exception, drc->cache_top);
124207
125   mips3.generate_break_exception = drc->cache_top;
208   mips3.drc->generate_break_exception = drc->cache_top;
126209   append_generate_exception(drc, EXCEPTION_BREAK);
127   code_log(drc, "generate_break_exception:", mips3.generate_break_exception);
210   code_log("generate_break_exception:", mips3.drc->generate_break_exception, drc->cache_top);
128211
129   mips3.generate_trap_exception = drc->cache_top;
212   mips3.drc->generate_trap_exception = drc->cache_top;
130213   append_generate_exception(drc, EXCEPTION_TRAP);
131   code_log(drc, "generate_trap_exception:", mips3.generate_trap_exception);
214   code_log("generate_trap_exception:", mips3.drc->generate_trap_exception, drc->cache_top);
132215
133   mips3.generate_tlbload_exception = drc->cache_top;
216   mips3.drc->generate_tlbload_exception = drc->cache_top;
134217   append_generate_exception(drc, EXCEPTION_TLBLOAD);
135   code_log(drc, "generate_tlbload_exception:", mips3.generate_tlbload_exception);
218   code_log("generate_tlbload_exception:", mips3.drc->generate_tlbload_exception, drc->cache_top);
136219
137   mips3.generate_tlbstore_exception = drc->cache_top;
220   mips3.drc->generate_tlbstore_exception = drc->cache_top;
138221   append_generate_exception(drc, EXCEPTION_TLBSTORE);
139   code_log(drc, "generate_tlbstore_exception:", mips3.generate_tlbstore_exception);
222   code_log("generate_tlbstore_exception:", mips3.drc->generate_tlbstore_exception, drc->cache_top);
140223
141   mips3.handle_pc_tlb_mismatch = drc->cache_top;
224   mips3.drc->handle_pc_tlb_mismatch = drc->cache_top;
142225   _mov_r32_r32(REG_EAX, REG_EDI);                                       // mov  eax,edi
143226   _shr_r32_imm(REG_EAX, 12);                                          // shr  eax,12
144   _mov_r32_m32isd(REG_EBX, REG_EAX, 4, &mips3.tlb_table);                     // mov  ebx,tlb_table[eax*4]
227   _mov_r32_m32isd(REG_EBX, REG_EAX, 4, &mips3.core.tlb_table);               // mov  ebx,tlb_table[eax*4]
145228   _test_r32_imm(REG_EBX, 2);                                          // test ebx,2
146229   _mov_r32_r32(REG_EAX, REG_EDI);                                       // mov  eax,edi
147   _jcc(COND_NZ, mips3.generate_tlbload_exception);                        // jnz  generate_tlbload_exception
230   _jcc(COND_NZ, mips3.drc->generate_tlbload_exception);                     // jnz  generate_tlbload_exception
148231   _mov_m32abs_r32(drc->pcptr, REG_EDI);                                 // mov  [pcptr],edi
149232   _jmp(drc->recompile);                                             // call recompile
150   code_log(drc, "handle_pc_tlb_mismatch:", mips3.handle_pc_tlb_mismatch);
233   code_log("handle_pc_tlb_mismatch:", mips3.drc->handle_pc_tlb_mismatch, drc->cache_top);
151234
152   mips3.read_and_translate_byte_signed = drc->cache_top;
235   mips3.drc->read_and_translate_byte_signed = drc->cache_top;
153236   append_readwrite_and_translate(drc, FALSE, 1, TRUE, TRUE);
154   code_log(drc, "read_and_translate_byte_signed:", mips3.read_and_translate_byte_signed);
237   code_log("read_and_translate_byte_signed:", mips3.drc->read_and_translate_byte_signed, drc->cache_top);
155238
156   mips3.read_and_translate_byte_unsigned = drc->cache_top;
239   mips3.drc->read_and_translate_byte_unsigned = drc->cache_top;
157240   append_readwrite_and_translate(drc, FALSE, 1, FALSE, TRUE);
158   code_log(drc, "read_and_translate_byte_unsigned:", mips3.read_and_translate_byte_unsigned);
241   code_log("read_and_translate_byte_unsigned:", mips3.drc->read_and_translate_byte_unsigned, drc->cache_top);
159242
160   mips3.read_and_translate_word_signed = drc->cache_top;
243   mips3.drc->read_and_translate_word_signed = drc->cache_top;
161244   append_readwrite_and_translate(drc, FALSE, 2, TRUE, TRUE);
162   code_log(drc, "read_and_translate_word_signed:", mips3.read_and_translate_word_signed);
245   code_log("read_and_translate_word_signed:", mips3.drc->read_and_translate_word_signed, drc->cache_top);
163246
164   mips3.read_and_translate_word_unsigned = drc->cache_top;
247   mips3.drc->read_and_translate_word_unsigned = drc->cache_top;
165248   append_readwrite_and_translate(drc, FALSE, 2, FALSE, TRUE);
166   code_log(drc, "read_and_translate_word_unsigned:", mips3.read_and_translate_word_unsigned);
249   code_log("read_and_translate_word_unsigned:", mips3.drc->read_and_translate_word_unsigned, drc->cache_top);
167250
168   mips3.read_and_translate_long = drc->cache_top;
251   mips3.drc->read_and_translate_long = drc->cache_top;
169252   append_readwrite_and_translate(drc, FALSE, 4, FALSE, TRUE);
170   code_log(drc, "read_and_translate_long:", mips3.read_and_translate_long);
253   code_log("read_and_translate_long:", mips3.drc->read_and_translate_long, drc->cache_top);
171254
172   mips3.read_and_translate_double = drc->cache_top;
255   mips3.drc->read_and_translate_double = drc->cache_top;
173256   append_readwrite_and_translate(drc, FALSE, 8, FALSE, TRUE);
174   code_log(drc, "read_and_translate_double:", mips3.read_and_translate_double);
257   code_log("read_and_translate_double:", mips3.drc->read_and_translate_double, drc->cache_top);
175258
176   mips3.write_and_translate_byte = drc->cache_top;
259   mips3.drc->write_and_translate_byte = drc->cache_top;
177260   append_readwrite_and_translate(drc, TRUE, 1, FALSE, TRUE);
178   code_log(drc, "write_and_translate_byte:", mips3.write_and_translate_byte);
261   code_log("write_and_translate_byte:", mips3.drc->write_and_translate_byte, drc->cache_top);
179262
180   mips3.write_and_translate_word = drc->cache_top;
263   mips3.drc->write_and_translate_word = drc->cache_top;
181264   append_readwrite_and_translate(drc, TRUE, 2, FALSE, TRUE);
182   code_log(drc, "write_and_translate_word:", mips3.write_and_translate_word);
265   code_log("write_and_translate_word:", mips3.drc->write_and_translate_word, drc->cache_top);
183266
184   mips3.write_and_translate_long = drc->cache_top;
267   mips3.drc->write_and_translate_long = drc->cache_top;
185268   append_readwrite_and_translate(drc, TRUE, 4, FALSE, TRUE);
186   code_log(drc, "write_and_translate_long:", mips3.write_and_translate_long);
269   code_log("write_and_translate_long:", mips3.drc->write_and_translate_long, drc->cache_top);
187270
188   mips3.write_and_translate_double = drc->cache_top;
271   mips3.drc->write_and_translate_double = drc->cache_top;
189272   append_readwrite_and_translate(drc, TRUE, 8, FALSE, TRUE);
190   code_log(drc, "write_and_translate_double:", mips3.write_and_translate_double);
273   code_log("write_and_translate_double:", mips3.drc->write_and_translate_double, drc->cache_top);
191274
192   mips3.write_back_long = drc->cache_top;
275   mips3.drc->write_back_long = drc->cache_top;
193276   append_readwrite_and_translate(drc, TRUE, 4, FALSE, FALSE);
194   code_log(drc, "write_back_long:", mips3.write_back_long);
277   code_log("write_back_long:", mips3.drc->write_back_long, drc->cache_top);
195278
196   mips3.write_back_double = drc->cache_top;
279   mips3.drc->write_back_double = drc->cache_top;
197280   append_readwrite_and_translate(drc, TRUE, 8, FALSE, FALSE);
198   code_log(drc, "write_back_double:", mips3.write_back_double);
281   code_log("write_back_double:", mips3.drc->write_back_double, drc->cache_top);
199282}
200283
201284
202
203285/*------------------------------------------------------------------
204    mips3drc_recompile
286    drc_recompile_callback
205287------------------------------------------------------------------*/
206288
207static void mips3drc_recompile(drc_core *drc)
289static void drc_recompile_callback(drc_core *drc)
208290{
209291   int remaining = MAX_INSTRUCTIONS;
210292   void *start = drc->cache_top;
211   UINT32 pc = mips3.pc;
293   UINT32 pc = mips3.core.pc;
212294   UINT32 lastpc = pc;
213295   UINT32 physpc;
214296
r869r870
219301   code_log_reset();
220302
221303   /* make sure our FR flag matches the last time */
222   _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_FR);                     // test [COP0_Status],SR_FR
304   _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_FR);                  // test [COP0_Status],SR_FR
223305   _jcc(IS_FR0 ? COND_NZ : COND_Z, drc->recompile);                        // jnz/z recompile
224306
225307   /* ensure that we are still mapped */
226   append_tlb_verify(drc, pc, mips3.handle_pc_tlb_mismatch);
308   append_tlb_verify(drc, pc, mips3.drc->handle_pc_tlb_mismatch);
227309   physpc = pc;
228   if (!translate_address(ADDRESS_SPACE_PROGRAM, &physpc))
310   if (!mips3com_translate_address(&mips3.core, ADDRESS_SPACE_PROGRAM, &physpc))
229311   {
230312      _mov_r32_r32(REG_EAX, REG_EDI);                                    // mov  eax,edi
231      _jmp(mips3.generate_tlbload_exception);                              // jmp  tlbload_exception
313      _jmp(mips3.drc->generate_tlbload_exception);                        // jmp  tlbload_exception
232314      goto exit;
233315   }
234316   change_pc(physpc);
r869r870
246328      if ((pc ^ lastpc) & 0xfffff000)
247329      {
248330         physpc = pc;
249         if (!translate_address(ADDRESS_SPACE_PROGRAM, &physpc))
331         if (!mips3com_translate_address(&mips3.core, ADDRESS_SPACE_PROGRAM, &physpc))
250332            break;
251333         append_tlb_verify(drc, pc, drc->dispatch);
252334         change_pc(physpc);
r869r870
272354#if LOG_CODE
273355{
274356   char label[40];
275   physpc = mips3.pc;
276   translate_address(ADDRESS_SPACE_PROGRAM, &physpc);
277   sprintf(label, "Code @ %08X (%08X physical)", mips3.pc, physpc);
278   code_log(drc, label, start);
357   physpc = mips3.core.pc;
358   mips3com_translate_address(&mips3.core, ADDRESS_SPACE_PROGRAM, &physpc);
359   sprintf(label, "Code @ %08X (%08X physical)", mips3.core.pc, physpc);
360   code_log(label, start, drc->cache_top);
279361}
280362#endif
281363}
282364
283365
284366/*------------------------------------------------------------------
285    mips3drc_entrygen
367    drc_entrygen_callback
286368------------------------------------------------------------------*/
287369
288static void mips3drc_entrygen(drc_core *drc)
370static void drc_entrygen_callback(drc_core *drc)
289371{
290   _mov_r32_imm(REG_ESI, &mips3.r[17]);
372   _mov_r32_imm(REG_ESI, &mips3.core.r[17]);
291373   append_check_interrupts(drc, 1);
292374}
293375
r869r870
379461   /* assumes address is in EAX */
380462   if (exception == EXCEPTION_TLBLOAD || exception == EXCEPTION_TLBSTORE)
381463   {
382      _mov_m32abs_r32(&mips3.cpr[0][COP0_BadVAddr], REG_EAX);                  // mov  [mips3.cpr[0][BadVAddr]],eax
383      _and_m32abs_imm(&mips3.cpr[0][COP0_EntryHi], 0x000000ff);               // and  [mips3.cpr[0][EntryHi]],0x000000ff
464      _mov_m32abs_r32(&mips3.core.cpr[0][COP0_BadVAddr], REG_EAX);            // mov  [mips3.core.cpr[0][BadVAddr]],eax
465      _and_m32abs_imm(&mips3.core.cpr[0][COP0_EntryHi], 0x000000ff);            // and  [mips3.core.cpr[0][EntryHi]],0x000000ff
384466      _and_r32_imm(REG_EAX, 0xffffe000);                                 // and  eax,0xffffe000
385      _or_m32abs_r32(&mips3.cpr[0][COP0_EntryHi], REG_EAX);                  // or   [mips3.cpr[0][EntryHi]],eax
386      _and_m32abs_imm(&mips3.cpr[0][COP0_Context], 0xff800000);               // and  [mips3.cpr[0][Context]],0xff800000
467      _or_m32abs_r32(&mips3.core.cpr[0][COP0_EntryHi], REG_EAX);               // or   [mips3.core.cpr[0][EntryHi]],eax
468      _and_m32abs_imm(&mips3.core.cpr[0][COP0_Context], 0xff800000);            // and  [mips3.core.cpr[0][Context]],0xff800000
387469      _shr_r32_imm(REG_EAX, 9);                                       // shr  eax,9
388      _or_m32abs_r32(&mips3.cpr[0][COP0_Context], REG_EAX);                  // or   [mips3.cpr[0][Context]],eax
470      _or_m32abs_r32(&mips3.core.cpr[0][COP0_Context], REG_EAX);               // or   [mips3.core.cpr[0][Context]],eax
389471   }
390472
391   _mov_m32abs_r32(&mips3.cpr[0][COP0_EPC], REG_EDI);                        // mov  [mips3.cpr[0][COP0_EPC]],edi
392   _mov_r32_m32abs(REG_EAX, &mips3.cpr[0][COP0_Cause]);                     // mov  eax,[mips3.cpr[0][COP0_Cause]]
473   _mov_m32abs_r32(&mips3.core.cpr[0][COP0_EPC], REG_EDI);                     // mov  [mips3.core.cpr[0][COP0_EPC]],edi
474   _mov_r32_m32abs(REG_EAX, &mips3.core.cpr[0][COP0_Cause]);                  // mov  eax,[mips3.core.cpr[0][COP0_Cause]]
393475   _and_r32_imm(REG_EAX, ~0x800000ff);                                    // and  eax,~0x800000ff
394476   if (exception)
395477      _or_r32_imm(REG_EAX, exception << 2);                              // or   eax,exception << 2
396478   _cmp_m32abs_imm(&mips3.nextpc, ~0);                                    // cmp  [mips3.nextpc],~0
397479   _jcc_short_link(COND_E, &link1);                                    // je   skip
398480   _mov_m32abs_imm(&mips3.nextpc, ~0);                                    // mov  [mips3.nextpc],~0
399   _sub_m32abs_imm(&mips3.cpr[0][COP0_EPC], 4);                           // sub  [mips3.cpr[0][COP0_EPC]],4
481   _sub_m32abs_imm(&mips3.core.cpr[0][COP0_EPC], 4);                        // sub  [mips3.core.cpr[0][COP0_EPC]],4
400482   _or_r32_imm(REG_EAX, 0x80000000);                                    // or   eax,0x80000000
401483   _resolve_link(&link1);                                             // skip:
402   _mov_m32abs_r32(&mips3.cpr[0][COP0_Cause], REG_EAX);                     // mov  [mips3.cpr[0][COP0_Cause]],eax
403   _mov_r32_m32abs(REG_EAX, &mips3.cpr[0][COP0_Status]);                     // mov  eax,[[mips3.cpr[0][COP0_Status]]
484   _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Cause], REG_EAX);                  // mov  [mips3.core.cpr[0][COP0_Cause]],eax
485   _mov_r32_m32abs(REG_EAX, &mips3.core.cpr[0][COP0_Status]);                  // mov  eax,[[mips3.core.cpr[0][COP0_Status]]
404486   _or_r32_imm(REG_EAX, SR_EXL);                                       // or   eax,SR_EXL
405487   _test_r32_imm(REG_EAX, SR_BEV);                                       // test eax,SR_BEV
406   _mov_m32abs_r32(&mips3.cpr[0][COP0_Status], REG_EAX);                     // mov  [[mips3.cpr[0][COP0_Status]],eax
488   _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Status], REG_EAX);                  // mov  [[mips3.core.cpr[0][COP0_Status]],eax
407489   _mov_r32_imm(REG_EDI, 0xbfc00200 + offset);                              // mov  edi,0xbfc00200+offset
408490   _jcc_short_link(COND_NZ, &link2);                                    // jnz  skip2
409491   _mov_r32_imm(REG_EDI, 0x80000000 + offset);                              // mov  edi,0x80000000+offset
r869r870
426508      _mov_r32_m32bd(REG_EAX, REG_ESP, 4);                              // mov  eax,[esp+4]
427509      _mov_r32_r32(REG_EBX, REG_EAX);                                    // mov  ebx,eax
428510      _shr_r32_imm(REG_EBX, 12);                                       // shr  ebx,12
429      _mov_r32_m32isd(REG_EBX, REG_EBX, 4, mips3.tlb_table);                  // mov  ebx,tlb_table[ebx*4]
511      _mov_r32_m32isd(REG_EBX, REG_EBX, 4, mips3.core.tlb_table);               // mov  ebx,tlb_table[ebx*4]
430512      _and_r32_imm(REG_EAX, 0xfff);                                    // and  eax,0xfff
431513      _shr_r32_imm(REG_EBX, (is_write ? 1 : 2));                           // shr  ebx,2/1 (read/write)
432514      _lea_r32_m32bisd(REG_EBX, REG_EAX, REG_EBX, (is_write ? 2 : 4), 0);         // lea  ebx,[eax+ebx*4/2] (read/write)
r869r870
451533         {
452534            if (size == 1)
453535            {
454               if (mips3.bigendian)
536               if (mips3.core.bigendian)
455537                  _xor_r32_imm(REG_EBX, 3);                           // xor   ebx,3
456538               if (is_signed)
457539                  _movsx_r32_m8bd(REG_EAX, REG_EBX, fastbase);            // movsx eax,byte ptr [ebx+fastbase]
r869r870
460542            }
461543            else if (size == 2)
462544            {
463               if (mips3.bigendian)
545               if (mips3.core.bigendian)
464546                  _xor_r32_imm(REG_EBX, 2);                           // xor   ebx,2
465547               if (is_signed)
466548                  _movsx_r32_m16bd(REG_EAX, REG_EBX, fastbase);            // movsx eax,word ptr [ebx+fastbase]
r869r870
471553               _mov_r32_m32bd(REG_EAX, REG_EBX, fastbase);                  // mov   eax,[ebx+fastbase]
472554            else if (size == 8)
473555            {
474               if (mips3.bigendian)
556               if (mips3.core.bigendian)
475557                  _mov_r64_m64bd(REG_EAX, REG_EDX, REG_EBX, fastbase);      // mov   eax:edx,[ebx+fastbase]
476558               else
477559                  _mov_r64_m64bd(REG_EDX, REG_EAX, REG_EBX, fastbase);      // mov   edx:eax,[ebx+fastbase]
r869r870
483565            if (size == 1)
484566            {
485567               _mov_r8_m8bd(REG_AL, REG_ESP, 8);                        // mov   al,[esp+8]
486               if (mips3.bigendian)
568               if (mips3.core.bigendian)
487569                  _xor_r32_imm(REG_EBX, 3);                           // xor   ebx,3
488570               _mov_m8bd_r8(REG_EBX, fastbase, REG_AL);                  // mov   [ebx+fastbase],al
489571            }
490572            else if (size == 2)
491573            {
492574               _mov_r16_m16bd(REG_AX, REG_ESP, 8);                        // mov   ax,[esp+8]
493               if (mips3.bigendian)
575               if (mips3.core.bigendian)
494576                  _xor_r32_imm(REG_EBX, 2);                           // xor   ebx,2
495577               _mov_m16bd_r16(REG_EBX, fastbase, REG_AX);                  // mov   [ebx+fastbase],ax
496578            }
r869r870
501583            }
502584            else if (size == 8)
503585            {
504               if (mips3.bigendian)
586               if (mips3.core.bigendian)
505587               {
506588                  _mov_r32_m32bd(REG_EAX, REG_ESP, 8);                  // mov   eax,[esp+8]
507589                  _mov_m32bd_r32(REG_EBX, fastbase+4, REG_EAX);            // mov   [ebx+fastbase+4],eax
r869r870
531613      {
532614         _mov_m32bd_r32(REG_ESP, 4, REG_EBX);                           // mov  [esp+4],ebx
533615         if (size == 1)
534            _jmp(mips3.memory.writebyte);                              // jmp  writebyte
616            _jmp(mips3.core.memory.writebyte);                           // jmp  writebyte
535617         else if (size == 2)
536            _jmp(mips3.memory.writeword);                              // jmp  writeword
618            _jmp(mips3.core.memory.writeword);                           // jmp  writeword
537619         else
538            _jmp(mips3.memory.writelong);                              // jmp  writelong
620            _jmp(mips3.core.memory.writelong);                           // jmp  writelong
539621      }
540622      else
541623      {
542624         _sub_r32_imm(REG_ESP, 4);                                    // sub  esp,4
543         _push_m32bd(REG_ESP, mips3.bigendian ? 16 : 12);                  // push [esp+12/16]
625         _push_m32bd(REG_ESP, mips3.core.bigendian ? 16 : 12);               // push [esp+12/16]
544626         _push_r32(REG_EBX);                                          // push ebx
545         _call(mips3.memory.writelong);                                 // call writelong
627         _call(mips3.core.memory.writelong);                              // call writelong
546628         _add_r32_imm(REG_EBX, 4);                                    // add  ebx,4
547629         _sub_r32_imm(REG_ESP, 8);                                    // sub  esp,8
548         _push_m32bd(REG_ESP, mips3.bigendian ? (12+16) : (16+16));            // push [esp+16+12/16]
630         _push_m32bd(REG_ESP, mips3.core.bigendian ? (12+16) : (16+16));         // push [esp+16+12/16]
549631         _push_r32(REG_EBX);                                          // push ebx
550         _call(mips3.memory.writelong);                                 // call writelong
632         _call(mips3.core.memory.writelong);                              // call writelong
551633         _sub_r32_imm(REG_EBX, 4);                                    // sub  ebx,4
552634         _add_r32_imm(REG_ESP, 28);                                    // add  esp,28
553635         _ret();                                                   // ret
r869r870
559641      {
560642         _sub_r32_imm(REG_ESP, 8);                                    // sub  esp,8
561643         _push_r32(REG_EBX);                                          // push ebx
562         _call(mips3.memory.readbyte);                                 // call  readbyte
644         _call(mips3.core.memory.readbyte);                              // call  readbyte
563645         if (is_signed)
564646            _movsx_r32_r8(REG_EAX, REG_AL);                              // movsx eax,al
565647         else
r869r870
571653      {
572654         _sub_r32_imm(REG_ESP, 8);                                    // sub  esp,8
573655         _push_r32(REG_EBX);                                          // push ebx
574         _call(mips3.memory.readword);                                 // call  readword
656         _call(mips3.core.memory.readword);                              // call  readword
575657         if (is_signed)
576658            _movsx_r32_r16(REG_EAX, REG_AX);                           // movsx eax,ax
577659         else
r869r870
582664      else if (size == 4)
583665      {
584666         _mov_m32bd_r32(REG_ESP, 4, REG_EBX);                           // mov  [esp+4],ebx
585         _jmp(mips3.memory.readlong);                                 // jmp  readlong
667         _jmp(mips3.core.memory.readlong);                              // jmp  readlong
586668      }
587669      else
588670      {
589671         _sub_r32_imm(REG_ESP, 8);                                    // sub  esp,8
590672         _push_r32(REG_EBX);                                          // push ebx
591         _call(mips3.memory.readlong);                                 // call readlong
673         _call(mips3.core.memory.readlong);                              // call readlong
592674         _add_r32_imm(REG_EBX, 4);                                    // add  ebx,4
593675         _mov_m32bd_r32(REG_ESP, 4, REG_EAX);                           // mov  [esp+4],eax
594676         _mov_m32bd_r32(REG_ESP, 0, REG_EBX);                           // mov  [esp],ebx
595         _call(mips3.memory.readlong);                                 // call readlong
677         _call(mips3.core.memory.readlong);                              // call readlong
596678         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
597         if (mips3.bigendian)
679         if (mips3.core.bigendian)
598680            _pop_r32(REG_EDX);                                       // pop  edx
599681         else
600682         {
r869r870
611693      _resolve_link(&link1);                                          // error:
612694      _mov_r32_m32bd(REG_EAX, REG_ESP, 4);                              // mov  eax,[esp+4]
613695      _add_r32_imm(REG_ESP, is_write ? (8+4) : (4+4));                     // add  esp,stack_bytes
614      _jmp(is_write ? mips3.generate_tlbstore_exception : mips3.generate_tlbload_exception);// jmp    generate_exception
696      _jmp(is_write ? mips3.drc->generate_tlbstore_exception : mips3.drc->generate_tlbload_exception);// jmp    generate_exception
615697   }
616698}
617699
r869r870
625707   /* addresses 0x80000000-0xbfffffff are direct-mapped; no checking needed */
626708   if (pc < 0x80000000 || pc >= 0xc0000000)
627709   {
628      _cmp_m32abs_imm(&mips3.tlb_table[pc >> 12], mips3.tlb_table[pc >> 12]);      // cmp  tlbtable[pc >> 12],physpc & 0xfffff000
710      _cmp_m32abs_imm(&mips3.core.tlb_table[pc >> 12], mips3.core.tlb_table[pc >> 12]);// cmp  tlbtable[pc >> 12],physpc & 0xfffff000
629711      _jcc(COND_NE, target);                                          // jne  handle_pc_tlb_mismatch
630712   }
631713}
r869r870
637719
638720static void append_update_cycle_counting(drc_core *drc)
639721{
722   _sub_r32_imm(REG_ESP, 8);
640723   _mov_m32abs_r32(&mips3_icount, REG_EBP);                              // mov  [mips3_icount],ebp
641   _sub_r32_imm(REG_ESP, 12);                                          // sub  esp,12
642   _call((genf *)update_cycle_counting);                                 // call update_cycle_counting
724   _push_imm(&mips3.core);                                             // sub  esp,12
725   _call((genf *)mips3com_update_cycle_counting);                           // call update_cycle_counting
643726   _add_r32_imm(REG_ESP, 12);                                          // add  esp,12
644727   _mov_r32_m32abs(REG_EBP, &mips3_icount);                              // mov  ebp,[mips3_icount]
645728}
r869r870
652735static void append_check_interrupts(drc_core *drc, int inline_generate)
653736{
654737   link_info link1, link2, link3;
655   _mov_r32_m32abs(REG_EAX, &mips3.cpr[0][COP0_Cause]);                     // mov  eax,[mips3.cpr[0][COP0_Cause]]
656   _and_r32_m32abs(REG_EAX, &mips3.cpr[0][COP0_Status]);                     // and  eax,[mips3.cpr[0][COP0_Status]]
738   _mov_r32_m32abs(REG_EAX, &mips3.core.cpr[0][COP0_Cause]);                  // mov  eax,[mips3.core.cpr[0][COP0_Cause]]
739   _and_r32_m32abs(REG_EAX, &mips3.core.cpr[0][COP0_Status]);                  // and  eax,[mips3.core.cpr[0][COP0_Status]]
657740   _and_r32_imm(REG_EAX, 0xfc00);                                       // and  eax,0xfc00
658741   if (!inline_generate)
659742      _jcc_short_link(COND_Z, &link1);                                 // jz   skip
660743   else
661744      _jcc_near_link(COND_Z, &link1);                                    // jz   skip
662   _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_IE);                     // test [mips3.cpr[0][COP0_Status],SR_IE
745   _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_IE);                  // test [mips3.core.cpr[0][COP0_Status],SR_IE
663746   if (!inline_generate)
664747      _jcc_short_link(COND_Z, &link2);                                 // jz   skip
665748   else
666749      _jcc_near_link(COND_Z, &link2);                                    // jz   skip
667   _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_EXL | SR_ERL);               // test [mips3.cpr[0][COP0_Status],SR_EXL | SR_ERL
750   _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_EXL | SR_ERL);            // test [mips3.core.cpr[0][COP0_Status],SR_EXL | SR_ERL
668751   if (!inline_generate)
669      _jcc(COND_Z, mips3.generate_interrupt_exception);                     // jz   generate_interrupt_exception
752      _jcc(COND_Z, mips3.drc->generate_interrupt_exception);                  // jz   generate_interrupt_exception
670753   else
671754   {
672755      _jcc_near_link(COND_NZ, &link3);                                 // jnz  skip
r869r870
684767
685768static void append_check_sw_interrupts(drc_core *drc, int inline_generate)
686769{
687   _test_m32abs_imm(&mips3.cpr[0][COP0_Cause], 0x300);                        // test [mips3.cpr[0][COP0_Cause]],0x300
688   _jcc(COND_NZ, mips3.generate_interrupt_exception);                        // jnz  generate_interrupt_exception
770   _test_m32abs_imm(&mips3.core.cpr[0][COP0_Cause], 0x300);                  // test [mips3.core.cpr[0][COP0_Cause]],0x300
771   _jcc(COND_NZ, mips3.drc->generate_interrupt_exception);                     // jnz  generate_interrupt_exception
689772}
690773
691774
r869r870
711794    USEFUL PRIMITIVES
712795***************************************************************************/
713796
714#define REGDISP(reg) offsetof(mips3_regs, r[reg]) - offsetof(mips3_regs, r[17])
797#define REGDISP(reg) offsetof(mips3_regs, core.r[reg]) - offsetof(mips3_regs, core.r[17])
715798
716799#define _zero_m64abs(addr)                      \
717800do {                                     \
r869r870
798881} while (0)
799882
800883#define FPR32(x)                           \
801   (IS_FR0 ? &((float *)&mips3.cpr[1][0])[x] :    \
802    (float *)&mips3.cpr[1][x])                  \
884   (IS_FR0 ? &((float *)&mips3.core.cpr[1][0])[x] :\
885    (float *)&mips3.core.cpr[1][x])            \
803886
804887#define FPR64(x)                           \
805   (IS_FR0 ? (double *)&mips3.cpr[1][(x)/2] :      \
806    (double *)&mips3.cpr[1][x])               \
888   (IS_FR0 ? (double *)&mips3.core.cpr[1][(x)/2] :   \
889    (double *)&mips3.core.cpr[1][x])            \
807890
808891
809892/***************************************************************************
r869r870
814897{
815898   if (*rt)
816899   {
817      mips3.lo = *rs / *rt;
818      mips3.hi = *rs % *rt;
900      mips3.core.lo = *rs / *rt;
901      mips3.core.hi = *rs % *rt;
819902   }
820903}
821904
r869r870
823906{
824907   if (*rt)
825908   {
826      mips3.lo = *rs / *rt;
827      mips3.hi = *rs % *rt;
909      mips3.core.lo = *rs / *rt;
910      mips3.core.hi = *rs % *rt;
828911   }
829912}
830913
r869r870
853936   /* recompile the instruction as-is */
854937   in_delay_slot = 1;
855938   physpc = pc;
856   translate_address(ADDRESS_SPACE_PROGRAM, &physpc);
939   mips3com_translate_address(&mips3.core, ADDRESS_SPACE_PROGRAM, &physpc);
857940   result = recompile_instruction(drc, pc, physpc);                        // <next instruction>
858941   in_delay_slot = 0;
859942
r869r870
10571140         {
10581141            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));               // mov  eax,[rsreg]
10591142            _add_r32_imm(REG_EAX, SIMMVAL);                              // add  eax,SIMMVAL
1060            _jcc(COND_O, mips3.generate_overflow_exception);               // jo   generate_overflow_exception
1143            _jcc(COND_O, mips3.drc->generate_overflow_exception);            // jo   generate_overflow_exception
10611144            if (RTREG != 0)
10621145            {
10631146               _cdq();                                             // cdq
r869r870
11931276         return recompile_cop1(drc, pc, op) | RECOMPILE_MAY_CAUSE_EXCEPTION;
11941277
11951278      case 0x12:   /* COP2 */
1196         _jmp((void *)mips3.generate_invalidop_exception);                  // jmp  generate_invalidop_exception
1279         _jmp((void *)mips3.drc->generate_invalidop_exception);               // jmp  generate_invalidop_exception
11971280         return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
11981281
11991282      case 0x13:   /* COP1X - R5000 */
1200         if (!mips3.is_mips4)
1283         if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
12011284         {
1202            _jmp((void *)mips3.generate_invalidop_exception);               // jmp  generate_invalidop_exception
1285            _jmp((void *)mips3.drc->generate_invalidop_exception);            // jmp  generate_invalidop_exception
12031286            return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
12041287         }
12051288         return recompile_cop1x(drc, pc, op) | RECOMPILE_MAY_CAUSE_EXCEPTION;
r869r870
13171400            _mov_r64_m64bd(REG_EDX, REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  edx:eax,[rsreg]
13181401            _add_r32_imm(REG_EAX, SIMMVAL);                              // add  eax,SIMMVAL
13191402            _adc_r32_imm(REG_EDX, (SIMMVAL < 0) ? -1 : 0);                  // adc  edx,signext(SIMMVAL)
1320            _jcc(COND_O, mips3.generate_overflow_exception);               // jo   generate_overflow_exception
1403            _jcc(COND_O, mips3.drc->generate_overflow_exception);            // jo   generate_overflow_exception
13211404            if (RTREG != 0)
13221405               _mov_m64bd_r64(REG_ESI, REGDISP(RTREG), REG_EDX, REG_EAX);      // mov  [rtreg],edx:eax
13231406         }
r869r870
13501433         _push_r32(REG_EAX);                                          // push eax
13511434         _and_r32_imm(REG_EAX, ~7);                                    // and  eax,~7
13521435         _push_r32(REG_EAX);                                          // push eax
1353         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_double
1436         _call((genf *)mips3.drc->read_and_translate_double);               // call read_and_translate_double
13541437         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
13551438         _pop_r32(REG_ECX);                                          // pop  ecx
13561439         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
r869r870
13591442         {
13601443            _and_r32_imm(REG_ECX, 7);                                 // and  ecx,7
13611444            _shl_r32_imm(REG_ECX, 3);                                 // shl  ecx,3
1362            if (!mips3.bigendian)
1445            if (!mips3.core.bigendian)
13631446               _xor_r32_imm(REG_ECX, 0x38);                           // xor  ecx,0x38
13641447            _test_r32_imm(REG_ECX, 0x20);                              // test ecx,0x20
13651448            _jcc_short_link(COND_Z, &link1);                           // jz   skip
r869r870
13891472         _push_r32(REG_EAX);                                          // push eax
13901473         _and_r32_imm(REG_EAX, ~7);                                    // and  eax,~7
13911474         _push_r32(REG_EAX);                                          // push eax
1392         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_double
1475         _call((genf *)mips3.drc->read_and_translate_double);                     // call read_and_translate_double
13931476         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
13941477         _pop_r32(REG_ECX);                                          // pop  ecx
13951478         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
r869r870
13981481         {
13991482            _and_r32_imm(REG_ECX, 7);                                 // and  ecx,7
14001483            _shl_r32_imm(REG_ECX, 3);                                 // shl  ecx,3
1401            if (mips3.bigendian)
1484            if (mips3.core.bigendian)
14021485               _xor_r32_imm(REG_ECX, 0x38);                           // xor  ecx,0x38
14031486            _test_r32_imm(REG_ECX, 0x20);                              // test ecx,0x20
14041487            _jcc_short_link(COND_Z, &link1);                           // jz   skip
r869r870
14241507            case 0: /* MAD */
14251508               if (RSREG != 0 && RTREG != 0)
14261509               {
1427                  _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));      // mov  eax,[rsreg]
1428                  _mov_r32_m32bd(REG_EDX, REG_ESI, REGDISP(RTREG));      // mov  edx,[rtreg]
1429                  _imul_r32(REG_EDX);                              // imul edx
1430                  _add_r32_m32abs(REG_EAX, &mips3.lo);               // add  eax,[lo]
1431                  _adc_r32_m32abs(REG_EDX, &mips3.hi);               // adc  edx,[hi]
1432                  _mov_r32_r32(REG_EBX, REG_EDX);                     // mov  ebx,edx
1433                  _cdq();                                       // cdq
1434                  _mov_m64abs_r64(&mips3.lo, REG_EDX, REG_EAX);         // mov  [lo],edx:eax
1435                  _mov_r32_r32(REG_EAX, REG_EBX);                     // mov  eax,ebx
1436                  _cdq();                                       // cdq
1437                  _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_EAX);         // mov  [hi],edx:eax
1510                  _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  eax,[rsreg]
1511                  _mov_r32_m32bd(REG_EDX, REG_ESI, REGDISP(RTREG));         // mov  edx,[rtreg]
1512                  _imul_r32(REG_EDX);                                 // imul edx
1513                  _add_r32_m32abs(REG_EAX, &mips3.core.lo);               // add  eax,[lo]
1514                  _adc_r32_m32abs(REG_EDX, &mips3.core.hi);               // adc  edx,[hi]
1515                  _mov_r32_r32(REG_EBX, REG_EDX);                        // mov  ebx,edx
1516                  _cdq();                                          // cdq
1517                  _mov_m64abs_r64(&mips3.core.lo, REG_EDX, REG_EAX);         // mov  [lo],edx:eax
1518                  _mov_r32_r32(REG_EAX, REG_EBX);                        // mov  eax,ebx
1519                  _cdq();                                          // cdq
1520                  _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_EAX);         // mov  [hi],edx:eax
14381521               }
14391522               return RECOMPILE_SUCCESSFUL_CP(3,4);
14401523
14411524            case 1: /* MADU */
14421525               if (RSREG != 0 && RTREG != 0)
14431526               {
1444                  _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));      // mov  eax,[rsreg]
1445                  _mov_r32_m32bd(REG_EDX, REG_ESI, REGDISP(RTREG));      // mov  edx,[rtreg]
1446                  _mul_r32(REG_EDX);                              // mul  edx
1447                  _add_r32_m32abs(REG_EAX, &mips3.lo);               // add  eax,[lo]
1448                  _adc_r32_m32abs(REG_EDX, &mips3.hi);               // adc  edx,[hi]
1449                  _mov_r32_r32(REG_EBX, REG_EDX);                     // mov  ebx,edx
1450                  _cdq();                                       // cdq
1451                  _mov_m64abs_r64(&mips3.lo, REG_EDX, REG_EAX);         // mov  [lo],edx:eax
1452                  _mov_r32_r32(REG_EAX, REG_EBX);                     // mov  eax,ebx
1453                  _cdq();                                       // cdq
1454                  _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_EAX);         // mov  [hi],edx:eax
1527                  _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  eax,[rsreg]
1528                  _mov_r32_m32bd(REG_EDX, REG_ESI, REGDISP(RTREG));         // mov  edx,[rtreg]
1529                  _mul_r32(REG_EDX);                                 // mul  edx
1530                  _add_r32_m32abs(REG_EAX, &mips3.core.lo);               // add  eax,[lo]
1531                  _adc_r32_m32abs(REG_EDX, &mips3.core.hi);               // adc  edx,[hi]
1532                  _mov_r32_r32(REG_EBX, REG_EDX);                        // mov  ebx,edx
1533                  _cdq();                                          // cdq
1534                  _mov_m64abs_r64(&mips3.core.lo, REG_EDX, REG_EAX);         // mov  [lo],edx:eax
1535                  _mov_r32_r32(REG_EAX, REG_EBX);                        // mov  eax,ebx
1536                  _cdq();                                          // cdq
1537                  _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_EAX);         // mov  [hi],edx:eax
14551538               }
14561539               return RECOMPILE_SUCCESSFUL_CP(3,4);
14571540
r869r870
14861569            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
14871570         else
14881571            _push_imm(SIMMVAL);                                       // push SIMMVAL
1489         _call(mips3.read_and_translate_byte_signed);                     // call read_and_translate_byte_signed
1572         _call(mips3.drc->read_and_translate_byte_signed);                  // call read_and_translate_byte_signed
14901573         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
14911574         if (RTREG != 0)
14921575         {
r869r870
15101593            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
15111594         else
15121595            _push_imm(SIMMVAL);                                       // push SIMMVAL
1513         _call(mips3.read_and_translate_word_signed);                     // call read_and_translate_word_signed
1596         _call(mips3.drc->read_and_translate_word_signed);                  // call read_and_translate_word_signed
15141597         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
15151598         if (RTREG != 0)
15161599         {
r869r870
15301613         _push_r32(REG_EAX);                                          // push eax
15311614         _and_r32_imm(REG_EAX, ~3);                                    // and  eax,~3
15321615         _push_r32(REG_EAX);                                          // push eax
1533         _call((genf *)mips3.read_and_translate_long);                     // call read_and_translate_long
1616         _call((genf *)mips3.drc->read_and_translate_long);                  // call read_and_translate_long
15341617         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
15351618         _pop_r32(REG_ECX);                                          // pop  ecx
15361619         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
r869r870
15391622         {
15401623            _and_r32_imm(REG_ECX, 3);                                 // and  ecx,3
15411624            _shl_r32_imm(REG_ECX, 3);                                 // shl  ecx,3
1542            if (!mips3.bigendian)
1625            if (!mips3.core.bigendian)
15431626               _xor_r32_imm(REG_ECX, 0x18);                           // xor  ecx,0x18
15441627            _shl_r32_cl(REG_EAX);                                    // shl  eax,cl
15451628            _mov_r32_m32bd(REG_EBX, REG_ESI, REGDISP(RTREG));               // mov  ebx,[rtreg].lo
r869r870
15651648            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
15661649         else
15671650            _push_imm(SIMMVAL);                                       // push SIMMVAL
1568         _call(mips3.read_and_translate_long);                           // call read_and_translate_long
1651         _call(mips3.drc->read_and_translate_long);                        // call read_and_translate_long
15691652         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
15701653         if (RTREG != 0)
15711654         {
r869r870
15891672            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
15901673         else
15911674            _push_imm(SIMMVAL);                                       // push SIMMVAL
1592         _call(mips3.read_and_translate_byte_unsigned);                     // call read_and_translate_byte_unsigned
1675         _call(mips3.drc->read_and_translate_byte_unsigned);                  // call read_and_translate_byte_unsigned
15931676         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
15941677         if (RTREG != 0)
15951678         {
r869r870
16131696            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
16141697         else
16151698            _push_imm(SIMMVAL);                                       // push SIMMVAL
1616         _call(mips3.read_and_translate_word_unsigned);                     // call read_and_translate_word_unsigned
1699         _call(mips3.drc->read_and_translate_word_unsigned);                  // call read_and_translate_word_unsigned
16171700         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
16181701         if (RTREG != 0)
16191702         {
r869r870
16331716         _push_r32(REG_EAX);                                          // push eax
16341717         _and_r32_imm(REG_EAX, ~3);                                    // and  eax,~3
16351718         _push_r32(REG_EAX);                                          // push eax
1636         _call((genf *)mips3.read_and_translate_long);                     // call read_and_translate_long
1719         _call((genf *)mips3.drc->read_and_translate_long);                  // call read_and_translate_long
16371720         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
16381721         _pop_r32(REG_ECX);                                          // pop  ecx
16391722         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
r869r870
16421725         {
16431726            _and_r32_imm(REG_ECX, 3);                                 // and  ecx,3
16441727            _shl_r32_imm(REG_ECX, 3);                                 // shl  ecx,3
1645            if (mips3.bigendian)
1728            if (mips3.core.bigendian)
16461729               _xor_r32_imm(REG_ECX, 0x18);                           // xor  ecx,0x18
16471730            _shr_r32_cl(REG_EAX);                                    // shr  eax,cl
16481731            _mov_r32_m32bd(REG_EBX, REG_ESI, REGDISP(RTREG));               // mov  ebx,[rtreg].lo
r869r870
16681751            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
16691752         else
16701753            _push_imm(SIMMVAL);                                       // push SIMMVAL
1671         _call(mips3.read_and_translate_long);                           // call read_and_translate_long
1754         _call(mips3.drc->read_and_translate_long);                        // call read_and_translate_long
16721755         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
16731756         if (RTREG != 0)
16741757         {
r869r870
16961779            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
16971780         else
16981781            _push_imm(SIMMVAL);                                       // push SIMMVAL
1699         _call(mips3.write_and_translate_byte);                           // call writebyte
1782         _call(mips3.drc->write_and_translate_byte);                        // call writebyte
17001783         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
17011784         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
17021785         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
17191802            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
17201803         else
17211804            _push_imm(SIMMVAL);                                       // push SIMMVAL
1722         _call(mips3.write_and_translate_word);                           // call writeword
1805         _call(mips3.drc->write_and_translate_word);                        // call writeword
17231806         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
17241807         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
17251808         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
17341817         _push_r32(REG_EAX);                                          // push eax
17351818         _and_r32_imm(REG_EAX, ~3);                                    // and  eax,~3
17361819         _push_r32(REG_EAX);                                          // push eax
1737         _call((genf *)mips3.read_and_translate_long);                     // call read_and_translate_long
1820         _call((genf *)mips3.drc->read_and_translate_long);                  // call read_and_translate_long
17381821         _mov_r32_m32bd(REG_ECX, REG_ESP, 4);                           // mov  ecx,[esp+4]
17391822         _add_r32_imm(REG_ESP, 8);                                    // add  esp,8
17401823
17411824         _and_r32_imm(REG_ECX, 3);                                    // and  ecx,3
17421825         _shl_r32_imm(REG_ECX, 3);                                    // shl  ecx,3
1743         if (!mips3.bigendian)
1826         if (!mips3.core.bigendian)
17441827            _xor_r32_imm(REG_ECX, 0x18);                              // xor  ecx,0x18
17451828
17461829         _and_r32_m32bd(REG_EAX, REG_ECX, sdl_mask);                        // and  eax,[sdl_mask + ecx]
r869r870
17541837
17551838         _push_r32(REG_EAX);                                          // push eax
17561839         _push_r32(REG_EBX);                                          // push ebx
1757         _call((genf *)mips3.write_back_long);                           // call writelong
1840         _call((genf *)mips3.drc->write_back_long);                        // call writelong
17581841         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
17591842
17601843         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
r869r870
17781861            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
17791862         else
17801863            _push_imm(SIMMVAL);                                       // push SIMMVAL
1781         _call(mips3.write_and_translate_long);                           // call write_and_translate_long
1864         _call(mips3.drc->write_and_translate_long);                        // call write_and_translate_long
17821865         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
17831866         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
17841867         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
17931876         _push_r32(REG_EAX);                                          // push eax
17941877         _and_r32_imm(REG_EAX, ~7);                                    // and  eax,~7
17951878         _push_r32(REG_EAX);                                          // push eax
1796         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_double
1879         _call((genf *)mips3.drc->read_and_translate_double);               // call read_and_translate_double
17971880         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
17981881         _pop_r32(REG_ECX);                                          // pop  ecx
17991882         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
18001883
18011884         _and_r32_imm(REG_ECX, 7);                                    // and  ecx,7
18021885         _shl_r32_imm(REG_ECX, 3);                                    // shl  ecx,3
1803         if (!mips3.bigendian)
1886         if (!mips3.core.bigendian)
18041887            _xor_r32_imm(REG_ECX, 0x38);                              // xor  ecx,0x38
18051888
18061889         _and_r32_m32bd(REG_EAX, REG_ECX, sdl_mask + 1);                     // and  eax,[sdl_mask + ecx + 4]
r869r870
18111894            _push_r32(REG_EBX);                                       // push ebx
18121895            _push_r32(REG_ESI);                                       // push esi
18131896            _test_r32_imm(REG_ECX, 0x20);                              // test ecx,0x20
1814            _mov_r64_m64abs(REG_ESI, REG_EBX, &mips3.r[RTREG]);               // mov  esi:ebx,[rtreg]
1897            _mov_r64_m64abs(REG_ESI, REG_EBX, &mips3.core.r[RTREG]);         // mov  esi:ebx,[rtreg]
18151898            _jcc_short_link(COND_Z, &link1);                           // jz   skip
18161899            _mov_r32_r32(REG_EBX, REG_ESI);                              // mov  ebx,esi
18171900            _xor_r32_r32(REG_ESI, REG_ESI);                              // xor  esi,esi
r869r870
18271910         _push_r32(REG_EDX);                                          // push edx
18281911         _push_r32(REG_EAX);                                          // push eax
18291912         _push_r32(REG_EBX);                                          // push ebx
1830         _call((genf *)mips3.write_back_double);                           // call write_back_double
1913         _call((genf *)mips3.drc->write_back_double);                     // call write_back_double
18311914         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
18321915
18331916         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
r869r870
18431926         _push_r32(REG_EAX);                                          // push eax
18441927         _and_r32_imm(REG_EAX, ~7);                                    // and  eax,~7
18451928         _push_r32(REG_EAX);                                          // push eax
1846         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_double
1929         _call((genf *)mips3.drc->read_and_translate_double);               // call read_and_translate_double
18471930         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
18481931         _pop_r32(REG_ECX);                                          // pop  ecx
18491932         _add_r32_imm(REG_ESP, 4);                                    // add  esp,4
18501933
18511934         _and_r32_imm(REG_ECX, 7);                                    // and  ecx,7
18521935         _shl_r32_imm(REG_ECX, 3);                                    // shl  ecx,3
1853         if (mips3.bigendian)
1936         if (mips3.core.bigendian)
18541937            _xor_r32_imm(REG_ECX, 0x38);                              // xor  ecx,0x38
18551938
18561939         _and_r32_m32bd(REG_EAX, REG_ECX, sdr_mask + 1);                     // and  eax,[sdr_mask + ecx + 4]
r869r870
18611944            _push_r32(REG_EBX);                                       // push ebx
18621945            _push_r32(REG_ESI);                                       // push esi
18631946            _test_r32_imm(REG_ECX, 0x20);                              // test ecx,0x20
1864            _mov_r64_m64abs(REG_ESI, REG_EBX, &mips3.r[RTREG]);               // mov  esi:ebx,[rtreg]
1947            _mov_r64_m64abs(REG_ESI, REG_EBX, &mips3.core.r[RTREG]);         // mov  esi:ebx,[rtreg]
18651948            _jcc_short_link(COND_Z, &link1);                           // jz   skip
18661949            _mov_r32_r32(REG_ESI, REG_EBX);                              // mov  esi,ebx
18671950            _xor_r32_r32(REG_EBX, REG_EBX);                              // xor  ebx,ebx
r869r870
18771960         _push_r32(REG_EDX);                                          // push edx
18781961         _push_r32(REG_EAX);                                          // push eax
18791962         _push_r32(REG_EBX);                                          // push ebx
1880         _call((genf *)mips3.write_back_double);                           // call write_back_double
1963         _call((genf *)mips3.drc->write_back_double);                     // call write_back_double
18811964         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
18821965
18831966         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
r869r870
18931976         _push_r32(REG_EAX);                                          // push eax
18941977         _and_r32_imm(REG_EAX, ~3);                                    // and  eax,~3
18951978         _push_r32(REG_EAX);                                          // push eax
1896         _call((genf *)mips3.read_and_translate_long);                     // call read_and_translate_long
1979         _call((genf *)mips3.drc->read_and_translate_long);                  // call read_and_translate_long
18971980         _mov_r32_m32bd(REG_ECX, REG_ESP, 4);                           // mov  ecx,[esp+4]
18981981         _add_r32_imm(REG_ESP, 8);                                    // add  esp,8
18991982
19001983         _and_r32_imm(REG_ECX, 3);                                    // and  ecx,3
19011984         _shl_r32_imm(REG_ECX, 3);                                    // shl  ecx,3
1902         if (mips3.bigendian)
1985         if (mips3.core.bigendian)
19031986            _xor_r32_imm(REG_ECX, 0x18);                              // xor  ecx,0x18
19041987
19051988         _and_r32_m32bd(REG_EAX, REG_ECX, sdr_mask + 1);                     // and  eax,[sdr_mask + ecx + 4]
r869r870
19131996
19141997         _push_r32(REG_EAX);                                          // push eax
19151998         _push_r32(REG_EBX);                                          // push ebx
1916         _call((genf *)mips3.write_back_long);                           // call write_back_long
1999         _call((genf *)mips3.drc->write_back_long);                        // call write_back_long
19172000         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
19182001
19192002         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
r869r870
19382021            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
19392022         else
19402023            _push_imm(SIMMVAL);                                       // push SIMMVAL
1941         _call(mips3.read_and_translate_long);                           // call read_and_translate_long
2024         _call(mips3.drc->read_and_translate_long);                        // call read_and_translate_long
19422025         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
19432026         _mov_m32abs_r32(FPR32(RTREG), REG_EAX);                           // mov  [rtreg],eax
19442027         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
r869r870
19582041            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
19592042         else
19602043            _push_imm(SIMMVAL);                                       // push SIMMVAL
1961         _call(mips3.read_and_translate_long);                           // call read_and_translate_long
2044         _call(mips3.drc->read_and_translate_long);                        // call read_and_translate_long
19622045         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
1963         _mov_m32abs_r32(&mips3.cpr[2][RTREG], REG_EAX);                     // mov  [rtreg],eax
2046         _mov_m32abs_r32(&mips3.core.cpr[2][RTREG], REG_EAX);               // mov  [rtreg],eax
19642047         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
19652048         return RECOMPILE_SUCCESSFUL_CP(1,4);
19662049
19672050      case 0x33:   /* PREF */
1968         if (mips3.is_mips4)
2051         if (mips3.core.flavor >= MIPS3_TYPE_MIPS_IV)
19692052            return RECOMPILE_SUCCESSFUL_CP(1,4);
19702053         else
19712054         {
1972            _jmp((void *)mips3.generate_invalidop_exception);               // jmp  generate_invalidop_exception
2055            _jmp((void *)mips3.drc->generate_invalidop_exception);            // jmp  generate_invalidop_exception
19732056            return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
19742057         }
19752058
r869r870
19892072            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
19902073         else
19912074            _push_imm(SIMMVAL);                                       // push SIMMVAL
1992         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_double
2075         _call((genf *)mips3.drc->read_and_translate_double);               // call read_and_translate_double
19932076         _mov_m32abs_r32(LO(FPR64(RTREG)), REG_EAX);                        // mov  [rtreg].lo,eax
19942077         _mov_m32abs_r32(HI(FPR64(RTREG)), REG_EDX);                        // mov  [rtreg].hi,edx
19952078         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
r869r870
20102093            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
20112094         else
20122095            _push_imm(SIMMVAL);                                       // push SIMMVAL
2013         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_long
2014         _mov_m32abs_r32(LO(&mips3.cpr[2][RTREG]), REG_EAX);                  // mov  [rtreg].lo,eax
2015         _mov_m32abs_r32(HI(&mips3.cpr[2][RTREG]), REG_EDX);                  // mov  [rtreg].hi,edx
2096         _call((genf *)mips3.drc->read_and_translate_double);               // call read_and_translate_long
2097         _mov_m32abs_r32(LO(&mips3.core.cpr[2][RTREG]), REG_EAX);            // mov  [rtreg].lo,eax
2098         _mov_m32abs_r32(HI(&mips3.core.cpr[2][RTREG]), REG_EDX);            // mov  [rtreg].hi,edx
20162099         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
20172100         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
20182101         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
20312114            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
20322115         else
20332116            _push_imm(SIMMVAL);                                       // push SIMMVAL
2034         _call((genf *)mips3.read_and_translate_double);                     // call read_and_translate_double
2117         _call((genf *)mips3.drc->read_and_translate_double);               // call read_and_translate_double
20352118         if (RTREG != 0)
20362119         {
20372120            _mov_m32bd_r32(REG_ESI, REGDISP(RTREG), REG_EAX);               // mov  [rtreg].lo,eax
r869r870
20592142            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
20602143         else
20612144            _push_imm(SIMMVAL);                                       // push SIMMVAL
2062         _call(mips3.write_and_translate_long);                           // call write_and_translate_long
2145         _call(mips3.drc->write_and_translate_long);                        // call write_and_translate_long
20632146         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
20642147         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
20652148         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
20682151         _mov_m32abs_r32(&mips3_icount, REG_EBP);                        // mov  [mips3_icount],ebp
20692152         _save_pc_before_call();                                       // save pc
20702153         _sub_r32_imm(REG_ESP, 4);                                    // sub  esp,4
2071         _push_m32abs(&mips3.cpr[2][RTREG]);                              // push dword [rtreg]
2154         _push_m32abs(&mips3.core.cpr[2][RTREG]);                        // push dword [rtreg]
20722155         if (RSREG != 0 && SIMMVAL != 0)
20732156         {
20742157            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));               // mov  eax,[rsreg]
r869r870
20792162            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
20802163         else
20812164            _push_imm(SIMMVAL);                                       // push SIMMVAL
2082         _call(mips3.write_and_translate_long);                           // call write_and_translate_long
2165         _call(mips3.drc->write_and_translate_long);                        // call write_and_translate_long
20832166         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
20842167         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
20852168         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
21022185            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
21032186         else
21042187            _push_imm(SIMMVAL);                                       // push SIMMVAL
2105         _call((genf *)mips3.write_and_translate_double);                  // call write_and_translate_double
2188         _call((genf *)mips3.drc->write_and_translate_double);               // call write_and_translate_double
21062189         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
21072190         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
21082191         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
21102193      case 0x3e:   /* SDC2 */
21112194         _mov_m32abs_r32(&mips3_icount, REG_EBP);                        // mov  [mips3_icount],ebp
21122195         _save_pc_before_call();                                       // save pc
2113         _push_m32abs(HI(&mips3.cpr[2][RTREG]));                           // push dword [rtreg].hi
2114         _push_m32abs(LO(&mips3.cpr[2][RTREG]));                           // push dword [rtreg].lo
2196         _push_m32abs(HI(&mips3.core.cpr[2][RTREG]));                     // push dword [rtreg].hi
2197         _push_m32abs(LO(&mips3.core.cpr[2][RTREG]));                     // push dword [rtreg].lo
21152198         if (RSREG != 0 && SIMMVAL != 0)
21162199         {
21172200            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));               // mov  eax,[rsreg]
r869r870
21222205            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
21232206         else
21242207            _push_imm(SIMMVAL);                                       // push SIMMVAL
2125         _call((genf *)mips3.write_and_translate_double);                  // call write_and_translate_double
2208         _call((genf *)mips3.drc->write_and_translate_double);               // call write_and_translate_double
21262209         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
21272210         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
21282211         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
21502233            _push_m32bd(REG_ESI, REGDISP(RSREG));                        // push [rsreg]
21512234         else
21522235            _push_imm(SIMMVAL);                                       // push SIMMVAL
2153         _call((genf *)mips3.write_and_translate_double);                  // call write_and_translate_double
2236         _call((genf *)mips3.drc->write_and_translate_double);               // call write_and_translate_double
21542237         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
21552238         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
21562239         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
21892272         return RECOMPILE_SUCCESSFUL_CP(1,4);
21902273
21912274      case 0x01:   /* MOVF - R5000*/
2192         if (!mips3.is_mips4)
2275         if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
21932276         {
2194            _jmp((void *)mips3.generate_invalidop_exception);               // jmp  generate_invalidop_exception
2277            _jmp((void *)mips3.drc->generate_invalidop_exception);            // jmp  generate_invalidop_exception
21952278            return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
21962279         }
2197         _cmp_m8abs_imm(&mips3.cf[1][(op >> 18) & 7], 0);                  // cmp  [cf[x]],0
2280         _cmp_m8abs_imm(&mips3.core.cf[1][(op >> 18) & 7], 0);               // cmp  [cf[x]],0
21982281         _jcc_short_link(((op >> 16) & 1) ? COND_Z : COND_NZ, &link1);         // jz/nz skip
21992282         _mov_r64_m64bd(REG_EDX, REG_EAX, REG_ESI, REGDISP(RSREG));            // mov  edx:eax,[rsreg]
22002283         _mov_m64bd_r64(REG_ESI, REGDISP(RDREG), REG_EDX, REG_EAX);            // mov  [rdreg],edx:eax
r869r870
23052388         return RECOMPILE_SUCCESSFUL_CP(1+cycles,0) | RECOMPILE_END_OF_STRING | RECOMPILE_ADD_DISPATCH;
23062389
23072390      case 0x0a:   /* MOVZ - R5000 */
2308         if (!mips3.is_mips4)
2391         if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
23092392         {
2310            _jmp((void *)mips3.generate_invalidop_exception);               // jmp  generate_invalidop_exception
2393            _jmp((void *)mips3.drc->generate_invalidop_exception);            // jmp  generate_invalidop_exception
23112394            return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
23122395         }
23132396         if (RDREG != 0)
r869r870
23212404         return RECOMPILE_SUCCESSFUL_CP(1,4);
23222405
23232406      case 0x0b:   /* MOVN - R5000 */
2324         if (!mips3.is_mips4)
2407         if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
23252408         {
2326            _jmp((void *)mips3.generate_invalidop_exception);               // jmp  generate_invalidop_exception
2409            _jmp((void *)mips3.drc->generate_invalidop_exception);            // jmp  generate_invalidop_exception
23272410            return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
23282411         }
23292412         if (RDREG != 0)
r869r870
23372420         return RECOMPILE_SUCCESSFUL_CP(1,4);
23382421
23392422      case 0x0c:   /* SYSCALL */
2340         _jmp((void *)mips3.generate_syscall_exception);                     // jmp  generate_syscall_exception
2423         _jmp((void *)mips3.drc->generate_syscall_exception);               // jmp  generate_syscall_exception
23412424         return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
23422425
23432426      case 0x0d:   /* BREAK */
2344         _jmp((void *)mips3.generate_break_exception);                     // jmp  generate_break_exception
2427         _jmp((void *)mips3.drc->generate_break_exception);                  // jmp  generate_break_exception
23452428         return RECOMPILE_SUCCESSFUL | RECOMPILE_MAY_CAUSE_EXCEPTION | RECOMPILE_END_OF_STRING;
23462429
23472430      case 0x0f:   /* SYNC */
r869r870
23492432
23502433      case 0x10:   /* MFHI */
23512434         if (RDREG != 0)
2352            _mov_m64bd_m64abs(REG_ESI, REGDISP(RDREG), &mips3.hi);            // mov  [rdreg],[hi]
2435            _mov_m64bd_m64abs(REG_ESI, REGDISP(RDREG), &mips3.core.hi);         // mov  [rdreg],[hi]
23532436         return RECOMPILE_SUCCESSFUL_CP(1,4);
23542437
23552438      case 0x11:   /* MTHI */
2356         _mov_m64abs_m64bd(&mips3.hi, REG_ESI, REGDISP(RSREG));               // mov  [hi],[rsreg]
2439         _mov_m64abs_m64bd(&mips3.core.hi, REG_ESI, REGDISP(RSREG));            // mov  [hi],[rsreg]
23572440         return RECOMPILE_SUCCESSFUL_CP(1,4);
23582441
23592442      case 0x12:   /* MFLO */
23602443         if (RDREG != 0)
2361            _mov_m64bd_m64abs(REG_ESI, REGDISP(RDREG), &mips3.lo);            // mov  [rdreg],[lo]
2444            _mov_m64bd_m64abs(REG_ESI, REGDISP(RDREG), &mips3.core.lo);         // mov  [rdreg],[lo]
23622445         return RECOMPILE_SUCCESSFUL_CP(1,4);
23632446
23642447      case 0x13:   /* MTLO */
2365         _mov_m64abs_m64bd(&mips3.lo, REG_ESI, REGDISP(RSREG));               // mov  [lo],[rsreg]
2448         _mov_m64abs_m64bd(&mips3.core.lo, REG_ESI, REGDISP(RSREG));            // mov  [lo],[rsreg]
23662449         return RECOMPILE_SUCCESSFUL_CP(1,4);
23672450
23682451      case 0x14:   /* DSLLV */
r869r870
24432526         _imul_r32(REG_ECX);                                          // imul ecx
24442527         _push_r32(REG_EDX);                                          // push edx
24452528         _cdq();                                                   // cdq
2446         _mov_m64abs_r64(&mips3.lo, REG_EDX, REG_EAX);                     // mov  [lo],edx:eax
2529         _mov_m64abs_r64(&mips3.core.lo, REG_EDX, REG_EAX);                  // mov  [lo],edx:eax
24472530         _pop_r32(REG_EAX);                                          // pop  eax
24482531         _cdq();                                                   // cdq
2449         _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_EAX);                     // mov  [hi],edx:eax
2532         _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_EAX);                  // mov  [hi],edx:eax
24502533         return RECOMPILE_SUCCESSFUL_CP(4,4);
24512534
24522535      case 0x19:   /* MULTU */
r869r870
24552538         _mul_r32(REG_ECX);                                          // mul  ecx
24562539         _push_r32(REG_EDX);                                          // push edx
24572540         _cdq();                                                   // cdq
2458         _mov_m64abs_r64(&mips3.lo, REG_EDX, REG_EAX);                     // mov  [lo],edx:eax
2541         _mov_m64abs_r64(&mips3.core.lo, REG_EDX, REG_EAX);                  // mov  [lo],edx:eax
24592542         _pop_r32(REG_EAX);                                          // pop  eax
24602543         _cdq();                                                   // cdq
2461         _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_EAX);                     // mov  [hi],edx:eax
2544         _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_EAX);                  // mov  [hi],edx:eax
24622545         return RECOMPILE_SUCCESSFUL_CP(4,4);
24632546
24642547      case 0x1a:   /* DIV */
r869r870
24722555            _idiv_r32(REG_ECX);                                       // idiv ecx
24732556            _push_r32(REG_EDX);                                       // push edx
24742557            _cdq();                                                // cdq
2475            _mov_m64abs_r64(&mips3.lo, REG_EDX, REG_EAX);                  // mov  [lo],edx:eax
2558            _mov_m64abs_r64(&mips3.core.lo, REG_EDX, REG_EAX);               // mov  [lo],edx:eax
24762559            _pop_r32(REG_EAX);                                       // pop  eax
24772560            _cdq();                                                // cdq
2478            _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_EAX);                  // mov  [hi],edx:eax
2561            _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_EAX);               // mov  [hi],edx:eax
24792562            _resolve_link(&link1);                                    // skip:
24802563         }
24812564         return RECOMPILE_SUCCESSFUL_CP(36,4);
r869r870
24912574            _div_r32(REG_ECX);                                       // div  ecx
24922575            _push_r32(REG_EDX);                                       // push edx
24932576            _cdq();                                                // cdq
2494            _mov_m64abs_r64(&mips3.lo, REG_EDX, REG_EAX);                  // mov  [lo],edx:eax
2577            _mov_m64abs_r64(&mips3.core.lo, REG_EDX, REG_EAX);               // mov  [lo],edx:eax
24952578            _pop_r32(REG_EAX);                                       // pop  eax
24962579            _cdq();                                                // cdq
2497            _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_EAX);                  // mov  [hi],edx:eax
2580            _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_EAX);               // mov  [hi],edx:eax
24982581            _resolve_link(&link1);                                    // skip:
24992582         }
25002583         return RECOMPILE_SUCCESSFUL_CP(36,4);
r869r870
25242607         _mul_m32abs(LO(&dmult_temp2));                                 // mul  [dmult_temp2].lo
25252608         _mov_r32_r32(REG_ECX, REG_EDX);                                 // mov  ecx,edx
25262609         _xor_r32_r32(REG_EBX, REG_EBX);                                 // xor  ebx,ebx
2527         _mov_m32abs_r32(LO(&mips3.lo), REG_EAX);                        // mov  [lo].lo,eax
2610         _mov_m32abs_r32(LO(&mips3.core.lo), REG_EAX);                     // mov  [lo].lo,eax
25282611
25292612         _mov_r32_m32abs(REG_EAX, HI(&dmult_temp1));                        // mov  eax,[dmult_temp1].hi
25302613         _mul_m32abs(LO(&dmult_temp2));                                 // mul  [dmult_temp2].lo
r869r870
25352618         _mul_m32abs(HI(&dmult_temp2));                                 // mul  [dmult_temp2].hi
25362619         _add_r32_r32(REG_ECX, REG_EAX);                                 // add  ecx,eax
25372620         _adc_r32_r32(REG_EBX, REG_EDX);                                 // adc  ebx,edx
2538         _mov_m32abs_r32(HI(&mips3.lo), REG_ECX);                        // mov  [lo].hi,ecx
2621         _mov_m32abs_r32(HI(&mips3.core.lo), REG_ECX);                     // mov  [lo].hi,ecx
25392622
25402623         _mov_r32_m32abs(REG_EAX, HI(&dmult_temp1));                        // mov  eax,[dmult_temp1].hi
25412624         _mul_m32abs(HI(&dmult_temp2));                                 // mul  [dmult_temp2].hi
25422625         _add_r32_r32(REG_EBX, REG_EAX);                                 // add  ebx,eax
25432626         _adc_r32_imm(REG_EDX, 0);                                    // adc  edx,0
2544         _mov_m32abs_r32(LO(&mips3.hi), REG_EBX);                        // mov  [hi].lo,ebx
2545         _mov_m32abs_r32(HI(&mips3.hi), REG_EDX);                        // mov  [hi].hi,edx
2627         _mov_m32abs_r32(LO(&mips3.core.hi), REG_EBX);                     // mov  [hi].lo,ebx
2628         _mov_m32abs_r32(HI(&mips3.core.hi), REG_EDX);                     // mov  [hi].hi,edx
25462629
25472630         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG)+4);                  // mov  eax,[rsreg].hi
25482631         _xor_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG)+4);                  // xor  eax,[rtreg].hi
r869r870
25512634         _xor_r32_r32(REG_EBX, REG_EBX);                                 // xor  ebx,ebx
25522635         _xor_r32_r32(REG_ECX, REG_ECX);                                 // xor  ecx,ecx
25532636         _xor_r32_r32(REG_EDX, REG_EDX);                                 // xor  edx,edx
2554         _sub_r32_m32abs(REG_EAX, LO(&mips3.lo));                        // sub  eax,[lo].lo
2555         _sbb_r32_m32abs(REG_EBX, HI(&mips3.lo));                        // sbb  ebx,[lo].hi
2556         _sbb_r32_m32abs(REG_ECX, LO(&mips3.hi));                        // sbb  ecx,[hi].lo
2557         _sbb_r32_m32abs(REG_EDX, HI(&mips3.hi));                        // sbb  edx,[hi].hi
2558         _mov_m64abs_r64(&mips3.lo, REG_EBX, REG_EAX);                     // mov  [lo],ebx:eax
2559         _mov_m64abs_r64(&mips3.hi, REG_EDX, REG_ECX);                     // mov  [lo],edx:ecx
2637         _sub_r32_m32abs(REG_EAX, LO(&mips3.core.lo));                     // sub  eax,[lo].lo
2638         _sbb_r32_m32abs(REG_EBX, HI(&mips3.core.lo));                     // sbb  ebx,[lo].hi
2639         _sbb_r32_m32abs(REG_ECX, LO(&mips3.core.hi));                     // sbb  ecx,[hi].lo
2640         _sbb_r32_m32abs(REG_EDX, HI(&mips3.core.hi));                     // sbb  edx,[hi].hi
2641         _mov_m64abs_r64(&mips3.core.lo, REG_EBX, REG_EAX);                  // mov  [lo],ebx:eax
2642         _mov_m64abs_r64(&mips3.core.hi, REG_EDX, REG_ECX);                  // mov  [lo],edx:ecx
25602643         _resolve_link(&link3);                                       // noflip:
25612644         return RECOMPILE_SUCCESSFUL_CP(8,4);
25622645
r869r870
25652648         _mul_m32bd(REG_ESI, REGDISP(RTREG));                           // mul  [rtreg].lo
25662649         _mov_r32_r32(REG_ECX, REG_EDX);                                 // mov  ecx,edx
25672650         _xor_r32_r32(REG_EBX, REG_EBX);                                 // xor  ebx,ebx
2568         _mov_m32abs_r32(LO(&mips3.lo), REG_EAX);                        // mov  [lo].lo,eax
2651         _mov_m32abs_r32(LO(&mips3.core.lo), REG_EAX);                     // mov  [lo].lo,eax
25692652
25702653         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG)+4);                  // mov  eax,[rsreg].hi
25712654         _mul_m32bd(REG_ESI, REGDISP(RTREG));                           // mul  [rtreg].lo
r869r870
25762659         _mul_m32bd(REG_ESI, REGDISP(RTREG)+4);                           // mul  [rtreg].hi
25772660         _add_r32_r32(REG_ECX, REG_EAX);                                 // add  ecx,eax
25782661         _adc_r32_r32(REG_EBX, REG_EDX);                                 // adc  ebx,edx
2579         _mov_m32abs_r32(HI(&mips3.lo), REG_ECX);                        // mov  [lo].hi,ecx
2662         _mov_m32abs_r32(HI(&mips3.core.lo), REG_ECX);                     // mov  [lo].hi,ecx
25802663
25812664         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG)+4);                  // mov  eax,[rsreg].hi
25822665         _mul_m32bd(REG_ESI, REGDISP(RTREG)+4);                           // mul  [rtreg].hi
25832666         _add_r32_r32(REG_EBX, REG_EAX);                                 // add  ebx,eax
25842667         _adc_r32_imm(REG_EDX, 0);                                    // adc  edx,0
2585         _mov_m32abs_r32(LO(&mips3.hi), REG_EBX);                        // mov  [hi].lo,ebx
2586         _mov_m32abs_r32(HI(&mips3.hi), REG_EDX);                        // mov  [hi].hi,edx
2668         _mov_m32abs_r32(LO(&mips3.core.hi), REG_EBX);                     // mov  [hi].lo,ebx
2669         _mov_m32abs_r32(HI(&mips3.core.hi), REG_EDX);                     // mov  [hi].hi,edx
25872670         return RECOMPILE_SUCCESSFUL_CP(8,4);
25882671
25892672      case 0x1e:   /* DDIV */
25902673         _sub_r32_imm(REG_ESP, 4);                                    // sub  esp,4
2591         _push_imm(&mips3.r[RTREG]);                                    // push [rtreg]
2592         _push_imm(&mips3.r[RSREG]);                                    // push [rsreg]
2674         _push_imm(&mips3.core.r[RTREG]);                              // push [rtreg]
2675         _push_imm(&mips3.core.r[RSREG]);                              // push [rsreg]
25932676         _call((genf *)ddiv);                                       // call ddiv
25942677         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
25952678         return RECOMPILE_SUCCESSFUL_CP(68,4);
25962679
25972680      case 0x1f:   /* DDIVU */
25982681         _sub_r32_imm(REG_ESP, 4);                                    // sub  esp,4
2599         _push_imm(&mips3.r[RTREG]);                                    // push [rtreg]
2600         _push_imm(&mips3.r[RSREG]);                                    // push [rsreg]
2682         _push_imm(&mips3.core.r[RTREG]);                              // push [rtreg]
2683         _push_imm(&mips3.core.r[RSREG]);                              // push [rsreg]
26012684         _call((genf *)ddivu);                                       // call ddivu
26022685         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
26032686         return RECOMPILE_SUCCESSFUL_CP(68,4);
26042687   }
26052688
2606   _jmp((void *)mips3.generate_invalidop_exception);                        // jmp  generate_invalidop_exception
2689   _jmp((void *)mips3.drc->generate_invalidop_exception);                     // jmp  generate_invalidop_exception
26072690   return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
26082691}
26092692
r869r870
26182701         {
26192702            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));               // mov  eax,[rsreg]
26202703            _add_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // add  eax,[rtreg]
2621            _jcc(COND_O, mips3.generate_overflow_exception);               // jo   generate_overflow_exception
2704            _jcc(COND_O, mips3.drc->generate_overflow_exception);            // jo   generate_overflow_exception
26222705            if (RDREG != 0)
26232706            {
26242707               _cdq();                                             // cdq
r869r870
26762759         {
26772760            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));               // mov  eax,[rsreg]
26782761            _sub_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // sub  eax,[rtreg]
2679            _jcc(COND_O, mips3.generate_overflow_exception);               // jo   generate_overflow_exception
2762            _jcc(COND_O, mips3.drc->generate_overflow_exception);            // jo   generate_overflow_exception
26802763            if (RDREG != 0)
26812764            {
26822765               _cdq();                                             // cdq
r869r870
28952978            _mov_r64_m64bd(REG_EDX, REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  edx:eax,[rsreg]
28962979            _add_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // add  eax,[rtreg].lo
28972980            _adc_r32_m32bd(REG_EDX, REG_ESI, REGDISP(RTREG)+4);               // adc  edx,[rtreg].hi
2898            _jcc(COND_O, mips3.generate_overflow_exception);               // jo   generate_overflow_exception
2981            _jcc(COND_O, mips3.drc->generate_overflow_exception);            // jo   generate_overflow_exception
28992982            if (RDREG != 0)
29002983               _mov_m64bd_r64(REG_ESI, REGDISP(RDREG), REG_EDX, REG_EAX);      // mov  [rdreg],edx:eax
29012984         }
r869r870
29453028            _mov_r64_m64bd(REG_EDX, REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  edx:eax,[rsreg]
29463029            _sub_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // sub  eax,[rtreg].lo
29473030            _sbb_r32_m32bd(REG_EDX, REG_ESI, REGDISP(RTREG)+4);               // sbb  edx,[rtreg].hi
2948            _jcc(COND_O, mips3.generate_overflow_exception);               // jo   generate_overflow_exception
3031            _jcc(COND_O, mips3.drc->generate_overflow_exception);            // jo   generate_overflow_exception
29493032            if (RDREG != 0)
29503033               _mov_m64bd_r64(REG_ESI, REGDISP(RDREG), REG_EDX, REG_EAX);      // mov  [rdreg],edx:eax
29513034         }
r869r870
30363119         }
30373120         else
30383121            _cmp_r32_imm(REG_EDX, 0);                                 // cmp  edx,0
3039         _jcc(COND_GE, mips3.generate_trap_exception);                     // jge  generate_trap_exception
3122         _jcc(COND_GE, mips3.drc->generate_trap_exception);                  // jge  generate_trap_exception
30403123         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
30413124
30423125      case 0x31:   /* TGEU */
30433126         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG)+4);                  // mov  eax,[rsreg].hi
30443127         _cmp_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG)+4);                  // cmp  eax,[rtreg].hi
3045         _jcc(COND_A, mips3.generate_trap_exception);                     // ja   generate_trap_exception
3128         _jcc(COND_A, mips3.drc->generate_trap_exception);                  // ja   generate_trap_exception
30463129         _jcc_short_link(COND_B, &link1);                              // jb   skipit
30473130         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg].lo
30483131         _cmp_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // cmp  eax,[rtreg].lo
3049         _jcc(COND_AE, mips3.generate_trap_exception);                     // jae  generate_trap_exception
3132         _jcc(COND_AE, mips3.drc->generate_trap_exception);                  // jae  generate_trap_exception
30503133         _resolve_link(&link1);                                       // skipit:
30513134         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
30523135
r869r870
30653148         }
30663149         else
30673150            _cmp_r32_imm(REG_EDX, 0);                                 // cmp  edx,0
3068         _jcc(COND_L, mips3.generate_trap_exception);                     // jl   generate_trap_exception
3151         _jcc(COND_L, mips3.drc->generate_trap_exception);                  // jl   generate_trap_exception
30693152         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
30703153
30713154      case 0x33:   /* TLTU */
30723155         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG)+4);                  // mov  eax,[rsreg].hi
30733156         _cmp_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG)+4);                  // cmp  eax,[rtreg].hi
3074         _jcc(COND_B, mips3.generate_trap_exception);                     // jb   generate_trap_exception
3157         _jcc(COND_B, mips3.drc->generate_trap_exception);                  // jb   generate_trap_exception
30753158         _jcc_short_link(COND_A, &link1);                              // ja   skipit
30763159         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg].lo
30773160         _cmp_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // cmp  eax,[rtreg].lo
3078         _jcc(COND_B, mips3.generate_trap_exception);                     // jb   generate_trap_exception
3161         _jcc(COND_B, mips3.drc->generate_trap_exception);                  // jb   generate_trap_exception
30793162         _resolve_link(&link1);                                       // skipit:
30803163         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
30813164
r869r870
30853168         _jcc_short_link(COND_NE, &link1);                              // jne  skipit
30863169         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg].lo
30873170         _cmp_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // cmp  eax,[rtreg].lo
3088         _jcc(COND_E, mips3.generate_trap_exception);                     // je   generate_trap_exception
3171         _jcc(COND_E, mips3.drc->generate_trap_exception);                  // je   generate_trap_exception
30893172         _resolve_link(&link1);                                       // skipit:
30903173         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
30913174
r869r870
30953178         _jcc_short_link(COND_E, &link1);                              // je   skipit
30963179         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg].lo
30973180         _cmp_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // cmp  eax,[rtreg].lo
3098         _jcc(COND_NE, mips3.generate_trap_exception);                     // jne  generate_trap_exception
3181         _jcc(COND_NE, mips3.drc->generate_trap_exception);                  // jne  generate_trap_exception
30993182         _resolve_link(&link1);                                       // skipit:
31003183         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
31013184
r869r870
32403323         return RECOMPILE_SUCCESSFUL_CP(1,4);
32413324   }
32423325
3243   _jmp((void *)mips3.generate_invalidop_exception);                        // jmp  generate_invalidop_exception
3326   _jmp((void *)mips3.drc->generate_invalidop_exception);                     // jmp  generate_invalidop_exception
32443327   return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
32453328}
32463329
r869r870
33353418            _mov_r64_m64bd(REG_EDX, REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  edx:eax,[rsreg]
33363419            _sub_r32_imm(REG_EAX, SIMMVAL);                              // sub  eax,[rtreg].lo
33373420            _sbb_r32_imm(REG_EDX, ((INT32)SIMMVAL >> 31));                  // sbb  edx,[rtreg].lo
3338            _jcc(COND_GE, mips3.generate_trap_exception);                  // jge  generate_trap_exception
3421            _jcc(COND_GE, mips3.drc->generate_trap_exception);               // jge  generate_trap_exception
33393422         }
33403423         else
33413424         {
33423425            if (0 >= SIMMVAL)
3343               _jmp(mips3.generate_trap_exception);                     // jmp  generate_trap_exception
3426               _jmp(mips3.drc->generate_trap_exception);                  // jmp  generate_trap_exception
33443427         }
33453428         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
33463429
r869r870
33483431         if (RSREG != 0)
33493432         {
33503433            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG)+4, ((INT32)SIMMVAL >> 31));   // cmp  [rsreg].hi,upper
3351            _jcc(COND_A, mips3.generate_trap_exception);                  // ja   generate_trap_exception
3434            _jcc(COND_A, mips3.drc->generate_trap_exception);               // ja   generate_trap_exception
33523435            _jcc_short_link(COND_B, &link1);                           // jb   skip
33533436            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG), SIMMVAL);               // cmp  [rsreg].lo,lower
3354            _jcc(COND_AE, mips3.generate_trap_exception);                  // jae  generate_trap_exception
3437            _jcc(COND_AE, mips3.drc->generate_trap_exception);               // jae  generate_trap_exception
33553438            _resolve_link(&link1);                                    // skip:
33563439         }
33573440         else
33583441         {
33593442            if (0 >= SIMMVAL)
3360               _jmp(mips3.generate_trap_exception);                     // jmp  generate_trap_exception
3443               _jmp(mips3.drc->generate_trap_exception);                  // jmp  generate_trap_exception
33613444         }
33623445         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
33633446
r869r870
33673450            _mov_r64_m64bd(REG_EDX, REG_EAX, REG_ESI, REGDISP(RSREG));         // mov  edx:eax,[rsreg]
33683451            _sub_r32_imm(REG_EAX, SIMMVAL);                              // sub  eax,[rtreg].lo
33693452            _sbb_r32_imm(REG_EDX, ((INT32)SIMMVAL >> 31));                  // sbb  edx,[rtreg].lo
3370            _jcc(COND_L, mips3.generate_trap_exception);                  // jl   generate_trap_exception
3453            _jcc(COND_L, mips3.drc->generate_trap_exception);               // jl   generate_trap_exception
33713454         }
33723455         else
33733456         {
33743457            if (0 < SIMMVAL)
3375               _jmp(mips3.generate_trap_exception);                     // jmp  generate_trap_exception
3458               _jmp(mips3.drc->generate_trap_exception);                  // jmp  generate_trap_exception
33763459         }
33773460         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
33783461
r869r870
33803463         if (RSREG != 0)
33813464         {
33823465            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG)+4, ((INT32)SIMMVAL >> 31));   // cmp  [rsreg].hi,upper
3383            _jcc(COND_B, mips3.generate_trap_exception);                  // jb   generate_trap_exception
3466            _jcc(COND_B, mips3.drc->generate_trap_exception);               // jb   generate_trap_exception
33843467            _jcc_short_link(COND_A, &link1);                           // ja   skip
33853468            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG), SIMMVAL);               // cmp  [rsreg].lo,lower
3386            _jcc(COND_B, mips3.generate_trap_exception);                  // jb   generate_trap_exception
3469            _jcc(COND_B, mips3.drc->generate_trap_exception);               // jb   generate_trap_exception
33873470            _resolve_link(&link1);                                    // skip:
33883471         }
33893472         else
r869r870
33993482            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG)+4, ((INT32)SIMMVAL >> 31));   // cmp  [rsreg].hi,upper
34003483            _jcc_short_link(COND_NE, &link1);                           // jne  skip
34013484            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG), SIMMVAL);               // cmp  [rsreg].lo,lower
3402            _jcc(COND_E, mips3.generate_trap_exception);                  // je   generate_trap_exception
3485            _jcc(COND_E, mips3.drc->generate_trap_exception);               // je   generate_trap_exception
34033486            _resolve_link(&link1);                                    // skip:
34043487         }
34053488         else
34063489         {
34073490            if (0 == SIMMVAL)
3408               _jmp(mips3.generate_trap_exception);                     // jmp  generate_trap_exception
3491               _jmp(mips3.drc->generate_trap_exception);                  // jmp  generate_trap_exception
34093492         }
34103493         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
34113494
r869r870
34153498            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG)+4, ((INT32)SIMMVAL >> 31));   // cmp  [rsreg].hi,upper
34163499            _jcc_short_link(COND_E, &link1);                           // je   skip
34173500            _cmp_m32bd_imm(REG_ESI, REGDISP(RSREG), SIMMVAL);               // cmp  [rsreg].lo,lower
3418            _jcc(COND_NE, mips3.generate_trap_exception);                  // jne  generate_trap_exception
3501            _jcc(COND_NE, mips3.drc->generate_trap_exception);               // jne  generate_trap_exception
34193502            _resolve_link(&link1);                                    // skip:
34203503         }
34213504         else
34223505         {
34233506            if (0 != SIMMVAL)
3424               _jmp(mips3.generate_trap_exception);                     // jmp  generate_trap_exception
3507               _jmp(mips3.drc->generate_trap_exception);                  // jmp  generate_trap_exception
34253508         }
34263509         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_MAY_CAUSE_EXCEPTION;
34273510
r869r870
34353518         }
34363519
34373520         cycles = recompile_delay_slot(drc, pc + 4);                        // <next instruction>
3438         _mov_m64abs_imm32(&mips3.r[31], pc + 8);                        // mov  [31],pc + 8
3521         _mov_m64abs_imm32(&mips3.core.r[31], pc + 8);                     // mov  [31],pc + 8
34393522         append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);      // <branch or dispatch>
34403523         _resolve_link(&link1);                                       // skip:
34413524         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
34443527         if (RSREG == 0)
34453528         {
34463529            cycles = recompile_delay_slot(drc, pc + 4);                     // <next instruction>
3447            _mov_m64abs_imm32(&mips3.r[31], pc + 8);                     // mov  [31],pc + 8
3530            _mov_m64abs_imm32(&mips3.core.r[31], pc + 8);                  // mov  [31],pc + 8
34483531            append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);   // <branch or dispatch>
34493532            return RECOMPILE_SUCCESSFUL_CP(0,0) | RECOMPILE_END_OF_STRING;
34503533         }
r869r870
34553538         }
34563539
34573540         cycles = recompile_delay_slot(drc, pc + 4);                        // <next instruction>
3458         _mov_m64abs_imm32(&mips3.r[31], pc + 8);                        // mov  [31],pc + 8
3541         _mov_m64abs_imm32(&mips3.core.r[31], pc + 8);                     // mov  [31],pc + 8
34593542         append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);      // <branch or dispatch>
34603543         _resolve_link(&link1);                                       // skip:
34613544         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
34703553         }
34713554
34723555         cycles = recompile_delay_slot(drc, pc + 4);                        // <next instruction>
3473         _mov_m64abs_imm32(&mips3.r[31], pc + 8);                        // mov  [31],pc + 8
3556         _mov_m64abs_imm32(&mips3.core.r[31], pc + 8);                     // mov  [31],pc + 8
34743557         append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);      // <branch or dispatch>
34753558         _resolve_link(&link1);                                       // skip:
34763559         return RECOMPILE_SUCCESSFUL_CP(1,8);
r869r870
34793562         if (RSREG == 0)
34803563         {
34813564            cycles = recompile_delay_slot(drc, pc + 4);                     // <next instruction>
3482            _mov_m64abs_imm32(&mips3.r[31], pc + 8);                     // mov  [31],pc + 8
3565            _mov_m64abs_imm32(&mips3.core.r[31], pc + 8);                  // mov  [31],pc + 8
34833566            append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);   // <branch or dispatch>
34843567            return RECOMPILE_SUCCESSFUL_CP(0,0) | RECOMPILE_END_OF_STRING;
34853568         }
r869r870
34903573         }
34913574
34923575         cycles = recompile_delay_slot(drc, pc + 4);                        // <next instruction>
3493         _mov_m64abs_imm32(&mips3.r[31], pc + 8);                        // mov  [31],pc + 8
3576         _mov_m64abs_imm32(&mips3.core.r[31], pc + 8);                     // mov  [31],pc + 8
34943577         append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);      // <branch or dispatch>
34953578         _resolve_link(&link1);                                       // skip:
34963579         return RECOMPILE_SUCCESSFUL_CP(1,8);
34973580   }
34983581
3499   _jmp((void *)mips3.generate_invalidop_exception);                        // jmp  generate_invalidop_exception
3582   _jmp((void *)mips3.drc->generate_invalidop_exception);                     // jmp  generate_invalidop_exception
35003583   return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
35013584}
35023585
r869r870
35173600   switch (reg)
35183601   {
35193602      case COP0_Cause:
3520         _mov_r32_m32abs(REG_EBX, &mips3.cpr[0][COP0_Cause]);               // mov  ebx,[mips3.cpr[0][COP0_Cause]]
3603         _mov_r32_m32abs(REG_EBX, &mips3.core.cpr[0][COP0_Cause]);            // mov  ebx,[mips3.core.cpr[0][COP0_Cause]]
35213604         _and_r32_imm(REG_EAX, ~0xfc00);                                 // and  eax,~0xfc00
35223605         _and_r32_imm(REG_EBX, 0xfc00);                                 // and  ebx,0xfc00
35233606         _or_r32_r32(REG_EAX, REG_EBX);                                 // or   eax,ebx
3524         _mov_m32abs_r32(&mips3.cpr[0][COP0_Cause], REG_EAX);               // mov  [mips3.cpr[0][COP0_Cause]],eax
3525         _and_r32_m32abs(REG_EAX, &mips3.cpr[0][COP0_Status]);               // and  eax,[mips3.cpr[0][COP0_Status]]
3607         _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Cause], REG_EAX);            // mov  [mips3.core.cpr[0][COP0_Cause]],eax
3608         _and_r32_m32abs(REG_EAX, &mips3.core.cpr[0][COP0_Status]);            // and  eax,[mips3.core.cpr[0][COP0_Status]]
35263609         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_CHECK_SW_INTERRUPTS;
35273610
35283611      case COP0_Status:
3529         _mov_r32_m32abs(REG_EBX, &mips3.cpr[0][COP0_Status]);               // mov  ebx,[mips3.cpr[0][COP0_Status]]
3530         _mov_m32abs_r32(&mips3.cpr[0][COP0_Status], REG_EAX);               // mov  [mips3.cpr[0][COP0_Status]],eax
3612         _mov_r32_m32abs(REG_EBX, &mips3.core.cpr[0][COP0_Status]);            // mov  ebx,[mips3.core.cpr[0][COP0_Status]]
3613         _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Status], REG_EAX);            // mov  [mips3.core.cpr[0][COP0_Status]],eax
35313614         _xor_r32_r32(REG_EBX, REG_EAX);                                 // xor  ebx,eax
35323615/*
35333616#ifdef MAME_DEBUG
r869r870
35493632         return RECOMPILE_SUCCESSFUL_CP(1,4) | RECOMPILE_CHECK_INTERRUPTS | RECOMPILE_END_OF_STRING | RECOMPILE_ADD_DISPATCH;
35503633
35513634      case COP0_Count:
3552         _mov_m32abs_r32(&mips3.cpr[0][COP0_Count], REG_EAX);               // mov  [mips3.cpr[0][COP0_Count]],eax
3635         _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Count], REG_EAX);            // mov  [mips3.core.cpr[0][COP0_Count]],eax
35533636         _mov_m32abs_r32(&mips3_icount, REG_EBP);                        // mov  [mips3_icount],ebp
35543637         _sub_r32_imm(REG_ESP, 8);                                    // sub  esp,8
35553638         _push_r32(REG_EAX);                                          // push eax
r869r870
35603643         _sbb_r32_imm(REG_EDX, 0);                                    // sbb  edx,0
35613644         _sub_r32_r32(REG_EAX, REG_EBX);                                 // sub  eax,ebx
35623645         _sbb_r32_imm(REG_EDX, 0);                                    // sbb  edx,0
3563         _mov_m64abs_r64(&mips3.count_zero_time, REG_EDX, REG_EAX);            // mov  [mips3.count_zero_time],edx:eax
3646         _mov_m64abs_r64(&mips3.core.count_zero_time, REG_EDX, REG_EAX);         // mov  [mips3.core.count_zero_time],edx:eax
35643647         append_update_cycle_counting(drc);                              // update cycle counting
35653648         return RECOMPILE_SUCCESSFUL_CP(1,4);
35663649
35673650      case COP0_Compare:
3568         _mov_m32abs_r32(&mips3.cpr[0][COP0_Compare], REG_EAX);               // mov  [mips3.cpr[0][COP0_Compare]],eax
3569         _and_m32abs_imm(&mips3.cpr[0][COP0_Cause], ~0x8000);               // and  [mips3.cpr[0][COP0_Cause]],~0x8000
3651         _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Compare], REG_EAX);            // mov  [mips3.core.cpr[0][COP0_Compare]],eax
3652         _and_m32abs_imm(&mips3.core.cpr[0][COP0_Cause], ~0x8000);            // and  [mips3.core.cpr[0][COP0_Cause]],~0x8000
35703653         append_update_cycle_counting(drc);                              // update cycle counting
35713654         return RECOMPILE_SUCCESSFUL_CP(1,4);
35723655
r869r870
35743657         return RECOMPILE_SUCCESSFUL_CP(1,4);
35753658
35763659      case COP0_Config:
3577         _mov_r32_m32abs(REG_EBX, &mips3.cpr[0][COP0_Config]);               // mov  ebx,[mips3.cpr[0][COP0_Cause]]
3660         _mov_r32_m32abs(REG_EBX, &mips3.core.cpr[0][COP0_Config]);            // mov  ebx,[mips3.core.cpr[0][COP0_Cause]]
35783661         _and_r32_imm(REG_EAX, 0x0007);                                 // and  eax,0x0007
35793662         _and_r32_imm(REG_EBX, ~0x0007);                                 // and  ebx,~0x0007
35803663         _or_r32_r32(REG_EAX, REG_EBX);                                 // or   eax,ebx
3581         _mov_m32abs_r32(&mips3.cpr[0][COP0_Config], REG_EAX);               // mov  [mips3.cpr[0][COP0_Cause]],eax
3664         _mov_m32abs_r32(&mips3.core.cpr[0][COP0_Config], REG_EAX);            // mov  [mips3.core.cpr[0][COP0_Cause]],eax
35823665         return RECOMPILE_SUCCESSFUL_CP(1,4);
35833666
35843667      default:
3585         _mov_m32abs_r32(&mips3.cpr[0][reg], REG_EAX);                     // mov  [mips3.cpr[0][reg]],eax
3668         _mov_m32abs_r32(&mips3.core.cpr[0][reg], REG_EAX);                  // mov  [mips3.core.cpr[0][reg]],eax
35863669         return RECOMPILE_SUCCESSFUL_CP(1,4);
35873670   }
35883671   return RECOMPILE_UNIMPLEMENTED;
r869r870
36083691         _sub_r32_imm(REG_ESP, 12);                                    // sub  esp,12
36093692         _call((genf *)activecpu_gettotalcycles64);                        // call activecpu_gettotalcycles64
36103693         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
3611         _sub_r32_m32abs(REG_EAX, LO(&mips3.count_zero_time));               // sub  eax,[mips3.count_zero_time+0]
3612         _sbb_r32_m32abs(REG_EDX, HI(&mips3.count_zero_time));               // sbb  edx,[mips3.count_zero_time+4]
3694         _sub_r32_m32abs(REG_EAX, LO(&mips3.core.count_zero_time));            // sub  eax,[mips3.core.count_zero_time+0]
3695         _sbb_r32_m32abs(REG_EDX, HI(&mips3.core.count_zero_time));            // sbb  edx,[mips3.core.count_zero_time+4]
36133696         _shrd_r32_r32_imm(REG_EAX, REG_EDX, 1);                           // shrd eax,edx,1
36143697         return RECOMPILE_SUCCESSFUL_CP(1,4);
36153698
r869r870
36183701         _jcc_short_link(COND_NS, &link1);                              // jns  notneg
36193702         _xor_r32_r32(REG_EBP, REG_EBP);                                 // xor  ebp,ebp
36203703         _resolve_link(&link1);                                       // notneg:
3621         _mov_r32_m32abs(REG_EAX, &mips3.cpr[0][reg]);                     // mov  eax,[mips3.cpr[0][reg]]
3704         _mov_r32_m32abs(REG_EAX, &mips3.core.cpr[0][reg]);                  // mov  eax,[mips3.core.cpr[0][reg]]
36223705         return RECOMPILE_SUCCESSFUL_CP(1,4);
36233706
36243707      default:
3625         _mov_r32_m32abs(REG_EAX, &mips3.cpr[0][reg]);                     // mov  eax,[mips3.cpr[0][reg]]
3708         _mov_r32_m32abs(REG_EAX, &mips3.core.cpr[0][reg]);                  // mov  eax,[mips3.core.cpr[0][reg]]
36263709         return RECOMPILE_SUCCESSFUL_CP(1,4);
36273710   }
36283711   return RECOMPILE_UNIMPLEMENTED;
r869r870
36403723
36413724   if (mips3.drcoptions & MIPS3DRC_STRICT_COP0)
36423725   {
3643      _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_KSU_MASK);               // test [mips3.cpr[0][COP0_Status]],SR_KSU_MASK
3726      _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_KSU_MASK);            // test [mips3.core.cpr[0][COP0_Status]],SR_KSU_MASK
36443727      _jcc_short_link(COND_Z, &checklink);                              // jz   okay
3645      _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_COP0);                  // test [mips3.cpr[0][COP0_Status]],SR_COP0
3646      _jcc(COND_Z, mips3.generate_cop_exception);                           // jz   generate_cop_exception
3728      _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_COP0);               // test [mips3.core.cpr[0][COP0_Status]],SR_COP0
3729      _jcc(COND_Z, mips3.drc->generate_cop_exception);                     // jz   generate_cop_exception
36473730      _resolve_link(&checklink);                                       // okay:
36483731   }
36493732
r869r870
36723755      case 0x02:   /* CFCz */
36733756         if (RTREG != 0)
36743757         {
3675            _mov_r32_m32abs(REG_EAX, &mips3.ccr[0][RDREG]);                  // mov  eax,[mips3.ccr[0][rdreg]]
3758            _mov_r32_m32abs(REG_EAX, &mips3.core.ccr[0][RDREG]);            // mov  eax,[mips3.core.ccr[0][rdreg]]
36763759            _cdq();                                                // cdq
36773760            _mov_m64bd_r64(REG_ESI, REGDISP(RTREG), REG_EDX, REG_EAX);         // mov  [rtreg],edx:eax
36783761         }
r869r870
36803763
36813764      case 0x04:   /* MTCz */
36823765         if (RTREG != 0)
3683            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.r[RTREG]]
3766            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.core.r[RTREG]]
36843767         else
36853768            _xor_r32_r32(REG_EAX, REG_EAX);                              // xor  eax,eax
36863769         result = recompile_set_cop0_reg(drc, RDREG);                     // write cop0 reg
r869r870
36883771
36893772      case 0x05:   /* DMTCz */
36903773         if (RTREG != 0)
3691            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.r[RTREG]]
3774            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.core.r[RTREG]]
36923775         else
36933776            _xor_r32_r32(REG_EAX, REG_EAX);                              // xor  eax,eax
36943777         result = recompile_set_cop0_reg(drc, RDREG);                     // write cop0 reg
r869r870
36963779
36973780      case 0x06:   /* CTCz */
36983781         if (RTREG != 0)
3699            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.r[RTREG]]
3782            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.core.r[RTREG]]
37003783         else
37013784            _xor_r32_r32(REG_EAX, REG_EAX);                              // xor  eax,eax
3702         _mov_m32abs_r32(&mips3.ccr[0][RDREG], REG_EAX);                     // mov  [mips3.ccr[0][RDREG]],eax
3785         _mov_m32abs_r32(&mips3.core.ccr[0][RDREG], REG_EAX);               // mov  [mips3.core.ccr[0][RDREG]],eax
37033786         return RECOMPILE_SUCCESSFUL_CP(1,4);
37043787
37053788//      case 0x08:  /* BC */
37063789//          switch (RTREG)
37073790//          {
3708//              case 0x00:  /* BCzF */  if (!mips3.cf[0][0]) ADDPC(SIMMVAL);                break;
3709//              case 0x01:  /* BCzF */  if (mips3.cf[0][0]) ADDPC(SIMMVAL);                 break;
3791//              case 0x00:  /* BCzF */  if (!mips3.core.cf[0][0]) ADDPC(SIMMVAL);                break;
3792//              case 0x01:  /* BCzF */  if (mips3.core.cf[0][0]) ADDPC(SIMMVAL);                 break;
37103793//              case 0x02:  /* BCzFL */ invalid_instruction(op);                            break;
37113794//              case 0x03:  /* BCzTL */ invalid_instruction(op);                            break;
37123795//              default:    invalid_instruction(op);                                        break;
r869r870
37323815         switch (op & 0x01ffffff)
37333816         {
37343817            case 0x01:   /* TLBR */
3735               _sub_r32_imm(REG_ESP, 12);
3736               drc_append_save_call_restore(drc, (genf *)tlbr, 12);
3818               _sub_r32_imm(REG_ESP, 8);
3819               _push_imm(&mips3.core);
3820               drc_append_save_call_restore(drc, (genf *)mips3com_tlbr, 12);
37373821               return RECOMPILE_SUCCESSFUL_CP(1,4);
37383822
37393823            case 0x02:   /* TLBWI */
3740               _sub_r32_imm(REG_ESP, 12);
3741               drc_append_save_call_restore(drc, (genf *)tlbwi, 12);
3824               _sub_r32_imm(REG_ESP, 8);
3825               _push_imm(&mips3.core);
3826               drc_append_save_call_restore(drc, (genf *)mips3com_tlbwi, 12);
37423827               return RECOMPILE_SUCCESSFUL_CP(1,4);
37433828
37443829            case 0x06:   /* TLBWR */
3745               _sub_r32_imm(REG_ESP, 12);
3746               drc_append_save_call_restore(drc, (genf *)tlbwr, 12);
3830               _sub_r32_imm(REG_ESP, 8);
3831               _push_imm(&mips3.core);
3832               drc_append_save_call_restore(drc, (genf *)mips3com_tlbwr, 12);
37473833               return RECOMPILE_SUCCESSFUL_CP(1,4);
37483834
37493835            case 0x08:   /* TLBP */
3750               _sub_r32_imm(REG_ESP, 12);
3751               drc_append_save_call_restore(drc, (genf *)tlbp, 12);
3836               _sub_r32_imm(REG_ESP, 8);
3837               _push_imm(&mips3.core);
3838               drc_append_save_call_restore(drc, (genf *)mips3com_tlbp, 12);
37523839               return RECOMPILE_SUCCESSFUL_CP(1,4);
37533840
37543841            case 0x10:   /* RFE */
3755               _jmp(mips3.generate_invalidop_exception);                  // jmp  generate_invalidop_exception
3842               _jmp(mips3.drc->generate_invalidop_exception);               // jmp  generate_invalidop_exception
37563843               return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
37573844
37583845            case 0x18:   /* ERET */
3759               _mov_r32_m32abs(REG_EDI, &mips3.cpr[0][COP0_EPC]);            // mov  edi,[mips3.cpr[0][COP0_EPC]]
3760               _and_m32abs_imm(&mips3.cpr[0][COP0_Status], ~SR_EXL);         // and  [mips3.cpr[0][COP0_Status]],~SR_EXL
3846               _mov_r32_m32abs(REG_EDI, &mips3.core.cpr[0][COP0_EPC]);         // mov  edi,[mips3.core.cpr[0][COP0_EPC]]
3847               _and_m32abs_imm(&mips3.core.cpr[0][COP0_Status], ~SR_EXL);      // and  [mips3.core.cpr[0][COP0_Status]],~SR_EXL
37613848               return RECOMPILE_SUCCESSFUL_CP(1,0) | RECOMPILE_CHECK_INTERRUPTS | RECOMPILE_END_OF_STRING | RECOMPILE_ADD_DISPATCH;
37623849
37633850            default:
3764               _jmp(mips3.generate_invalidop_exception);                  // jmp  generate_invalidop_exception
3851               _jmp(mips3.drc->generate_invalidop_exception);               // jmp  generate_invalidop_exception
37653852               return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
37663853         }
37673854         break;
37683855
37693856//      default:
3770//          _jmp(mips3.generate_invalidop_exception);                               // jmp  generate_invalidop_exception
3857//          _jmp(mips3.drc->generate_invalidop_exception);                          // jmp  generate_invalidop_exception
37713858//          return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
37723859   }
37733860   return RECOMPILE_UNIMPLEMENTED;
r869r870
37903877
37913878   if (mips3.drcoptions & MIPS3DRC_STRICT_COP1)
37923879   {
3793      _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_COP1);                  // test [mips3.cpr[0][COP0_Status]],SR_COP1
3794      _jcc(COND_Z, mips3.generate_cop_exception);                           // jz   generate_cop_exception
3880      _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_COP1);               // test [mips3.core.cpr[0][COP0_Status]],SR_COP1
3881      _jcc(COND_Z, mips3.drc->generate_cop_exception);                     // jz   generate_cop_exception
37953882   }
37963883
37973884   switch (RSREG)
r869r870
37993886      case 0x00:   /* MFCz */
38003887         if (RTREG != 0)
38013888         {
3802            _mov_r32_m32abs(REG_EAX, FPR32(RDREG));                        // mov  eax,[mips3.cpr[1][RDREG]]
3889            _mov_r32_m32abs(REG_EAX, FPR32(RDREG));                        // mov  eax,[mips3.core.cpr[1][RDREG]]
38033890            _cdq();                                                // cdq
3804            _mov_m64bd_r64(REG_ESI, REGDISP(RTREG), REG_EDX, REG_EAX);         // mov  [mips3.r[RTREG]],edx:eax
3891            _mov_m64bd_r64(REG_ESI, REGDISP(RTREG), REG_EDX, REG_EAX);         // mov  [mips3.core.r[RTREG]],edx:eax
38053892         }
38063893         return RECOMPILE_SUCCESSFUL_CP(1,4);
38073894
r869r870
38133900      case 0x02:   /* CFCz */
38143901         if (RTREG != 0)
38153902         {
3816            _mov_r32_m32abs(REG_EAX, &mips3.ccr[1][RDREG]);                  // mov  eax,[mips3.ccr[1][RDREG]]
3903            _mov_r32_m32abs(REG_EAX, &mips3.core.ccr[1][RDREG]);            // mov  eax,[mips3.core.ccr[1][RDREG]]
38173904            if (RDREG == 31)
38183905            {
38193906               _and_r32_imm(REG_EAX, ~0xfe800000);                        // and  eax,~0xfe800000
38203907               _xor_r32_r32(REG_EBX, REG_EBX);                           // xor  ebx,ebx
3821               _cmp_m8abs_imm(&mips3.cf[1][0], 0);                        // cmp  [cf[0]],0
3908               _cmp_m8abs_imm(&mips3.core.cf[1][0], 0);                  // cmp  [cf[0]],0
38223909               _setcc_r8(COND_NZ, REG_BL);                              // setnz bl
38233910               _shl_r32_imm(REG_EBX, 23);                              // shl  ebx,23
38243911               _or_r32_r32(REG_EAX, REG_EBX);                           // or   eax,ebx
3825               if (mips3.is_mips4)
3912               if (mips3.core.flavor >= MIPS3_TYPE_MIPS_IV)
38263913                  for (i = 1; i <= 7; i++)
38273914                  {
3828                     _cmp_m8abs_imm(&mips3.cf[1][i], 0);                  // cmp  [cf[i]],0
3915                     _cmp_m8abs_imm(&mips3.core.cf[1][i], 0);            // cmp  [cf[i]],0
38293916                     _setcc_r8(COND_NZ, REG_BL);                        // setnz bl
38303917                     _shl_r32_imm(REG_EBX, 24+i);                     // shl  ebx,24+i
38313918                     _or_r32_r32(REG_EAX, REG_EBX);                     // or   eax,ebx
38323919                  }
38333920            }
38343921            _cdq();                                                // cdq
3835            _mov_m64bd_r64(REG_ESI, REGDISP(RTREG), REG_EDX, REG_EAX);         // mov  [mips3.r[RTREG]],edx:eax
3922            _mov_m64bd_r64(REG_ESI, REGDISP(RTREG), REG_EDX, REG_EAX);         // mov  [mips3.core.r[RTREG]],edx:eax
38363923         }
38373924         return RECOMPILE_SUCCESSFUL_CP(1,4);
38383925
38393926      case 0x04:   /* MTCz */
38403927         if (RTREG != 0)
38413928         {
3842            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.r[RTREG]]
3843            _mov_m32abs_r32(FPR32(RDREG), REG_EAX);                        // mov  [mips3.cpr[1][RDREG]],eax
3929            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.core.r[RTREG]]
3930            _mov_m32abs_r32(FPR32(RDREG), REG_EAX);                        // mov  [mips3.core.cpr[1][RDREG]],eax
38443931         }
38453932         else
3846            _mov_m32abs_imm(FPR32(RDREG), 0);                           // mov  [mips3.cpr[1][RDREG]],0
3933            _mov_m32abs_imm(FPR32(RDREG), 0);                           // mov  [mips3.core.cpr[1][RDREG]],0
38473934         return RECOMPILE_SUCCESSFUL_CP(1,4);
38483935
38493936      case 0x05:   /* DMTCz */
38503937         if (RTREG != 0)
38513938            _mov_m64abs_m64bd(FPR64(RDREG), REG_ESI, REGDISP(RTREG));
38523939         else
3853            _zero_m64abs(FPR64(RDREG));                                 // mov  [mips3.cpr[1][RDREG]],0
3940            _zero_m64abs(FPR64(RDREG));                                 // mov  [mips3.core.cpr[1][RDREG]],0
38543941         return RECOMPILE_SUCCESSFUL_CP(1,4);
38553942
38563943      case 0x06:   /* CTCz */
38573944         if (RTREG != 0)
38583945         {
3859            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.r[RTREG]]
3860            _mov_m32abs_r32(&mips3.ccr[1][RDREG], REG_EAX);                  // mov  [mips3.ccr[1][RDREG]],eax
3946            _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));               // mov  eax,[mips3.core.r[RTREG]]
3947            _mov_m32abs_r32(&mips3.core.ccr[1][RDREG], REG_EAX);            // mov  [mips3.core.ccr[1][RDREG]],eax
38613948         }
38623949         else
3863            _mov_m32abs_imm(&mips3.ccr[1][RDREG], 0);                     // mov  [mips3.ccr[1][RDREG]],0
3950            _mov_m32abs_imm(&mips3.core.ccr[1][RDREG], 0);                  // mov  [mips3.core.ccr[1][RDREG]],0
38643951         if (RDREG == 31)
38653952         {
3866            _mov_r32_m32abs(REG_EAX, LO(&mips3.ccr[1][RDREG]));               // mov  eax,[mips3.ccr[1][RDREG]]
3953            _mov_r32_m32abs(REG_EAX, LO(&mips3.core.ccr[1][RDREG]));         // mov  eax,[mips3.core.ccr[1][RDREG]]
38673954            _test_r32_imm(REG_EAX, 1 << 23);                           // test eax,1<<23
3868            _setcc_m8abs(COND_NZ, &mips3.cf[1][0]);                        // setnz [cf[0]]
3869            if (mips3.is_mips4)
3955            _setcc_m8abs(COND_NZ, &mips3.core.cf[1][0]);                  // setnz [cf[0]]
3956            if (mips3.core.flavor >= MIPS3_TYPE_MIPS_IV)
38703957               for (i = 1; i <= 7; i++)
38713958               {
38723959                  _test_r32_imm(REG_EAX, 1 << (24+i));                  // test eax,1<<(24+i)
3873                  _setcc_m8abs(COND_NZ, &mips3.cf[1][i]);                  // setnz [cf[i]]
3960                  _setcc_m8abs(COND_NZ, &mips3.core.cf[1][i]);            // setnz [cf[i]]
38743961               }
38753962            _and_r32_imm(REG_EAX, 3);                                 // and  eax,3
38763963            _test_r32_imm(REG_EAX, 1);                                 // test eax,1
r869r870
38853972         switch ((op >> 16) & 3)
38863973         {
38873974            case 0x00:   /* BCzF */
3888               _cmp_m8abs_imm(&mips3.cf[1][mips3.is_mips4 ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
3975               _cmp_m8abs_imm(&mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
38893976               _jcc_near_link(COND_NZ, &link1);                        // jnz  link1
38903977               cycles = recompile_delay_slot(drc, pc + 4);                  // <next instruction>
38913978               append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);// <branch or dispatch>
r869r870
38933980               return RECOMPILE_SUCCESSFUL_CP(1,4);
38943981
38953982            case 0x01:   /* BCzT */
3896               _cmp_m8abs_imm(&mips3.cf[1][mips3.is_mips4 ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
3983               _cmp_m8abs_imm(&mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
38973984               _jcc_near_link(COND_Z, &link1);                           // jz   link1
38983985               cycles = recompile_delay_slot(drc, pc + 4);                  // <next instruction>
38993986               append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);// <branch or dispatch>
r869r870
39013988               return RECOMPILE_SUCCESSFUL_CP(1,4);
39023989
39033990            case 0x02:   /* BCzFL */
3904               _cmp_m8abs_imm(&mips3.cf[1][mips3.is_mips4 ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
3991               _cmp_m8abs_imm(&mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
39053992               _jcc_near_link(COND_NZ, &link1);                        // jnz  link1
39063993               cycles = recompile_delay_slot(drc, pc + 4);                  // <next instruction>
39073994               append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);// <branch or dispatch>
r869r870
39093996               return RECOMPILE_SUCCESSFUL_CP(1,8);
39103997
39113998            case 0x03:   /* BCzTL */
3912               _cmp_m8abs_imm(&mips3.cf[1][mips3.is_mips4 ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
3999               _cmp_m8abs_imm(&mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 18) & 7) : 0], 0);   // cmp  [cf[x]],0
39134000               _jcc_near_link(COND_Z, &link1);                           // jz   link1
39144001               cycles = recompile_delay_slot(drc, pc + 4);                  // <next instruction>
39154002               append_branch_or_dispatch(drc, pc + 4 + (SIMMVAL << 2), 1+cycles);// <branch or dispatch>
r869r870
42134300               return RECOMPILE_SUCCESSFUL_CP(1,4);
42144301
42154302            case 0x11:   /* R5000 */
4216               if (!mips3.is_mips4)
4303               if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
42174304               {
4218                  _jmp((void *)mips3.generate_invalidop_exception);         // jmp  generate_invalidop_exception
4305                  _jmp((void *)mips3.drc->generate_invalidop_exception);      // jmp  generate_invalidop_exception
42194306                  return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
42204307               }
4221               _cmp_m8abs_imm(&mips3.cf[1][(op >> 18) & 7], 0);            // cmp  [cf[x]],0
4308               _cmp_m8abs_imm(&mips3.core.cf[1][(op >> 18) & 7], 0);         // cmp  [cf[x]],0
42224309               _jcc_short_link(((op >> 16) & 1) ? COND_Z : COND_NZ, &link1);   // jz/nz skip
42234310               if (IS_SINGLE(op))   /* MOVT/F.S */
42244311               {
r869r870
42314318               return RECOMPILE_SUCCESSFUL_CP(1,4);
42324319
42334320            case 0x12:   /* R5000 */
4234               if (!mips3.is_mips4)
4321               if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
42354322               {
4236                  _jmp((void *)mips3.generate_invalidop_exception);         // jmp  generate_invalidop_exception
4323                  _jmp((void *)mips3.drc->generate_invalidop_exception);      // jmp  generate_invalidop_exception
42374324                  return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
42384325               }
42394326               _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));            // mov  eax,[rtreg].lo
r869r870
42504337               return RECOMPILE_SUCCESSFUL_CP(1,4);
42514338
42524339            case 0x13:   /* R5000 */
4253               if (!mips3.is_mips4)
4340               if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
42544341               {
4255                  _jmp((void *)mips3.generate_invalidop_exception);         // jmp  generate_invalidop_exception
4342                  _jmp((void *)mips3.drc->generate_invalidop_exception);      // jmp  generate_invalidop_exception
42564343                  return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
42574344               }
42584345               _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));            // mov  eax,[rtreg].lo
r869r870
42694356               return RECOMPILE_SUCCESSFUL_CP(1,4);
42704357
42714358            case 0x15:   /* R5000 */
4272               if (!mips3.is_mips4)
4359               if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
42734360               {
4274                  _jmp((void *)mips3.generate_invalidop_exception);         // jmp  generate_invalidop_exception
4361                  _jmp((void *)mips3.drc->generate_invalidop_exception);      // jmp  generate_invalidop_exception
42754362                  return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
42764363               }
42774364               _fld1();                                          // fld1
r869r870
42904377               return RECOMPILE_SUCCESSFUL_CP(1,4);
42914378
42924379            case 0x16:   /* R5000 */
4293               if (!mips3.is_mips4)
4380               if (mips3.core.flavor < MIPS3_TYPE_MIPS_IV)
42944381               {
4295                  _jmp((void *)mips3.generate_invalidop_exception);         // jmp  generate_invalidop_exception
4382                  _jmp((void *)mips3.drc->generate_invalidop_exception);      // jmp  generate_invalidop_exception
42964383                  return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
42974384               }
42984385               _fld1();                                          // fld1
r869r870
43564443
43574444            case 0x30:
43584445            case 0x38:
4359               _mov_m8abs_imm(&mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0], 0);   /* C.F.S/D */
4446               _mov_m8abs_imm(&mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0], 0);   /* C.F.S/D */
43604447               return RECOMPILE_SUCCESSFUL_CP(1,4);
43614448
43624449            case 0x31:
43634450            case 0x39:
4364               _mov_m8abs_imm(&mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0], 0);   /* C.UN.S/D */
4451               _mov_m8abs_imm(&mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0], 0);   /* C.UN.S/D */
43654452               return RECOMPILE_SUCCESSFUL_CP(1,4);
43664453
43674454            case 0x32:
r869r870
43784465                     _movsd_r128_m64abs(REG_XMM0, FPR64(FSREG));            // movsd xmm0,[fsreg]
43794466                     _comisd_r128_m64abs(REG_XMM0, FPR64(FTREG));         // comisd xmm0,[ftreg]
43804467                  }
4381                  _setcc_m8abs(COND_E, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
4468                  _setcc_m8abs(COND_E, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
43824469               }
43834470               else
43844471               {
r869r870
43954482                  _fcompp();                                       // fcompp
43964483                  _fnstsw_ax();                                    // fnstsw ax
43974484                  _sahf();                                       // sahf
4398                  _setcc_m8abs(COND_E, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
4485                  _setcc_m8abs(COND_E, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
43994486               }
44004487               return RECOMPILE_SUCCESSFUL_CP(1,4);
44014488
r869r870
44134500                     _movsd_r128_m64abs(REG_XMM0, FPR64(FSREG));            // movsd xmm0,[fsreg]
44144501                     _ucomisd_r128_m64abs(REG_XMM0, FPR64(FTREG));         // ucomisd xmm0,[ftreg]
44154502                  }
4416                  _setcc_m8abs(COND_E, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
4503                  _setcc_m8abs(COND_E, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
44174504               }
44184505               else
44194506               {
r869r870
44304517                  _fucompp();                                       // fucompp
44314518                  _fnstsw_ax();                                    // fnstsw ax
44324519                  _sahf();                                       // sahf
4433                  _setcc_m8abs(COND_E, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
4520                  _setcc_m8abs(COND_E, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // sete [cf[x]]
44344521               }
44354522               return RECOMPILE_SUCCESSFUL_CP(1,4);
44364523
r869r870
44484535                     _movsd_r128_m64abs(REG_XMM0, FPR64(FSREG));            // movsd xmm0,[fsreg]
44494536                     _comisd_r128_m64abs(REG_XMM0, FPR64(FTREG));         // comisd xmm0,[ftreg]
44504537                  }
4451                  _setcc_m8abs(COND_B, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
4538                  _setcc_m8abs(COND_B, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
44524539               }
44534540               else
44544541               {
r869r870
44654552                  _fcompp();                                       // fcompp
44664553                  _fnstsw_ax();                                    // fnstsw ax
44674554                  _sahf();                                       // sahf
4468                  _setcc_m8abs(COND_B, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
4555                  _setcc_m8abs(COND_B, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
44694556               }
44704557               return RECOMPILE_SUCCESSFUL_CP(1,4);
44714558
r869r870
44834570                     _movsd_r128_m64abs(REG_XMM0, FPR64(FSREG));            // movsd xmm0,[fsreg]
44844571                     _ucomisd_r128_m64abs(REG_XMM0, FPR64(FTREG));         // ucomisd xmm0,[ftreg]
44854572                  }
4486                  _setcc_m8abs(COND_B, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
4573                  _setcc_m8abs(COND_B, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
44874574               }
44884575               else
44894576               {
r869r870
45004587                  _fucompp();                                       // fucompp
45014588                  _fnstsw_ax();                                    // fnstsw ax
45024589                  _sahf();                                       // sahf
4503                  _setcc_m8abs(COND_B, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
4590                  _setcc_m8abs(COND_B, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setb [cf[x]]
45044591               }
45054592               return RECOMPILE_SUCCESSFUL_CP(1,4);
45064593
r869r870
45184605                     _movsd_r128_m64abs(REG_XMM0, FPR64(FSREG));            // movsd xmm0,[fsreg]
45194606                     _comisd_r128_m64abs(REG_XMM0, FPR64(FTREG));         // comisd xmm0,[ftreg]
45204607                  }
4521                  _setcc_m8abs(COND_BE, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setle [cf[x]]
4608                  _setcc_m8abs(COND_BE, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setle [cf[x]]
45224609               }
45234610               else
45244611               {
r869r870
45354622                  _fcompp();                                       // fcompp
45364623                  _fnstsw_ax();                                    // fnstsw ax
45374624                  _sahf();                                       // sahf
4538                  _setcc_m8abs(COND_BE, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setbe [cf[x]]
4625                  _setcc_m8abs(COND_BE, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setbe [cf[x]]
45394626               }
45404627               return RECOMPILE_SUCCESSFUL_CP(1,4);
45414628
r869r870
45534640                     _movsd_r128_m64abs(REG_XMM0, FPR64(FSREG));            // movsd xmm0,[fsreg]
45544641                     _ucomisd_r128_m64abs(REG_XMM0, FPR64(FTREG));         // ucomisd xmm0,[ftreg]
45554642                  }
4556                  _setcc_m8abs(COND_BE, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setl [cf[x]]
4643                  _setcc_m8abs(COND_BE, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setl [cf[x]]
45574644               }
45584645               else
45594646               {
r869r870
45704657                  _fucompp();                                       // fucompp
45714658                  _fnstsw_ax();                                    // fnstsw ax
45724659                  _sahf();                                       // sahf
4573                  _setcc_m8abs(COND_BE, &mips3.cf[1][mips3.is_mips4 ? ((op >> 8) & 7) : 0]); // setbe [cf[x]]
4660                  _setcc_m8abs(COND_BE, &mips3.core.cf[1][(mips3.core.flavor >= MIPS3_TYPE_MIPS_IV) ? ((op >> 8) & 7) : 0]); // setbe [cf[x]]
45744661               }
45754662               return RECOMPILE_SUCCESSFUL_CP(1,4);
45764663         }
45774664         break;
45784665   }
4579   _jmp((void *)mips3.generate_invalidop_exception);                        // jmp  generate_invalidop_exception
4666   _jmp((void *)mips3.drc->generate_invalidop_exception);                     // jmp  generate_invalidop_exception
45804667   return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
45814668}
45824669
r869r870
45944681{
45954682   if (mips3.drcoptions & MIPS3DRC_STRICT_COP1)
45964683   {
4597      _test_m32abs_imm(&mips3.cpr[0][COP0_Status], SR_COP1);                  // test [mips3.cpr[0][COP0_Status]],SR_COP1
4598      _jcc(COND_Z, mips3.generate_cop_exception);                           // jz   generate_cop_exception
4684      _test_m32abs_imm(&mips3.core.cpr[0][COP0_Status], SR_COP1);               // test [mips3.core.cpr[0][COP0_Status]],SR_COP1
4685      _jcc(COND_Z, mips3.drc->generate_cop_exception);                     // jz   generate_cop_exception
45994686   }
46004687
46014688   switch (op & 0x3f)
r869r870
46074694         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg]
46084695         _add_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // add  eax,[rtreg]
46094696         _push_r32(REG_EAX);                                          // push eax
4610         _call(mips3.read_and_translate_long);                           // call read_and_translate_long
4697         _call(mips3.drc->read_and_translate_long);                        // call read_and_translate_long
46114698         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
46124699         _mov_m32abs_r32(FPR32(FDREG), REG_EAX);                           // mov  [fdreg],eax
46134700         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
r869r870
46204707         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg]
46214708         _add_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // add  eax,[rtreg]
46224709         _push_r32(REG_EAX);                                          // push eax
4623         _call(mips3.read_and_translate_double);                           // call read_and_translate_double
4710         _call(mips3.drc->read_and_translate_double);                     // call read_and_translate_double
46244711         _mov_m32abs_r32(LO(FPR64(FDREG)), REG_EAX);                        // mov  [fdreg].lo,eax
46254712         _mov_m32abs_r32(HI(FPR64(FDREG)), REG_EDX);                        // mov  [fdreg].hi,edx
46264713         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
r869r870
46354722         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg]
46364723         _add_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // add  eax,[rtreg]
46374724         _push_r32(REG_EAX);                                          // push eax
4638         _call(mips3.write_and_translate_long);                           // call write_and_translate_long
4725         _call(mips3.drc->write_and_translate_long);                        // call write_and_translate_long
46394726         _add_r32_imm(REG_ESP, 12);                                    // add  esp,8
46404727         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
46414728         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
46444731         // REVISIT: does this actually work?
46454732         // Two 32-bit words are pushed, before the call, but three are popped afterwards!
46464733         // This, as far as I can see, will kill off the return address.
4647         // All other calls to mips3.write_and_translate_double take three 32-bit words as arguments.
4734         // All other calls to mips3.drc->write_and_translate_double take three 32-bit words as arguments.
46484735         // So is one argument too few being pushed, or is one too many being popped?
46494736         _mov_m32abs_r32(&mips3_icount, REG_EBP);                        // mov  [mips3_icount],ebp
46504737         _save_pc_before_call();                                       // save pc
r869r870
46524739         _push_m32abs(LO(FPR64(FSREG)));                                 // push [fsreg].lo
46534740         _mov_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RSREG));                  // mov  eax,[rsreg]
46544741         _add_r32_m32bd(REG_EAX, REG_ESI, REGDISP(RTREG));                  // add  eax,[rtreg]
4655         _call(mips3.write_and_translate_double);                        // call write_and_translate_double
4742         _call(mips3.drc->write_and_translate_double);                     // call write_and_translate_double
46564743         _add_r32_imm(REG_ESP, 12);                                    // add  esp,12
46574744         _mov_r32_m32abs(REG_EBP, &mips3_icount);                        // mov  ebp,[mips3_icount]
46584745         return RECOMPILE_SUCCESSFUL_CP(1,4);
r869r870
48324919         fprintf(stderr, "cop1x %X\n", op);
48334920         break;
48344921   }
4835   _jmp((void *)mips3.generate_invalidop_exception);                        // jmp  generate_invalidop_exception
4922   _jmp((void *)mips3.drc->generate_invalidop_exception);                     // jmp  generate_invalidop_exception
48364923   return RECOMPILE_SUCCESSFUL | RECOMPILE_END_OF_STRING;
48374924}
src/emu/cpu/mips/mips3drc.c
r869r870
1414#include <stddef.h>
1515#include "cpuintrf.h"
1616#include "debugger.h"
17#include "mips3.h"
18#include "cpu/x86drc.h"
17#include "mips3com.h"
1918
2019
21//In GCC, ECX/EDX are volatile
22//EBX/EBP/ESI/EDI are non-volatile
2320
24
25
2621/***************************************************************************
27    CONFIGURATION
22    DEBUGGING
2823***************************************************************************/
2924
3025#define LOG_CODE         (0)
31#define PRINTF_TLB         (0)
3226
33#define CACHE_SIZE         (16 * 1024 * 1024)
34#define MAX_INSTRUCTIONS   512
3527
3628
37
3829/***************************************************************************
39    CONSTANTS
30    CONFIGURATION
4031***************************************************************************/
4132
42/* COP0 registers */
43#define COP0_Index         0
44#define COP0_Random         1
45#define COP0_EntryLo      2
46#define COP0_EntryLo0      2
47#define COP0_EntryLo1      3
48#define COP0_Context      4
49#define COP0_PageMask      5
50#define COP0_Wired         6
51#define COP0_BadVAddr      8
52#define COP0_Count         9
53#define COP0_EntryHi      10
54#define COP0_Compare      11
55#define COP0_Status         12
56#define COP0_Cause         13
57#define COP0_EPC         14
58#define COP0_PRId         15
59#define COP0_Config         16
60#define COP0_XContext      20
33#define MAX_INSTRUCTIONS   512
6134
62/* Status register bits */
63#define SR_IE            0x00000001
64#define SR_EXL            0x00000002
65#define SR_ERL            0x00000004
66#define SR_KSU_MASK         0x00000018
67#define SR_KSU_KERNEL      0x00000000
68#define SR_KSU_SUPERVISOR   0x00000008
69#define SR_KSU_USER         0x00000010
70#define SR_IMSW0         0x00000100
71#define SR_IMSW1         0x00000200
72#define SR_IMEX0         0x00000400
73#define SR_IMEX1         0x00000800
74#define SR_IMEX2         0x00001000
75#define SR_IMEX3         0x00002000
76#define SR_IMEX4         0x00004000
77#define SR_IMEX5         0x00008000
78#define SR_DE            0x00010000
79#define SR_CE            0x00020000
80#define SR_CH            0x00040000
81#define SR_SR            0x00100000
82#define SR_TS            0x00200000
83#define SR_BEV            0x00400000
84#define SR_RE            0x02000000
85#define SR_FR            0x04000000
86#define SR_RP            0x08000000
87#define SR_COP0            0x10000000
88#define SR_COP1            0x20000000
89#define SR_COP2            0x40000000
90#define SR_COP3            0x80000000
9135
92/* exception types */
93#define EXCEPTION_INTERRUPT   0
94#define EXCEPTION_TLBMOD   1
95#define EXCEPTION_TLBLOAD   2
96#define EXCEPTION_TLBSTORE   3
97#define EXCEPTION_ADDRLOAD   4
98#define EXCEPTION_ADDRSTORE   5
99#define EXCEPTION_BUSINST   6
100#define EXCEPTION_BUSDATA   7
101#define EXCEPTION_SYSCALL   8
102#define EXCEPTION_BREAK      9
103#define EXCEPTION_INVALIDOP   10
104#define EXCEPTION_BADCOP   11
105#define EXCEPTION_OVERFLOW   12
106#define EXCEPTION_TRAP      13
10736
108
109
11037/***************************************************************************
111    HELPER MACROS
38    MACROS
11239***************************************************************************/
11340
114#define RSREG      ((op >> 21) & 31)
115#define RTREG      ((op >> 16) & 31)
116#define RDREG      ((op >> 11) & 31)
117#define SHIFT      ((op >> 6) & 31)
41#define SR         mips3.core.cpr[0][COP0_Status]
42#define IS_FR0      (!(SR & SR_FR))
43#define IS_FR1      (SR & SR_FR)
11844
119#define FRREG      ((op >> 21) & 31)
120#define FTREG      ((op >> 16) & 31)
121#define FSREG      ((op >> 11) & 31)
122#define FDREG      ((op >> 6) & 31)
12345
124#define IS_SINGLE(o) (((o) & (1 << 21)) == 0)
125#define IS_DOUBLE(o) (((o) & (1 << 21)) != 0)
126#define IS_FLOAT(o) (((o) & (1 << 23)) == 0)
127#define IS_INTEGRAL(o) (((o) & (1 << 23)) != 0)
12846
129#define SIMMVAL      ((INT16)op)
130#define UIMMVAL      ((UINT16)op)
131#define LIMMVAL      (op & 0x03ffffff)
132
133#define IS_FR0      (!(mips3.cpr[0][COP0_Status] & SR_FR))
134#define IS_FR1      (mips3.cpr[0][COP0_Status] & SR_FR)
135
136
137
13847/***************************************************************************
13948    STRUCTURES & TYPEDEFS
14049***************************************************************************/
14150
142/* memory access function table */
143typedef struct
144{
145   UINT8      (*readbyte)(offs_t);
146   UINT16      (*readword)(offs_t);
147   UINT32      (*readlong)(offs_t);
148   void      (*writebyte)(offs_t, UINT8);
149   void      (*writeword)(offs_t, UINT16);
150   void      (*writelong)(offs_t, UINT32);
151} memory_handlers;
152
153
15451/* code logging info */
52typedef struct _code_log_entry code_log_entry;
15553struct _code_log_entry
15654{
15755   UINT32      pc;
15856   UINT32      op;
15957   void *      base;
16058};
161typedef struct _code_log_entry code_log_entry;
16259
16360
164/* MIPS3 Registers */
165typedef struct
61/* fast RAM info */
62typedef struct _fast_ram_info fast_ram_info;
63struct _fast_ram_info
16664{
167   /* core registers */
168   UINT32      pc;
169   UINT64      hi;
170   UINT64      lo;
171   UINT64      r[32];
65   offs_t      start;
66   offs_t      end;
67   UINT8      readonly;
68   void *      base;
69};
17270
173   /* COP registers */
174   UINT64      cpr[4][32];
175   UINT64      ccr[4][32];
176   UINT8      cf[4][8];
17771
178   /* internal stuff */
179   drc_core *   drc;
180   UINT32      drcoptions;
181   UINT32      nextpc;
182   int       (*irq_callback)(int irqline);
183   UINT64      count_zero_time;
184   mame_timer *   compare_int_timer;
185   UINT8      is_mips4;
186   UINT8      flush_pending;
187   UINT32      system_clock;
188   UINT32      cpu_clock;
72/* hotspot info */
73typedef struct _hotspot_info hotspot_info;
74struct _hotspot_info
75{
76   offs_t      pc;
77   UINT32      opcode;
78   UINT32      cycles;
79};
18980
190   /* memory accesses */
191   UINT8      bigendian;
192   memory_handlers memory;
19381
194   /* cache memory */
195   UINT32 *   icache;
196   UINT32 *   dcache;
197   size_t      icache_size;
198   size_t      dcache_size;
82/* opaque drc-specific info */
83typedef struct _mips3drc_data mips3drc_data;
19984
200   /* MMU */
201   struct
202   {
203      UINT64   page_mask;
204      UINT64   entry_hi;
205      UINT64   entry_lo[2];
206   } tlb[48];
207   UINT32 *   tlb_table;
20885
86/* MIPS3 registers */
87typedef struct _mips3_regs mips3_regs;
88struct _mips3_regs
89{
90   /* core state */
91   mips3_state      core;
92   mips3drc_data *   drc;
93   UINT32         drcoptions;
94
95   /* internal stuff */
96   UINT32         nextpc;
97
20998   /* fast RAM */
210   UINT32      fastram_select;
211   struct
212   {
213      offs_t   start;
214      offs_t   end;
215      int      readonly;
216      void *   base;
217   } fastram[MIPS3_MAX_FASTRAM];
99   UINT32         fastram_select;
100   fast_ram_info   fastram[MIPS3_MAX_FASTRAM];
218101
219102   /* hotspots */
220   UINT32      hotspot_select;
221   struct
222   {
223      offs_t      pc;
224      UINT32      opcode;
225      UINT32      cycles;
226   } hotspot[MIPS3_MAX_HOTSPOTS];
103   UINT32         hotspot_select;
104   hotspot_info   hotspot[MIPS3_MAX_HOTSPOTS];
105};
227106
228   /* callbacks */
229   void *      generate_interrupt_exception;
230   void *      generate_cop_exception;
231   void *      generate_overflow_exception;
232   void *      generate_invalidop_exception;
233   void *      generate_syscall_exception;
234   void *      generate_break_exception;
235   void *      generate_trap_exception;
236   void *      generate_tlbload_exception;
237   void *      generate_tlbstore_exception;
238   void *      handle_pc_tlb_mismatch;
239   void *      read_and_translate_byte_signed;
240   void *      read_and_translate_byte_unsigned;
241   void *      read_and_translate_word_signed;
242   void *      read_and_translate_word_unsigned;
243   void *      read_and_translate_long;
244   void *      read_and_translate_double;
245   void *      write_and_translate_byte;
246   void *      write_and_translate_word;
247   void *      write_and_translate_long;
248   void *      write_and_translate_double;
249   void *      write_back_long;
250   void *      write_back_double;
251} mips3_regs;
252107
253108
254
255109/***************************************************************************
256110    FUNCTION PROTOTYPES
257111***************************************************************************/
258112
259113static void mips3drc_init(void);
260static void mips3drc_reset(drc_core *drc);
261static void mips3drc_recompile(drc_core *drc);
262static void mips3drc_entrygen(drc_core *drc);
114static void mips3drc_reset(void);
115static void mips3drc_execute(void);
116static void mips3drc_exit(void);
263117
264static void recompute_tlb_table(void);
265static void update_cycle_counting(void);
266118
267#ifdef MAME_DEBUG
268static offs_t mips3_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
269#endif /* MAME_DEBUG */
270119
271
272
273120/***************************************************************************
274    PUBLIC GLOBAL VARIABLES
275***************************************************************************/
276
277static int   mips3_icount;
278
279
280
281/***************************************************************************
282121    PRIVATE GLOBAL VARIABLES
283122***************************************************************************/
284123
285124static mips3_regs mips3;
286125
287126
288static const memory_handlers be_memory =
289{
290   program_read_byte_32be,  program_read_word_32be,  program_read_dword_32be,
291   program_write_byte_32be, program_write_word_32be, program_write_dword_32be
292};
293127
294static const memory_handlers le_memory =
295{
296   program_read_byte_32le,  program_read_word_32le,  program_read_dword_32le,
297   program_write_byte_32le, program_write_word_32le, program_write_dword_32le
298};
299
300
301
302128/***************************************************************************
303    IRQ HANDLING
129    CORE CALLBACKS
304130***************************************************************************/
305131
306static void set_irq_line(int irqline, int state)
307{
308   if (state != CLEAR_LINE)
309      mips3.cpr[0][COP0_Cause] |= 0x400 << irqline;
310   else
311      mips3.cpr[0][COP0_Cause] &= ~(0x400 << irqline);
312}
132/*-------------------------------------------------
133    mips3_reset - reset the processor
134-------------------------------------------------*/
313135
314
315
316/***************************************************************************
317    CONTEXT SWITCHING
318***************************************************************************/
319
320static void mips3_get_context(void *dst)
136static void mips3_reset(void)
321137{
322   /* copy the context */
323   if (dst)
324      *(mips3_regs *)dst = mips3;
138   mips3com_reset(&mips3.core);
139   mips3drc_reset();
325140}
326141
327142
328static void mips3_set_context(void *src)
329{
330   /* copy the context */
331   if (src)
332      mips3 = *(mips3_regs *)src;
333}
143/*-------------------------------------------------
144    mips3_execute - execute the CPU for the
145    specified number of cycles
146-------------------------------------------------*/
334147
335
336
337/***************************************************************************
338    INITIALIZATION AND SHUTDOWN
339***************************************************************************/
340
341static TIMER_CALLBACK( compare_int_callback )
342{
343   cpunum_set_input_line(param, 5, ASSERT_LINE);
344}
345
346
347static void mips3_init(int index, int clock, const void *_config, int (*irqcallback)(int))
348{
349   const struct mips3_config *config = _config;
350   mips3drc_init();
351
352   mips3.compare_int_timer = mame_timer_alloc(compare_int_callback);
353   mips3.irq_callback = irqcallback;
354
355   /* allocate memory */
356   mips3.icache = auto_malloc(config->icache);
357   mips3.dcache = auto_malloc(config->dcache);
358   mips3.tlb_table = auto_malloc(sizeof(mips3.tlb_table[0]) * (1 << (32 - 12)));
359
360   /* initialize the rest of the config */
361   mips3.icache_size = config->icache;
362   mips3.dcache_size = config->dcache;
363   mips3.system_clock = config->system_clock;
364   mips3.cpu_clock = clock;
365}
366
367
368static void mips3_reset(int bigendian, int mips4, UINT32 prid)
369{
370   UINT32 configreg;
371   int divisor;
372
373   /* set up the endianness */
374   mips3.bigendian = bigendian;
375   if (mips3.bigendian)
376      mips3.memory = be_memory;
377   else
378      mips3.memory = le_memory;
379
380   /* initialize the state */
381   mips3.pc = 0xbfc00000;
382   mips3.nextpc = ~0;
383   mips3.cpr[0][COP0_Status] = SR_BEV | SR_ERL;
384   mips3.cpr[0][COP0_Compare] = 0xffffffff;
385   mips3.cpr[0][COP0_Count] = 0;
386   mips3.count_zero_time = activecpu_gettotalcycles64();
387
388   /* reset the DRC */
389   drc_cache_reset(mips3.drc);
390
391   /* config register: set the cache line size to 32 bytes */
392   configreg = 0x00026030;
393
394   /* config register: set the data cache size */
395        if (mips3.icache_size <= 0x01000) configreg |= 0 << 6;
396   else if (mips3.icache_size <= 0x02000) configreg |= 1 << 6;
397   else if (mips3.icache_size <= 0x04000) configreg |= 2 << 6;
398   else if (mips3.icache_size <= 0x08000) configreg |= 3 << 6;
399   else if (mips3.icache_size <= 0x10000) configreg |= 4 << 6;
400   else if (mips3.icache_size <= 0x20000) configreg |= 5 << 6;
401   else if (mips3.icache_size <= 0x40000) configreg |= 6 << 6;
402   else                                   configreg |= 7 << 6;
403
404   /* config register: set the instruction cache size */
405        if (mips3.icache_size <= 0x01000) configreg |= 0 << 9;
406   else if (mips3.icache_size <= 0x02000) configreg |= 1 << 9;
407   else if (mips3.icache_size <= 0x04000) configreg |= 2 << 9;
408   else if (mips3.icache_size <= 0x08000) configreg |= 3 << 9;
409   else if (mips3.icache_size <= 0x10000) configreg |= 4 << 9;
410   else if (mips3.icache_size <= 0x20000) configreg |= 5 << 9;
411   else if (mips3.icache_size <= 0x40000) configreg |= 6 << 9;
412   else                                   configreg |= 7 << 9;
413
414   /* config register: set the endianness bit */
415   if (bigendian) configreg |= 0x00008000;
416
417   /* config register: set the system clock divider */
418   divisor = 2;
419   if (mips3.system_clock != 0)
420   {
421      divisor = mips3.cpu_clock / mips3.system_clock;
422      if (mips3.system_clock * divisor != mips3.cpu_clock)
423      {
424         configreg |= 0x80000000;
425         divisor = mips3.cpu_clock * 2 / mips3.system_clock;
426      }
427   }
428   configreg |= (((divisor < 2) ? 2 : (divisor > 8) ? 8 : divisor) - 2) << 28;
429
430   /* set up the architecture */
431   mips3.is_mips4 = mips4;
432   mips3.cpr[0][COP0_PRId] = prid;
433   mips3.cpr[0][COP0_Config] = configreg;
434
435   /* recompute the TLB table */
436   recompute_tlb_table();
437}
438
439
440/*
441
442    R6000A = 0x0600
443    R10000 = 0x0900
444    R4300  = 0x0b00
445    VR41XX = 0x0c00
446    R12000 = 0x0e00
447    R8000  = 0x1000
448    R4600  = 0x2000
449    R4650  = 0x2000
450    R5000  = 0x2300
451    R5432  = 0x5400
452    RM7000 = 0x2700
453*/
454
455#if (HAS_R4600||HAS_R4650)
456static void r4600be_reset(void)
457{
458   mips3_reset(1, 0, 0x2000);
459}
460
461static void r4600le_reset(void)
462{
463   mips3_reset(0, 0, 0x2000);
464}
465#endif
466
467
468#if (HAS_R4700)
469static void r4700be_reset(void)
470{
471   mips3_reset(1, 0, 0x2100);
472}
473
474static void r4700le_reset(void)
475{
476   mips3_reset(0, 0, 0x2100);
477}
478#endif
479
480
481#if (HAS_R5000)
482static void r5000be_reset(void)
483{
484   mips3_reset(1, 1, 0x2300);
485}
486
487static void r5000le_reset(void)
488{
489   mips3_reset(0, 1, 0x2300);
490}
491#endif
492
493
494#if (HAS_QED5271)
495static void qed5271be_reset(void)
496{
497   mips3_reset(1, 1, 0x2300);
498}
499
500static void qed5271le_reset(void)
501{
502   mips3_reset(1, 0, 0x2300);
503}
504#endif
505
506
507#if (HAS_RM7000)
508static void rm7000be_reset(void)
509{
510   mips3_reset(1, 1, 0x2700);
511}
512
513static void rm7000le_reset(void)
514{
515   mips3_reset(0, 1, 0x2700);
516}
517#endif
518
519
520static void mips3_exit(void)
521{
522   drc_exit(mips3.drc);
523}
524
525
526148static int mips3_execute(int cycles)
527149{
528150   /* update the cycle timing */
529   update_cycle_counting();
151   mips3com_update_cycle_counting(&mips3.core);
530152
531   /* count cycles and interrupt cycles */
153   /* execute */
532154   mips3_icount = cycles;
533   drc_execute(mips3.drc);
155   mips3drc_execute();
534156   return cycles - mips3_icount;
535157}
536158
537159
160/*-------------------------------------------------
161    mips3_exit - cleanup from execution
162-------------------------------------------------*/
538163
539/***************************************************************************
540    TLB HANDLING
541***************************************************************************/
542
543static void map_tlb_entries(void)
164static void mips3_exit(void)
544165{
545   int valid_asid = mips3.cpr[0][COP0_EntryHi] & 0xff;
546   int index;
547
548   /* iterate over all TLB entries */
549   for (index = 0; index < 48; index++)
550   {
551      UINT64 hi = mips3.tlb[index].entry_hi;
552
553      /* only process if the ASID matches or if BOTH entries are marked global */
554      if (valid_asid == (hi & 0xff) || ((mips3.tlb[index].entry_lo[0] & 1) && (mips3.tlb[index].entry_lo[1] & 1)))
555      {
556         UINT32 count = (mips3.tlb[index].page_mask >> 13) & 0x00fff;
557         UINT32 vpn = ((hi >> 13) & 0x07ffffff) << 1;
558         int which, i;
559
560         /* ignore if the virtual address is beyond 32 bits */
561         if (vpn < (1 << (32 - 12)))
562
563            /* loop over both the even and odd pages */
564            for (which = 0; which < 2; which++)
565            {
566               UINT64 lo = mips3.tlb[index].entry_lo[which];
567
568               /* only map if the TLB entry is valid */
569               if (lo & 2)
570               {
571                  UINT32 pfn = (lo >> 6) & 0x00ffffff;
572                  UINT32 wp = (~lo >> 2) & 1;
573
574                  for (i = 0; i <= count; i++, vpn++, pfn++)
575                     if (vpn < 0x80000 || vpn >= 0xc0000)
576                        mips3.tlb_table[vpn] = (pfn << 12) | wp;
577               }
578
579               /* otherwise, advance by the number of pages we would have mapped */
580               else
581                  vpn += count + 1;
582            }
583      }
584   }
166   mips3drc_exit();
585167}
586168
587169
588static void unmap_tlb_entries(void)
589{
590   int index;
170/*-------------------------------------------------
171    mips3_get_context - return a copy of the
172    current context
173-------------------------------------------------*/
591174
592   /* iterate over all TLB entries */
593   for (index = 0; index < 48; index++)
594   {
595      UINT64 hi = mips3.tlb[index].entry_hi;
596      UINT32 count = (mips3.tlb[index].page_mask >> 13) & 0x00fff;
597      UINT32 vpn = ((hi >> 13) & 0x07ffffff) << 1;
598      int which, i;
599
600      /* ignore if the virtual address is beyond 32 bits */
601      if (vpn < (1 << (32 - 12)))
602
603         /* loop over both the even and odd pages */
604         for (which = 0; which < 2; which++)
605            for (i = 0; i <= count; i++, vpn++)
606               if (vpn < 0x80000 || vpn >= 0xc0000)
607                  mips3.tlb_table[vpn] = 0xffffffff;
608   }
609}
610
611
612static void recompute_tlb_table(void)
175static void mips3_get_context(void *dst)
613176{
614   UINT32 addr;
615
616   /* map in the hard-coded spaces */
617   for (addr = 0x80000000; addr < 0xc0000000; addr += 1 << 12)
618      mips3.tlb_table[addr >> 12] = addr & 0x1ffff000;
619
620   /* reset everything else to unmapped */
621   memset(&mips3.tlb_table[0x00000000 >> 12], 0xff, sizeof(mips3.tlb_table[0]) * (0x80000000 >> 12));
622   memset(&mips3.tlb_table[0xc0000000 >> 12], 0xff, sizeof(mips3.tlb_table[0]) * (0x40000000 >> 12));
623
624   /* remap all the entries in the TLB */
625   map_tlb_entries();
177   if (dst != NULL)
178      *(mips3_regs *)dst = mips3;
626179}
627180
628181
629static int translate_address(int space, offs_t *address)
630{
631   if (space == ADDRESS_SPACE_PROGRAM)
632   {
633      UINT32 result = mips3.tlb_table[*address >> 12];
634      if (result == 0xffffffff)
635         return 0;
636      *address = (result & ~0xfff) | (*address & 0xfff);
637   }
638   return 1;
639}
182/*-------------------------------------------------
183    mips3_set_context - copy the current context
184    into the global state
185-------------------------------------------------*/
640186
641
642INLINE void logonetlbentry(int index, int which)
187static void mips3_set_context(void *src)
643188{
644#if PRINTF_TLB
645   UINT64 hi = mips3.cpr[0][COP0_EntryHi];
646   UINT64 lo = mips3.cpr[0][COP0_EntryLo0 + which];
647   UINT32 vpn = (((hi >> 13) & 0x07ffffff) << 1);
648   UINT32 asid = hi & 0xff;
649   UINT32 r = (hi >> 62) & 3;
650   UINT32 pfn = (lo >> 6) & 0x00ffffff;
651   UINT32 c = (lo >> 3) & 7;
652   UINT32 pagesize = (((mips3.cpr[0][COP0_PageMask] >> 13) & 0xfff) + 1) << 12;
653   UINT64 vaddr = (UINT64)vpn * 0x1000;
654   UINT64 paddr = (UINT64)pfn * 0x1000;
655
656   vaddr += pagesize * which;
657
658   mame_printf_debug("index=%08X  pagesize=%08X  vaddr=%08X%08X  paddr=%08X%08X  asid=%02X  r=%X  c=%X  dvg=%c%c%c\n",
659         index, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr,
660         asid, r, c, (lo & 4) ? 'd' : '.', (lo & 2) ? 'v' : '.', (lo & 1) ? 'g' : '.');
661#endif
189   if (src != NULL)
190      mips3 = *(mips3_regs *)src;
662191}
663192
664193
665static void logtlbentry(int index)
666{
667   logonetlbentry(index, 0);
668   logonetlbentry(index, 1);
669}
194/*-------------------------------------------------
195    mips3_translate - perform virtual-to-physical
196    address translation
197-------------------------------------------------*/
670198
671
672static void tlbr(void)
199static int mips3_translate(int space, offs_t *address)
673200{
674   UINT32 index = mips3.cpr[0][COP0_Index] & 0x3f;
675   if (index < 48)
676   {
677      mips3.cpr[0][COP0_PageMask] = mips3.tlb[index].page_mask;
678      mips3.cpr[0][COP0_EntryHi] = mips3.tlb[index].entry_hi;
679      mips3.cpr[0][COP0_EntryLo0] = mips3.tlb[index].entry_lo[0];
680      mips3.cpr[0][COP0_EntryLo1] = mips3.tlb[index].entry_lo[1];
681   }
201   return mips3com_translate_address(&mips3.core, space, address);
682202}
683203
684204
685static void tlbwi(void)
686{
687   UINT32 index = mips3.cpr[0][COP0_Index] & 0x3f;
688   logtlbentry(index);
689   if (index < 48)
690   {
691      unmap_tlb_entries();
692      mips3.tlb[index].page_mask = mips3.cpr[0][COP0_PageMask];
693      mips3.tlb[index].entry_hi = mips3.cpr[0][COP0_EntryHi] & ~(mips3.tlb[index].page_mask & U64(0x0000000001ffe000));
694      mips3.tlb[index].entry_lo[0] = mips3.cpr[0][COP0_EntryLo0];
695      mips3.tlb[index].entry_lo[1] = mips3.cpr[0][COP0_EntryLo1];
696      map_tlb_entries();
697   }
698}
205/*-------------------------------------------------
206    mips3_dasm - disassemble an instruction
207-------------------------------------------------*/
699208
700
701static void tlbwr(void)
209#ifdef MAME_DEBUG
210static offs_t mips3_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
702211{
703   UINT32 wired = mips3.cpr[0][COP0_Wired] & 0x3f;
704   UINT32 index = 48 - wired;
705   if (index > 0)
706      index = ((activecpu_gettotalcycles64() - mips3.count_zero_time) % index + wired) & 0x3f;
707   else
708      index = 47;
709   logtlbentry(index);
710   {
711      unmap_tlb_entries();
712      mips3.tlb[index].page_mask = mips3.cpr[0][COP0_PageMask];
713      mips3.tlb[index].entry_hi = mips3.cpr[0][COP0_EntryHi] & ~(mips3.tlb[index].page_mask & U64(0x0000000001ffe000));
714      mips3.tlb[index].entry_lo[0] = mips3.cpr[0][COP0_EntryLo0];
715      mips3.tlb[index].entry_lo[1] = mips3.cpr[0][COP0_EntryLo1];
716      map_tlb_entries();
717   }
212   return mips3com_dasm(&mips3.core, buffer, pc, oprom, opram);
718213}
214#endif /* MAME_DEBUG */
719215
720216
721static void tlbp(void)
722{
723   UINT32 index;
724   UINT64 vpn;
725217
726//  DEBUGGER_BREAK;
727   for (index = 0; index < 48; index++)
728   {
729      UINT64 mask = ~(mips3.tlb[index].page_mask & U64(0x0000000001ffe000)) & ~U64(0x1fff);
730#if PRINTF_TLB
731mame_printf_debug("Mask = %08X%08X  TLB = %08X%08X  MATCH = %08X%08X\n",
732   (UINT32)(mask >> 32), (UINT32)mask,
733   (UINT32)(mips3.tlb[index].entry_hi >> 32), (UINT32)mips3.tlb[index].entry_hi,
734   (UINT32)(mips3.cpr[0][COP0_EntryHi] >> 32), (UINT32)mips3.cpr[0][COP0_EntryHi]);
735#endif
736      if ((mips3.tlb[index].entry_hi & mask) == (mips3.cpr[0][COP0_EntryHi] & mask))
737      {
738         if (((mips3.tlb[index].entry_lo[0] & 1) && (mips3.tlb[index].entry_lo[1] & 1)) ||
739            (mips3.tlb[index].entry_hi & 0xff) == (mips3.cpr[0][COP0_EntryHi] & 0xff))
740            break;
741      }
742   }
743   vpn = ((mips3.cpr[0][COP0_EntryHi] >> 13) & 0x07ffffff) << 1;
744   if (index != 48)
745   {
746      if (mips3.tlb_table[vpn & 0xfffff] == 0xffffffff)
747      {
748#if PRINTF_TLB
749         mame_printf_debug("TLBP: Should have not found an entry\n");
750//          DEBUGGER_BREAK;
751#endif
752      }
753      mips3.cpr[0][COP0_Index] = index;
754   }
755   else
756   {
757      if (mips3.tlb_table[vpn & 0xfffff] != 0xffffffff)
758      {
759#if PRINTF_TLB
760         mame_printf_debug("TLBP: Should havefound an entry\n");
761//          DEBUGGER_BREAK;
762#endif
763      }
764      mips3.cpr[0][COP0_Index] = 0x80000000;
765   }
766}
767
768
769
770218/***************************************************************************
771    RECOMPILER CALLBACKS
772***************************************************************************/
773
774/*------------------------------------------------------------------
775    update_cycle_counting
776------------------------------------------------------------------*/
777
778static void update_cycle_counting(void)
779{
780   /* modify the timer to go off */
781   if ((mips3.cpr[0][COP0_Status] & 0x8000) && mips3.cpr[0][COP0_Compare] != 0xffffffff)
782   {
783      UINT32 count = (activecpu_gettotalcycles64() - mips3.count_zero_time) / 2;
784      UINT32 compare = mips3.cpr[0][COP0_Compare];
785      UINT32 cyclesleft = compare - count;
786      mame_time newtime = MAME_TIME_IN_CYCLES(((INT64)cyclesleft * 2), cpu_getactivecpu());
787
788      /* due to accuracy issues, don't bother setting timers unless they're for less than 100msec */
789      if (compare_mame_times(newtime, MAME_TIME_IN_MSEC(100)) < 0)
790         mame_timer_adjust(mips3.compare_int_timer, newtime, cpu_getactivecpu(), time_zero);
791   }
792   else
793      mame_timer_adjust(mips3.compare_int_timer, time_never, cpu_getactivecpu(), time_zero);
794}
795
796
797
798
799/***************************************************************************
800219    CODE LOGGING
801220***************************************************************************/
802221
r869r870
818237   code_log_index++;
819238}
820239
821static void code_log(drc_core *drc, const char *label, void *start)
240static void code_log(const char *label, void *start, void *stop)
822241{
823242   extern int i386_dasm_one(char *buffer, UINT32 eip, UINT8 *oprom, int mode);
824243   extern unsigned dasmmips3(char *buffer, unsigned pc, UINT32 op);
r869r870
833252   fprintf(f, "\n%s\n", label);
834253
835254   /* loop from the start until the cache top */
836   while (cur < drc->cache_top)
255   while (cur < (UINT8 *)stop)
837256   {
838257      char buffer[100];
839258      int bytes;
840259      int op;
841260
842261      /* disassemble this instruction */
262#ifdef PTR64
263      bytes = i386_dasm_one(buffer, (UINT32)cur, cur, 64) & DASMFLAG_LENGTHMASK;
264#else
843265      bytes = i386_dasm_one(buffer, (UINT32)cur, cur, 32) & DASMFLAG_LENGTHMASK;
266#endif
844267
845268      /* look for a match in the registered opcodes */
846269      for (op = 0; op < code_log_index; op++)
r869r870
849272
850273      /* if no match, just output the current instruction */
851274      if (op == code_log_index)
852         fprintf(f, "%08X: %s\n", (UINT32)cur, buffer);
275         fprintf(f, "%p: %s\n", cur, buffer);
853276
854277      /* otherwise, output with the original instruction to the right */
855278      else
856279      {
857280         char buffer2[100];
858281         dasmmips3(buffer2, code_log_buffer[op].pc, code_log_buffer[op].op);
859         fprintf(f, "%08X: %-50s %08X: %s\n", (UINT32)cur, buffer, code_log_buffer[op].pc, buffer2);
282         fprintf(f, "%p: %-50s %08X: %s\n", cur, buffer, code_log_buffer[op].pc, buffer2);
860283      }
861284
862285      /* advance past this instruction */
r869r870
881304    RECOMPILER CORE
882305***************************************************************************/
883306
884
307#ifdef PTR64
308#include "mdrc64.c"
309#else
885310#include "mdrcold.c"
886//#include "mdrc32.c"
311#endif
887312
888313
889314
890315/***************************************************************************
891    DISASSEMBLY HOOK
316    GENERIC GET/SET INFO
892317***************************************************************************/
893318
894#ifdef MAME_DEBUG
895static offs_t mips3_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
896{
897   extern unsigned dasmmips3(char *, unsigned, UINT32);
898   UINT32 op = *(UINT32 *)oprom;
899   if (mips3.bigendian)
900      op = BIG_ENDIANIZE_INT32(op);
901   else
902      op = LITTLE_ENDIANIZE_INT32(op);
903   return dasmmips3(buffer, pc, op);
904}
905#endif /* MAME_DEBUG */
906
907
908/**************************************************************************
909 * Generic set_info
910 **************************************************************************/
911
912319static void mips3_set_info(UINT32 state, cpuinfo *info)
913320{
914321   switch (state)
915322   {
916323      /* --- the following bits of info are set as 64-bit signed integers --- */
917      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      set_irq_line(MIPS3_IRQ0, info->i);      break;
918      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      set_irq_line(MIPS3_IRQ1, info->i);      break;
919      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ2:      set_irq_line(MIPS3_IRQ2, info->i);      break;
920      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ3:      set_irq_line(MIPS3_IRQ3, info->i);      break;
921      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ4:      set_irq_line(MIPS3_IRQ4, info->i);      break;
922      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ5:      set_irq_line(MIPS3_IRQ5, info->i);      break;
923
924      case CPUINFO_INT_PC:
925      case CPUINFO_INT_REGISTER + MIPS3_PC:         mips3.pc = info->i;                  break;
926      case CPUINFO_INT_REGISTER + MIPS3_SR:         mips3.cpr[0][COP0_Status] = info->i;    break;
927      case CPUINFO_INT_REGISTER + MIPS3_EPC:         mips3.cpr[0][COP0_EPC] = info->i;       break;
928      case CPUINFO_INT_REGISTER + MIPS3_CAUSE:      mips3.cpr[0][COP0_Cause] = info->i;      break;
929      case CPUINFO_INT_REGISTER + MIPS3_COUNT:      mips3.cpr[0][COP0_Count] = info->i;    break;
930      case CPUINFO_INT_REGISTER + MIPS3_COMPARE:      mips3.cpr[0][COP0_Compare] = info->i;    break;
931      case CPUINFO_INT_REGISTER + MIPS3_INDEX:      mips3.cpr[0][COP0_Index] = info->i;    break;
932      case CPUINFO_INT_REGISTER + MIPS3_RANDOM:      mips3.cpr[0][COP0_Random] = info->i;    break;
933      case CPUINFO_INT_REGISTER + MIPS3_ENTRYHI:      mips3.cpr[0][COP0_EntryHi] = info->i;    break;
934      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO0:      mips3.cpr[0][COP0_EntryLo0] = info->i;    break;
935      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO1:      mips3.cpr[0][COP0_EntryLo1] = info->i;    break;
936      case CPUINFO_INT_REGISTER + MIPS3_PAGEMASK:      mips3.cpr[0][COP0_PageMask] = info->i;    break;
937      case CPUINFO_INT_REGISTER + MIPS3_WIRED:      mips3.cpr[0][COP0_Wired] = info->i;    break;
938      case CPUINFO_INT_REGISTER + MIPS3_BADVADDR:      mips3.cpr[0][COP0_BadVAddr] = info->i;    break;
939
940      case CPUINFO_INT_REGISTER + MIPS3_R0:         mips3.r[0] = info->i;               break;
941      case CPUINFO_INT_REGISTER + MIPS3_R1:         mips3.r[1] = info->i;               break;
942      case CPUINFO_INT_REGISTER + MIPS3_R2:         mips3.r[2] = info->i;               break;
943      case CPUINFO_INT_REGISTER + MIPS3_R3:         mips3.r[3] = info->i;               break;
944      case CPUINFO_INT_REGISTER + MIPS3_R4:         mips3.r[4] = info->i;               break;
945      case CPUINFO_INT_REGISTER + MIPS3_R5:         mips3.r[5] = info->i;               break;
946      case CPUINFO_INT_REGISTER + MIPS3_R6:         mips3.r[6] = info->i;               break;
947      case CPUINFO_INT_REGISTER + MIPS3_R7:         mips3.r[7] = info->i;               break;
948      case CPUINFO_INT_REGISTER + MIPS3_R8:         mips3.r[8] = info->i;               break;
949      case CPUINFO_INT_REGISTER + MIPS3_R9:         mips3.r[9] = info->i;               break;
950      case CPUINFO_INT_REGISTER + MIPS3_R10:         mips3.r[10] = info->i;               break;
951      case CPUINFO_INT_REGISTER + MIPS3_R11:         mips3.r[11] = info->i;               break;
952      case CPUINFO_INT_REGISTER + MIPS3_R12:         mips3.r[12] = info->i;               break;
953      case CPUINFO_INT_REGISTER + MIPS3_R13:         mips3.r[13] = info->i;               break;
954      case CPUINFO_INT_REGISTER + MIPS3_R14:         mips3.r[14] = info->i;               break;
955      case CPUINFO_INT_REGISTER + MIPS3_R15:         mips3.r[15] = info->i;               break;
956      case CPUINFO_INT_REGISTER + MIPS3_R16:         mips3.r[16] = info->i;               break;
957      case CPUINFO_INT_REGISTER + MIPS3_R17:         mips3.r[17] = info->i;               break;
958      case CPUINFO_INT_REGISTER + MIPS3_R18:         mips3.r[18] = info->i;               break;
959      case CPUINFO_INT_REGISTER + MIPS3_R19:         mips3.r[19] = info->i;               break;
960      case CPUINFO_INT_REGISTER + MIPS3_R20:         mips3.r[20] = info->i;               break;
961      case CPUINFO_INT_REGISTER + MIPS3_R21:         mips3.r[21] = info->i;               break;
962      case CPUINFO_INT_REGISTER + MIPS3_R22:         mips3.r[22] = info->i;               break;
963      case CPUINFO_INT_REGISTER + MIPS3_R23:         mips3.r[23] = info->i;               break;
964      case CPUINFO_INT_REGISTER + MIPS3_R24:         mips3.r[24] = info->i;               break;
965      case CPUINFO_INT_REGISTER + MIPS3_R25:         mips3.r[25] = info->i;               break;
966      case CPUINFO_INT_REGISTER + MIPS3_R26:         mips3.r[26] = info->i;               break;
967      case CPUINFO_INT_REGISTER + MIPS3_R27:         mips3.r[27] = info->i;               break;
968      case CPUINFO_INT_REGISTER + MIPS3_R28:         mips3.r[28] = info->i;               break;
969      case CPUINFO_INT_REGISTER + MIPS3_R29:         mips3.r[29] = info->i;               break;
970      case CPUINFO_INT_REGISTER + MIPS3_R30:         mips3.r[30] = info->i;               break;
971      case CPUINFO_INT_SP:
972      case CPUINFO_INT_REGISTER + MIPS3_R31:         mips3.r[31] = info->i;               break;
973      case CPUINFO_INT_REGISTER + MIPS3_HI:         mips3.hi = info->i;                  break;
974      case CPUINFO_INT_REGISTER + MIPS3_LO:         mips3.lo = info->i;                  break;
975
976324      case CPUINFO_INT_MIPS3_DRC_OPTIONS:            mips3.drcoptions = info->i;            break;
977325
978326      case CPUINFO_INT_MIPS3_FASTRAM_SELECT:         if (info->i >= 0 && info->i < MIPS3_MAX_FASTRAM) mips3.fastram_select = info->i; break;
r869r870
987335
988336      /* --- the following bits of info are set as pointers to data or functions --- */
989337      case CPUINFO_PTR_MIPS3_FASTRAM_BASE:         mips3.fastram[mips3.fastram_select].base = info->p;   break;
338
339      /* --- everything else is handled generically --- */
340      default:                              mips3com_set_info(&mips3.core, state, info);   break;
990341   }
991342}
992343
993344
994
995/**************************************************************************
996 * Generic get_info
997 **************************************************************************/
998
999345void mips3_get_info(UINT32 state, cpuinfo *info)
1000346{
1001347   switch (state)
1002348   {
1003349      /* --- the following bits of info are returned as 64-bit signed integers --- */
1004350      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(mips3);            break;
1005      case CPUINFO_INT_INPUT_LINES:               info->i = 6;                     break;
1006      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
1007      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1008      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
1009      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 4;                     break;
1010      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 4;                     break;
1011      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
1012      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
1013
1014      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1015      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1016      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1017      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1018      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 12;               break;
1019
1020      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      info->i = (mips3.cpr[0][COP0_Cause] & 0x400) ? ASSERT_LINE : CLEAR_LINE;   break;
1021      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      info->i = (mips3.cpr[0][COP0_Cause] & 0x800) ? ASSERT_LINE : CLEAR_LINE;   break;
1022      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ2:      info->i = (mips3.cpr[0][COP0_Cause] & 0x1000) ? ASSERT_LINE : CLEAR_LINE;   break;
1023      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ3:      info->i = (mips3.cpr[0][COP0_Cause] & 0x2000) ? ASSERT_LINE : CLEAR_LINE;   break;
1024      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ4:      info->i = (mips3.cpr[0][COP0_Cause] & 0x4000) ? ASSERT_LINE : CLEAR_LINE;   break;
1025      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ5:      info->i = (mips3.cpr[0][COP0_Cause] & 0x8000) ? ASSERT_LINE : CLEAR_LINE;   break;
1026
1027351      case CPUINFO_INT_PREVIOUSPC:               /* not implemented */               break;
1028352
1029      case CPUINFO_INT_PC:
1030      case CPUINFO_INT_REGISTER + MIPS3_PC:         info->i = mips3.pc;                  break;
1031      case CPUINFO_INT_REGISTER + MIPS3_SR:         info->i = mips3.cpr[0][COP0_Status];   break;
1032      case CPUINFO_INT_REGISTER + MIPS3_EPC:         info->i = mips3.cpr[0][COP0_EPC];      break;
1033      case CPUINFO_INT_REGISTER + MIPS3_CAUSE:      info->i = mips3.cpr[0][COP0_Cause];      break;
1034      case CPUINFO_INT_REGISTER + MIPS3_COUNT:      info->i = ((activecpu_gettotalcycles64() - mips3.count_zero_time) / 2); break;
1035      case CPUINFO_INT_REGISTER + MIPS3_COMPARE:      info->i = mips3.cpr[0][COP0_Compare];   break;
1036      case CPUINFO_INT_REGISTER + MIPS3_INDEX:      info->i = mips3.cpr[0][COP0_Index];      break;
1037      case CPUINFO_INT_REGISTER + MIPS3_RANDOM:      info->i = mips3.cpr[0][COP0_Random];   break;
1038      case CPUINFO_INT_REGISTER + MIPS3_ENTRYHI:      info->i = mips3.cpr[0][COP0_EntryHi];   break;
1039      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO0:      info->i = mips3.cpr[0][COP0_EntryLo0];   break;
1040      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO1:      info->i = mips3.cpr[0][COP0_EntryLo1];   break;
1041      case CPUINFO_INT_REGISTER + MIPS3_PAGEMASK:      info->i = mips3.cpr[0][COP0_PageMask];   break;
1042      case CPUINFO_INT_REGISTER + MIPS3_WIRED:      info->i = mips3.cpr[0][COP0_Wired];      break;
1043      case CPUINFO_INT_REGISTER + MIPS3_BADVADDR:      info->i = mips3.cpr[0][COP0_BadVAddr];   break;
1044
1045      case CPUINFO_INT_REGISTER + MIPS3_R0:         info->i = mips3.r[0];               break;
1046      case CPUINFO_INT_REGISTER + MIPS3_R1:         info->i = mips3.r[1];               break;
1047      case CPUINFO_INT_REGISTER + MIPS3_R2:         info->i = mips3.r[2];               break;
1048      case CPUINFO_INT_REGISTER + MIPS3_R3:         info->i = mips3.r[3];               break;
1049      case CPUINFO_INT_REGISTER + MIPS3_R4:         info->i = mips3.r[4];               break;
1050      case CPUINFO_INT_REGISTER + MIPS3_R5:         info->i = mips3.r[5];               break;
1051      case CPUINFO_INT_REGISTER + MIPS3_R6:         info->i = mips3.r[6];               break;
1052      case CPUINFO_INT_REGISTER + MIPS3_R7:         info->i = mips3.r[7];               break;
1053      case CPUINFO_INT_REGISTER + MIPS3_R8:         info->i = mips3.r[8];               break;
1054      case CPUINFO_INT_REGISTER + MIPS3_R9:         info->i = mips3.r[9];               break;
1055      case CPUINFO_INT_REGISTER + MIPS3_R10:         info->i = mips3.r[10];               break;
1056      case CPUINFO_INT_REGISTER + MIPS3_R11:         info->i = mips3.r[11];               break;
1057      case CPUINFO_INT_REGISTER + MIPS3_R12:         info->i = mips3.r[12];               break;
1058      case CPUINFO_INT_REGISTER + MIPS3_R13:         info->i = mips3.r[13];               break;
1059      case CPUINFO_INT_REGISTER + MIPS3_R14:         info->i = mips3.r[14];               break;
1060      case CPUINFO_INT_REGISTER + MIPS3_R15:         info->i = mips3.r[15];               break;
1061      case CPUINFO_INT_REGISTER + MIPS3_R16:         info->i = mips3.r[16];               break;
1062      case CPUINFO_INT_REGISTER + MIPS3_R17:         info->i = mips3.r[17];               break;
1063      case CPUINFO_INT_REGISTER + MIPS3_R18:         info->i = mips3.r[18];               break;
1064      case CPUINFO_INT_REGISTER + MIPS3_R19:         info->i = mips3.r[19];               break;
1065      case CPUINFO_INT_REGISTER + MIPS3_R20:         info->i = mips3.r[20];               break;
1066      case CPUINFO_INT_REGISTER + MIPS3_R21:         info->i = mips3.r[21];               break;
1067      case CPUINFO_INT_REGISTER + MIPS3_R22:         info->i = mips3.r[22];               break;
1068      case CPUINFO_INT_REGISTER + MIPS3_R23:         info->i = mips3.r[23];               break;
1069      case CPUINFO_INT_REGISTER + MIPS3_R24:         info->i = mips3.r[24];               break;
1070      case CPUINFO_INT_REGISTER + MIPS3_R25:         info->i = mips3.r[25];               break;
1071      case CPUINFO_INT_REGISTER + MIPS3_R26:         info->i = mips3.r[26];               break;
1072      case CPUINFO_INT_REGISTER + MIPS3_R27:         info->i = mips3.r[27];               break;
1073      case CPUINFO_INT_REGISTER + MIPS3_R28:         info->i = mips3.r[28];               break;
1074      case CPUINFO_INT_REGISTER + MIPS3_R29:         info->i = mips3.r[29];               break;
1075      case CPUINFO_INT_REGISTER + MIPS3_R30:         info->i = mips3.r[30];               break;
1076      case CPUINFO_INT_SP:
1077      case CPUINFO_INT_REGISTER + MIPS3_R31:         info->i = mips3.r[31];               break;
1078      case CPUINFO_INT_REGISTER + MIPS3_HI:         info->i = mips3.hi;                  break;
1079      case CPUINFO_INT_REGISTER + MIPS3_LO:         info->i = mips3.lo;                  break;
1080
1081353      /* --- the following bits of info are returned as pointers to data or functions --- */
1082354      case CPUINFO_PTR_SET_INFO:                  info->setinfo = mips3_set_info;         break;
1083355      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = mips3_get_context;   break;
1084356      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = mips3_set_context;   break;
1085      case CPUINFO_PTR_INIT:                     info->init = mips3_init;            break;
1086      case CPUINFO_PTR_RESET:                     /* provided per-CPU */               break;
357      case CPUINFO_PTR_INIT:                     /* provided per-CPU */               break;
358      case CPUINFO_PTR_RESET:                     info->reset = mips3_reset;            break;
1087359      case CPUINFO_PTR_EXIT:                     info->exit = mips3_exit;            break;
1088360      case CPUINFO_PTR_EXECUTE:                  info->execute = mips3_execute;         break;
1089      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1090361#ifdef MAME_DEBUG
1091362      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = mips3_dasm;         break;
1092363#endif /* MAME_DEBUG */
1093      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &mips3_icount;         break;
1094      case CPUINFO_PTR_TRANSLATE:                  info->translate = translate_address;   break;
364      case CPUINFO_PTR_TRANSLATE:                  info->translate = mips3_translate;      break;
1095365
1096366      /* --- the following bits of info are returned as NULL-terminated strings --- */
1097      case CPUINFO_STR_NAME:                     strcpy(info->s, "MIPS III");         break;
1098      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "MIPS III");         break;
1099      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");               break;
1100367      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
1101      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright (C) Aaron Giles 2000-2004"); break;
1102368
1103      case CPUINFO_STR_FLAGS:                     strcpy(info->s, " ");               break;
1104
1105      case CPUINFO_STR_REGISTER + MIPS3_PC:         sprintf(info->s, "PC: %08X", mips3.pc); break;
1106      case CPUINFO_STR_REGISTER + MIPS3_SR:         sprintf(info->s, "SR: %08X", (UINT32)mips3.cpr[0][COP0_Status]); break;
1107      case CPUINFO_STR_REGISTER + MIPS3_EPC:         sprintf(info->s, "EPC:%08X", (UINT32)mips3.cpr[0][COP0_EPC]); break;
1108      case CPUINFO_STR_REGISTER + MIPS3_CAUSE:       sprintf(info->s, "Cause:%08X", (UINT32)mips3.cpr[0][COP0_Cause]); break;
1109      case CPUINFO_STR_REGISTER + MIPS3_COUNT:       sprintf(info->s, "Count:%08X", (UINT32)((activecpu_gettotalcycles64() - mips3.count_zero_time) / 2)); break;
1110      case CPUINFO_STR_REGISTER + MIPS3_COMPARE:      sprintf(info->s, "Compare:%08X", (UINT32)mips3.cpr[0][COP0_Compare]); break;
1111      case CPUINFO_STR_REGISTER + MIPS3_INDEX:      sprintf(info->s, "Index:%08X", (UINT32)mips3.cpr[0][COP0_Index]); break;
1112      case CPUINFO_STR_REGISTER + MIPS3_RANDOM:      sprintf(info->s, "Random:%08X", (UINT32)mips3.cpr[0][COP0_Random]); break;
1113      case CPUINFO_STR_REGISTER + MIPS3_ENTRYHI:      sprintf(info->s, "EntryHi:%08X%08X", (UINT32)(mips3.cpr[0][COP0_EntryHi] >> 32), (UINT32)mips3.cpr[0][COP0_EntryHi]); break;
1114      case CPUINFO_STR_REGISTER + MIPS3_ENTRYLO0:      sprintf(info->s, "EntryLo0:%08X%08X", (UINT32)(mips3.cpr[0][COP0_EntryLo0] >> 32), (UINT32)mips3.cpr[0][COP0_EntryLo0]); break;
1115      case CPUINFO_STR_REGISTER + MIPS3_ENTRYLO1:      sprintf(info->s, "EntryLo1:%08X%08X", (UINT32)(mips3.cpr[0][COP0_EntryLo1] >> 32), (UINT32)mips3.cpr[0][COP0_EntryLo1]); break;
1116      case CPUINFO_STR_REGISTER + MIPS3_PAGEMASK:      sprintf(info->s, "PageMask:%08X%08X", (UINT32)(mips3.cpr[0][COP0_PageMask] >> 32), (UINT32)mips3.cpr[0][COP0_PageMask]); break;
1117      case CPUINFO_STR_REGISTER + MIPS3_WIRED:      sprintf(info->s, "Wired:%08X", (UINT32)mips3.cpr[0][COP0_Wired]); break;
1118      case CPUINFO_STR_REGISTER + MIPS3_BADVADDR:      sprintf(info->s, "BadVAddr:%08X", (UINT32)mips3.cpr[0][COP0_BadVAddr]); break;
1119
1120      case CPUINFO_STR_REGISTER + MIPS3_R0:         sprintf(info->s, "R0: %08X%08X", (UINT32)(mips3.r[0] >> 32), (UINT32)mips3.r[0]); break;
1121      case CPUINFO_STR_REGISTER + MIPS3_R1:         sprintf(info->s, "R1: %08X%08X", (UINT32)(mips3.r[1] >> 32), (UINT32)mips3.r[1]); break;
1122      case CPUINFO_STR_REGISTER + MIPS3_R2:         sprintf(info->s, "R2: %08X%08X", (UINT32)(mips3.r[2] >> 32), (UINT32)mips3.r[2]); break;
1123      case CPUINFO_STR_REGISTER + MIPS3_R3:         sprintf(info->s, "R3: %08X%08X", (UINT32)(mips3.r[3] >> 32), (UINT32)mips3.r[3]); break;
1124      case CPUINFO_STR_REGISTER + MIPS3_R4:         sprintf(info->s, "R4: %08X%08X", (UINT32)(mips3.r[4] >> 32), (UINT32)mips3.r[4]); break;
1125      case CPUINFO_STR_REGISTER + MIPS3_R5:         sprintf(info->s, "R5: %08X%08X", (UINT32)(mips3.r[5] >> 32), (UINT32)mips3.r[5]); break;
1126      case CPUINFO_STR_REGISTER + MIPS3_R6:         sprintf(info->s, "R6: %08X%08X", (UINT32)(mips3.r[6] >> 32), (UINT32)mips3.r[6]); break;
1127      case CPUINFO_STR_REGISTER + MIPS3_R7:         sprintf(info->s, "R7: %08X%08X", (UINT32)(mips3.r[7] >> 32), (UINT32)mips3.r[7]); break;
1128      case CPUINFO_STR_REGISTER + MIPS3_R8:         sprintf(info->s, "R8: %08X%08X", (UINT32)(mips3.r[8] >> 32), (UINT32)mips3.r[8]); break;
1129      case CPUINFO_STR_REGISTER + MIPS3_R9:         sprintf(info->s, "R9: %08X%08X", (UINT32)(mips3.r[9] >> 32), (UINT32)mips3.r[9]); break;
1130      case CPUINFO_STR_REGISTER + MIPS3_R10:         sprintf(info->s, "R10:%08X%08X", (UINT32)(mips3.r[10] >> 32), (UINT32)mips3.r[10]); break;
1131      case CPUINFO_STR_REGISTER + MIPS3_R11:         sprintf(info->s, "R11:%08X%08X", (UINT32)(mips3.r[11] >> 32), (UINT32)mips3.r[11]); break;
1132      case CPUINFO_STR_REGISTER + MIPS3_R12:         sprintf(info->s, "R12:%08X%08X", (UINT32)(mips3.r[12] >> 32), (UINT32)mips3.r[12]); break;
1133      case CPUINFO_STR_REGISTER + MIPS3_R13:         sprintf(info->s, "R13:%08X%08X", (UINT32)(mips3.r[13] >> 32), (UINT32)mips3.r[13]); break;
1134      case CPUINFO_STR_REGISTER + MIPS3_R14:         sprintf(info->s, "R14:%08X%08X", (UINT32)(mips3.r[14] >> 32), (UINT32)mips3.r[14]); break;
1135      case CPUINFO_STR_REGISTER + MIPS3_R15:         sprintf(info->s, "R15:%08X%08X", (UINT32)(mips3.r[15] >> 32), (UINT32)mips3.r[15]); break;
1136      case CPUINFO_STR_REGISTER + MIPS3_R16:         sprintf(info->s, "R16:%08X%08X", (UINT32)(mips3.r[16] >> 32), (UINT32)mips3.r[16]); break;
1137      case CPUINFO_STR_REGISTER + MIPS3_R17:         sprintf(info->s, "R17:%08X%08X", (UINT32)(mips3.r[17] >> 32), (UINT32)mips3.r[17]); break;
1138      case CPUINFO_STR_REGISTER + MIPS3_R18:         sprintf(info->s, "R18:%08X%08X", (UINT32)(mips3.r[18] >> 32), (UINT32)mips3.r[18]); break;
1139      case CPUINFO_STR_REGISTER + MIPS3_R19:         sprintf(info->s, "R19:%08X%08X", (UINT32)(mips3.r[19] >> 32), (UINT32)mips3.r[19]); break;
1140      case CPUINFO_STR_REGISTER + MIPS3_R20:         sprintf(info->s, "R20:%08X%08X", (UINT32)(mips3.r[20] >> 32), (UINT32)mips3.r[20]); break;
1141      case CPUINFO_STR_REGISTER + MIPS3_R21:         sprintf(info->s, "R21:%08X%08X", (UINT32)(mips3.r[21] >> 32), (UINT32)mips3.r[21]); break;
1142      case CPUINFO_STR_REGISTER + MIPS3_R22:         sprintf(info->s, "R22:%08X%08X", (UINT32)(mips3.r[22] >> 32), (UINT32)mips3.r[22]); break;
1143      case CPUINFO_STR_REGISTER + MIPS3_R23:         sprintf(info->s, "R23:%08X%08X", (UINT32)(mips3.r[23] >> 32), (UINT32)mips3.r[23]); break;
1144      case CPUINFO_STR_REGISTER + MIPS3_R24:         sprintf(info->s, "R24:%08X%08X", (UINT32)(mips3.r[24] >> 32), (UINT32)mips3.r[24]); break;
1145      case CPUINFO_STR_REGISTER + MIPS3_R25:         sprintf(info->s, "R25:%08X%08X", (UINT32)(mips3.r[25] >> 32), (UINT32)mips3.r[25]); break;
1146      case CPUINFO_STR_REGISTER + MIPS3_R26:         sprintf(info->s, "R26:%08X%08X", (UINT32)(mips3.r[26] >> 32), (UINT32)mips3.r[26]); break;
1147      case CPUINFO_STR_REGISTER + MIPS3_R27:         sprintf(info->s, "R27:%08X%08X", (UINT32)(mips3.r[27] >> 32), (UINT32)mips3.r[27]); break;
1148      case CPUINFO_STR_REGISTER + MIPS3_R28:         sprintf(info->s, "R28:%08X%08X", (UINT32)(mips3.r[28] >> 32), (UINT32)mips3.r[28]); break;
1149      case CPUINFO_STR_REGISTER + MIPS3_R29:         sprintf(info->s, "R29:%08X%08X", (UINT32)(mips3.r[29] >> 32), (UINT32)mips3.r[29]); break;
1150      case CPUINFO_STR_REGISTER + MIPS3_R30:         sprintf(info->s, "R30:%08X%08X", (UINT32)(mips3.r[30] >> 32), (UINT32)mips3.r[30]); break;
1151      case CPUINFO_STR_REGISTER + MIPS3_R31:         sprintf(info->s, "R31:%08X%08X", (UINT32)(mips3.r[31] >> 32), (UINT32)mips3.r[31]); break;
1152      case CPUINFO_STR_REGISTER + MIPS3_HI:         sprintf(info->s, "HI: %08X%08X", (UINT32)(mips3.hi >> 32), (UINT32)mips3.hi); break;
1153      case CPUINFO_STR_REGISTER + MIPS3_LO:         sprintf(info->s, "LO: %08X%08X", (UINT32)(mips3.lo >> 32), (UINT32)mips3.lo); break;
369      /* --- everything else is handled generically --- */
370      default:                              mips3com_get_info(&mips3.core, state, info); break;
1154371   }
1155372}
1156373
1157374
375
376/***************************************************************************
377    R4600 VARIANTS
378***************************************************************************/
379
1158380#if (HAS_R4600)
1159/**************************************************************************
1160 * CPU-specific set_info
1161 **************************************************************************/
381static void r4600be_init(int index, int clock, const void *config, int (*irqcallback)(int))
382{
383   mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, index, clock, config, irqcallback);
384   mips3drc_init();
385}
1162386
387static void r4600le_init(int index, int clock, const void *config, int (*irqcallback)(int))
388{
389   mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, index, clock, config, irqcallback);
390   mips3drc_init();
391}
392
1163393void r4600be_get_info(UINT32 state, cpuinfo *info)
1164394{
1165395   switch (state)
r869r870
1168398      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
1169399
1170400      /* --- the following bits of info are returned as pointers to data or functions --- */
1171      case CPUINFO_PTR_RESET:                     info->reset = r4600be_reset;         break;
401      case CPUINFO_PTR_INIT:                     info->init = r4600be_init;            break;
1172402
1173403      /* --- the following bits of info are returned as NULL-terminated strings --- */
1174404      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (big)");         break;
1175405
406      /* --- everything else is handled generically --- */
1176407      default:                              mips3_get_info(state, info);         break;
1177408   }
1178409}
1179410
1180
1181411void r4600le_get_info(UINT32 state, cpuinfo *info)
1182412{
1183413   switch (state)
r869r870
1186416      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1187417
1188418      /* --- the following bits of info are returned as pointers to data or functions --- */
1189      case CPUINFO_PTR_RESET:                     info->reset = r4600le_reset;         break;
419      case CPUINFO_PTR_INIT:                     info->init = r4600le_init;            break;
1190420
1191421      /* --- the following bits of info are returned as NULL-terminated strings --- */
1192422      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (little)");      break;
1193423
424      /* --- everything else is handled generically --- */
1194425      default:                              mips3_get_info(state, info);         break;
1195426   }
1196427}
1197428#endif
1198429
430
431
432/***************************************************************************
433    R4650 VARIANTS
434***************************************************************************/
435
1199436#if (HAS_R4650)
1200/**************************************************************************
1201 * CPU-specific set_info
1202 **************************************************************************/
437static void r4650be_init(int index, int clock, const void *config, int (*irqcallback)(int))
438{
439   mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, index, clock, config, irqcallback);
440   mips3drc_init();
441}
1203442
443static void r4650le_init(int index, int clock, const void *config, int (*irqcallback)(int))
444{
445   mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, index, clock, config, irqcallback);
446   mips3drc_init();
447}
448
1204449void r4650be_get_info(UINT32 state, cpuinfo *info)
1205450{
1206451   switch (state)
r869r870
1209454      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
1210455
1211456      /* --- the following bits of info are returned as pointers to data or functions --- */
1212      case CPUINFO_PTR_RESET:                     info->reset = r4600be_reset;         break;
457      case CPUINFO_PTR_INIT:                     info->init = r4650be_init;            break;
1213458
1214459      /* --- the following bits of info are returned as NULL-terminated strings --- */
1215460      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (big)");      break;
1216461
462      /* --- everything else is handled generically --- */
1217463      default:                              mips3_get_info(state, info);         break;
1218464   }
1219465}
1220466
1221
1222467void r4650le_get_info(UINT32 state, cpuinfo *info)
1223468{
1224469   switch (state)
r869r870
1227472      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1228473
1229474      /* --- the following bits of info are returned as pointers to data or functions --- */
1230      case CPUINFO_PTR_RESET:                     info->reset = r4600le_reset;         break;
475      case CPUINFO_PTR_INIT:                     info->init = r4650le_init;            break;
1231476
1232477      /* --- the following bits of info are returned as NULL-terminated strings --- */
1233478      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (little)");   break;
1234479
480      /* --- everything else is handled generically --- */
1235481      default:                              mips3_get_info(state, info);         break;
1236482   }
1237483}
1238484#endif
1239485
486
487
488/***************************************************************************
489    R4700 VARIANTS
490***************************************************************************/
491
1240492#if (HAS_R4700)
1241/**************************************************************************
1242 * CPU-specific set_info
1243 **************************************************************************/
493static void r4700be_init(int index, int clock, const void *config, int (*irqcallback)(int))
494{
495   mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, index, clock, config, irqcallback);
496   mips3drc_init();
497}
1244498
499static void r4700le_init(int index, int clock, const void *config, int (*irqcallback)(int))
500{
501   mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, index, clock, config, irqcallback);
502   mips3drc_init();
503}
504
1245505void r4700be_get_info(UINT32 state, cpuinfo *info)
1246506{
1247507   switch (state)
r869r870
1250510      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
1251511
1252512      /* --- the following bits of info are returned as pointers to data or functions --- */
1253      case CPUINFO_PTR_RESET:                     info->reset = r4700be_reset;         break;
513      case CPUINFO_PTR_INIT:                     info->init = r4700be_init;            break;
1254514
1255515      /* --- the following bits of info are returned as NULL-terminated strings --- */
1256516      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (big)");         break;
1257517
518      /* --- everything else is handled generically --- */
1258519      default:                              mips3_get_info(state, info);         break;
1259520   }
1260521}
r869r870
1268529      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1269530
1270531      /* --- the following bits of info are returned as pointers to data or functions --- */
1271      case CPUINFO_PTR_RESET:                     info->reset = r4700le_reset;         break;
532      case CPUINFO_PTR_INIT:                     info->init = r4700le_init;            break;
1272533
1273534      /* --- the following bits of info are returned as NULL-terminated strings --- */
1274535      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (little)");      break;
1275536
537      /* --- everything else is handled generically --- */
1276538      default:                              mips3_get_info(state, info);         break;
1277539   }
1278540}
1279541#endif
1280542
1281543
544
545/***************************************************************************
546    R5000 VARIANTS
547***************************************************************************/
548
1282549#if (HAS_R5000)
1283/**************************************************************************
1284 * CPU-specific set_info
1285 **************************************************************************/
550static void r5000be_init(int index, int clock, const void *config, int (*irqcallback)(int))
551{
552   mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, index, clock, config, irqcallback);
553   mips3drc_init();
554}
1286555
556static void r5000le_init(int index, int clock, const void *config, int (*irqcallback)(int))
557{
558   mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, index, clock, config, irqcallback);
559   mips3drc_init();
560}
561
1287562void r5000be_get_info(UINT32 state, cpuinfo *info)
1288563{
1289564   switch (state)
r869r870
1292567      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
1293568
1294569      /* --- the following bits of info are returned as pointers to data or functions --- */
1295      case CPUINFO_PTR_RESET:                     info->reset = r5000be_reset;         break;
570      case CPUINFO_PTR_INIT:                     info->init = r5000be_init;            break;
1296571
1297572      /* --- the following bits of info are returned as NULL-terminated strings --- */
1298573      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (big)");         break;
1299574
575      /* --- everything else is handled generically --- */
1300576      default:                              mips3_get_info(state, info);         break;
1301577   }
1302578}
1303579
1304
1305580void r5000le_get_info(UINT32 state, cpuinfo *info)
1306581{
1307582   switch (state)
r869r870
1310585      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1311586
1312587      /* --- the following bits of info are returned as pointers to data or functions --- */
1313      case CPUINFO_PTR_RESET:                     info->reset = r5000le_reset;         break;
588      case CPUINFO_PTR_INIT:                     info->init = r5000le_init;            break;
1314589
1315590      /* --- the following bits of info are returned as NULL-terminated strings --- */
1316591      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (little)");      break;
1317592
593      /* --- everything else is handled generically --- */
1318594      default:                              mips3_get_info(state, info);         break;
1319595   }
1320596}
1321597#endif
1322598
1323599
600
601/***************************************************************************
602    QED5271 VARIANTS
603***************************************************************************/
604
1324605#if (HAS_QED5271)
1325/**************************************************************************
1326 * CPU-specific set_info
1327 **************************************************************************/
606static void qed5271be_init(int index, int clock, const void *config, int (*irqcallback)(int))
607{
608   mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, index, clock, config, irqcallback);
609   mips3drc_init();
610}
1328611
612static void qed5271le_init(int index, int clock, const void *config, int (*irqcallback)(int))
613{
614   mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, index, clock, config, irqcallback);
615   mips3drc_init();
616}
617
1329618void qed5271be_get_info(UINT32 state, cpuinfo *info)
1330619{
1331620   switch (state)
r869r870
1334623      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
1335624
1336625      /* --- the following bits of info are returned as pointers to data or functions --- */
1337      case CPUINFO_PTR_RESET:                     info->reset = qed5271be_reset;         break;
626      case CPUINFO_PTR_INIT:                     info->init = qed5271be_init;         break;
1338627
1339628      /* --- the following bits of info are returned as NULL-terminated strings --- */
1340629      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (big)");      break;
1341630
631      /* --- everything else is handled generically --- */
1342632      default:                              mips3_get_info(state, info);         break;
1343633   }
1344634}
1345635
1346
1347636void qed5271le_get_info(UINT32 state, cpuinfo *info)
1348637{
1349638   switch (state)
r869r870
1352641      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1353642
1354643      /* --- the following bits of info are returned as pointers to data or functions --- */
1355      case CPUINFO_PTR_RESET:                     info->reset = qed5271le_reset;         break;
644      case CPUINFO_PTR_INIT:                     info->init = qed5271le_init;         break;
1356645
1357646      /* --- the following bits of info are returned as NULL-terminated strings --- */
1358647      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (little)");   break;
1359648
649      /* --- everything else is handled generically --- */
1360650      default:                              mips3_get_info(state, info);         break;
1361651   }
1362652}
1363653#endif
1364654
1365655
656
657/***************************************************************************
658    RM7000 VARIANTS
659***************************************************************************/
660
1366661#if (HAS_RM7000)
1367/**************************************************************************
1368 * CPU-specific set_info
1369 **************************************************************************/
662static void rm7000be_init(int index, int clock, const void *config, int (*irqcallback)(int))
663{
664   mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, index, clock, config, irqcallback);
665   mips3drc_init();
666}
1370667
668static void rm7000le_init(int index, int clock, const void *config, int (*irqcallback)(int))
669{
670   mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, index, clock, config, irqcallback);
671   mips3drc_init();
672}
673
1371674void rm7000be_get_info(UINT32 state, cpuinfo *info)
1372675{
1373676   switch (state)
r869r870
1376679      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
1377680
1378681      /* --- the following bits of info are returned as pointers to data or functions --- */
1379      case CPUINFO_PTR_RESET:                     info->reset = rm7000be_reset;         break;
682      case CPUINFO_PTR_INIT:                     info->init = rm7000be_init;            break;
1380683
1381684      /* --- the following bits of info are returned as NULL-terminated strings --- */
1382685      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (big)");      break;
1383686
687      /* --- everything else is handled generically --- */
1384688      default:                              mips3_get_info(state, info);         break;
1385689   }
1386690}
1387691
1388
1389692void rm7000le_get_info(UINT32 state, cpuinfo *info)
1390693{
1391694   switch (state)
r869r870
1394697      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
1395698
1396699      /* --- the following bits of info are returned as pointers to data or functions --- */
1397      case CPUINFO_PTR_RESET:                     info->reset = rm7000le_reset;         break;
700      case CPUINFO_PTR_INIT:                     info->init = rm7000le_init;            break;
1398701
1399702      /* --- the following bits of info are returned as NULL-terminated strings --- */
1400703      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (little)");      break;
1401704
705      /* --- everything else is handled generically --- */
1402706      default:                              mips3_get_info(state, info);         break;
1403707   }
1404708}
r869r870
1406710
1407711
1408712
713/***************************************************************************
714    DISASSEMBLERS
715***************************************************************************/
1409716
1410717#if !defined(MAME_DEBUG) && (LOG_CODE)
1411718#include "mips3dsm.c"
src/emu/cpu/mips/mips3com.c
r0r870
1/***************************************************************************
2
3    mips3com.c
4
5    Common MIPS III/IV definitions and functions
6
7***************************************************************************/
8
9#include "mips3com.h"
10
11
12/***************************************************************************
13    DEBUGGING
14***************************************************************************/
15
16#define PRINTF_TLB            (1)
17
18
19
20/***************************************************************************
21    FUNCTION PROTOTYPES
22***************************************************************************/
23
24static TIMER_CALLBACK( compare_int_callback );
25
26static UINT32 compute_config_register(const mips3_state *mips);
27static UINT32 compute_prid_register(const mips3_state *mips);
28
29static void tlb_write_common(mips3_state *mips, int index);
30static void tlb_entry_log_half(mips3_tlb_entry *tlbent, int index, int which);
31
32static UINT64 program_read_qword_32be(offs_t offset);
33static UINT64 program_read_qword_32le(offs_t offset);
34static void program_write_qword_32be(offs_t offset, UINT64 data);
35static void program_write_qword_32le(offs_t offset, UINT64 data);
36
37
38
39/***************************************************************************
40    GLOBAL VARIABLES
41***************************************************************************/
42
43int mips3_icount;
44
45
46
47/***************************************************************************
48    PRIVATE GLOBAL VARIABLES
49***************************************************************************/
50
51static const memory_handlers be_memory =
52{
53   program_read_byte_32be,  program_read_word_32be,  program_read_dword_32be,  program_read_qword_32be,
54   program_write_byte_32be, program_write_word_32be, program_write_dword_32be, program_write_qword_32be
55};
56
57static const memory_handlers le_memory =
58{
59   program_read_byte_32le,  program_read_word_32le,  program_read_dword_32le,  program_read_qword_32le,
60   program_write_byte_32le, program_write_word_32le, program_write_dword_32le, program_write_qword_32le
61};
62
63
64
65/***************************************************************************
66    INITIALIZATION AND SHUTDOWN
67***************************************************************************/
68
69/*-------------------------------------------------
70    mips3com_init - initialize the mips3_state
71    structure based on the configured type
72-------------------------------------------------*/
73
74void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int))
75{
76   /* initialize the state */
77   memset(mips, 0, sizeof(*mips));
78
79   /* initialize based on the config */
80   mips->flavor = flavor;
81   mips->bigendian = bigendian;
82   mips->cpu_clock = clock;
83   mips->irq_callback = irqcallback;
84   mips->icache_size = config->icache;
85   mips->dcache_size = config->dcache;
86   mips->system_clock = config->system_clock;
87
88   /* set up the endianness */
89   if (mips->bigendian)
90      mips->memory = be_memory;
91   else
92      mips->memory = le_memory;
93
94   /* allocate memory */
95   mips->icache = auto_malloc(config->icache);
96   mips->dcache = auto_malloc(config->dcache);
97   mips->tlb_table = auto_malloc(sizeof(mips->tlb_table[0]) * (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)));
98
99   /* allocate a timer for the compare interrupt */
100   mips->compare_int_timer = mame_timer_alloc(compare_int_callback);
101
102   /* reset the state */
103   mips3com_reset(mips);
104}
105
106
107/*-------------------------------------------------
108    mips3com_reset - reset the state of all the
109    registers
110-------------------------------------------------*/
111
112void mips3com_reset(mips3_state *mips)
113{
114   /* initialize the state */
115   mips->pc = 0xbfc00000;
116   mips->cpr[0][COP0_Status] = SR_BEV | SR_ERL;
117   mips->cpr[0][COP0_Compare] = 0xffffffff;
118   mips->cpr[0][COP0_Count] = 0;
119   mips->cpr[0][COP0_Config] = compute_config_register(mips);
120   mips->cpr[0][COP0_PRId] = compute_prid_register(mips);
121   mips->count_zero_time = activecpu_gettotalcycles64();
122
123   /* recompute the TLB table */
124   mips3com_recompute_tlb_table(mips);
125}
126
127
128/*-------------------------------------------------
129    mips3com_dasm - handle disassembly for a
130    CPU
131-------------------------------------------------*/
132
133#ifdef MAME_DEBUG
134offs_t mips3com_dasm(mips3_state *mips, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
135{
136   extern unsigned dasmmips3(char *, unsigned, UINT32);
137   UINT32 op = *(UINT32 *)oprom;
138   if (mips->bigendian)
139      op = BIG_ENDIANIZE_INT32(op);
140   else
141      op = LITTLE_ENDIANIZE_INT32(op);
142   return dasmmips3(buffer, pc, op);
143}
144#endif /* MAME_DEBUG */
145
146
147
148/*-------------------------------------------------
149    mips3com_update_cycle_counting - update cycle
150    counts and the timers
151-------------------------------------------------*/
152
153void mips3com_update_cycle_counting(mips3_state *mips)
154{
155   /* modify the timer to go off */
156   if ((mips->cpr[0][COP0_Status] & 0x8000) && mips->cpr[0][COP0_Compare] != 0xffffffff)
157   {
158      UINT32 count = (activecpu_gettotalcycles64() - mips->count_zero_time) / 2;
159      UINT32 compare = mips->cpr[0][COP0_Compare];
160      UINT32 cyclesleft = compare - count;
161      mame_time newtime = MAME_TIME_IN_CYCLES(((INT64)cyclesleft * 2), cpu_getactivecpu());
162
163      /* due to accuracy issues, don't bother setting timers unless they're for less than 100msec */
164      if (compare_mame_times(newtime, MAME_TIME_IN_MSEC(100)) < 0)
165         mame_timer_adjust(mips->compare_int_timer, newtime, cpu_getactivecpu(), time_zero);
166   }
167   else
168      mame_timer_adjust(mips->compare_int_timer, time_never, cpu_getactivecpu(), time_zero);
169}
170
171
172
173/***************************************************************************
174    TLB HANDLING
175***************************************************************************/
176
177/*-------------------------------------------------
178    mips3com_map_tlb_entries - map entries from the
179    TLB into the tlb_table
180-------------------------------------------------*/
181
182void mips3com_map_tlb_entries(mips3_state *mips)
183{
184   int valid_asid = mips->cpr[0][COP0_EntryHi] & 0xff;
185   int index;
186
187   /* iterate over all TLB entries */
188   for (index = 0; index < ARRAY_LENGTH(mips->tlb); index++)
189   {
190      mips3_tlb_entry *tlbent = &mips->tlb[index];
191
192      /* only process if global or if the ASID matches */
193      if ((tlbent->entry_hi & 0x1000) || valid_asid == (tlbent->entry_hi & 0xff))
194      {
195         UINT32 count = (tlbent->page_mask >> 13) & 0x00fff;
196         UINT32 vpn = ((tlbent->entry_hi >> 13) & 0x07ffffff) << 1;
197         int which, i;
198
199         /* ignore if the virtual address is beyond 32 bits */
200         if (vpn < (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)))
201
202            /* loop over both the even and odd pages */
203            for (which = 0; which < 2; which++)
204            {
205               UINT64 lo = tlbent->entry_lo[which];
206
207               /* only map if the TLB entry is valid */
208               if (lo & 2)
209               {
210                  UINT32 pfn = (lo >> 6) & 0x00ffffff;
211                  UINT32 wp = (~lo >> 2) & 1;
212
213                  for (i = 0; i <= count; i++, vpn++, pfn++)
214                     if (vpn < 0x80000 || vpn >= 0xc0000)
215                        mips->tlb_table[vpn] = (pfn << MIPS3_MIN_PAGE_SHIFT) | wp;
216               }
217
218               /* otherwise, advance by the number of pages we would have mapped */
219               else
220                  vpn += count + 1;
221            }
222      }
223   }
224}
225
226
227/*-------------------------------------------------
228    mips3com_unmap_tlb_entries - unmap entries from
229    the TLB into the tlb_table
230-------------------------------------------------*/
231
232void mips3com_unmap_tlb_entries(mips3_state *mips)
233{
234   int index;
235
236   /* iterate over all TLB entries */
237   for (index = 0; index < ARRAY_LENGTH(mips->tlb); index++)
238   {
239      mips3_tlb_entry *tlbent = &mips->tlb[index];
240      UINT32 count = (tlbent->page_mask >> 13) & 0x00fff;
241      UINT32 vpn = ((tlbent->entry_hi >> 13) & 0x07ffffff) << 1;
242      int which, i;
243
244      /* ignore if the virtual address is beyond 32 bits */
245      if (vpn < (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)))
246
247         /* loop over both the even and odd pages */
248         for (which = 0; which < 2; which++)
249            for (i = 0; i <= count; i++, vpn++)
250               if (vpn < 0x80000 || vpn >= 0xc0000)
251                  mips->tlb_table[vpn] = 0xffffffff;
252   }
253}
254
255
256/*-------------------------------------------------
257    mips3com_recompute_tlb_table - recompute the TLB
258    table from scratch
259-------------------------------------------------*/
260
261void mips3com_recompute_tlb_table(mips3_state *mips)
262{
263   UINT32 addr;
264
265   /* map in the hard-coded spaces */
266   for (addr = 0x80000000; addr < 0xc0000000; addr += MIPS3_MIN_PAGE_SIZE)
267      mips->tlb_table[addr >> MIPS3_MIN_PAGE_SHIFT] = addr & 0x1ffff000;
268
269   /* reset everything else to unmapped */
270   memset(&mips->tlb_table[0x00000000 >> MIPS3_MIN_PAGE_SHIFT], 0xff, sizeof(mips->tlb_table[0]) * (0x80000000 >> MIPS3_MIN_PAGE_SHIFT));
271   memset(&mips->tlb_table[0xc0000000 >> MIPS3_MIN_PAGE_SHIFT], 0xff, sizeof(mips->tlb_table[0]) * (0x40000000 >> MIPS3_MIN_PAGE_SHIFT));
272
273   /* remap all the entries in the TLB */
274   mips3com_map_tlb_entries(mips);
275}
276
277
278/*-------------------------------------------------
279    mips3com_translate_address - translate an address
280    from logical to physical
281-------------------------------------------------*/
282
283int mips3com_translate_address(mips3_state *mips, int space, offs_t *address)
284{
285   /* only applies to the program address space */
286   if (space == ADDRESS_SPACE_PROGRAM)
287   {
288      UINT32 result = mips->tlb_table[*address >> MIPS3_MIN_PAGE_SHIFT];
289      if (result == 0xffffffff)
290         return FALSE;
291      *address = (result & ~MIPS3_MIN_PAGE_MASK) | (*address & MIPS3_MIN_PAGE_MASK);
292   }
293   return TRUE;
294}
295
296
297/*-------------------------------------------------
298    mips3com_tlbr - execute the tlbr instruction
299-------------------------------------------------*/
300
301void mips3com_tlbr(mips3_state *mips)
302{
303   UINT32 index = mips->cpr[0][COP0_Index] & 0x3f;
304
305   /* only handle entries within the TLB */
306   if (index < ARRAY_LENGTH(mips->tlb))
307   {
308      mips3_tlb_entry *tlbent = &mips->tlb[index];
309
310      /* copy data from the TLB entry into the COP0 registers */
311      mips->cpr[0][COP0_PageMask] = tlbent->page_mask;
312      mips->cpr[0][COP0_EntryHi] = tlbent->entry_hi;
313      mips->cpr[0][COP0_EntryLo0] = tlbent->entry_lo[0];
314      mips->cpr[0][COP0_EntryLo1] = tlbent->entry_lo[1];
315   }
316}
317
318
319/*-------------------------------------------------
320    mips3com_tlbwi - execute the tlbwi instruction
321-------------------------------------------------*/
322
323void mips3com_tlbwi(mips3_state *mips)
324{
325   /* use the common handler and write based off the COP0 Index register */
326   tlb_write_common(mips, mips->cpr[0][COP0_Index] & 0x3f);
327}
328
329
330/*-------------------------------------------------
331    mips3com_tlbwr - execute the tlbwr instruction
332-------------------------------------------------*/
333
334void mips3com_tlbwr(mips3_state *mips)
335{
336   UINT32 wired = mips->cpr[0][COP0_Wired] & 0x3f;
337   UINT32 unwired = ARRAY_LENGTH(mips->tlb) - wired;
338   UINT32 index = ARRAY_LENGTH(mips->tlb) - 1;
339
340   /* "random" is based off of the current cycle counting through the non-wired pages */
341   if (unwired > 0)
342      index = ((activecpu_gettotalcycles64() - mips->count_zero_time) % unwired + wired) & 0x3f;
343
344   /* use the common handler to write to this index */
345   tlb_write_common(mips, index);
346}
347
348
349/*-------------------------------------------------
350    mips3com_tlbp - execute the tlbp instruction
351-------------------------------------------------*/
352
353void mips3com_tlbp(mips3_state *mips)
354{
355   UINT32 index;
356   UINT64 vpn;
357
358   /* iterate over TLB entries */
359   for (index = 0; index < ARRAY_LENGTH(mips->tlb); index++)
360   {
361      mips3_tlb_entry *tlbent = &mips->tlb[index];
362      UINT64 mask = ~((tlbent->page_mask >> 13) & 0xfff) << 13;
363
364      /* if the relevant bits of EntryHi match the relevant bits of the TLB */
365      if ((tlbent->entry_hi & mask) == (mips->cpr[0][COP0_EntryHi] & mask))
366
367         /* and if we are either global or matching the current ASID, then stop */
368         if ((tlbent->entry_hi & 0x1000) || (tlbent->entry_hi & 0xff) == (mips->cpr[0][COP0_EntryHi] & 0xff))
369            break;
370   }
371
372   /* validate that our tlb_table was in sync */
373   vpn = ((mips->cpr[0][COP0_EntryHi] >> 13) & 0x07ffffff) << 1;
374   if (index != ARRAY_LENGTH(mips->tlb))
375   {
376      assert(mips->tlb_table[vpn & 0xfffff] != 0xffffffff);
377      mips->cpr[0][COP0_Index] = index;
378   }
379   else
380   {
381      assert(mips->tlb_table[vpn & 0xfffff] == 0xffffffff);
382      mips->cpr[0][COP0_Index] = 0x80000000;
383   }
384}
385
386
387
388/***************************************************************************
389    COMMON GET/SET INFO
390***************************************************************************/
391
392/*-------------------------------------------------
393    mips3com_set_info - set information about
394    a MIPS 3 CPU
395-------------------------------------------------*/
396
397void mips3com_set_info(mips3_state *mips, UINT32 state, cpuinfo *info)
398{
399   switch (state)
400   {
401      /* --- the following bits of info are set as 64-bit signed integers --- */
402      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      mips3com_set_irq_line(mips, MIPS3_IRQ0, info->i);   break;
403      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      mips3com_set_irq_line(mips, MIPS3_IRQ1, info->i);   break;
404      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ2:      mips3com_set_irq_line(mips, MIPS3_IRQ2, info->i);   break;
405      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ3:      mips3com_set_irq_line(mips, MIPS3_IRQ3, info->i);   break;
406      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ4:      mips3com_set_irq_line(mips, MIPS3_IRQ4, info->i);   break;
407      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ5:      mips3com_set_irq_line(mips, MIPS3_IRQ5, info->i);   break;
408
409      case CPUINFO_INT_PC:
410      case CPUINFO_INT_REGISTER + MIPS3_PC:         mips->pc = info->i;                  break;
411      case CPUINFO_INT_REGISTER + MIPS3_SR:         mips->cpr[0][COP0_Status] = info->i;    break;
412      case CPUINFO_INT_REGISTER + MIPS3_EPC:         mips->cpr[0][COP0_EPC] = info->i;       break;
413      case CPUINFO_INT_REGISTER + MIPS3_CAUSE:      mips->cpr[0][COP0_Cause] = info->i;      break;
414      case CPUINFO_INT_REGISTER + MIPS3_COUNT:      mips->cpr[0][COP0_Count] = info->i;    break;
415      case CPUINFO_INT_REGISTER + MIPS3_COMPARE:      mips->cpr[0][COP0_Compare] = info->i;    break;
416      case CPUINFO_INT_REGISTER + MIPS3_INDEX:      mips->cpr[0][COP0_Index] = info->i;    break;
417      case CPUINFO_INT_REGISTER + MIPS3_RANDOM:      mips->cpr[0][COP0_Random] = info->i;    break;
418      case CPUINFO_INT_REGISTER + MIPS3_ENTRYHI:      mips->cpr[0][COP0_EntryHi] = info->i;    break;
419      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO0:      mips->cpr[0][COP0_EntryLo0] = info->i;    break;
420      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO1:      mips->cpr[0][COP0_EntryLo1] = info->i;    break;
421      case CPUINFO_INT_REGISTER + MIPS3_PAGEMASK:      mips->cpr[0][COP0_PageMask] = info->i;    break;
422      case CPUINFO_INT_REGISTER + MIPS3_WIRED:      mips->cpr[0][COP0_Wired] = info->i;    break;
423      case CPUINFO_INT_REGISTER + MIPS3_BADVADDR:      mips->cpr[0][COP0_BadVAddr] = info->i;    break;
424
425      case CPUINFO_INT_REGISTER + MIPS3_R0:         /* can't change R0 */               break;
426      case CPUINFO_INT_REGISTER + MIPS3_R1:         mips->r[1] = info->i;               break;
427      case CPUINFO_INT_REGISTER + MIPS3_R2:         mips->r[2] = info->i;               break;
428      case CPUINFO_INT_REGISTER + MIPS3_R3:         mips->r[3] = info->i;               break;
429      case CPUINFO_INT_REGISTER + MIPS3_R4:         mips->r[4] = info->i;               break;
430      case CPUINFO_INT_REGISTER + MIPS3_R5:         mips->r[5] = info->i;               break;
431      case CPUINFO_INT_REGISTER + MIPS3_R6:         mips->r[6] = info->i;               break;
432      case CPUINFO_INT_REGISTER + MIPS3_R7:         mips->r[7] = info->i;               break;
433      case CPUINFO_INT_REGISTER + MIPS3_R8:         mips->r[8] = info->i;               break;
434      case CPUINFO_INT_REGISTER + MIPS3_R9:         mips->r[9] = info->i;               break;
435      case CPUINFO_INT_REGISTER + MIPS3_R10:         mips->r[10] = info->i;               break;
436      case CPUINFO_INT_REGISTER + MIPS3_R11:         mips->r[11] = info->i;               break;
437      case CPUINFO_INT_REGISTER + MIPS3_R12:         mips->r[12] = info->i;               break;
438      case CPUINFO_INT_REGISTER + MIPS3_R13:         mips->r[13] = info->i;               break;
439      case CPUINFO_INT_REGISTER + MIPS3_R14:         mips->r[14] = info->i;               break;
440      case CPUINFO_INT_REGISTER + MIPS3_R15:         mips->r[15] = info->i;               break;
441      case CPUINFO_INT_REGISTER + MIPS3_R16:         mips->r[16] = info->i;               break;
442      case CPUINFO_INT_REGISTER + MIPS3_R17:         mips->r[17] = info->i;               break;
443      case CPUINFO_INT_REGISTER + MIPS3_R18:         mips->r[18] = info->i;               break;
444      case CPUINFO_INT_REGISTER + MIPS3_R19:         mips->r[19] = info->i;               break;
445      case CPUINFO_INT_REGISTER + MIPS3_R20:         mips->r[20] = info->i;               break;
446      case CPUINFO_INT_REGISTER + MIPS3_R21:         mips->r[21] = info->i;               break;
447      case CPUINFO_INT_REGISTER + MIPS3_R22:         mips->r[22] = info->i;               break;
448      case CPUINFO_INT_REGISTER + MIPS3_R23:         mips->r[23] = info->i;               break;
449      case CPUINFO_INT_REGISTER + MIPS3_R24:         mips->r[24] = info->i;               break;
450      case CPUINFO_INT_REGISTER + MIPS3_R25:         mips->r[25] = info->i;               break;
451      case CPUINFO_INT_REGISTER + MIPS3_R26:         mips->r[26] = info->i;               break;
452      case CPUINFO_INT_REGISTER + MIPS3_R27:         mips->r[27] = info->i;               break;
453      case CPUINFO_INT_REGISTER + MIPS3_R28:         mips->r[28] = info->i;               break;
454      case CPUINFO_INT_REGISTER + MIPS3_R29:         mips->r[29] = info->i;               break;
455      case CPUINFO_INT_REGISTER + MIPS3_R30:         mips->r[30] = info->i;               break;
456      case CPUINFO_INT_SP:
457      case CPUINFO_INT_REGISTER + MIPS3_R31:         mips->r[31] = info->i;               break;
458      case CPUINFO_INT_REGISTER + MIPS3_HI:         mips->hi = info->i;                  break;
459      case CPUINFO_INT_REGISTER + MIPS3_LO:         mips->lo = info->i;                  break;
460
461      case CPUINFO_INT_REGISTER + MIPS3_FPR0:         mips->cpr[1][0] = info->i;            break;
462      case CPUINFO_INT_REGISTER + MIPS3_FPR1:         mips->cpr[1][1] = info->i;            break;
463      case CPUINFO_INT_REGISTER + MIPS3_FPR2:         mips->cpr[1][2] = info->i;            break;
464      case CPUINFO_INT_REGISTER + MIPS3_FPR3:         mips->cpr[1][3] = info->i;            break;
465      case CPUINFO_INT_REGISTER + MIPS3_FPR4:         mips->cpr[1][4] = info->i;            break;
466      case CPUINFO_INT_REGISTER + MIPS3_FPR5:         mips->cpr[1][5] = info->i;            break;
467      case CPUINFO_INT_REGISTER + MIPS3_FPR6:         mips->cpr[1][6] = info->i;            break;
468      case CPUINFO_INT_REGISTER + MIPS3_FPR7:         mips->cpr[1][7] = info->i;            break;
469      case CPUINFO_INT_REGISTER + MIPS3_FPR8:         mips->cpr[1][8] = info->i;            break;
470      case CPUINFO_INT_REGISTER + MIPS3_FPR9:         mips->cpr[1][9] = info->i;            break;
471      case CPUINFO_INT_REGISTER + MIPS3_FPR10:      mips->cpr[1][10] = info->i;            break;
472      case CPUINFO_INT_REGISTER + MIPS3_FPR11:      mips->cpr[1][11] = info->i;            break;
473      case CPUINFO_INT_REGISTER + MIPS3_FPR12:      mips->cpr[1][12] = info->i;            break;
474      case CPUINFO_INT_REGISTER + MIPS3_FPR13:      mips->cpr[1][13] = info->i;            break;
475      case CPUINFO_INT_REGISTER + MIPS3_FPR14:      mips->cpr[1][14] = info->i;            break;
476      case CPUINFO_INT_REGISTER + MIPS3_FPR15:      mips->cpr[1][15] = info->i;            break;
477      case CPUINFO_INT_REGISTER + MIPS3_FPR16:      mips->cpr[1][16] = info->i;            break;
478      case CPUINFO_INT_REGISTER + MIPS3_FPR17:      mips->cpr[1][17] = info->i;            break;
479      case CPUINFO_INT_REGISTER + MIPS3_FPR18:      mips->cpr[1][18] = info->i;            break;
480      case CPUINFO_INT_REGISTER + MIPS3_FPR19:      mips->cpr[1][19] = info->i;            break;
481      case CPUINFO_INT_REGISTER + MIPS3_FPR20:      mips->cpr[1][20] = info->i;            break;
482      case CPUINFO_INT_REGISTER + MIPS3_FPR21:      mips->cpr[1][21] = info->i;            break;
483      case CPUINFO_INT_REGISTER + MIPS3_FPR22:      mips->cpr[1][22] = info->i;            break;
484      case CPUINFO_INT_REGISTER + MIPS3_FPR23:      mips->cpr[1][23] = info->i;            break;
485      case CPUINFO_INT_REGISTER + MIPS3_FPR24:      mips->cpr[1][24] = info->i;            break;
486      case CPUINFO_INT_REGISTER + MIPS3_FPR25:      mips->cpr[1][25] = info->i;            break;
487      case CPUINFO_INT_REGISTER + MIPS3_FPR26:      mips->cpr[1][26] = info->i;            break;
488      case CPUINFO_INT_REGISTER + MIPS3_FPR27:      mips->cpr[1][27] = info->i;            break;
489      case CPUINFO_INT_REGISTER + MIPS3_FPR28:      mips->cpr[1][28] = info->i;            break;
490      case CPUINFO_INT_REGISTER + MIPS3_FPR29:      mips->cpr[1][29] = info->i;            break;
491      case CPUINFO_INT_REGISTER + MIPS3_FPR30:      mips->cpr[1][30] = info->i;            break;
492      case CPUINFO_INT_REGISTER + MIPS3_FPR31:      mips->cpr[1][31] = info->i;            break;
493   }
494}
495
496
497/*-------------------------------------------------
498    mips3com_get_info - get information about
499    a MIPS 3 CPU
500-------------------------------------------------*/
501
502void mips3com_get_info(mips3_state *mips, UINT32 state, cpuinfo *info)
503{
504   switch (state)
505   {
506      /* --- the following bits of info are returned as 64-bit signed integers --- */
507      case CPUINFO_INT_CONTEXT_SIZE:               /* provided by core */               break;
508      case CPUINFO_INT_INPUT_LINES:               info->i = 6;                     break;
509      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
510      case CPUINFO_INT_ENDIANNESS:               info->i = mips->bigendian ? CPU_IS_BE : CPU_IS_LE; break;
511      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
512      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 4;                     break;
513      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 4;                     break;
514      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
515      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
516
517      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = MIPS3_MAX_PADDR_SHIFT;break;
518      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
519      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
520      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
521      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = MIPS3_MIN_PAGE_SHIFT;   break;
522
523      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      info->i = (mips->cpr[0][COP0_Cause] & 0x400) ? ASSERT_LINE : CLEAR_LINE;   break;
524      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      info->i = (mips->cpr[0][COP0_Cause] & 0x800) ? ASSERT_LINE : CLEAR_LINE;   break;
525      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ2:      info->i = (mips->cpr[0][COP0_Cause] & 0x1000) ? ASSERT_LINE : CLEAR_LINE;   break;
526      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ3:      info->i = (mips->cpr[0][COP0_Cause] & 0x2000) ? ASSERT_LINE : CLEAR_LINE;   break;
527      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ4:      info->i = (mips->cpr[0][COP0_Cause] & 0x4000) ? ASSERT_LINE : CLEAR_LINE;   break;
528      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ5:      info->i = (mips->cpr[0][COP0_Cause] & 0x8000) ? ASSERT_LINE : CLEAR_LINE;   break;
529
530      case CPUINFO_INT_PREVIOUSPC:               /* optionally implemented */         break;
531
532      case CPUINFO_INT_PC:
533      case CPUINFO_INT_REGISTER + MIPS3_PC:         info->i = mips->pc;                  break;
534      case CPUINFO_INT_REGISTER + MIPS3_SR:         info->i = mips->cpr[0][COP0_Status];   break;
535      case CPUINFO_INT_REGISTER + MIPS3_EPC:         info->i = mips->cpr[0][COP0_EPC];      break;
536      case CPUINFO_INT_REGISTER + MIPS3_CAUSE:      info->i = mips->cpr[0][COP0_Cause];      break;
537      case CPUINFO_INT_REGISTER + MIPS3_COUNT:      info->i = ((activecpu_gettotalcycles64() - mips->count_zero_time) / 2); break;
538      case CPUINFO_INT_REGISTER + MIPS3_COMPARE:      info->i = mips->cpr[0][COP0_Compare];   break;
539      case CPUINFO_INT_REGISTER + MIPS3_INDEX:      info->i = mips->cpr[0][COP0_Index];      break;
540      case CPUINFO_INT_REGISTER + MIPS3_RANDOM:      info->i = mips->cpr[0][COP0_Random];   break;
541      case CPUINFO_INT_REGISTER + MIPS3_ENTRYHI:      info->i = mips->cpr[0][COP0_EntryHi];   break;
542      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO0:      info->i = mips->cpr[0][COP0_EntryLo0];   break;
543      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO1:      info->i = mips->cpr[0][COP0_EntryLo1];   break;
544      case CPUINFO_INT_REGISTER + MIPS3_PAGEMASK:      info->i = mips->cpr[0][COP0_PageMask];   break;
545      case CPUINFO_INT_REGISTER + MIPS3_WIRED:      info->i = mips->cpr[0][COP0_Wired];      break;
546      case CPUINFO_INT_REGISTER + MIPS3_BADVADDR:      info->i = mips->cpr[0][COP0_BadVAddr];   break;
547
548      case CPUINFO_INT_REGISTER + MIPS3_R0:         info->i = mips->r[0];               break;
549      case CPUINFO_INT_REGISTER + MIPS3_R1:         info->i = mips->r[1];               break;
550      case CPUINFO_INT_REGISTER + MIPS3_R2:         info->i = mips->r[2];               break;
551      case CPUINFO_INT_REGISTER + MIPS3_R3:         info->i = mips->r[3];               break;
552      case CPUINFO_INT_REGISTER + MIPS3_R4:         info->i = mips->r[4];               break;
553      case CPUINFO_INT_REGISTER + MIPS3_R5:         info->i = mips->r[5];               break;
554      case CPUINFO_INT_REGISTER + MIPS3_R6:         info->i = mips->r[6];               break;
555      case CPUINFO_INT_REGISTER + MIPS3_R7:         info->i = mips->r[7];               break;
556      case CPUINFO_INT_REGISTER + MIPS3_R8:         info->i = mips->r[8];               break;
557      case CPUINFO_INT_REGISTER + MIPS3_R9:         info->i = mips->r[9];               break;
558      case CPUINFO_INT_REGISTER + MIPS3_R10:         info->i = mips->r[10];               break;
559      case CPUINFO_INT_REGISTER + MIPS3_R11:         info->i = mips->r[11];               break;
560      case CPUINFO_INT_REGISTER + MIPS3_R12:         info->i = mips->r[12];               break;
561      case CPUINFO_INT_REGISTER + MIPS3_R13:         info->i = mips->r[13];               break;
562      case CPUINFO_INT_REGISTER + MIPS3_R14:         info->i = mips->r[14];               break;
563      case CPUINFO_INT_REGISTER + MIPS3_R15:         info->i = mips->r[15];               break;
564      case CPUINFO_INT_REGISTER + MIPS3_R16:         info->i = mips->r[16];               break;
565      case CPUINFO_INT_REGISTER + MIPS3_R17:         info->i = mips->r[17];               break;
566      case CPUINFO_INT_REGISTER + MIPS3_R18:         info->i = mips->r[18];               break;
567      case CPUINFO_INT_REGISTER + MIPS3_R19:         info->i = mips->r[19];               break;
568      case CPUINFO_INT_REGISTER + MIPS3_R20:         info->i = mips->r[20];               break;
569      case CPUINFO_INT_REGISTER + MIPS3_R21:         info->i = mips->r[21];               break;
570      case CPUINFO_INT_REGISTER + MIPS3_R22:         info->i = mips->r[22];               break;
571      case CPUINFO_INT_REGISTER + MIPS3_R23:         info->i = mips->r[23];               break;
572      case CPUINFO_INT_REGISTER + MIPS3_R24:         info->i = mips->r[24];               break;
573      case CPUINFO_INT_REGISTER + MIPS3_R25:         info->i = mips->r[25];               break;
574      case CPUINFO_INT_REGISTER + MIPS3_R26:         info->i = mips->r[26];               break;
575      case CPUINFO_INT_REGISTER + MIPS3_R27:         info->i = mips->r[27];               break;
576      case CPUINFO_INT_REGISTER + MIPS3_R28:         info->i = mips->r[28];               break;
577      case CPUINFO_INT_REGISTER + MIPS3_R29:         info->i = mips->r[29];               break;
578      case CPUINFO_INT_REGISTER + MIPS3_R30:         info->i = mips->r[30];               break;
579      case CPUINFO_INT_SP:
580      case CPUINFO_INT_REGISTER + MIPS3_R31:         info->i = mips->r[31];               break;
581      case CPUINFO_INT_REGISTER + MIPS3_HI:         info->i = mips->hi;                  break;
582      case CPUINFO_INT_REGISTER + MIPS3_LO:         info->i = mips->lo;                  break;
583
584      /* --- the following bits of info are returned as pointers to data or functions --- */
585      case CPUINFO_PTR_SET_INFO:                  /* provided by core */               break;
586      case CPUINFO_PTR_GET_CONTEXT:               /* provided by core */               break;
587      case CPUINFO_PTR_SET_CONTEXT:               /* provided by core */               break;
588      case CPUINFO_PTR_INIT:                     /* provided by core */               break;
589      case CPUINFO_PTR_RESET:                     /* provided by core */               break;
590      case CPUINFO_PTR_EXIT:                     /* provided by core */               break;
591      case CPUINFO_PTR_EXECUTE:                  /* provided by core */               break;
592      case CPUINFO_PTR_TRANSLATE:                  /* provided by core */               break;
593      case CPUINFO_PTR_DISASSEMBLE:               /* provided by core */               break;
594      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &mips3_icount;         break;
595
596      /* --- the following bits of info are returned as NULL-terminated strings --- */
597      case CPUINFO_STR_NAME:                     strcpy(info->s, "MIPS III");         break;
598      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "MIPS III");         break;
599      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "2.0");               break;
600      case CPUINFO_STR_CORE_FILE:                  /* provided by core */               break;
601      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright (C) Aaron Giles 2000-2007"); break;
602
603      case CPUINFO_STR_FLAGS:                     strcpy(info->s, " ");               break;
604
605      case CPUINFO_STR_REGISTER + MIPS3_PC:         sprintf(info->s, "PC: %08X", mips->pc); break;
606      case CPUINFO_STR_REGISTER + MIPS3_SR:         sprintf(info->s, "SR: %08X", (UINT32)mips->cpr[0][COP0_Status]); break;
607      case CPUINFO_STR_REGISTER + MIPS3_EPC:         sprintf(info->s, "EPC:%08X", (UINT32)mips->cpr[0][COP0_EPC]); break;
608      case CPUINFO_STR_REGISTER + MIPS3_CAUSE:       sprintf(info->s, "Cause:%08X", (UINT32)mips->cpr[0][COP0_Cause]); break;
609      case CPUINFO_STR_REGISTER + MIPS3_COUNT:       sprintf(info->s, "Count:%08X", (UINT32)((activecpu_gettotalcycles64() - mips->count_zero_time) / 2)); break;
610      case CPUINFO_STR_REGISTER + MIPS3_COMPARE:      sprintf(info->s, "Compare:%08X", (UINT32)mips->cpr[0][COP0_Compare]); break;
611      case CPUINFO_STR_REGISTER + MIPS3_INDEX:      sprintf(info->s, "Index:%08X", (UINT32)mips->cpr[0][COP0_Index]); break;
612      case CPUINFO_STR_REGISTER + MIPS3_RANDOM:      sprintf(info->s, "Random:%08X", (UINT32)mips->cpr[0][COP0_Random]); break;
613      case CPUINFO_STR_REGISTER + MIPS3_ENTRYHI:      sprintf(info->s, "EntryHi:%08X%08X", (UINT32)(mips->cpr[0][COP0_EntryHi] >> 32), (UINT32)mips->cpr[0][COP0_EntryHi]); break;
614      case CPUINFO_STR_REGISTER + MIPS3_ENTRYLO0:      sprintf(info->s, "EntryLo0:%08X%08X", (UINT32)(mips->cpr[0][COP0_EntryLo0] >> 32), (UINT32)mips->cpr[0][COP0_EntryLo0]); break;
615      case CPUINFO_STR_REGISTER + MIPS3_ENTRYLO1:      sprintf(info->s, "EntryLo1:%08X%08X", (UINT32)(mips->cpr[0][COP0_EntryLo1] >> 32), (UINT32)mips->cpr[0][COP0_EntryLo1]); break;
616      case CPUINFO_STR_REGISTER + MIPS3_PAGEMASK:      sprintf(info->s, "PageMask:%08X%08X", (UINT32)(mips->cpr[0][COP0_PageMask] >> 32), (UINT32)mips->cpr[0][COP0_PageMask]); break;
617      case CPUINFO_STR_REGISTER + MIPS3_WIRED:      sprintf(info->s, "Wired:%08X", (UINT32)mips->cpr[0][COP0_Wired]); break;
618      case CPUINFO_STR_REGISTER + MIPS3_BADVADDR:      sprintf(info->s, "BadVAddr:%08X", (UINT32)mips->cpr[0][COP0_BadVAddr]); break;
619
620      case CPUINFO_STR_REGISTER + MIPS3_R0:         sprintf(info->s, "R0: %08X%08X", (UINT32)(mips->r[0] >> 32), (UINT32)mips->r[0]); break;
621      case CPUINFO_STR_REGISTER + MIPS3_R1:         sprintf(info->s, "R1: %08X%08X", (UINT32)(mips->r[1] >> 32), (UINT32)mips->r[1]); break;
622      case CPUINFO_STR_REGISTER + MIPS3_R2:         sprintf(info->s, "R2: %08X%08X", (UINT32)(mips->r[2] >> 32), (UINT32)mips->r[2]); break;
623      case CPUINFO_STR_REGISTER + MIPS3_R3:         sprintf(info->s, "R3: %08X%08X", (UINT32)(mips->r[3] >> 32), (UINT32)mips->r[3]); break;
624      case CPUINFO_STR_REGISTER + MIPS3_R4:         sprintf(info->s, "R4: %08X%08X", (UINT32)(mips->r[4] >> 32), (UINT32)mips->r[4]); break;
625      case CPUINFO_STR_REGISTER + MIPS3_R5:         sprintf(info->s, "R5: %08X%08X", (UINT32)(mips->r[5] >> 32), (UINT32)mips->r[5]); break;
626      case CPUINFO_STR_REGISTER + MIPS3_R6:         sprintf(info->s, "R6: %08X%08X", (UINT32)(mips->r[6] >> 32), (UINT32)mips->r[6]); break;
627      case CPUINFO_STR_REGISTER + MIPS3_R7:         sprintf(info->s, "R7: %08X%08X", (UINT32)(mips->r[7] >> 32), (UINT32)mips->r[7]); break;
628      case CPUINFO_STR_REGISTER + MIPS3_R8:         sprintf(info->s, "R8: %08X%08X", (UINT32)(mips->r[8] >> 32), (UINT32)mips->r[8]); break;
629      case CPUINFO_STR_REGISTER + MIPS3_R9:         sprintf(info->s, "R9: %08X%08X", (UINT32)(mips->r[9] >> 32), (UINT32)mips->r[9]); break;
630      case CPUINFO_STR_REGISTER + MIPS3_R10:         sprintf(info->s, "R10:%08X%08X", (UINT32)(mips->r[10] >> 32), (UINT32)mips->r[10]); break;
631      case CPUINFO_STR_REGISTER + MIPS3_R11:         sprintf(info->s, "R11:%08X%08X", (UINT32)(mips->r[11] >> 32), (UINT32)mips->r[11]); break;
632      case CPUINFO_STR_REGISTER + MIPS3_R12:         sprintf(info->s, "R12:%08X%08X", (UINT32)(mips->r[12] >> 32), (UINT32)mips->r[12]); break;
633      case CPUINFO_STR_REGISTER + MIPS3_R13:         sprintf(info->s, "R13:%08X%08X", (UINT32)(mips->r[13] >> 32), (UINT32)mips->r[13]); break;
634      case CPUINFO_STR_REGISTER + MIPS3_R14:         sprintf(info->s, "R14:%08X%08X", (UINT32)(mips->r[14] >> 32), (UINT32)mips->r[14]); break;
635      case CPUINFO_STR_REGISTER + MIPS3_R15:         sprintf(info->s, "R15:%08X%08X", (UINT32)(mips->r[15] >> 32), (UINT32)mips->r[15]); break;
636      case CPUINFO_STR_REGISTER + MIPS3_R16:         sprintf(info->s, "R16:%08X%08X", (UINT32)(mips->r[16] >> 32), (UINT32)mips->r[16]); break;
637      case CPUINFO_STR_REGISTER + MIPS3_R17:         sprintf(info->s, "R17:%08X%08X", (UINT32)(mips->r[17] >> 32), (UINT32)mips->r[17]); break;
638      case CPUINFO_STR_REGISTER + MIPS3_R18:         sprintf(info->s, "R18:%08X%08X", (UINT32)(mips->r[18] >> 32), (UINT32)mips->r[18]); break;
639      case CPUINFO_STR_REGISTER + MIPS3_R19:         sprintf(info->s, "R19:%08X%08X", (UINT32)(mips->r[19] >> 32), (UINT32)mips->r[19]); break;
640      case CPUINFO_STR_REGISTER + MIPS3_R20:         sprintf(info->s, "R20:%08X%08X", (UINT32)(mips->r[20] >> 32), (UINT32)mips->r[20]); break;
641      case CPUINFO_STR_REGISTER + MIPS3_R21:         sprintf(info->s, "R21:%08X%08X", (UINT32)(mips->r[21] >> 32), (UINT32)mips->r[21]); break;
642      case CPUINFO_STR_REGISTER + MIPS3_R22:         sprintf(info->s, "R22:%08X%08X", (UINT32)(mips->r[22] >> 32), (UINT32)mips->r[22]); break;
643      case CPUINFO_STR_REGISTER + MIPS3_R23:         sprintf(info->s, "R23:%08X%08X", (UINT32)(mips->r[23] >> 32), (UINT32)mips->r[23]); break;
644      case CPUINFO_STR_REGISTER + MIPS3_R24:         sprintf(info->s, "R24:%08X%08X", (UINT32)(mips->r[24] >> 32), (UINT32)mips->r[24]); break;
645      case CPUINFO_STR_REGISTER + MIPS3_R25:         sprintf(info->s, "R25:%08X%08X", (UINT32)(mips->r[25] >> 32), (UINT32)mips->r[25]); break;
646      case CPUINFO_STR_REGISTER + MIPS3_R26:         sprintf(info->s, "R26:%08X%08X", (UINT32)(mips->r[26] >> 32), (UINT32)mips->r[26]); break;
647      case CPUINFO_STR_REGISTER + MIPS3_R27:         sprintf(info->s, "R27:%08X%08X", (UINT32)(mips->r[27] >> 32), (UINT32)mips->r[27]); break;
648      case CPUINFO_STR_REGISTER + MIPS3_R28:         sprintf(info->s, "R28:%08X%08X", (UINT32)(mips->r[28] >> 32), (UINT32)mips->r[28]); break;
649      case CPUINFO_STR_REGISTER + MIPS3_R29:         sprintf(info->s, "R29:%08X%08X", (UINT32)(mips->r[29] >> 32), (UINT32)mips->r[29]); break;
650      case CPUINFO_STR_REGISTER + MIPS3_R30:         sprintf(info->s, "R30:%08X%08X", (UINT32)(mips->r[30] >> 32), (UINT32)mips->r[30]); break;
651      case CPUINFO_STR_REGISTER + MIPS3_R31:         sprintf(info->s, "R31:%08X%08X", (UINT32)(mips->r[31] >> 32), (UINT32)mips->r[31]); break;
652      case CPUINFO_STR_REGISTER + MIPS3_HI:         sprintf(info->s, "HI: %08X%08X", (UINT32)(mips->hi >> 32), (UINT32)mips->hi); break;
653      case CPUINFO_STR_REGISTER + MIPS3_LO:         sprintf(info->s, "LO: %08X%08X", (UINT32)(mips->lo >> 32), (UINT32)mips->lo); break;
654
655      case CPUINFO_STR_REGISTER + MIPS3_FPR0:         sprintf(info->s, "FPR0: %08X%08X", (UINT32)(mips->cpr[1][0] >> 32), (UINT32)mips->cpr[1][0]); break;
656      case CPUINFO_STR_REGISTER + MIPS3_FPR1:         sprintf(info->s, "FPR1: %08X%08X", (UINT32)(mips->cpr[1][1] >> 32), (UINT32)mips->cpr[1][1]); break;
657      case CPUINFO_STR_REGISTER + MIPS3_FPR2:         sprintf(info->s, "FPR2: %08X%08X", (UINT32)(mips->cpr[1][2] >> 32), (UINT32)mips->cpr[1][2]); break;
658      case CPUINFO_STR_REGISTER + MIPS3_FPR3:         sprintf(info->s, "FPR3: %08X%08X", (UINT32)(mips->cpr[1][3] >> 32), (UINT32)mips->cpr[1][3]); break;
659      case CPUINFO_STR_REGISTER + MIPS3_FPR4:         sprintf(info->s, "FPR4: %08X%08X", (UINT32)(mips->cpr[1][4] >> 32), (UINT32)mips->cpr[1][4]); break;
660      case CPUINFO_STR_REGISTER + MIPS3_FPR5:         sprintf(info->s, "FPR5: %08X%08X", (UINT32)(mips->cpr[1][5] >> 32), (UINT32)mips->cpr[1][5]); break;
661      case CPUINFO_STR_REGISTER + MIPS3_FPR6:         sprintf(info->s, "FPR6: %08X%08X", (UINT32)(mips->cpr[1][6] >> 32), (UINT32)mips->cpr[1][6]); break;
662      case CPUINFO_STR_REGISTER + MIPS3_FPR7:         sprintf(info->s, "FPR7: %08X%08X", (UINT32)(mips->cpr[1][7] >> 32), (UINT32)mips->cpr[1][7]); break;
663      case CPUINFO_STR_REGISTER + MIPS3_FPR8:         sprintf(info->s, "FPR8: %08X%08X", (UINT32)(mips->cpr[1][8] >> 32), (UINT32)mips->cpr[1][8]); break;
664      case CPUINFO_STR_REGISTER + MIPS3_FPR9:         sprintf(info->s, "FPR9: %08X%08X", (UINT32)(mips->cpr[1][9] >> 32), (UINT32)mips->cpr[1][9]); break;
665      case CPUINFO_STR_REGISTER + MIPS3_FPR10:      sprintf(info->s, "FPR10:%08X%08X", (UINT32)(mips->cpr[1][10] >> 32), (UINT32)mips->cpr[1][10]); break;
666      case CPUINFO_STR_REGISTER + MIPS3_FPR11:      sprintf(info->s, "FPR11:%08X%08X", (UINT32)(mips->cpr[1][11] >> 32), (UINT32)mips->cpr[1][11]); break;
667      case CPUINFO_STR_REGISTER + MIPS3_FPR12:      sprintf(info->s, "FPR12:%08X%08X", (UINT32)(mips->cpr[1][12] >> 32), (UINT32)mips->cpr[1][12]); break;
668      case CPUINFO_STR_REGISTER + MIPS3_FPR13:      sprintf(info->s, "FPR13:%08X%08X", (UINT32)(mips->cpr[1][13] >> 32), (UINT32)mips->cpr[1][13]); break;
669      case CPUINFO_STR_REGISTER + MIPS3_FPR14:      sprintf(info->s, "FPR14:%08X%08X", (UINT32)(mips->cpr[1][14] >> 32), (UINT32)mips->cpr[1][14]); break;
670      case CPUINFO_STR_REGISTER + MIPS3_FPR15:      sprintf(info->s, "FPR15:%08X%08X", (UINT32)(mips->cpr[1][15] >> 32), (UINT32)mips->cpr[1][15]); break;
671      case CPUINFO_STR_REGISTER + MIPS3_FPR16:      sprintf(info->s, "FPR16:%08X%08X", (UINT32)(mips->cpr[1][16] >> 32), (UINT32)mips->cpr[1][16]); break;
672      case CPUINFO_STR_REGISTER + MIPS3_FPR17:      sprintf(info->s, "FPR17:%08X%08X", (UINT32)(mips->cpr[1][17] >> 32), (UINT32)mips->cpr[1][17]); break;
673      case CPUINFO_STR_REGISTER + MIPS3_FPR18:      sprintf(info->s, "FPR18:%08X%08X", (UINT32)(mips->cpr[1][18] >> 32), (UINT32)mips->cpr[1][18]); break;
674      case CPUINFO_STR_REGISTER + MIPS3_FPR19:      sprintf(info->s, "FPR19:%08X%08X", (UINT32)(mips->cpr[1][19] >> 32), (UINT32)mips->cpr[1][19]); break;
675      case CPUINFO_STR_REGISTER + MIPS3_FPR20:      sprintf(info->s, "FPR20:%08X%08X", (UINT32)(mips->cpr[1][20] >> 32), (UINT32)mips->cpr[1][20]); break;
676      case CPUINFO_STR_REGISTER + MIPS3_FPR21:      sprintf(info->s, "FPR21:%08X%08X", (UINT32)(mips->cpr[1][21] >> 32), (UINT32)mips->cpr[1][21]); break;
677      case CPUINFO_STR_REGISTER + MIPS3_FPR22:      sprintf(info->s, "FPR22:%08X%08X", (UINT32)(mips->cpr[1][22] >> 32), (UINT32)mips->cpr[1][22]); break;
678      case CPUINFO_STR_REGISTER + MIPS3_FPR23:      sprintf(info->s, "FPR23:%08X%08X", (UINT32)(mips->cpr[1][23] >> 32), (UINT32)mips->cpr[1][23]); break;
679      case CPUINFO_STR_REGISTER + MIPS3_FPR24:      sprintf(info->s, "FPR24:%08X%08X", (UINT32)(mips->cpr[1][24] >> 32), (UINT32)mips->cpr[1][24]); break;
680      case CPUINFO_STR_REGISTER + MIPS3_FPR25:      sprintf(info->s, "FPR25:%08X%08X", (UINT32)(mips->cpr[1][25] >> 32), (UINT32)mips->cpr[1][25]); break;
681      case CPUINFO_STR_REGISTER + MIPS3_FPR26:      sprintf(info->s, "FPR26:%08X%08X", (UINT32)(mips->cpr[1][26] >> 32), (UINT32)mips->cpr[1][26]); break;
682      case CPUINFO_STR_REGISTER + MIPS3_FPR27:      sprintf(info->s, "FPR27:%08X%08X", (UINT32)(mips->cpr[1][27] >> 32), (UINT32)mips->cpr[1][27]); break;
683      case CPUINFO_STR_REGISTER + MIPS3_FPR28:      sprintf(info->s, "FPR28:%08X%08X", (UINT32)(mips->cpr[1][28] >> 32), (UINT32)mips->cpr[1][28]); break;
684      case CPUINFO_STR_REGISTER + MIPS3_FPR29:      sprintf(info->s, "FPR29:%08X%08X", (UINT32)(mips->cpr[1][29] >> 32), (UINT32)mips->cpr[1][29]); break;
685      case CPUINFO_STR_REGISTER + MIPS3_FPR30:      sprintf(info->s, "FPR30:%08X%08X", (UINT32)(mips->cpr[1][30] >> 32), (UINT32)mips->cpr[1][30]); break;
686      case CPUINFO_STR_REGISTER + MIPS3_FPR31:      sprintf(info->s, "FPR31:%08X%08X", (UINT32)(mips->cpr[1][31] >> 32), (UINT32)mips->cpr[1][31]); break;
687   }
688}
689
690
691/***************************************************************************
692    INTERNAL HELPERS
693***************************************************************************/
694
695/*-------------------------------------------------
696    compare_int_callback - callback that fires
697    whenever a compare interrupt is generated
698-------------------------------------------------*/
699
700static TIMER_CALLBACK( compare_int_callback )
701{
702   cpunum_set_input_line(param, MIPS3_IRQ5, ASSERT_LINE);
703}
704
705
706/*-------------------------------------------------
707    compute_config_register - compute the value
708    of the config register
709-------------------------------------------------*/
710
711static UINT32 compute_config_register(const mips3_state *mips)
712{
713   /* set the cache line size to 32 bytes */
714   UINT32 configreg = 0x00026030;
715   int divisor;
716
717   /* set the data cache size */
718        if (mips->icache_size <= 0x01000) configreg |= 0 << 6;
719   else if (mips->icache_size <= 0x02000) configreg |= 1 << 6;
720   else if (mips->icache_size <= 0x04000) configreg |= 2 << 6;
721   else if (mips->icache_size <= 0x08000) configreg |= 3 << 6;
722   else if (mips->icache_size <= 0x10000) configreg |= 4 << 6;
723   else if (mips->icache_size <= 0x20000) configreg |= 5 << 6;
724   else if (mips->icache_size <= 0x40000) configreg |= 6 << 6;
725   else                                   configreg |= 7 << 6;
726
727   /* set the instruction cache size */
728        if (mips->icache_size <= 0x01000) configreg |= 0 << 9;
729   else if (mips->icache_size <= 0x02000) configreg |= 1 << 9;
730   else if (mips->icache_size <= 0x04000) configreg |= 2 << 9;
731   else if (mips->icache_size <= 0x08000) configreg |= 3 << 9;
732   else if (mips->icache_size <= 0x10000) configreg |= 4 << 9;
733   else if (mips->icache_size <= 0x20000) configreg |= 5 << 9;
734   else if (mips->icache_size <= 0x40000) configreg |= 6 << 9;
735   else                                   configreg |= 7 << 9;
736
737   /* set the endianness bit */
738   if (mips->bigendian)
739      configreg |= 0x00008000;
740
741   /* set the system clock divider */
742   divisor = 2;
743   if (mips->system_clock != 0)
744   {
745      divisor = mips->cpu_clock / mips->system_clock;
746      if (mips->system_clock * divisor != mips->cpu_clock)
747      {
748         configreg |= 0x80000000;
749         divisor = mips->cpu_clock * 2 / mips->system_clock;
750      }
751   }
752   configreg |= (((divisor < 2) ? 2 : (divisor > 8) ? 8 : divisor) - 2) << 28;
753
754   return configreg;
755}
756
757
758/*-------------------------------------------------
759    compute_prid_register - compute the value
760    of the PRId register
761-------------------------------------------------*/
762
763static UINT32 compute_prid_register(const mips3_state *mips)
764{
765   switch (mips->flavor)
766   {
767      case MIPS3_TYPE_R4600:
768      case MIPS3_TYPE_R4650:
769         return 0x2000;
770
771      case MIPS3_TYPE_R4700:
772         return 0x2100;
773
774      case MIPS3_TYPE_R5000:
775      case MIPS3_TYPE_QED5271:
776         return 0x2300;
777
778      case MIPS3_TYPE_RM7000:
779         return 0x2700;
780
781      default:
782         fatalerror("Unknown MIPS flavor specified");
783   }
784   return 0x2000;
785}
786
787
788/*-------------------------------------------------
789    tlb_write_common - common routine for writing
790    a TLB entry
791-------------------------------------------------*/
792
793static void tlb_write_common(mips3_state *mips, int index)
794{
795   /* only handle entries within the TLB */
796   if (index < ARRAY_LENGTH(mips->tlb))
797   {
798      mips3_tlb_entry *tlbent = &mips->tlb[index];
799
800      /* unmap what we have */
801      mips3com_unmap_tlb_entries(mips);
802
803      /* fill in the new TLB entry from the COP0 registers */
804      tlbent->page_mask = mips->cpr[0][COP0_PageMask];
805      tlbent->entry_hi = mips->cpr[0][COP0_EntryHi] & ~(tlbent->page_mask & U64(0x0000000001ffe000));
806      tlbent->entry_lo[0] = mips->cpr[0][COP0_EntryLo0];
807      tlbent->entry_lo[1] = mips->cpr[0][COP0_EntryLo1];
808
809      /* remap the TLB */
810      mips3com_map_tlb_entries(mips);
811
812      /* log the two halves once they are in */
813      tlb_entry_log_half(tlbent, index, 0);
814      tlb_entry_log_half(tlbent, index, 1);
815   }
816}
817
818
819/*-------------------------------------------------
820    tlb_entry_log_half - log half of a single TLB
821    entry
822-------------------------------------------------*/
823
824static void tlb_entry_log_half(mips3_tlb_entry *tlbent, int index, int which)
825{
826#if PRINTF_TLB
827   UINT64 hi = tlbent->entry_hi;
828   UINT64 lo = tlbent->entry_lo[which];
829   UINT32 vpn = (((hi >> 13) & 0x07ffffff) << 1);
830   UINT32 asid = hi & 0xff;
831   UINT32 r = (hi >> 62) & 3;
832   UINT32 pfn = (lo >> 6) & 0x00ffffff;
833   UINT32 c = (lo >> 3) & 7;
834   UINT32 pagesize = (((tlbent->page_mask >> 13) & 0xfff) + 1) << MIPS3_MIN_PAGE_SHIFT;
835   UINT64 vaddr = (UINT64)vpn * MIPS3_MIN_PAGE_SIZE;
836   UINT64 paddr = (UINT64)pfn * MIPS3_MIN_PAGE_SIZE;
837
838   vaddr += pagesize * which;
839
840   mame_printf_debug("index=%08X  pagesize=%08X  vaddr=%08X%08X  paddr=%08X%08X  asid=%02X  r=%X  c=%X  dvg=%c%c%c\n",
841         index, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr,
842         asid, r, c, (lo & 4) ? 'd' : '.', (lo & 2) ? 'v' : '.', (hi & 0x1000) ? 'g' : '.');
843#endif
844}
845
846
847
848/***************************************************************************
849    DOUBLEWORD READS/WRITES
850***************************************************************************/
851
852/*-------------------------------------------------
853    program_read_qword_32be - read a 64-bit
854    big-endian value
855-------------------------------------------------*/
856
857static UINT64 program_read_qword_32be(offs_t offset)
858{
859   UINT64 result = (UINT64)program_read_dword_32be(offset) << 32;
860   return result | program_read_dword_32be(offset + 4);
861}
862
863
864/*-------------------------------------------------
865    program_read_qword_32le - read a 64-bit
866    little-endian value
867-------------------------------------------------*/
868
869static UINT64 program_read_qword_32le(offs_t offset)
870{
871   UINT64 result = program_read_dword_32le(offset);
872   return result | ((UINT64)program_read_dword_32le(offset + 4) << 32);
873}
874
875
876/*-------------------------------------------------
877    program_write_qword_32be - write a 64-bit
878    big-endian value
879-------------------------------------------------*/
880
881static void program_write_qword_32be(offs_t offset, UINT64 data)
882{
883   program_write_dword_32be(offset, data >> 32);
884   program_write_dword_32be(offset + 4, data);
885}
886
887
888/*-------------------------------------------------
889    program_write_qword_32le - write a 64-bit
890    little-endian value
891-------------------------------------------------*/
892
893static void program_write_qword_32le(offs_t offset, UINT64 data)
894{
895   program_write_dword_32le(offset, data);
896   program_write_dword_32le(offset + 4, data >> 32);
897}
src/emu/cpu/mips/mips3.c
r869r870
1212#include <math.h>
1313#include "cpuintrf.h"
1414#include "debugger.h"
15#include "mips3.h"
15#include "mips3com.h"
1616
1717
1818#define ENABLE_OVERFLOWS   0
19#define PRINTF_TLB         0
2019
2120
2221/***************************************************************************
23    CONSTANTS
24***************************************************************************/
25
26/* COP0 registers */
27#define COP0_Index         0
28#define COP0_Random         1
29#define COP0_EntryLo      2
30#define COP0_EntryLo0      2
31#define COP0_EntryLo1      3
32#define COP0_Context      4
33#define COP0_PageMask      5
34#define COP0_Wired         6
35#define COP0_BadVAddr      8
36#define COP0_Count         9
37#define COP0_EntryHi      10
38#define COP0_Compare      11
39#define COP0_Status         12
40#define COP0_Cause         13
41#define COP0_EPC         14
42#define COP0_PRId         15
43#define COP0_Config         16
44#define COP0_XContext      20
45
46/* Status register bits */
47#define SR_IE            0x00000001
48#define SR_EXL            0x00000002
49#define SR_ERL            0x00000004
50#define SR_KSU_MASK         0x00000018
51#define SR_KSU_KERNEL      0x00000000
52#define SR_KSU_SUPERVISOR   0x00000008
53#define SR_KSU_USER         0x00000010
54#define SR_IMSW0         0x00000100
55#define SR_IMSW1         0x00000200
56#define SR_IMEX0         0x00000400
57#define SR_IMEX1         0x00000800
58#define SR_IMEX2         0x00001000
59#define SR_IMEX3         0x00002000
60#define SR_IMEX4         0x00004000
61#define SR_IMEX5         0x00008000
62#define SR_DE            0x00010000
63#define SR_CE            0x00020000
64#define SR_CH            0x00040000
65#define SR_SR            0x00100000
66#define SR_TS            0x00200000
67#define SR_BEV            0x00400000
68#define SR_RE            0x02000000
69#define SR_FR            0x04000000
70#define SR_RP            0x08000000
71#define SR_COP0            0x10000000
72#define SR_COP1            0x20000000
73#define SR_COP2            0x40000000
74#define SR_COP3            0x80000000
75
76/* exception types */
77#define EXCEPTION_INTERRUPT   0
78#define EXCEPTION_TLBMOD   1
79#define EXCEPTION_TLBLOAD   2
80#define EXCEPTION_TLBSTORE   3
81#define EXCEPTION_ADDRLOAD   4
82#define EXCEPTION_ADDRSTORE   5
83#define EXCEPTION_BUSINST   6
84#define EXCEPTION_BUSDATA   7
85#define EXCEPTION_SYSCALL   8
86#define EXCEPTION_BREAK      9
87#define EXCEPTION_INVALIDOP   10
88#define EXCEPTION_BADCOP   11
89#define EXCEPTION_OVERFLOW   12
90#define EXCEPTION_TRAP      13
91
92
93
94/***************************************************************************
9522    HELPER MACROS
9623***************************************************************************/
9724
98#define RSREG      ((op >> 21) & 31)
99#define RTREG      ((op >> 16) & 31)
100#define RDREG      ((op >> 11) & 31)
101#define SHIFT      ((op >> 6) & 31)
25#define RSVAL32      ((UINT32)mips3.core.r[RSREG])
26#define RTVAL32      ((UINT32)mips3.core.r[RTREG])
27#define RDVAL32      ((UINT32)mips3.core.r[RDREG])
10228
103#define RSVAL32      ((UINT32)mips3.r[RSREG])
104#define RTVAL32      ((UINT32)mips3.r[RTREG])
105#define RDVAL32      ((UINT32)mips3.r[RDREG])
29#define RSVAL64      (mips3.core.r[RSREG])
30#define RTVAL64      (mips3.core.r[RTREG])
31#define RDVAL64      (mips3.core.r[RDREG])
10632
107#define RSVAL64      (mips3.r[RSREG])
108#define RTVAL64      (mips3.r[RTREG])
109#define RDVAL64      (mips3.r[RDREG])
33#define FRVALS_FR0   (((float *)&mips3.core.cpr[1][0])[FRREG])
34#define FTVALS_FR0   (((float *)&mips3.core.cpr[1][0])[FTREG])
35#define FSVALS_FR0   (((float *)&mips3.core.cpr[1][0])[FSREG])
36#define FDVALS_FR0   (((float *)&mips3.core.cpr[1][0])[FDREG])
37#define FSVALW_FR0   (((UINT32 *)&mips3.core.cpr[1][0])[FSREG])
38#define FDVALW_FR0   (((UINT32 *)&mips3.core.cpr[1][0])[FDREG])
11039
111#define FRREG      ((op >> 21) & 31)
112#define FTREG      ((op >> 16) & 31)
113#define FSREG      ((op >> 11) & 31)
114#define FDREG      ((op >> 6) & 31)
40#define FRVALD_FR0   (*(double *)&mips3.core.cpr[1][FRREG/2])
41#define FTVALD_FR0   (*(double *)&mips3.core.cpr[1][FTREG/2])
42#define FSVALD_FR0   (*(double *)&mips3.core.cpr[1][FSREG/2])
43#define FDVALD_FR0   (*(double *)&mips3.core.cpr[1][FDREG/2])
44#define FSVALL_FR0   (((UINT64 *)&mips3.core.cpr[1][0])[FSREG/2])
45#define FDVALL_FR0   (((UINT64 *)&mips3.core.cpr[1][0])[FDREG/2])
11546
116#define FRVALS_FR0   (((float *)&mips3.cpr[1][0])[FRREG])
117#define FTVALS_FR0   (((float *)&mips3.cpr[1][0])[FTREG])
118#define FSVALS_FR0   (((float *)&mips3.cpr[1][0])[FSREG])
119#define FDVALS_FR0   (((float *)&mips3.cpr[1][0])[FDREG])
120#define FSVALW_FR0   (((UINT32 *)&mips3.cpr[1][0])[FSREG])
121#define FDVALW_FR0   (((UINT32 *)&mips3.cpr[1][0])[FDREG])
47#define FRVALS_FR1   (((float *)&mips3.core.cpr[1][FRREG])[BYTE_XOR_LE(0)])
48#define FTVALS_FR1   (((float *)&mips3.core.cpr[1][FTREG])[BYTE_XOR_LE(0)])
49#define FSVALS_FR1   (((float *)&mips3.core.cpr[1][FSREG])[BYTE_XOR_LE(0)])
50#define FDVALS_FR1   (((float *)&mips3.core.cpr[1][FDREG])[BYTE_XOR_LE(0)])
51#define FSVALW_FR1   (((UINT32 *)&mips3.core.cpr[1][FSREG])[BYTE_XOR_LE(0)])
52#define FDVALW_FR1   (((UINT32 *)&mips3.core.cpr[1][FDREG])[BYTE_XOR_LE(0)])
12253
123#define FRVALD_FR0   (*(double *)&mips3.cpr[1][FRREG/2])
124#define FTVALD_FR0   (*(double *)&mips3.cpr[1][FTREG/2])
125#define FSVALD_FR0   (*(double *)&mips3.cpr[1][FSREG/2])
126#define FDVALD_FR0   (*(double *)&mips3.cpr[1][FDREG/2])
127#define FSVALL_FR0   (((UINT64 *)&mips3.cpr[1][0])[FSREG/2])
128#define FDVALL_FR0   (((UINT64 *)&mips3.cpr[1][0])[FDREG/2])
54#define FRVALD_FR1   (*(double *)&mips3.core.cpr[1][FRREG])
55#define FTVALD_FR1   (*(double *)&mips3.core.cpr[1][FTREG])
56#define FSVALD_FR1   (*(double *)&mips3.core.cpr[1][FSREG])
57#define FDVALD_FR1   (*(double *)&mips3.core.cpr[1][FDREG])
58#define FSVALL_FR1   (*(UINT64 *)&mips3.core.cpr[1][FSREG])
59#define FDVALL_FR1   (*(UINT64 *)&mips3.core.cpr[1][FDREG])
12960
130#define FRVALS_FR1   (((float *)&mips3.cpr[1][FRREG])[BYTE_XOR_LE(0)])
131#define FTVALS_FR1   (((float *)&mips3.cpr[1][FTREG])[BYTE_XOR_LE(0)])
132#define FSVALS_FR1   (((float *)&mips3.cpr[1][FSREG])[BYTE_XOR_LE(0)])
133#define FDVALS_FR1   (((float *)&mips3.cpr[1][FDREG])[BYTE_XOR_LE(0)])
134#define FSVALW_FR1   (((UINT32 *)&mips3.cpr[1][FSREG])[BYTE_XOR_LE(0)])
135#define FDVALW_FR1   (((UINT32 *)&mips3.cpr[1][FDREG])[BYTE_XOR_LE(0)])
136
137#define FRVALD_FR1   (*(double *)&mips3.cpr[1][FRREG])
138#define FTVALD_FR1   (*(double *)&mips3.cpr[1][FTREG])
139#define FSVALD_FR1   (*(double *)&mips3.cpr[1][FSREG])
140#define FDVALD_FR1   (*(double *)&mips3.cpr[1][FDREG])
141#define FSVALL_FR1   (*(UINT64 *)&mips3.cpr[1][FSREG])
142#define FDVALL_FR1   (*(UINT64 *)&mips3.cpr[1][FDREG])
143
144#define IS_SINGLE(o) (((o) & (1 << 21)) == 0)
145#define IS_DOUBLE(o) (((o) & (1 << 21)) != 0)
146#define IS_FLOAT(o) (((o) & (1 << 23)) == 0)
147#define IS_INTEGRAL(o) (((o) & (1 << 23)) != 0)
148
149#define SIMMVAL      ((INT16)op)
150#define UIMMVAL      ((UINT16)op)
151#define LIMMVAL      (op & 0x03ffffff)
152
153#define ADDPC(x)   mips3.nextpc = mips3.pc + ((x) << 2)
154#define ADDPCL(x,l)   { mips3.nextpc = mips3.pc + ((x) << 2); mips3.r[l] = mips3.pc + 4; }
155#define ABSPC(x)   mips3.nextpc = (mips3.pc & 0xf0000000) | ((x) << 2)
156#define ABSPCL(x,l)   { mips3.nextpc = (mips3.pc & 0xf0000000) | ((x) << 2); mips3.r[l] = mips3.pc + 4; }
61#define ADDPC(x)   mips3.nextpc = mips3.core.pc + ((x) << 2)
62#define ADDPCL(x,l)   { mips3.nextpc = mips3.core.pc + ((x) << 2); mips3.core.r[l] = mips3.core.pc + 4; }
63#define ABSPC(x)   mips3.nextpc = (mips3.core.pc & 0xf0000000) | ((x) << 2)
64#define ABSPCL(x,l)   { mips3.nextpc = (mips3.core.pc & 0xf0000000) | ((x) << 2); mips3.core.r[l] = mips3.core.pc + 4; }
15765#define SETPC(x)   mips3.nextpc = (x)
158#define SETPCL(x,l)   { mips3.nextpc = (x); mips3.r[l] = mips3.pc + 4; }
66#define SETPCL(x,l)   { mips3.nextpc = (x); mips3.core.r[l] = mips3.core.pc + 4; }
15967
160#define HIVAL      (UINT32)mips3.hi
161#define LOVAL      (UINT32)mips3.lo
162#define HIVAL64      mips3.hi
163#define LOVAL64      mips3.lo
164#define SR         mips3.cpr[0][COP0_Status]
165#define CAUSE      mips3.cpr[0][COP0_Cause]
68#define HIVAL      (UINT32)mips3.core.hi
69#define LOVAL      (UINT32)mips3.core.lo
70#define HIVAL64      mips3.core.hi
71#define LOVAL64      mips3.core.lo
72#define SR         mips3.core.cpr[0][COP0_Status]
73#define CAUSE      mips3.core.cpr[0][COP0_Cause]
16674
167#define GET_FCC(n)   ((mips3.ccr[1][31] >> fcc_shift[n]) & 1)
168#define SET_FCC(n,v) (mips3.ccr[1][31] = (mips3.ccr[1][31] & ~(1 << fcc_shift[n])) | ((v) << fcc_shift[n]))
75#define GET_FCC(n)   ((mips3.core.ccr[1][31] >> fcc_shift[n]) & 1)
76#define SET_FCC(n,v) (mips3.core.ccr[1][31] = (mips3.core.ccr[1][31] & ~(1 << fcc_shift[n])) | ((v) << fcc_shift[n]))
16977
17078#define IS_FR0      (!(SR & SR_FR))
17179#define IS_FR1      (SR & SR_FR)
17280
17381
82
17483/***************************************************************************
17584    STRUCTURES & TYPEDEFS
17685***************************************************************************/
17786
178/* memory access function table */
179typedef struct
180{
181   UINT8      (*readbyte)(offs_t);
182   UINT16      (*readword)(offs_t);
183   UINT32      (*readlong)(offs_t);
184   UINT64      (*readdouble)(offs_t);
185   void      (*writebyte)(offs_t, UINT8);
186   void      (*writeword)(offs_t, UINT16);
187   void      (*writelong)(offs_t, UINT32);
188   void      (*writedouble)(offs_t, UINT64);
189} memory_handlers;
190
191
19287/* MIPS3 Registers */
19388typedef struct
19489{
195   /* core registers */
196   UINT32      pc;
197   UINT64      hi;
198   UINT64      lo;
199   UINT64      r[32];
90   /* core state */
91   mips3_state   core;
20092
201   /* COP registers */
202   UINT64      cpr[4][32];
203   UINT64      ccr[4][32];
204   UINT8      cf[4];
205
20693   /* internal stuff */
20794   UINT32      ppc;
20895   UINT32      nextpc;
20996   UINT32      pcbase;
21097   int         op;
21198   int         interrupt_cycles;
212   int       (*irq_callback)(int irqline);
213   UINT64      count_zero_time;
214   mame_timer *   compare_int_timer;
215   UINT8      is_mips4;
21699   UINT32      ll_value;
217100   UINT64      lld_value;
218   UINT32      system_clock;
219   UINT32      cpu_clock;
220101
221102   /* endian-dependent load/store */
222103   void      (*lwl)(UINT32 op);
r869r870
227108   void      (*ldr)(UINT32 op);
228109   void      (*sdl)(UINT32 op);
229110   void      (*sdr)(UINT32 op);
230
231   /* memory accesses */
232   UINT8      bigendian;
233   memory_handlers memory;
234
235   /* cache memory */
236   UINT32 *   icache;
237   UINT32 *   dcache;
238   size_t      icache_size;
239   size_t      dcache_size;
240
241   /* MMU */
242   struct
243   {
244      UINT64   page_mask;
245      UINT64   entry_hi;
246      UINT64   entry_lo[2];
247   } tlb[48];
248   UINT32 *   tlb_table;
249111} mips3_regs;
250112
251113
r869r870
254116    FUNCTION PROTOTYPES
255117***************************************************************************/
256118
257static void recompute_tlb_table(void);
258
259119static void lwl_be(UINT32 op);
260120static void lwr_be(UINT32 op);
261121static void swl_be(UINT32 op);
r869r870
276136static void sdl_le(UINT32 op);
277137static void sdr_le(UINT32 op);
278138
279static UINT64 read_qword_32be(offs_t offset);
280static UINT64 read_qword_32le(offs_t offset);
281
282static void write_qword_32be(offs_t offset, UINT64 data);
283static void write_qword_32le(offs_t offset, UINT64 data);
284
285139static UINT8 fcc_shift[8] = { 23, 25, 26, 27, 28, 29, 30, 31 };
286140
287141
288142
289143/***************************************************************************
290    PUBLIC GLOBAL VARIABLES
291***************************************************************************/
292
293static int   mips3_icount;
294
295
296
297/***************************************************************************
298144    PRIVATE GLOBAL VARIABLES
299145***************************************************************************/
300146
301147static mips3_regs mips3;
302148
303149
304static const memory_handlers be_memory =
305{
306   program_read_byte_32be,  program_read_word_32be,  program_read_dword_32be, read_qword_32be,
307   program_write_byte_32be, program_write_word_32be, program_write_dword_32be, write_qword_32be
308};
309150
310static const memory_handlers le_memory =
311{
312   program_read_byte_32le,  program_read_word_32le,  program_read_dword_32le, read_qword_32le,
313   program_write_byte_32le, program_write_word_32le, program_write_dword_32le, write_qword_32le
314};
315
316
317
318151/***************************************************************************
319152    MEMORY ACCESSORS
320153***************************************************************************/
r869r870
334167
335168    if (exception != 0)
336169    {
337        fprintf(stderr, "Exception: PC=%08X, PPC=%08X\n", mips3.pc, mips3.ppc);
170        fprintf(stderr, "Exception: PC=%08X, PPC=%08X\n", mips3.core.pc, mips3.ppc);
338171        DEBUGGER_BREAK;
339172    }
340173*/
341174
342175   /* back up if necessary */
343176   if (backup)
344      mips3.pc = mips3.ppc;
177      mips3.core.pc = mips3.ppc;
345178
346179   /* set the exception PC */
347   mips3.cpr[0][COP0_EPC] = mips3.pc;
180   mips3.core.cpr[0][COP0_EPC] = mips3.core.pc;
348181
349182   /* put the cause in the low 8 bits and clear the branch delay flag */
350183   CAUSE = (CAUSE & ~0x800000ff) | (exception << 2);
r869r870
353186   if (mips3.nextpc != ~0)
354187   {
355188      mips3.nextpc = ~0;
356      mips3.cpr[0][COP0_EPC] -= 4;
189      mips3.core.cpr[0][COP0_EPC] -= 4;
357190      CAUSE |= 0x80000000;
358191   }
359192
r869r870
361194   SR |= SR_EXL;
362195
363196   /* based on the BEV bit, we either go to ROM or RAM */
364   mips3.pc = (SR & SR_BEV) ? 0xbfc00200 : 0x80000000;
197   mips3.core.pc = (SR & SR_BEV) ? 0xbfc00200 : 0x80000000;
365198
366199   /* most exceptions go to offset 0x180, except for TLB stuff */
367200   if (exception >= EXCEPTION_TLBMOD && exception <= EXCEPTION_TLBSTORE)
368201   {
369      mips3.pc += 0x00;
370      mame_printf_debug("TLB miss @ %08X\n", (UINT32)mips3.cpr[0][COP0_BadVAddr]);
202      mips3.core.pc += 0x00;
203      mame_printf_debug("TLB miss @ %08X\n", (UINT32)mips3.core.cpr[0][COP0_BadVAddr]);
371204   }
372205   else
373      mips3.pc += 0x180;
206      mips3.core.pc += 0x180;
374207
375208/*
376209    useful for tracking interrupts
377210
378211    if ((CAUSE & 0x7f) == 0)
379        logerror("Took interrupt -- Cause = %08X, PC =  %08X\n", (UINT32)CAUSE, mips3.pc);
212        logerror("Took interrupt -- Cause = %08X, PC =  %08X\n", (UINT32)CAUSE, mips3.core.pc);
380213*/
381214}
382215
383216
384217static void generate_tlb_exception(int exception, offs_t address)
385218{
386   mips3.cpr[0][COP0_BadVAddr] = address;
387   mips3.cpr[0][COP0_Context] = (mips3.cpr[0][COP0_Context] & 0xff800000) | ((address >> 9) & 0x007ffff0);
388   mips3.cpr[0][COP0_EntryHi] = (address & 0xffffe000) | (mips3.cpr[0][COP0_EntryHi] & 0xff);
219   mips3.core.cpr[0][COP0_BadVAddr] = address;
220   mips3.core.cpr[0][COP0_Context] = (mips3.core.cpr[0][COP0_Context] & 0xff800000) | ((address >> 9) & 0x007ffff0);
221   mips3.core.cpr[0][COP0_EntryHi] = (address & 0xffffe000) | (mips3.core.cpr[0][COP0_EntryHi] & 0xff);
389222   generate_exception(exception, 1);
390223}
391224
r869r870
408241}
409242
410243
411static void set_irq_line(int irqline, int state)
412{
413   if (state != CLEAR_LINE)
414      CAUSE |= 0x400 << irqline;
415   else
416      CAUSE &= ~(0x400 << irqline);
417}
418244
419
420
421245/***************************************************************************
422    CONTEXT SWITCHING
246    CORE CALLBACKS
423247***************************************************************************/
424248
425249static void mips3_get_context(void *dst)
426250{
427   /* copy the context */
428   if (dst)
251   if (dst != NULL)
429252      *(mips3_regs *)dst = mips3;
430253}
431254
432255
433256static void mips3_set_context(void *src)
434257{
435   /* copy the context */
436   if (src)
258   if (src != NULL)
437259      mips3 = *(mips3_regs *)src;
438260}
439261
440262
441
442/***************************************************************************
443    INITIALIZATION AND SHUTDOWN
444***************************************************************************/
445
446static TIMER_CALLBACK( compare_int_callback )
263static void mips3_reset(void)
447264{
448   cpunum_set_input_line(param, 5, ASSERT_LINE);
449}
265   /* common reset */
266   mips3com_reset(&mips3.core);
450267
451
452static void mips3_init(int index, int clock, const void *_config, int (*irqcallback)(int))
453{
454   const struct mips3_config *config = _config;
455
456   mips3.irq_callback = irqcallback;
457   mips3.compare_int_timer = mame_timer_alloc(compare_int_callback);
458
459   /* allocate memory */
460   mips3.icache = auto_malloc(config->icache);
461   mips3.dcache = auto_malloc(config->dcache);
462   mips3.tlb_table = auto_malloc(sizeof(mips3.tlb_table[0]) * (1 << (32 - 12)));
463
464   /* initialize the rest of the config */
465   mips3.icache_size = config->icache;
466   mips3.dcache_size = config->dcache;
467   mips3.system_clock = config->system_clock;
468   mips3.cpu_clock = clock;
469}
470
471
472static void mips3_reset(int bigendian, int mips4, UINT32 prid)
473{
474   UINT32 configreg;
475   int divisor;
476
477268   /* set up the endianness */
478   mips3.bigendian = bigendian;
479   if (mips3.bigendian)
269   if (mips3.core.bigendian)
480270   {
481      mips3.memory = be_memory;
482271      mips3.lwl = lwl_be;
483272      mips3.lwr = lwr_be;
484273      mips3.swl = swl_be;
r869r870
490279   }
491280   else
492281   {
493      mips3.memory = le_memory;
494282      mips3.lwl = lwl_le;
495283      mips3.lwr = lwr_le;
496284      mips3.swl = swl_le;
r869r870
500288      mips3.sdl = sdl_le;
501289      mips3.sdr = sdr_le;
502290   }
503
504   /* initialize the state */
505   mips3.pc = 0xbfc00000;
506   mips3.ppc = ~mips3.pc;
507   mips3.nextpc = ~0;
508   mips3.cpr[0][COP0_Status] = SR_BEV | SR_ERL;
509   mips3.cpr[0][COP0_Compare] = 0xffffffff;
510   mips3.cpr[0][COP0_Count] = 0;
511   mips3.count_zero_time = activecpu_gettotalcycles64();
512
513   /* config register: set the cache line size to 32 bytes */
514   configreg = 0x00026030;
515
516   /* config register: set the data cache size */
517        if (mips3.icache_size <= 0x01000) configreg |= 0 << 6;
518   else if (mips3.icache_size <= 0x02000) configreg |= 1 << 6;
519   else if (mips3.icache_size <= 0x04000) configreg |= 2 << 6;
520   else if (mips3.icache_size <= 0x08000) configreg |= 3 << 6;
521   else if (mips3.icache_size <= 0x10000) configreg |= 4 << 6;
522   else if (mips3.icache_size <= 0x20000) configreg |= 5 << 6;
523   else if (mips3.icache_size <= 0x40000) configreg |= 6 << 6;
524   else                                   configreg |= 7 << 6;
525
526   /* config register: set the instruction cache size */
527        if (mips3.icache_size <= 0x01000) configreg |= 0 << 9;
528   else if (mips3.icache_size <= 0x02000) configreg |= 1 << 9;
529   else if (mips3.icache_size <= 0x04000) configreg |= 2 << 9;
530   else if (mips3.icache_size <= 0x08000) configreg |= 3 << 9;
531   else if (mips3.icache_size <= 0x10000) configreg |= 4 << 9;
532   else if (mips3.icache_size <= 0x20000) configreg |= 5 << 9;
533   else if (mips3.icache_size <= 0x40000) configreg |= 6 << 9;
534   else                                   configreg |= 7 << 9;
535
536   /* config register: set the endianness bit */
537   if (bigendian) configreg |= 0x00008000;
538
539   /* config register: set the system clock divider */
540   divisor = 2;
541   if (mips3.system_clock != 0)
542   {
543      divisor = mips3.cpu_clock / mips3.system_clock;
544      if (mips3.system_clock * divisor != mips3.cpu_clock)
545      {
546         configreg |= 0x80000000;
547         divisor = mips3.cpu_clock * 2 / mips3.system_clock;
548      }
549   }
550   configreg |= (((divisor < 2) ? 2 : (divisor > 8) ? 8 : divisor) - 2) << 28;
551
552   /* set up the architecture */
553   mips3.is_mips4 = mips4;
554   mips3.cpr[0][COP0_PRId] = prid;
555   mips3.cpr[0][COP0_Config] = configreg;
556
557   /* recompute the TLB table */
558   recompute_tlb_table();
559291}
560292
561293
562#if (HAS_R4600)
563static void r4600be_reset(void)
294static int mips3_translate(int space, offs_t *address)
564295{
565   mips3_reset(1, 0, 0x2000);
296   /* common translate */
297   return mips3com_translate_address(&mips3.core, space, address);
566298}
567299
568static void r4600le_reset(void)
569{
570   mips3_reset(0, 0, 0x2000);
571}
572#endif
573300
574
575#if (HAS_R4700)
576static void r4700be_reset(void)
301#ifdef MAME_DEBUG
302offs_t mips3_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
577303{
578   mips3_reset(1, 0, 0x2100);
304   /* common disassemble */
305   return mips3com_dasm(&mips3.core, buffer, pc, oprom, opram);
579306}
307#endif /* MAME_DEBUG */
580308
581static void r4700le_reset(void)
582{
583   mips3_reset(0, 0, 0x2100);
584}
585#endif
586309
587310
588#if (HAS_R5000)
589static void r5000be_reset(void)
590{
591   mips3_reset(1, 1, 0x2300);
592}
593
594static void r5000le_reset(void)
595{
596   mips3_reset(0, 1, 0x2300);
597}
598#endif
599
600
601#if (HAS_QED5271)
602static void qed5271be_reset(void)
603{
604   mips3_reset(1, 1, 0x2300);
605}
606
607static void qed5271le_reset(void)
608{
609   mips3_reset(1, 0, 0x2300);
610}
611#endif
612
613
614#if (HAS_RM7000)
615static void rm7000be_reset(void)
616{
617   mips3_reset(1, 1, 0x2700);
618}
619
620static void rm7000le_reset(void)
621{
622   mips3_reset(0, 1, 0x2700);
623}
624#endif
625
626
627static void mips3_exit(void)
628{
629}
630
631
632/* kludge for DRC support */
633static void mips3drc_set_options(UINT8 cpunum, UINT32 opts)
634{
635}
636
637
638
639311/***************************************************************************
640312    TLB HANDLING
641313***************************************************************************/
642314
643static void map_tlb_entries(void)
644{
645   int valid_asid = mips3.cpr[0][COP0_EntryHi] & 0xff;
646   int index;
647
648   /* iterate over all TLB entries */
649   for (index = 0; index < 48; index++)
650   {
651      UINT64 hi = mips3.tlb[index].entry_hi;
652
653      /* only process if the ASID matches or if BOTH entries are marked global */
654      if (valid_asid == (hi & 0xff) || ((mips3.tlb[index].entry_lo[0] & 1) && (mips3.tlb[index].entry_lo[1] & 1)))
655      {
656         UINT32 count = (mips3.tlb[index].page_mask >> 13) & 0x00fff;
657         UINT32 vpn = ((hi >> 13) & 0x07ffffff) << 1;
658         int which, i;
659
660         /* ignore if the virtual address is beyond 32 bits */
661         if (vpn < (1 << (32 - 12)))
662
663            /* loop over both the even and odd pages */
664            for (which = 0; which < 2; which++)
665            {
666               UINT64 lo = mips3.tlb[index].entry_lo[which];
667
668               /* only map if the TLB entry is valid */
669               if (lo & 2)
670               {
671                  UINT32 pfn = (lo >> 6) & 0x00ffffff;
672                  UINT32 wp = (~lo >> 2) & 1;
673
674                  for (i = 0; i <= count; i++, vpn++, pfn++)
675                     if (vpn < 0x80000 || vpn >= 0xc0000)
676                        mips3.tlb_table[vpn] = (pfn << 12) | wp;
677               }
678
679               /* otherwise, advance by the number of pages we would have mapped */
680               else
681                  vpn += count + 1;
682            }
683      }
684   }
685}
686
687
688static void unmap_tlb_entries(void)
689{
690   int index;
691
692   /* iterate over all TLB entries */
693   for (index = 0; index < 48; index++)
694   {
695      UINT64 hi = mips3.tlb[index].entry_hi;
696      UINT32 count = (mips3.tlb[index].page_mask >> 13) & 0x00fff;
697      UINT32 vpn = ((hi >> 13) & 0x07ffffff) << 1;
698      int which, i;
699
700      /* ignore if the virtual address is beyond 32 bits */
701      if (vpn < (1 << (32 - 12)))
702
703         /* loop over both the even and odd pages */
704         for (which = 0; which < 2; which++)
705            for (i = 0; i <= count; i++, vpn++)
706               if (vpn < 0x80000 || vpn >= 0xc0000)
707                  mips3.tlb_table[vpn] = 0xffffffff;
708   }
709}
710
711
712static void recompute_tlb_table(void)
713{
714   UINT32 addr;
715
716   /* map in the hard-coded spaces */
717   for (addr = 0x80000000; addr < 0xc0000000; addr += 1 << 12)
718      mips3.tlb_table[addr >> 12] = addr & 0x1ffff000;
719
720   /* reset everything else to unmapped */
721   memset(&mips3.tlb_table[0x00000000 >> 12], 0xff, sizeof(mips3.tlb_table[0]) * (0x80000000 >> 12));
722   memset(&mips3.tlb_table[0xc0000000 >> 12], 0xff, sizeof(mips3.tlb_table[0]) * (0x40000000 >> 12));
723
724   /* remap all the entries in the TLB */
725   map_tlb_entries();
726}
727
728
729static int translate_address(int space, offs_t *address)
730{
731   if (space == ADDRESS_SPACE_PROGRAM)
732   {
733      UINT32 result = mips3.tlb_table[*address >> 12];
734      if (result == 0xffffffff)
735         return 0;
736      *address = (result & ~0xfff) | (*address & 0xfff);
737   }
738   return 1;
739}
740
741
742315static int update_pcbase(void)
743316{
744   UINT32 entry = mips3.tlb_table[mips3.pc >> 12];
317   UINT32 entry = mips3.core.tlb_table[mips3.core.pc >> 12];
745318   if (entry == 0xffffffff)
746319   {
747      generate_tlb_exception(EXCEPTION_TLBLOAD, mips3.pc);
320      generate_tlb_exception(EXCEPTION_TLBLOAD, mips3.core.pc);
748321      return 0;
749322   }
750323   mips3.pcbase = entry & ~0xfff;
r869r870
755328
756329INLINE int RBYTE(offs_t address, UINT32 *result)
757330{
758   UINT32 tlbval = mips3.tlb_table[address >> 12];
331   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
759332   if (tlbval == 0xffffffff)
760333   {
761334      generate_tlb_exception(EXCEPTION_TLBLOAD, address);
762335      return 0;
763336   }
764   *result = (*mips3.memory.readbyte)((tlbval & ~0xfff) | (address & 0xfff));
337   *result = (*mips3.core.memory.readbyte)((tlbval & ~0xfff) | (address & 0xfff));
765338   return 1;
766339}
767340
768341
769342INLINE int RWORD(offs_t address, UINT32 *result)
770343{
771   UINT32 tlbval = mips3.tlb_table[address >> 12];
344   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
772345   if (tlbval == 0xffffffff)
773346   {
774347      generate_tlb_exception(EXCEPTION_TLBLOAD, address);
775348      return 0;
776349   }
777   *result = (*mips3.memory.readword)((tlbval & ~0xfff) | (address & 0xfff));
350   *result = (*mips3.core.memory.readword)((tlbval & ~0xfff) | (address & 0xfff));
778351   return 1;
779352}
780353
781354
782355INLINE int RLONG(offs_t address, UINT32 *result)
783356{
784   UINT32 tlbval = mips3.tlb_table[address >> 12];
357   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
785358   if (tlbval == 0xffffffff)
786359   {
787360      generate_tlb_exception(EXCEPTION_TLBLOAD, address);
788361      return 0;
789362   }
790   *result = (*mips3.memory.readlong)((tlbval & ~0xfff) | (address & 0xfff));
363   *result = (*mips3.core.memory.readlong)((tlbval & ~0xfff) | (address & 0xfff));
791364   return 1;
792365}
793366
794367
795368INLINE int RDOUBLE(offs_t address, UINT64 *result)
796369{
797   UINT32 tlbval = mips3.tlb_table[address >> 12];
370   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
798371   if (tlbval == 0xffffffff)
799372   {
800373      generate_tlb_exception(EXCEPTION_TLBLOAD, address);
801374      return 0;
802375   }
803   *result = (*mips3.memory.readdouble)((tlbval & ~0xfff) | (address & 0xfff));
376   *result = (*mips3.core.memory.readdouble)((tlbval & ~0xfff) | (address & 0xfff));
804377   return 1;
805378}
806379
807380
808381INLINE void WBYTE(offs_t address, UINT8 data)
809382{
810   UINT32 tlbval = mips3.tlb_table[address >> 12];
383   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
811384   if (tlbval & 1)
812385      generate_tlb_exception(EXCEPTION_TLBSTORE, address);
813386   else
814      (*mips3.memory.writebyte)(tlbval | (address & 0xfff), data);
387      (*mips3.core.memory.writebyte)(tlbval | (address & 0xfff), data);
815388}
816389
817390
818391INLINE void WWORD(offs_t address, UINT16 data)
819392{
820   UINT32 tlbval = mips3.tlb_table[address >> 12];
393   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
821394   if (tlbval & 1)
822395      generate_tlb_exception(EXCEPTION_TLBSTORE, address);
823396   else
824      (*mips3.memory.writeword)(tlbval | (address & 0xfff), data);
397      (*mips3.core.memory.writeword)(tlbval | (address & 0xfff), data);
825398}
826399
827400
828401INLINE void WLONG(offs_t address, UINT32 data)
829402{
830   UINT32 tlbval = mips3.tlb_table[address >> 12];
403   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
831404   if (tlbval & 1)
832405      generate_tlb_exception(EXCEPTION_TLBSTORE, address);
833406   else
834      (*mips3.memory.writelong)(tlbval | (address & 0xfff), data);
407      (*mips3.core.memory.writelong)(tlbval | (address & 0xfff), data);
835408}
836409
837410
838411INLINE void WDOUBLE(offs_t address, UINT64 data)
839412{
840   UINT32 tlbval = mips3.tlb_table[address >> 12];
413   UINT32 tlbval = mips3.core.tlb_table[address >> 12];
841414   if (tlbval & 1)
842415      generate_tlb_exception(EXCEPTION_TLBSTORE, address);
843416   else
844      (*mips3.memory.writedouble)(tlbval | (address & 0xfff), data);
417      (*mips3.core.memory.writedouble)(tlbval | (address & 0xfff), data);
845418}
846419
847420
r869r870
850423    COP0 (SYSTEM) EXECUTION HANDLING
851424***************************************************************************/
852425
853static void update_cycle_counting(void)
854{
855   /* modify the timer to go off */
856   if ((SR & 0x8000) && mips3.cpr[0][COP0_Compare] != 0xffffffff)
857   {
858      UINT32 count = (activecpu_gettotalcycles64() - mips3.count_zero_time) / 2;
859      UINT32 compare = mips3.cpr[0][COP0_Compare];
860      UINT32 cyclesleft = compare - count;
861      mame_time newtime = MAME_TIME_IN_CYCLES(((INT64)cyclesleft * 2), cpu_getactivecpu());
862
863      /* due to accuracy issues, don't bother setting timers unless they're for less than 100msec */
864      if (compare_mame_times(newtime, MAME_TIME_IN_MSEC(100)) < 0)
865         mame_timer_adjust(mips3.compare_int_timer, newtime, cpu_getactivecpu(), time_zero);
866   }
867   else
868      mame_timer_adjust(mips3.compare_int_timer, time_never, cpu_getactivecpu(), time_zero);
869}
870
871426INLINE UINT64 get_cop0_reg(int idx)
872427{
873428   if (idx == COP0_Count)
r869r870
878433         mips3_icount -= 250;
879434      else
880435         mips3_icount = 0;
881      return (UINT32)((activecpu_gettotalcycles64() - mips3.count_zero_time) / 2);
436      return (UINT32)((activecpu_gettotalcycles64() - mips3.core.count_zero_time) / 2);
882437   }
883438   else if (idx == COP0_Cause)
884439   {
r869r870
891446   }
892447   else if (idx == COP0_Random)
893448   {
894      int wired = mips3.cpr[0][COP0_Wired] & 0x3f;
449      int wired = mips3.core.cpr[0][COP0_Wired] & 0x3f;
895450      int range = 48 - wired;
896451      if (range > 0)
897         return ((activecpu_gettotalcycles64() - mips3.count_zero_time) % range + wired) & 0x3f;
452         return ((activecpu_gettotalcycles64() - mips3.core.count_zero_time) % range + wired) & 0x3f;
898453      else
899454         return 47;
900455   }
901   return mips3.cpr[0][idx];
456   return mips3.core.cpr[0][idx];
902457}
903458
904459INLINE void set_cop0_reg(int idx, UINT64 val)
r869r870
912467            /* if we're in a delay slot, propogate the target PC before generating the exception */
913468            if (mips3.nextpc != ~0)
914469            {
915               mips3.pc = mips3.nextpc;
470               mips3.core.pc = mips3.nextpc;
916471               mips3.nextpc = ~0;
917472            }
918473            generate_exception(EXCEPTION_INTERRUPT, 0);
r869r870
922477      case COP0_Status:
923478      {
924479         /* update interrupts and cycle counting */
925         UINT32 diff = mips3.cpr[0][idx] ^ val;
480         UINT32 diff = mips3.core.cpr[0][idx] ^ val;
926481//          if (val & 0xe0)
927482//              fatalerror("System set 64-bit addressing mode, SR=%08X", val);
928         mips3.cpr[0][idx] = val;
483         mips3.core.cpr[0][idx] = val;
929484         if (diff & 0x8000)
930            update_cycle_counting();
485            mips3com_update_cycle_counting(&mips3.core);
931486         check_irqs();
932487         break;
933488      }
934489
935490      case COP0_Count:
936         mips3.count_zero_time = activecpu_gettotalcycles64() - ((UINT64)(UINT32)val * 2);
937         update_cycle_counting();
491         mips3.core.count_zero_time = activecpu_gettotalcycles64() - ((UINT64)(UINT32)val * 2);
492         mips3com_update_cycle_counting(&mips3.core);
938493         break;
939494
940495      case COP0_Compare:
941496         CAUSE &= ~0x8000;
942         mips3.cpr[0][idx] = val & 0xffffffff;
943         update_cycle_counting();
497         mips3.core.cpr[0][idx] = val & 0xffffffff;
498         mips3com_update_cycle_counting(&mips3.core);
944499         break;
945500
946501      case COP0_PRId:
947502         break;
948503
949504      case COP0_Config:
950         mips3.cpr[0][idx] = (mips3.cpr[0][idx] & ~7) | (val & 7);
505         mips3.core.cpr[0][idx] = (mips3.core.cpr[0][idx] & ~7) | (val & 7);
951506         break;
952507
953508      case COP0_EntryHi:
954509         /* if the ASID changes, remap */
955         if ((mips3.cpr[0][idx] ^ val) & 0xff)
510         if ((mips3.core.cpr[0][idx] ^ val) & 0xff)
956511         {
957            mips3.cpr[0][idx] = val;
958            unmap_tlb_entries();
959            map_tlb_entries();
512            mips3.core.cpr[0][idx] = val;
513            mips3com_unmap_tlb_entries(&mips3.core);
514            mips3com_map_tlb_entries(&mips3.core);
960515         }
961         mips3.cpr[0][idx] = val;
516         mips3.core.cpr[0][idx] = val;
962517         break;
963518
964519      default:
965         mips3.cpr[0][idx] = val;
520         mips3.core.cpr[0][idx] = val;
966521         break;
967522   }
968523}
969524
970525INLINE UINT64 get_cop0_creg(int idx)
971526{
972   return mips3.ccr[0][idx];
527   return mips3.core.ccr[0][idx];
973528}
974529
975530INLINE void set_cop0_creg(int idx, UINT64 val)
976531{
977   mips3.ccr[0][idx] = val;
532   mips3.core.ccr[0][idx] = val;
978533}
979534
980INLINE void logonetlbentry(int index, int which)
981{
982#if PRINTF_TLB
983   UINT64 hi = mips3.cpr[0][COP0_EntryHi];
984   UINT64 lo = mips3.cpr[0][COP0_EntryLo0 + which];
985   UINT32 vpn = (((hi >> 13) & 0x07ffffff) << 1);
986   UINT32 asid = hi & 0xff;
987   UINT32 r = (hi >> 62) & 3;
988   UINT32 pfn = (lo >> 6) & 0x00ffffff;
989   UINT32 c = (lo >> 3) & 7;
990   UINT32 pagesize = (((mips3.cpr[0][COP0_PageMask] >> 13) & 0xfff) + 1) << 12;
991   UINT64 vaddr = (UINT64)vpn * 0x1000;
992   UINT64 paddr = (UINT64)pfn * 0x1000;
993
994   vaddr += pagesize * which;
995
996   mame_printf_debug("index=%08X  pagesize=%08X  vaddr=%08X%08X  paddr=%08X%08X  asid=%02X  r=%X  c=%X  dvg=%c%c%c\n",
997         index, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr,
998         asid, r, c, (lo & 4) ? 'd' : '.', (lo & 2) ? 'v' : '.', (lo & 1) ? 'g' : '.');
999#endif
1000}
1001
1002static void logtlbentry(int index)
1003{
1004   logonetlbentry(index, 0);
1005   logonetlbentry(index, 1);
1006}
1007
1008535INLINE void handle_cop0(UINT32 op)
1009536{
1010   UINT32 index, wired, vpn;
1011
1012537   if ((SR & SR_KSU_MASK) != SR_KSU_KERNEL && !(SR & SR_COP0))
1013538      generate_exception(EXCEPTION_BADCOP, 1);
1014539
r869r870
1023548      case 0x08:   /* BC */
1024549         switch (RTREG)
1025550         {
1026            case 0x00:   /* BCzF */   if (!mips3.cf[0]) ADDPC(SIMMVAL);               break;
1027            case 0x01:   /* BCzF */   if (mips3.cf[0]) ADDPC(SIMMVAL);               break;
551            case 0x00:   /* BCzF */   if (!mips3.core.cf[0]) ADDPC(SIMMVAL);            break;
552            case 0x01:   /* BCzF */   if (mips3.core.cf[0]) ADDPC(SIMMVAL);            break;
1028553            case 0x02:   /* BCzFL */   invalid_instruction(op);                     break;
1029554            case 0x03:   /* BCzTL */   invalid_instruction(op);                     break;
1030555            default:   invalid_instruction(op);                              break;
r869r870
1049574         switch (op & 0x01ffffff)
1050575         {
1051576            case 0x01:   /* TLBR */
1052               index = mips3.cpr[0][COP0_Index] & 0x3f;
1053               if (index < 48)
1054               {
1055                  mips3.cpr[0][COP0_PageMask] = mips3.tlb[index].page_mask;
1056                  mips3.cpr[0][COP0_EntryHi] = mips3.tlb[index].entry_hi;
1057                  mips3.cpr[0][COP0_EntryLo0] = mips3.tlb[index].entry_lo[0];
1058                  mips3.cpr[0][COP0_EntryLo1] = mips3.tlb[index].entry_lo[1];
1059               }
577               mips3com_tlbr(&mips3.core);
1060578               break;
1061579
1062580            case 0x02:   /* TLBWI */
1063               index = mips3.cpr[0][COP0_Index] & 0x3f;
1064               logtlbentry(index);
1065               if (index < 48)
1066               {
1067                  unmap_tlb_entries();
1068                  mips3.tlb[index].page_mask = mips3.cpr[0][COP0_PageMask];
1069                  mips3.tlb[index].entry_hi = mips3.cpr[0][COP0_EntryHi] & ~(mips3.tlb[index].page_mask & U64(0x0000000001ffe000));
1070                  mips3.tlb[index].entry_lo[0] = mips3.cpr[0][COP0_EntryLo0];
1071                  mips3.tlb[index].entry_lo[1] = mips3.cpr[0][COP0_EntryLo1];
1072                  map_tlb_entries();
1073               }
581               mips3com_tlbwi(&mips3.core);
1074582               break;
1075583
1076584            case 0x06:   /* TLBWR */
1077               wired = mips3.cpr[0][COP0_Wired] & 0x3f;
1078               index = 48 - wired;
1079               if (index > 0)
1080                  index = ((activecpu_gettotalcycles64() - mips3.count_zero_time) % index + wired) & 0x3f;
1081               else
1082                  index = 47;
1083               logtlbentry(index);
1084               {
1085                  unmap_tlb_entries();
1086                  mips3.tlb[index].page_mask = mips3.cpr[0][COP0_PageMask];
1087                  mips3.tlb[index].entry_hi = mips3.cpr[0][COP0_EntryHi] & ~(mips3.tlb[index].page_mask & U64(0x0000000001ffe000));
1088                  mips3.tlb[index].entry_lo[0] = mips3.cpr[0][COP0_EntryLo0];
1089                  mips3.tlb[index].entry_lo[1] = mips3.cpr[0][COP0_EntryLo1];
1090                  map_tlb_entries();
1091               }
585               mips3com_tlbwr(&mips3.core);
1092586               break;
1093587
1094588            case 0x08:   /* TLBP */
1095//                  DEBUGGER_BREAK;
1096               for (index = 0; index < 48; index++)
1097               {
1098                  UINT64 mask = ~(mips3.tlb[index].page_mask & U64(0x0000000001ffe000)) & ~U64(0x1fff);
1099#if PRINTF_TLB
1100mame_printf_debug("Mask = %08X%08X  TLB = %08X%08X  MATCH = %08X%08X\n",
1101   (UINT32)(mask >> 32), (UINT32)mask,
1102   (UINT32)(mips3.tlb[index].entry_hi >> 32), (UINT32)mips3.tlb[index].entry_hi,
1103   (UINT32)(mips3.cpr[0][COP0_EntryHi] >> 32), (UINT32)mips3.cpr[0][COP0_EntryHi]);
1104#endif
1105                  if ((mips3.tlb[index].entry_hi & mask) == (mips3.cpr[0][COP0_EntryHi] & mask))
1106                  {
1107                     if (((mips3.tlb[index].entry_lo[0] & 1) && (mips3.tlb[index].entry_lo[1] & 1)) ||
1108                        (mips3.tlb[index].entry_hi & 0xff) == (mips3.cpr[0][COP0_EntryHi] & 0xff))
1109                        break;
1110                  }
1111               }
1112               vpn = ((mips3.cpr[0][COP0_EntryHi] >> 13) & 0x07ffffff) << 1;
1113               if (index != 48)
1114               {
1115                  if (mips3.tlb_table[vpn & 0xfffff] == 0xffffffff)
1116                  {
1117#if PRINTF_TLB
1118                     mame_printf_debug("TLBP: Should have not found an entry\n");
1119//                          DEBUGGER_BREAK;
1120#endif
1121                  }
1122                  mips3.cpr[0][COP0_Index] = index;
1123               }
1124               else
1125               {
1126                  if (mips3.tlb_table[vpn & 0xfffff] != 0xffffffff)
1127                  {
1128#if PRINTF_TLB
1129                     mame_printf_debug("TLBP: Should have found an entry\n");
1130//                          DEBUGGER_BREAK;
1131#endif
1132                  }
1133                  mips3.cpr[0][COP0_Index] = 0x80000000;
1134               }
589               mips3com_tlbp(&mips3.core);
1135590               break;
1136591
1137592            case 0x10:   /* RFE */   invalid_instruction(op);                     break;
1138            case 0x18:   /* ERET */   logerror("ERET\n"); mips3.pc = mips3.cpr[0][COP0_EPC]; SR &= ~SR_EXL; check_irqs(); mips3.lld_value ^= 0xffffffff; mips3.ll_value ^= 0xffffffff;   break;
593            case 0x18:   /* ERET */   logerror("ERET\n"); mips3.core.pc = mips3.core.cpr[0][COP0_EPC]; SR &= ~SR_EXL; check_irqs(); mips3.lld_value ^= 0xffffffff; mips3.ll_value ^= 0xffffffff;   break;
1139594            default:   invalid_instruction(op);                              break;
1140595         }
1141596         break;
r869r870
1152607INLINE UINT32 get_cop1_reg32(int idx)
1153608{
1154609   if (IS_FR0)
1155      return ((UINT32 *)&mips3.cpr[1][0])[idx];
610      return ((UINT32 *)&mips3.core.cpr[1][0])[idx];
1156611   else
1157      return mips3.cpr[1][idx];
612      return mips3.core.cpr[1][idx];
1158613}
1159614
1160615INLINE UINT64 get_cop1_reg64(int idx)
1161616{
1162617   if (IS_FR0)
1163      return ((UINT64 *)&mips3.cpr[1][0])[idx/2];
618      return ((UINT64 *)&mips3.core.cpr[1][0])[idx/2];
1164619   else
1165      return mips3.cpr[1][idx];
620      return mips3.core.cpr[1][idx];
1166621}
1167622
1168623INLINE void set_cop1_reg32(int idx, UINT32 val)
1169624{
1170625   if (IS_FR0)
1171      ((UINT32 *)&mips3.cpr[1][0])[idx] = val;
626      ((UINT32 *)&mips3.core.cpr[1][0])[idx] = val;
1172627   else
1173      mips3.cpr[1][idx] = val;
628      mips3.core.cpr[1][idx] = val;
1174629}
1175630
1176631INLINE void set_cop1_reg64(int idx, UINT64 val)
1177632{
1178633   if (IS_FR0)
1179      ((UINT64 *)&mips3.cpr[1][0])[idx/2] = val;
634      ((UINT64 *)&mips3.core.cpr[1][0])[idx/2] = val;
1180635   else
1181      mips3.cpr[1][idx] = val;
636      mips3.core.cpr[1][idx] = val;
1182637}
1183638
1184639INLINE UINT64 get_cop1_creg(int idx)
1185640{
1186   return mips3.ccr[1][idx];
641   return mips3.core.ccr[1][idx];
1187642}
1188643
1189644INLINE void set_cop1_creg(int idx, UINT64 val)
1190645{
1191   mips3.ccr[1][idx] = val;
646   mips3.core.ccr[1][idx] = val;
1192647}
1193648
1194649INLINE void handle_cop1_fr0(UINT32 op)
r869r870
1213668         {
1214669            case 0x00:   /* BCzF */   if (!GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL);   break;
1215670            case 0x01:   /* BCzT */   if (GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL);   break;
1216            case 0x02:   /* BCzFL */   if (!GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.pc += 4;   break;
1217            case 0x03:   /* BCzTL */   if (GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.pc += 4;   break;
671            case 0x02:   /* BCzFL */   if (!GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.core.pc += 4;   break;
672            case 0x03:   /* BCzTL */   if (GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.core.pc += 4;   break;
1218673         }
1219674         break;
1220675      default:
r869r870
15691024         {
15701025            case 0x00:   /* BCzF */   if (!GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL);   break;
15711026            case 0x01:   /* BCzT */   if (GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL);   break;
1572            case 0x02:   /* BCzFL */   if (!GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.pc += 4;   break;
1573            case 0x03:   /* BCzTL */   if (GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.pc += 4;   break;
1027            case 0x02:   /* BCzFL */   if (!GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.core.pc += 4;   break;
1028            case 0x03:   /* BCzTL */   if (GET_FCC((op >> 18) & 7)) ADDPC(SIMMVAL); else mips3.core.pc += 4;   break;
15741029         }
15751030         break;
15761031      default:
r869r870
20671522
20681523INLINE UINT64 get_cop2_reg(int idx)
20691524{
2070   return mips3.cpr[2][idx];
1525   return mips3.core.cpr[2][idx];
20711526}
20721527
20731528INLINE void set_cop2_reg(int idx, UINT64 val)
20741529{
2075   mips3.cpr[2][idx] = val;
1530   mips3.core.cpr[2][idx] = val;
20761531}
20771532
20781533INLINE UINT64 get_cop2_creg(int idx)
20791534{
2080   return mips3.ccr[2][idx];
1535   return mips3.core.ccr[2][idx];
20811536}
20821537
20831538INLINE void set_cop2_creg(int idx, UINT64 val)
20841539{
2085   mips3.ccr[2][idx] = val;
1540   mips3.core.ccr[2][idx] = val;
20861541}
20871542
20881543INLINE void handle_cop2(UINT32 op)
r869r870
21011556      case 0x08:   /* BC */
21021557         switch (RTREG)
21031558         {
2104            case 0x00:   /* BCzF */   if (!mips3.cf[2]) ADDPC(SIMMVAL);               break;
2105            case 0x01:   /* BCzF */   if (mips3.cf[2]) ADDPC(SIMMVAL);               break;
1559            case 0x00:   /* BCzF */   if (!mips3.core.cf[2]) ADDPC(SIMMVAL);            break;
1560            case 0x01:   /* BCzF */   if (mips3.core.cf[2]) ADDPC(SIMMVAL);            break;
21061561            case 0x02:   /* BCzFL */   invalid_instruction(op);                     break;
21071562            case 0x03:   /* BCzTL */   invalid_instruction(op);                     break;
21081563            default:   invalid_instruction(op);                              break;
r869r870
21421597   mips3.interrupt_cycles = 0;
21431598
21441599   /* update timers & such */
2145   update_cycle_counting();
1600   mips3com_update_cycle_counting(&mips3.core);
21461601
21471602   /* check for IRQs */
21481603   check_irqs();
r869r870
21551610      UINT32 temp;
21561611
21571612      /* see if we crossed a page boundary */
2158      if ((mips3.pc ^ mips3.ppc) & 0xfffff000)
1613      if ((mips3.core.pc ^ mips3.ppc) & 0xfffff000)
21591614         if (!update_pcbase())
21601615            continue;
21611616
21621617      /* debugging */
2163      mips3.ppc = mips3.pc;
1618      mips3.ppc = mips3.core.pc;
21641619      CALL_MAME_DEBUG;
21651620
21661621      /* instruction fetch */
2167      op = ROPCODE(mips3.pcbase | (mips3.pc & 0xfff));
1622      op = ROPCODE(mips3.pcbase | (mips3.core.pc & 0xfff));
21681623
21691624      /* adjust for next PC */
21701625      if (mips3.nextpc != ~0)
21711626      {
2172         mips3.pc = mips3.nextpc;
1627         mips3.core.pc = mips3.nextpc;
21731628         mips3.nextpc = ~0;
21741629      }
21751630      else
2176         mips3.pc += 4;
1631         mips3.core.pc += 4;
21771632
21781633      /* parse the instruction */
21791634      switch (op >> 26)
r869r870
23051760            {
23061761               case 0x00:   /* BLTZ */      if ((INT64)RSVAL64 < 0) ADDPC(SIMMVAL);                     break;
23071762               case 0x01:   /* BGEZ */      if ((INT64)RSVAL64 >= 0) ADDPC(SIMMVAL);                  break;
2308               case 0x02:   /* BLTZL */      if ((INT64)RSVAL64 < 0) ADDPC(SIMMVAL);   else mips3.pc += 4;      break;
2309               case 0x03:   /* BGEZL */      if ((INT64)RSVAL64 >= 0) ADDPC(SIMMVAL); else mips3.pc += 4;    break;
1763               case 0x02:   /* BLTZL */      if ((INT64)RSVAL64 < 0) ADDPC(SIMMVAL);   else mips3.core.pc += 4;      break;
1764               case 0x03:   /* BGEZL */      if ((INT64)RSVAL64 >= 0) ADDPC(SIMMVAL); else mips3.core.pc += 4;    break;
23101765               case 0x08:   /* TGEI */      if ((INT64)RSVAL64 >= SIMMVAL) generate_exception(EXCEPTION_TRAP, 1);   break;
23111766               case 0x09:   /* TGEIU */      if (RSVAL64 >= SIMMVAL) generate_exception(EXCEPTION_TRAP, 1);   break;
23121767               case 0x0a:   /* TLTI */      if ((INT64)RSVAL64 < SIMMVAL) generate_exception(EXCEPTION_TRAP, 1);   break;
r869r870
23151770               case 0x0e:   /* TNEI */      if (RSVAL64 != SIMMVAL) generate_exception(EXCEPTION_TRAP, 1);   break;
23161771               case 0x10:   /* BLTZAL */   if ((INT64)RSVAL64 < 0) ADDPCL(SIMMVAL,31);                  break;
23171772               case 0x11:   /* BGEZAL */   if ((INT64)RSVAL64 >= 0) ADDPCL(SIMMVAL,31);               break;
2318               case 0x12:   /* BLTZALL */   if ((INT64)RSVAL64 < 0) ADDPCL(SIMMVAL,31) else mips3.pc += 4;   break;
2319               case 0x13:   /* BGEZALL */   if ((INT64)RSVAL64 >= 0) ADDPCL(SIMMVAL,31) else mips3.pc += 4;   break;
1773               case 0x12:   /* BLTZALL */   if ((INT64)RSVAL64 < 0) ADDPCL(SIMMVAL,31) else mips3.core.pc += 4;   break;
1774               case 0x13:   /* BGEZALL */   if ((INT64)RSVAL64 >= 0) ADDPCL(SIMMVAL,31) else mips3.core.pc += 4;   break;
23201775               default:   /* ??? */      invalid_instruction(op);                              break;
23211776            }
23221777            break;
r869r870
23421797         case 0x11:   /* COP1 */      if (IS_FR0) handle_cop1_fr0(op); else handle_cop1_fr1(op);            break;
23431798         case 0x12:   /* COP2 */      handle_cop2(op);                                          break;
23441799         case 0x13:   /* COP1X - R5000 */if (IS_FR0) handle_cop1x_fr0(op); else handle_cop1x_fr1(op);         break;
2345         case 0x14:   /* BEQL */      if (RSVAL64 == RTVAL64) ADDPC(SIMMVAL); else mips3.pc += 4;            break;
2346         case 0x15:   /* BNEL */      if (RSVAL64 != RTVAL64) ADDPC(SIMMVAL);   else mips3.pc += 4;            break;
2347         case 0x16:   /* BLEZL */      if ((INT64)RSVAL64 <= 0) ADDPC(SIMMVAL); else mips3.pc += 4;         break;
2348         case 0x17:   /* BGTZL */      if ((INT64)RSVAL64 > 0) ADDPC(SIMMVAL); else mips3.pc += 4;            break;
1800         case 0x14:   /* BEQL */      if (RSVAL64 == RTVAL64) ADDPC(SIMMVAL); else mips3.core.pc += 4;            break;
1801         case 0x15:   /* BNEL */      if (RSVAL64 != RTVAL64) ADDPC(SIMMVAL);   else mips3.core.pc += 4;            break;
1802         case 0x16:   /* BLEZL */      if ((INT64)RSVAL64 <= 0) ADDPC(SIMMVAL); else mips3.core.pc += 4;         break;
1803         case 0x17:   /* BGTZL */      if ((INT64)RSVAL64 > 0) ADDPC(SIMMVAL); else mips3.core.pc += 4;            break;
23491804         case 0x18:   /* DADDI */
23501805            if (ENABLE_OVERFLOWS && RSVAL64 > ~SIMMVAL) generate_exception(EXCEPTION_OVERFLOW, 1);
23511806            else if (RTREG) RTVAL64 = RSVAL64 + (INT64)SIMMVAL;
r869r870
24331888
24341889
24351890/***************************************************************************
2436    DISASSEMBLY HOOK
2437***************************************************************************/
2438
2439#ifdef MAME_DEBUG
2440static offs_t mips3_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
2441{
2442   extern unsigned dasmmips3(char *, unsigned, UINT32);
2443   UINT32 op = *(UINT32 *)oprom;
2444   if (mips3.bigendian)
2445      op = BIG_ENDIANIZE_INT32(op);
2446   else
2447      op = LITTLE_ENDIANIZE_INT32(op);
2448   return dasmmips3(buffer, pc, op);
2449}
2450#endif /* MAME_DEBUG */
2451
2452
2453
2454/***************************************************************************
2455    DOUBLEWORD READS/WRITES
2456***************************************************************************/
2457
2458static UINT64 read_qword_32be(offs_t offset)
2459{
2460   UINT64 result = (UINT64)program_read_dword_32be(offset) << 32;
2461   return result | program_read_dword_32be(offset + 4);
2462}
2463
2464static UINT64 read_qword_32le(offs_t offset)
2465{
2466   UINT64 result = program_read_dword_32le(offset);
2467   return result | ((UINT64)program_read_dword_32le(offset + 4) << 32);
2468}
2469
2470static void write_qword_32be(offs_t offset, UINT64 data)
2471{
2472   program_write_dword_32be(offset, data >> 32);
2473   program_write_dword_32be(offset + 4, data);
2474}
2475
2476static void write_qword_32le(offs_t offset, UINT64 data)
2477{
2478   program_write_dword_32le(offset, data);
2479   program_write_dword_32le(offset + 4, data >> 32);
2480}
2481
2482
2483
2484/***************************************************************************
24851891    COMPLEX OPCODE IMPLEMENTATIONS
24861892***************************************************************************/
24871893
r869r870
27222128
27232129
27242130
2725/**************************************************************************
2726 * Generic set_info
2727 **************************************************************************/
2131/***************************************************************************
2132    GENERIC GET/SET INFO
2133***************************************************************************/
27282134
27292135static void mips3_set_info(UINT32 state, cpuinfo *info)
27302136{
2731   switch (state)
2732   {
2733      /* --- the following bits of info are set as 64-bit signed integers --- */
2734      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      set_irq_line(MIPS3_IRQ0, info->i);      break;
2735      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      set_irq_line(MIPS3_IRQ1, info->i);      break;
2736      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ2:      set_irq_line(MIPS3_IRQ2, info->i);      break;
2737      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ3:      set_irq_line(MIPS3_IRQ3, info->i);      break;
2738      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ4:      set_irq_line(MIPS3_IRQ4, info->i);      break;
2739      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ5:      set_irq_line(MIPS3_IRQ5, info->i);      break;
2740
2741      case CPUINFO_INT_PC:
2742      case CPUINFO_INT_REGISTER + MIPS3_PC:         mips3.pc = info->i;                  break;
2743      case CPUINFO_INT_REGISTER + MIPS3_SR:         mips3.cpr[0][COP0_Status] = info->i;    break;
2744      case CPUINFO_INT_REGISTER + MIPS3_EPC:         mips3.cpr[0][COP0_EPC] = info->i;       break;
2745      case CPUINFO_INT_REGISTER + MIPS3_CAUSE:      mips3.cpr[0][COP0_Cause] = info->i;      break;
2746      case CPUINFO_INT_REGISTER + MIPS3_COUNT:      mips3.cpr[0][COP0_Count] = info->i;    break;
2747      case CPUINFO_INT_REGISTER + MIPS3_COMPARE:      mips3.cpr[0][COP0_Compare] = info->i;    break;
2748      case CPUINFO_INT_REGISTER + MIPS3_INDEX:      mips3.cpr[0][COP0_Index] = info->i;    break;
2749      case CPUINFO_INT_REGISTER + MIPS3_RANDOM:      mips3.cpr[0][COP0_Random] = info->i;    break;
2750      case CPUINFO_INT_REGISTER + MIPS3_ENTRYHI:      mips3.cpr[0][COP0_EntryHi] = info->i;    break;
2751      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO0:      mips3.cpr[0][COP0_EntryLo0] = info->i;    break;
2752      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO1:      mips3.cpr[0][COP0_EntryLo1] = info->i;    break;
2753      case CPUINFO_INT_REGISTER + MIPS3_PAGEMASK:      mips3.cpr[0][COP0_PageMask] = info->i;    break;
2754      case CPUINFO_INT_REGISTER + MIPS3_WIRED:      mips3.cpr[0][COP0_Wired] = info->i;    break;
2755      case CPUINFO_INT_REGISTER + MIPS3_BADVADDR:      mips3.cpr[0][COP0_BadVAddr] = info->i;    break;
2756
2757      case CPUINFO_INT_REGISTER + MIPS3_R0:         mips3.r[0] = info->i;               break;
2758      case CPUINFO_INT_REGISTER + MIPS3_R1:         mips3.r[1] = info->i;               break;
2759      case CPUINFO_INT_REGISTER + MIPS3_R2:         mips3.r[2] = info->i;               break;
2760      case CPUINFO_INT_REGISTER + MIPS3_R3:         mips3.r[3] = info->i;               break;
2761      case CPUINFO_INT_REGISTER + MIPS3_R4:         mips3.r[4] = info->i;               break;
2762      case CPUINFO_INT_REGISTER + MIPS3_R5:         mips3.r[5] = info->i;               break;
2763      case CPUINFO_INT_REGISTER + MIPS3_R6:         mips3.r[6] = info->i;               break;
2764      case CPUINFO_INT_REGISTER + MIPS3_R7:         mips3.r[7] = info->i;               break;
2765      case CPUINFO_INT_REGISTER + MIPS3_R8:         mips3.r[8] = info->i;               break;
2766      case CPUINFO_INT_REGISTER + MIPS3_R9:         mips3.r[9] = info->i;               break;
2767      case CPUINFO_INT_REGISTER + MIPS3_R10:         mips3.r[10] = info->i;               break;
2768      case CPUINFO_INT_REGISTER + MIPS3_R11:         mips3.r[11] = info->i;               break;
2769      case CPUINFO_INT_REGISTER + MIPS3_R12:         mips3.r[12] = info->i;               break;
2770      case CPUINFO_INT_REGISTER + MIPS3_R13:         mips3.r[13] = info->i;               break;
2771      case CPUINFO_INT_REGISTER + MIPS3_R14:         mips3.r[14] = info->i;               break;
2772      case CPUINFO_INT_REGISTER + MIPS3_R15:         mips3.r[15] = info->i;               break;
2773      case CPUINFO_INT_REGISTER + MIPS3_R16:         mips3.r[16] = info->i;               break;
2774      case CPUINFO_INT_REGISTER + MIPS3_R17:         mips3.r[17] = info->i;               break;
2775      case CPUINFO_INT_REGISTER + MIPS3_R18:         mips3.r[18] = info->i;               break;
2776      case CPUINFO_INT_REGISTER + MIPS3_R19:         mips3.r[19] = info->i;               break;
2777      case CPUINFO_INT_REGISTER + MIPS3_R20:         mips3.r[20] = info->i;               break;
2778      case CPUINFO_INT_REGISTER + MIPS3_R21:         mips3.r[21] = info->i;               break;
2779      case CPUINFO_INT_REGISTER + MIPS3_R22:         mips3.r[22] = info->i;               break;
2780      case CPUINFO_INT_REGISTER + MIPS3_R23:         mips3.r[23] = info->i;               break;
2781      case CPUINFO_INT_REGISTER + MIPS3_R24:         mips3.r[24] = info->i;               break;
2782      case CPUINFO_INT_REGISTER + MIPS3_R25:         mips3.r[25] = info->i;               break;
2783      case CPUINFO_INT_REGISTER + MIPS3_R26:         mips3.r[26] = info->i;               break;
2784      case CPUINFO_INT_REGISTER + MIPS3_R27:         mips3.r[27] = info->i;               break;
2785      case CPUINFO_INT_REGISTER + MIPS3_R28:         mips3.r[28] = info->i;               break;
2786      case CPUINFO_INT_REGISTER + MIPS3_R29:         mips3.r[29] = info->i;               break;
2787      case CPUINFO_INT_REGISTER + MIPS3_R30:         mips3.r[30] = info->i;               break;
2788      case CPUINFO_INT_SP:
2789      case CPUINFO_INT_REGISTER + MIPS3_R31:         mips3.r[31] = info->i;               break;
2790      case CPUINFO_INT_REGISTER + MIPS3_HI:         mips3.hi = info->i;                  break;
2791      case CPUINFO_INT_REGISTER + MIPS3_LO:         mips3.lo = info->i;                  break;
2792   }
2137   /* everything is handled generically here */
2138   mips3com_set_info(&mips3.core, state, info);
27932139}
27942140
27952141
2796
2797/**************************************************************************
2798 * Generic get_info
2799 **************************************************************************/
2800
28012142void mips3_get_info(UINT32 state, cpuinfo *info)
28022143{
2803   UINT64 temp64;
2804
28052144   switch (state)
28062145   {
28072146      /* --- the following bits of info are returned as 64-bit signed integers --- */
28082147      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(mips3);            break;
2809      case CPUINFO_INT_INPUT_LINES:               info->i = 6;                     break;
2810      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
2811      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
2812      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
2813      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 4;                     break;
2814      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 4;                     break;
2815      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
2816      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
2817
2818      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
2819      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2820      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
2821      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2822      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 12;               break;
2823
2824      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      info->i = (mips3.cpr[0][COP0_Cause] & 0x400) ? ASSERT_LINE : CLEAR_LINE;   break;
2825      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      info->i = (mips3.cpr[0][COP0_Cause] & 0x800) ? ASSERT_LINE : CLEAR_LINE;   break;
2826      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ2:      info->i = (mips3.cpr[0][COP0_Cause] & 0x1000) ? ASSERT_LINE : CLEAR_LINE;   break;
2827      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ3:      info->i = (mips3.cpr[0][COP0_Cause] & 0x2000) ? ASSERT_LINE : CLEAR_LINE;   break;
2828      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ4:      info->i = (mips3.cpr[0][COP0_Cause] & 0x4000) ? ASSERT_LINE : CLEAR_LINE;   break;
2829      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ5:      info->i = (mips3.cpr[0][COP0_Cause] & 0x8000) ? ASSERT_LINE : CLEAR_LINE;   break;
2830
28312148      case CPUINFO_INT_PREVIOUSPC:               info->i = mips3.ppc;               break;
28322149
2833      case CPUINFO_INT_PC:
2834      case CPUINFO_INT_REGISTER + MIPS3_PC:         info->i = mips3.pc;                  break;
2835      case CPUINFO_INT_REGISTER + MIPS3_SR:         info->i = mips3.cpr[0][COP0_Status];   break;
2836      case CPUINFO_INT_REGISTER + MIPS3_EPC:         info->i = mips3.cpr[0][COP0_EPC];      break;
2837      case CPUINFO_INT_REGISTER + MIPS3_CAUSE:      info->i = mips3.cpr[0][COP0_Cause];      break;
2838      case CPUINFO_INT_REGISTER + MIPS3_COUNT:      info->i = ((activecpu_gettotalcycles64() - mips3.count_zero_time) / 2); break;
2839      case CPUINFO_INT_REGISTER + MIPS3_COMPARE:      info->i = mips3.cpr[0][COP0_Compare];   break;
2840      case CPUINFO_INT_REGISTER + MIPS3_INDEX:      info->i = mips3.cpr[0][COP0_Index];      break;
2841      case CPUINFO_INT_REGISTER + MIPS3_RANDOM:      info->i = mips3.cpr[0][COP0_Random];   break;
2842      case CPUINFO_INT_REGISTER + MIPS3_ENTRYHI:      info->i = mips3.cpr[0][COP0_EntryHi];   break;
2843      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO0:      info->i = mips3.cpr[0][COP0_EntryLo0];   break;
2844      case CPUINFO_INT_REGISTER + MIPS3_ENTRYLO1:      info->i = mips3.cpr[0][COP0_EntryLo1];   break;
2845      case CPUINFO_INT_REGISTER + MIPS3_PAGEMASK:      info->i = mips3.cpr[0][COP0_PageMask];   break;
2846      case CPUINFO_INT_REGISTER + MIPS3_WIRED:      info->i = get_cop0_reg(COP0_Wired);      break;
2847      case CPUINFO_INT_REGISTER + MIPS3_BADVADDR:      info->i = mips3.cpr[0][COP0_BadVAddr];   break;
2848
2849      case CPUINFO_INT_REGISTER + MIPS3_R0:         info->i = mips3.r[0];               break;
2850      case CPUINFO_INT_REGISTER + MIPS3_R1:         info->i = mips3.r[1];               break;
2851      case CPUINFO_INT_REGISTER + MIPS3_R2:         info->i = mips3.r[2];               break;
2852      case CPUINFO_INT_REGISTER + MIPS3_R3:         info->i = mips3.r[3];               break;
2853      case CPUINFO_INT_REGISTER + MIPS3_R4:         info->i = mips3.r[4];               break;
2854      case CPUINFO_INT_REGISTER + MIPS3_R5:         info->i = mips3.r[5];               break;
2855      case CPUINFO_INT_REGISTER + MIPS3_R6:         info->i = mips3.r[6];               break;
2856      case CPUINFO_INT_REGISTER + MIPS3_R7:         info->i = mips3.r[7];               break;
2857      case CPUINFO_INT_REGISTER + MIPS3_R8:         info->i = mips3.r[8];               break;
2858      case CPUINFO_INT_REGISTER + MIPS3_R9:         info->i = mips3.r[9];               break;
2859      case CPUINFO_INT_REGISTER + MIPS3_R10:         info->i = mips3.r[10];               break;
2860      case CPUINFO_INT_REGISTER + MIPS3_R11:         info->i = mips3.r[11];               break;
2861      case CPUINFO_INT_REGISTER + MIPS3_R12:         info->i = mips3.r[12];               break;
2862      case CPUINFO_INT_REGISTER + MIPS3_R13:         info->i = mips3.r[13];               break;
2863      case CPUINFO_INT_REGISTER + MIPS3_R14:         info->i = mips3.r[14];               break;
2864      case CPUINFO_INT_REGISTER + MIPS3_R15:         info->i = mips3.r[15];               break;
2865      case CPUINFO_INT_REGISTER + MIPS3_R16:         info->i = mips3.r[16];               break;
2866      case CPUINFO_INT_REGISTER + MIPS3_R17:         info->i = mips3.r[17];               break;
2867      case CPUINFO_INT_REGISTER + MIPS3_R18:         info->i = mips3.r[18];               break;
2868      case CPUINFO_INT_REGISTER + MIPS3_R19:         info->i = mips3.r[19];               break;
2869      case CPUINFO_INT_REGISTER + MIPS3_R20:         info->i = mips3.r[20];               break;
2870      case CPUINFO_INT_REGISTER + MIPS3_R21:         info->i = mips3.r[21];               break;
2871      case CPUINFO_INT_REGISTER + MIPS3_R22:         info->i = mips3.r[22];               break;
2872      case CPUINFO_INT_REGISTER + MIPS3_R23:         info->i = mips3.r[23];               break;
2873      case CPUINFO_INT_REGISTER + MIPS3_R24:         info->i = mips3.r[24];               break;
2874      case CPUINFO_INT_REGISTER + MIPS3_R25:         info->i = mips3.r[25];               break;
2875      case CPUINFO_INT_REGISTER + MIPS3_R26:         info->i = mips3.r[26];               break;
2876      case CPUINFO_INT_REGISTER + MIPS3_R27:         info->i = mips3.r[27];               break;
2877      case CPUINFO_INT_REGISTER + MIPS3_R28:         info->i = mips3.r[28];               break;
2878      case CPUINFO_INT_REGISTER + MIPS3_R29:         info->i = mips3.r[29];               break;
2879      case CPUINFO_INT_REGISTER + MIPS3_R30:         info->i = mips3.r[30];               break;
2880      case CPUINFO_INT_SP:
2881      case CPUINFO_INT_REGISTER + MIPS3_R31:         info->i = mips3.r[31];               break;
2882      case CPUINFO_INT_REGISTER + MIPS3_HI:         info->i = mips3.hi;                  break;
2883      case CPUINFO_INT_REGISTER + MIPS3_LO:         info->i = mips3.lo;                  break;
2884
28852150      /* --- the following bits of info are returned as pointers to data or functions --- */
28862151      case CPUINFO_PTR_SET_INFO:                  info->setinfo = mips3_set_info;         break;
28872152      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = mips3_get_context;   break;
28882153      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = mips3_set_context;   break;
2889      case CPUINFO_PTR_INIT:                     info->init = mips3_init;            break;
2890      case CPUINFO_PTR_RESET:                     /* provided per-CPU */               break;
2891      case CPUINFO_PTR_EXIT:                     info->exit = mips3_exit;            break;
2154      case CPUINFO_PTR_INIT:                     /* provided per-CPU */               break;
2155      case CPUINFO_PTR_RESET:                     info->reset = mips3_reset;            break;
28922156      case CPUINFO_PTR_EXECUTE:                  info->execute = mips3_execute;         break;
2893      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
28942157#ifdef MAME_DEBUG
28952158      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = mips3_dasm;         break;
2896#endif /* MAME_DEBUG */
2897      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &mips3_icount;         break;
2898      case CPUINFO_PTR_TRANSLATE:                  info->translate = translate_address;   break;
2159#endif
2160      case CPUINFO_PTR_TRANSLATE:                  info->translate = mips3_translate;      break;
28992161
29002162      /* --- the following bits of info are returned as NULL-terminated strings --- */
2901      case CPUINFO_STR_NAME:                     strcpy(info->s, "MIPS III");         break;
2902      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "MIPS III");         break;
2903      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");               break;
29042163      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
2905      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright (C) Aaron Giles 2000-2004"); break;
29062164
2907      case CPUINFO_STR_FLAGS:                     strcpy(info->s, " ");               break;
2908
2909      case CPUINFO_STR_REGISTER + MIPS3_PC:         sprintf(info->s, "PC: %08X", mips3.pc); break;
2910      case CPUINFO_STR_REGISTER + MIPS3_SR:         sprintf(info->s, "SR: %08X", (UINT32)mips3.cpr[0][COP0_Status]); break;
2911      case CPUINFO_STR_REGISTER + MIPS3_EPC:         sprintf(info->s, "EPC:%08X", (UINT32)mips3.cpr[0][COP0_EPC]); break;
2912      case CPUINFO_STR_REGISTER + MIPS3_CAUSE:       sprintf(info->s, "Cause:%08X", (UINT32)mips3.cpr[0][COP0_Cause]); break;
2913      case CPUINFO_STR_REGISTER + MIPS3_COUNT:       temp64 = ((activecpu_gettotalcycles64() - mips3.count_zero_time) / 2); sprintf(info->s, "Count:%08X%08X", (UINT32)(temp64 >> 32), (UINT32)temp64); break;
2914      case CPUINFO_STR_REGISTER + MIPS3_COMPARE:      sprintf(info->s, "Compare:%08X", (UINT32)mips3.cpr[0][COP0_Compare]); break;
2915      case CPUINFO_STR_REGISTER + MIPS3_INDEX:      sprintf(info->s, "Index:%08X", (UINT32)mips3.cpr[0][COP0_Index]); break;
2916      case CPUINFO_STR_REGISTER + MIPS3_RANDOM:      sprintf(info->s, "Random:%08X", (UINT32)mips3.cpr[0][COP0_Random]); break;
2917      case CPUINFO_STR_REGISTER + MIPS3_ENTRYHI:      sprintf(info->s, "EntryHi:%08X%08X", (UINT32)(mips3.cpr[0][COP0_EntryHi] >> 32), (UINT32)mips3.cpr[0][COP0_EntryHi]); break;
2918      case CPUINFO_STR_REGISTER + MIPS3_ENTRYLO0:      sprintf(info->s, "EntryLo0:%08X%08X", (UINT32)(mips3.cpr[0][COP0_EntryLo0] >> 32), (UINT32)mips3.cpr[0][COP0_EntryLo0]); break;
2919      case CPUINFO_STR_REGISTER + MIPS3_ENTRYLO1:      sprintf(info->s, "EntryLo1:%08X%08X", (UINT32)(mips3.cpr[0][COP0_EntryLo1] >> 32), (UINT32)mips3.cpr[0][COP0_EntryLo1]); break;
2920      case CPUINFO_STR_REGISTER + MIPS3_PAGEMASK:      sprintf(info->s, "PageMask:%08X%08X", (UINT32)(mips3.cpr[0][COP0_PageMask] >> 32), (UINT32)mips3.cpr[0][COP0_PageMask]); break;
2921      case CPUINFO_STR_REGISTER + MIPS3_WIRED:      sprintf(info->s, "Wired:%08X", (UINT32)mips3.cpr[0][COP0_Wired]); break;
2922      case CPUINFO_STR_REGISTER + MIPS3_BADVADDR:      sprintf(info->s, "BadVAddr:%08X", (UINT32)mips3.cpr[0][COP0_BadVAddr]); break;
2923
2924      case CPUINFO_STR_REGISTER + MIPS3_R0:         sprintf(info->s, "R0: %08X%08X", (UINT32)(mips3.r[0] >> 32), (UINT32)mips3.r[0]); break;
2925      case CPUINFO_STR_REGISTER + MIPS3_R1:         sprintf(info->s, "R1: %08X%08X", (UINT32)(mips3.r[1] >> 32), (UINT32)mips3.r[1]); break;
2926      case CPUINFO_STR_REGISTER + MIPS3_R2:         sprintf(info->s, "R2: %08X%08X", (UINT32)(mips3.r[2] >> 32), (UINT32)mips3.r[2]); break;
2927      case CPUINFO_STR_REGISTER + MIPS3_R3:         sprintf(info->s, "R3: %08X%08X", (UINT32)(mips3.r[3] >> 32), (UINT32)mips3.r[3]); break;
2928      case CPUINFO_STR_REGISTER + MIPS3_R4:         sprintf(info->s, "R4: %08X%08X", (UINT32)(mips3.r[4] >> 32), (UINT32)mips3.r[4]); break;
2929      case CPUINFO_STR_REGISTER + MIPS3_R5:         sprintf(info->s, "R5: %08X%08X", (UINT32)(mips3.r[5] >> 32), (UINT32)mips3.r[5]); break;
2930      case CPUINFO_STR_REGISTER + MIPS3_R6:         sprintf(info->s, "R6: %08X%08X", (UINT32)(mips3.r[6] >> 32), (UINT32)mips3.r[6]); break;
2931      case CPUINFO_STR_REGISTER + MIPS3_R7:         sprintf(info->s, "R7: %08X%08X", (UINT32)(mips3.r[7] >> 32), (UINT32)mips3.r[7]); break;
2932      case CPUINFO_STR_REGISTER + MIPS3_R8:         sprintf(info->s, "R8: %08X%08X", (UINT32)(mips3.r[8] >> 32), (UINT32)mips3.r[8]); break;
2933      case CPUINFO_STR_REGISTER + MIPS3_R9:         sprintf(info->s, "R9: %08X%08X", (UINT32)(mips3.r[9] >> 32), (UINT32)mips3.r[9]); break;
2934      case CPUINFO_STR_REGISTER + MIPS3_R10:         sprintf(info->s, "R10:%08X%08X", (UINT32)(mips3.r[10] >> 32), (UINT32)mips3.r[10]); break;
2935      case CPUINFO_STR_REGISTER + MIPS3_R11:         sprintf(info->s, "R11:%08X%08X", (UINT32)(mips3.r[11] >> 32), (UINT32)mips3.r[11]); break;
2936      case CPUINFO_STR_REGISTER + MIPS3_R12:         sprintf(info->s, "R12:%08X%08X", (UINT32)(mips3.r[12] >> 32), (UINT32)mips3.r[12]); break;
2937      case CPUINFO_STR_REGISTER + MIPS3_R13:         sprintf(info->s, "R13:%08X%08X", (UINT32)(mips3.r[13] >> 32), (UINT32)mips3.r[13]); break;
2938      case CPUINFO_STR_REGISTER + MIPS3_R14:         sprintf(info->s, "R14:%08X%08X", (UINT32)(mips3.r[14] >> 32), (UINT32)mips3.r[14]); break;
2939      case CPUINFO_STR_REGISTER + MIPS3_R15:         sprintf(info->s, "R15:%08X%08X", (UINT32)(mips3.r[15] >> 32), (UINT32)mips3.r[15]); break;
2940      case CPUINFO_STR_REGISTER + MIPS3_R16:         sprintf(info->s, "R16:%08X%08X", (UINT32)(mips3.r[16] >> 32), (UINT32)mips3.r[16]); break;
2941      case CPUINFO_STR_REGISTER + MIPS3_R17:         sprintf(info->s, "R17:%08X%08X", (UINT32)(mips3.r[17] >> 32), (UINT32)mips3.r[17]); break;
2942      case CPUINFO_STR_REGISTER + MIPS3_R18:         sprintf(info->s, "R18:%08X%08X", (UINT32)(mips3.r[18] >> 32), (UINT32)mips3.r[18]); break;
2943      case CPUINFO_STR_REGISTER + MIPS3_R19:         sprintf(info->s, "R19:%08X%08X", (UINT32)(mips3.r[19] >> 32), (UINT32)mips3.r[19]); break;
2944      case CPUINFO_STR_REGISTER + MIPS3_R20:         sprintf(info->s, "R20:%08X%08X", (UINT32)(mips3.r[20] >> 32), (UINT32)mips3.r[20]); break;
2945      case CPUINFO_STR_REGISTER + MIPS3_R21:         sprintf(info->s, "R21:%08X%08X", (UINT32)(mips3.r[21] >> 32), (UINT32)mips3.r[21]); break;
2946      case CPUINFO_STR_REGISTER + MIPS3_R22:         sprintf(info->s, "R22:%08X%08X", (UINT32)(mips3.r[22] >> 32), (UINT32)mips3.r[22]); break;
2947      case CPUINFO_STR_REGISTER + MIPS3_R23:         sprintf(info->s, "R23:%08X%08X", (UINT32)(mips3.r[23] >> 32), (UINT32)mips3.r[23]); break;
2948      case CPUINFO_STR_REGISTER + MIPS3_R24:         sprintf(info->s, "R24:%08X%08X", (UINT32)(mips3.r[24] >> 32), (UINT32)mips3.r[24]); break;
2949      case CPUINFO_STR_REGISTER + MIPS3_R25:         sprintf(info->s, "R25:%08X%08X", (UINT32)(mips3.r[25] >> 32), (UINT32)mips3.r[25]); break;
2950      case CPUINFO_STR_REGISTER + MIPS3_R26:         sprintf(info->s, "R26:%08X%08X", (UINT32)(mips3.r[26] >> 32), (UINT32)mips3.r[26]); break;
2951      case CPUINFO_STR_REGISTER + MIPS3_R27:         sprintf(info->s, "R27:%08X%08X", (UINT32)(mips3.r[27] >> 32), (UINT32)mips3.r[27]); break;
2952      case CPUINFO_STR_REGISTER + MIPS3_R28:         sprintf(info->s, "R28:%08X%08X", (UINT32)(mips3.r[28] >> 32), (UINT32)mips3.r[28]); break;
2953      case CPUINFO_STR_REGISTER + MIPS3_R29:         sprintf(info->s, "R29:%08X%08X", (UINT32)(mips3.r[29] >> 32), (UINT32)mips3.r[29]); break;
2954      case CPUINFO_STR_REGISTER + MIPS3_R30:         sprintf(info->s, "R30:%08X%08X", (UINT32)(mips3.r[30] >> 32), (UINT32)mips3.r[30]); break;
2955      case CPUINFO_STR_REGISTER + MIPS3_R31:         sprintf(info->s, "R31:%08X%08X", (UINT32)(mips3.r[31] >> 32), (UINT32)mips3.r[31]); break;
2956      case CPUINFO_STR_REGISTER + MIPS3_HI:         sprintf(info->s, "HI: %08X%08X", (UINT32)(mips3.hi >> 32), (UINT32)mips3.hi); break;
2957      case CPUINFO_STR_REGISTER + MIPS3_LO:         sprintf(info->s, "LO: %08X%08X", (UINT32)(mips3.lo >> 32), (UINT32)mips3.lo); break;
2165      /* --- everything else is handled generically --- */
2166      default:                              mips3com_get_info(&mips3.core, state, info); break;
29582167   }
29592168}
29602169
29612170
2171
2172/***************************************************************************
2173    R4600 VARIANTS
2174***************************************************************************/
2175
29622176#if (HAS_R4600)
2963/**************************************************************************
2964 * CPU-specific set_info
2965 **************************************************************************/
2177static void r4600be_init(int index, int clock, const void *config, int (*irqcallback)(int))
2178{
2179   mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, index, clock, config, irqcallback);
2180}
29662181
2182static void r4600le_init(int index, int clock, const void *config, int (*irqcallback)(int))
2183{
2184   mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, index, clock, config, irqcallback);
2185}
2186
29672187void r4600be_get_info(UINT32 state, cpuinfo *info)
29682188{
29692189   switch (state)
r869r870
29722192      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
29732193
29742194      /* --- the following bits of info are returned as pointers to data or functions --- */
2975      case CPUINFO_PTR_RESET:                     info->reset = r4600be_reset;         break;
2195      case CPUINFO_PTR_INIT:                     info->init = r4600be_init;            break;
29762196
29772197      /* --- the following bits of info are returned as NULL-terminated strings --- */
29782198      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (big)");         break;
29792199
2200      /* --- everything else is handled generically --- */
29802201      default:                              mips3_get_info(state, info);         break;
29812202   }
29822203}
29832204
2984
29852205void r4600le_get_info(UINT32 state, cpuinfo *info)
29862206{
29872207   switch (state)
r869r870
29902210      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
29912211
29922212      /* --- the following bits of info are returned as pointers to data or functions --- */
2993      case CPUINFO_PTR_RESET:                     info->reset = r4600le_reset;         break;
2213      case CPUINFO_PTR_INIT:                     info->init = r4600le_init;            break;
29942214
29952215      /* --- the following bits of info are returned as NULL-terminated strings --- */
29962216      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (little)");      break;
29972217
2218      /* --- everything else is handled generically --- */
29982219      default:                              mips3_get_info(state, info);         break;
29992220   }
30002221}
30012222#endif
30022223
30032224
2225
2226/***************************************************************************
2227    R4650 VARIANTS
2228***************************************************************************/
2229
30042230#if (HAS_R4650)
3005/**************************************************************************
3006 * CPU-specific set_info
3007 **************************************************************************/
2231static void r4650be_init(int index, int clock, const void *config, int (*irqcallback)(int))
2232{
2233   mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, index, clock, config, irqcallback);
2234}
30082235
2236static void r4650le_init(int index, int clock, const void *config, int (*irqcallback)(int))
2237{
2238   mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, index, clock, config, irqcallback);
2239}
2240
30092241void r4650be_get_info(UINT32 state, cpuinfo *info)
30102242{
30112243   switch (state)
r869r870
30142246      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
30152247
30162248      /* --- the following bits of info are returned as pointers to data or functions --- */
3017      case CPUINFO_PTR_RESET:                     info->reset = r4600be_reset;         break;
2249      case CPUINFO_PTR_INIT:                     info->init = r4650be_init;            break;
30182250
30192251      /* --- the following bits of info are returned as NULL-terminated strings --- */
30202252      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (big)");      break;
30212253
2254      /* --- everything else is handled generically --- */
30222255      default:                              mips3_get_info(state, info);         break;
30232256   }
30242257}
30252258
3026
30272259void r4650le_get_info(UINT32 state, cpuinfo *info)
30282260{
30292261   switch (state)
r869r870
30322264      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
30332265
30342266      /* --- the following bits of info are returned as pointers to data or functions --- */
3035      case CPUINFO_PTR_RESET:                     info->reset = r4600le_reset;         break;
2267      case CPUINFO_PTR_INIT:                     info->init = r4650le_init;            break;
30362268
30372269      /* --- the following bits of info are returned as NULL-terminated strings --- */
30382270      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (little)");   break;
30392271
2272      /* --- everything else is handled generically --- */
30402273      default:                              mips3_get_info(state, info);         break;
30412274   }
30422275}
30432276#endif
30442277
2278
2279
2280/***************************************************************************
2281    R4700 VARIANTS
2282***************************************************************************/
2283
30452284#if (HAS_R4700)
3046/**************************************************************************
3047 * CPU-specific set_info
3048 **************************************************************************/
2285static void r4700be_init(int index, int clock, const void *config, int (*irqcallback)(int))
2286{
2287   mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, index, clock, config, irqcallback);
2288}
30492289
2290static void r4700le_init(int index, int clock, const void *config, int (*irqcallback)(int))
2291{
2292   mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, index, clock, config, irqcallback);
2293}
2294
30502295void r4700be_get_info(UINT32 state, cpuinfo *info)
30512296{
30522297   switch (state)
r869r870
30552300      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
30562301
30572302      /* --- the following bits of info are returned as pointers to data or functions --- */
3058      case CPUINFO_PTR_RESET:                     info->reset = r4700be_reset;         break;
2303      case CPUINFO_PTR_INIT:                     info->init = r4700be_init;            break;
30592304
30602305      /* --- the following bits of info are returned as NULL-terminated strings --- */
30612306      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (big)");         break;
30622307
2308      /* --- everything else is handled generically --- */
30632309      default:                              mips3_get_info(state, info);         break;
30642310   }
30652311}
r869r870
30732319      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
30742320
30752321      /* --- the following bits of info are returned as pointers to data or functions --- */
3076      case CPUINFO_PTR_RESET:                     info->reset = r4700le_reset;         break;
2322      case CPUINFO_PTR_INIT:                     info->init = r4700le_init;            break;
30772323
30782324      /* --- the following bits of info are returned as NULL-terminated strings --- */
30792325      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (little)");      break;
30802326
2327      /* --- everything else is handled generically --- */
30812328      default:                              mips3_get_info(state, info);         break;
30822329   }
30832330}
30842331#endif
30852332
30862333
2334
2335/***************************************************************************
2336    R5000 VARIANTS
2337***************************************************************************/
2338
30872339#if (HAS_R5000)
3088/**************************************************************************
3089 * CPU-specific set_info
3090 **************************************************************************/
2340static void r5000be_init(int index, int clock, const void *config, int (*irqcallback)(int))
2341{
2342   mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, index, clock, config, irqcallback);
2343}
30912344
2345static void r5000le_init(int index, int clock, const void *config, int (*irqcallback)(int))
2346{
2347   mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, index, clock, config, irqcallback);
2348}
2349
30922350void r5000be_get_info(UINT32 state, cpuinfo *info)
30932351{
30942352   switch (state)
r869r870
30972355      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
30982356
30992357      /* --- the following bits of info are returned as pointers to data or functions --- */
3100      case CPUINFO_PTR_RESET:                     info->reset = r5000be_reset;         break;
2358      case CPUINFO_PTR_INIT:                     info->init = r5000be_init;            break;
31012359
31022360      /* --- the following bits of info are returned as NULL-terminated strings --- */
31032361      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (big)");         break;
31042362
2363      /* --- everything else is handled generically --- */
31052364      default:                              mips3_get_info(state, info);         break;
31062365   }
31072366}
31082367
3109
31102368void r5000le_get_info(UINT32 state, cpuinfo *info)
31112369{
31122370   switch (state)
r869r870
31152373      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
31162374
31172375      /* --- the following bits of info are returned as pointers to data or functions --- */
3118      case CPUINFO_PTR_RESET:                     info->reset = r5000le_reset;         break;
2376      case CPUINFO_PTR_INIT:                     info->init = r5000le_init;            break;
31192377
31202378      /* --- the following bits of info are returned as NULL-terminated strings --- */
31212379      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (little)");      break;
31222380
2381      /* --- everything else is handled generically --- */
31232382      default:                              mips3_get_info(state, info);         break;
31242383   }
31252384}
31262385#endif
31272386
31282387
2388
2389/***************************************************************************
2390    QED5271 VARIANTS
2391***************************************************************************/
2392
31292393#if (HAS_QED5271)
3130/**************************************************************************
3131 * CPU-specific set_info
3132 **************************************************************************/
2394static void qed5271be_init(int index, int clock, const void *config, int (*irqcallback)(int))
2395{
2396   mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, index, clock, config, irqcallback);
2397}
31332398
2399static void qed5271le_init(int index, int clock, const void *config, int (*irqcallback)(int))
2400{
2401   mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, index, clock, config, irqcallback);
2402}
2403
31342404void qed5271be_get_info(UINT32 state, cpuinfo *info)
31352405{
31362406   switch (state)
r869r870
31392409      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
31402410
31412411      /* --- the following bits of info are returned as pointers to data or functions --- */
3142      case CPUINFO_PTR_RESET:                     info->reset = qed5271be_reset;         break;
2412      case CPUINFO_PTR_INIT:                     info->init = qed5271be_init;         break;
31432413
31442414      /* --- the following bits of info are returned as NULL-terminated strings --- */
31452415      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (big)");      break;
31462416
2417      /* --- everything else is handled generically --- */
31472418      default:                              mips3_get_info(state, info);         break;
31482419   }
31492420}
31502421
3151
31522422void qed5271le_get_info(UINT32 state, cpuinfo *info)
31532423{
31542424   switch (state)
r869r870
31572427      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
31582428
31592429      /* --- the following bits of info are returned as pointers to data or functions --- */
3160      case CPUINFO_PTR_RESET:                     info->reset = qed5271le_reset;         break;
2430      case CPUINFO_PTR_INIT:                     info->init = qed5271le_init;         break;
31612431
31622432      /* --- the following bits of info are returned as NULL-terminated strings --- */
31632433      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (little)");   break;
31642434
2435      /* --- everything else is handled generically --- */
31652436      default:                              mips3_get_info(state, info);         break;
31662437   }
31672438}
31682439#endif
31692440
31702441
2442
2443/***************************************************************************
2444    RM7000 VARIANTS
2445***************************************************************************/
2446
31712447#if (HAS_RM7000)
3172/**************************************************************************
3173 * CPU-specific set_info
3174 **************************************************************************/
2448static void rm7000be_init(int index, int clock, const void *config, int (*irqcallback)(int))
2449{
2450   mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, index, clock, config, irqcallback);
2451}
31752452
2453static void rm7000le_init(int index, int clock, const void *config, int (*irqcallback)(int))
2454{
2455   mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, index, clock, config, irqcallback);
2456}
2457
31762458void rm7000be_get_info(UINT32 state, cpuinfo *info)
31772459{
31782460   switch (state)
r869r870
31812463      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
31822464
31832465      /* --- the following bits of info are returned as pointers to data or functions --- */
3184      case CPUINFO_PTR_RESET:                     info->reset = rm7000be_reset;         break;
2466      case CPUINFO_PTR_INIT:                     info->init = rm7000be_init;            break;
31852467
31862468      /* --- the following bits of info are returned as NULL-terminated strings --- */
31872469      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (big)");      break;
31882470
2471      /* --- everything else is handled generically --- */
31892472      default:                              mips3_get_info(state, info);         break;
31902473   }
31912474}
31922475
3193
31942476void rm7000le_get_info(UINT32 state, cpuinfo *info)
31952477{
31962478   switch (state)
r869r870
31992481      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_LE;               break;
32002482
32012483      /* --- the following bits of info are returned as pointers to data or functions --- */
3202      case CPUINFO_PTR_RESET:                     info->reset = rm7000le_reset;         break;
2484      case CPUINFO_PTR_INIT:                     info->init = rm7000le_init;            break;
32032485
32042486      /* --- the following bits of info are returned as NULL-terminated strings --- */
32052487      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (little)");      break;
32062488
2489      /* --- everything else is handled generically --- */
32072490      default:                              mips3_get_info(state, info);         break;
32082491   }
32092492}
32102493#endif
3211
src/emu/tilemap.c
r869r870
197197   if (!(tmap->attributes & TILEMAP_FLIPX))
198198      value = tmap->dx - tmap->rowscroll[index];
199199   else
200      value = screen_width - tmap->width - tmap->dx_flipped + tmap->rowscroll[index];
200      value = screen_width - tmap->width - (tmap->dx_flipped - tmap->rowscroll[index]);
201201
202202   /* clamp to 0..width */
203203   if (value < 0)
r869r870
226226   if (!(tmap->attributes & TILEMAP_FLIPY))
227227      value = tmap->dy - tmap->colscroll[index];
228228   else
229      value = screen_height - tmap->height - tmap->dy_flipped + tmap->colscroll[index];
229      value = screen_height - tmap->height - (tmap->dy_flipped - tmap->colscroll[index]);
230230
231231   /* clamp to 0..height */
232232   if (value < 0)
src/emu/memory.c
r869r870
11181118
11191119
11201120/*-------------------------------------------------
1121    construct_map_0 - NULL memory map
1121    construct_address_map - build address map
11221122-------------------------------------------------*/
11231123
1124address_map *construct_map_0(address_map *map)
1124void construct_address_map(address_map *map, const machine_config *drv, int cpunum, int spacenum)
11251125{
1126   int cputype = drv->cpu[cpunum].cpu_type;
1127   construct_map_t internal_map = (construct_map_t)cputype_get_info_fct(cputype, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
1128
11261129   map->flags = AM_FLAGS_END;
1127   return map;
1130
1131   /* start by constructing the internal CPU map */
1132   if (internal_map)
1133      map = (*internal_map)(map);
1134
1135   /* construct the standard map */
1136   if (drv->cpu[cpunum].construct_map[spacenum][0])
1137      map = (*drv->cpu[cpunum].construct_map[spacenum][0])(map);
1138   if (drv->cpu[cpunum].construct_map[spacenum][1])
1139      map = (*drv->cpu[cpunum].construct_map[spacenum][1])(map);
11281140}
11291141
11301142
r869r870
11941206   int abits = cputype_addrbus_width(cputype, spacenum);
11951207   int dbits = cputype_databus_width(cputype, spacenum);
11961208   int accessorindex = (dbits == 8) ? 0 : (dbits == 16) ? 1 : (dbits == 32) ? 2 : 3;
1197   construct_map_t internal_map = (construct_map_t)cputype_get_info_fct(cputype, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
11981209   int entrynum;
11991210
12001211   /* determine the address and data bits */
r869r870
12151226   cpudata[cpunum].spacemask |= 1 << spacenum;
12161227
12171228   /* construct the combined memory map */
1218   if (internal_map || Machine->drv->cpu[cpunum].construct_map[spacenum][0] || Machine->drv->cpu[cpunum].construct_map[spacenum][1])
12191229   {
12201230      /* allocate and clear memory for 2 copies of the map */
12211231      address_map *map = auto_malloc(sizeof(space->map[0]) * MAX_ADDRESS_MAP_SIZE * 4);
r869r870
12251235      space->map = map;
12261236      space->adjmap = &map[MAX_ADDRESS_MAP_SIZE * 2];
12271237
1228      /* start by constructing the internal CPU map */
1229      if (internal_map)
1230         map = (*internal_map)(map);
1238      construct_address_map(map, Machine->drv, cpunum, spacenum);
12311239
1232      /* construct the standard map */
1233      if (Machine->drv->cpu[cpunum].construct_map[spacenum][0])
1234         map = (*Machine->drv->cpu[cpunum].construct_map[spacenum][0])(map);
1235      if (Machine->drv->cpu[cpunum].construct_map[spacenum][1])
1236         map = (*Machine->drv->cpu[cpunum].construct_map[spacenum][1])(map);
1237
12381240      /* convert implicit ROM entries to map to the memory region */
12391241      if (spacenum == ADDRESS_SPACE_PROGRAM && memory_region(REGION_CPU1 + cpunum))
12401242         for (map = space->map; !IS_AMENTRY_END(map); map++)
src/emu/memory.h
r869r870
597597    ADDRESS MAP ARRAY CONSTRUCTORS
598598***************************************************************************/
599599
600void construct_address_map(address_map *map, const machine_config *drv, int cpunum, int spacenum);
601
600602/* ----- a typedef for pointers to these functions ----- */
601603typedef address_map *(*construct_map_t)(address_map *map);
602604
r869r870
608610#define ADDRESS_MAP_START(_name,_space,_bits)                     \
609611address_map *construct_map_##_name(address_map *map)               \
610612{                                                      \
613   extern read##_bits##_handler port_tag_to_handler##_bits(const char *); \
611614   typedef read##_bits##_handler _rh_t;                        \
612615   typedef write##_bits##_handler _wh_t;                        \
613616   _rh_t read;                                             \
614617   _wh_t write;                                          \
618   _rh_t (*port_tag_to_handler)(const char *) = port_tag_to_handler##_bits; \
615619   UINT##_bits **base;                                       \
616620                                                      \
617621   (void)read; (void)write; (void)base;                        \
622   (void)port_tag_to_handler; \
618623   map->flags = AM_FLAGS_EXTENDED;                              \
619624   map->start = AMEF_DBITS(_bits) | AMEF_SPACE(_space);            \
620625
r869r870
653658   map->read.handler = (genf *)(read = _handler);                  \
654659   map->read_name = #_handler;                                 \
655660
661#define AM_READ_PORT(_tag) \
662   AM_READ((*port_tag_to_handler)(_tag))
663
656664#define AM_WRITE(_handler)                                    \
657665   map->write.handler = (genf *)(write = _handler);               \
658666   map->write_name = #_handler;                              \
r869r870
963971extern offs_t         opcode_memory_min;         /* opcode memory minimum */
964972extern offs_t         opcode_memory_max;         /* opcode memory maximum */
965973extern address_space   active_address_space[];      /* address spaces */
966extern address_map *   construct_map_0(address_map *map);
974#define construct_map_0 NULL
967975
968976
969977
src/emu/inptport.c
r869r870
25652565}
25662566
25672567
2568read64_handler port_tag_to_handler64(const char *tag)
2569{
2570   return MRA64_NOP;
2571}
2572
2573
25682574const char *input_port_name(const input_port_entry *port)
25692575{
25702576   int defindex;
src/emu/inptport.h
r869r870
821821   PORT_BIT(    mask, mask & default, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode ))
822822
823823#define PORT_DIPUNUSED_DIPLOC(mask,default,loc)   \
824   PORT_BIT(    mask, mask & default, IPT_DIPSWITCH_NAME ) PORT_NAME( DEF_STR( Unused )) PORT_TOGGLE PORT_DIPLOCATION(loc)   \
824   PORT_BIT(    mask, mask & default, IPT_DIPSWITCH_NAME ) PORT_NAME( DEF_STR( Unused )) PORT_DIPLOCATION(loc)   \
825825   PORT_DIPSETTING(    mask & default, DEF_STR( Off ) )   \
826826   PORT_DIPSETTING(    mask &~default, DEF_STR( On ) )
827827
828828#define PORT_DIPUNUSED(mask,default)   \
829   PORT_BIT(    mask, mask & default, IPT_DIPSWITCH_NAME ) PORT_NAME( DEF_STR( Unused )) PORT_TOGGLE   \
829   PORT_BIT(    mask, mask & default, IPT_DIPSWITCH_NAME ) PORT_NAME( DEF_STR( Unused )) \
830830   PORT_DIPSETTING(    mask & default, DEF_STR( Off ) )   \
831831   PORT_DIPSETTING(    mask &~default, DEF_STR( On ) )
832832
833#define PORT_DIPUNKNOWN_DIPLOC(mask,default,loc)   \
834   PORT_BIT(    mask, mask & default, IPT_DIPSWITCH_NAME ) PORT_NAME( DEF_STR( Unknown )) PORT_DIPLOCATION(loc)   \
835   PORT_DIPSETTING(    mask & default, DEF_STR( Off ) )   \
836   PORT_DIPSETTING(    mask &~default, DEF_STR( On ) )
833837
838#define PORT_DIPUNKNOWN(mask,default)   \
839   PORT_BIT(    mask, mask & default, IPT_DIPSWITCH_NAME ) PORT_NAME( DEF_STR( Unknown )) \
840   PORT_DIPSETTING(    mask & default, DEF_STR( Off ) )   \
841   PORT_DIPSETTING(    mask &~default, DEF_STR( On ) )
834842
843
844
835845/***************************************************************************
836846    GLOBAL VARIABLES
837847***************************************************************************/
r869r870
863873read8_handler port_tag_to_handler8(const char *tag);
864874read16_handler port_tag_to_handler16(const char *tag);
865875read32_handler port_tag_to_handler32(const char *tag);
876read64_handler port_tag_to_handler64(const char *tag);
866877const char *input_port_name(const input_port_entry *in);
867878input_seq *input_port_seq(input_port_entry *in, int seqtype);
868879input_seq *input_port_default_seq(int type, int player, int seqtype);
src/emu/cpuintrf.c
r869r870
3737void deco16_get_info(UINT32 state, cpuinfo *info);
3838void m4510_get_info(UINT32 state, cpuinfo *info);
3939void h6280_get_info(UINT32 state, cpuinfo *info);
40void i86_get_info(UINT32 state, cpuinfo *info);
41void i88_get_info(UINT32 state, cpuinfo *info);
42void i186_get_info(UINT32 state, cpuinfo *info);
43void i188_get_info(UINT32 state, cpuinfo *info);
44void i286_get_info(UINT32 state, cpuinfo *info);
40void i8086_get_info(UINT32 state, cpuinfo *info);
41void i8088_get_info(UINT32 state, cpuinfo *info);
42void i80186_get_info(UINT32 state, cpuinfo *info);
43void i80188_get_info(UINT32 state, cpuinfo *info);
44void i80286_get_info(UINT32 state, cpuinfo *info);
4545void v20_get_info(UINT32 state, cpuinfo *info);
46void v25_get_info(UINT32 state, cpuinfo *info);
4647void v30_get_info(UINT32 state, cpuinfo *info);
4748void v33_get_info(UINT32 state, cpuinfo *info);
49void v35_get_info(UINT32 state, cpuinfo *info);
4850void v60_get_info(UINT32 state, cpuinfo *info);
4951void v70_get_info(UINT32 state, cpuinfo *info);
5052void i8035_get_info(UINT32 state, cpuinfo *info);
r869r870
319321#if (HAS_H6280)
320322   { CPU_H6280, h6280_get_info },
321323#endif
322#if (HAS_I86)
323   { CPU_I86, i86_get_info },
324#if (HAS_I8086)
325   { CPU_I8086, i8086_get_info },
324326#endif
325#if (HAS_I88)
326   { CPU_I88, i88_get_info },
327#if (HAS_I8088)
328   { CPU_I8088, i8088_get_info },
327329#endif
328#if (HAS_I186)
329   { CPU_I186, i186_get_info },
330#if (HAS_I80186)
331   { CPU_I80186, i80186_get_info },
330332#endif
331#if (HAS_I188)
332   { CPU_I188, i188_get_info },
333#if (HAS_I80188)
334   { CPU_I80188, i80188_get_info },
333335#endif
334#if (HAS_I286)
335   { CPU_I286, i286_get_info },
336#if (HAS_I80286)
337   { CPU_I80286, i80286_get_info },
336338#endif
337339#if (HAS_V20)
338340   { CPU_V20, v20_get_info },
339341#endif
342#if (HAS_V25)
343   { CPU_V25, v25_get_info },
344#endif
340345#if (HAS_V30)
341346   { CPU_V30, v30_get_info },
342347#endif
343348#if (HAS_V33)
344349   { CPU_V33, v33_get_info },
345350#endif
351#if (HAS_V35)
352   { CPU_V35, v35_get_info },
353#endif
346354#if (HAS_V60)
347355   { CPU_V60, v60_get_info },
348356#endif
src/emu/cpuintrf.h
r869r870
4747   CPU_DECO16,
4848   CPU_M4510,
4949   CPU_H6280,
50   CPU_I86,
51   CPU_I88,
52   CPU_I186,
53   CPU_I188,
54   CPU_I286,
50   CPU_I8086,
51   CPU_I8088,
52   CPU_I80186,
53   CPU_I80188,
54   CPU_I80286,
5555   CPU_V20,
56   CPU_V25,
5657   CPU_V30,
5758   CPU_V33,
59   CPU_V35,
5860   CPU_V60,
5961   CPU_V70,
6062   CPU_I8035,
src/emu/sound/iremga20.c
r869r870
5252   UINT8 *rom;
5353   INT32 rom_size;
5454   sound_stream * stream;
55   INT32 regs[0x40];
55   UINT16 regs[0x40];
5656   struct IremGA20_channel_def channel[4];
5757};
5858
r869r870
132132   }
133133}
134134
135WRITE8_HANDLER( IremGA20_w )
135WRITE16_HANDLER( IremGA20_w )
136136{
137137   struct IremGA20_chip_def *chip = sndti_token(SOUND_IREMGA20, 0);
138138   int channel;
139139
140   /* only low byte hooked up? */
141   if (!ACCESSING_LSB)
142      return;
143
140144   //logerror("GA20:  Offset %02x, data %04x\n",offset,data);
141145
142146   stream_update(chip->stream);
143147
144   channel = offset >> 4;
148   channel = offset >> 3;
145149
146150   chip->regs[offset] = data;
147151
148   switch (offset & 0xf)
152   switch (offset & 0x7)
149153   {
150   case 0: /* start address low */
151      chip->channel[channel].start = ((chip->channel[channel].start)&0xff000) | (data<<4);
152   break;
154      case 0: /* start address low */
155         chip->channel[channel].start = ((chip->channel[channel].start)&0xff000) | (data<<4);
156         break;
153157
154   case 2: /* start address high */
155      chip->channel[channel].start = ((chip->channel[channel].start)&0x00ff0) | (data<<12);
156   break;
158      case 1: /* start address high */
159         chip->channel[channel].start = ((chip->channel[channel].start)&0x00ff0) | (data<<12);
160         break;
157161
158   case 4: /* end address low */
159      chip->channel[channel].end = ((chip->channel[channel].end)&0xff000) | (data<<4);
160   break;
162      case 2: /* end address low */
163         chip->channel[channel].end = ((chip->channel[channel].end)&0xff000) | (data<<4);
164         break;
161165
162   case 6: /* end address high */
163      chip->channel[channel].end = ((chip->channel[channel].end)&0x00ff0) | (data<<12);
164   break;
166      case 3: /* end address high */
167         chip->channel[channel].end = ((chip->channel[channel].end)&0x00ff0) | (data<<12);
168         break;
165169
166   case 8:
167      chip->channel[channel].rate = 0x1000000 / (256 - data);
168   break;
170      case 4:
171         chip->channel[channel].rate = 0x1000000 / (256 - data);
172         break;
169173
170   case 0xa: //AT: gain control
171      chip->channel[channel].volume = (data * MAX_VOL) / (data + 10);
172   break;
174      case 5: //AT: gain control
175         chip->channel[channel].volume = (data * MAX_VOL) / (data + 10);
176         break;
173177
174   case 0xc: //AT: this is always written 2(enabling both channels?)
175      chip->channel[channel].play = data;
176      chip->channel[channel].pos = chip->channel[channel].start;
177      chip->channel[channel].frac = 0;
178   break;
178      case 6: //AT: this is always written 2(enabling both channels?)
179         chip->channel[channel].play = data;
180         chip->channel[channel].pos = chip->channel[channel].start;
181         chip->channel[channel].frac = 0;
182         break;
179183   }
180184}
181185
182READ8_HANDLER( IremGA20_r )
186READ16_HANDLER( IremGA20_r )
183187{
184188   struct IremGA20_chip_def *chip = sndti_token(SOUND_IREMGA20, 0);
185189   int channel;
186190
187191   stream_update(chip->stream);
188192
189   channel = offset >> 4;
193   channel = offset >> 3;
190194
191   switch (offset & 0xf)
195   switch (offset & 0x7)
192196   {
193      case 0xe:   // voice status.  bit 0 is 1 if active. (routine around 0xccc in rtypeleo)
197      case 7:   // voice status.  bit 0 is 1 if active. (routine around 0xccc in rtypeleo)
194198         return chip->channel[channel].play ? 1 : 0;
195199         break;
196200
src/emu/sound/iremga20.h
r869r870
1010   int region;               /* memory region of sample ROM(s) */
1111};
1212
13WRITE8_HANDLER( IremGA20_w );
14READ8_HANDLER( IremGA20_r );
13WRITE16_HANDLER( IremGA20_w );
14READ16_HANDLER( IremGA20_r );
1515
1616#endif /* __IREMGA20_H__ */
src/emu/sound/x1_010.c
r869r870
66
77                    rewrite by Manbow-J(manbowj@hamal.freemail.ne.jp)
88
9X1-010 (Seta Custom Sound Chip):
9                    X1-010 Seta Custom Sound Chip (80 Pin PQFP)
1010
11 Custom programmed Mitsubishi M60016 Gate Array, 3608 gates, 148 Max I/O ports
12
1113    The X1-010 is 16 Voices sound generator, each channel gets it's
1214    waveform from RAM (128 bytes per waveform, 8 bit unsigned data)
1315    or sampling PCM(8bit unsigned data).
src/emu/sound/bsmt2000.c
r869r870
66
77    Copyright (c) Aaron Giles
88
9    Chip is actually a TMS320C15 DSP with embedded mask rom
10    Trivia: BSMT stands for "Brian Schmidt's Mouse Trap"
11
912***************************************************************************/
1013
1114#include <math.h>
src/emu/sound/2203intf.c
r869r870
217217   YM2203Write(info->chip,1,data);
218218}
219219
220
221READ16_HANDLER( YM2203_status_port_0_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 0); return YM2203Read(info->chip,0) | 0xff00; }
222READ16_HANDLER( YM2203_status_port_1_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 1); return YM2203Read(info->chip,0) | 0xff00; }
223READ16_HANDLER( YM2203_status_port_2_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 2); return YM2203Read(info->chip,0) | 0xff00; }
224READ16_HANDLER( YM2203_status_port_3_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 3); return YM2203Read(info->chip,0) | 0xff00; }
225READ16_HANDLER( YM2203_status_port_4_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 4); return YM2203Read(info->chip,0) | 0xff00; }
226
227READ16_HANDLER( YM2203_read_port_0_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 0); return YM2203Read(info->chip,1) | 0xff00; }
228READ16_HANDLER( YM2203_read_port_1_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 1); return YM2203Read(info->chip,1) | 0xff00; }
229READ16_HANDLER( YM2203_read_port_2_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 2); return YM2203Read(info->chip,1) | 0xff00; }
230READ16_HANDLER( YM2203_read_port_3_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 3); return YM2203Read(info->chip,1) | 0xff00; }
231READ16_HANDLER( YM2203_read_port_4_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 4); return YM2203Read(info->chip,1) | 0xff00; }
232
233WRITE16_HANDLER( YM2203_control_port_0_lsb_w )
234{
235   struct ym2203_info *info = sndti_token(SOUND_YM2203, 0);
236   if (ACCESSING_LSB)
237      YM2203Write(info->chip,0,data);
238}
239WRITE16_HANDLER( YM2203_control_port_1_lsb_w )
240{
241   struct ym2203_info *info = sndti_token(SOUND_YM2203, 1);
242   if (ACCESSING_LSB)
243      YM2203Write(info->chip,0,data);
244}
245WRITE16_HANDLER( YM2203_control_port_2_lsb_w )
246{
247   struct ym2203_info *info = sndti_token(SOUND_YM2203, 2);
248   if (ACCESSING_LSB)
249      YM2203Write(info->chip,0,data);
250}
251WRITE16_HANDLER( YM2203_control_port_3_lsb_w )
252{
253   struct ym2203_info *info = sndti_token(SOUND_YM2203, 3);
254   if (ACCESSING_LSB)
255      YM2203Write(info->chip,0,data);
256}
257WRITE16_HANDLER( YM2203_control_port_4_lsb_w )
258{
259   struct ym2203_info *info = sndti_token(SOUND_YM2203, 4);
260   if (ACCESSING_LSB)
261      YM2203Write(info->chip,0,data);
262}
263
264WRITE16_HANDLER( YM2203_write_port_0_lsb_w )
265{
266   struct ym2203_info *info = sndti_token(SOUND_YM2203, 0);
267   if (ACCESSING_LSB)
268      YM2203Write(info->chip,1,data);
269}
270WRITE16_HANDLER( YM2203_write_port_1_lsb_w )
271{
272   struct ym2203_info *info = sndti_token(SOUND_YM2203, 1);
273   if (ACCESSING_LSB)
274      YM2203Write(info->chip,1,data);
275}
276WRITE16_HANDLER( YM2203_write_port_2_lsb_w )
277{
278   struct ym2203_info *info = sndti_token(SOUND_YM2203, 2);
279   if (ACCESSING_LSB)
280      YM2203Write(info->chip,1,data);
281}
282WRITE16_HANDLER( YM2203_write_port_3_lsb_w )
283{
284   struct ym2203_info *info = sndti_token(SOUND_YM2203, 3);
285   if (ACCESSING_LSB)
286      YM2203Write(info->chip,1,data);
287}
288WRITE16_HANDLER( YM2203_write_port_4_lsb_w )
289{
290   struct ym2203_info *info = sndti_token(SOUND_YM2203, 4);
291   if (ACCESSING_LSB)
292      YM2203Write(info->chip,1,data);
293}
294
295
220296WRITE8_HANDLER( YM2203_word_0_w )
221297{
222298   if (offset)
src/emu/sound/2203intf.h
r869r870
3737WRITE8_HANDLER( YM2203_write_port_3_w );
3838WRITE8_HANDLER( YM2203_write_port_4_w );
3939
40READ16_HANDLER( YM2203_status_port_0_lsb_r );
41READ16_HANDLER( YM2203_status_port_1_lsb_r );
42READ16_HANDLER( YM2203_status_port_2_lsb_r );
43READ16_HANDLER( YM2203_status_port_3_lsb_r );
44READ16_HANDLER( YM2203_status_port_4_lsb_r );
45
46READ16_HANDLER( YM2203_read_port_0_lsb_r );
47READ16_HANDLER( YM2203_read_port_1_lsb_r );
48READ16_HANDLER( YM2203_read_port_2_lsb_r );
49READ16_HANDLER( YM2203_read_port_3_lsb_r );
50READ16_HANDLER( YM2203_read_port_4_lsb_r );
51
52WRITE16_HANDLER( YM2203_control_port_0_lsb_w );
53WRITE16_HANDLER( YM2203_control_port_1_lsb_w );
54WRITE16_HANDLER( YM2203_control_port_2_lsb_w );
55WRITE16_HANDLER( YM2203_control_port_3_lsb_w );
56WRITE16_HANDLER( YM2203_control_port_4_lsb_w );
57
58WRITE16_HANDLER( YM2203_write_port_0_lsb_w );
59WRITE16_HANDLER( YM2203_write_port_1_lsb_w );
60WRITE16_HANDLER( YM2203_write_port_2_lsb_w );
61WRITE16_HANDLER( YM2203_write_port_3_lsb_w );
62WRITE16_HANDLER( YM2203_write_port_4_lsb_w );
63
4064WRITE8_HANDLER( YM2203_word_0_w );
4165WRITE8_HANDLER( YM2203_word_1_w );
4266
src/emu/driver.h
r869r870
109109*/
110110
111111/* The default is to have no VBLANK timing -- this is historical, and a bad idea */
112#define DEFAULT_60HZ_VBLANK_DURATION      TIME_IN_USEC(0)
113#define DEFAULT_30HZ_VBLANK_DURATION      TIME_IN_USEC(0)
112#define DEFAULT_60HZ_VBLANK_DURATION      USEC_TO_SUBSECONDS(0)
113#define DEFAULT_30HZ_VBLANK_DURATION      USEC_TO_SUBSECONDS(0)
114114
115115/* If you use IPT_VBLANK, you need a duration different from 0 */
116#define DEFAULT_REAL_60HZ_VBLANK_DURATION   TIME_IN_USEC(2500)
117#define DEFAULT_REAL_30HZ_VBLANK_DURATION   TIME_IN_USEC(2500)
116#define DEFAULT_REAL_60HZ_VBLANK_DURATION   USEC_TO_SUBSECONDS(2500)
117#define DEFAULT_REAL_30HZ_VBLANK_DURATION   USEC_TO_SUBSECONDS(2500)
118118
119119
120120
r869r870
421421   screen->defstate.refresh = HZ_TO_SUBSECONDS(rate);               \
422422
423423#define MDRV_SCREEN_VBLANK_TIME(time)                           \
424   screen->defstate.vblank = DOUBLE_TO_SUBSECONDS(time);            \
424   screen->defstate.vblank = time;            \
425425   screen->defstate.oldstyle_vblank_supplied = 1;                  \
426426
427427#define MDRV_SCREEN_SIZE(_width, _height)                        \
src/emu/timer.h
r869r870
3737/* convert between a double and subseconds */
3838#define SUBSECONDS_TO_DOUBLE(x)      ((double)(x) * (1.0 / (double)MAX_SUBSECONDS))
3939#define DOUBLE_TO_SUBSECONDS(x)      ((subseconds_t)((x) * (double)MAX_SUBSECONDS))
40#define USEC_TO_SUBSECONDS(us)      ((subseconds_t)((us) * (MAX_SUBSECONDS / 1000000)))
4041
4142/* hertz to subseconds macros */
4243#define SUBSECONDS_TO_HZ(x)         ((double)MAX_SUBSECONDS / (double)(x))
r869r870
4647#define MAME_TIME_TO_CYCLES(cpu,t)   ((t).seconds * cycles_per_second[cpu] + (t).subseconds / subseconds_per_cycle[cpu])
4748#define MAME_TIME_IN_CYCLES(c,cpu)   (make_mame_time((c) / cycles_per_second[cpu], (c) * subseconds_per_cycle[cpu]))
4849
49/* useful macro for describing time using doubles */
50#define TIME_IN_USEC(us)      ((double)(us) * (1.0 / 1000000.0))
51
5250/* useful macros for describing mame_times */
5351#define MAME_TIME_IN_HZ(hz)      make_mame_time(0, MAX_SUBSECONDS / (hz))
5452#define MAME_TIME_IN_SEC(s)      make_mame_time((s)  / 1, (s) % 1 /* mod here errors on doubles, which is intended */)
src/emu/validity.c
r869r870
506506         address_map *map;
507507         UINT32 flags;
508508
509         /* if no map, skip */
510         if (!cpu->construct_map[spacenum][0] && !cpu->construct_map[spacenum][1])
511            continue;
512
513509         /* check to see that the same map is not used twice */
514         if (cpu->construct_map[spacenum][0] && cpu->construct_map[spacenum][0] != construct_map_0 && cpu->construct_map[spacenum][0] == cpu->construct_map[spacenum][1])
510         if (cpu->construct_map[spacenum][0] && cpu->construct_map[spacenum][0] == cpu->construct_map[spacenum][1])
515511         {
516512            mame_printf_error("%s: %s uses identical memory maps for CPU #%d spacenum %d\n", driver->source_file, driver->name, cpunum, spacenum);
517513            error = TRUE;
r869r870
524520
525521         /* construct the maps */
526522         map = addrmap;
527         if (cpu->construct_map[spacenum][0])
528            map = (*cpu->construct_map[spacenum][0])(map);
529         if (cpu->construct_map[spacenum][1])
530            map = (*cpu->construct_map[spacenum][1])(map);
523         construct_address_map(map, drv, cpunum, spacenum);
531524
532525         /* if this is an empty map, just skip it */
533         map = addrmap;
534526         if (IS_AMENTRY_END(map))
535527            continue;
536528
r869r870
541533            error = TRUE;
542534         }
543535
544         /* verify the type of memory handlers */
545         flags = AM_EXTENDED_FLAGS(map);
546         if (flags & AMEF_SPECIFIES_DBITS)
547         {
548            int val = (flags & AMEF_DBITS_MASK) >> AMEF_DBITS_SHIFT;
549            val = (val + 1) * 8;
550            if (val != databus_width)
551            {
552               mame_printf_error("%s: %s cpu #%d uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, cpunum, spacename[spacenum], databus_width, AM_EXTENDED_FLAGS(map));
553               error = TRUE;
554            }
555         }
556
557536         /* loop over entries and look for errors */
558537         for ( ; !IS_AMENTRY_END(map); map++)
559538            if (!IS_AMENTRY_EXTENDED(map))
560539            {
561               /* the following checks only work for standard start/end ranges */
562               if (!IS_AMENTRY_MATCH_MASK(map))
540               int ismatchmask = ((map->flags & AM_FLAGS_MATCH_MASK) != 0);
541               UINT32 start = SPACE_SHIFT(map->start);
542               UINT32 end = ismatchmask ? SPACE_SHIFT(map->end) : SPACE_SHIFT_END(map->end);
543
563544               {
564545                  /* look for inverted start/end pairs */
565                  if (map->end < map->start)
546                  if (end < start)
566547                  {
567548                     mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver->source_file, driver->name, spacename[spacenum], map->start, map->end);
568549                     error = TRUE;
569550                  }
570551
571552                  /* look for misaligned entries */
572                  if ((SPACE_SHIFT(map->start) & (alignunit-1)) != 0 || (SPACE_SHIFT_END(map->end) & (alignunit-1)) != (alignunit-1))
553                  if ((start & (alignunit-1)) != 0 || (end & (alignunit-1)) != (alignunit-1))
573554                  {
574555                     mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver->source_file, driver->name, spacename[spacenum], map->start, map->end, alignunit);
575556                     error = TRUE;
r869r870
583564                  }
584565
585566                  /* if this entry references a memory region, validate it */
586                  if (map->region)
587                     if (region_length[map->region] && map->region_offs + (SPACE_SHIFT_END(map->end) - SPACE_SHIFT(map->start) + 1) > region_length[map->region] && map->share == 0 && !map->base)
567                  if (map->region && map->share == 0)
568                  {
569                     offs_t length = region_length[map->region];
570
571                     if (length == 0)
588572                     {
589                        if (region_length[map->region] == 0)
590                           mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X references non-existant region %d\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region);
591                        else
592                           mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X extends beyond region %d size (%X)\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region, region_length[map->region]);
573                        mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X references non-existant region %d\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region);
593574                        error = TRUE;
594575                     }
576                     else if (map->region_offs + (end - start + 1) > length)
577                     {
578                        mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X extends beyond region %d size (%X)\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region, length);
579                        error = TRUE;
580                     }
581                  }
582
583                  /* If this is a match/mask, make sure the match bits are present in the mask */
584                  if (ismatchmask && (start & end) != start)
585                  {
586                     mame_printf_error("%s: %s CPU %d space %d memory map entry match %X contains bits not in mask %X for region %d\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region);
587                     error = TRUE;
588                  }
595589               }
596590            }
591            else
592            {
593               flags = AM_EXTENDED_FLAGS(map);
594               if (flags & AMEF_SPECIFIES_SPACE)
595               {
596                  int val = (flags & AMEF_SPACE_MASK) >> AMEF_SPACE_SHIFT;
597                  if (val != spacenum)
598                  {
599                     mame_printf_error("%s: %s CPU #%d space %d has address space %d handlers!", driver->source_file, driver->name, cpunum, spacenum, val);
600                     error = TRUE;
601                  }
602               }
603
604               /* verify the type of memory handlers */
605               if (flags & AMEF_SPECIFIES_DBITS)
606               {
607                  int val = (flags & AMEF_DBITS_MASK) >> AMEF_DBITS_SHIFT;
608                  val = (val + 1) * 8;
609                  if (val != databus_width)
610                  {
611                     mame_printf_error("%s: %s cpu #%d uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, cpunum, spacename[spacenum], databus_width, val);
612                     error = TRUE;
613                  }
614               }
615            }
597616      }
598617   }
599618
src/mess/mslegacy.h
r0r870
1/*********************************************************************
2
3   mslegacy.h
4
5   Defines since removed from MAME, but kept in MESS for legacy
6   reasons
7
8*********************************************************************/
9
10#ifndef MSLEGACY_H
11#define MSLEGACY_H
12
13#define TIME_IN_USEC(us)      ((double)(us) * (1.0 / 1000000.0))
14
15INLINE void palette_set_colors_rgb(running_machine *machine, pen_t color_base, const UINT8 *colors, int color_count)
16{
17   while (color_count--)
18   {
19      UINT8 r = *colors++;
20      UINT8 g = *colors++;
21      UINT8 b = *colors++;
22      palette_set_color_rgb(machine, color_base++, r, g, b);
23   }
24}
25
26
27#endif /* MSLEGACY_H */
src/mess/mess.h
r869r870
116116
117117/* --------------------------------------------------------------------------------------------- */
118118
119/* phase this out - this call is only here so that I can get 0.116 out */
120INLINE void palette_set_colors_rgb(running_machine *machine, pen_t color_base, const UINT8 *colors, int color_count)
121{
122   while (color_count--)
123   {
124      UINT8 r = *colors++;
125      UINT8 g = *colors++;
126      UINT8 b = *colors++;
127      palette_set_color_rgb(machine, color_base++, r, g, b);
128   }
129}
130
131
132
133/* --------------------------------------------------------------------------------------------- */
134
135119/* dummy read handlers */
136120 READ8_HANDLER(return8_00);
137121 READ8_HANDLER(return8_FE);
src/mess/video/hp48.c
r869r870
11#include "driver.h"
22#include "video/generic.h"
3#include "mslegacy.h"
34
45#include "includes/hp48.h"
56
src/mess/video/911_vdt.c
r869r870
1515#include "911_chr.h"
1616#include "911_key.h"
1717#include "sound/beep.h"
18#include "mslegacy.h"
1819
1920
2021#define MAX_VDT 1
src/mess/video/i82720.c
r869r870
1717#include "video/generic.h"
1818#include "i82720.h"
1919#include "i82720cm.h"
20#include "mslegacy.h"
2021#include <math.h>
2122
2223/*-------------------------------------------------------------------------*/
src/mess/video/dai.c
r869r870
1515#include "driver.h"
1616#include "video/generic.h"
1717#include "includes/dai.h"
18#include "mslegacy.h"
1819
1920#define DEBUG_DAI_VIDEO   0
2021
src/mess/video/pocketc.c
r869r870
11#include "driver.h"
2#include "mslegacy.h"
23#include "video/generic.h"
34
45#include "includes/pocketc.h"
src/mess/video/pc_vga.c
r869r870
2929***************************************************************************/
3030
3131#include "driver.h"
32#include "mslegacy.h"
3233
3334#include "includes/crtc6845.h"
3435#include "video/pc_vga.h"
src/mess/video/epnick.c
r869r870
1010
1111#include "nick.h"
1212#include "epnick.h"
13#include "mslegacy.h"
1314
1415/*************************************************************/
1516/* MESS stuff */
src/mess/video/sym1.c
r869r870
66******************************************************************************/
77
88#include "driver.h"
9#include "mslegacy.h"
910#include "video/generic.h"
1011
1112#include "includes/sym1.h"
src/mess/video/pmd85.c
r869r870
99***************************************************************************/
1010
1111#include "driver.h"
12#include "mslegacy.h"
1213#include "video/generic.h"
1314#include "includes/pmd85.h"
1415
src/mess/video/lviv.c
r869r870
1111#include "driver.h"
1212#include "video/generic.h"
1313#include "includes/lviv.h"
14#include "mslegacy.h"
1415
1516unsigned char lviv_palette[8*3] =
1617{
src/mess/video/exidy.c
r869r870
99#include "driver.h"
1010#include "video/generic.h"
1111#include "../includes/exidy.h"
12#include "mslegacy.h"
1213
1314/***************************************************************************
1415  Start the video hardware emulation.
src/mess/video/channelf.c
r869r870
11#include "driver.h"
22#include "video/generic.h"
33#include "includes/channelf.h"
4#include "mslegacy.h"
45
56UINT8 channelf_val_reg = 0;
67UINT8 channelf_row_reg = 0;
src/mess/video/ssystem3.c
r869r870
44
55#include "driver.h"
66#include "video/generic.h"
7#include "mslegacy.h"
78
89#include "includes/ssystem3.h"
910
src/mess/video/avigo.c
r869r870
99#include "driver.h"
1010#include "video/generic.h"
1111#include "includes/avigo.h"
12#include "mslegacy.h"
1213
1314/***************************************************************************
1415  Start the video hardware emulation.
src/mess/video/vic6567.c
r869r870
6161#include "video/generic.h"
6262#include "mscommon.h"
6363#include "utils.h"
64#include "mslegacy.h"
6465
6566#define VERBOSE_DBG 1
6667#include "includes/cbm.h"
src/mess/video/odyssey2.c
r869r870
66
77#include <assert.h>
88#include "driver.h"
9#include "mslegacy.h"
910#include "cpu/i8039/i8039.h"
1011#include "video/generic.h"
1112#include "includes/odyssey2.h"
src/mess/video/primo.c
r869r870
99***************************************************************************/
1010
1111#include "driver.h"
12#include "mslegacy.h"
1213#include "video/generic.h"
1314#include "includes/primo.h"
1415
src/mess/video/saa5050.c
r869r870
99#include "driver.h"
1010#include "video/generic.h"
1111#include "includes/saa5050.h"
12#include "mslegacy.h"
1213
1314static INT8 frame_count;
1415
src/mess/video/733_asr.c
r869r870
2121*/
2222
2323#include "driver.h"
24#include "mslegacy.h"
2425
2526#include "733_asr.h"
2627
src/mess/video/galaxy.c
r869r870
1010#include "video/generic.h"
1111#include "includes/galaxy.h"
1212#include "cpu/z80/z80.h"
13#include "mslegacy.h"
1314
1415static int horizontal_pos = 0x0b;
1516
src/mess/video/kc.c
r869r870
1010#include "video/generic.h"
1111#include "includes/kc.h"
1212#include "eventlst.h"
13#include "mslegacy.h"
1314
1415/* KC85/4 and KC85/3 common graphics hardware */
1516
src/mess/machine/bebox.c
r869r870
104104#include "machine/8042kbdc.h"
105105#include "machine/53c810.h"
106106#include "memconv.h"
107#include "mslegacy.h"
107108
108109#define LOG_CPUIMASK   1
109110#define LOG_UART      1
src/mess/mess.mak
r869r870
6464#CPUS += DECO16
6565CPUS += M4510
6666CPUS += H6280
67CPUS += I86
68CPUS += I88
69CPUS += I186
70#CPUS += I188
71CPUS += I286
67#CPUS += I8086
68#CPUS += I8088
69#CPUS += I80186
70#CPUS += I80188
71#CPUS += I80286
7272CPUS += V20
73#CPUS += V25
7374#CPUS += V30
7475#CPUS += V33
76#CPUS += V35
7577#CPUS += V60
7678#CPUS += V70
7779CPUS += I8035
r869r870
209211CPUS += TMS7000_EXL
210212CPUS += SM8500
211213CPUS += V30MZ
214CPUS += I8086
215CPUS += I8088
216CPUS += I80186
217#CPUS += I80188
218CPUS += I80286
212219CPUS += M68008
213220#CPUS += TMS99000
214221CPUS += TMS99010
src/mess/drivers/wswan.c
r869r870
133133   MDRV_CPU_VBLANK_INT(wswan_scanline_interrupt, 159)   /* 1 int each scanline */
134134
135135   MDRV_SCREEN_REFRESH_RATE(75)
136   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
136   MDRV_SCREEN_VBLANK_TIME(0)
137137   MDRV_INTERLEAVE(1)
138138
139139   MDRV_NVRAM_HANDLER( wswan )
src/mess/drivers/comquest.c
r869r870
4040 */
4141
4242#include "driver.h"
43#include "mslegacy.h"
4344#include "includes/comquest.h"
4445#include "devices/cartslot.h"
4546
src/mess/drivers/zx.c
r869r870
2828#include "includes/zx.h"
2929#include "devices/cassette.h"
3030#include "formats/zx81_p.h"
31#include "mslegacy.h"
3132
3233/* Memory Maps */
3334
src/mess/drivers/dgn_beta.c
r869r870
5050#include "formats/coco_dsk.h"
5151#include "devices/mflopimg.h"
5252#include "devices/coco_vhd.h"
53#include "mslegacy.h"
5354
5455/*
5556 Colour codes are as below acording to os-9 headers, however the presise values
src/mess/drivers/pdp1.c
r869r870
4747#include <math.h>
4848
4949#include "driver.h"
50#include "mslegacy.h"
5051
5152#include "cpu/pdp1/pdp1.h"
5253#include "includes/pdp1.h"
src/mess/drivers/apple2gs.c
r869r870
4343#include "driver.h"
4444#include "state.h"
4545#include "inputx.h"
46#include "mslegacy.h"
4647#include "video/generic.h"
4748#include "includes/apple2.h"
4849#include "machine/ay3600.h"
src/mess/drivers/c65.c
r869r870
99***************************************************************************/
1010
1111#include "driver.h"
12#include "mslegacy.h"
1213#include "sound/sid6581.h"
1314#include "machine/6526cia.h"
1415
src/mess/drivers/dai.c
r869r870
6767#include "machine/8255ppi.h"
6868#include "machine/tms5501.h"
6969#include "devices/cassette.h"
70#include "mslegacy.h"
7071
7172/* I/O ports */
7273ADDRESS_MAP_START( dai_io , ADDRESS_SPACE_IO, 8)
src/mess/drivers/mac.c
r869r870
4242#include "devices/sonydriv.h"
4343#include "devices/harddriv.h"
4444#include "includes/mac.h"
45#include "mslegacy.h"
4546
4647
4748static ADDRESS_MAP_START(mac512ke_map, ADDRESS_SPACE_PROGRAM, 16)
src/mess/drivers/atari.c
r869r870
1414#include "machine/6821pia.h"
1515#include "video/gtia.h"
1616#include "inputx.h"
17#include "mslegacy.h"
1718
1819/******************************************************************************
1920    Atari 800 memory map (preliminary)
src/mess/drivers/cbmb.c
r869r870
158158 */
159159
160160#include "driver.h"
161#include "mslegacy.h"
161162#include "video/generic.h"
162163#include "cpu/m6502/m6509.h"
163164#include "sound/sid6581.h"
src/mess/drivers/mbee.c
r869r870
4646#include "devices/cassette.h"
4747#include "devices/z80bin.h"
4848#include "inputx.h"
49#include "mslegacy.h"
4950#include "cpu/z80/z80daisy.h"
5051
5152#define VERBOSE 1
src/mess/drivers/nes.c
r869r870
1818#include "devices/cartslot.h"
1919#include "sound/nes_apu.h"
2020#include "inputx.h"
21#include "mslegacy.h"
2122
2223unsigned char *battery_ram;
2324
src/mess/drivers/gb.c
r869r870
571571   MDRV_CPU_VBLANK_INT(gb_scanline_interrupt, 1)   /* 1 dummy int each frame */
572572
573573   MDRV_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND)
574   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
574   MDRV_SCREEN_VBLANK_TIME(0)
575575   MDRV_INTERLEAVE(1)
576576
577577   MDRV_MACHINE_START( gb )
r869r870
690690   MDRV_CPU_CONFIG(megaduck_cpu_reset)
691691
692692   MDRV_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND)
693   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
693   MDRV_SCREEN_VBLANK_TIME(0)
694694   MDRV_INTERLEAVE(1)
695695
696696   MDRV_MACHINE_RESET( megaduck )
src/mess/drivers/gamecom.c
r869r870
9999   MDRV_CPU_VBLANK_INT( gamecom_scanline, 200 )
100100
101101   MDRV_SCREEN_REFRESH_RATE( 59.732155 )
102   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
102   MDRV_SCREEN_VBLANK_TIME(0)
103103   MDRV_INTERLEAVE(1)
104104
105105   MDRV_MACHINE_RESET( gamecom )
src/mess/drivers/mz700.c
r869r870
6666#include "includes/mz700.h"
6767#include "devices/cassette.h"
6868#include "formats/mz_cas.h"
69#include "mslegacy.h"
6970
7071#ifndef VERBOSE
7172#define VERBOSE 1
src/mess/drivers/tm990189.c
r869r870
4444#include "video/tms9928a.h"
4545#include "devices/cassette.h"
4646#include "sound/speaker.h"
47#include "mslegacy.h"
4748
4849static int load_state;
4950static int ic_state;
r869r870
784785
785786   /* video hardware - we emulate a 8-segment LED display */
786787   MDRV_SCREEN_REFRESH_RATE(75)
787   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(/*DEFAULT_REAL_60HZ_VBLANK_DURATION*/0))
788   MDRV_SCREEN_VBLANK_TIME(/*DEFAULT_REAL_60HZ_VBLANK_DURATION*/0)
788789   /*MDRV_INTERLEAVE(interleave)*/
789790
790791   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
src/mess/drivers/arcadia.c
r869r870
77#include <assert.h>
88#include "driver.h"
99#include "image.h"
10#include "mslegacy.h"
1011#include "cpu/s2650/s2650.h"
1112#include "includes/arcadia.h"
1213#include "devices/cartslot.h"
src/mess/drivers/aquarius.c
r869r870
2525************************************************************************/
2626
2727#include "driver.h"
28#include "mslegacy.h"
2829#include "cpu/z80/z80.h"
2930#include "video/generic.h"
3031#include "includes/aquarius.h"
src/mess/drivers/cgenie.c
r869r870
2727***************************************************************************/
2828
2929#include "driver.h"
30#include "mslegacy.h"
3031#include "video/generic.h"
3132#include "includes/cgenie.h"
3233#include "devices/basicdsk.h"
src/mess/drivers/pmd85.c
r869r870
528528   MDRV_CPU_PROGRAM_MAP(pmd85_mem, 0)
529529   MDRV_CPU_IO_MAP(pmd85_readport, pmd85_writeport)
530530   MDRV_SCREEN_REFRESH_RATE(50)
531   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
531   MDRV_SCREEN_VBLANK_TIME(0)
532532   MDRV_INTERLEAVE(1)
533533
534534   MDRV_MACHINE_RESET( pmd85 )
src/mess/drivers/apexc.c
r869r870
99#include "driver.h"
1010#include "cpu/apexc/apexc.h"
1111#include "video/generic.h"
12#include "mslegacy.h"
1213
1314static void apexc_teletyper_init(void);
1415static void apexc_teletyper_putchar(int character);
src/mess/drivers/x68k.c
r869r870
137137#include "machine/rp5c15.h"
138138#include "devices/basicdsk.h"
139139#include "includes/x68k.h"
140#include "mslegacy.h"
140141
141142struct x68k_system sys;
142143
src/mess/drivers/spectrum.c
r869r870
150150#include "sound/ay8910.h"
151151#include "sound/speaker.h"
152152#include "formats/tzx_cas.h"
153#include "mslegacy.h"
153154
154155/* +3 hardware */
155156#include "machine/nec765.h"
src/mess/drivers/kaypro.c
r869r870
1010 ******************************************************************************/
1111
1212#include "driver.h"
13#include "mslegacy.h"
1314#include "includes/kaypro.h"
1415#include "devices/basicdsk.h"
1516
src/mess/drivers/super80.c
r869r870
2020
2121#include <math.h>
2222#include "driver.h"
23#include "mslegacy.h"
2324#include "machine/z80ctc.h"
2425#include "machine/z80pio.h"
2526#include "machine/z80sio.h"
r869r870
7172   keyboard_scan();
7273   /* enable ROM in base >0000, and re-enable RAM shortly thereafter */
7374   memory_set_bankptr(1, memory_region(REGION_CPU1) + 0xC000);
74   timer_set(TIME_IN_USEC(10), 0, reset_timer_callback);
75   mame_timer_set(MAME_TIME_IN_USEC(10), 0, reset_timer_callback);
7576}
7677
7778static VIDEO_START( super80 )
src/mess/drivers/tx0.c
r869r870
66
77#include <math.h>
88#include "driver.h"
9#include "mslegacy.h"
910
1011#include "cpu/pdp1/tx0.h"
1112#include "includes/tx0.h"
src/mess/drivers/c128.c
r869r870
294294*/
295295
296296#include "driver.h"
297#include "mslegacy.h"
297298#include "sound/sid6581.h"
298299#include "machine/6526cia.h"
299300
src/mess/drivers/lviv.c
r869r870
426426   MDRV_CPU_PROGRAM_MAP(lviv_mem, 0)
427427   MDRV_CPU_IO_MAP(lviv_readport, lviv_writeport)
428428   MDRV_SCREEN_REFRESH_RATE(50)
429   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
429   MDRV_SCREEN_VBLANK_TIME(0)
430430   MDRV_INTERLEAVE(1)
431431
432432   MDRV_MACHINE_RESET( lviv )
src/mess/drivers/exidy.c
r869r870
9696#include "sound/speaker.h"
9797#include "image.h"
9898#include "inputx.h"
99#include "mslegacy.h"
99100
100101static int device_load_exidy_floppy(mess_image *image)
101102{
src/mess/drivers/p2000t.c
r869r870
3131#include "video/generic.h"
3232#include "includes/saa5050.h"
3333#include "includes/p2000t.h"
34#include "mslegacy.h"
3435
3536/* port i/o functions */
3637
src/mess/drivers/pet.c
r869r870
113113 */
114114
115115#include "driver.h"
116#include "mslegacy.h"
116117
117118#define VERBOSE_DBG 0
118119#include "includes/cbm.h"
src/mess/drivers/c16.c
r869r870
165165#include "includes/ted7360.h"
166166#include "devices/cartslot.h"
167167#include "inputx.h"
168#include "mslegacy.h"
168169
169170/*
170171 * commodore c16/c116/plus 4
src/mess/drivers/oric.c
r869r870
1717*********************************************************************/
1818
1919#include "driver.h"
20#include "mslegacy.h"
2021#include "video/generic.h"
2122#include "includes/oric.h"
2223#include "includes/centroni.h"
src/mess/drivers/at.c
r869r870
414414
415415static MACHINE_DRIVER_START( atcga )
416416   /* basic machine hardware */
417   MDRV_CPU_ATPC(at, at, I286, 12000000, NULL)
417   MDRV_CPU_ATPC(at, at, I80286, 12000000, NULL)
418418
419419   MDRV_SCREEN_REFRESH_RATE(60)
420420   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
447447
448448static MACHINE_DRIVER_START( ps2m30286 )
449449   /* basic machine hardware */
450   MDRV_CPU_ATPC(at, at, I286, 12000000, NULL)
450   MDRV_CPU_ATPC(at, at, I80286, 12000000, NULL)
451451
452452   MDRV_SCREEN_REFRESH_RATE(60)
453453   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
477477
478478static MACHINE_DRIVER_START( atvga )
479479   /* basic machine hardware */
480   MDRV_CPU_ATPC(at, at, I286, 12000000, NULL)
480   MDRV_CPU_ATPC(at, at, I80286, 12000000, NULL)
481481
482482   MDRV_SCREEN_REFRESH_RATE(60)
483483   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
src/mess/drivers/vc20.c
r869r870
152152
153153
154154#include "driver.h"
155#include "mslegacy.h"
155156
156157#define VERBOSE_DBG 0
157158#include "includes/cbm.h"
src/mess/drivers/saturn.c
r869r870
167167#include "machine/scudsp.h"
168168#include "sound/scsp.h"
169169#include "devices/chd_cd.h"
170#include "mslegacy.h"
170171
171172extern UINT32* stv_vdp2_regs;
172173extern UINT32* stv_vdp2_vram;
src/mess/drivers/apple1.c
r869r870
7575#include "devices/snapquik.h"
7676#include "devices/cassette.h"
7777#include "inputx.h"
78#include "mslegacy.h"
7879
7980/* port i/o functions */
8081
src/mess/drivers/nascom1.c
r869r870
5353#include "video/generic.h"
5454#include "includes/nascom1.h"
5555#include "devices/cartslot.h"
56#include "mslegacy.h"
5657
5758/* Memory w/r functions */
5859ADDRESS_MAP_START( nascom1_mem , ADDRESS_SPACE_PROGRAM, 8)
src/mess/drivers/ti99_2.c
r869r870
8181#include "video/generic.h"
8282#include "machine/tms9901.h"
8383#include "cpu/tms9900/tms9900.h"
84#include "mslegacy.h"
8485
8586static int ROM_paged;
8687
src/mess/drivers/intv.c
r869r870
2020 ************************************************************************/
2121
2222#include "driver.h"
23#include "mslegacy.h"
2324#include "video/generic.h"
2425#include "video/stic.h"
2526#include "includes/intv.h"
src/mess/drivers/jupiter.c
r869r870
2929***************************************************************************/
3030
3131#include "driver.h"
32#include "mslegacy.h"
3233#include "cpu/z80/z80.h"
3334#include "video/generic.h"
3435#include "includes/jupiter.h"
3536#include "devices/cartslot.h"
37#include "mslegacy.h"
3638
3739/* memory w/r functions */
3840ADDRESS_MAP_START( jupiter_mem , ADDRESS_SPACE_PROGRAM, 8)
src/mess/drivers/amstrad.c
r869r870
7676#include "devices/printer.h"
7777#include "devices/cassette.h"
7878#include "inputx.h"
79#include "mslegacy.h"
7980#include "sound/ay8910.h"
8081
8182#ifdef AMSTRAD_VIDEO_EVENT_LIST
src/mess/drivers/psx.c
r869r870
781781   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
782782
783783   MDRV_SCREEN_REFRESH_RATE( 60 )
784   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
784   MDRV_SCREEN_VBLANK_TIME(0)
785785
786786   MDRV_MACHINE_RESET( psx )
787787
r869r870
811811   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
812812
813813   MDRV_SCREEN_REFRESH_RATE( 50 )
814   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC( 0 ))
814   MDRV_SCREEN_VBLANK_TIME(0)
815815
816816   MDRV_MACHINE_RESET( psx )
817817
src/mess/drivers/coupe.c
r869r870
412412   MDRV_CPU_IO_MAP(coupe_io, 0)
413413   MDRV_CPU_VBLANK_INT(coupe_line_interrupt, 192 + 10)   /* 192 scanlines + 10 lines of vblank (approx).. */
414414   MDRV_SCREEN_REFRESH_RATE(50)
415   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
415   MDRV_SCREEN_VBLANK_TIME(0)
416416   MDRV_INTERLEAVE(1)
417417
418418   MDRV_MACHINE_START( coupe )
src/mess/drivers/trs80.c
r869r870
8080#include "includes/trs80.h"
8181#include "devices/basicdsk.h"
8282#include "sound/speaker.h"
83#include "mslegacy.h"
8384
8485#define FW   TRS80_FONT_W
8586#define FH   TRS80_FONT_H
src/mess/drivers/apple2.c
r869r870
191191#include "devices/mflopimg.h"
192192#include "formats/ap2_dsk.h"
193193#include "sound/ay8910.h"
194#include "mslegacy.h"
194195
195196static ADDRESS_MAP_START( apple2_map, ADDRESS_SPACE_PROGRAM, 8 )
196197ADDRESS_MAP_END
src/mess/drivers/primo.c
r869r870
109109#include "includes/cbmserb.h"
110110#include "includes/primo.h"
111111#include "formats/primoptp.h"
112#include "mslegacy.h"
112113
113114
114115ADDRESS_MAP_START( primoa_port, ADDRESS_SPACE_IO, 8 )
src/mess/drivers/ti85.c
r869r870
334334   MDRV_CPU_PROGRAM_MAP(ti81_mem, 0)
335335   MDRV_CPU_IO_MAP(ti81_io, 0)
336336   MDRV_SCREEN_REFRESH_RATE(50)
337   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
337   MDRV_SCREEN_VBLANK_TIME(0)
338338   MDRV_INTERLEAVE(1)
339339
340340   MDRV_MACHINE_START( ti81 )
src/mess/drivers/svision.c
r869r870
77#include <assert.h>
88#include "driver.h"
99#include "image.h"
10#include "mslegacy.h"
1011#include "video/generic.h"
1112#include "cpu/m6502/m6502.h"
1213
src/mess/drivers/pc.c
r869r870
11321132
11331133static MACHINE_DRIVER_START( pccga )
11341134   /* basic machine hardware */
1135   MDRV_CPU_PC(pc, pc, I88, 4772720, pc_cga_frame_interrupt)   /* 4,77 Mhz */
1135   MDRV_CPU_PC(pc, pc, I8088, 4772720, pc_cga_frame_interrupt)   /* 4,77 Mhz */
11361136
11371137   MDRV_SCREEN_REFRESH_RATE(60)
11381138   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
11621162
11631163static MACHINE_DRIVER_START( europc )
11641164   /* basic machine hardware */
1165   MDRV_CPU_PC(europc, europc, I88, 4772720*2, pc_aga_frame_interrupt)
1165   MDRV_CPU_PC(europc, europc, I8088, 4772720*2, pc_aga_frame_interrupt)
11661166
11671167   MDRV_SCREEN_REFRESH_RATE(60)
11681168   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
11981198
11991199static MACHINE_DRIVER_START( xtcga )
12001200   /* basic machine hardware */
1201   MDRV_CPU_PC(pc, pc, I86, 12000000, pc_cga_frame_interrupt)
1201   MDRV_CPU_PC(pc, pc, I8086, 12000000, pc_cga_frame_interrupt)
12021202
12031203   MDRV_SCREEN_REFRESH_RATE(60)
12041204   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
12281228
12291229static MACHINE_DRIVER_START( pc200 )
12301230   /* basic machine hardware */
1231   MDRV_CPU_PC(pc1640, pc200, I86, 8000000, pc_aga_frame_interrupt)
1231   MDRV_CPU_PC(pc1640, pc200, I8086, 8000000, pc_aga_frame_interrupt)
12321232
12331233   MDRV_SCREEN_REFRESH_RATE(60)
12341234   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
12571257
12581258static MACHINE_DRIVER_START( pc1512 )
12591259   /* basic machine hardware */
1260   MDRV_CPU_PC(pc1640, pc1640, I86, 8000000, pc_cga_frame_interrupt)
1260   MDRV_CPU_PC(pc1640, pc1640, I8086, 8000000, pc_cga_frame_interrupt)
12611261
12621262   MDRV_SCREEN_REFRESH_RATE(60)
12631263   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
12781278
12791279static MACHINE_DRIVER_START( pc1640 )
12801280   /* basic machine hardware */
1281   MDRV_CPU_PC(pc1640, pc1640, I86, 8000000, pc_vga_frame_interrupt)
1281   MDRV_CPU_PC(pc1640, pc1640, I8086, 8000000, pc_vga_frame_interrupt)
12821282
12831283   MDRV_SCREEN_REFRESH_RATE(60)
12841284   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
12991299
13001300static MACHINE_DRIVER_START( xtvga )
13011301   /* basic machine hardware */
1302   MDRV_CPU_PC(pc, pc, I86, 12000000, pc_vga_frame_interrupt)
1302   MDRV_CPU_PC(pc, pc, I8086, 12000000, pc_vga_frame_interrupt)
13031303
13041304   MDRV_SCREEN_REFRESH_RATE(60)
13051305   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r869r870
13291329
13301330static MACHINE_DRIVER_START( t1000hx )
13311331   /* basic machine hardware */
1332   MDRV_CPU_PC(tandy1000, tandy1000, I88, 8000000, tandy1000_frame_interrupt)
1332   MDRV_CPU_PC(tandy1000, tandy1000, I8088, 8000000, tandy1000_frame_interrupt)
13331333
13341334   MDRV_SCREEN_REFRESH_RATE(60)
13351335   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
src/mess/drivers/vc4000.c
r869r870
66
77#include "driver.h"
88#include "cpu/s2650/s2650.h"
9#include "mslegacy.h"
910
1011#include "includes/vc4000.h"
1112#include "devices/cartslot.h"
src/mess/drivers/galaxy.c
r869r870
128128   MDRV_CPU_IO_MAP(galaxy_readport, galaxy_writeport)
129129   MDRV_CPU_VBLANK_INT(galaxy_interrupt, 1)
130130   MDRV_SCREEN_REFRESH_RATE(50)
131   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
131   MDRV_SCREEN_VBLANK_TIME(0)
132132   MDRV_INTERLEAVE(1)
133133
134134   MDRV_MACHINE_RESET( galaxy )
src/mess/drivers/bbc.c
r869r870
2323#include "machine/mc6850.h"
2424#include "formats/uef_cas.h"
2525#include "formats/csw_cas.h"
26#include "mslegacy.h"
2627
2728
2829/******************************************************************************
src/mess/drivers/compis.c
r869r870
210210
211211static MACHINE_DRIVER_START( compis )
212212   /* basic machine hardware */
213   MDRV_CPU_ADD_TAG("main", I186, 8000000)   /* 8 MHz */
213   MDRV_CPU_ADD_TAG("main", I80186, 8000000)   /* 8 MHz */
214214   MDRV_CPU_PROGRAM_MAP(compis_mem, 0)
215215   MDRV_CPU_IO_MAP(compis_io, 0)
216216   MDRV_CPU_VBLANK_INT(compis_vblank_int, 1)
src/mess/drivers/vtech2.c
r869r870
6464***************************************************************************/
6565
6666#include "driver.h"
67#include "mslegacy.h"
6768#include "video/generic.h"
6869#include "includes/vtech2.h"
6970#include "devices/cartslot.h"
r869r870
469470   MDRV_CPU_IO_MAP(vtech2_io, 0)
470471   MDRV_CPU_VBLANK_INT(vtech2_interrupt, 1)
471472   MDRV_SCREEN_REFRESH_RATE(50)
472   MDRV_SCREEN_VBLANK_TIME(TIME_IN_USEC(0))
473   MDRV_SCREEN_VBLANK_TIME(0)
473474   MDRV_INTERLEAVE(1)
474475
475476   MDRV_MACHINE_RESET( laser350 )
docs/messnew.txt
r869r870
3636
3737Source Changes:
3838----------------
39- The core is based on MAME 0.118u2.  This incorporates all features of the
39- The core is based on MAME 0.118u3.  This incorporates all features of the
4040  update to this core.  [MAME team]
4141
4242

Previous 15994 Revisions Next


© 1998-2018 The MESS Team