Previous 15994 Revisions Next

r1186 Thursday 25th October, 2007 at 19:25:50 UTC by Nathan Woods
Updated to MAME 0.120u1 core
[ROOT]makefile
[docs]messnew.txt
[src/emu]audit.c cheat.c clifront.c cpuexec.c cpuexec.h cpuint.c cpuintrf.c cpuintrf.h driver.c driver.h emu.mak info.c input.c memory.c romload.c sndintrf.c sndintrf.h sound.c sound.h ui.c validity.c
[src/emu/cpu/adsp2100]adsp2100.c
[src/emu/cpu/i8051]i8051.c
[src/emu/cpu/m6502]m4510.c m65ce02.c minc4510.h* mincce02.h* ops4510.h opsce02.h t6509.c t65ce02.c
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/nec]nec.c nec.h
[src/emu/cpu/v30mz]v30mz.c v30mz.h
[src/emu/debug]debugcpu.c
[src/emu/machine]6522via.c 6532riot.c 8042kbdc.c tmp68301.c
[src/emu/sound]2610intf.c ay8910.c ay8910.h es5506.c gaelco.c scsp.c sid6581.c
[src/emu/video]polynew.c* polynew.h* vooddefs.h voodoo.c
[src/lib/util]chd.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]atarijsa.c cage.c cchasm.c cinemat.c dcs.c exidy.c leland.c namcoc7x.c polepos.c senjyo.c
[src/mame/drivers]asteroid.c astrocde.c cclimber.c cojag.c dec8.c deniam.c dlair.c dominob.c f1gp.c gaelco3d.c gamecstl.c* genesis.c goodejan.c* gticlub.c harddriv.c hornet.c ikki.c itech8.c mcr68.c megasys1.c metro.c midvunit.c midyunit.c midzeus.c namcoic.c namcos21.c nbmj8991.c nbmj9195.c niyanpai.c pacman.c peplus.c pipeline.c psikyo4.c segas18.c seta.c stv.c taito_b.c tubep.c
[src/mame/includes]cclimber.h f1gp.h gaelco3d.h
[src/mame/layout]peplus.lay* pepp0188.lay* peset038.lay*
[src/mame/machine]amiga.c atarigen.c bublbobl.c cclimber.c fd1089.c leland.c mcr.c mexico86.c midtunit.c midyunit.c namcos2.c slapstic.c taitosj.c tnzs.c toaplan1.c
[src/mame/video]f1gp.c gaelco3d.c goodejan.c* midvunit.c model2.c namcos21.c namcos22.c toaplan2.c turbo.c
[src/mess]eventlst.c
[src/mess/audio]svision.c
[src/mess/devices]cartslot.c
[src/mess/drivers]svision.c
[src/mess/machine]at.c pc.c
[src/mess/video]odyssey2.c pc_aga.c pc_cga.c pc_mda.c pc_vga.c
[src/osd]osdcore.h
[src/osd/osdmini]miniwork.c
[src/osd/windows]debugwin.c osinline.h vconv.c winsync.c winwork.c
[src/osd/winui]m32util.c mkhelp.c properties.c treeview.c win32ui.c winui.mak

src/mame/audio/cchasm.c
r1185r1186
179179    sound_flags = 0;
180180    output[0] = 0; output[1] = 0;
181181
182   ctc_intf.baseclock = machine->drv->cpu[1].cpu_clock;
182   ctc_intf.baseclock = machine->drv->cpu[1].clock;
183183   z80ctc_init (0, &ctc_intf);
184184
185185   mame_timer_pulse(make_mame_time(0, machine->screen[0].refresh), 0, cchasm_sh_update);
src/mame/audio/cinemat.c
r1185r1186
15081508   generic_init(machine, demon_sound_w);
15091509
15101510   /* initialize the CTC interface */
1511   demon_z80ctc_interface.baseclock = machine->drv->cpu[1].cpu_clock;
1511   demon_z80ctc_interface.baseclock = machine->drv->cpu[1].clock;
15121512   z80ctc_init(0, &demon_z80ctc_interface);
15131513
15141514   /* reset the FIFO */
src/mame/audio/atarijsa.c
r1185r1186
119119   has_tms5220 = has_oki6295 = has_pokey = has_ym2151 = 0;
120120   for (i = 0; i < MAX_SOUND; i++)
121121   {
122      switch (Machine->drv->sound[i].sound_type)
122      switch (Machine->drv->sound[i].type)
123123      {
124124         case SOUND_TMS5220:
125125            has_tms5220 = 1;
r1185r1186
133133         case SOUND_YM2151:
134134            has_ym2151 = 1;
135135            break;
136         default:
137            break;
136138      }
137139   }
138140
src/mame/audio/cage.c
r1185r1186
161161   memory_set_bankptr(11, memory_region(boot_region + 1));
162162
163163   cage_cpu = mame_find_cpu_index(Machine, "cage");
164   cage_cpu_clock_period = MAME_TIME_IN_HZ(Machine->drv->cpu[cage_cpu].cpu_clock);
164   cage_cpu_clock_period = MAME_TIME_IN_HZ(Machine->drv->cpu[cage_cpu].clock);
165165   cage_cpu_h1_clock_period = scale_up_mame_time(cage_cpu_clock_period, 2);
166166
167167   dma_timer = mame_timer_alloc(dma_timer_callback);
src/mame/audio/senjyo.c
r1185r1186
6969    int i;
7070
7171   /* z80 ctc init */
72   ctc_intf.baseclock = Machine->drv->cpu[1].cpu_clock;
72   ctc_intf.baseclock = Machine->drv->cpu[1].clock;
7373   z80ctc_init (0, &ctc_intf);
7474
7575   /* z80 pio init */
src/mame/audio/leland.c
r1185r1186
508508   /* determine which sound hardware is installed */
509509   has_ym2151 = 0;
510510   for (i = 0; i < MAX_SOUND; i++)
511      if (Machine->drv->sound[i].sound_type == SOUND_YM2151)
511      if (Machine->drv->sound[i].type == SOUND_YM2151)
512512         has_ym2151 = 1;
513513
514514   /* allocate separate streams for the DMA and non-DMA DACs */
src/mame/audio/namcoc7x.c
r1185r1186
6565
6666   // install speedup cheat
6767   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
68      if (Machine->drv->cpu[cpunum].cpu_type == CPU_M37702)
68      if (Machine->drv->cpu[cpunum].type == CPU_M37702)
6969      {
7070         memory_install_read16_handler(cpunum, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, speedup_r);
7171         memory_install_write16_handler(cpunum, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, speedup_w);
src/mame/audio/dcs.c
r1185r1186
19211921   /* calculate how long until we generate an interrupt */
19221922
19231923   /* frequency the time per each bit sent */
1924   mame_time sample_period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[dcs.cpunum].cpu_clock), 2 * (dcs.control_regs[S1_SCLKDIV_REG] + 1));
1924   mame_time sample_period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[dcs.cpunum].clock), 2 * (dcs.control_regs[S1_SCLKDIV_REG] + 1));
19251925
19261926   /* now put it down to samples, so we know what the channel frequency has to be */
19271927   sample_period = scale_up_mame_time(sample_period, 16 * dcs.channels);
src/mame/audio/polepos.c
r1185r1186
6363   }
6464
6565   /* determine the effective clock rate */
66   clock = (Machine->drv->cpu[0].cpu_clock / 16) * ((sample_msb + 1) * 64 + sample_lsb + 1) / (64*64);
66   clock = (Machine->drv->cpu[0].clock / 16) * ((sample_msb + 1) * 64 + sample_lsb + 1) / (64*64);
6767   step = (clock << 12) / OUTPUT_RATE;
6868
6969   /* determine the volume */
src/mame/audio/exidy.c
r1185r1186
400400   has_tms5220 = FALSE;
401401   for (i = 0; i < MAX_SOUND; i++)
402402   {
403      if (Machine->drv->sound[i].sound_type == SOUND_TMS5220)
403      if (Machine->drv->sound[i].type == SOUND_TMS5220)
404404         has_tms5220 = TRUE;
405      if (Machine->drv->sound[i].sound_type == SOUND_HC55516)
405      if (Machine->drv->sound[i].type == SOUND_HC55516)
406406         has_hc55516 = TRUE;
407407   }
408408
src/mame/machine/fd1089.c
r1185r1186
64926492   FD1089B
64936493};
64946494
6495static UINT16 fd1089_decrypt(offs_t addr,UINT16 val,const UINT8 *key,int opcode,int cpu_type)
6495static UINT16 fd1089_decrypt(offs_t addr,UINT16 val,const UINT8 *key,int opcode,int cputype)
64966496{
64976497   int tbl_num,src;
64986498
r1185r1186
65076507         ((val & 0x0040) >> 5) |
65086508         ((val & 0xfc00) >> 8);
65096509
6510   switch (cpu_type)
6510   switch (cputype)
65116511   {
65126512      case FD1089A: src = decode_fd1089a(src,key[tbl_num + opcode * 0x1000],opcode); break;
65136513      case FD1089B: src = decode_fd1089b(src,key[tbl_num + opcode * 0x1000],opcode); break;
r1185r1186
65226522
65236523static UINT16 *decrypted;
65246524
6525static void sys16_decrypt(const UINT8 *key,int cpu_type)
6525static void sys16_decrypt(const UINT8 *key,int cputype)
65266526{
65276527   UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
65286528   int size = memory_region_length(REGION_CPU1);
r1185r1186
65366536      UINT16 src = rom[A/2];
65376537
65386538      /* decode the opcodes */
6539      decrypted[A/2] = fd1089_decrypt(A,src,key,1,cpu_type);
6539      decrypted[A/2] = fd1089_decrypt(A,src,key,1,cputype);
65406540
65416541      /* decode the data */
6542      rom[A/2] = fd1089_decrypt(A,src,key,0,cpu_type);
6542      rom[A/2] = fd1089_decrypt(A,src,key,0,cputype);
65436543   }
65446544}
65456545
src/mame/machine/bublbobl.c
r1185r1186
2929   cpunum_set_input_line(1, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
3030
3131   /* bit 5 resets mcu */
32   if (Machine->drv->cpu[3].cpu_type != CPU_DUMMY)   // only if we have a MCU
32   if (Machine->drv->cpu[3].type != CPU_DUMMY)   // only if we have a MCU
3333      cpunum_set_input_line(3, INPUT_LINE_RESET, (data & 0x20) ? CLEAR_LINE : ASSERT_LINE);
3434
3535   /* bit 6 enables display */
src/mame/machine/tnzs.c
r1185r1186
742742            /* bit 2 resets the mcu */
743743            if (data & 0x04)
744744            {
745               if (Machine->drv->cpu[2].cpu_type == CPU_I8X41)
745               if (Machine->drv->cpu[2].type == CPU_I8X41)
746746                  cpunum_set_input_line(2, INPUT_LINE_RESET, PULSE_LINE);
747747            }
748748            /* Coin count and lockout is handled by the i8742 */
src/mame/machine/midyunit.c
r1185r1186
4141static UINT8   cmos_w_enable;
4242
4343/* sound-related variables */
44static UINT8   sound_type;
44static UINT8   chip_type;
4545
4646/* hack-related variables */
4747static UINT16 *t2_hack_mem;
r1185r1186
283283   }
284284
285285   /* load sound ROMs and set up sound handlers */
286   sound_type = sound;
286   chip_type = sound;
287287   switch (sound)
288288   {
289289      case SOUND_CVSD_SMALL:
r1185r1186
513513MACHINE_RESET( midyunit )
514514{
515515   /* reset sound */
516   switch (sound_type)
516   switch (chip_type)
517517   {
518518      case SOUND_NARC:
519519         williams_narc_reset_w(1);
r1185r1186
555555
556556   /* call through based on the sound type */
557557   if (ACCESSING_LSB && ACCESSING_MSB)
558      switch (sound_type)
558      switch (chip_type)
559559      {
560560         case SOUND_NARC:
561561            williams_narc_data_w(data);
src/mame/machine/leland.c
r1185r1186
402402      memory_set_bankptr(3, &slave_base[0x10000]);
403403
404404   /* if we have an I80186 CPU, reset it */
405   if (machine->drv->cpu[2].cpu_type == CPU_I80186)
405   if (machine->drv->cpu[2].type == CPU_I80186)
406406      leland_80186_sound_init();
407407}
408408
src/mame/machine/toaplan1.c
r1185r1186
225225   if (ACCESSING_LSB && (data == 0))
226226   {
227227      logerror("PC:%04x  Resetting Sound CPU and Sound chip (%08x)\n",activecpu_get_previouspc(),data);
228      if (Machine->drv->sound[0].sound_type == SOUND_YM3812)
228      if (Machine->drv->sound[0].type == SOUND_YM3812)
229229         sndti_reset(SOUND_YM3812, 0);
230      if (Machine->drv->cpu[1].cpu_type == CPU_Z80)
230      if (Machine->drv->cpu[1].type == CPU_Z80)
231231         cpunum_set_input_line(1, INPUT_LINE_RESET, PULSE_LINE);
232232   }
233233}
src/mame/machine/midtunit.c
r1185r1186
2626static UINT8   cmos_write_enable;
2727
2828/* sound-related variables */
29static UINT8   sound_type;
29static UINT8   chip_type;
3030static UINT8   fake_sound_state;
3131
3232/* protection */
r1185r1186
412412   }
413413
414414   /* load sound ROMs and set up sound handlers */
415   sound_type = sound;
415   chip_type = sound;
416416   switch (sound)
417417   {
418418      case SOUND_ADPCM:
r1185r1186
548548MACHINE_RESET( midtunit )
549549{
550550   /* reset sound */
551   switch (sound_type)
551   switch (chip_type)
552552   {
553553      case SOUND_ADPCM:
554554      case SOUND_ADPCM_LARGE:
r1185r1186
575575{
576576/*  logerror("%08X:Sound status read\n", activecpu_get_pc());*/
577577
578   if (sound_type == SOUND_DCS)
578   if (chip_type == SOUND_DCS)
579579      return dcs_control_r() >> 4;
580580
581581   if (fake_sound_state)
r1185r1186
590590{
591591   logerror("%08X:Sound data read\n", activecpu_get_pc());
592592
593   if (sound_type == SOUND_DCS)
593   if (chip_type == SOUND_DCS)
594594      return dcs_data_r() & 0xff;
595595
596596   return ~0;
r1185r1186
607607
608608   /* call through based on the sound type */
609609   if (ACCESSING_LSB && ACCESSING_MSB)
610      switch (sound_type)
610      switch (chip_type)
611611      {
612612         case SOUND_ADPCM:
613613         case SOUND_ADPCM_LARGE:
src/mame/machine/mexico86.c
r1185r1186
2121WRITE8_HANDLER( mexico86_f008_w )
2222{
2323   cpunum_set_input_line(1, INPUT_LINE_RESET, (data & 4) ? CLEAR_LINE : ASSERT_LINE);
24    if (Machine->drv->cpu[2].cpu_type != CPU_DUMMY)
24    if (Machine->drv->cpu[2].type != CPU_DUMMY)
2525   {
2626      // mexico 86, knight boy
2727      cpunum_set_input_line(2, INPUT_LINE_RESET, (data & 2) ? CLEAR_LINE : ASSERT_LINE);
src/mame/machine/taitosj.c
r1185r1186
5555   zaccept = 1;
5656   zready = 0;
5757   busreq = 0;
58    if (machine->drv->cpu[2].cpu_type != CPU_DUMMY)
58    if (machine->drv->cpu[2].type != CPU_DUMMY)
5959   cpunum_set_input_line(2,0,CLEAR_LINE);
6060
6161   spacecr_prot_value = 0;
src/mame/machine/amiga.c
r1185r1186
3333 *************************************/
3434
3535/* 715909 Hz for NTSC, 709379 for PAL */
36#define O2_CLOCK               (Machine->drv->cpu[0].cpu_clock / 10)
36#define O2_CLOCK               (Machine->drv->cpu[0].clock / 10)
3737
3838/* How many CPU cycles we delay until we fire a pending interrupt */
3939#define AMIGA_IRQ_DELAY_CYCLES      24
r1185r1186
11391139
11401140static void custom_reset(void)
11411141{
1142   int clock = Machine->drv->cpu[0].cpu_clock;
1142   int clock = Machine->drv->cpu[0].clock;
11431143   UINT16   vidmode = (clock == AMIGA_68000_NTSC_CLOCK || clock == AMIGA_68EC020_NTSC_CLOCK ) ? 0x1000 : 0x0000; /* NTSC or PAL? */
11441144
11451145   CUSTOM_REG(REG_DDFSTRT) = 0x18;
r1185r1186
15161516mame_time amiga_get_serial_char_period(void)
15171517{
15181518   UINT32 divisor = (CUSTOM_REG(REG_SERPER) & 0x7fff) + 1;
1519   UINT32 baud = Machine->drv->cpu[0].cpu_clock / 2 / divisor;
1519   UINT32 baud = Machine->drv->cpu[0].clock / 2 / divisor;
15201520   UINT32 numbits = 2 + ((CUSTOM_REG(REG_SERPER) & 0x8000) ? 9 : 8);
15211521   return scale_up_mame_time(MAME_TIME_IN_HZ(baud), numbits);
15221522}
src/mame/machine/atarigen.c
r1185r1186
109109static TIMER_CALLBACK( delayed_sound_w );
110110static TIMER_CALLBACK( delayed_6502_sound_w );
111111
112static void atarigen_set_vol(running_machine *machine, int volume, int type);
112static void atarigen_set_vol(running_machine *machine, int volume, sound_type type);
113113
114114static TIMER_CALLBACK( scanline_timer_callback );
115115
r1185r1186
775775    changes the volume on all channels associated with it.
776776---------------------------------------------------------------*/
777777
778static void atarigen_set_vol(running_machine *machine, int volume, int type)
778void atarigen_set_vol(running_machine *machine, int volume, sound_type type)
779779{
780780   int sndindex = 0;
781781   int ch;
782782
783783   for (ch = 0; ch < MAX_SOUND; ch++)
784      if (machine->drv->sound[ch].sound_type == type)
784      if (machine->drv->sound[ch].type == type)
785785      {
786786         int output;
787787         for (output = 0; output < 2; output++)
src/mame/machine/namcos2.c
r1185r1186
444444UINT16  namcos2_68k_slave_C148[0x20];
445445UINT16  namcos2_68k_gpu_C148[0x20];
446446
447
448static int IsSystem21( void )
449{
450   switch( namcos2_gametype )
451   {
452   case NAMCOS21_AIRCOMBAT:
453   case NAMCOS21_STARBLADE:
454   case NAMCOS21_CYBERSLED:
455   case NAMCOS21_SOLVALOU:
456   case NAMCOS21_WINRUN91:
457   case NAMCOS21_DRIVERS_EYES:
458      return 1;
459   default:
460      return 0;
461   }
462}
463
447464static UINT16
448465ReadWriteC148( int cpu, offs_t offset, UINT16 data, int bWrite )
449466{
r1185r1186
563580            /* Suspend execution */
564581            cpunum_set_input_line(CPU_SOUND, INPUT_LINE_RESET, ASSERT_LINE);
565582         }
566         if( data&4 )
583         if( IsSystem21() )
567584         {
568            namcos21_kickstart(1);
585            //printf( "dspkick=0x%x\n", data );
586            if( data&4 )
587            {
588               namcos21_kickstart(1);
589            }
569590         }
570591      }
571592      break;
r1185r1186
632653   cpunum_set_input_line(CPU_MASTER , namcos2_68k_master_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE);
633654}
634655
635static int IsSystem21( void )
636{
637   switch( namcos2_gametype )
638   {
639   case NAMCOS21_AIRCOMBAT:
640   case NAMCOS21_STARBLADE:
641   case NAMCOS21_CYBERSLED:
642   case NAMCOS21_SOLVALOU:
643   case NAMCOS21_WINRUN91:
644   case NAMCOS21_DRIVERS_EYES:
645      return 1;
646   default:
647      return 0;
648   }
649}
650
651656static int
652657GetPosIRQScanline( void )
653658{
r1185r1186
683688
684689static TIMER_CALLBACK( namcos2_68k_gpu_posirq )
685690{
691   //printf( "namcos2_68k_gpu_posirq(%d)\n", param );
686692   video_screen_update_partial(0, param);
687693   cpunum_set_input_line(CPU_GPU, namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE);
688694}
689695
690696INTERRUPT_GEN( namcos2_68k_gpu_vblank )
691697{
698   //printf( "namcos2_68k_gpu_vblank(%d)\n",namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] );
692699   if( namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] )
693700   {
694      int scanline = 137;//GetPosIRQScanline();
701      int scanline = 0x50+0x89; /* HACK for Winning Run */
695702      mame_timer_set(video_screen_get_time_until_pos(0, scanline, 0), scanline, namcos2_68k_gpu_posirq );
696703   }
697704   cpunum_set_input_line( CPU_GPU, namcos2_68k_gpu_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE);
src/mame/machine/cclimber.c
r1185r1186
11#include "driver.h"
22#include "includes/cclimber.h"
33
4/* set to 1 to fix protection check after bonus round (see notes in pacman.c driver) */
5#define CANNONB_HACK   0
6
47static void cclimber_decode(const UINT8 convtable[8][16])
58{
69   UINT8 *rom = memory_region(REGION_CPU1);
r1185r1186
8285   cclimber_decode(convtable);
8386}
8487
88DRIVER_INIT( ckongb )
89{
90   int A;
91   UINT8 *rom = memory_region(REGION_CPU1);
92
93   for (A = 0x0000;A < 0x6000;A++) /* all the program ROMs are encrypted */
94   {
95      rom[A] = rom[A] ^ 0xf0;
96   }
97}
98
99#if CANNONB_HACK
100static void cannonb_patch(void)
101{
102   UINT8 *rom = memory_region(REGION_CPU1);
103
104   rom[0x2ba0] = 0x21;
105   rom[0x2ba1] = 0xfb;
106   rom[0x2ba2] = 0x0e;
107   rom[0x2ba3] = 0x00;
108}
109#endif
110
85111DRIVER_INIT( cannonb )
86112{
87113   int A;
88114   UINT8 *rom = memory_region(REGION_CPU1);
89115
90
91116   for (A = 0x0000;A < 0x1000;A++) /* only first ROM is encrypted */
92117   {
93118      UINT8 src;
r1185r1186
102127
103128      rom[A] = src;
104129   }
130
131#if CANNONB_HACK
132   cannonb_patch();
133#endif
105134}
106135
107DRIVER_INIT( ckongb )
136DRIVER_INIT( cannonb2 )
108137{
109   int A;
110   UINT8 *rom = memory_region(REGION_CPU1);
138#if CANNONB_HACK
139   cannonb_patch();
140#endif
141}
111142
112
113   for (A = 0x0000;A < 0x6000;A++) /* all the program ROMs are encrypted */
114   {
115      rom[A] = rom[A] ^ 0xf0;
116   }
117}
src/mame/machine/mcr.c
r1185r1186
267267MACHINE_START( mcr )
268268{
269269   /* initialize the CTC */
270   ctc_intf.baseclock = machine->drv->cpu[0].cpu_clock;
270   ctc_intf.baseclock = machine->drv->cpu[0].clock;
271271   z80ctc_init(0, &ctc_intf);
272272
273273   state_save_register_global(mcr_cocktail_flip);
r1185r1186
277277MACHINE_START( nflfoot )
278278{
279279   /* initialize the CTC */
280   ctc_intf.baseclock = machine->drv->cpu[0].cpu_clock;
280   ctc_intf.baseclock = machine->drv->cpu[0].clock;
281281   z80ctc_init(0, &ctc_intf);
282282
283   nflfoot_ctc_intf.baseclock = machine->drv->cpu[3].cpu_clock;
283   nflfoot_ctc_intf.baseclock = machine->drv->cpu[3].clock;
284284   z80ctc_init(1, &nflfoot_ctc_intf);
285285
286286   z80pio_init(0, &nflfoot_pio_intf);
287287   z80pio_init(1, &nflfoot_pio_intf);
288288
289   nflfoot_sio_intf.baseclock = machine->drv->cpu[3].cpu_clock;
289   nflfoot_sio_intf.baseclock = machine->drv->cpu[3].clock;
290290   z80sio_init(0, &nflfoot_sio_intf);
291291
292292   /* allocate a timer for the IPU watchdog */
r1185r1186
364364   }
365365
366366   /* initialize the clock */
367   m6840_internal_counter_period = MAME_TIME_IN_HZ(Machine->drv->cpu[0].cpu_clock / 10);
367   m6840_internal_counter_period = MAME_TIME_IN_HZ(Machine->drv->cpu[0].clock / 10);
368368
369369   /* reset cocktail flip */
370370   mcr_cocktail_flip = 0;
src/mame/machine/slapstic.c
r1185r1186
815815   slapstic_reset();
816816
817817   /* see if we're 68k or 6502/6809 based */
818   access_68k = (Machine->drv->cpu[0].cpu_type != CPU_M6809 &&
819              Machine->drv->cpu[0].cpu_type != CPU_M6502);
818   access_68k = (Machine->drv->cpu[0].type != CPU_M6809 &&
819              Machine->drv->cpu[0].type != CPU_M6502);
820820}
821821
822822
src/mame/mamedriv.c
r1185r1186
369369   DRIVER( clshroad )   /* (c) 1986 Woodplace Inc. */
370370   DRIVER( clshrdst )   /* (c) 1986 Status Games */
371371   DRIVER( tubep )      /* (c) 1984 + Fujitek */
372   DRIVER( tubepb )   /* (c) 1984 + bootleg */
372373   DRIVER( rjammer )   /* (c) 1984 + Alice */
373374   DRIVER( magmax )   /* (c) 1985 */
374375   DRIVER( cop01 )      /* (c) 1985 */
r1185r1186
47744775   DRIVER( gticlubj )   /* GX688 (c)1996 */
47754776   DRIVER( hangplt )   /* GX685 (c)1997 */
47764777   DRIVER( nbapbp )   /* GX778 (c)1998 */
4778   DRIVER( terabrst )   /* GX??? (c)1998 */
47774779   DRIVER( gradius4 )   /* GX837 (c)1999 */
47784780   DRIVER( sscope )   /* GX830 (c)1999 */
47794781   DRIVER( sscopea )   /* GX830 (c)1999 */
r1185r1186
49154917   DRIVER( asteroib )   /* (bootleg) */
49164918   DRIVER( asterock )   /* Sidam bootleg    (c) 1979 */
49174919   DRIVER( meteorts )   /* VCC bootleg      (c) 1979 */
4920   DRIVER( meteorho )   /* Hoei? bootleg    (c) 1980 */
49184921   DRIVER( astdelux )   /* 0351xx           (c) 1980 */
49194922   DRIVER( astdelu2 )   /* 0351xx           (c) 1980 */
49204923   DRIVER( astdelu1 )   /* 0351xx           (c) 1980 */
r1185r1186
59725975
59735976   /* Midway Zeus games */
59745977   DRIVER( mk4 )      /* (c) 1997 Midway */
5978   DRIVER( mk4a )      /* (c) 1997 Midway */
59755979   DRIVER( invasn )   /* (c) 1999 Midway */
59765980   DRIVER( crusnexo )   /* (c) 1999 Midway */
59775981   DRIVER( thegrid )   /* (c) 2001 Midway */
r1185r1186
61286132   DRIVER( sdgndmps )   /* (c) Banpresto / Bandai (Japan) */
61296133   DRIVER( dcon )      /* (c) 1992 Success */
61306134   DRIVER( sengokmj )   /* (c) 1991 Sigma */
6135   DRIVER( totmejan )   /* (c) 1991 Seibu/Tecmo */
6136   DRIVER( goodejan )   /* (c) 1991 Seibu/Tecmo */
6137   DRIVER( goodejaa )   /* (c) 1991 Seibu/Tecmo */
61316138
61326139
61336140   DRIVER( raiden2 )   /* (c) 1993 Seibu Kaihatsu + Fabtek license */
r1185r1186
63566363   DRIVER( welltrij )   /* (c) 1991 Video System Co. (Japan) */
63576364   DRIVER( quiz18k )   /* (c) 1992 EIM (Welltris hardware) */
63586365   DRIVER( f1gp )      /* (c) 1991 Video System Co. */
6359   DRIVER( sf1gp )      /* bootleg */
6366   DRIVER( f1gpb )      /* bootleg */
63606367   DRIVER( f1gp2 )      /* (c) 1992 Video System Co. */
63616368   DRIVER( crshrace )   /* (c) 1993 Video System Co. */
63626369   DRIVER( crshrac2 )   /* (c) 1993 Video System Co. */
r1185r1186
78117818   DRIVER( eshb )      /* (c) 1984 Funai / Gakken */
78127819   DRIVER( comebaby )   /* (c) 2000 ExPotato */
78137820   DRIVER( peplus )   /* (c) 1987 IGT - International Gaming Technology */
7821    DRIVER( pepp0188 )   /* (c) 1987 IGT - International Gaming Technology */
7822    DRIVER( peset038 )   /* (c) 1987 IGT - International Gaming Technology */
78147823   DRIVER( mirage )   /* (c) 1994 Mitchell */
78157824   DRIVER( dominob )   /* (c) 1990 Wonwoo Systems */
78167825   DRIVER( jongkyo )   /* (c) 1985 Kiwako */
78177826   DRIVER( gtipoker )   /* (c) 1983 GTI Inc */
7827   DRIVER( gamecstl )   /* MAME based bootleg */
78187828
78197829#endif   /* DRIVER_RECURSIVE */
src/mame/includes/gaelco3d.h
r1185r1186
66
77**************************************************************************/
88
9/* should be 1, but can increased to 2 or 3 for speed */
10#define GAELCO3D_RESOLUTION_DIVIDE   1
119
12
1310/*----------- defined in video/gaelco3d.c -----------*/
1411
1512extern UINT8 *gaelco3d_texture;
src/mame/includes/f1gp.h
r1185r1186
33extern UINT16 *f1gp_spr1vram,*f1gp_spr2vram,*f1gp_spr1cgram,*f1gp_spr2cgram;
44extern UINT16 *f1gp_fgvideoram,*f1gp_rozvideoram;
55extern UINT16 *f1gp2_sprcgram,*f1gp2_spritelist;
6extern UINT16 *f1gpb_rozregs, *f1gpb_fgregs;
67extern size_t f1gp_spr1cgram_size,f1gp_spr2cgram_size;
78
89
910VIDEO_START( f1gp );
11VIDEO_START( f1gpb );
1012VIDEO_START( f1gp2 );
1113VIDEO_UPDATE( f1gp );
14VIDEO_UPDATE( f1gpb );
1215VIDEO_UPDATE( f1gp2 );
1316
1417READ16_HANDLER( f1gp_zoomdata_r );
src/mame/includes/cclimber.h
r1185r1186
44DRIVER_INIT( cclimbrj );
55DRIVER_INIT( mshuttle );
66DRIVER_INIT( cannonb );
7DRIVER_INIT( cannonb2 );
78DRIVER_INIT( ckongb );
89
910/*----------- defined in video/cclimber.c -----------*/
src/mame/mame.mak
r1185r1186
11831183   $(DRIVERS)/dcon.o $(VIDEO)/dcon.o \
11841184   $(DRIVERS)/deadang.o $(VIDEO)/deadang.o \
11851185   $(DRIVERS)/dynduke.o $(VIDEO)/dynduke.o \
1186   $(DRIVERS)/goodejan.o $(VIDEO)/goodejan.o \
11861187   $(DRIVERS)/kncljoe.o $(VIDEO)/kncljoe.o \
11871188   $(DRIVERS)/mustache.o $(VIDEO)/mustache.o \
11881189   $(DRIVERS)/panicr.o \
r1185r1186
15231524   $(DRIVERS)/fortecar.o \
15241525   $(DRIVERS)/freekick.o $(VIDEO)/freekick.o \
15251526   $(DRIVERS)/funworld.o $(VIDEO)/funworld.o \
1527   $(DRIVERS)/gamecstl.o \
15261528   $(DRIVERS)/gdrawpkr.o $(VIDEO)/gdrawpkr.o \
15271529   $(DRIVERS)/gtipoker.o \
15281530   $(DRIVERS)/go2000.o \
r1185r1186
16771679
16781680$(DRIVERS)/nbmj8688.o:   $(LAYOUT)/nbmj8688.lh
16791681
1682$(DRIVERS)/peplus.o:   $(LAYOUT)/peplus.lh \
1683                  $(LAYOUT)/pepp0188.lh \
1684                  $(LAYOUT)/peset038.lh
1685
16801686$(DRIVERS)/pmpoker.o:   $(LAYOUT)/pmpoker.lh \
16811687                  $(LAYOUT)/goldnpkr.lh \
16821688                  $(LAYOUT)/pottnpkr.lh
src/mame/video/goodejan.c
r0r1186
1#include "driver.h"
2
3static tilemap *bg_tilemap, *tx_tilemap;
4UINT16 *goodejan_bgvram,*goodejan_txvram;
5
6WRITE16_HANDLER( goodejan_bgvram_w )
7{
8   COMBINE_DATA(&goodejan_bgvram[offset]);
9   tilemap_mark_tile_dirty(bg_tilemap,offset);
10}
11
12WRITE16_HANDLER( goodejan_txvram_w )
13{
14   COMBINE_DATA(&goodejan_txvram[offset]);
15   tilemap_mark_tile_dirty(tx_tilemap,offset);
16}
17
18static TILE_GET_INFO( goodejan_bg_tile_info )
19{
20   int tile = goodejan_bgvram[tile_index]&0x0fff;
21   int color = (goodejan_bgvram[tile_index]&0xf000)>>12;
22
23   // WRONG!
24   if ((goodejan_bgvram[tile_index]&0x8000)==0x0000) tile+=0x1000;
25
26   SET_TILE_INFO(1, tile, color, 0);
27}
28
29static TILE_GET_INFO( goodejan_tx_tile_info )
30{
31   int tile = goodejan_txvram[tile_index];
32   int color = (tile >> 12) & 0x0f;
33   SET_TILE_INFO(2, (tile & 0xfff) + 0x3000, color, 0);
34}
35
36static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri)
37{
38   int offs,fx,fy,x,y,color,sprite;
39   int dx,dy,ax,ay;
40
41   for (offs = 0x400-4;offs >= 0;offs -= 4)
42   {
43      if ((spriteram16[offs+0]&0x8000)!=0x8000) continue;
44      sprite = spriteram16[offs+1];
45      if ((sprite>>14)!=pri) continue;
46      sprite &= 0x1fff;
47
48      y = spriteram16[offs+3];//&0x1ff;
49      x = spriteram16[offs+2];//&0x1ff;
50
51      if (spriteram16[offs+2]&0x8000) x=0x10000-x;
52      if (spriteram16[offs+3]&0x8000) y=0x10000-y;
53
54      color = spriteram16[offs+0]&0x3f;
55      fx = spriteram16[offs+0]&0x40;
56      fy = 0; /* To do - probably 0x2000 */
57      dy = ((spriteram16[offs+0]&0x0380)>>7) + 1;
58      dx = ((spriteram16[offs+0]&0x1c00)>>10) + 1;
59
60      for (ax=0; ax<dx; ax++)
61         for (ay=0; ay<dy; ay++) {
62            if (!fx)
63               drawgfx(bitmap,machine->gfx[0],
64                  sprite++,
65                  color,fx,fy,x+ax*16,y+ay*16,
66                  cliprect,TRANSPARENCY_PEN,15);
67            else
68               drawgfx(bitmap,machine->gfx[0],
69                  sprite++,
70                  color,fx,fy,x+(dx-1-ax)*16,y+ay*16,
71                  cliprect,TRANSPARENCY_PEN,15);
72         }
73   }
74}
75
76
77WRITE16_HANDLER( goodejan_bg_scrollx_w )
78{
79   tilemap_set_scrollx(bg_tilemap,0, data);
80}
81
82WRITE16_HANDLER( goodejan_bg_scrolly_w )
83{
84   tilemap_set_scrolly(bg_tilemap,0, data);
85}
86
87VIDEO_START( goodejan )
88{
89   bg_tilemap = tilemap_create(goodejan_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     16,16,32,32);
90   tx_tilemap = tilemap_create(goodejan_tx_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,32,32);
91   tilemap_set_transparent_pen(tx_tilemap,15);
92}
93
94VIDEO_UPDATE( goodejan )
95{
96   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
97   draw_sprites(machine, bitmap,cliprect, 2);
98   draw_sprites(machine, bitmap,cliprect, 1);
99   draw_sprites(machine, bitmap,cliprect, 0);
100   tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
101   draw_sprites(machine, bitmap,cliprect, 3);
102
103   return 0;
104}
src/mame/video/gaelco3d.c
r1185r1186
88
99#include "driver.h"
1010#include "gaelco3d.h"
11#include "video/poly.h"
11#include "video/polynew.h"
1212
1313UINT8 *gaelco3d_texture;
1414UINT8 *gaelco3d_texmask;
r1185r1186
3232static mame_bitmap *zbuffer;
3333static UINT16 *palette;
3434static UINT32 *polydata_buffer;
35static UINT32 polydata_start;
3635static UINT32 polydata_count;
3736
3837static int polygons;
3938static int lastscan;
4039static int video_changed;
4140
42static osd_work_queue *work_queue;
41static poly_manager *poly;
4342
44static int this_skip;
4543
44typedef struct _poly_extra_data poly_extra_data;
45struct _poly_extra_data
46{
47   UINT32 tex, color;
48   float ooz_dx, ooz_dy, ooz_base;
49   float uoz_dx, uoz_dy, uoz_base;
50   float voz_dx, voz_dy, voz_base;
51   float z0;
52};
4653
4754
55static void render_noz_noperspective(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
56static void render_normal(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
57static void render_alphablend(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
58
59
60
4861/*************************************
4962 *
5063 *  Video init
r1185r1186
5366
5467static void gaelco3d_exit(running_machine *machine)
5568{
56   osd_work_queue_free(work_queue);
69   poly_free(poly);
5770}
5871
5972
6073VIDEO_START( gaelco3d )
6174{
75   poly = poly_alloc(2000, sizeof(poly_extra_data), 0);
76   add_exit_callback(machine, gaelco3d_exit);
77
6278   screenbits = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
6379
6480   zbuffer = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED16);
r1185r1186
6682   palette = auto_malloc(32768 * sizeof(palette[0]));
6783   polydata_buffer = auto_malloc(MAX_POLYDATA * sizeof(polydata_buffer[0]));
6884
69   work_queue = osd_work_queue_alloc(0);
70   add_exit_callback(machine, gaelco3d_exit);
71
7285   /* save states */
7386
7487   state_save_register_global_pointer(palette, 32768);
7588   state_save_register_global_pointer(polydata_buffer, MAX_POLYDATA);
76   state_save_register_global(polydata_start);
7789   state_save_register_global(polydata_count);
7890
7991   state_save_register_global(polygons);
r1185r1186
128140 *
129141 *************************************/
130142
131static void *render_poly(void *param)
132{
133   UINT32 *polydata = param;
143/*
144    Polygon data stream format:
134145
135   /* these three parameters combine via A * x + B * y + C to produce a 1/z value */
136   float ooz_dx = dsp_to_float(polydata[4]) * GAELCO3D_RESOLUTION_DIVIDE;
137   float ooz_dy = dsp_to_float(polydata[3]) * GAELCO3D_RESOLUTION_DIVIDE;
138   float ooz_base = dsp_to_float(polydata[8]);
146    data[0]  (float) = scale factor to map Z to fixed Z buffer value
147    data[1]  (float) = dvoz/dy (change in v/z per Y)
148    data[2]  (float) = dvoz/dx (change in v/z per X)
149    data[3]  (float) = dooz/dy (change in 1/z per Y)
150    data[4]  (float) = dooz/dx (change in 1/z per X)
151    data[5]  (float) = duoz/dy (change in u/z per Y)
152    data[6]  (float) = duoz/dx (change in u/z per X)
153    data[7]  (float) = voz origin (value of v/z at coordinate (0,0))
154    data[8]  (float) = ooz origin (value of 1/z at coordinate (0,0))
155    data[9]  (float) = uoz origin (value of u/z at coordinate (0,0))
156    data[10] (int)   = palette base (bits 14-8)
157    data[11] (int)   = texture address
158    data[12] (int)   = start point (bits 15-8 = X coordinate, bits 12-0 = Y coordinate)
159    data[13] (int)   = next point (bits 15-8 = X coordinate, bits 12-0 = Y coordinate)
160    data[14] (int)   = 16.16 dx/dy from previous point to this point
161    (repeat these two for each additional point in the fan)
162*/
139163
140   /* these three parameters combine via A * x + B * y + C to produce a u/z value */
141   float uoz_dx = dsp_to_float(polydata[6]) * GAELCO3D_RESOLUTION_DIVIDE;
142   float uoz_dy = dsp_to_float(polydata[5]) * GAELCO3D_RESOLUTION_DIVIDE;
143   float uoz_base = dsp_to_float(polydata[9]);
144
145   /* these three parameters combine via A * x + B * y + C to produce a v/z value */
146   float voz_dx = dsp_to_float(polydata[2]) * GAELCO3D_RESOLUTION_DIVIDE;
147   float voz_dy = dsp_to_float(polydata[1]) * GAELCO3D_RESOLUTION_DIVIDE;
148   float voz_base = dsp_to_float(polydata[7]);
149
150   /* this parameter is used to scale 1/z to a formal Z buffer value */
164static void render_poly(UINT32 *polydata)
165{
166   float midx = Machine->screen[0].width / 2;
167   float midy = Machine->screen[0].height / 2;
151168   float z0 = dsp_to_float(polydata[0]);
152
153   /* these two parameters are the X,Y origin of the texture data */
154   int xorigin = (INT32)polydata[12] >> 16;
155   int yorigin = (INT32)(polydata[12] << 18) >> 18;
156
169   float voz_dy = dsp_to_float(polydata[1]);
170   float voz_dx = dsp_to_float(polydata[2]);
171   float ooz_dy = dsp_to_float(polydata[3]);
172   float ooz_dx = dsp_to_float(polydata[4]);
173   float uoz_dy = dsp_to_float(polydata[5]);
174   float uoz_dx = dsp_to_float(polydata[6]);
175   float voz_base = dsp_to_float(polydata[7]) - midx * voz_dx - midy * voz_dy;
176   float ooz_base = dsp_to_float(polydata[8]) - midx * ooz_dx - midy * ooz_dy;
177   float uoz_base = dsp_to_float(polydata[9]) - midx * uoz_dx - midy * uoz_dy;
157178   int color = (polydata[10] & 0x7f) << 8;
158   int midx = Machine->screen[0].width/2;
159   int midy = Machine->screen[0].height/2;
160   struct poly_vertex vert[3];
161   rectangle clip;
179   poly_vertex vert[3];
162180   int i;
163181
164   // shut up the compiler
165   (void)xorigin;
166   (void)yorigin;
167
168   if (LOG_POLYGONS && input_code_pressed(KEYCODE_LSHIFT))
182   if (LOG_POLYGONS)
169183   {
170184      int t;
171      mame_printf_debug("poly: %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %08X %08X (%4d,%4d) %08X",
185      logerror("poly: %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %08X %08X (%4d,%4d) %08X",
172186            (double)dsp_to_float(polydata[0]),
173187            (double)dsp_to_float(polydata[1]),
174188            (double)dsp_to_float(polydata[2]),
r1185r1186
183197            polydata[11],
184198            (INT16)(polydata[12] >> 16), (INT16)(polydata[12] << 2) >> 2, polydata[12]);
185199
186      mame_printf_debug(" (%4d,%4d) %08X %08X", (INT16)(polydata[13] >> 16), (INT16)(polydata[13] << 2) >> 2, polydata[13], polydata[14]);
200      logerror(" (%4d,%4d) %08X %08X", (INT16)(polydata[13] >> 16), (INT16)(polydata[13] << 2) >> 2, polydata[13], polydata[14]);
187201      for (t = 15; !IS_POLYEND(polydata[t - 2]); t += 2)
188         mame_printf_debug(" (%4d,%4d) %08X %08X", (INT16)(polydata[t] >> 16), (INT16)(polydata[t] << 2) >> 2, polydata[t], polydata[t+1]);
189      mame_printf_debug("\n");
202         logerror(" (%4d,%4d) %08X %08X", (INT16)(polydata[t] >> 16), (INT16)(polydata[t] << 2) >> 2, polydata[t], polydata[t+1]);
203      logerror("\n");
190204   }
191205
192   /* compute the adjusted clip */
193   clip.min_x = Machine->screen[0].visarea.min_x - midx;
194   clip.min_y = midy - Machine->screen[0].visarea.max_y;
195   clip.max_x = Machine->screen[0].visarea.max_x - midx;
196   clip.max_y = midy - Machine->screen[0].visarea.min_y;
197
198206   /* extract the first two vertices */
199   vert[0].x = (((INT32)polydata[13] >> 16) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE;
200   vert[0].y = (((INT32)(polydata[13] << 18) >> 18) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE;
201   vert[1].x = (((INT32)polydata[15] >> 16) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE;
202   vert[1].y = (((INT32)(polydata[15] << 18) >> 18) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE;
207   vert[0].x = midx + (float)((INT32)polydata[13] >> 16) + 0.5f;
208   vert[0].y = midy + ((float)((INT32)(polydata[13] << 18) >> 18) + 0.5f);
209   vert[1].x = midx + (float)((INT32)polydata[15] >> 16) + 0.5f;
210   vert[1].y = midy + ((float)((INT32)(polydata[15] << 18) >> 18) + 0.5f);
203211
204212   /* loop over the remaining verticies */
205213   for (i = 17; !IS_POLYEND(polydata[i - 2]) && i < 1000; i += 2)
206214   {
207      offs_t endmask = gaelco3d_texture_size - 1;
208      const struct poly_scanline_data *scans;
209      UINT32 tex = polydata[11];
210      int x, y;
215      poly_extra_data *extra = poly_get_extra_data(poly);
211216
217      /* fill in core extra data */
218      extra->tex = polydata[11];
219      extra->color = color;
220      extra->ooz_dx = ooz_dx;
221      extra->ooz_dy = ooz_dy;
222      extra->ooz_base = ooz_base;
223      extra->uoz_dx = uoz_dx;
224      extra->uoz_dy = uoz_dy;
225      extra->uoz_base = uoz_base;
226      extra->voz_dx = voz_dx;
227      extra->voz_dy = voz_dy;
228      extra->voz_base = voz_base;
229      extra->z0 = z0;
230
212231      /* extract vertex 2 */
213      vert[2].x = (((INT32)polydata[i] >> 16) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE;
214      vert[2].y = (((INT32)(polydata[i] << 18) >> 18) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE;
232      vert[2].x = midx + (float)((INT32)polydata[i] >> 16) + 0.5f;
233      vert[2].y = midy + (float)((INT32)(polydata[i] << 18) >> 18) + 0.5f;
215234
216      /* compute the scanning parameters */
217      scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], &clip);
218      if (scans)
235      /* special case: no Z buffering and no perspective correction */
236      if (color != 0x7f00 && z0 < 0 && ooz_dx == 0 && ooz_dy == 0)
237         poly_render_triangle(poly, screenbits, &Machine->screen[0].visarea, render_noz_noperspective, 0, &vert[0], &vert[1], &vert[2]);
238
239      /* general case: non-alpha blended */
240      else if (color != 0x7f00)
241         poly_render_triangle(poly, screenbits, &Machine->screen[0].visarea, render_normal, 0, &vert[0], &vert[1], &vert[2]);
242
243      /* color 0x7f seems to be hard-coded as a 50% alpha blend */
244      else
245         poly_render_triangle(poly, screenbits, &Machine->screen[0].visarea, render_alphablend, 0, &vert[0], &vert[1], &vert[2]);
246
247      /* copy vertex 2 to vertex 1 -- this hardware draws in fans */
248      vert[1] = vert[2];
249      polygons++;
250   }
251}
252
253
254
255static void render_noz_noperspective(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
256{
257   poly_extra_data *extra = poly->extra;
258   mame_bitmap *bitmap = destbase;
259   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
260   UINT16 *zbuf = BITMAP_ADDR16(zbuffer, scanline, 0);
261   float zbase = 1.0f / extra->ooz_base;
262   float uoz = (extra->uoz_base + scanline * extra->uoz_dy + startx * extra->uoz_dx) * zbase;
263   float voz = (extra->voz_base + scanline * extra->voz_dy + startx * extra->voz_dx) * zbase;
264   float uoz_step = extra->uoz_dx * zbase;
265   float voz_step = extra->voz_dx * zbase;
266   int zbufval = (int)(-extra->z0 * zbase);
267   offs_t endmask = gaelco3d_texture_size - 1;
268   UINT16 color = extra->color;
269   UINT32 tex = extra->tex;
270   int x;
271
272   for (x = startx; x < stopx; x++)
273   {
274      int pixeloffs, u, v;
275
276      if (!BILINEAR_FILTER)
219277      {
220         int pixeloffs, zbufval, u, v;
221#if (BILINEAR_FILTER)
222         int paldata, r, g, b, f, tf;
223#endif
224         /* special case: no Z buffering and no perspective correction */
225         if (color != 0x7f00 && z0 < 0 && ooz_dx == 0 && ooz_dy == 0)
278         u = (int)(uoz + 0.5f); v = (int)(voz + 0.5f);
279         pixeloffs = (tex + v * 4096 + u) & endmask;
280         if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
226281         {
227            float zbase = 1.0f / ooz_base;
228            float uoz_step = uoz_dx * zbase;
229            float voz_step = voz_dx * zbase;
230            zbufval = (int)(-z0 * zbase);
282            dest[x] = palette[color | gaelco3d_texture[pixeloffs]];
283            zbuf[x] = zbufval;
284         }
285      }
286      else
287      {
288         u = (int)(uoz * 256.0f); v = (int)(voz * 256.0f);
289         pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask;
290         if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
291         {
292            int paldata, r, g, b, f, tf;
231293
232            /* loop over scanlines */
233            for (y = scans->sy; y <= scans->ey; y++)
234            {
235               const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
236               UINT16 *dest = BITMAP_ADDR16(screenbits, midy - y, midx);
237               UINT16 *zbuf = BITMAP_ADDR16(zbuffer, midy - y, midx);
238               float uoz = (uoz_dy * y + scan->sx * uoz_dx + uoz_base) * zbase;
239               float voz = (voz_dy * y + scan->sx * voz_dx + voz_base) * zbase;
294            paldata = palette[color | gaelco3d_texture[pixeloffs]];
295            tf = f = (~u & 0xff) * (~v & 0xff);
296            r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f;
240297
241               for (x = scan->sx; x <= scan->ex; x++)
242               {
243#if (!BILINEAR_FILTER)
244                  u = (int)(uoz + 0.5); v = (int)(voz + 0.5);
245                  pixeloffs = (tex + v * 4096 + u) & endmask;
246                  if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
247                  {
248                     dest[x] = palette[color | gaelco3d_texture[pixeloffs]];
249                     zbuf[x] = zbufval;
250                  }
251#else
252                  u = (int)(uoz * 256.0); v = (int)(voz * 256.0);
253                  pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask;
254                  if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
255                  {
256                     paldata = palette[color | gaelco3d_texture[pixeloffs]];
257                     tf = f = (~u & 0xff) * (~v & 0xff);
258                     r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f;
298            paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]];
299            tf += f = (u & 0xff) * (~v & 0xff);
300            r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
259301
260                     paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]];
261                     tf += f = (u & 0xff) * (~v & 0xff);
262                     r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
302            paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]];
303            tf += f = (~u & 0xff) * (v & 0xff);
304            r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
263305
264                     paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]];
265                     tf += f = (~u & 0xff) * (v & 0xff);
266                     r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
306            paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]];
307            f = 0x10000 - tf;
308            r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
267309
268                     paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]];
269                     f = 0x10000 - tf;
270                     r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
271
272                     dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16);
273                     zbuf[x] = zbufval;
274                  }
275#endif
276                  /* advance texture params to the next pixel */
277                  uoz += uoz_step;
278                  voz += voz_step;
279               }
280            }
310            dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16);
311            zbuf[x] = zbufval;
281312         }
313      }
282314
283         /* general case: non-alpha blended */
284         else if (color != 0x7f00)
315      /* advance texture params to the next pixel */
316      uoz += uoz_step;
317      voz += voz_step;
318   }
319}
320
321
322static void render_normal(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
323{
324   poly_extra_data *extra = poly->extra;
325   mame_bitmap *bitmap = destbase;
326   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
327   UINT16 *zbuf = BITMAP_ADDR16(zbuffer, scanline, 0);
328   float ooz_dx = extra->ooz_dx;
329   float uoz_dx = extra->uoz_dx;
330   float voz_dx = extra->voz_dx;
331   float ooz = extra->ooz_base + scanline * extra->ooz_dy + startx * ooz_dx;
332   float uoz = extra->uoz_base + scanline * extra->uoz_dy + startx * uoz_dx;
333   float voz = extra->voz_base + scanline * extra->voz_dy + startx * voz_dx;
334   offs_t endmask = gaelco3d_texture_size - 1;
335   UINT16 color = extra->color;
336   UINT32 tex = extra->tex;
337   float z0 = extra->z0;
338   int x;
339
340   for (x = startx; x < stopx; x++)
341   {
342      if (ooz > 0)
343      {
344         /* compute Z and check the Z buffer value first */
345         float z = 1.0f / ooz;
346         int zbufval = (int)(z0 * z);
347         if (zbufval < zbuf[x] || zbufval < 0)
285348         {
286            /* loop over scanlines */
287            for (y = scans->sy; y <= scans->ey; y++)
349            int pixeloffs, u, v;
350
351            if (!BILINEAR_FILTER)
288352            {
289               const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
290               UINT16 *dest = BITMAP_ADDR16(screenbits, midy - y, midx);
291               UINT16 *zbuf = BITMAP_ADDR16(zbuffer, midy - y, midx);
292               float ooz = ooz_dy * y + scan->sx * ooz_dx + ooz_base;
293               float uoz = uoz_dy * y + scan->sx * uoz_dx + uoz_base;
294               float voz = voz_dy * y + scan->sx * voz_dx + voz_base;
295
296               for (x = scan->sx; x <= scan->ex; x++)
353               u = (int)(uoz * z + 0.5f); v = (int)(voz * z + 0.5f);
354               pixeloffs = (tex + v * 4096 + u) & endmask;
355               if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
297356               {
298                  if (ooz > 0)
299                  {
300                     /* compute Z and check the Z buffer value first */
301                     float z = 1.0f / ooz;
302                     zbufval = (int)(z0 * z);
303                     if (zbufval < zbuf[x] || zbufval < 0)
304                     {
305#if (!BILINEAR_FILTER)
306                        u = (int)(uoz * z + 0.5); v = (int)(voz * z + 0.5);
307                        pixeloffs = (tex + v * 4096 + u) & endmask;
308                        if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
309                        {
310                           dest[x] = palette[color | gaelco3d_texture[pixeloffs]];
311                           zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
312                        }
313#else
314                        u = (int)(uoz * z * 256.0); v = (int)(voz * z * 256.0);
315                        pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask;
316                        if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
317                        {
318                           paldata = palette[color | gaelco3d_texture[pixeloffs]];
319                           tf = f = (~u & 0xff) * (~v & 0xff);
320                           r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f;
357                  dest[x] = palette[color | gaelco3d_texture[pixeloffs]];
358                  zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
359               }
360            }
361            else
362            {
363               u = (int)(uoz * z * 256.0f); v = (int)(voz * z * 256.0f);
364               pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask;
365               if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
366               {
367                  int paldata, r, g, b, f, tf;
321368
322                           paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]];
323                           tf += f = (u & 0xff) * (~v & 0xff);
324                           r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
369                  paldata = palette[color | gaelco3d_texture[pixeloffs]];
370                  tf = f = (~u & 0xff) * (~v & 0xff);
371                  r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f;
325372
326                           paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]];
327                           tf += f = (~u & 0xff) * (v & 0xff);
328                           r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
373                  paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]];
374                  tf += f = (u & 0xff) * (~v & 0xff);
375                  r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
329376
330                           paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]];
331                           f = 0x10000 - tf;
332                           r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
377                  paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]];
378                  tf += f = (~u & 0xff) * (v & 0xff);
379                  r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
333380
334                           dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16);
335                           zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
336                        }
337#endif
338                     }
339                  }
381                  paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]];
382                  f = 0x10000 - tf;
383                  r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
340384
341                  /* advance texture params to the next pixel */
342                  ooz += ooz_dx;
343                  uoz += uoz_dx;
344                  voz += voz_dx;
385                  dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16);
386                  zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
345387               }
346388            }
347389         }
390      }
348391
349         /* color 0x7f seems to be hard-coded as a 50% alpha blend */
350         else
392      /* advance texture params to the next pixel */
393      ooz += ooz_dx;
394      uoz += uoz_dx;
395      voz += voz_dx;
396   }
397}
398
399
400static void render_alphablend(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
401{
402   poly_extra_data *extra = poly->extra;
403   mame_bitmap *bitmap = destbase;
404   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
405   UINT16 *zbuf = BITMAP_ADDR16(zbuffer, scanline, 0);
406   float ooz_dx = extra->ooz_dx;
407   float uoz_dx = extra->uoz_dx;
408   float voz_dx = extra->voz_dx;
409   float ooz = extra->ooz_base + extra->ooz_dy * scanline + startx * ooz_dx;
410   float uoz = extra->uoz_base + extra->uoz_dy * scanline + startx * uoz_dx;
411   float voz = extra->voz_base + extra->voz_dy * scanline + startx * voz_dx;
412   offs_t endmask = gaelco3d_texture_size - 1;
413   UINT16 color = extra->color;
414   UINT32 tex = extra->tex;
415   float z0 = extra->z0;
416   int x;
417
418   for (x = startx; x < stopx; x++)
419   {
420      if (ooz > 0)
421      {
422         /* compute Z and check the Z buffer value first */
423         float z = 1.0f / ooz;
424         int zbufval = (int)(z0 * z);
425         if (zbufval < zbuf[x] || zbufval < 0)
351426         {
352            /* loop over scanlines */
353            for (y = scans->sy; y <= scans->ey; y++)
427            int pixeloffs, u, v;
428
429            if (!BILINEAR_FILTER)
354430            {
355               const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
356               UINT16 *dest = BITMAP_ADDR16(screenbits, midy - y, midx);
357               UINT16 *zbuf = BITMAP_ADDR16(zbuffer, midy - y, midx);
358               float ooz = ooz_dy * y + scan->sx * ooz_dx + ooz_base;
359               float uoz = uoz_dy * y + scan->sx * uoz_dx + uoz_base;
360               float voz = voz_dy * y + scan->sx * voz_dx + voz_base;
361
362               for (x = scan->sx; x <= scan->ex; x++)
431               u = (int)(uoz * z + 0.5f); v = (int)(voz * z + 0.5f);
432               pixeloffs = (tex + v * 4096 + u) & endmask;
433               if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
363434               {
364                  if (ooz > 0)
365                  {
366                     /* compute Z and check the Z buffer value first */
367                     float z = 1.0f / ooz;
368                     zbufval = (int)(z0 * z);
369                     if (zbufval < zbuf[x] || zbufval < 0)
370                     {
371#if (!BILINEAR_FILTER)
372                        u = (int)(uoz * z + 0.5); v = (int)(voz * z + 0.5);
373                        pixeloffs = (tex + v * 4096 + u) & endmask;
374                        if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
375                        {
376                           dest[x] = ((dest[x] >> 1) & 0x3def) + ((palette[color | gaelco3d_texture[pixeloffs]] >> 1) & 0x3def);
377                           zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
378                        }
379#else
380                        u = (int)(uoz * z * 256.0); v = (int)(voz * z * 256.0);
381                        pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask;
382                        if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
383                        {
384                           paldata = palette[color | gaelco3d_texture[pixeloffs]];
385                           tf = f = (~u & 0xff) * (~v & 0xff);
386                           r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f;
435                  dest[x] = ((dest[x] >> 1) & 0x3def) + ((palette[color | gaelco3d_texture[pixeloffs]] >> 1) & 0x3def);
436                  zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
437               }
438            }
439            else
440            {
441               u = (int)(uoz * z * 256.0f); v = (int)(voz * z * 256.0f);
442               pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask;
443               if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs])
444               {
445                  int paldata, r, g, b, f, tf;
387446
388                           paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]];
389                           tf += f = (u & 0xff) * (~v & 0xff);
390                           r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
447                  paldata = palette[color | gaelco3d_texture[pixeloffs]];
448                  tf = f = (~u & 0xff) * (~v & 0xff);
449                  r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f;
391450
392                           paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]];
393                           tf += f = (~u & 0xff) * (v & 0xff);
394                           r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
451                  paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]];
452                  tf += f = (u & 0xff) * (~v & 0xff);
453                  r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
395454
396                           paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]];
397                           f = 0x10000 - tf;
398                           r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
455                  paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]];
456                  tf += f = (~u & 0xff) * (v & 0xff);
457                  r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
399458
400                           paldata = ((r >> 17) & 0x7c00) | ((g >> 17) & 0x03e0) | (b >> 17);
401                           dest[x] = ((dest[x] >> 1) & 0x3def) + (paldata & 0x3def);
402                           zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
403                        }
404#endif
405                     }
406                  }
459                  paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]];
460                  f = 0x10000 - tf;
461                  r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f;
407462
408                  /* advance texture params to the next pixel */
409                  ooz += ooz_dx;
410                  uoz += uoz_dx;
411                  voz += voz_dx;
463                  paldata = ((r >> 17) & 0x7c00) | ((g >> 17) & 0x03e0) | (b >> 17);
464                  dest[x] = ((dest[x] >> 1) & 0x3def) + (paldata & 0x3def);
465                  zbuf[x] = (zbufval < 0) ? -zbufval : zbufval;
412466               }
413467            }
414468         }
415469      }
416470
417      /* copy vertex 2 to vertex 1 -- this hardware draws in fans */
418      vert[1] = vert[2];
471      /* advance texture params to the next pixel */
472      ooz += ooz_dx;
473      uoz += uoz_dx;
474      voz += voz_dx;
419475   }
420
421   polygons++;
422   return NULL;
423476}
424477
425478
426
427479/*************************************
428480 *
429481 *  Scene rendering
r1185r1186
433485void gaelco3d_render(void)
434486{
435487   /* wait for any queued stuff to complete */
436   osd_work_queue_wait(work_queue, 100 * osd_ticks_per_second());
488   poly_wait(poly, "Time to render");
437489
438   /* Every 2nd frame video data is written. Only skip if two frames are skipped */
439   this_skip = video_skip_this_frame();
440
441490#if DISPLAY_STATS
442491{
443492   int scan = video_screen_get_vpos(0);
r1185r1186
445494}
446495#endif
447496
448   polydata_start = polydata_count = 0;
497   polydata_count = 0;
449498   polygons = 0;
450499   lastscan = -1;
451500}
r1185r1186
466515      fatalerror("Out of polygon buffer space!");
467516
468517   /* if we've accumulated a completed poly set of data, queue it */
469   if (!this_skip)
518   if (!video_skip_this_frame())
470519   {
471      int index = polydata_count - 1 - polydata_start;
472      if (index >= 17 && (index % 2) == 1 && IS_POLYEND(data))
520      if (polydata_count >= 18 && (polydata_count % 2) == 1 && IS_POLYEND(polydata_buffer[polydata_count - 2]))
473521      {
474         osd_work_item_queue(work_queue, render_poly, &polydata_buffer[polydata_start], WORK_ITEM_FLAG_AUTO_RELEASE);
475         polydata_start += index + 2;
522         render_poly(&polydata_buffer[0]);
523         polydata_count = 0;
476524      }
477525      video_changed = TRUE;
478526   }
r1185r1186
490538 *
491539 *************************************/
492540
493INLINE void update_palette_entry(offs_t offset, UINT16 data)
494{
495   int r = (data >> 10) & 0x1f;
496   int g = (data >> 5) & 0x1f;
497   int b = (data >> 0) & 0x1f;
498   r = (r << 3) | (r >> 2);
499   g = (g << 3) | (g >> 2);
500   b = (b << 3) | (b >> 2);
501   palette[offset] = data;
502}
503
504
505541WRITE16_HANDLER( gaelco3d_paletteram_w )
506542{
543   poly_wait(poly, "Palette change");
507544   COMBINE_DATA(&paletteram16[offset]);
508   update_palette_entry(offset, paletteram16[offset]);
545   palette[offset] = paletteram16[offset];
509546}
510547
511548
512549WRITE32_HANDLER( gaelco3d_paletteram_020_w )
513550{
551   poly_wait(poly, "Palette change");
514552   COMBINE_DATA(&paletteram32[offset]);
515   update_palette_entry(offset*2+0, paletteram32[offset] >> 16);
516   update_palette_entry(offset*2+1, paletteram32[offset]);
553   palette[offset*2+0] = paletteram32[offset] >> 16;
554   palette[offset*2+1] = paletteram32[offset];
517555}
518556
519557
r1185r1186
567605   else
568606   {
569607      if (video_changed)
570         copybitmap(bitmap, screenbits, 0,0, 0,0, cliprect, TRANSPARENCY_NONE, 0);
608         copybitmap(bitmap, screenbits, 0,1, 0,0, cliprect, TRANSPARENCY_NONE, 0);
571609      ret = video_changed;
572610      video_changed = FALSE;
573611   }
src/mame/video/model2.c
r1185r1186
9999extern UINT32 *model2_textureram1;
100100extern UINT32 *model2_lumaram;
101101
102
102103/*******************************************
103104 *
104105 *  Basic Data Types
r1185r1186
457458   if ( max_z < 0 )
458459      cull = 1;
459460
461   /* set the object's z value */
462   zvalue = raster.triangle_z;
463
464   /* see if we need to recompute min/max z */
465   if ( (attr >> 10) & 3 )
466   {
467      if ( (attr >> 10) & 1 ) /* min value */
468      {
469         zvalue = min_z;
470      }
471      else if ( (attr >> 10) & 2 ) /* max value */
472      {
473         zvalue = max_z;
474      }
475
476      raster.triangle_z = zvalue;
477   }
478
460479   if ( cull == 0 )
461480   {
462481      INT32   clipped_verts;
r1185r1186
475494      {
476495         triangle *ztri;
477496
478         /* set the object's z value */
479         zvalue = raster.triangle_z;
480
481         /* see if we need to recompute min/max z */
482         if ( (attr >> 10) & 3 )
483         {
484            /* update min_z and max_z with the new clipped values */
485            min_z = verts[0].z;
486            max_z = verts[0].z;
487
488            for( i = 1; i < clipped_verts; i++ )
489            {
490               if ( verts[i].z < min_z ) min_z = verts[i].z;
491               if ( verts[i].z > max_z ) max_z = verts[i].z;
492            }
493
494            if ( (attr >> 10) & 1 ) /* min value */
495            {
496               zvalue = min_z;
497            }
498            else if ( (attr >> 10) & 2 ) /* max value */
499            {
500               zvalue = max_z;
501            }
502
503            raster.triangle_z = zvalue;
504         }
505
506497         /* adjust and set the object z-sort value */
507498         object.z = float_to_zval( zvalue + raster.z_adjust );
508499
r1185r1186
703694   if ( max_z < 0 )
704695      cull = 1;
705696
697   /* set the object's z value */
698   zvalue = raster.triangle_z;
699
700   /* see if we need to recompute min/max z */
701   if ( (attr >> 10) & 3 )
702   {
703      if ( (attr >> 10) & 1 ) /* min value */
704      {
705         zvalue = min_z;
706      }
707      else if ( (attr >> 10) & 2 ) /* max value */
708      {
709         zvalue = max_z;
710      }
711
712      raster.triangle_z = zvalue;
713   }
714
706715   /* if we're not culling, do z-clip and add to out triangle list */
707716   if ( cull == 0 )
708717   {
r1185r1186
722731      {
723732         triangle *ztri;
724733
725         /* set the object's z value */
726         zvalue = raster.triangle_z;
727
728         /* see if we need to recompute min/max z */
729         if ( (attr >> 10) & 3 )
730         {
731            /* update min_z and max_z with the new clipped values */
732            min_z = verts[0].z;
733            max_z = verts[0].z;
734
735            for( i = 1; i < clipped_verts; i++ )
736            {
737               if ( verts[i].z < min_z ) min_z = verts[i].z;
738               if ( verts[i].z > max_z ) max_z = verts[i].z;
739            }
740
741            if ( (attr >> 10) & 1 ) /* min value */
742            {
743               zvalue = min_z;
744            }
745            else if ( (attr >> 10) & 2 ) /* max value */
746            {
747               zvalue = max_z;
748            }
749
750            raster.triangle_z = zvalue;
751         }
752
753734         /* adjust and set the object z-sort value */
754735         object.z = float_to_zval( zvalue + raster.z_adjust );
755736
r1185r1186
27142695
27152696VIDEO_UPDATE(model2)
27162697{
2698   logerror("--- frame ---\n");
2699
27172700   sys24_tile_update(machine);
27182701   fillbitmap(bitmap, machine->pens[0], &machine->screen[0].visarea);
27192702   fillbitmap(sys24_bitmap, 0, &machine->screen[0].visarea);
src/mame/video/namcos21.c
r1185r1186
44- sprite hardware is identical to Namco System NB1
55- there are no tilemaps
66- 3d graphics are managed by DSP processors
7
8TODO: use fixed point arithmetic while rendering quads
9TODO: need proper depth cueing tables
107*/
118
129#include "driver.h"
r1185r1186
1815
1916/* work (hidden) framebuffer */
2017static UINT16 *mpPolyFrameBufferPens;
21static INT16 *mpPolyFrameBufferZ;
18static UINT16 *mpPolyFrameBufferZ;
2219
2320/* visible framebuffer */
2421static UINT16 *mpPolyFrameBufferPens2;
25static INT16 *mpPolyFrameBufferZ2;
22static UINT16 *mpPolyFrameBufferZ2;
2623
2724static UINT16 winrun_color;
2825static UINT16 winrun_gpu_register[0x10/2];
r1185r1186
8380namcos21_ClearPolyFrameBuffer( void )
8481{
8582   int i;
86   INT16 *temp1;
8783   UINT16 *temp2;
8884
8985   /* swap work and visible framebuffers */
90   temp1 = mpPolyFrameBufferZ;
86   temp2 = mpPolyFrameBufferZ;
9187   mpPolyFrameBufferZ = mpPolyFrameBufferZ2;
92   mpPolyFrameBufferZ2 = temp1;
88   mpPolyFrameBufferZ2 = temp2;
9389
9490   temp2 = mpPolyFrameBufferPens;
9591   mpPolyFrameBufferPens = mpPolyFrameBufferPens2;
r1185r1186
10399} /* namcos21_ClearPolyFrameBuffer */
104100
105101static void
106CopyVisiblePolyFrameBuffer( mame_bitmap *bitmap, const rectangle *clip )
102CopyVisiblePolyFrameBuffer( mame_bitmap *bitmap, const rectangle *clip, int zlo, int zhi )
107103{ /* blit the visible framebuffer */
108104   int sy;
109105   for( sy=clip->min_y; sy<=clip->max_y; sy++ )
110106   {
111107      UINT16 *dest = BITMAP_ADDR16(bitmap, sy, 0);
112108      const UINT16 *pPen = mpPolyFrameBufferPens2+NAMCOS21_POLY_FRAME_WIDTH*sy;
113      const INT16 *pZ = mpPolyFrameBufferZ2+NAMCOS21_POLY_FRAME_WIDTH*sy;
109      const UINT16 *pZ = mpPolyFrameBufferZ2+NAMCOS21_POLY_FRAME_WIDTH*sy;
114110      int sx;
115111      for( sx=clip->min_x; sx<=clip->max_x; sx++ )
116112      {
117         if( pZ[sx]!=0x7fff )
113         int z = pZ[sx];
114         //if( pZ[sx]!=0x7fff )
115         if( z>=zlo && z<=zhi )
118116         {
119117            dest[sx] = pPen[sx];
120118         }
r1185r1186
177175   }
178176} /* update_palette */
179177
178
180179VIDEO_UPDATE( namcos21 )
181180{
182181   int pivot = 3;
183182   int pri;
184183   update_palette();
185184   fillbitmap( bitmap, 0xff, cliprect );
185
186186   if( namcos2_gametype != NAMCOS21_WINRUN91 )
187187   { /* draw low priority 2d sprites */
188      for( pri=0; pri<pivot; pri++ )
189      {
190         namco_obj_draw( machine, bitmap, cliprect, pri );
191      }
188      namco_obj_draw( machine, bitmap, cliprect, 2 );
192189   }
193   CopyVisiblePolyFrameBuffer( bitmap, cliprect );
190
191   CopyVisiblePolyFrameBuffer( bitmap, cliprect,0x7fc0,0x7ffe );
192
194193   if( namcos2_gametype != NAMCOS21_WINRUN91 )
194   { /* draw low priority 2d sprites */
195      namco_obj_draw( machine, bitmap, cliprect, 0 );
196      namco_obj_draw( machine, bitmap, cliprect, 1 );
197   }
198
199   CopyVisiblePolyFrameBuffer( bitmap, cliprect,0,0x7fbf );
200
201
202   if( namcos2_gametype != NAMCOS21_WINRUN91 )
195203   { /* draw high priority 2d sprites */
196204      for( pri=pivot; pri<8; pri++ )
197205      {
r1185r1186
200208   }
201209   else
202210   { /* winrun bitmap layer */
203      int dy = (INT16)winrun_gpu_register[0x2/2];
211      int yscroll = -cliprect->min_y+(INT16)winrun_gpu_register[0x2/2];
204212      int base = 0x1000+0x100*(winrun_color&0xf);
205213      int sx,sy;
206214      for( sy=cliprect->min_y; sy<=cliprect->max_y; sy++ )
207215      {
208         const UINT8 *pSource = &videoram[((sy+dy)&0x3ff)*0x200];
216         const UINT8 *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200];
209217         UINT16 *pDest = BITMAP_ADDR16(bitmap, sy, 0);
210218         for( sx=cliprect->min_x; sx<=cliprect->max_x; sx++ )
211219         {
212220            int pen = pSource[sx];
213            if( pen!=0xff )
221            switch( pen )
214222            {
223            case 0xff:
224               break;
225            case 0x00:
226               pDest[sx] = (pDest[sx]&0x1fff)+0x4000;
227               break;
228            case 0x01:
229               pDest[sx] = (pDest[sx]&0x1fff)+0x6000;
230               break;
231            default:
215232               pDest[sx] = base|pen;
233               break;
216234            }
217235         }
218236      }
219237   } /* winrun bitmap layer */
220
221
222//  if( input_code_pressed( KEYCODE_Q ) ) namco_obj_draw( machine, bitmap, cliprect, 0 ); // boot, mountains
223//  if( input_code_pressed( KEYCODE_W ) ) namco_obj_draw( machine, bitmap, cliprect, 1 );
224//  if( input_code_pressed( KEYCODE_E ) ) namco_obj_draw( machine, bitmap, cliprect, 2 ); // hs backdrop
225//  if( input_code_pressed( KEYCODE_R ) ) namco_obj_draw( machine, bitmap, cliprect, 3 ); // warn, starship
226//  if( input_code_pressed( KEYCODE_T ) ) namco_obj_draw( machine, bitmap, cliprect, 4 );
227//  if( input_code_pressed( KEYCODE_Y ) ) namco_obj_draw( machine, bitmap, cliprect, 5 );
228//  if( input_code_pressed( KEYCODE_U ) ) namco_obj_draw( machine, bitmap, cliprect, 6 );
229//  if( input_code_pressed( KEYCODE_I ) ) namco_obj_draw( machine, bitmap, cliprect, 7 );
230
231238   return 0;
232239} /* VIDEO_UPDATE( namcos21 ) */
233240
r1185r1186
257264
258265   {
259266      UINT16 *pDest = mpPolyFrameBufferPens + sy*NAMCOS21_POLY_FRAME_WIDTH;
260      INT16 *pZBuf = mpPolyFrameBufferZ     + sy*NAMCOS21_POLY_FRAME_WIDTH;
267      UINT16 *pZBuf = mpPolyFrameBufferZ    + sy*NAMCOS21_POLY_FRAME_WIDTH;
261268      int x0 = (int)e1->x;
262269      int x1 = (int)e2->x;
263270      int w = x1-x0;
r1185r1186
279286
280287         for( x=x0; x<x1; x++ )
281288         {
282            INT16 zz = (INT16)z;
289            UINT16 zz = (UINT16)z;
283290            if( zz<pZBuf[x] )
284291            {
285292               int pen = color;
r1185r1186
288295                  int depth = 0;
289296                  if( namcos2_gametype == NAMCOS21_WINRUN91 )
290297                  {
291                     depth = (zz>>1)&0xff00;
292                     if( depth>0x1f00 ) depth = 0x1f00;
298                     depth = (zz>>10)*0x100;
293299                     pen += depth;
294300                  }
295301                  else
296302                  {
297                     depth = (zz>>0)&0xfe00;
298                     if( depth>0x1e00 ) depth = 0x1e00;
303                     depth = (zz>>11)*0x200;
299304                     pen -= depth;
300305                  }
301306               }
r1185r1186
449454      if( code&0x80 )
450455      {
451456         color = color&0xff;
452         color = 0x3e00|color;
457//          color = 0x3e00|color;
458         color = 0x2100|color;
459         depthcueenable = 0;
453460      }
454461      else
455462      {
src/mame/video/toaplan2.c
r1185r1186
951951               if ((toaplan2_sub_cpu == CPU_2_Z80) && (data == 3))
952952               {
953953                  /* HACK! When tilted, sound CPU needs to be reset. */
954                  if (Machine->drv->sound[0].sound_type == SOUND_YM3812)
954                  if (Machine->drv->sound[0].type == SOUND_YM3812)
955955                  {
956956                     cpunum_set_input_line(1, INPUT_LINE_RESET, PULSE_LINE);
957957                     sndti_reset(SOUND_YM3812, 0);
src/mame/video/namcos22.c
r1185r1186
3535
3636#include "driver.h"
3737#include "namcos22.h"
38#include "video/polynew.h"
3839#include <math.h>
3940
4041static int mbSuperSystem22; /* used to conditionally support Super System22-specific features */
4142static int mbSpotlightEnable;
4243static UINT16 *namcos22_czram[4];
4344
45static poly_manager *poly;
46
4447static UINT8
4548nthbyte( const UINT32 *pSource, int offs )
4649{
r1185r1186
8083static void
8184UpdateVideoMixer( void )
8285{
86   poly_wait(poly, "UpdateVideoMixer");
8387   memset( &mixer, 0, sizeof(mixer) );
8488   if( mbSuperSystem22 )
8589   {
r1185r1186
150154   }
151155}
152156
153static UINT8
157INLINE UINT8
154158Clamp256( int v )
155159{
156160   if( v<0 )
r1185r1186
237241   return mpTextureTileData[(tile<<8)|mXYAttrToPixel[mpTextureTileMapAttr[offs]][x&0xf][y&0xf]];
238242} /* texel */
239243
240static void renderscanline_uvi_full(running_machine *machine, mame_bitmap *bitmap, const rectangle *clip, const edge *e1, const edge *e2, int sy, int color, int bn, UINT16 flags, int cmode )
244typedef struct _poly_extra_data poly_extra_data;
245struct _poly_extra_data
241246{
247   int color;
248   int bn;
249   UINT16 flags;
250   int cmode;
251   const UINT8 *source;      /* sprites */
252   int z;
253   int alpha;
254   int prioverchar;
255   int line_modulo;
256};
257
258static void renderscanline_uvi_full(void *dest, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
259{
260   mame_bitmap *bitmap = dest;
261   poly_extra_data *extra = poly->extra;
262   UINT16 flags = extra->flags;
263   int cmode = extra->cmode;
264   int bn = extra->bn;
242265   int fadeEnable = (mixer.target&1) && mixer.fadeFactor;
243   int fogDisable = color&0x80;
244   const pen_t *pens = &machine->pens[(color&0x7f)<<8];
245   int fogDensity = 0;
266   int fogDisable = extra->color&0x80;
267   const pen_t *pens = &Machine->pens[(extra->color&0x7f)<<8];
268   int fogDensity = 0;
246269   int prioverchar = (cmode&7)==1;
247270
248   if( e1->x > e2->x )
249   {
250      SWAP(e1,e2);
251   }
271   const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, scanline, 0);
272   UINT32 *pDest = BITMAP_ADDR32(bitmap, scanline, 0);
273   float u = poly_param_value(startx, scanline, 0, poly); /* u/z */
274   float v = poly_param_value(startx, scanline, 1, poly); /* v/z */
275   float i = poly_param_value(startx, scanline, 2, poly); /* i/z */
276   float z = poly_param_value(startx, scanline, 3, poly); /* 1/z */
277   float du = poly->param[0].dpdx;
278   float dv = poly->param[1].dpdx;
279   float di = poly->param[2].dpdx;
280   float dz = poly->param[3].dpdx;
281   int x;
282   bn *= 0x1000;
252283
284   if( mbSuperSystem22 )
253285   {
254      const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, sy, 0);
255      UINT32 *pDest = BITMAP_ADDR32(bitmap, sy, 0);
256      int x0 = (int)e1->x;
257      int x1 = (int)e2->x;
258      int w = x1-x0;
259      if( w )
286      if( !fogDisable )
260287      {
261         float u = e1->u; /* u/z */
262         float v = e1->v; /* v/z */
263         float i = e1->i; /* i/z */
264         float z = e1->z; /* 1/z */
265         float oow = 1.0f / w;
266         float du = (e2->u - e1->u)*oow;
267         float dv = (e2->v - e1->v)*oow;
268         float dz = (e2->z - e1->z)*oow;
269         float di = (e2->i - e1->i)*oow;
270         int x, crop;
271         crop = clip->min_x - x0;
272         if( crop>0 )
288         int cz = flags>>8;
289         static const int cztype_remap[4] = { 3,1,2,0 };
290         int cztype = flags&3;
291         if( nthword(namcos22_czattr,4)&(0x4000>>(cztype*4)) )
273292         {
274            u += crop*du;
275            v += crop*dv;
276            i += crop*di;
277            z += crop*dz;
278            x0 = clip->min_x;
279         }
280         if( x1>clip->max_x )
281         {
282            x1 = clip->max_x;
283         }
284         bn *= 0x1000;
285
286         if( mbSuperSystem22 )
287         {
288            if( !fogDisable )
293            int fogDelta = (INT16)nthword(namcos22_czattr, cztype);
294            //          if( fogDelta == 0x8000 ) fogDelta = -0x7fff;
295            //cz = Clamp256(cz+fogDelta);
296            fogDensity = fogDelta + namcos22_czram[cztype_remap[cztype]][cz];
297            if( fogDensity<0x0000 )
289298            {
290               int cz = flags>>8;
291               static const int cztype_remap[4] = { 3,1,2,0 };
292               int cztype = flags&3;
293               if( nthword(namcos22_czattr,4)&(0x4000>>(cztype*4)) )
294               {
295                  int fogDelta = (INT16)nthword(namcos22_czattr, cztype);
296         //          if( fogDelta == 0x8000 ) fogDelta = -0x7fff;
297                  //cz = Clamp256(cz+fogDelta);
298                  fogDensity = fogDelta + namcos22_czram[cztype_remap[cztype]][cz];
299                  if( fogDensity<0x0000 )
300                  {
301                     fogDensity = 0x0000;
302                  }
303                  else if( fogDensity>0x1fff )
304                  {
305                     fogDensity = 0x1fff;
306                  }
307               }
299               fogDensity = 0x0000;
308300            }
309         }
310         else
311         {
312            fogDisable = 1;
313         }
314
315         for( x=x0; x<x1; x++ )
316         {
317            if( pCharPri[x]==0 || prioverchar )
301            else if( fogDensity>0x1fff )
318302            {
319               float ooz = 1.0f/z;
320               int pen = texel((int)(u * ooz),bn+(int)(v*ooz));
321               switch( cmode )
322               {
323               case 0x2:
324                   pen = 0xe0|(pen>>4);
325                   break;
326               case 0x3:
327                  pen = 0xe0|(pen&0xf);
328                  break;
329               case 0x4:
330                  pen = 0xec|(pen>>6);
331                  break;
332               case 0x5:
333                  pen = 0xec|((pen>>4)&3);
334                  break;
335               case 0x6:
336                  pen = 0xec|((pen>>2)&3);
337                  break;
338               case 0x7:
339                  pen = 0xec|(pen&3);
340                  break;
341               case 0xa:
342                  pen = 0xf0|(pen>>4);
343                  break;
344               case 0xb:
345                  pen = 0xf0|(pen&0xf);
346                  break;
347               case 0xc:
348                  pen = 0xfc|(pen>>6);
349                  break;
350               case 0xd:
351                  pen = 0xfc|((pen>>4)&3);
352                  break;
353               case 0xe:
354                  pen = 0xfc|((pen>>2)&3);
355                  break;
356               case 0xf:
357                  pen = 0xfc|(pen&3);
358                  break;
359               default:
360                  break;
361               }
362
363               {
364                  UINT32 rgb = pens[pen];
365                  int shade = i*ooz;
366                  int r = rgb>>16;
367                  int g = (rgb>>8)&0xff;
368                  int b = rgb&0xff;
369                  r = r*shade/0x40;
370                  if( r>0xff ) r = 0xff;
371                  g = g*shade/0x40;
372                  if( g>0xff ) g = 0xff;
373                  b = b*shade/0x40;
374                  if( b>0xff ) b = 0xff;
375                  if( !fogDisable )
376                  {
377                     int fogDensity2 = 0x2000 - fogDensity;
378                     r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13;
379                     g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13;
380                     b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13;
381                  }
382                  if( fadeEnable )
383                  {
384                     int fade2 = 0x100-mixer.fadeFactor;
385                     r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8;
386                     g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8;
387                     b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8;
388                  }
389                  if( prioverchar )
390                  {
391                     UINT32 color = pDest[x];
392                     int tr = color>>16;
393                     int tg = (color>>8)&0xff;
394                     int tb = color&0xff;
395                     int trans1 = 0x100 - mixer.poly_translucency;
396                     r = (tr*mixer.poly_translucency + r*trans1)>>8;
397                     g = (tg*mixer.poly_translucency + g*trans1)>>8;
398                     b = (tb*mixer.poly_translucency + b*trans1)>>8;
399                  }
400                  rgb = (r<<16)|(g<<8)|b;
401                  pDest[x] = rgb;
402               }
303               fogDensity = 0x1fff;
403304            }
404
405            u += du;
406            v += dv;
407            i += di;
408            z += dz;
409305         }
410306      }
411307   }
412} /* renderscanline_uvi_full */
413
414static void rendertri(running_machine *machine,
415      mame_bitmap *bitmap,
416      const rectangle *clip,
417      int color,
418      int bn,
419      const vertex *v0,
420      const vertex *v1,
421      const vertex *v2,
422      UINT16 flags,
423      int cmode )
424{
425   int dy,ystart,yend,crop;
426
427   /* first, sort so that v0->y <= v1->y <= v2->y */
428   for(;;)
308   else
429309   {
430      if( v0->y > v1->y )
431      {
432         SWAP(v0,v1);
433      }
434      else if( v1->y > v2->y )
435      {
436         SWAP(v1,v2);
437      }
438      else
439      {
440         break;
441      }
310      fogDisable = 1;
442311   }
443312
444   ystart = v0->y;
445   yend   = v2->y;
446   dy = yend-ystart;
447   if( dy )
313   for( x=startx; x<stopx; x++ )
448314   {
449      int y;
450      edge e1; /* short edge (top and bottom) */
451      edge e2; /* long (common) edge */
452
453      float oody = 1.0f / (float)dy;
454
455      float dx2dy = (v2->x - v0->x)*oody;
456      float du2dy = (v2->u - v0->u)*oody;
457      float dv2dy = (v2->v - v0->v)*oody;
458      float di2dy = (v2->i - v0->i)*oody;
459      float dz2dy = (v2->z - v0->z)*oody;
460
461      float dx1dy;
462      float du1dy;
463      float dv1dy;
464      float di1dy;
465      float dz1dy;
466
467      e2.x = v0->x;
468      e2.u = v0->u;
469      e2.v = v0->v;
470      e2.i = v0->i;
471      e2.z = v0->z;
472      crop = clip->min_y - ystart;
473      if( crop>0 )
315      if( pCharPri[x]==0 || prioverchar )
474316      {
475         e2.x += dx2dy*crop;
476         e2.u += du2dy*crop;
477         e2.v += dv2dy*crop;
478         e2.i += di2dy*crop;
479         e2.z += dz2dy*crop;
480      }
481
482      ystart = v0->y;
483      yend = v1->y;
484      dy = yend-ystart;
485
486      if( dy )
487      {
488         e1.x = v0->x;
489         e1.u = v0->u;
490         e1.v = v0->v;
491         e1.i = v0->i;
492         e1.z = v0->z;
493
494         oody = 1.0f / (float)dy;
495         dx1dy = (v1->x - v0->x)*oody;
496         du1dy = (v1->u - v0->u)*oody;
497         dv1dy = (v1->v - v0->v)*oody;
498         di1dy = (v1->i - v0->i)*oody;
499         dz1dy = (v1->z - v0->z)*oody;
500
501         crop = clip->min_y - ystart;
502         if( crop>0 )
317         float ooz = 1.0f/z;
318         int pen = texel((int)(u * ooz),bn+(int)(v*ooz));
319         switch( cmode )
503320         {
504            e1.x += dx1dy*crop;
505            e1.u += du1dy*crop;
506            e1.v += dv1dy*crop;
507            e1.i += di1dy*crop;
508            e1.z += dz1dy*crop;
509            ystart = clip->min_y;
321            case 0x2:
322               pen = 0xe0|(pen>>4);
323               break;
324            case 0x3:
325               pen = 0xe0|(pen&0xf);
326               break;
327            case 0x4:
328               pen = 0xec|(pen>>6);
329               break;
330            case 0x5:
331               pen = 0xec|((pen>>4)&3);
332               break;
333            case 0x6:
334               pen = 0xec|((pen>>2)&3);
335               break;
336            case 0x7:
337               pen = 0xec|(pen&3);
338               break;
339            case 0xa:
340               pen = 0xf0|(pen>>4);
341               break;
342            case 0xb:
343               pen = 0xf0|(pen&0xf);
344               break;
345            case 0xc:
346               pen = 0xfc|(pen>>6);
347               break;
348            case 0xd:
349               pen = 0xfc|((pen>>4)&3);
350               break;
351            case 0xe:
352               pen = 0xfc|((pen>>2)&3);
353               break;
354            case 0xf:
355               pen = 0xfc|(pen&3);
356               break;
357            default:
358               break;
510359         }
511         if( yend>clip->max_y ) yend = clip->max_y;
512360
513         for( y=ystart; y<yend; y++ )
514361         {
515            renderscanline_uvi_full(machine, bitmap, clip, &e1, &e2, y, color, bn, flags, cmode );
516
517            e2.x += dx2dy;
518            e2.u += du2dy;
519            e2.v += dv2dy;
520            e2.i += di2dy;
521            e2.z += dz2dy;
522
523            e1.x += dx1dy;
524            e1.u += du1dy;
525            e1.v += dv1dy;
526            e1.i += di1dy;
527            e1.z += dz1dy;
362            UINT32 rgb = pens[pen];
363            int shade = i*ooz;
364            int r = rgb>>16;
365            int g = (rgb>>8)&0xff;
366            int b = rgb&0xff;
367            r = r*shade/0x40;
368            if( r>0xff ) r = 0xff;
369            g = g*shade/0x40;
370            if( g>0xff ) g = 0xff;
371            b = b*shade/0x40;
372            if( b>0xff ) b = 0xff;
373            if( !fogDisable )
374            {
375               int fogDensity2 = 0x2000 - fogDensity;
376               r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13;
377               g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13;
378               b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13;
379            }
380            if( fadeEnable )
381            {
382               int fade2 = 0x100-mixer.fadeFactor;
383               r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8;
384               g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8;
385               b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8;
386            }
387            if( prioverchar )
388            {
389               UINT32 color = pDest[x];
390               int tr = color>>16;
391               int tg = (color>>8)&0xff;
392               int tb = color&0xff;
393               int trans1 = 0x100 - mixer.poly_translucency;
394               r = (tr*mixer.poly_translucency + r*trans1)>>8;
395               g = (tg*mixer.poly_translucency + g*trans1)>>8;
396               b = (tb*mixer.poly_translucency + b*trans1)>>8;
397            }
398            rgb = (r<<16)|(g<<8)|b;
399            pDest[x] = rgb;
528400         }
529401      }
530402
531      ystart = v1->y;
532      yend = v2->y;
533      dy = yend-ystart;
534      if( dy )
535      {
536         e1.x = v1->x;
537         e1.u = v1->u;
538         e1.v = v1->v;
539         e1.i = v1->i;
540         e1.z = v1->z;
403      u += du;
404      v += dv;
405      i += di;
406      z += dz;
407   }
408} /* renderscanline_uvi_full */
541409
542         oody = 1.0f / (float)dy;
543         dx1dy = (v2->x - v1->x)*oody;
544         du1dy = (v2->u - v1->u)*oody;
545         dv1dy = (v2->v - v1->v)*oody;
546         di1dy = (v2->i - v1->i)*oody;
547         dz1dy = (v2->z - v1->z)*oody;
410static void rendertri(running_machine *machine,
411   mame_bitmap *bitmap,
412   const rectangle *clip,
413   int color,
414   int bn,
415   const vertex *v0,
416   const vertex *v1,
417   const vertex *v2,
418   UINT16 flags,
419   int cmode )
420{
421   poly_extra_data *extra = poly_get_extra_data(poly);
422   poly_vertex vert[3];
548423
549         crop = clip->min_y - ystart;
550         if( crop>0 )
551         {
552            e1.x += dx1dy*crop;
553            e1.u += du1dy*crop;
554            e1.v += dv1dy*crop;
555            e1.i += di1dy*crop;
556            e1.z += dz1dy*crop;
557            ystart = clip->min_y;
558         }
559         if( yend>clip->max_y ) yend = clip->max_y;
424   vert[0].x = v0->x;
425   vert[0].y = v0->y;
426   vert[0].p[0] = v0->u;
427   vert[0].p[1] = v0->v;
428   vert[0].p[2] = v0->i;
429   vert[0].p[3] = v0->z;
430   vert[1].x = v1->x;
431   vert[1].y = v1->y;
432   vert[1].p[0] = v1->u;
433   vert[1].p[1] = v1->v;
434   vert[1].p[2] = v1->i;
435   vert[1].p[3] = v1->z;
436   vert[2].x = v2->x;
437   vert[2].y = v2->y;
438   vert[2].p[0] = v2->u;
439   vert[2].p[1] = v2->v;
440   vert[2].p[2] = v2->i;
441   vert[2].p[3] = v2->z;
560442
561         for( y=ystart; y<yend; y++ )
562         {
563            renderscanline_uvi_full(machine, bitmap, clip, &e1,&e2,y, color, bn, flags, cmode );
443   extra->color = color;
444   extra->bn = bn;
445   extra->flags = flags;
446   extra->cmode = cmode;
564447
565            e2.x += dx2dy;
566            e2.u += du2dy;
567            e2.v += dv2dy;
568            e2.i += di2dy;
569            e2.z += dz2dy;
448   poly_render_triangle(poly, bitmap, clip, renderscanline_uvi_full, 4, &vert[0], &vert[1], &vert[2]);
570449
571            e1.x += dx1dy;
572            e1.u += du1dy;
573            e1.v += dv1dy;
574            e1.i += di1dy;
575            e1.z += dz1dy;
576         }
577      }
578   }
579450} /* rendertri */
580451
581452static void
r1185r1186
748619   BlitTri(machine, bitmap, pv, color, textureBank, flags, direct, cmode );
749620}
750621
751static void
752mydrawgfxzoom(
753   mame_bitmap *dest_bmp,const gfx_element *gfx,
754   UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
755   const rectangle *clip,int transparency,int transparent_color,
756   int scalex, int scaley, int z, int prioverchar )
622static void renderscanline_sprite(void *destptr, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
757623{
758   rectangle myclip;
759   if (!scalex || !scaley) return;
760   if(clip)
761   {
762      myclip.min_x = clip->min_x;
763      myclip.max_x = clip->max_x;
764      myclip.min_y = clip->min_y;
765      myclip.max_y = clip->max_y;
624   poly_extra_data *extra = poly->extra;
625   int x_index = poly_param_value(startx, scanline, 0, poly) * 65536.0f;
626   int y_index = poly_param_value(startx, scanline, 1, poly) * 65536.0f;
627   int dx = poly->param[0].dpdx * 65536.0f;
628   mame_bitmap *destmap = destptr;
629   UINT8 *source = (UINT8 *)extra->source + (y_index>>16) * extra->line_modulo;
630   UINT32 *dest = BITMAP_ADDR32(destmap, scanline, 0);
631   const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, scanline, 0);
632   const pen_t *pal = &Machine->remapped_colortable[extra->color];
633   int prioverchar = extra->prioverchar;
634   int z = extra->z;
635   int alpha = extra->alpha;
636   int x;
766637
767      if (myclip.min_x < 0) myclip.min_x = 0;
768      if (myclip.max_x >= dest_bmp->width) myclip.max_x = dest_bmp->width-1;
769      if (myclip.min_y < 0) myclip.min_y = 0;
770      if (myclip.max_y >= dest_bmp->height) myclip.max_y = dest_bmp->height-1;
638   int bFogEnable = 0;
639   INT16 fogDelta = 0;
640   int fadeEnable = (mixer.target&2) && mixer.fadeFactor;
771641
772      clip=&myclip;
642   if( mbSuperSystem22 )
643   {
644      fogDelta = nthword(namcos22_czattr, 0 );
645      bFogEnable = nthword(namcos22_czattr,4)&0x4000; /* ? */
773646   }
774   if( gfx )
647   else
775648   {
776      const pen_t *pal = &Machine->remapped_colortable[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
777      UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
778      int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
779      int sprite_screen_width = (scalex*gfx->width+0x8000)>>16;
780      if (sprite_screen_width && sprite_screen_height)
781      {
782         int dx = (gfx->width<<16)/sprite_screen_width;
783         int dy = (gfx->height<<16)/sprite_screen_height;
784         int ex = sx+sprite_screen_width;
785         int ey = sy+sprite_screen_height;
786         int x_index_base;
787         int y_index;
649      bFogEnable = 0;
650   }
788651
789         int bFogEnable = 0;
790         INT16 fogDelta = 0;
791         int fadeEnable = (mixer.target&2) && mixer.fadeFactor;
792
793         if( mbSuperSystem22 )
794         {
795            fogDelta = nthword(namcos22_czattr, 0 );
796            bFogEnable = nthword(namcos22_czattr,4)&0x4000; /* ? */
797         }
798         else
652   for( x=startx; x<stopx; x++ )
653   {
654      int pen = source[x_index>>16];
655      if( pen != 0xff )
656      {
657         if( pCharPri[x]==0 || prioverchar )
799658         {
800            bFogEnable = 0;
801         }
802
803         if( flipx )
804         {
805            x_index_base = (sprite_screen_width-1)*dx;
806            dx = -dx;
807         }
808         else
809         {
810            x_index_base = 0;
811         }
812         if( flipy )
813         {
814            y_index = (sprite_screen_height-1)*dy;
815            dy = -dy;
816         }
817         else
818         {
819            y_index = 0;
820         }
821         if( clip )
822         {
823            if( sx < clip->min_x)
824            { /* clip left */
825               int pixels = clip->min_x-sx;
826               sx += pixels;
827               x_index_base += pixels*dx;
828            }
829            if( sy < clip->min_y )
830            { /* clip top */
831               int pixels = clip->min_y-sy;
832               sy += pixels;
833               y_index += pixels*dy;
834            }
835            if( ex > clip->max_x+1 )
836            { /* clip right */
837               int pixels = ex-clip->max_x-1;
838               ex -= pixels;
839            }
840            if( ey > clip->max_y+1 )
841            { /* clip bottom */
842               int pixels = ey-clip->max_y-1;
843               ey -= pixels;
844            }
845         }
846         if( ex>sx )
847         { /* skip if inner loop doesn't draw anything */
848            int y;
849            for( y=sy; y<ey; y++ )
659            UINT32 color = pal[pen];
660            int r = color>>16;
661            int g = (color>>8)&0xff;
662            int b = color&0xff;
663            if( bFogEnable && z!=0xffff )
850664            {
851               UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
852               UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0);
853               const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, y, 0);
854               int x, x_index = x_index_base;
855               for( x=sx; x<ex; x++ )
665               int zc = Clamp256(fogDelta + z);
666               UINT16 fogDensity = namcos22_czram[3][zc];
667               if( fogDensity>0 )
856668               {
857                  int pen = source[x_index>>16];
858                  if( pen != transparent_color )
859                  {
860                     if( pCharPri[x]==0 || prioverchar )
861                     {
862                        UINT32 color = pal[pen];
863                        int r = color>>16;
864                        int g = (color>>8)&0xff;
865                        int b = color&0xff;
866                        if( bFogEnable && z!=0xffff )
867                        {
868                           int zc = Clamp256(fogDelta + z);
869                           UINT16 fogDensity = namcos22_czram[3][zc];
870                           if( fogDensity>0 )
871                           {
872                              int fogDensity2 = 0x2000 - fogDensity;
873                              r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13;
874                              g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13;
875                              b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13;
876                           }
877                        }
878                        if( fadeEnable )
879                        {
880                           int fade2 = 0x100-mixer.fadeFactor;
881                           r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8;
882                           g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8;
883                           b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8;
884                        }
885                        color = (r<<16)|(g<<8)|b;
886                        color = alpha_blend32(dest[x], color);
887                        color&=0xffffff;
888                        dest[x] = color;
889                     }
890                  }
891                  x_index += dx;
669                  int fogDensity2 = 0x2000 - fogDensity;
670                  r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13;
671                  g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13;
672                  b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13;
892673               }
893               y_index += dy;
894674            }
675            if( fadeEnable )
676            {
677               int fade2 = 0x100-mixer.fadeFactor;
678               r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8;
679               g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8;
680               b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8;
681            }
682            color = (r<<16)|(g<<8)|b;
683            color = alpha_blend_r32(dest[x], color, alpha);
684            color&=0xffffff;
685            dest[x] = color;
895686         }
896687      }
688      x_index += dx;
897689   }
690}
691
692
693static void
694mydrawgfxzoom(
695   mame_bitmap *dest_bmp,const gfx_element *gfx,
696   UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
697   const rectangle *clip,int transparency,int transparent_color,
698   int scalex, int scaley, int z, int prioverchar, int alpha )
699{
700   int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
701   int sprite_screen_width = (scalex*gfx->width+0x8000)>>16;
702   if (sprite_screen_width && sprite_screen_height && gfx)
703   {
704      float fsx = sx;
705      float fsy = sy;
706      float fwidth = gfx->width;
707      float fheight = gfx->height;
708      float fsw = sprite_screen_width;
709      float fsh = sprite_screen_height;
710      poly_extra_data *extra;
711      poly_vertex vert[4];
712
713      vert[0].x = fsx;
714      vert[0].y = fsy;
715      vert[0].p[0] = flipx ? fwidth : 0;
716      vert[0].p[1] = flipy ? fheight : 0;
717      vert[1].x = fsx + fsw;
718      vert[1].y = fsy;
719      vert[1].p[0] = flipx ? 0 : fwidth;
720      vert[1].p[1] = flipy ? fheight : 0;
721      vert[2].x = fsx + fsw;
722      vert[2].y = fsy + fsh;
723      vert[2].p[0] = flipx ? 0 : fwidth;
724      vert[2].p[1] = flipy ? 0 : fheight;
725      vert[3].x = fsx;
726      vert[3].y = fsy + fsh;
727      vert[3].p[0] = flipx ? fwidth : 0;
728      vert[3].p[1] = flipy ? 0 : fheight;
729
730      extra = poly_get_extra_data(poly);
731      extra->z = z;
732      extra->alpha = alpha;
733      extra->prioverchar = prioverchar;
734      extra->line_modulo = gfx->line_modulo;
735      extra->color = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
736      extra->source = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
737      poly_render_triangle(poly, dest_bmp, clip, renderscanline_sprite, 2, &vert[0], &vert[1], &vert[2]);
738
739      extra = poly_get_extra_data(poly);
740      extra->z = z;
741      extra->alpha = alpha;
742      extra->prioverchar = prioverchar;
743      extra->line_modulo = gfx->line_modulo;
744      extra->color = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
745      extra->source = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
746      poly_render_triangle(poly, dest_bmp, clip, renderscanline_sprite, 2, &vert[0], &vert[2], &vert[3]);
747   }
898748} /* mydrawgfxzoom */
899749
900750static void
r1185r1186
954804   clip.min_y = 0;
955805   clip.max_x = 640-1;
956806   clip.max_y = 480-1;
957   alpha_set_level( 0xff - translucency );
958807   mydrawgfxzoom(
959808      bitmap,
960809      gfx,
r1185r1186
966815      TRANSPARENCY_ALPHA, 0xff,
967816      (width<<16)/32,
968817      (height<<16)/32,
969      zc, pri );
818      zc, pri, 0xff - translucency );
970819}
971820
972821#define DSP_FIXED_TO_FLOAT( X ) (((INT16)(X))/(float)0x7fff)
r1185r1186
12901139      node->data.nonleaf.next[i] = NULL;
12911140   }
12921141   poly3d_NoClip();
1142   poly_wait(poly, "DrawPolygons");
12931143} /* RenderScene */
12941144
12951145static float
r1185r1186
24892339   if( mbDSPisActive )
24902340   {
24912341      SimulateSlaveDSP( bitmap );
2342      poly_wait(poly, "DrawPolygons");
24922343   }
24932344} /* DrawPolygons */
24942345
r1185r1186
25332384   dirtypal[offset&(0x7fff/4)] = 1;
25342385}
25352386
2387static void namcos22_exit(running_machine *machine)
2388{
2389   poly_free(poly);
2390}
2391
25362392static void video_start_common(running_machine *machine)
25372393{
25382394   bgtilemap = tilemap_create( TextTilemapGetInfo,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,64,64 );
r1185r1186
25482404   mpPolyL = memory_region(REGION_POINTROM);
25492405   mpPolyM = mpPolyL + mPtRomSize;
25502406   mpPolyH = mpPolyM + mPtRomSize;
2407
2408   poly = poly_alloc(1000, sizeof(poly_extra_data), 0);
2409   add_exit_callback(machine, namcos22_exit);
25512410}
25522411
25532412VIDEO_START( namcos22 )
src/mame/video/midvunit.c
r1185r1186
88#include "cpu/tms34010/tms34010.h"
99#include "cpu/adsp2100/adsp2100.h"
1010#include "audio/williams.h"
11#include "video/poly.h"
11#include "video/polynew.h"
1212#include "midvunit.h"
1313
1414
1515#define WATCH_RENDER      (0)
16#define KEEP_STATISTICS      (0)
1716#define LOG_DMA            (0)
1817
1918
2019#define DMA_CLOCK         40000000
2120
2221
23#if KEEP_STATISTICS
24#define ADD_TO_PIXEL_COUNT(a)   do { if ((a) > 0) pixelcount += (a); } while (0)
25#else
26#define ADD_TO_PIXEL_COUNT(a)
27#endif
28
29
3022/* for when we implement DMA timing */
3123#define DMA_QUEUE_SIZE      273
3224#define TIME_PER_PIXEL      41e-9
r1185r1186
4335static UINT8 video_changed;
4436
4537static mame_timer *scanline_timer;
38static poly_manager *poly;
4639
47static struct poly_vertex vert[4];
48static UINT8 topleft, topright, botleft, botright;
40typedef struct _poly_extra_data poly_extra_data;
41struct _poly_extra_data
42{
43   UINT8 *      texbase;
44   UINT16       pixdata;
45   UINT8      dither;
46};
4947
50#if KEEP_STATISTICS
51static int polycount, pixelcount, lastfps, framecount, totalframes;
52#endif
5348
5449
5550/*************************************
r1185r1186
6762}
6863
6964
70VIDEO_START( midvunit )
65static void midvunit_exit(running_machine *machine)
7166{
72   scanline_timer = mame_timer_alloc(scanline_timer_cb);
67   poly_free(poly);
7368}
7469
7570
76
77/*************************************
78 *
79 *  Returns true if the quad is
80 *  straight-on
81 *
82 *************************************/
83
84INLINE int quad_is_straight(void)
71VIDEO_START( midvunit )
8572{
86   INT32 x1, x2, y1, y2, t;
87
88   x1 = vert[0].x;
89   t = vert[1].x;
90
91   /* case 1: the first two verts are the two extremes */
92   if (t != x1)
93   {
94      x2 = t;
95      t = vert[2].x;
96      if (t != x1)
97      {
98         if (t != x2 || vert[3].x != x1)
99            return 0;
100      }
101      else
102      {
103         if (vert[3].x != x2)
104            return 0;
105      }
106   }
107
108   /* case 2: the first two verts are the same */
109   else
110   {
111      x2 = vert[2].x;
112      if (vert[3].x != x2)
113         return 0;
114   }
115
116   y1 = vert[0].y;
117   t = vert[1].y;
118
119   /* case 1: the first two verts are the two extremes */
120   if (t != y1)
121   {
122      y2 = t;
123      t = vert[2].y;
124      if (t != y1)
125      {
126         if (t != y2 || vert[3].y != y1)
127            return 0;
128      }
129      else
130      {
131         if (vert[3].y != y2)
132            return 0;
133      }
134   }
135
136   /* case 2: the first two verts are the same */
137   else
138   {
139      y2 = vert[2].y;
140      if (vert[3].y != y2)
141         return 0;
142   }
143
144   /* sort into min/max */
145   if (x1 > x2) { t = x1; x1 = x2; x2 = t; }
146   if (y1 > y2) { t = y1; y1 = y2; y2 = t; }
147
148   /* determine the corners */
149   for (t = 0; t < 4; t++)
150   {
151      if (vert[t].x == x1)
152      {
153         if (vert[t].y == y1)
154            topleft = t;
155         else
156            botleft = t;
157      }
158      else
159      {
160         if (vert[t].y == y1)
161            topright = t;
162         else
163            botright = t;
164      }
165   }
166
167   return 1;
73   scanline_timer = mame_timer_alloc(scanline_timer_cb);
74   poly = poly_alloc(4000, sizeof(poly_extra_data), 0);
75   add_exit_callback(machine, midvunit_exit);
16876}
16977
17078
17179
17280/*************************************
17381 *
174 *  Straight, flat quad renderers
82 *  Generic flat quad renderer
17583 *
17684 *************************************/
17785
178static void render_straight_flat_quad(running_machine *machine)
86static void render_flat(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
17987{
180   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
181   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
182   INT32 sx, sy, ex, ey, x, y;
88   poly_extra_data *extra = poly->extra;
89   UINT16 *dest = (UINT16 *)destbase + scanline * 512;
90   UINT16 pixdata = extra->pixdata;
91   int xstep = extra->dither + 1;
92   int x;
18393
184   /* compute parameters */
185   sx = vert[topleft].x;
186   ex = vert[topright].x;
187   sy = vert[topleft].y;
188   ey = vert[botleft].y;
94   /* if dithering, ensure that we start on an appropriate pixel */
95   startx += (scanline ^ startx) & extra->dither;
18996
190   /* clip */
191   if (sx < machine->screen[0].visarea.min_x)
192      sx = machine->screen[0].visarea.min_x;
193   if (ex > machine->screen[0].visarea.max_x)
194      ex = machine->screen[0].visarea.max_x;
195   if (sy < machine->screen[0].visarea.min_y)
196      sy = machine->screen[0].visarea.min_y;
197   if (ey > machine->screen[0].visarea.max_y)
198      ey = machine->screen[0].visarea.max_y;
97   /* non-dithered 0 pixels can use a memset */
98   if (pixdata == 0 && xstep == 1)
99      memset(&dest[startx], 0, 2 * (stopx - startx + 1));
199100
200   ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1));
201
202   /* loop over rows */
203   for (y = sy; y <= ey; y++)
101   /* otherwise, we fill manually */
102   else
204103   {
205      UINT16 *d = dest + y * 512 + sx;
206      if (pixdata)
207         for (x = sx; x <= ex; x++)
208            *d++ = pixdata;
209      else
210         memset(d, 0, 2 * (ex - sx + 1));
104      for (x = startx; x < stopx; x += xstep)
105         dest[x] = pixdata;
211106   }
212107}
213108
214109
215static void render_straight_flat_dither_quad(running_machine *machine)
216{
217   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
218   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
219   INT32 sx, sy, ex, ey, x, y;
220110
221   /* compute parameters */
222   sx = vert[topleft].x;
223   ex = vert[topright].x;
224   sy = vert[topleft].y;
225   ey = vert[botleft].y;
226
227   /* clip */
228   if (sx < machine->screen[0].visarea.min_x)
229      sx = machine->screen[0].visarea.min_x;
230   if (ex > machine->screen[0].visarea.max_x)
231      ex = machine->screen[0].visarea.max_x;
232   if (sy < machine->screen[0].visarea.min_y)
233      sy = machine->screen[0].visarea.min_y;
234   if (ey > machine->screen[0].visarea.max_y)
235      ey = machine->screen[0].visarea.max_y;
236
237   ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1));
238
239   /* loop over rows */
240   for (y = sy; y <= ey; y++)
241   {
242      UINT16 *d = dest + y * 512;
243      int tsx = sx + ((sx ^ y) & 1);
244      for (x = tsx; x <= ex; x += 2)
245         d[x] = pixdata;
246   }
247}
248
249
250
251111/*************************************
252112 *
253 *  Straight, textured quad renderers
113 *  Generic textured quad renderers
254114 *
255115 *************************************/
256116
257static void render_straight_tex_quad(running_machine *machine)
117static void render_tex(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
258118{
259   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
260   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
261   UINT16 pixdata = dma_data[1];
262   INT32 sx, sy, ex, ey, su, sv, dudx, dvdx, dudy, dvdy, x, y, u, v;
119   poly_extra_data *extra = poly->extra;
120   UINT16 *dest = (UINT16 *)destbase + scanline * 512;
121   UINT16 pixdata = extra->pixdata & 0xff00;
122   const UINT8 *texbase = extra->texbase;
123   INT32 u = poly_param_value(startx, scanline, 0, poly) * 65536.0f;
124   INT32 v = poly_param_value(startx, scanline, 1, poly) * 65536.0f;
125   INT32 dudx = poly->param[0].dpdx * 65536.0f;
126   INT32 dvdx = poly->param[1].dpdx * 65536.0f;
127   int xstep = extra->dither + 1;
128   int x;
263129
264   /* compute parameters */
265   sx = vert[topleft].x;
266   ex = vert[topright].x;
267   sy = vert[topleft].y;
268   ey = vert[botleft].y;
269   su = (dma_data[10 + topleft] & 0x00ff) << 16;
270   sv = (dma_data[10 + topleft] & 0xff00) << 8;
271
272   /* compute texture deltas */
273   if (ex != sx)
130   /* if dithering, we advance by 2x; also ensure that we start on an appropriate pixel */
131   if (xstep == 2)
274132   {
275      dudx = (((dma_data[10 + topright] & 0x00ff) << 16) - su) / (ex - sx);
276      dvdx = (((dma_data[10 + topright] & 0xff00) << 8 ) - sv) / (ex - sx);
277   }
278   else
279      dudx = dvdx = 1;
280   if (ey != sy)
281   {
282      dudy = (((dma_data[10 + botleft] & 0x00ff) << 16) - su) / (ey - sy);
283      dvdy = (((dma_data[10 + botleft] & 0xff00) << 8 ) - sv) / (ey - sy);
284   }
285   else
286      dudy = dvdy = 1;
287
288   /* clip */
289   if (sx < machine->screen[0].visarea.min_x)
290   {
291      su += (machine->screen[0].visarea.min_x - sx) * dudx;
292      sv += (machine->screen[0].visarea.min_x - sx) * dvdx;
293      sx = machine->screen[0].visarea.min_x;
294   }
295   if (ex > machine->screen[0].visarea.max_x)
296      ex = machine->screen[0].visarea.max_x;
297   if (sy < machine->screen[0].visarea.min_y)
298   {
299      su += (machine->screen[0].visarea.min_y - sy) * dudy;
300      sv += (machine->screen[0].visarea.min_y - sy) * dvdy;
301      sy = machine->screen[0].visarea.min_y;
302   }
303   if (ey > machine->screen[0].visarea.max_y)
304      ey = machine->screen[0].visarea.max_y;
305
306   ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1));
307
308   /* loop over rows */
309   for (y = sy; y <= ey; y++)
310   {
311      UINT16 *d = dest + y * 512;
312
313      u = su;
314      v = sv;
315      su += dudy;
316      sv += dvdy;
317
318      for (x = sx; x <= ex; x++)
133      if ((scanline ^ startx) & 1)
319134      {
320         d[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)];
135         startx++;
321136         u += dudx;
322137         v += dvdx;
323138      }
139      dudx *= 2;
140      dvdx *= 2;
324141   }
325}
326142
327
328static void render_straight_textrans_quad(running_machine *machine)
329{
330   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
331   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
332   UINT16 pixdata = dma_data[1];
333   INT32 sx, sy, ex, ey, su, sv, dudx, dvdx, dudy, dvdy, x, y, u, v;
334
335   /* compute parameters */
336   sx = vert[topleft].x;
337   ex = vert[topright].x;
338   sy = vert[topleft].y;
339   ey = vert[botleft].y;
340   su = (dma_data[10 + topleft] & 0x00ff) << 16;
341   sv = (dma_data[10 + topleft] & 0xff00) << 8;
342
343   /* compute texture deltas */
344   if (ex != sx)
143   /* general case; render every pixel */
144   for (x = startx; x < stopx; x += xstep)
345145   {
346      dudx = (((dma_data[10 + topright] & 0x00ff) << 16) - su) / (ex - sx);
347      dvdx = (((dma_data[10 + topright] & 0xff00) << 8 ) - sv) / (ex - sx);
146      dest[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)];
147      u += dudx;
148      v += dvdx;
348149   }
349   else
350      dudx = dvdx = 1;
351   if (ey != sy)
352   {
353      dudy = (((dma_data[10 + botleft] & 0x00ff) << 16) - su) / (ey - sy);
354      dvdy = (((dma_data[10 + botleft] & 0xff00) << 8 ) - sv) / (ey - sy);
355   }
356   else
357      dudy = dvdy = 1;
358
359   /* clip */
360   if (sx < machine->screen[0].visarea.min_x)
361   {
362      su += (machine->screen[0].visarea.min_x - sx) * dudx;
363      sv += (machine->screen[0].visarea.min_x - sx) * dvdx;
364      sx = machine->screen[0].visarea.min_x;
365   }
366   if (ex > machine->screen[0].visarea.max_x)
367      ex = machine->screen[0].visarea.max_x;
368   if (sy < machine->screen[0].visarea.min_y)
369   {
370      su += (machine->screen[0].visarea.min_y - sy) * dudy;
371      sv += (machine->screen[0].visarea.min_y - sy) * dvdy;
372      sy = machine->screen[0].visarea.min_y;
373   }
374   if (ey > machine->screen[0].visarea.max_y)
375      ey = machine->screen[0].visarea.max_y;
376
377   ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1));
378
379   /* loop over rows */
380   for (y = sy; y <= ey; y++)
381   {
382      UINT16 *d = dest + y * 512;
383
384      u = su;
385      v = sv;
386      su += dudy;
387      sv += dvdy;
388
389      for (x = sx; x <= ex; x++)
390      {
391         int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
392         if (pix) d[x] = pixdata | pix;
393         u += dudx;
394         v += dvdx;
395      }
396   }
397150}
398151
399152
400static void render_straight_textransmask_quad(running_machine *machine)
153static void render_textrans(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
401154{
402   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
403   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
404   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
405   INT32 sx, sy, ex, ey, su, sv, dudx, dvdx, dudy, dvdy, x, y, u, v;
155   poly_extra_data *extra = poly->extra;
156   UINT16 *dest = (UINT16 *)destbase + scanline * 512;
157   UINT16 pixdata = extra->pixdata & 0xff00;
158   const UINT8 *texbase = extra->texbase;
159   INT32 u = poly_param_value(startx, scanline, 0, poly) * 65536.0f;
160   INT32 v = poly_param_value(startx, scanline, 1, poly) * 65536.0f;
161   INT32 dudx = poly->param[0].dpdx * 65536.0f;
162   INT32 dvdx = poly->param[1].dpdx * 65536.0f;
163   int xstep = extra->dither + 1;
164   int x;
406165
407   /* compute parameters */
408   sx = vert[topleft].x;
409   ex = vert[topright].x;
410   sy = vert[topleft].y;
411   ey = vert[botleft].y;
412   su = (dma_data[10 + topleft] & 0x00ff) << 16;
413   sv = (dma_data[10 + topleft] & 0xff00) << 8;
414
415   /* compute texture deltas */
416   if (ex != sx)
166   /* if dithering, we advance by 2x; also ensure that we start on an appropriate pixel */
167   if (xstep == 2)
417168   {
418      dudx = (((dma_data[10 + topright] & 0x00ff) << 16) - su) / (ex - sx);
419      dvdx = (((dma_data[10 + topright] & 0xff00) << 8 ) - sv) / (ex - sx);
420   }
421   else
422      dudx = dvdx = 1;
423   if (ey != sy)
424   {
425      dudy = (((dma_data[10 + botleft] & 0x00ff) << 16) - su) / (ey - sy);
426      dvdy = (((dma_data[10 + botleft] & 0xff00) << 8 ) - sv) / (ey - sy);
427   }
428   else
429      dudy = dvdy = 1;
430
431   /* clip */
432   if (sx < machine->screen[0].visarea.min_x)
433   {
434      su += (machine->screen[0].visarea.min_x - sx) * dudx;
435      sv += (machine->screen[0].visarea.min_x - sx) * dvdx;
436      sx = machine->screen[0].visarea.min_x;
437   }
438   if (ex > machine->screen[0].visarea.max_x)
439      ex = machine->screen[0].visarea.max_x;
440   if (sy < machine->screen[0].visarea.min_y)
441   {
442      su += (machine->screen[0].visarea.min_y - sy) * dudy;
443      sv += (machine->screen[0].visarea.min_y - sy) * dvdy;
444      sy = machine->screen[0].visarea.min_y;
445   }
446   if (ey > machine->screen[0].visarea.max_y)
447      ey = machine->screen[0].visarea.max_y;
448
449   ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1));
450
451   /* loop over rows */
452   for (y = sy; y <= ey; y++)
453   {
454      UINT16 *d = dest + y * 512;
455
456      u = su;
457      v = sv;
458      su += dudy;
459      sv += dvdy;
460
461      for (x = sx; x <= ex; x++)
169      if ((scanline ^ startx) & 1)
462170      {
463         int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
464         if (pix) d[x] = pixdata;
171         startx++;
465172         u += dudx;
466173         v += dvdx;
467174      }
175      dudx *= 2;
176      dvdx *= 2;
468177   }
469}
470178
471
472
473/*************************************
474 *
475 *  Generic flat quad renderer
476 *
477 *************************************/
478
479static void render_flat_quad(running_machine *machine)
480{
481   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
482   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
483   const struct poly_scanline_data *scans;
484   const struct poly_scanline *curscan;
485   int x, y, i;
486
487   /* loop over two tris */
488   for (i = 0; i < 2; i++)
179   /* general case; render every non-zero texel */
180   for (x = startx; x < stopx; x += xstep)
489181   {
490      /* first tri is 0,1,2; second is 0,3,2 */
491      if (i == 0)
492         scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
493      else
494         scans = setup_triangle_0(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
495
496      /* skip if we're clipped out */
497      if (!scans)
498         continue;
499
500      /* loop over scanlines */
501      curscan = scans->scanline;
502      for (y = scans->sy; y <= scans->ey; y++, curscan++)
503      {
504         UINT16 *d = dest + y * 512 + curscan->sx;
505         int width = curscan->ex - curscan->sx + 1;
506         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
507         for (x = 0; x < width; x++)
508            d[x] = pixdata;
509      }
182      UINT8 pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
183      if (pix != 0)
184         dest[x] = pixdata | pix;
185      u += dudx;
186      v += dvdx;
510187   }
511188}
512189
513190
514static void render_flat_dither_quad(running_machine *machine)
191static void render_textransmask(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
515192{
516   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
517   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
518   const struct poly_scanline_data *scans;
519   const struct poly_scanline *curscan;
520   int x, y, i;
193   poly_extra_data *extra = poly->extra;
194   UINT16 *dest = (UINT16 *)destbase + scanline * 512;
195   UINT16 pixdata = extra->pixdata;
196   const UINT8 *texbase = extra->texbase;
197   INT32 u = poly_param_value(startx, scanline, 0, poly) * 65536.0f;
198   INT32 v = poly_param_value(startx, scanline, 1, poly) * 65536.0f;
199   INT32 dudx = poly->param[0].dpdx * 65536.0f;
200   INT32 dvdx = poly->param[1].dpdx * 65536.0f;
201   int xstep = extra->dither + 1;
202   int x;
521203
522   /* loop over two tris */
523   for (i = 0; i < 2; i++)
204   /* if dithering, we advance by 2x; also ensure that we start on an appropriate pixel */
205   if (xstep == 2)
524206   {
525      /* first tri is 0,1,2; second is 0,3,2 */
526      if (i == 0)
527         scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
528      else
529         scans = setup_triangle_0(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
530
531      /* skip if we're clipped out */
532      if (!scans)
533         continue;
534
535      /* loop over scanlines */
536      curscan = scans->scanline;
537      for (y = scans->sy; y <= scans->ey; y++, curscan++)
207      if ((scanline ^ startx) & 1)
538208      {
539         int tsx = curscan->sx + ((curscan->sx ^ y) & 1);
540         UINT16 *d = dest + y * 512;
541         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
542         for (x = tsx; x <= curscan->ex; x += 2)
543            d[x] = pixdata;
209         startx++;
210         u += dudx;
211         v += dvdx;
544212      }
213      dudx *= 2;
214      dvdx *= 2;
545215   }
546}
547216
548
549
550/*************************************
551 *
552 *  Generic textured quad renderers
553 *
554 *************************************/
555
556static void render_tex_quad(running_machine *machine)
557{
558   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
559   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
560   UINT16 pixdata = dma_data[1];
561   const struct poly_scanline_data *scans;
562   const struct poly_scanline *curscan;
563   int x, y, i;
564
565   /* fill in the vertex data */
566   vert[0].p[0] = dma_data[10] & 0xff;
567   vert[0].p[1] = dma_data[10] >> 8;
568   vert[1].p[0] = dma_data[11] & 0xff;
569   vert[1].p[1] = dma_data[11] >> 8;
570   vert[2].p[0] = dma_data[12] & 0xff;
571   vert[2].p[1] = dma_data[12] >> 8;
572   vert[3].p[0] = dma_data[13] & 0xff;
573   vert[3].p[1] = dma_data[13] >> 8;
574
575   /* loop over two tris */
576   for (i = 0; i < 2; i++)
217   /* general case; every non-zero texel renders pixdata */
218   for (x = startx; x < stopx; x += xstep)
577219   {
578      /* first tri is 0,1,2; second is 0,3,2 */
579      if (i == 0)
580         scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
581      else
582         scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
583
584      /* skip if we're clipped out */
585      if (!scans)
586         continue;
587
588      /* loop over scanlines */
589      curscan = scans->scanline;
590      for (y = scans->sy; y <= scans->ey; y++, curscan++)
591      {
592         UINT16 *d = dest + y * 512 + curscan->sx;
593         int width = curscan->ex - curscan->sx + 1;
594         int u = curscan->p[0], dudx = scans->dp[0];
595         int v = curscan->p[1], dvdx = scans->dp[1];
596         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
597         for (x = 0; x < width; x++)
598         {
599            d[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)];
600            u += dudx;
601            v += dvdx;
602         }
603      }
220      UINT8 pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
221      if (pix != 0)
222         dest[x] = pixdata;
223      u += dudx;
224      v += dvdx;
604225   }
605226}
606227
607228
608static void render_textrans_quad(running_machine *machine)
609{
610   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
611   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
612   UINT16 pixdata = dma_data[1];
613   const struct poly_scanline_data *scans;
614   const struct poly_scanline *curscan;
615   int x, y, i;
616229
617   /* fill in the vertex data */
618   vert[0].p[0] = dma_data[10] & 0xff;
619   vert[0].p[1] = dma_data[10] >> 8;
620   vert[1].p[0] = dma_data[11] & 0xff;
621   vert[1].p[1] = dma_data[11] >> 8;
622   vert[2].p[0] = dma_data[12] & 0xff;
623   vert[2].p[1] = dma_data[12] >> 8;
624   vert[3].p[0] = dma_data[13] & 0xff;
625   vert[3].p[1] = dma_data[13] >> 8;
626
627   /* loop over two tris */
628   for (i = 0; i < 2; i++)
629   {
630      /* first tri is 0,1,2; second is 0,3,2 */
631      if (i == 0)
632         scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
633      else
634         scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
635
636      /* skip if we're clipped out */
637      if (!scans)
638         continue;
639
640      /* loop over scanlines */
641      curscan = scans->scanline;
642      for (y = scans->sy; y <= scans->ey; y++, curscan++)
643      {
644         UINT16 *d = dest + y * 512 + curscan->sx;
645         int width = curscan->ex - curscan->sx + 1;
646         int u = curscan->p[0], dudx = scans->dp[0];
647         int v = curscan->p[1], dvdx = scans->dp[1];
648         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
649         for (x = 0; x < width; x++)
650         {
651            int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
652            if (pix) d[x] = pixdata | pix;
653            u += dudx;
654            v += dvdx;
655         }
656      }
657   }
658}
659
660
661static void render_textransmask_quad(running_machine *machine)
662{
663   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
664   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
665   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
666   const struct poly_scanline_data *scans;
667   const struct poly_scanline *curscan;
668   int x, y, i;
669
670   /* fill in the vertex data */
671   vert[0].p[0] = dma_data[10] & 0xff;
672   vert[0].p[1] = dma_data[10] >> 8;
673   vert[1].p[0] = dma_data[11] & 0xff;
674   vert[1].p[1] = dma_data[11] >> 8;
675   vert[2].p[0] = dma_data[12] & 0xff;
676   vert[2].p[1] = dma_data[12] >> 8;
677   vert[3].p[0] = dma_data[13] & 0xff;
678   vert[3].p[1] = dma_data[13] >> 8;
679
680   /* loop over two tris */
681   for (i = 0; i < 2; i++)
682   {
683      /* first tri is 0,1,2; second is 0,3,2 */
684      if (i == 0)
685         scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
686      else
687         scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
688
689      /* skip if we're clipped out */
690      if (!scans)
691         continue;
692
693      /* loop over scanlines */
694      curscan = scans->scanline;
695      for (y = scans->sy; y <= scans->ey; y++, curscan++)
696      {
697         UINT16 *d = dest + y * 512 + curscan->sx;
698         int width = curscan->ex - curscan->sx + 1;
699         int u = curscan->p[0], dudx = scans->dp[0];
700         int v = curscan->p[1], dvdx = scans->dp[1];
701         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
702         for (x = 0; x < width; x++)
703         {
704            int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
705            if (pix) d[x] = pixdata;
706            u += dudx;
707            v += dvdx;
708         }
709      }
710   }
711}
712
713
714
715230/*************************************
716231 *
717 *  Generic dithered textured quad renderers
718 *
719 *************************************/
720
721static void render_tex_dither_quad(running_machine *machine)
722{
723   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
724   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
725   UINT16 pixdata = dma_data[1];
726   const struct poly_scanline_data *scans;
727   const struct poly_scanline *curscan;
728   int x, y, i;
729
730   /* fill in the vertex data */
731   vert[0].p[0] = dma_data[10] & 0xff;
732   vert[0].p[1] = dma_data[10] >> 8;
733   vert[1].p[0] = dma_data[11] & 0xff;
734   vert[1].p[1] = dma_data[11] >> 8;
735   vert[2].p[0] = dma_data[12] & 0xff;
736   vert[2].p[1] = dma_data[12] >> 8;
737   vert[3].p[0] = dma_data[13] & 0xff;
738   vert[3].p[1] = dma_data[13] >> 8;
739
740   /* loop over two tris */
741   for (i = 0; i < 2; i++)
742   {
743      /* first tri is 0,1,2; second is 0,3,2 */
744      if (i == 0)
745         scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
746      else
747         scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
748
749      /* skip if we're clipped out */
750      if (!scans)
751         continue;
752
753      /* loop over scanlines */
754      curscan = scans->scanline;
755      for (y = scans->sy; y <= scans->ey; y++, curscan++)
756      {
757         int u = curscan->p[0], dudx = scans->dp[0];
758         int v = curscan->p[1], dvdx = scans->dp[1];
759         UINT16 *d = dest + y * 512;
760         int tsx = curscan->sx;
761
762         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
763         if ((tsx ^ y) & 1)
764         {
765            tsx++;
766            u += dudx;
767            v += dvdx;
768         }
769
770         dudx *= 2;
771         dvdx *= 2;
772
773         for (x = tsx; x <= curscan->ex; x += 2)
774         {
775            d[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)];
776            u += dudx;
777            v += dvdx;
778         }
779      }
780   }
781}
782
783
784static void render_textrans_dither_quad(running_machine *machine)
785{
786   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
787   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
788   UINT16 pixdata = dma_data[1];
789   const struct poly_scanline_data *scans;
790   const struct poly_scanline *curscan;
791   int x, y, i;
792
793   /* fill in the vertex data */
794   vert[0].p[0] = dma_data[10] & 0xff;
795   vert[0].p[1] = dma_data[10] >> 8;
796   vert[1].p[0] = dma_data[11] & 0xff;
797   vert[1].p[1] = dma_data[11] >> 8;
798   vert[2].p[0] = dma_data[12] & 0xff;
799   vert[2].p[1] = dma_data[12] >> 8;
800   vert[3].p[0] = dma_data[13] & 0xff;
801   vert[3].p[1] = dma_data[13] >> 8;
802
803   /* loop over two tris */
804   for (i = 0; i < 2; i++)
805   {
806      /* first tri is 0,1,2; second is 0,3,2 */
807      if (i == 0)
808         scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
809      else
810         scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
811
812      /* skip if we're clipped out */
813      if (!scans)
814         continue;
815
816      /* loop over scanlines */
817      curscan = scans->scanline;
818      for (y = scans->sy; y <= scans->ey; y++, curscan++)
819      {
820         int u = curscan->p[0], dudx = scans->dp[0];
821         int v = curscan->p[1], dvdx = scans->dp[1];
822         UINT16 *d = dest + y * 512;
823         int tsx = curscan->sx;
824
825         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
826         if ((tsx ^ y) & 1)
827         {
828            tsx++;
829            u += dudx;
830            v += dvdx;
831         }
832
833         dudx *= 2;
834         dvdx *= 2;
835
836         for (x = tsx; x <= curscan->ex; x += 2)
837         {
838            int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
839            if (pix) d[x] = pixdata | pix;
840            u += dudx;
841            v += dvdx;
842         }
843      }
844   }
845}
846
847
848static void render_textransmask_dither_quad(running_machine *machine)
849{
850   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
851   UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
852   UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
853   const struct poly_scanline_data *scans;
854   const struct poly_scanline *curscan;
855   int x, y, i;
856
857   /* fill in the vertex data */
858   vert[0].p[0] = dma_data[10] & 0xff;
859   vert[0].p[1] = dma_data[10] >> 8;
860   vert[1].p[0] = dma_data[11] & 0xff;
861   vert[1].p[1] = dma_data[11] >> 8;
862   vert[2].p[0] = dma_data[12] & 0xff;
863   vert[2].p[1] = dma_data[12] >> 8;
864   vert[3].p[0] = dma_data[13] & 0xff;
865   vert[3].p[1] = dma_data[13] >> 8;
866
867   /* loop over two tris */
868   for (i = 0; i < 2; i++)
869   {
870      /* first tri is 0,1,2; second is 0,3,2 */
871      if (i == 0)
872         scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea);
873      else
874         scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea);
875
876      /* skip if we're clipped out */
877      if (!scans)
878         continue;
879
880      /* loop over scanlines */
881      curscan = scans->scanline;
882      for (y = scans->sy; y <= scans->ey; y++, curscan++)
883      {
884         int u = curscan->p[0], dudx = scans->dp[0];
885         int v = curscan->p[1], dvdx = scans->dp[1];
886         UINT16 *d = dest + y * 512;
887         int tsx = curscan->sx;
888
889         ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1);
890         if ((tsx ^ y) & 1)
891         {
892            tsx++;
893            u += dudx;
894            v += dvdx;
895         }
896
897         dudx *= 2;
898         dvdx *= 2;
899
900         for (x = tsx; x <= curscan->ex; x += 2)
901         {
902            int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)];
903            if (pix) d[x] = pixdata;
904            u += dudx;
905            v += dvdx;
906         }
907      }
908   }
909}
910
911
912
913/*************************************
914 *
915232 *  DMA queue processor
916233 *
917234 *************************************/
r1185r1186
919236static void process_dma_queue(running_machine *machine)
920237{
921238   int textured = ((dma_data[0] & 0x300) == 0x100);
922   int dithered = dma_data[0] & 0x2000;
923   int straight;
239   poly_draw_scanline callback;
240   poly_vertex vert[4];
241   int i;
924242
925#if KEEP_STATISTICS
926   polycount++;
927#endif
928
929243   /* if we're rendering to the same page we're viewing, it has changed */
930244   if ((((page_control >> 2) ^ page_control) & 1) == 0)
931245      video_changed = TRUE;
932246
933247   /* fill in the vertex data */
934   vert[0].x = (INT16)dma_data[2];
935   vert[0].y = (INT16)dma_data[3];
936   vert[1].x = (INT16)dma_data[4];
937   vert[1].y = (INT16)dma_data[5];
938   vert[2].x = (INT16)dma_data[6];
939   vert[2].y = (INT16)dma_data[7];
940   vert[3].x = (INT16)dma_data[8];
941   vert[3].y = (INT16)dma_data[9];
248   vert[0].x = (float)(INT16)dma_data[2];
249   vert[0].y = (float)(INT16)dma_data[3];
250   vert[1].x = (float)(INT16)dma_data[4];
251   vert[1].y = (float)(INT16)dma_data[5];
252   vert[2].x = (float)(INT16)dma_data[6];
253   vert[2].y = (float)(INT16)dma_data[7];
254   vert[3].x = (float)(INT16)dma_data[8];
255   vert[3].y = (float)(INT16)dma_data[9];
942256
943   /* determine if it's straight-on or arbitrary */
944   straight = quad_is_straight();
945
946257   /* handle flat-shaded quads here */
947258   if (!textured)
948   {
949      /* two cases: straight on and arbitrary */
950      if (straight)
951      {
952         if (!dithered)
953            render_straight_flat_quad(machine);
954         else
955            render_straight_flat_dither_quad(machine);
956      }
957      else
958      {
959         if (!dithered)
960            render_flat_quad(machine);
961         else
962            render_flat_dither_quad(machine);
963      }
964   }
259      callback = render_flat;
965260
966261   /* handle textured quads here */
967262   else
968263   {
969      /* three cases: straight on, non-dithered arbitrary, and dithered arbitrary */
970      if (straight && !dithered)
971      {
972         /* handle non-masked, non-transparent quads */
973         if ((dma_data[0] & 0xc00) == 0x000)
974            render_straight_tex_quad(machine);
264      /* if textured, add the texture info */
265      vert[0].p[0] = (float)(dma_data[10] & 0xff);
266      vert[0].p[1] = (float)(dma_data[10] >> 8);
267      vert[1].p[0] = (float)(dma_data[11] & 0xff);
268      vert[1].p[1] = (float)(dma_data[11] >> 8);
269      vert[2].p[0] = (float)(dma_data[12] & 0xff);
270      vert[2].p[1] = (float)(dma_data[12] >> 8);
271      vert[3].p[0] = (float)(dma_data[13] & 0xff);
272      vert[3].p[1] = (float)(dma_data[13] >> 8);
975273
976         /* handle non-masked, transparent quads */
977         else if ((dma_data[0] & 0xc00) == 0x800)
978            render_straight_textrans_quad(machine);
274      /* handle non-masked, non-transparent quads */
275      if ((dma_data[0] & 0xc00) == 0x000)
276         callback = render_tex;
979277
980         /* handle masked, transparent quads */
981         else if ((dma_data[0] & 0xc00) == 0xc00)
982            render_straight_textransmask_quad(machine);
278      /* handle non-masked, transparent quads */
279      else if ((dma_data[0] & 0xc00) == 0x800)
280         callback = render_textrans;
983281
984         /* handle masked, non-transparent quads */
985         else
986            render_straight_flat_quad(machine);
987      }
988      else if (!dithered)
989      {
990         /* handle non-masked, non-transparent quads */
991         if ((dma_data[0] & 0xc00) == 0x000)
992            render_tex_quad(machine);
282      /* handle masked, transparent quads */
283      else if ((dma_data[0] & 0xc00) == 0xc00)
284         callback = render_textransmask;
993285
994         /* handle non-masked, transparent quads */
995         else if ((dma_data[0] & 0xc00) == 0x800)
996            render_textrans_quad(machine);
997
998         /* handle masked, transparent quads */
999         else if ((dma_data[0] & 0xc00) == 0xc00)
1000            render_textransmask_quad(machine);
1001
1002         /* handle masked, non-transparent quads */
1003         else
1004            render_flat_quad(machine);
1005      }
286      /* handle masked, non-transparent quads */
1006287      else
1007      {
1008         /* handle non-masked, non-transparent quads */
1009         if ((dma_data[0] & 0xc00) == 0x000)
1010            render_tex_dither_quad(machine);
288         callback = render_flat;
289   }
1011290
1012         /* handle non-masked, transparent quads */
1013         else if ((dma_data[0] & 0xc00) == 0x800)
1014            render_textrans_dither_quad(machine);
291   /* loop over two tris */
292   for (i = 0; i < 2; i++)
293   {
294      poly_extra_data *extra = poly_get_extra_data(poly);
295      UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
1015296
1016         /* handle masked, transparent quads */
1017         else if ((dma_data[0] & 0xc00) == 0xc00)
1018            render_textransmask_dither_quad(machine);
297      /* set up the extra data for this triangle */
298      extra->texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256);
299      extra->pixdata = dma_data[1] | (dma_data[0] & 0x00ff);
300      extra->dither = ((dma_data[0] & 0x2000) != 0);
1019301
1020         /* handle masked, non-transparent quads */
1021         else
1022            render_flat_dither_quad(machine);
1023      }
302      /* first tri is 0,1,2; second is 0,3,2 */
303      if (i == 0)
304         poly_render_triangle(poly, dest, &machine->screen[0].visarea, callback, textured ? 2 : 0, &vert[0], &vert[1], &vert[2]);
305      else
306         poly_render_triangle(poly, dest, &machine->screen[0].visarea, callback, textured ? 2 : 0, &vert[0], &vert[3], &vert[2]);
1024307   }
1025308}
1026309
r1185r1186
1076359      video_changed = TRUE;
1077360      if (LOG_DMA && input_code_pressed(KEYCODE_L))
1078361         logerror("##########################################################\n");
1079#if KEEP_STATISTICS
1080      popmessage("Polys:%d  Render:%d%%  FPS:%d",
1081            polycount, pixelcount / (512*4), lastfps);
1082      polycount = pixelcount = 0;
1083      framecount++;
1084#endif
1085362      video_screen_update_partial(0, video_screen_get_vpos(0) - 1);
1086363   }
1087364   page_control = data;
r1185r1186
1142419
1143420WRITE32_HANDLER( midvunit_videoram_w )
1144421{
422   poly_wait(poly, "Video RAM write");
1145423   if (!video_changed)
1146424   {
1147425      int visbase = (page_control & 1) ? 0x40000 : 0x00000;
r1185r1186
1154432
1155433READ32_HANDLER( midvunit_videoram_r )
1156434{
435   poly_wait(poly, "Video RAM read");
1157436   return midvunit_videoram[offset];
1158437}
1159438
r1185r1186
1185464WRITE32_HANDLER( midvunit_textureram_w )
1186465{
1187466   UINT8 *base = (UINT8 *)midvunit_textureram;
467   poly_wait(poly, "Texture RAM write");
1188468   base[offset * 2] = data;
1189469   base[offset * 2 + 1] = data >> 8;
1190470}
r1185r1186
1210490   int x, y, width, xoffs;
1211491   UINT32 offset;
1212492
493   poly_wait(poly, "Refresh Time");
494
1213495   /* if the video didn't change, indicate as much */
1214496   if (!video_changed)
1215497      return UPDATE_HAS_NOT_CHANGED;
1216498   video_changed = FALSE;
1217499
1218#if KEEP_STATISTICS
1219   totalframes++;
1220   if (totalframes == 57)
1221   {
1222      lastfps = framecount;
1223      framecount = totalframes = 0;
1224   }
1225#endif
1226
1227500   /* determine the base of the videoram */
1228501#if WATCH_RENDER
1229502   offset = (page_control & 4) ? 0x40000 : 0x00000;
src/mame/video/turbo.c
r1185r1186
10151015         forebits = pr5198[offs];
10161016
10171017         /* fetch the STAR bit */
1018         star = state->buckrog_bitmap_ram[y * 64 + xx];
1018         star = state->buckrog_bitmap_ram[y * 256 + xx];
10191019
10201020         /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */
10211021         for (ix = 0; ix < TURBO_X_SCALE; ix++)
src/mame/video/f1gp.c
r1185r1186
11#include "driver.h"
22#include "video/konamiic.h"
3#include "f1gp.h"
3//#include "f1gp.h"
44
55
66UINT16 *f1gp_spr1vram,*f1gp_spr2vram,*f1gp_spr1cgram,*f1gp_spr2cgram;
77UINT16 *f1gp_fgvideoram,*f1gp_rozvideoram;
88UINT16 *f1gp2_sprcgram,*f1gp2_spritelist;
9UINT16 *f1gpb_rozregs, *f1gpb_fgregs;
910size_t f1gp_spr1cgram_size,f1gp_spr2cgram_size;
1011
1112static UINT16 *zoomdata;
r1185r1186
5455
5556VIDEO_START( f1gp )
5657{
57   roz_tilemap = tilemap_create(f1gp_get_roz_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     16,16,64,64);
58   roz_tilemap = tilemap_create(f1gp_get_roz_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,64,64);
5859   fg_tilemap =  tilemap_create(get_fg_tile_info,      tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
5960
6061   K053936_wraparound_enable(0, 1);
r1185r1186
6869   zoomdata = (UINT16 *)memory_region(REGION_GFX4);
6970}
7071
72VIDEO_START( f1gpb )
73{
74   roz_tilemap = tilemap_create(f1gp_get_roz_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,64,64);
75   fg_tilemap =  tilemap_create(get_fg_tile_info,      tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
76
77   tilemap_set_transparent_pen(fg_tilemap,0xff);
78
79   dirtychar = auto_malloc(TOTAL_CHARS);
80   memset(dirtychar,1,TOTAL_CHARS);
81
82   zoomdata = (UINT16 *)memory_region(REGION_GFX4);
83}
84
7185VIDEO_START( f1gp2 )
7286{
7387   roz_tilemap = tilemap_create(f1gp2_get_roz_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,64,64);
r1185r1186
247261   }
248262}
249263
264static void f1gpb_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
265{
266   int attr_start, start_offset = spriteram_size/2 - 4;
250267
268   // find the "end of list" to draw the sprites in reverse order
269   for (attr_start = 4;attr_start < spriteram_size/2;attr_start += 4)
270   {
271      if (spriteram16[attr_start+3-4] == 0xffff) /* end of list marker */
272      {
273         start_offset = attr_start - 4;
274         break;
275      }
276   }
277
278   for (attr_start = start_offset;attr_start >= 4;attr_start -= 4)
279   {
280      int code,gfx;
281      int x,y,flipx,flipy,color,pri;
282
283      x = (spriteram16[attr_start + 2] & 0x03ff) - 48;
284      y = (256 - (spriteram16[attr_start + 3 - 4] & 0x03ff)) - 15;
285      flipx = spriteram16[attr_start + 1] & 0x0800;
286      flipy = spriteram16[attr_start + 1] & 0x8000;
287      color = spriteram16[attr_start + 1] & 0x000f;
288      code = spriteram16[attr_start + 0] & 0x3fff;
289      pri = 0; //?
290
291      if((spriteram16[attr_start + 1] & 0x00f0) && (spriteram16[attr_start + 1] & 0x00f0) != 0xc0)
292      {
293         printf("attr %X\n",spriteram16[attr_start + 1] & 0x00f0);
294         code = mame_rand(Machine);
295      }
296
297/*
298        if(spriteram16[attr_start + 1] & ~0x88cf)
299            printf("1 = %X\n",spriteram16[attr_start + 1] & ~0x88cf);
300*/
301      if(code >= 0x2000)
302      {
303         gfx = 1;
304         code -= 0x2000;
305      }
306      else
307      {
308         gfx = 0;
309      }
310
311      pdrawgfx(bitmap,machine->gfx[1 + gfx],
312         code,
313         color,
314         flipx,flipy,
315         x,y,
316         cliprect,TRANSPARENCY_PEN,15,
317         pri ? 0 : 0x2);
318
319      // wrap around x
320      pdrawgfx(bitmap,machine->gfx[1 + gfx],
321         code,
322         color,
323         flipx,flipy,
324         x - 512,y,
325         cliprect,TRANSPARENCY_PEN,15,
326         pri ? 0 : 0x2);
327   }
328}
329
330
251331VIDEO_UPDATE( f1gp )
252332{
253333   static const gfx_layout tilelayout =
r1185r1186
309389   return 0;
310390}
311391
392VIDEO_UPDATE( f1gpb )
393{
394   UINT32 startx,starty;
395   int incxx,incxy,incyx,incyy;
312396
397   static const gfx_layout tilelayout =
398   {
399      16,16,
400      TOTAL_CHARS,
401      4,
402      { 0, 1, 2, 3 },
403#ifdef LSB_FIRST
404      { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4,
405            10*4, 11*4, 8*4, 9*4, 14*4, 15*4, 12*4, 13*4 },
406#else
407      { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
408            8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
409#endif
410      { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
411            8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
412      64*16,
413   };
313414
415
416   if (dirtygfx)
417   {
418      int i;
419
420      dirtygfx = 0;
421
422      for (i = 0;i < TOTAL_CHARS;i++)
423      {
424         if (dirtychar[i])
425         {
426            dirtychar[i] = 0;
427            decodechar(machine->gfx[3],i,(UINT8 *)zoomdata,&tilelayout);
428         }
429      }
430
431      tilemap_mark_all_tiles_dirty(roz_tilemap);
432   }
433
434   incxy = (INT16)f1gpb_rozregs[1];
435   incyx = -incxy;
436   incxx = incyy = (INT16)f1gpb_rozregs[3];
437   startx = f1gpb_rozregs[0] + 328;
438   starty = f1gpb_rozregs[2];
439
440   tilemap_set_scrolly(fg_tilemap,0,f1gpb_fgregs[0] + 8);
441
442   fillbitmap(priority_bitmap, 0, cliprect);
443
444   tilemap_draw_roz(bitmap, cliprect, roz_tilemap,
445      startx << 13, starty << 13,
446      incxx << 5, incxy << 5, incyx << 5, incyy << 5,
447      1, 0, 0);
448
449   tilemap_draw(bitmap,cliprect,fg_tilemap,0,1);
450
451   f1gpb_draw_sprites(machine,bitmap,cliprect);
452
453   return 0;
454}
455
456
314457static void f1gp2_draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect)
315458{
316459   int offs;
src/mame/layout/peplus.lay
r0r1186
1<!-- peplus.lay -->
2
3<mamelayout version="2">
4   <element name="bezel">
5   </element>
6
7   <element name="hold" defstate="1">
8      <rect state="0">
9         <color red="0.5" green="0.5" blue="0.5" />
10      </rect>
11      <rect state="1">
12         <color red="1.0" green="1.0" blue="1.0" />
13      </rect>
14      <text string="HOLD">
15         <color red="0.0" green="0.0" blue="0.0" />
16         <bounds x="0" y="0.1" width="1" height="0.8" />
17      </text>
18   </element>
19
20   <element name="change" defstate="1">
21      <rect state="1">
22         <color red="1.0" green="0.0" blue="0.0" />
23      </rect>
24      <rect state="0">
25         <color red="0.5" green="0.0" blue="0.0" />
26      </rect>
27   </element>
28
29   <element name="dooropen" defstate="1">
30      <rect state="0">
31         <color red="0.5" green="0.5" blue="0.5" />
32      </rect>
33      <rect state="1">
34         <color red="1.0" green="1.0" blue="1.0" />
35      </rect>
36      <text string="DOOR OPEN">
37         <color red="0.0" green="0.0" blue="0.0" />
38         <bounds x="0" y="0.1" width="1" height="0.8" />
39      </text>
40   </element>
41
42   <element name="dealdraw" defstate="1">
43      <rect state="0">
44         <color red="0.5" green="0.5" blue="0.5" />
45      </rect>
46      <rect state="1">
47         <color red="1.0" green="1.0" blue="1.0" />
48      </rect>
49      <text string="DEAL DRAW">
50         <color red="0.0" green="0.0" blue="0.0" />
51         <bounds x="0" y="0.1" width="1" height="0.8" />
52      </text>
53   </element>
54
55   <element name="cashout" defstate="1">
56      <rect state="0">
57         <color red="0.5" green="0.5" blue="0.5" />
58      </rect>
59      <rect state="1">
60         <color red="1.0" green="1.0" blue="1.0" />
61      </rect>
62      <text string="CASHOUT">
63         <color red="0.0" green="0.0" blue="0.0" />
64         <bounds x="0" y="0.1" width="1" height="0.8" />
65      </text>
66   </element>
67
68   <element name="betcredits" defstate="1">
69      <rect state="0">
70         <color red="0.5" green="0.5" blue="0.5" />
71      </rect>
72      <rect state="1">
73         <color red="1.0" green="1.0" blue="1.0" />
74      </rect>
75      <text string="BET CREDITS">
76         <color red="0.0" green="0.0" blue="0.0" />
77         <bounds x="0" y="0.1" width="1" height="0.8" />
78      </text>
79   </element>
80
81   <view name="Bezel Lamps">
82      <screen index="0">
83         <bounds left="10" top="40" right="330" bottom="240" />
84      </screen>
85      <bezel element="bezel">
86         <bounds left="0" top="0" right="340" bottom="310" />
87      </bezel>
88      <bezel name="lamp3" element="hold">
89         <bounds x="50" y="250" width="40" height="20" />
90      </bezel>
91      <bezel name="lamp0" element="hold">
92         <bounds x="100" y="250" width="40" height="20" />
93      </bezel>
94      <bezel name="lamp0" element="hold">
95         <bounds x="150" y="250" width="40" height="20" />
96      </bezel>
97      <bezel name="lamp0" element="hold">
98         <bounds x="200" y="250" width="40" height="20" />
99      </bezel>
100      <bezel name="lamp7" element="hold">
101         <bounds x="250" y="250" width="40" height="20" />
102      </bezel>
103      <bezel name="lamp5" element="change">
104         <bounds x="310" y="10" width="20" height="20" />
105      </bezel>
106      <bezel name="lamp6" element="dooropen">
107         <bounds x="10" y="10" width="100" height="20" />
108      </bezel>
109      <bezel name="lamp1" element="dealdraw">
110         <bounds x="10" y="280" width="100" height="20" />
111      </bezel>
112      <bezel name="lamp2" element="cashout">
113         <bounds x="120" y="280" width="100" height="20" />
114      </bezel>
115      <bezel name="lamp4" element="betcredits">
116         <bounds x="230" y="280" width="100" height="20" />
117      </bezel>
118   </view>
119</mamelayout>
src/mame/layout/peset038.lay
r0r1186
1<!-- peplus.lay -->
2
3<mamelayout version="2">
4   <element name="bezel">
5   </element>
6
7   <element name="hold" defstate="1">
8      <rect state="0">
9         <color red="0.5" green="0.5" blue="0.5" />
10      </rect>
11      <rect state="1">
12         <color red="1.0" green="1.0" blue="1.0" />
13      </rect>
14      <text string="HOLD">
15         <color red="0.0" green="0.0" blue="0.0" />
16         <bounds x="0" y="0.1" width="1" height="0.8" />
17      </text>
18   </element>
19
20   <element name="change" defstate="1">
21      <rect state="1">
22         <color red="1.0" green="0.0" blue="0.0" />
23      </rect>
24      <rect state="0">
25         <color red="0.5" green="0.0" blue="0.0" />
26      </rect>
27   </element>
28
29   <element name="dooropen" defstate="1">
30      <rect state="0">
31         <color red="0.5" green="0.5" blue="0.5" />
32      </rect>
33      <rect state="1">
34         <color red="1.0" green="1.0" blue="1.0" />
35      </rect>
36      <text string="DOOR OPEN">
37         <color red="0.0" green="0.0" blue="0.0" />
38         <bounds x="0" y="0.1" width="1" height="0.8" />
39      </text>
40   </element>
41
42   <element name="dealdraw" defstate="1">
43      <rect state="0">
44         <color red="0.5" green="0.5" blue="0.5" />
45      </rect>
46      <rect state="1">
47         <color red="1.0" green="1.0" blue="1.0" />
48      </rect>
49      <text string="DEAL DRAW">
50         <color red="0.0" green="0.0" blue="0.0" />
51         <bounds x="0" y="0.1" width="1" height="0.8" />
52      </text>
53   </element>
54
55   <element name="cashout" defstate="1">
56      <rect state="0">
57         <color red="0.5" green="0.5" blue="0.5" />
58      </rect>
59      <rect state="1">
60         <color red="1.0" green="1.0" blue="1.0" />
61      </rect>
62      <text string="CASHOUT">
63         <color red="0.0" green="0.0" blue="0.0" />
64         <bounds x="0" y="0.1" width="1" height="0.8" />
65      </text>
66   </element>
67
68   <element name="betcredits" defstate="1">
69      <rect state="0">
70         <color red="0.5" green="0.5" blue="0.5" />
71      </rect>
72      <rect state="1">
73         <color red="1.0" green="1.0" blue="1.0" />
74      </rect>
75      <text string="BET CREDITS">
76         <color red="0.0" green="0.0" blue="0.0" />
77         <bounds x="0" y="0.1" width="1" height="0.8" />
78      </text>
79   </element>
80
81   <view name="Bezel Lamps">
82      <screen index="0">
83         <bounds left="10" top="40" right="330" bottom="240" />
84      </screen>
85      <bezel element="bezel">
86         <bounds left="0" top="0" right="340" bottom="310" />
87      </bezel>
88      <bezel name="lamp3" element="hold">
89         <bounds x="50" y="250" width="40" height="20" />
90      </bezel>
91      <bezel name="lamp0" element="hold">
92         <bounds x="100" y="250" width="40" height="20" />
93      </bezel>
94      <bezel name="lamp0" element="hold">
95         <bounds x="150" y="250" width="40" height="20" />
96      </bezel>
97      <bezel name="lamp0" element="hold">
98         <bounds x="200" y="250" width="40" height="20" />
99      </bezel>
100      <bezel name="lamp7" element="hold">
101         <bounds x="250" y="250" width="40" height="20" />
102      </bezel>
103      <bezel name="lamp5" element="change">
104         <bounds x="310" y="10" width="20" height="20" />
105      </bezel>
106      <bezel name="lamp6" element="dooropen">
107         <bounds x="10" y="10" width="100" height="20" />
108      </bezel>
109      <bezel name="lamp1" element="dealdraw">
110         <bounds x="10" y="280" width="100" height="20" />
111      </bezel>
112      <bezel name="lamp2" element="cashout">
113         <bounds x="120" y="280" width="100" height="20" />
114      </bezel>
115      <bezel name="lamp4" element="betcredits">
116         <bounds x="230" y="280" width="100" height="20" />
117      </bezel>
118   </view>
119</mamelayout>
src/mame/layout/pepp0188.lay
r0r1186
1<!-- peplus.lay -->
2
3<mamelayout version="2">
4   <element name="bezel">
5   </element>
6
7   <element name="hold" defstate="1">
8      <rect state="0">
9         <color red="0.5" green="0.5" blue="0.5" />
10      </rect>
11      <rect state="1">
12         <color red="1.0" green="1.0" blue="1.0" />
13      </rect>
14      <text string="HOLD">
15         <color red="0.0" green="0.0" blue="0.0" />
16         <bounds x="0" y="0.1" width="1" height="0.8" />
17      </text>
18   </element>
19
20   <element name="change" defstate="1">
21      <rect state="1">
22         <color red="1.0" green="0.0" blue="0.0" />
23      </rect>
24      <rect state="0">
25         <color red="0.5" green="0.0" blue="0.0" />
26      </rect>
27   </element>
28
29   <element name="dooropen" defstate="1">
30      <rect state="0">
31         <color red="0.5" green="0.5" blue="0.5" />
32      </rect>
33      <rect state="1">
34         <color red="1.0" green="1.0" blue="1.0" />
35      </rect>
36      <text string="DOOR OPEN">
37         <color red="0.0" green="0.0" blue="0.0" />
38         <bounds x="0" y="0.1" width="1" height="0.8" />
39      </text>
40   </element>
41
42   <element name="dealdraw" defstate="1">
43      <rect state="0">
44         <color red="0.5" green="0.5" blue="0.5" />
45      </rect>
46      <rect state="1">
47         <color red="1.0" green="1.0" blue="1.0" />
48      </rect>
49      <text string="DEAL DRAW">
50         <color red="0.0" green="0.0" blue="0.0" />
51         <bounds x="0" y="0.1" width="1" height="0.8" />
52      </text>
53   </element>
54
55   <element name="cashout" defstate="1">
56      <rect state="0">
57         <color red="0.5" green="0.5" blue="0.5" />
58      </rect>
59      <rect state="1">
60         <color red="1.0" green="1.0" blue="1.0" />
61      </rect>
62      <text string="CASHOUT">
63         <color red="0.0" green="0.0" blue="0.0" />
64         <bounds x="0" y="0.1" width="1" height="0.8" />
65      </text>
66   </element>
67
68   <element name="betcredits" defstate="1">
69      <rect state="0">
70         <color red="0.5" green="0.5" blue="0.5" />
71      </rect>
72      <rect state="1">
73         <color red="1.0" green="1.0" blue="1.0" />
74      </rect>
75      <text string="BET CREDITS">
76         <color red="0.0" green="0.0" blue="0.0" />
77         <bounds x="0" y="0.1" width="1" height="0.8" />
78      </text>
79   </element>
80
81   <view name="Bezel Lamps">
82      <screen index="0">
83         <bounds left="10" top="40" right="330" bottom="240" />
84      </screen>
85      <bezel element="bezel">
86         <bounds left="0" top="0" right="340" bottom="310" />
87      </bezel>
88      <bezel name="lamp3" element="hold">
89         <bounds x="50" y="250" width="40" height="20" />
90      </bezel>
91      <bezel name="lamp0" element="hold">
92         <bounds x="100" y="250" width="40" height="20" />
93      </bezel>
94      <bezel name="lamp0" element="hold">
95         <bounds x="150" y="250" width="40" height="20" />
96      </bezel>
97      <bezel name="lamp0" element="hold">
98         <bounds x="200" y="250" width="40" height="20" />
99      </bezel>
100      <bezel name="lamp7" element="hold">
101         <bounds x="250" y="250" width="40" height="20" />
102      </bezel>
103      <bezel name="lamp5" element="change">
104         <bounds x="310" y="10" width="20" height="20" />
105      </bezel>
106      <bezel name="lamp6" element="dooropen">
107         <bounds x="10" y="10" width="100" height="20" />
108      </bezel>
109      <bezel name="lamp1" element="dealdraw">
110         <bounds x="10" y="280" width="100" height="20" />
111      </bezel>
112      <bezel name="lamp2" element="cashout">
113         <bounds x="120" y="280" width="100" height="20" />
114      </bezel>
115      <bezel name="lamp4" element="betcredits">
116         <bounds x="230" y="280" width="100" height="20" />
117      </bezel>
118   </view>
119</mamelayout>
src/mame/drivers/midyunit.c
r1185r1186
187187   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
188188   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
189189   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
190   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
190   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BILL1 )
191191   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) /* video freeze */
192192   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START3 )
193193   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START4 )
r1185r1186
203203   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
204204   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
205205   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
206   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN4 )
206   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN3 )
207207   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNUSED )
208208
209209   PORT_START
r1185r1186
286286   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2)
287287   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
288288   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
289   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
289   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BILL1 )
290290   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) /* video freeze */
291   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN4 )
291   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN3 )
292292   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
293293   PORT_BIT( 0xf800, IP_ACTIVE_LOW, IPT_UNUSED )
294294
r1185r1186
478478   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
479479   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
480480   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
481   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
482   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
481   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BILL1 )
482   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN3 )
483483   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
484484   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
485485   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
r1185r1186
570570   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
571571   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
572572   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
573   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
574   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
573   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BILL1 )
574   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN3 )
575575   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
576576   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
577577   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
r1185r1186
761761   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
762762   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
763763   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
764   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
764   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BILL1 )
765765   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) /* video freeze */
766   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN4 )
766   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN3 )
767767   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED )
768768
769769   PORT_START
src/mame/drivers/nbmj9195.c
r1185r1186
526526static void tmpz84c011_init(running_machine *machine)
527527{
528528   // initialize the CTC
529   ctc_intf_1.baseclock = machine->drv->cpu[0].cpu_clock;
530   ctc_intf_2.baseclock = machine->drv->cpu[1].cpu_clock;
529   ctc_intf_1.baseclock = machine->drv->cpu[0].clock;
530   ctc_intf_2.baseclock = machine->drv->cpu[1].clock;
531531   z80ctc_init(0, &ctc_intf_1);
532532   z80ctc_init(1, &ctc_intf_2);
533533}
src/mame/drivers/hornet.c
r1185r1186
681681   AM_RANGE(0x7d04a000, 0x7d04a003) AM_MIRROR(0x80000000) AM_WRITE(comm_rombank_w)
682682   AM_RANGE(0x7d050000, 0x7d05ffff) AM_MIRROR(0x80000000) AM_ROMBANK(1)      /* COMM BOARD 1 */
683683   AM_RANGE(0x7e000000, 0x7e7fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER2, 0)      /* Data ROM */
684   AM_RANGE(0x7f000000, 0x7f1fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2)
685   AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2)   /* Program ROM */
684   AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2)
685   AM_RANGE(0x7fc00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2)   /* Program ROM */
686686ADDRESS_MAP_END
687687
688688/*****************************************************************************/
r1185r1186
12481248   init_hornet(machine);
12491249}
12501250
1251static DRIVER_INIT(terabrst)
1252{
1253   int i;
1254   UINT16 checksum;
1255
1256   /* RTC data */
1257   backup_ram[0x00] = 0x47;   // 'G'
1258   backup_ram[0x01] = 0x4e;   // 'N'
1259   backup_ram[0x02] = 0x37;   // '7'
1260   backup_ram[0x03] = 0x31;   // '1'
1261   backup_ram[0x04] = 0x35;   // '5'
1262   backup_ram[0x05] = 0x00;   //
1263   backup_ram[0x06] = 0x00;   //
1264   backup_ram[0x07] = 0x00;   //
1265   backup_ram[0x08] = 0x19;   //
1266   backup_ram[0x09] = 0x98;   // 1998
1267   backup_ram[0x0a] = 0x41;   // 'J'
1268   backup_ram[0x0b] = 0x41;   // 'A'
1269   backup_ram[0x0c] = 0x45;   // 'E'
1270   backup_ram[0x0d] = 0x00;   //
1271
1272   checksum = 0;
1273   for (i=0; i < 14; i+=2)
1274   {
1275      checksum += (backup_ram[i] << 8) | (backup_ram[i+1]);
1276   }
1277   checksum = ~checksum - 0;
1278   backup_ram[0x0e] = (checksum >> 8) & 0xff;   // checksum
1279   backup_ram[0x0f] = (checksum >> 0) & 0xff;   // checksum
1280
1281   voodoo_version = 0;
1282   init_hornet_2board(machine);
1283}
1284
12511285static DRIVER_INIT(sscope)
12521286{
12531287   int i;
r1185r1186
13471381/*****************************************************************************/
13481382
13491383ROM_START(sscope)
1350   ROM_REGION32_BE(0x200000, REGION_USER1, 0)   /* PowerPC program */
1351   ROM_LOAD16_WORD_SWAP("ss1-1.27p", 0x000000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14))
1384   ROM_REGION32_BE(0x400000, REGION_USER1, 0)   /* PowerPC program */
1385   ROM_LOAD16_WORD_SWAP("ss1-1.27p", 0x200000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14))
13521386
13531387   ROM_REGION32_BE(0x800000, REGION_USER2, ROMREGION_ERASE00)   /* Data roms */
13541388
r1185r1186
13651399ROM_END
13661400
13671401ROM_START(sscopea)
1368   ROM_REGION32_BE(0x200000, REGION_USER1, 0)   /* PowerPC program */
1369   ROM_LOAD16_WORD_SWAP("830_a01.bin", 0x000000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37))
1402   ROM_REGION32_BE(0x400000, REGION_USER1, 0)   /* PowerPC program */
1403   ROM_LOAD16_WORD_SWAP("830_a01.bin", 0x200000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37))
13701404
13711405   ROM_REGION32_BE(0x800000, REGION_USER2, ROMREGION_ERASE00)   /* Data roms */
13721406
r1185r1186
13831417ROM_END
13841418
13851419ROM_START(sscope2)
1386   ROM_REGION32_BE(0x200000, REGION_USER1, 0)   /* PowerPC program */
1387   ROM_LOAD16_WORD_SWAP("931d01.bin", 0x000000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2))
1420   ROM_REGION32_BE(0x400000, REGION_USER1, 0)   /* PowerPC program */
1421   ROM_LOAD16_WORD_SWAP("931d01.bin", 0x200000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2))
13881422
13891423   ROM_REGION32_BE(0x800000, REGION_USER2, 0)   /* Data roms */
13901424      ROM_LOAD32_WORD_SWAP("931a04.bin", 0x000000, 0x200000, CRC(4f5917e6) SHA1(a63a107f1d6d9756e4ab0965d72ea446f0692814))
r1185r1186
14051439ROM_END
14061440
14071441ROM_START(gradius4)
1408   ROM_REGION32_BE(0x200000, REGION_USER1, 0)   /* PowerPC program */
1409        ROM_LOAD16_WORD_SWAP( "837c01.27p",   0x000000, 0x200000, CRC(ce003123) SHA1(15e33997be2c1b3f71998627c540db378680a7a1) )
1442   ROM_REGION32_BE(0x400000, REGION_USER1, 0)   /* PowerPC program */
1443        ROM_LOAD16_WORD_SWAP( "837c01.27p",   0x200000, 0x200000, CRC(ce003123) SHA1(15e33997be2c1b3f71998627c540db378680a7a1) )
14101444
14111445   ROM_REGION32_BE(0x800000, REGION_USER2, 0)   /* Data roms */
14121446        ROM_LOAD32_WORD_SWAP( "837a04.16t",   0x000000, 0x200000, CRC(18453b59) SHA1(3c75a54d8c09c0796223b42d30fb3867a911a074) )
r1185r1186
14271461ROM_END
14281462
14291463ROM_START(nbapbp)
1430   ROM_REGION32_BE(0x200000, REGION_USER1, 0)   /* PowerPC program */
1431        ROM_LOAD16_WORD_SWAP( "778a01.27p",   0x000000, 0x200000, CRC(e70019ce) SHA1(8b187b6e670fdc88771da08a56685cd621b139dc) )
1464   ROM_REGION32_BE(0x400000, REGION_USER1, 0)   /* PowerPC program */
1465        ROM_LOAD16_WORD_SWAP( "778a01.27p",   0x200000, 0x200000, CRC(e70019ce) SHA1(8b187b6e670fdc88771da08a56685cd621b139dc) )
14321466
14331467   ROM_REGION32_BE(0x800000, REGION_USER2, 0)   /* Data roms */
14341468        ROM_LOAD32_WORD_SWAP( "778a04.16t",   0x000000, 0x400000, CRC(62c70132) SHA1(405aed149fc51e0adfa3ace3c644e47d53cf1ee3) )
r1185r1186
14501484        ROM_LOAD( "778a12.9p",    0xc00000, 0x400000, CRC(27d0c724) SHA1(48e48cbaea6db0de8c3471a2eda6faaa16eed46e) )
14511485ROM_END
14521486
1487ROM_START(terabrst)
1488   ROM_REGION32_BE(0x400000, REGION_USER1, 0)   /* PowerPC program */
1489        ROM_LOAD32_WORD_SWAP( "715a02.25p",   0x000000, 0x200000, CRC(070c48b3) SHA1(066cefbd34d8f6476083417471114f782bef97fb) )
1490        ROM_LOAD32_WORD_SWAP( "715a03.22p",   0x000002, 0x200000, CRC(f77d242f) SHA1(7680e4abcccd549b3f6d1d245f64631fab57e80d) )
1491
1492   ROM_REGION32_BE(0x800000, REGION_USER2, 0)   /* Data roms */
1493        ROM_LOAD32_WORD_SWAP( "715a04.16t",   0x000000, 0x200000, CRC(00d9567e) SHA1(fe372399ad0ae89d557c93c3145b38e3ed0f714d) )
1494        ROM_LOAD32_WORD_SWAP( "715a05.14t",   0x000002, 0x200000, CRC(462d53bf) SHA1(0216a84358571de6791365c69a1fa8fe2784148d) )
1495
1496   ROM_REGION32_BE(0x1000000, REGION_USER5, 0)   /* CG Board texture roms */
1497        ROM_LOAD32_WORD_SWAP( "715a14.32u",   0x000002, 0x400000, CRC(bbb36be3) SHA1(c828d0af0546db02e87afe68423b9447db7c7e51) )
1498        ROM_LOAD32_WORD_SWAP( "715a13.24u",   0x000000, 0x400000, CRC(dbff58a1) SHA1(f0c60bb2cbf268cfcbdd65606ebb18f1b4839c0e) )
1499
1500   ROM_REGION(0x80000, REGION_CPU2, 0)      /* 68K Program */
1501        ROM_LOAD16_WORD_SWAP( "715a08.7s",    0x000000, 0x080000, CRC(3aa2f4a5) SHA1(bb43e5f5ef4ac51f228d4d825be66d3c720d51ea) )
1502
1503   ROM_REGION(0x1000000, REGION_SOUND1, 0)      /* PCM sample roms */
1504        ROM_LOAD( "715a09.16p",   0x000000, 0x400000, CRC(65845866) SHA1(d2a63d0deef1901e6fa21b55c5f96e1f781dceda) )
1505        ROM_LOAD( "715a10.14p",   0x400000, 0x400000, CRC(294fe71b) SHA1(ac5fff5627df1cee4f1e1867377f208b34334899) )
1506
1507   ROM_REGION(0x20000, REGION_CPU3, 0)      /* 68K Program */
1508        ROM_LOAD16_WORD_SWAP( "715a17.20k",    0x000000, 0x020000, CRC(f0b7ba0c) SHA1(863b260824b0ae2f890ba84d1c9a8f436891b1ff) )
1509ROM_END
1510
14531511/*************************************************************************/
14541512
14551513GAME( 1998, gradius4,   0,      hornet,         hornet,   gradius4,   ROT0,   "Konami",   "Gradius 4: Fukkatsu", GAME_IMPERFECT_SOUND )
14561514GAME( 1998, nbapbp,      0,      hornet,         hornet,   nbapbp,      ROT0,   "Konami",   "NBA Play By Play", GAME_IMPERFECT_SOUND )
1515GAMEL( 1998, terabrst,   0,     hornet_2board,  hornet, terabrst,   ROT0,   "Konami",   "Teraburst", GAME_IMPERFECT_SOUND, layout_dualhsxs )
14571516GAMEL( 2000, sscope,   0,      hornet_2board,   sscope,   sscope,      ROT0,   "Konami",   "Silent Scope (ver UAB)", GAME_IMPERFECT_SOUND|GAME_NOT_WORKING, layout_dualhsxs )
14581517GAMEL( 2000, sscopea,   sscope, hornet_2board,   sscope,   sscope,      ROT0,   "Konami",   "Silent Scope (ver UAA)", GAME_IMPERFECT_SOUND|GAME_NOT_WORKING, layout_dualhsxs )
14591518GAMEL( 2000, sscope2,   0,      hornet_2board,   sscope,   sscope2,   ROT0,   "Konami",   "Silent Scope 2", GAME_IMPERFECT_SOUND|GAME_NOT_WORKING, layout_dualhsxs )
src/mame/drivers/niyanpai.c
r1185r1186
202202static void tmpz84c011_init(running_machine *machine)
203203{
204204   // initialize the CTC
205   ctc_intf.baseclock = machine->drv->cpu[1].cpu_clock;
205   ctc_intf.baseclock = machine->drv->cpu[1].clock;
206206   z80ctc_init(0, &ctc_intf);
207207}
208208
src/mame/drivers/midzeus.c
r1185r1186
11011001C03E:graphics_w(0CE) = 00007620
11111101C03E:graphics_w(0CD) = 00000000
11211201C03E:graphics_w(0CC) = 00000000
11301C03E:graphics_w(0CB) = 00000116
11401C03E:graphics_w(0CA) = 00000107
11501C03E:graphics_w(0C9) = 00000103
11601C03E:graphics_w(0C8) = 000000FF
11301C03E:graphics_w(0CB) = 00000116   = VTOTAL(?)
11401C03E:graphics_w(0CA) = 00000107   = VSYNC END
11501C03E:graphics_w(0C9) = 00000103   = VSYNC START
11601C03E:graphics_w(0C8) = 000000FF   = VBSTART
11711701C03E:graphics_w(0C7) = 00000211
11811801C03E:graphics_w(0C6) = 0000007F
11911901C03E:graphics_w(0C5) = 0000000C
r1185r1186
829829}
830830
831831
832static READ32_HANDLER( graphics2_r )
833{
834   return graphics_r(offset * 2, 0);
835}
832836
837
838static WRITE32_HANDLER( graphics2_w )
839{
840   graphics_w(offset * 2, data, mem_mask);
841}
842
843
844
833845/*************************************
834846 *
835847 *  Machine init
r1185r1186
838850
839851static MACHINE_RESET( midzeus )
840852{
841   memcpy(ram_base, memory_region(REGION_USER1), 0x20000*4);
853   memcpy(ram_base, memory_region(REGION_USER1), 0x40000*4);
842854
843855   *(UINT32 *)ram_base *= 2;
844856
r1185r1186
942954}
943955
944956
945static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 )
957static ADDRESS_MAP_START( zeus_map, ADDRESS_SPACE_PROGRAM, 32 )
946958   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
947959   AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base)
948960   AM_RANGE(0x400000, 0x41ffff) AM_RAM
r1185r1186
959971ADDRESS_MAP_END
960972
961973
974static ADDRESS_MAP_START( zeus2_map, ADDRESS_SPACE_PROGRAM, 32 )
975   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
976   AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base)
977   AM_RANGE(0x400000, 0x43ffff) AM_RAM
978   AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control)
979   AM_RANGE(0x87fe00, 0x87ffff) AM_RAM
980   AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(graphics2_r, graphics2_w) AM_BASE(&graphics_ram)
981   AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000)
982   AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w)
983//9d0000 -- page select?
984   AM_RANGE(0x9e0000, 0x9e0000) AM_WRITENOP      // watchdog?
985   AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size)
986   AM_RANGE(0x9f8000, 0x9f8000) AM_WRITE(cmos_protect_w)
987   AM_RANGE(0xa00000, 0xffffff) AM_ROM AM_REGION(REGION_USER1, 0)
988ADDRESS_MAP_END
962989
990
991
963992/*************************************
964993 *
965994 *  Input ports
r1185r1186
14021431
14031432   /* basic machine hardware */
14041433   MDRV_CPU_ADD_TAG("main", TMS32031, 50000000)      // actually, TMS32032
1405   MDRV_CPU_PROGRAM_MAP(main_map,0)
1434   MDRV_CPU_PROGRAM_MAP(zeus_map,0)
14061435   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
14071436
14081437   MDRV_SCREEN_REFRESH_RATE(57)
r1185r1186
14261455MACHINE_DRIVER_END
14271456
14281457
1458MACHINE_DRIVER_START( midzeus2 )
1459   MDRV_IMPORT_FROM(midzeus)
14291460
1461   /* basic machine hardware */
1462   MDRV_CPU_MODIFY("main")
1463   MDRV_CPU_PROGRAM_MAP(zeus2_map,0)
1464MACHINE_DRIVER_END
1465
1466
1467
14301468/*************************************
14311469 *
14321470 *  ROM definitions
r1185r1186
14351473
14361474ROM_START( mk4 )
14371475   ROM_REGION16_LE( 0x1000000, REGION_SOUND1, ROMREGION_ERASEFF )   /* sound data */
1476   ROM_LOAD16_BYTE( "mk4_l2.u2", 0x000000, 0x200000, CRC(4c01b493) SHA1(dcd6da9ee30d0f6645bfdb1762d926be0a26090a) )
1477   ROM_LOAD16_BYTE( "mk4_l2.u3", 0x400000, 0x200000, CRC(8fbcf0ac) SHA1(c53704e72cfcba800c7af3a03267041f1e29a784) )
1478   ROM_LOAD16_BYTE( "mk4_l2.u4", 0x800000, 0x200000, CRC(dee91696) SHA1(00a182a36a414744cd014fcfc53c2e1a66ab5189) )
1479   ROM_LOAD16_BYTE( "mk4_l2.u5", 0xc00000, 0x200000, CRC(44d072be) SHA1(8a636c2801d799dfb84e69607ade76d2b49cf09f) )
1480
1481   ROM_REGION32_LE( 0x1800000, REGION_USER1, 0 )
1482   ROM_LOAD32_WORD( "mk4_l3.u10", 0x0000000, 0x200000, CRC(84efe5a9) SHA1(e2a9bf6fab971691017371a87ab87b1bf66f96d0) )
1483   ROM_LOAD32_WORD( "mk4_l3.u11", 0x0000002, 0x200000, CRC(0c026ccb) SHA1(7531fe81ff8d8dd9ec3cd915acaf14cbe6bdc90a) )
1484   ROM_LOAD32_WORD( "mk4_l3.u12", 0x0400000, 0x200000, CRC(7816c07f) SHA1(da94b4391e671f915c61b5eb9bece4acb3382e31) )
1485   ROM_LOAD32_WORD( "mk4_l3.u13", 0x0400002, 0x200000, CRC(b3c237cd) SHA1(9e71e60cc92c17524f85f36543c174ca138104cd) )
1486   ROM_LOAD32_WORD( "mk4_l3.u14", 0x0800000, 0x200000, CRC(fd33eb1a) SHA1(59d9d2e5251679d19cab031f51731c85f429ba18) )
1487   ROM_LOAD32_WORD( "mk4_l3.u15", 0x0800002, 0x200000, CRC(b907518f) SHA1(cfb56538746895bdca779957fec6a872019b23c3) )
1488   ROM_LOAD32_WORD( "mk4_l3.u16", 0x0c00000, 0x200000, CRC(24371d57) SHA1(c90134b17c23a182d391d1679bf457d251e641f7) )
1489   ROM_LOAD32_WORD( "mk4_l3.u17", 0x0c00002, 0x200000, CRC(3a1a082c) SHA1(5f8e8ce760d8ebadd1240ef08f1382a37cf11d0b) )
1490ROM_END
1491
1492ROM_START( mk4a )
1493   ROM_REGION16_LE( 0x1000000, REGION_SOUND1, ROMREGION_ERASEFF )   /* sound data */
14381494   ROM_LOAD16_BYTE( "mk4_l2.2", 0x000000, 0x200000, CRC(4c01b493) SHA1(dcd6da9ee30d0f6645bfdb1762d926be0a26090a) )
14391495   ROM_LOAD16_BYTE( "mk4_l2.3", 0x400000, 0x200000, CRC(8fbcf0ac) SHA1(c53704e72cfcba800c7af3a03267041f1e29a784) )
14401496   ROM_LOAD16_BYTE( "mk4_l2.4", 0x800000, 0x200000, CRC(dee91696) SHA1(00a182a36a414744cd014fcfc53c2e1a66ab5189) )
14411497   ROM_LOAD16_BYTE( "mk4_l2.5", 0xc00000, 0x200000, CRC(44d072be) SHA1(8a636c2801d799dfb84e69607ade76d2b49cf09f) )
14421498
14431499   ROM_REGION32_LE( 0x1800000, REGION_USER1, 0 )
1444   ROM_LOAD32_WORD( "mk4_l3.10", 0x0000000, 0x200000, CRC(84efe5a9) SHA1(e2a9bf6fab971691017371a87ab87b1bf66f96d0) )
1445   ROM_LOAD32_WORD( "mk4_l3.11", 0x0000002, 0x200000, CRC(0c026ccb) SHA1(7531fe81ff8d8dd9ec3cd915acaf14cbe6bdc90a) )
1500   ROM_LOAD32_WORD( "mk4_l2.1.u10", 0x000000, 0x200000, CRC(42d0f1c9) SHA1(5ac0ded8bf6e756319be2691e3b555eac079ebdc) )
1501   ROM_LOAD32_WORD( "mk4_l2.1.u11", 0x000002, 0x200000, CRC(6e21b243) SHA1(6d4768a5972db05c1409e0d16e79df9eff8918a0) )
14461502   ROM_LOAD32_WORD( "mk4_l3.12", 0x0400000, 0x200000, CRC(7816c07f) SHA1(da94b4391e671f915c61b5eb9bece4acb3382e31) )
14471503   ROM_LOAD32_WORD( "mk4_l3.13", 0x0400002, 0x200000, CRC(b3c237cd) SHA1(9e71e60cc92c17524f85f36543c174ca138104cd) )
14481504   ROM_LOAD32_WORD( "mk4_l3.14", 0x0800000, 0x200000, CRC(fd33eb1a) SHA1(59d9d2e5251679d19cab031f51731c85f429ba18) )
r1185r1186
14541510
14551511ROM_START( invasn )
14561512   ROM_REGION16_LE( 0x1000000, REGION_SOUND1, ROMREGION_ERASEFF )   /* sound data */
1457   ROM_LOAD16_BYTE( "invau2", 0x000000, 0x200000, CRC(59d2e1d6) SHA1(994a4311ac4841d4341449c0c7480952b6f3855d) )
1458   ROM_LOAD16_BYTE( "invau3", 0x400000, 0x200000, CRC(86b956ae) SHA1(f7fd4601a2ce3e7e9b67e7d77908bfa206ee7e62) )
1459   ROM_LOAD16_BYTE( "invau4", 0x800000, 0x200000, CRC(5ef1fab5) SHA1(987afa0672fa89b18cf20d28644848a9e5ee9b17) )
1460   ROM_LOAD16_BYTE( "invau5", 0xc00000, 0x200000, CRC(e42805c9) SHA1(e5b71eb1852809a649ac43a82168b3bdaf4b1526) )
1513   ROM_LOAD16_BYTE( "invasion.u2", 0x000000, 0x200000, CRC(59d2e1d6) SHA1(994a4311ac4841d4341449c0c7480952b6f3855d) )
1514   ROM_LOAD16_BYTE( "invasion.u3", 0x400000, 0x200000, CRC(86b956ae) SHA1(f7fd4601a2ce3e7e9b67e7d77908bfa206ee7e62) )
1515   ROM_LOAD16_BYTE( "invasion.u4", 0x800000, 0x200000, CRC(5ef1fab5) SHA1(987afa0672fa89b18cf20d28644848a9e5ee9b17) )
1516   ROM_LOAD16_BYTE( "invasion.u5", 0xc00000, 0x200000, CRC(e42805c9) SHA1(e5b71eb1852809a649ac43a82168b3bdaf4b1526) )
14611517
14621518   ROM_REGION32_LE( 0x1800000, REGION_USER1, 0 )
1463   ROM_LOAD32_WORD( "invau10", 0x0000000, 0x200000, CRC(b3ce958b) SHA1(ed51c167d85bc5f6155b8046ec056a4f4ad5cf9d) )
1464   ROM_LOAD32_WORD( "invau11", 0x0000002, 0x200000, CRC(0bd09359) SHA1(f40886bd2e5f5fbf506580e5baa2f733be200852) )
1465   ROM_LOAD32_WORD( "invau12", 0x0400000, 0x200000, CRC(ce1eb06a) SHA1(ff17690a0cbca6dcccccde70e2c5812ae03db5bb) )
1466   ROM_LOAD32_WORD( "invau13", 0x0400002, 0x200000, CRC(33fc6707) SHA1(11a39ad980ec320547319eca6ffa5aef3ab8b010) )
1467   ROM_LOAD32_WORD( "invau14", 0x0800000, 0x200000, CRC(760682a1) SHA1(ff91210225d4aa750115c6219d4c35c9521a3f0b) )
1468   ROM_LOAD32_WORD( "invau15", 0x0800002, 0x200000, CRC(90467d7a) SHA1(a143a3d3605e5626852e75937160ba6bcd891608) )
1469   ROM_LOAD32_WORD( "invau16", 0x0c00000, 0x200000, CRC(3ef1b28d) SHA1(6f9a071b8830194fea84daa62aadabae86977c5f) )
1470   ROM_LOAD32_WORD( "invau17", 0x0c00002, 0x200000, CRC(97aa677a) SHA1(4d21cc59e0ffd4985f89c97c71d605c3b404a8a3) )
1471   ROM_LOAD32_WORD( "invau18", 0x1000000, 0x200000, CRC(6930c656) SHA1(28054ff9a6c6f5764a371f8defe4c1f5730618f3) )
1472   ROM_LOAD32_WORD( "invau19", 0x1000002, 0x200000, CRC(89fa6ee5) SHA1(572565e1308142b0b062aa72315c68e928f2419c) )
1519   ROM_LOAD32_WORD( "invasion.u10", 0x0000000, 0x200000, CRC(b3ce958b) SHA1(ed51c167d85bc5f6155b8046ec056a4f4ad5cf9d) )
1520   ROM_LOAD32_WORD( "invasion.u11", 0x0000002, 0x200000, CRC(0bd09359) SHA1(f40886bd2e5f5fbf506580e5baa2f733be200852) )
1521   ROM_LOAD32_WORD( "invasion.u12", 0x0400000, 0x200000, CRC(ce1eb06a) SHA1(ff17690a0cbca6dcccccde70e2c5812ae03db5bb) )
1522   ROM_LOAD32_WORD( "invasion.u13", 0x0400002, 0x200000, CRC(33fc6707) SHA1(11a39ad980ec320547319eca6ffa5aef3ab8b010) )
1523   ROM_LOAD32_WORD( "invasion.u14", 0x0800000, 0x200000, CRC(760682a1) SHA1(ff91210225d4aa750115c6219d4c35c9521a3f0b) )
1524   ROM_LOAD32_WORD( "invasion.u15", 0x0800002, 0x200000, CRC(90467d7a) SHA1(a143a3d3605e5626852e75937160ba6bcd891608) )
1525   ROM_LOAD32_WORD( "invasion.u16", 0x0c00000, 0x200000, CRC(3ef1b28d) SHA1(6f9a071b8830194fea84daa62aadabae86977c5f) )
1526   ROM_LOAD32_WORD( "invasion.u17", 0x0c00002, 0x200000, CRC(97aa677a) SHA1(4d21cc59e0ffd4985f89c97c71d605c3b404a8a3) )
1527   ROM_LOAD32_WORD( "invasion.u18", 0x1000000, 0x200000, CRC(6930c656) SHA1(28054ff9a6c6f5764a371f8defe4c1f5730618f3) )
1528   ROM_LOAD32_WORD( "invasion.u19", 0x1000002, 0x200000, CRC(89fa6ee5) SHA1(572565e1308142b0b062aa72315c68e928f2419c) )
14731529ROM_END
14741530
14751531
r1185r1186
15071563   ROM_LOAD( "the_grid.u4", 0x800000, 0x400000, CRC(7a15c203) SHA1(a0a49dd08bba92402640ed2d1fb4fee112c4ab5f) )
15081564
15091565   ROM_REGION32_LE( 0x3000000, REGION_USER1, 0 )
1510   ROM_LOAD32_WORD( "the_grid.u10", 0x0000000, 0x100000, BAD_DUMP CRC(3219c028) SHA1(956cb358c4c52d4fa7e870796e92880fb2b94147) )
1511   ROM_LOAD32_WORD( "the_grid.u11", 0x0000002, 0x100000, BAD_DUMP CRC(540dd6f9) SHA1(02af52bdbe266cdf51294b31e1db71c1ee723d0d) )
1512   ROM_LOAD32_WORD( "the_grid.u12", 0x0200000, 0x100000, BAD_DUMP CRC(4e9f7031) SHA1(4df99e0edc5510067521c554227921d2185070c4) )
1513   ROM_LOAD32_WORD( "the_grid.u13", 0x0200002, 0x100000, BAD_DUMP CRC(268252ca) SHA1(80080e0244bb8ba2ff7dd513ea263b5f5dc54bb6) )
1514   ROM_LOAD32_WORD( "the_grid.u18", 0x0400000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) )
1515   ROM_LOAD32_WORD( "the_grid.u19", 0x0400002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) )
1516   ROM_LOAD32_WORD( "the_grid.u20", 0x0c00002, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) )
1517   ROM_LOAD32_WORD( "the_grid.u21", 0x0c00002, 0x400000, CRC(48c03f8e) SHA1(50790bdae9f2234ffb4914c2c5c16374e3508b47) )
1518   ROM_LOAD32_WORD( "the_grid.u22", 0x1400002, 0x400000, CRC(84c3a8b6) SHA1(de0dcf9daf7ada7a6952b9e29a29571b2aa9d0b2) )
1519   ROM_LOAD32_WORD( "the_grid.u23", 0x1400002, 0x400000, CRC(f48ef409) SHA1(79d74b4fe38b06a02ae0351d13d7f0a7ed0f0c87) )
1566    ROM_LOAD32_WORD( "thegrid-11.u10", 0x0000000, 0x100000, CRC(87ea0e9e) SHA1(618de2ca87b7a3e0225d1f7e65f8fc1356de1421) )
1567   ROM_LOAD32_WORD( "thegrid-11.u11", 0x0000002, 0x100000, CRC(73d84b1a) SHA1(8dcfcab5ff64f46f8486e6439a10d91ad26fd48a) )
1568   ROM_LOAD32_WORD( "thegrid-11.u12", 0x0200000, 0x100000, CRC(78d16ca1) SHA1(7b893ec8af2f44d8bc293861fd8622d68d41ccbe) )
1569   ROM_LOAD32_WORD( "thegrid-11.u13", 0x0200002, 0x100000, CRC(8e00b400) SHA1(96581c5da62afc19e6d69b2352b3166665cb9918) )
1570   ROM_LOAD32_WORD( "the_grid.u18",   0x0400000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) )
1571   ROM_LOAD32_WORD( "the_grid.u19",   0x0400002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) )
1572   ROM_LOAD32_WORD( "the_grid.u20",   0x0c00002, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) )
1573   ROM_LOAD32_WORD( "the_grid.u21",   0x0c00002, 0x400000, CRC(48c03f8e) SHA1(50790bdae9f2234ffb4914c2c5c16374e3508b47) )
1574   ROM_LOAD32_WORD( "the_grid.u22",   0x1400002, 0x400000, CRC(84c3a8b6) SHA1(de0dcf9daf7ada7a6952b9e29a29571b2aa9d0b2) )
1575   ROM_LOAD32_WORD( "the_grid.u23",   0x1400002, 0x400000, CRC(f48ef409) SHA1(79d74b4fe38b06a02ae0351d13d7f0a7ed0f0c87) )
15201576ROM_END
15211577
15221578
r1185r1186
15691625 *
15701626 *************************************/
15711627
1572GAME( 1997, mk4,      0,     midzeus, mk4,      mk4,      ROT0, "Midway", "Mortal Kombat 4 (rev L3)", GAME_NOT_WORKING | GAME_NO_SOUND )
1573GAME( 1999, invasn,   0,     midzeus, invasn,   invasn,   ROT0, "Midway", "Invasion (Midway)", GAME_NOT_WORKING | GAME_NO_SOUND )
1574GAME( 1999, crusnexo, 0,     midzeus, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_NO_SOUND )
1575GAME( 2001, thegrid,  0,     midzeus, thegrid,  thegrid,  ROT0, "Midway", "The Grid", GAME_NOT_WORKING | GAME_NO_SOUND )
1628GAME( 1997, mk4,      0,     midzeus,  mk4,      mk4,      ROT0, "Midway", "Mortal Kombat 4 (rev L3)", GAME_NOT_WORKING | GAME_NO_SOUND )
1629GAME( 1997, mk4a,     mk4,   midzeus,  mk4,      mk4,      ROT0, "Midway", "Mortal Kombat 4 (? rev)", GAME_NOT_WORKING | GAME_NO_SOUND )
1630GAME( 1999, invasn,   0,     midzeus,  invasn,   invasn,   ROT0, "Midway", "Invasion (Midway)", GAME_NOT_WORKING | GAME_NO_SOUND )
1631GAME( 1999, crusnexo, 0,     midzeus2, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_NO_SOUND )
1632GAME( 2001, thegrid,  0,     midzeus2, thegrid,  thegrid,  ROT0, "Midway", "The Grid (version 1.1)", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/goodejan.c
r0r1186
1/******************************************************************************************
2
3Seibu Mahjong games (distributed by Tecmo)
4
5CPU: V30 D70116C-10
6Sound: Z80 YM3812 M6295
7OSC: 12.000MHz 16.000MHz 7.15909MHz
8
9
10ToDo:
11 BG Banking is wrong.
12 Inputs are imperfect (missing dips)
13 Sprite glitches in intro
14
15
16PCB Layout
17
18|---------------------------------------------------------------|
19|LA4460  YM3812  M6295  E-JAN.U0911 6116        Z80A 7.15909MHz |
20|                                                               |
21|                                    5.U1016                    |
22|                SEI0100                        PAL             |
23|                                                               |
24|                           E-JAN.U064          4.U061          |
25|                                                      SEI0160  |
26|           SEI0181                             3.U063          |
27|                                                               |
28|                                                               |
29|           PAL             SEI0200           6264        PAL   |
30|                           TC110G21AF                          |
31|           82S135.U083                 PAL   6264              |
32|                                                               |
33|  DSW     DSW                                                  |
34|                                              62256     62256  |
35|  E-JAN.U078                PAL                                |
36|                                                               |
37| PAL                        PAL               1.U022    2.U023 |
38|            SEI0210                                            |
39| PAL                        PAL                                |
40|                                                               |
41| 12MHz                16MHz        V30                         |
42|---------------------------------------------------------------|
43Notes:
44      V30 clock - 8.000MHz [16/2]
45      Z80 clock - 3.579545MHz [7.15909/2]
46      YM3812 clock - 3.579545MHz [7.15909/2]
47      M6295 clock - 1.000MHz [16/16], Pin 7 HIGH
48      VSync - 60Hz
49      HSync - 15.38kHz
50
51
52*******************************************************************************************/
53
54#include "driver.h"
55#include "audio/seibu.h"
56#include "sound/3812intf.h"
57
58#define GOODEJAN_MHZ1 7159090
59#define GOODEJAN_MHZ2 16000000
60#define GOODEJAN_MHZ3 12000000
61
62extern UINT16 *goodejan_bgvram, *goodejan_txvram;
63static UINT16 goodejan_mux_data;
64
65WRITE16_HANDLER( goodejan_bgvram_w );
66WRITE16_HANDLER( goodejan_txvram_w );
67WRITE16_HANDLER( goodejan_bg_scrollx_w );
68WRITE16_HANDLER( goodejan_bg_scrolly_w );
69
70VIDEO_START( goodejan );
71VIDEO_UPDATE( goodejan );
72
73/* Multiplexer device for the mahjong panel */
74static READ16_HANDLER( mahjong_panel_r )
75{
76   UINT16 ret;
77   ret = 0xffff;
78
79   switch(goodejan_mux_data)
80   {
81      case 1:    ret = readinputport(1); break;
82      case 2:    ret = readinputport(2); break;
83      case 4:    ret = readinputport(3); break;
84      case 8:    ret = readinputport(4); break;
85      case 0x10: ret = readinputport(5); break;
86   }
87
88   return ret;
89}
90
91static WRITE16_HANDLER( mahjong_panel_w )
92{
93   goodejan_mux_data = data;
94}
95
96static READ16_HANDLER( goodejan_read_ff )
97{
98   return 0xff;
99}
100
101static ADDRESS_MAP_START( goodejan_map, ADDRESS_SPACE_PROGRAM, 16 )
102   AM_RANGE(0x00000, 0x0afff) AM_RAM
103   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_WRITE(goodejan_bgvram_w) AM_BASE(&goodejan_bgvram)
104   AM_RANGE(0x0d000, 0x0dfff) AM_RAM AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
105   AM_RANGE(0x0c800, 0x0cfff) AM_RAM AM_WRITE(goodejan_txvram_w) AM_BASE(&goodejan_txvram)
106   AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16)
107   AM_RANGE(0xc0000, 0xfffff) AM_ROM
108ADDRESS_MAP_END
109
110
111static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 )
112
113   AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w )
114   AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w )
115
116   AM_RANGE(0xb004, 0xb005) AM_WRITE(mahjong_panel_w)
117
118   AM_RANGE(0xc000, 0xc001) AM_READ(goodejan_read_ff)
119   AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r)
120//  AM_RANGE(0xc004, 0xc005) AM_READ(random_reading)
121
122   AM_RANGE(0xd000, 0xd00f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
123ADDRESS_MAP_END
124
125INPUT_PORTS_START( goodejan )
126   /* Must be port 0: coin inputs read through sound cpu */
127   SEIBU_COIN_INPUTS
128
129   PORT_START
130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
131   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
133   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
134   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
135   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
136   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
137   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
138
139   PORT_START
140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
143   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
144   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
145   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
148
149   PORT_START
150   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
153   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
154   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
155   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
156   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
157   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
158
159   PORT_START
160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
163   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
164   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
165   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
168
169   PORT_START
170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
173   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
174   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
175   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
178
179   PORT_DIPNAME( 0x0001, 0x0001, "4" )
180    PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
181    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
182    PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
183    PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
184    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
185    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
186    PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
187    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
188    PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
189    PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
190    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
191    PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )  // Freezes if off?
192    PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
193    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
194    PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
195    PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
196    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
197    PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
198    PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
199    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
200    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
201    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
202    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
203    PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
204    PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
205    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
206    PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
207    PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
208    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
209    PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
210    PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
211    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
212    PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
213    PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
214    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
215    PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
216    PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
217    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
218    PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
219    PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
220    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
221    PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
222    PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
223    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
224    PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
225    PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
226    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
227INPUT_PORTS_END
228
229
230static const gfx_layout tilelayout =
231{
232   16,16,   /* 16*16 sprites  */
233   RGN_FRAC(1,1),
234   4,   /* 4 bits per pixel */
235   { 12, 8, 4, 0 },
236   {
237      0,  1,  2,  3,
238      16, 17, 18, 19,
239      512,513,514,515,
240      528,529,530,531
241   },
242   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
243   32*32,
244};
245
246static const gfx_layout charlayout =
247{
248   8,8,
249   RGN_FRAC(1,1),
250   4,   /* 4 bits per pixel */
251   { 12, 8, 4, 0 },
252   {
253      0,  1,  2,  3,
254       16, 17, 18, 19
255   },
256   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32  },
257   8*32
258};
259
260static GFXDECODE_START( goodejan )
261   GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x200, 0x40 ) /* Sprites */
262   GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 0x30 ) /* Tiles */
263   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x100, 0x10 ) /* Text */
264GFXDECODE_END
265
266SEIBU_SOUND_SYSTEM_YM3812_HARDWARE
267
268static INTERRUPT_GEN( goodejan_interrupt )
269{
270   if (cpu_getiloops())
271      cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0x208/4);
272   else
273      cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0x00c/4);
274}
275
276static MACHINE_DRIVER_START( goodejan )
277
278   /* basic machine hardware */
279   MDRV_CPU_ADD(V30, GOODEJAN_MHZ2/2)
280   MDRV_CPU_PROGRAM_MAP(goodejan_map,0)
281   MDRV_CPU_IO_MAP(goodejan_io_map,0)
282   MDRV_CPU_VBLANK_INT(goodejan_interrupt,2)
283
284   SEIBU_SOUND_SYSTEM_CPU(GOODEJAN_MHZ1/2)
285
286   MDRV_SCREEN_REFRESH_RATE(60)
287   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
288
289   MDRV_MACHINE_RESET(seibu_sound_1)
290
291   /* video hardware */
292   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
293   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
294   MDRV_SCREEN_SIZE(32*8, 32*8)
295   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
296   MDRV_GFXDECODE(goodejan)
297   MDRV_PALETTE_LENGTH(0x1000)
298
299   MDRV_VIDEO_START(goodejan)
300   MDRV_VIDEO_UPDATE(goodejan)
301
302   /* sound hardware */
303   SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16,1)
304MACHINE_DRIVER_END
305
306ROM_START( totmejan )
307   ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* V30 code */
308   ROM_LOAD16_BYTE( "1.022",  0xc0000, 0x20000, CRC(63c3c54f) SHA1(3116b73b848a1f7391a47b994951ba1af92ba298) )
309   ROM_LOAD16_BYTE( "2.023",  0xc0001, 0x20000, CRC(c0b9892f) SHA1(127f439a9e625d5a0f5e88102fed6500433cd9cc) )
310
311   ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* 64k code for sound Z80 */
312   ROM_LOAD( "5.1016", 0x000000, 0x08000,  CRC(8bfdb304) SHA1(454fd84eb7d9338f0b5f8de0ffae541d17b958d5) )
313   ROM_CONTINUE(             0x010000, 0x08000 )
314   ROM_COPY( REGION_CPU2, 0, 0x018000, 0x08000 )
315
316   ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE )
317   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(61b5ae88) SHA1(16105a4e97765454079deda8eaa456d60d44e906) )
318   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) )
319
320   ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )
321   ROM_LOAD( "e-jan.064", 0x080000, 0x080000, CRC(5f6185ee) SHA1(599e4a574672cd1571032e879b3032d06b70e4e2) )
322   ROM_CONTINUE(0x00000,0x80000)
323
324   ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
325   ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) )
326
327   ROM_REGION( 0x80000, REGION_SOUND1, 0 )    /* ADPCM samples */
328   ROM_LOAD( "e-jan.0911", 0x00000, 0x80000, CRC(a7fb93c2) SHA1(c2e1300f142032c087c96e1a785af28a6d678947) )
329
330   ROM_REGION( 0x200, REGION_USER1, ROMREGION_DISPOSE ) /* not used */
331   ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) )
332ROM_END
333
334ROM_START( goodejan )
335   ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* V30 code */
336   ROM_LOAD16_BYTE( "1.022",  0xc0000, 0x20000, CRC(8555122f) SHA1(92e1ec02fb81ae972eb7492b5d226b40ca65c70d) )
337   ROM_LOAD16_BYTE( "2.023",  0xc0001, 0x20000, CRC(32704d74) SHA1(9722b7f1e506a17e0fa5234e05f79333cd99a364) )
338
339   ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* 64k code for sound Z80 */
340   ROM_LOAD( "5.1016", 0x000000, 0x08000,  CRC(732e9eae) SHA1(d306610f08630708bbbb97d71e9ed4d7e027579a) )
341   ROM_CONTINUE(             0x010000, 0x08000 )
342   ROM_COPY( REGION_CPU2, 0, 0x018000, 0x08000 )
343
344   ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE )
345   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) )
346   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
347
348   ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )
349   ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
350
351   ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
352   ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
353
354   ROM_REGION( 0x80000, REGION_SOUND1, 0 )    /* ADPCM samples */
355   ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) )
356
357   ROM_REGION( 0x200, REGION_USER1, ROMREGION_DISPOSE ) /* not used */
358   ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) )
359ROM_END
360
361ROM_START( goodejaa )
362   ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* V30 code */
363   ROM_LOAD16_BYTE( "1.u022",  0xc0000, 0x20000, CRC(d496cdd1) SHA1(144a9d8850b3b62520b71efd2ed1459bd673ac92) )
364   ROM_LOAD16_BYTE( "2.u023",  0xc0001, 0x20000, CRC(5eda77bb) SHA1(ac54125988f9c929207becf0dcbab72eff4f054a) )
365
366   ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* 64k code for sound Z80 */
367   ROM_LOAD( "5.1016", 0x000000, 0x08000,  CRC(732e9eae) SHA1(d306610f08630708bbbb97d71e9ed4d7e027579a) )
368   ROM_CONTINUE(             0x010000, 0x08000 )
369   ROM_COPY( REGION_CPU2, 0, 0x018000, 0x08000 )
370
371   ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE )
372   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) )
373   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
374
375   ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )
376   ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
377
378   ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
379   ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
380
381   ROM_REGION( 0x80000, REGION_SOUND1, 0 )    /* ADPCM samples */
382   ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) )
383
384   ROM_REGION( 0x200, REGION_USER1, ROMREGION_DISPOSE ) /* not used */
385   ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) )
386ROM_END
387
388GAME( 1991, totmejan, 0,        goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Tottemo E Jong", GAME_IMPERFECT_GRAPHICS )
389GAME( 1991, goodejan, 0,        goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Good E Jong -Kachinuki Mahjong Syoukin Oh!!- (set 1)", GAME_IMPERFECT_GRAPHICS )
390GAME( 1991, goodejaa, goodejan, goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Good E Jong -Kachinuki Mahjong Syoukin Oh!!- (set 2)", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/cclimber.c
r1185r1186
458458   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
459459   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
460460   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
461   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
462   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
461   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
462   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
463463
464464   PORT_START_TAG("DSW")
465   PORT_DIPNAME( 0x01, 0x00, "Unknown 1" )
466   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
467   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
468   PORT_DIPNAME( 0x02, 0x00, "Player title" )
469   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
470   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
465   PORT_DIPNAME( 0x03, 0x03, "Display" )
466   PORT_DIPSETTING(    0x03, "Scores and Progession Bars" )
467   PORT_DIPSETTING(    0x01, "Scores only" )
468   PORT_DIPSETTING(    0x02, "Progession Bars only" )
469   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
471470   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
472471   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
473472   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r1185r1186
476475   PORT_DIPSETTING(    0x08, "4" )
477476   PORT_DIPSETTING(    0x10, "5" )
478477   PORT_DIPSETTING(    0x18, "6" )
479   PORT_DIPNAME( 0x20, 0x00, "Unknown 2" )
480   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
481   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
482   PORT_DIPNAME( 0x40, 0x00, "Unknown 3" )
483   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
484   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
485   PORT_DIPNAME( 0x80, 0x00, "Unknown 4" )
486   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
487   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
478   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
479   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
480   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
488481
489   CKONGIN2
482   PORT_START_TAG("IN2")
483   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
484   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
485   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" )
486   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME( "Select" )
487   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
490488INPUT_PORTS_END
491489
492490INPUT_PORTS_START( ckong )
r1185r1186
12861284   ROM_LOAD( "ck12.bin",     0x1000, 0x1000, CRC(2eb23b60) SHA1(c9e7dc584562aceb374193655fbacb7df6c9c731) )
12871285ROM_END
12881286
1287ROM_START( ckongb )
1288   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1289   ROM_LOAD( "d05-7.rom",    0x0000, 0x1000, CRC(5d96ee9a) SHA1(f531d251fd3469edd3b5b5e7c26ff9cef7006ce8) )
1290   ROM_LOAD( "f05-8.rom",    0x1000, 0x1000, CRC(74a8435b) SHA1(465ad96009d3ba939eee13ba0d5fd6d9dec118bc) )
1291   ROM_LOAD( "h05-9.rom",    0x2000, 0x1000, CRC(e06ca575) SHA1(cd5a32fac614902e136e522ac188616c72d65571) )
1292   ROM_LOAD( "k05-10.rom",   0x3000, 0x1000, CRC(46d83a11) SHA1(de840994104bfc633a3640610966f087fbc3d749) )
1293   ROM_LOAD( "l05-11.rom",   0x4000, 0x1000, CRC(07c30f3d) SHA1(9b72f8a76c64ab22f8b8c1bd8e457c10b86d95a1) )
1294   ROM_LOAD( "n05-12.rom",   0x5000, 0x1000, CRC(151de90a) SHA1(5d063c4fe6767727d051815120d692818a30ee81) )
1295
1296   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
1297   ROM_LOAD( "n11-6.bin",    0x0000, 0x1000, CRC(2dcedd12) SHA1(dfdcfc21bcba7c8e148ee54daae511ca78c58e70) )
1298   ROM_LOAD( "k11-4.bin",    0x1000, 0x1000, CRC(3375b3bd) SHA1(a00b3c31cff123aab6ac0833aabfdd663302971a) )
1299   ROM_LOAD( "l11-5.bin",    0x2000, 0x1000, CRC(fa7cbd91) SHA1(0208d2ebc59f3600005476b6987472685bc99d67) )
1300   ROM_LOAD( "h11-3.bin",    0x3000, 0x1000, CRC(5655cc11) SHA1(5195e9b2a60c54280b48b32ee8248090904dbc51) )
1301
1302   ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE )
1303   ROM_LOAD( "c11-2.bin",    0x0000, 0x0800, CRC(d1352c31) SHA1(da726a63a8be830d695afeddc1717749af8c9d47) )
1304   ROM_LOAD( "a11-1.bin",    0x0800, 0x0800, CRC(a7a2fdbd) SHA1(529865f8bbfbdbbf34ac39c70ef17e6d5bd0f845) )
1305
1306   ROM_REGION( 0x0060, REGION_PROMS, 0 )
1307   ROM_LOAD( "prom.v6",      0x0000, 0x0020, CRC(b3fc1505) SHA1(5b94adde0428a26b815c7eb9b3f3716470d349c7) )
1308   ROM_LOAD( "prom.u6",      0x0020, 0x0020, CRC(26aada9e) SHA1(f59645e606ea4f0dd0fc4ea47dd03f526c534941) )
1309   ROM_LOAD( "prom.t6",      0x0040, 0x0020, CRC(676b3166) SHA1(29b9434cd34d43ea5664e436e2a24b54f8d88aac) )
1310
1311   ROM_REGION( 0x2000, REGION_SOUND1, 0 )  /* samples */
1312   ROM_LOAD( "s05-14.bin",   0x0000, 0x1000, CRC(5f0bcdfb) SHA1(7f79bf6de117348f606696ed7ea1937bbf926612) )
1313   ROM_LOAD( "r05-13.bin",   0x1000, 0x1000, CRC(9003ffbd) SHA1(fd016056aabc23957643f37230f03842294f795e) )
1314ROM_END
1315
12891316ROM_START( rpatrolb )
12901317   ROM_REGION( 0x10000, REGION_CPU1, 0 )
12911318   ROM_LOAD( "rp1.4l",       0x0000, 0x1000, CRC(bfd7ae7a) SHA1(a06d1cc2674ed40d0bfa67dd6d724964c1e40600) )
r1185r1186
14621489   ROM_LOAD( "cb5.bin",    0x1000, 0x1000, CRC(9003ffbd) SHA1(fd016056aabc23957643f37230f03842294f795e) )
14631490ROM_END
14641491
1465ROM_START( ckongb )
1466   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1467   ROM_LOAD( "d05-7.rom",    0x0000, 0x1000, CRC(5d96ee9a) SHA1(f531d251fd3469edd3b5b5e7c26ff9cef7006ce8) )
1468   ROM_LOAD( "f05-8.rom",    0x1000, 0x1000, CRC(74a8435b) SHA1(465ad96009d3ba939eee13ba0d5fd6d9dec118bc) )
1469   ROM_LOAD( "h05-9.rom",    0x2000, 0x1000, CRC(e06ca575) SHA1(cd5a32fac614902e136e522ac188616c72d65571) )
1470   ROM_LOAD( "k05-10.rom",   0x3000, 0x1000, CRC(46d83a11) SHA1(de840994104bfc633a3640610966f087fbc3d749) )
1471   ROM_LOAD( "l05-11.rom",   0x4000, 0x1000, CRC(07c30f3d) SHA1(9b72f8a76c64ab22f8b8c1bd8e457c10b86d95a1) )
1472   ROM_LOAD( "n05-12.rom",   0x5000, 0x1000, CRC(151de90a) SHA1(5d063c4fe6767727d051815120d692818a30ee81) )
1473
1474   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
1475   ROM_LOAD( "n11-6.bin",    0x0000, 0x1000, CRC(2dcedd12) SHA1(dfdcfc21bcba7c8e148ee54daae511ca78c58e70) )
1476   ROM_LOAD( "k11-4.bin",    0x1000, 0x1000, CRC(3375b3bd) SHA1(a00b3c31cff123aab6ac0833aabfdd663302971a) )
1477   ROM_LOAD( "l11-5.bin",    0x2000, 0x1000, CRC(fa7cbd91) SHA1(0208d2ebc59f3600005476b6987472685bc99d67) )
1478   ROM_LOAD( "h11-3.bin",    0x3000, 0x1000, CRC(5655cc11) SHA1(5195e9b2a60c54280b48b32ee8248090904dbc51) )
1479
1480   ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE )
1481   ROM_LOAD( "c11-2.bin",    0x0000, 0x0800, CRC(d1352c31) SHA1(da726a63a8be830d695afeddc1717749af8c9d47) )
1482   ROM_LOAD( "a11-1.bin",    0x0800, 0x0800, CRC(a7a2fdbd) SHA1(529865f8bbfbdbbf34ac39c70ef17e6d5bd0f845) )
1483
1484   ROM_REGION( 0x0060, REGION_PROMS, 0 )
1485   ROM_LOAD( "prom.v6",      0x0000, 0x0020, CRC(b3fc1505) SHA1(5b94adde0428a26b815c7eb9b3f3716470d349c7) )
1486   ROM_LOAD( "prom.u6",      0x0020, 0x0020, CRC(26aada9e) SHA1(f59645e606ea4f0dd0fc4ea47dd03f526c534941) )
1487   ROM_LOAD( "prom.t6",      0x0040, 0x0020, CRC(676b3166) SHA1(29b9434cd34d43ea5664e436e2a24b54f8d88aac) )
1488
1489   ROM_REGION( 0x2000, REGION_SOUND1, 0 )  /* samples */
1490   ROM_LOAD( "s05-14.bin",   0x0000, 0x1000, CRC(5f0bcdfb) SHA1(7f79bf6de117348f606696ed7ea1937bbf926612) )
1491   ROM_LOAD( "r05-13.bin",   0x1000, 0x1000, CRC(9003ffbd) SHA1(fd016056aabc23957643f37230f03842294f795e) )
1492ROM_END
1493
14941492ROM_START( swimmer )
14951493   ROM_REGION( 0x10000, REGION_CPU1, 0 )
14961494   ROM_LOAD( "sw1",          0x0000, 0x1000, CRC(f12481e7) SHA1(4e8ee509043fd57ec1579594f0b2c543f270bead) )
r1185r1186
16301628GAME( 1981, ckongalc, ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Crazy Kong (Alca bootleg)", 0 )
16311629GAME( 198?, bigkong,  ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Big Kong", 0 )
16321630GAME( 1981, monkeyd,  ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Monkey Donkey", 0 )
1631GAME( 198?, ckongb,   ckong,    cclimber, ckongb,   ckongb,   ROT270, "bootleg", "Crazy Kong (Alternative levels)", 0 )
16331632
16341633GAME( 1981, rpatrolb, 0,        cclimber, rpatrolb, 0,        ROT0,   "bootleg", "River Patrol (bootleg)", 0 )
16351634GAME( 1981, rpatrolo, rpatrolb, cclimber, rpatrolb, 0,        ROT0,   "Orca",  "River Patrol (Orca)", 0 )
16361635GAME( 1981, silvland, rpatrolb, cclimber, rpatrolb, 0,        ROT0,   "Falcon", "Silver Land", 0 )
16371636
1638GAME( 1985, cannonb,  0,        cannonb,  cannonb,  cannonb,  ROT90,  "Soft", "Cannon Ball (Crazy Climber hardware)" , GAME_IMPERFECT_GRAPHICS )
1639GAME( 1985, cannonb2, cannonb,  cannonb,  cannonb,  0,        ROT90,  "TV Game Gruenberg", "Cannon Ball (set 2)", 0 )
1640GAME( 198?, ckongb,   ckong,    cclimber, ckongb,   ckongb,   ROT270, "bootleg", "Crazy Kong (Alternative levels)", 0 )
1637GAME( 1985, cannonb,  cannonbp, cannonb,  cannonb,  cannonb,  ROT90,  "Soft", "Cannon Ball (bootleg on Crazy Climber hardware, set 1)" , GAME_IMPERFECT_GRAPHICS )
1638GAME( 1985, cannonb2, cannonbp, cannonb,  cannonb,  cannonb2, ROT90,  "TV Game Gruenberg", "Cannon Ball (bootleg on Crazy Climber hardware, set 2)", 0 )
16411639
16421640GAME( 1982, swimmer,  0,        swimmer,  swimmer,  0,        ROT0,   "Tehkan", "Swimmer (set 1)", 0 )
16431641GAME( 1982, swimmera, swimmer,  swimmer,  swimmer,  0,        ROT0,   "Tehkan", "Swimmer (set 2)", 0 )
src/mame/drivers/gticlub.c
r1185r1186
4242#include "machine/konamiic.h"
4343#include "machine/adc083x.h"
4444#include "sound/rf5c400.h"
45#include "video/poly.h"
4645#include "video/voodoo.h"
4746#include "video/gticlub.h"
4847#include "rendlay.h"
src/mame/drivers/deniam.c
r1185r1186
307307static void irqhandler(int linestate)
308308{
309309   /* system 16c doesn't have the sound CPU */
310   if (Machine->drv->cpu[1].cpu_type != CPU_DUMMY)
310   if (Machine->drv->cpu[1].type != CPU_DUMMY)
311311      cpunum_set_input_line(1,0,linestate);
312312}
313313
src/mame/drivers/pipeline.c
r1185r1186
346346
347347MACHINE_RESET( pipeline )
348348{
349   ctc_intf.baseclock = machine->drv->cpu[0].cpu_clock;
349   ctc_intf.baseclock = machine->drv->cpu[0].clock;
350350   z80ctc_init(0, &ctc_intf);
351351   ppi8255_init(&ppi8255_intf);
352352}
src/mame/drivers/taito_b.c
r1185r1186
26192619{
26202620   if (channel==1)
26212621   {
2622      int type = Machine->drv->sound[0].sound_type;
2622      sound_type type = Machine->drv->sound[0].type;
26232623      sndti_set_output_gain(type, 0, 0, percent / 100.0);
26242624      sndti_set_output_gain(type, 1, 0, percent / 100.0);
26252625      sndti_set_output_gain(type, 2, 0, percent / 100.0);
src/mame/drivers/gaelco3d.c
r1185r1186
632632         /* calculate how long until we generate an interrupt */
633633
634634         /* period per each bit sent */
635         sample_period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[2].cpu_clock), 2 * (adsp_control_regs[S1_SCLKDIV_REG] + 1));
635         sample_period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[2].clock), 2 * (adsp_control_regs[S1_SCLKDIV_REG] + 1));
636636
637637         /* now put it down to samples, so we know what the channel frequency has to be */
638638         sample_period = scale_up_mame_time(sample_period, 16 * SOUND_CHANNELS);
r1185r1186
963963   /* video hardware */
964964   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER )
965965   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15)
966   MDRV_SCREEN_SIZE(576 / GAELCO3D_RESOLUTION_DIVIDE, 432 / GAELCO3D_RESOLUTION_DIVIDE)
967   MDRV_SCREEN_VISIBLE_AREA(0, 576 / GAELCO3D_RESOLUTION_DIVIDE - 1, 0, 432 / GAELCO3D_RESOLUTION_DIVIDE - 1)
966   MDRV_SCREEN_SIZE(576, 432)
967   MDRV_SCREEN_VISIBLE_AREA(0, 575, 0, 431)
968968   MDRV_PALETTE_LENGTH(32768)
969969
970970   MDRV_VIDEO_START(gaelco3d)
src/mame/drivers/itech8.c
r1185r1186
546546   if (blitter != -1) blitter_int = blitter;
547547
548548   /* handle the 6809 case */
549   if (Machine->drv->cpu[0].cpu_type == CPU_M6809)
549   if (Machine->drv->cpu[0].type == CPU_M6809)
550550   {
551551      /* just modify lines that have changed */
552552      if (periodic != -1) cpunum_set_input_line(0, INPUT_LINE_NMI, periodic ? ASSERT_LINE : CLEAR_LINE);
r1185r1186
628628static MACHINE_RESET( itech8 )
629629{
630630   /* make sure bank 0 is selected */
631   if (machine->drv->cpu[0].cpu_type == CPU_M6809)
631   if (machine->drv->cpu[0].type == CPU_M6809)
632632      memory_set_bankptr(1, &memory_region(REGION_CPU1)[0x4000]);
633633
634634   /* reset the PIA (if used) */
src/mame/drivers/namcos21.c
r1185r1186
11/**
22Namco System 21
33
4todo:
5- confirm that halt dsp works
6- fix machine/namcos2 to halt only relevant cpu subsets
7- manual "kickstart" needed (press "N" any time after title screen)
8
94Winning Run
105    polygon glitches/flicker
11    missing posirq handling
6    posirq effects for bitmap layer not working
127
13Air Combat
14    timing innacuracies cause DSP to lock up in-game
15
16Starblade
17    high score colors wrong
18
19Cybersled
20    occasional transparent floor due to z-buffer overloading
21
22Solvaou
23    sprite mixing wrong; needs to use zbuffer
24
258Driver's Eyes
269    not yet working
2710
r1185r1186
298281
299282#define PTRAM_SIZE 0x20000
300283#define CPU_DSP_MASTER_REGION   REGION_CPU5
301#define CPU_DSP_SLAVE_REGION   REGION_CPU6
302284
303285static UINT16 *winrun_dspbios;
304286static UINT16 *winrun_dspcomram;
r1185r1186
326308
327309
328310
329#define DSP_BUF_MAX (4096*8)
311#define DSP_BUF_MAX (4096*12)
330312static struct
331313{
332314   unsigned masterSourceAddr;
r1185r1186
360342   COMBINE_DATA( &namcos21_video_enable ); /* 0x40 = enable */
361343   if( namcos21_video_enable!=0 && namcos21_video_enable!=0x40 )
362344   {
363      printf( "unexpected namcos21_video_enable_w=0x%x\n", namcos21_video_enable );
345      logerror( "unexpected namcos21_video_enable_w=0x%x\n", namcos21_video_enable );
364346   }
365347}
366348
r1185r1186
382364      case 0x8067: result = 0xffff; break;
383365      case 0x806e: result = 0x0145; break;
384366      default:
385         printf( "unk cuskey_r; pc=0x%x\n", activecpu_get_pc() );
367         logerror( "unk cuskey_r; pc=0x%x\n", activecpu_get_pc() );
386368         break;
387369      }
388370   }
r1185r1186
417399   unsigned offs = mpDspState->slaveInputStart+mpDspState->slaveBytesAvailable++;
418400   mpDspState->slaveInputBuffer[offs%DSP_BUF_MAX] = data;
419401   logerror( "+%04x(#%04x)\n", data, mpDspState->slaveBytesAvailable );
420   //printf( "+%04x(#%04x)\n", data, mpDspState->slaveBytesAvailable );
421402   mpDspState->slaveActive = 1;
422403   if( mpDspState->slaveBytesAvailable >= DSP_BUF_MAX )
423404   {
424      printf( "IDC overflow\n" );
405      logerror( "IDC overflow\n" );
425406      exit(1);
426407   }
427408} /* TransmitWordToSlave */
r1185r1186
524505
525506static int mbNeedsKickstart;
526507
508static UINT16 *master_dsp_code;
509
527510void
528511namcos21_kickstart( int internal )
529512{
513   /* patch dsp watchdog */
514   switch( namcos2_gametype )
515   {
516   case NAMCOS21_AIRCOMBAT:
517      master_dsp_code[0x008e] = 0x808f;
518      break;
519   case NAMCOS21_SOLVALOU:
520      master_dsp_code[0x008b] = 0x808c;
521      break;
522   default:
523      break;
524   }
530525   if( internal )
531526   {
532527      if( mbNeedsKickstart==0 ) return;
533528      mbNeedsKickstart--;
534529      if( mbNeedsKickstart ) return;
535      printf("KICK\n" );
536530   }
531
537532   namcos21_ClearPolyFrameBuffer();
538533   mpDspState->masterSourceAddr = 0;
539534   mpDspState->slaveOutputSize = 0;
r1185r1186
748743      }
749744      else
750745      {
751         printf( "indirection used w/ direct draw?\n" );
746         logerror( "indirection used w/ direct draw?\n" );
752747      }
753748   }
754749   else if( mpDspState->masterDirectDrawSize )
755750   {
756      printf( "unexpected masterDirectDrawSize=%d!\n",mpDspState->masterDirectDrawSize );
751      logerror( "unexpected masterDirectDrawSize=%d!\n",mpDspState->masterDirectDrawSize );
757752   }
758753   mpDspState->masterDirectDrawSize = 0;
759754} /* dsp_portb_w */
r1185r1186
766761   }
767762   else
768763   {
769      printf( "portc overflow\n" );
764      logerror( "portc overflow\n" );
770765   }
771766} /* dsp_portc_w */
772767
r1185r1186
782777
783778static ADDRESS_MAP_START( master_dsp_program, ADDRESS_SPACE_PROGRAM, 16 )
784779   AM_RANGE(0x0000, 0x0fff) AM_READ(MRA16_ROM) /* BIOS */
785   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA16_RAM) AM_WRITE(MWA16_RAM)
780   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA16_RAM) AM_WRITE(MWA16_RAM) AM_BASE(&master_dsp_code)
786781ADDRESS_MAP_END
787782
788783static ADDRESS_MAP_START( master_dsp_data, ADDRESS_SPACE_DATA, 16 )
r1185r1186
814809{
815810   if( mpDspState->slaveOutputSize >= 4096 )
816811   {
817      printf( "FATAL ERROR: SLAVE OVERFLOW (0x%x)\n",mpDspState->slaveOutputBuffer[0]  );
812      logerror( "FATAL ERROR: SLAVE OVERFLOW (0x%x)\n",mpDspState->slaveOutputBuffer[0]  );
818813      exit(1);
819814      return;
820815   }
r1185r1186
832827         int j;
833828         if( color&0x8000 )
834829         {
835            if( count!=13 ) printf( "?!direct-draw(%d)\n", count );
830            if( count!=13 ) logerror( "?!direct-draw(%d)\n", count );
836831            for( j=0; j<4; j++ )
837832            {
838833               sx[j] = NAMCOS21_POLY_FRAME_WIDTH/2 + (INT16)pSource[3*j+0];
r1185r1186
866861      }
867862      else if( count==0 )
868863      {
869         printf( "RenderSlaveOutput\n" );
864         logerror( "RenderSlaveOutput\n" );
870865         exit(1);
871866      }
872867   }
r1185r1186
12211216   }
12221217   else
12231218   {
1224      printf( "WINRUN_POLY_OVERFLOW\n" );
1219      logerror( "WINRUN_POLY_OVERFLOW\n" );
12251220   }
12261221} /* winrun_dsp_render_w */
12271222
r1185r1186
17501745   ROM_LOAD32_BYTE( "ac1-poi-lu.2k", 0x000002, 0x80000, CRC(d99084b9) SHA1(c604d60a2162af7610e5ff7c1aa4195f7df82efe) )
17511746   ROM_LOAD32_BYTE( "ac1-poi-ll.2n", 0x000003, 0x80000, CRC(abb32307) SHA1(8e936ba99479215dd33a951d81ec2b04020dfd62) )   /* least significant */
17521747
1753
17541748   ROM_REGION( 0x200000, REGION_SOUND1, 0 ) /* sound samples */
17551749   ROM_LOAD("ac1-voi0.12b",0x000000,0x80000,CRC(f427b119) SHA1(bd45bbe41c8be26d6c997fcdc226d080b416a2cf) )
17561750   ROM_LOAD("ac1-voi1.12c",0x080000,0x80000,CRC(c9490667) SHA1(4b6fbe635c32469870a8e6f82742be6a9d4918c9) )
17571751   ROM_LOAD("ac1-voi2.12d",0x100000,0x80000,CRC(1fcb51ba) SHA1(80fc815e5fad76d20c3795ab1d89b57d9abc3efd) )
17581752   ROM_LOAD("ac1-voi3.12e",0x180000,0x80000,CRC(cd202e06) SHA1(72a18f5ba402caefef14b8d1304f337eaaa3eb1d) )
17591753
1760   ROM_REGION( 0x0600, REGION_PLDS, ROMREGION_DISPOSE )
1761   ROM_LOAD( "gal16v8a-3pdsp5.17d", 0x0000, 0x0117, CRC(799c1f26) SHA1(d28ed1b9fa78180c5a0b01a7198a2870137c7349) )
1762   ROM_LOAD( "plhs18p8-3pobj3.17n", 0x0200, 0x0149, CRC(9625f469) SHA1(29158a3d37485fb0714d0a60bcd07abd26a3f56e) )
1763   ROM_LOAD( "plhs18p8-3pobj4.17n", 0x0400, 0x0149, CRC(1b7c90c1) SHA1(ae65aab7a191cdf1af488e144af22b9d8669c903) )
1754//  ROM_REGION( 0x0600, REGION_PLDS, ROMREGION_DISPOSE )
1755//  ROM_LOAD( "gal16v8a-3pdsp5.17d", 0x0000, 0x0117, CRC(799c1f26) SHA1(d28ed1b9fa78180c5a0b01a7198a2870137c7349) )
1756//  ROM_LOAD( "plhs18p8-3pobj3.17n", 0x0200, 0x0149, CRC(9625f469) SHA1(29158a3d37485fb0714d0a60bcd07abd26a3f56e) )
1757//  ROM_LOAD( "plhs18p8-3pobj4.17n", 0x0400, 0x0149, CRC(1b7c90c1) SHA1(ae65aab7a191cdf1af488e144af22b9d8669c903) )
17641758ROM_END
17651759
17661760ROM_START( aircombj )
r1185r1186
21872181   mpDataROM = (UINT16 *)memory_region( REGION_USER1 );
21882182   InitDSP();
21892183   mbNeedsKickstart = 20;
2184   if( game_type==NAMCOS21_CYBERSLED )
2185   {
2186      mbNeedsKickstart = 200;
2187   }
21902188} /* namcos21_init */
21912189
21922190static DRIVER_INIT( winrun )
src/mame/drivers/ikki.c
r1185r1186
196196   MDRV_CPU_PROGRAM_MAP(ikki_cpu2,0)
197197   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
198198
199   MDRV_INTERLEAVE(10)
200
199201   MDRV_SCREEN_REFRESH_RATE(60)
200202   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
201203
src/mame/drivers/metro.c
r1185r1186
59275927GAME( 1994, lastforg, lastfort, lastforg, ladykill, metro,    ROT0,   "Metro",                      "Last Fortress - Toride (German)"    , 0 )
59285928GAME( 1994, toride2g, 0,        toride2g, toride2g, metro,    ROT0,   "Metro",                      "Toride II Adauchi Gaiden",        GAME_IMPERFECT_GRAPHICS )
59295929GAME( 1994, torid2gg, toride2g, toride2g, toride2g, metro,    ROT0,   "Metro",                      "Toride II Adauchi Gaiden (German)", GAME_IMPERFECT_GRAPHICS )
5930GAME( 1994, toride2j, toride2g, toride2g, toride2g, metro,    ROT0,   "Metro",                      "Toride II Adauchi Gaiden (Japan)", GAME_IMPERFECT_GRAPHICS )
5930GAME( 1994, toride2j, toride2g, toride2g, toride2g, metro,    ROT0,   "Metro",                      "Toride II (Japan)", GAME_IMPERFECT_GRAPHICS )
59315931GAME( 1994, gunmast,  0,        pururun,  gunmast,  daitorid, ROT0,   "Metro",                      "Gun Master"                      , 0 )
59325932GAME( 1995, daitorid, 0,        daitorid, daitorid, daitorid, ROT0,   "Metro",                      "Daitoride",                       GAME_IMPERFECT_GRAPHICS )
59335933GAME( 1995, dokyusei, 0,        dokyusei, dokyusei, gakusai,  ROT0,   "Make Software / Elf / Media Trading", "Mahjong Doukyuusei"        , 0 )
src/mame/drivers/midvunit.c
r1185r1186
286286
287287      /* bit 0x200 selects internal clocking, which is 1/2 the main CPU clock rate */
288288      if (data & 0x200)
289         timer_rate = (double)Machine->drv->cpu[0].cpu_clock * 0.5;
289         timer_rate = (double)Machine->drv->cpu[0].clock * 0.5;
290290      else
291291         timer_rate = 10000000.;
292292   }
src/mame/drivers/seta.c
r1185r1186
12521252   UINT16 max = uPD71054.max[no]&0xffff;
12531253
12541254   if( max != 0 ) {
1255      mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[0].cpu_clock), 16 * max);
1255      mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[0].clock), 16 * max);
12561256      mame_timer_adjust( uPD71054.timer[no], period, no, time_zero );
12571257   } else {
12581258      mame_timer_adjust( uPD71054.timer[no], time_never, no, time_never);
src/mame/drivers/asteroid.c
r1185r1186
775775   ROM_LOAD( "034602-01.c8",   0x0000, 0x0100, CRC(97953db8) SHA1(8cbded64d1dd35b18c4d5cece00f77e7b2cab2ad) )
776776ROM_END
777777
778ROM_START( meteorho )
779   ROM_REGION( 0x8000, REGION_CPU1, 0 )
780   ROM_LOAD( "g.bin",    0x6800, 0x0400, CRC(7420421b) SHA1(e84a340c0cbc8816bbe43120bc8e692d2a3db0ab) )
781   ROM_LOAD( "h.bin",    0x6c00, 0x0400, CRC(a6aa56bc) SHA1(8298e1667c3bd9af9e0be7d53c00d73ef59d742e) )
782   ROM_LOAD( "f.bin",    0x7000, 0x0400, CRC(2711bd52) SHA1(219499b9b8dcc221173f9b9a34c9e6f2fb936231) )
783   ROM_LOAD( "d.bin",    0x7400, 0x0400, CRC(9f169db9) SHA1(b6a4a8ea9d48c6b1faebf104faae7c67b2b060b5) )
784   ROM_LOAD( "c.bin",    0x7800, 0x0400, CRC(bd99556a) SHA1(8c712b205125c0c2a45dbb4fa9e5e5302c5bbd1b) )
785   ROM_LOAD( "e.bin",    0x7c00, 0x0400, CRC(10fdfe9a) SHA1(9db4b3ab904e66d3622ec98e13ef6baf5d4f7099) )
786   /* Vector ROM */
787   ROM_LOAD( "a.bin",    0x5000, 0x0400, CRC(d7822110) SHA1(bf6c5e622fdc16c39a1d8f23fc029abaa1e99b19) )
788   ROM_LOAD( "b.bin",    0x5400, 0x0400, CRC(d62b2887) SHA1(8832953c7166d2f0ed1067c43ebf369db4a4aa70) )
789   /* DVG PROM */
790   ROM_REGION( 0x100, REGION_USER1, 0 )
791   ROM_LOAD( "prom.bin",   0x0000, 0x0100, CRC(9e237193) SHA1(f663e12d5db0fa50ea49d03591475ae0a7168bc0) )
792ROM_END
778793
794
779795ROM_START( astdelux )
780796   ROM_REGION( 0x8000, REGION_CPU1, 0 )
781797   ROM_LOAD( "036430.02",    0x6000, 0x0800, CRC(a4d7a525) SHA1(abe262193ec8e1981be36928e9a89a8ac95cd0ad) )
r1185r1186
924940GAME( 1979, asteroib, asteroid, asteroid, asteroib, asteroib, ROT0, "bootleg", "Asteroids (bootleg on Lunar Lander hardware)", 0 )
925941GAME( 1979, asterock, asteroid, asterock, asterock, asterock, ROT0, "Sidam", "Asterock", 0 )
926942GAME( 1979, meteorts, asteroid, asteroid, asteroid, 0,        ROT0, "VGG",   "Meteorites", 0 )
943GAME( 1980, meteorho, asteroid, asteroid, asteroid, 0,        ROT0, "Hoei",  "Meteor", 0 )
927944GAMEL(1980, astdelux, 0,        astdelux, astdelux, 0,        ROT0, "Atari", "Asteroids Deluxe (rev 3)", 0, layout_ho88ffff )
928945GAMEL(1980, astdelu2, astdelux, astdelux, astdelux, 0,        ROT0, "Atari", "Asteroids Deluxe (rev 2)", 0, layout_ho88ffff )
929946GAMEL(1980, astdelu1, astdelux, astdelux, astdelux, 0,        ROT0, "Atari", "Asteroids Deluxe (rev 1)", 0, layout_ho88ffff )
src/mame/drivers/stv.c
r1185r1186
36943694//GBX   YEAR, NAME,      PARENT,  BIOS,    MACH,INP,  INIT,      MONITOR
36953695/* Playable */
36963696GAMEB( 1998, astrass,   stvbios, stvbios, stv, stv,  astrass,   ROT0,   "Sunsoft",                  "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3697GAMEB( 1996, bakubaku,  stvbios, stvbios, stv, stv,  bakubaku,  ROT0,   "Sega",                   "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
3697GAMEB( 1995, bakubaku,  stvbios, stvbios, stv, stv,  bakubaku,  ROT0,   "Sega",                   "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
36983698GAMEB( 1996, batmanfr,  stvbios, stvbios, stv, stv,  batmanfr,  ROT0,   "Acclaim",                  "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND )
36993699GAMEB( 1996, colmns97,  stvbios, stvbios, stv, stv,  colmns97,  ROT0,   "Sega",                   "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37003700GAMEB( 1997, cotton2,   stvbios, stvbios, stv, stv,  cotton2,   ROT0,   "Success",                "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
r1185r1186
37073707GAMEB( 1995, fhboxers,  stvbios, stvbios, stv, stv,  fhboxers,  ROT0,   "Sega",                   "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
37083708GAMEB( 1994, gaxeduel,  stvbios, stvbios, stv, stv,  gaxeduel,   ROT0,   "Sega",                    "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND )
37093709GAMEB( 1998, grdforce,  stvbios, stvbios, stv, stv,  grdforce,  ROT0,   "Success",                "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3710GAMEB( 1996, groovef,   stvbios, stvbios, stv, stv,  groovef,   ROT0,   "Atlus",                  "Power Instinct 3 - Groove On Fight (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3711GAMEB( 1998, hanagumi,  stvbios, stvbios, stv, stv,  hanagumi,  ROT0,   "Sega",                   "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3710GAMEB( 1998, groovef,   stvbios, stvbios, stv, stv,  groovef,   ROT0,   "Atlus",                  "Power Instinct 3 - Groove On Fight (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3711GAMEB( 1997, hanagumi,  stvbios, stvbios, stv, stv,  hanagumi,  ROT0,   "Sega",                   "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
37123712GAMEB( 1996, introdon,  stvbios, stvbios, stv, stv,  ic13,      ROT0,   "Sunsoft / Success",         "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37133713GAMEB( 1995, kiwames,   stvbios, stvbios, stv, stvmp,ic13,      ROT0,   "Athena",                 "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37143714GAMEB( 1997, maruchan,  stvbios, stvbios, stv, stv,  maruchan,  ROT0,   "Sega / Toyosuisan",          "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3715GAMEB( 1995, mausuke,   stvbios, stvbios, stv, stv,  mausuke,   ROT0,   "Data East",              "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3715GAMEB( 1996, mausuke,   stvbios, stvbios, stv, stv,  mausuke,   ROT0,   "Data East",              "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37163716GAMEB( 1998, othellos,  stvbios, stvbios, stv, stv,  othellos,  ROT0,   "Success",                "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37173717GAMEB( 1995, pblbeach,  stvbios, stvbios, stv, stv,  pblbeach,  ROT0,   "T&E Soft",                 "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37183718GAMEB( 1996, prikura,   stvbios, stvbios, stv, stv,  prikura,   ROT0,   "Atlus",                  "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37193719GAMEB( 1996, puyosun,   stvbios, stvbios, stv, stv,  puyosun,   ROT0,   "Compile",                "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37203720GAMEB( 1998, rsgun,     stvbios, stvbios, stv, stv,  rsgun,     ROT0,   "Treasure",                 "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3721GAMEB( 1996, sasissu,   stvbios, stvbios, stv, stv,  sasissu,   ROT0,   "Sega",                    "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3722GAMEB( 1998, seabass,   stvbios, stvbios, stv, stv,  seabass,   ROT0,   "A wave inc. (Able license)","Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3721GAMEB( 1998, sasissu,   stvbios, stvbios, stv, stv,  sasissu,   ROT0,   "Sega",                    "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3722GAMEB( 1997, seabass,   stvbios, stvbios, stv, stv,  seabass,   ROT0,   "A wave inc. (Able license)","Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37233723GAMEB( 1995, shanhigw,  stvbios, stvbios, stv, stv,  shanhigw,   ROT0,   "Sunsoft / Activision",      "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37243724GAMEB( 1997, shienryu,  stvbios, stvbios, stv, stv,  shienryu,  ROT270, "Warashi",                "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
37253725GAMEB( 1995, smleague,  stvbios, stvbios, stv, stv,  smleague,  ROT0,   "Sega",                    "Super Major League (U 960108 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37263726GAMEB( 1995, finlarch,  smleague,stvbios, stv, stv,  finlarch,  ROT0,   "Sega",                    "Final Arch (J 950714 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37273727GAMEB( 1998, sss,       stvbios, stvbios, stv, stv,  sss,       ROT0,   "Capcom / Cave / Victor",     "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND )
3728GAMEB( 1995, sandor,    stvbios, stvbios, stv, stv,  sandor,    ROT0,   "Sega",                    "Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3728GAMEB( 1995, sandor,    stvbios, stvbios, stv, stv,  sandor,    ROT0,   "Sega",                    "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37293729GAMEB( 1996, sokyugrt,  stvbios, stvbios, stv, stv,  sokyugrt,  ROT0,   "Raizing / 8ing",            "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37303730GAMEB( 1995, suikoenb,  stvbios, stvbios, stv, stv,  suikoenb,  ROT0,   "Data East",                "Suikoenbu / Outlaws of the Lost Dynasty (JUETL 950314 V2.001)", GAME_IMPERFECT_SOUND )
3731GAMEB( 1995, thunt,     sandor,  stvbios, stv, stv,  thunt,     ROT0,   "Sega (Deniam license?)",     "Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3731GAMEB( 1997, thunt,     sandor,  stvbios, stv, stv,  thunt,     ROT0,   "Sega",                      "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37323732GAMEB( 1996, vfkids,    stvbios, stvbios, stv, stv,  ic13,      ROT0,   "Sega",                   "Virtua Fighter Kids (JUET 960319 V0.000)", GAME_IMPERFECT_SOUND )
37333733GAMEB( 1997, winterht,  stvbios, stvbios, stv, stv,  winterht,  ROT0,   "Sega",                   "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
37343734GAMEB( 1997, znpwfv,    stvbios, stvbios, stv, stv,  znpwfv,    ROT0,   "Sega",                    "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
r1185r1186
37413741/* Doing Something.. but not enough yet */
37423742GAMEB( 1998, elandore,  stvbios, stvbios, stv, stv,  elandore,  ROT0,   "Sai-Mate",                 "Elan Doree - Legend of Dragon (JUET 980922 V1.006)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )//japanese name?
37433743GAMEB( 1995, vfremix,   stvbios, stvbios, stv, stv,  vfremix,   ROT0,   "Sega",                    "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
3744GAMEB( 1996, findlove,  stvbios, stvbios, stv, stv,  ic13,      ROT0,   "Daiki / FCF",               "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
3745GAMEB( 1995, decathlt,  stvbios, stvbios, stv, stv,  decathlt,  ROT0,   "Sega",                    "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
3744GAMEB( 1997, findlove,  stvbios, stvbios, stv, stv,  ic13,      ROT0,   "Daiki / FCF",               "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
3745GAMEB( 1996, decathlt,  stvbios, stvbios, stv, stv,  decathlt,  ROT0,   "Sega",                    "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
37463746
37473747/* not working,black screen */
37483748GAMEB( 1999, ffreveng,  stvbios, stvbios, stv, stv,  ffreveng,  ROT0,   "Capcom",                   "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING )
src/mame/drivers/astrocde.c
r1185r1186
506506static MACHINE_START( tenpindx )
507507{
508508   /* initialize the CTC */
509   ctc_intf.baseclock = machine->drv->cpu[0].cpu_clock;
509   ctc_intf.baseclock = machine->drv->cpu[0].clock;
510510   z80ctc_init(0, &ctc_intf);
511511   machine_start_astrocde(machine);
512512}
src/mame/drivers/psikyo4.c
r1185r1186
1010 Taisen Hot Gimmick (c)1997
1111 Taisen Hot Gimmick Kairakuten (c)1998
1212 Taisen Hot Gimmick 3 Digital Surfing (c)1999
13 Taisen Hot Gimmick 4 Ever (c)2000
14 Taisen Hot Gimmick Integral (c)2001
15
1316 Lode Runner - The Dig Fight (c)2000
1417 Quiz de Idol! Hot Debut (c)2000
1518
16 Incomplete Dumps
17 Taisen Hot Gimmick 4 Ever (c)2000 (confirmed by Japump)
18 Taisen Hot Gimmick Integral (c)2001 (confirmed by Yahoo! Japan auction)
19
20
2119 The PS4 board appears to be a cheaper board than PS3/5/5v2, with only simple sprites, no bgs,
2220 smaller palette etc, only 8bpp sprites too.
2321 Supports dual-screen though.
r1185r1186
4240
4341Hold Button during booting to test roms (Checksum 16-bit) for:
4442
45Lode Runner - The Dig Fight:   PL1 Start (passes gfx, sample result:05A5, expects:0BB0 [both sets])
43Lode Runner - The Dig Fight:   PL1 Start (passes gfx, sample result:05A5, expects:0BB0 [both sets]) (banking?)
4644Quiz de Idol! Hot Debut:       PL1 Start (passes)
4745
4846--- Lode Runner: The Dig Fight ---
r1185r1186
5654NOTE: The version number (A/B) on Lode Runner: The Dig Fight is ONLY displayed when the game is set
5755      to Japanese.  The same is true for Space Bomber in psikyosh.c
5856
57
58Psikyo PS4V3 Hardware Overview
59Psikyo, 1997-2001
60
61PCB Layout
62----------
63
64PS4V3 MADE IN JAPAN
65|--------------------------------------------------------------------|
66| SND0.U10 SND1.U19               HA13118            HA13118         |
67|                          JRC4741                                   |
68| 8L.U112  8H.U113            YAC516    VOL             VOL        |-|
69|                  74ACT153 74ACT153                               |
70|                                                                  |-|
71| 7L.U9    7H.U18  74HCT273 74HCT273 74ACT138 74HCT273               |
72|                                             74HC244  74HC244      M|
73|                                      74ACT244              CN8    A|
74| 6L.U8    6H.U17   74ACT138  93LC56                                H|
75|                                 JP4  74ACT244                     J|
76|                       |---------|                                 O|
77| 5L.U7    5H.U16       |         |    74ACT244              CN7    N|
78|                       | PSIKYO  |             74HC14              G|
79|                       | PS6807  |    74ACT244        TD62064       |
80| 4L.U6    4H.U15       |         |                                |-|
81|                       |---------|    74ACT244                    |
82|                                                         TD62003  |-|
83| 3L.U5    3H.U14       57.2727MHz     74ACT244                      |
84|                                               74ACT138  TD62003    |
85|                                               3771                J|
86| 2L.U4    2H.U13   814260        74AC08 74ACT04 74HC245  74HC244   A|
87|                                                                   M|
88|                   814260                 |--------|               M|
89| 1L.U3    1H.U12                          |        |               A|
90|                                          |  SH-2  |                |
91|                                          |        |     74HC244  |-|
92| 0L.U2    0H.U11    1.U23                 |--------|              |
93|                                                         74HC244  |-|
94| PROG.U1            2.U22                     74ACT139              |
95|--------------------------------------------------------------------|
96(All IC's listed)
97Notes:
98SH-2    - Hitachi HD6417604F28 SH-2 CPU, clock input 28.63635 [57.2727/2] (QFP144)
99YMF278  - Yamaha YMF278B OPL4 sound chip, clock input 28.63635MHz [57.2727/2] (QFP80)
100YAC516  - Yamaha YAC516 Delta Sigma Modulation D/A Converter with 8 Times Over-sampling
101          Filter. Clock input 14.318175MHz [57.2727/4]
102814260  - Fujitsu 814260-70 256k x16 (4MBit) DRAM (SOJ40)
1033771    - Fujitsu MB3771 Watchdog Reset IC (SOIC8)
10493LC56  - 256x8(2k) Serial CMOS EEPROM (SOIC8)
105JRC4741 - Japan Radio Co. JRC4741 Quad OP AMP (SOIC14)
106HA13118 - 18W Bridge Tied Load (BTL) Mono Audio Amplifier Module (in 15-pin SP-15TA package)
107JP4     - Hardwired jumper bank (x4) for region selection.
108          All jumpers shorted = Japan region (default)
109CN7/CN8 - Extra connector for 2nd screen output and additional player inputs. JAMMA/MAHJONG
110          connectors not used together. Either one or the other is used depending on the game.
111          Game will operate fine with 1 screen output. CN7/CN8 connection is optional.
112TD62064 - Toshiba TD62064 4 Channel High-Current Darlington Sink Driver (SOP18)
113TD62003 - Toshiba TD62003 7 Channel High-Current Darlington Sink Driver (SOP16)
114VSync   - 60Hz
115HSync   - 15.68kHz
116
117ROMs -
118       1.U23 - Main Program, ST 27C4002 EPROM (DIP40)
119       2.U22 /
120
121       The remaining ROMs are surface mounted TSOP48 Type II MASKROMs,
122       either OKI MSM27C3252 (32MBit) or OKI MSM27C1652 (16MBit).
123       These MASKROMs are non-standard are require a custom adapter
124       to read them. Not all positions are populated for each game. See
125       the source below for specifics.
126
59127----------------------------------------------------------------*/
60128
61129#include "driver.h"
r1185r1186
851919ROM_END
852920
853921ROM_START( hotgmcki )
854   /* main program */
855   ROM_REGION( 0x300000, REGION_CPU1, 0)
922   ROM_REGION( 0x500000, REGION_CPU1, 0)
856923   ROM_LOAD32_WORD_SWAP( "2.u22",   0x000000, 0x080000, CRC(abc192dd) SHA1(674c2b8814319605c1b6221bbe18588a98dda093) )
857924   ROM_LOAD32_WORD_SWAP( "1.u23",   0x000002, 0x080000, CRC(8be896d0) SHA1(5d677dede4ec18cbfc54acae95fe0f10bfc4d566) )
858   /* not dumped yet */
859    ROM_LOAD16_WORD_SWAP( "prog.u1", 0x100000, 0x100000, NO_DUMP )
925    ROM_LOAD16_WORD_SWAP( "prog.u1", 0x100000, 0x200000, CRC(9017ae8e) SHA1(0879198606095a2d209df059538ce1c73460b30e) ) // no test
926   ROM_RELOAD(0x300000,0x200000)
860927
861   /* exact number & size of gfx / sound roms may be incorrect */
862   ROM_REGION( 0x4000000, REGION_GFX1, ROMTEST_GFX )   /* Sprites */
863   /* not dumped yet */
864    ROM_LOAD32_WORD( "0l.u2",  0x0000000, 0x400000, NO_DUMP )
865    ROM_LOAD32_WORD( "0h.u11", 0x0000002, 0x400000, NO_DUMP )
866    ROM_LOAD32_WORD( "1l.u3",  0x0800000, 0x400000, NO_DUMP )
867    ROM_LOAD32_WORD( "1h.u12", 0x0800002, 0x400000, NO_DUMP )
868    ROM_LOAD32_WORD( "2l.u4",  0x1000000, 0x400000, NO_DUMP )
869    ROM_LOAD32_WORD( "2h.u13", 0x1000002, 0x400000, NO_DUMP )
870    ROM_LOAD32_WORD( "3l.u5",  0x1800000, 0x400000, NO_DUMP )
871    ROM_LOAD32_WORD( "3h.u14", 0x1800002, 0x400000, NO_DUMP )
872    ROM_LOAD32_WORD( "4l.u6",  0x2000000, 0x400000, NO_DUMP )
873    ROM_LOAD32_WORD( "4h.u15", 0x2000002, 0x400000, NO_DUMP )
874    ROM_LOAD32_WORD( "5l.u7",  0x2800000, 0x400000, NO_DUMP )
875    ROM_LOAD32_WORD( "5h.u16", 0x2800002, 0x400000, NO_DUMP )
876    ROM_LOAD32_WORD( "6l.u8",  0x3000000, 0x400000, NO_DUMP )
877    ROM_LOAD32_WORD( "6h.u17", 0x3000002, 0x400000, NO_DUMP )
878    ROM_LOAD32_WORD( "7l.u9",  0x3800000, 0x400000, NO_DUMP )
879    ROM_LOAD32_WORD( "7h.u18", 0x3800002, 0x400000, NO_DUMP )
928   /* Roms have to be mirrored with ROM_RELOAD for rom tests to pass */
929   ROM_REGION( 0x4000000, REGION_GFX1, ROMREGION_ERASEFF | ROMTEST_GFX )   /* Sprites */
930   ROM_LOAD32_WORD( "0l.u2",  0x0000000, 0x200000, CRC(58ae45eb) SHA1(76a23e79f2c772c5e85b8c15cf79f56b6f71fbc6) ) // ok
931   ROM_RELOAD(                0x0400000, 0x200000 )
932   ROM_LOAD32_WORD( "0h.u11", 0x0000002, 0x200000, CRC(d7bbb929) SHA1(c505ad04cdafb84800099bbbb67c5f6b52212124) ) // ok
933   ROM_RELOAD(                0x0400002, 0x200000 )
934   ROM_LOAD32_WORD( "1l.u3",  0x0800000, 0x200000, CRC(27576360) SHA1(ed9d6f5b9934e8ddae3f3ca146e99f42dbd495de) ) // ok
935   ROM_RELOAD(                0x0c00000, 0x200000 )
936    ROM_LOAD32_WORD( "1h.u12", 0x0800002, 0x200000, CRC(7439a63f) SHA1(c9a74e5e81a2c94ce7a9b3b487f54ac5b3635744) ) // ok
937   ROM_RELOAD(                0x0c00002, 0x200000 )
938   ROM_LOAD32_WORD( "2l.u4",  0x1000000, 0x200000, CRC(fda64e24) SHA1(e8788b5f0e8b0f90c9942f9f4cbcee02be8afd09) ) // ok
939   ROM_RELOAD(                0x1400000, 0x200000 )
940   ROM_LOAD32_WORD( "2h.u13", 0x1000002, 0x200000, CRC(8be54ea6) SHA1(311812e9d7815e80db05d9a94c277b2b37e7a589) ) // ok
941   ROM_RELOAD(                0x1400002, 0x200000 )
942   ROM_LOAD32_WORD( "3l.u5",  0x1800000, 0x200000, CRC(92507b3f) SHA1(15f0432a8061e886be6171ee90581ad8fe3d44ba) ) // ok
943   ROM_RELOAD(                0x1c00000, 0x200000 )
944   ROM_LOAD32_WORD( "3h.u14", 0x1800002, 0x200000, CRC(042bef5e) SHA1(b57ffa744a17be21681db3d5246025ea27067ae7) ) // ok
945   ROM_RELOAD(                0x1c00002, 0x200000 )
946   ROM_LOAD32_WORD( "4l.u6",  0x2000000, 0x200000, CRC(023b6d70) SHA1(7932d8648d1c2e90539955a6474d9755f02b4350) ) // ok
947   ROM_RELOAD(                0x2400000, 0x200000 )
948   ROM_LOAD32_WORD( "4h.u15", 0x2000002, 0x200000, CRC(9be7e8b1) SHA1(2200bb86b0a7b05a9387da14d8bdc571d0570d11) ) // ok
949   ROM_RELOAD(                0x2400002, 0x200000 )
950   ROM_LOAD32_WORD( "5l.u7",  0x2800000, 0x200000, CRC(7aa54306) SHA1(ec9ecc8dbe81679e0e7544cf5f331ca3eeee700a) ) // ok
951   ROM_RELOAD(                0x2c00000, 0x200000 )
952   ROM_LOAD32_WORD( "5h.u16", 0x2800002, 0x200000, CRC(e6b48e52) SHA1(1deb84fe96fe31ba33ddf833967ef332570b8fe5) ) // ok
953   ROM_RELOAD(                0x2c00002, 0x200000 )
954   ROM_LOAD32_WORD( "6l.u8",  0x3000000, 0x200000, CRC(dfe675e9) SHA1(a4ff934c4b0501be490a2ba3a0ef1d46bc1d68e7) ) // ok
955   ROM_RELOAD(                0x3400000, 0x200000 )
956   ROM_LOAD32_WORD( "6h.u17", 0x3000002, 0x200000, CRC(45919576) SHA1(63c509f8786ebd43ec24664bb2b829f4bf8acf5d) ) // ok
957   ROM_RELOAD(                0x3400002, 0x200000 )
958   ROM_LOAD32_WORD( "7l.u9",  0x3800000, 0x200000, CRC(cd3af598) SHA1(57c8048802264a4699e0e95b8deb25689afff237) ) // ok
959   ROM_RELOAD(                0x3c00000, 0x200000 )
960   ROM_LOAD32_WORD( "7h.u18", 0x3800002, 0x200000, CRC(a3fd4ae5) SHA1(31056e5f645984b85e9bc3767016a856ac0175f9) ) // ok
961   ROM_RELOAD(                0x3c00002, 0x200000 )
880962
881963   ROM_REGION( 0x400000, REGION_SOUND1, ROMREGION_ERASE00 )
882964
883965   ROM_REGION( 0x800000, REGION_SOUND2, 0 )
884   /* not dumped yet */
885    ROM_LOAD( "snd0.u10", 0x000000, 0x400000, NO_DUMP )
886    ROM_LOAD( "snd1.u19", 0x400000, 0x400000, NO_DUMP )
966   ROM_LOAD( "snd0.u10", 0x000000, 0x400000, CRC(5f275f35) SHA1(c5952a16e9f0cee6fc990c234ccaa7ca577741bd) ) // ok
967   ROM_LOAD( "snd1.u19", 0x400000, 0x400000, CRC(98608779) SHA1(a73c21f0f66c2af903e44a0a6a9f821b00615e7b) ) // ok (but fails rom test due to bad banking in service mode)
887968ROM_END
888969
889970
r1185r1186
10331114GAME( 1998, hgkairak, 0,        ps4big,    hotgmck,  hotgmck,  ROT0,   "Psikyo", "Taisen Hot Gimmick Kairakuten (Japan)", 0 )
10341115GAME( 1999, hotgmck3, 0,        ps4big,    hotgmck,  hotgmck,  ROT0,   "Psikyo", "Taisen Hot Gimmick 3 Digital Surfing (Japan)", 0 )
10351116GAME( 2000, hotgm4ev, 0,        ps4big,    hotgmck,  hotgmck,  ROT0,   "Psikyo", "Taisen Hot Gimmick 4 Ever (Japan)", 0 )
1036GAME( 2001, hotgmcki, 0,        ps4big,    hotgmck,  hotgmck,  ROT0,   "Psikyo", "Taisen Hot Gimmick Integral (Japan)", GAME_NOT_WORKING )
1117GAME( 2001, hotgmcki, 0,        ps4big,    hotgmck,  hotgmck,  ROT0,   "Psikyo", "Mahjong Hot Gimmick Integral (Japan)", 0 )
10371118GAME( 2000, loderndf, 0,        ps4small,  loderndf, loderndf, ROT0,   "Psikyo", "Lode Runner - The Dig Fight (ver. B)", 0 )
10381119GAME( 2000, loderdfa, loderndf, ps4small,  loderndf, loderdfa, ROT0,   "Psikyo", "Lode Runner - The Dig Fight (ver. A)", 0 )
10391120GAME( 2000, hotdebut, 0,        ps4small,  hotdebut, hotdebut, ROT0,   "Psikyo / Moss", "Quiz de Idol! Hot Debut (Japan)", 0 )
src/mame/drivers/nbmj8991.c
r1185r1186
7878
7979static MACHINE_RESET( nbmj8991 )
8080{
81   if (machine->drv->cpu[1].cpu_type == CPU_Z80)
81   if (machine->drv->cpu[1].type == CPU_Z80)
8282   {
8383      memory_configure_bank(1, 0, 4, memory_region(REGION_CPU2) + 0x8000, 0x8000);
8484      memory_set_bank(1, 0);
src/mame/drivers/f1gp.c
r1185r1186
209209   AM_RANGE(0x1b, 0x1b) AM_WRITE(YM2610_data_port_0_B_w)
210210ADDRESS_MAP_END
211211
212static WRITE16_HANDLER( f1gpb_misc_w )
213{
214   /*
215    static int old=-1;
216    static int old_bank = -1;
217    int new_bank = (data & 0xf0) >> 4; //wrong!
212218
219    if(old_bank != new_bank && new_bank < 5)
220    {
221        // oki banking
222        UINT8 *src = memory_region(REGION_SOUND1) + 0x40000 + 0x10000 * new_bank;
223        UINT8 *dst = memory_region(REGION_SOUND1) + 0x30000;
224        memcpy(dst, src, 0x10000);
213225
226        old_bank = new_bank;
227    }
228
229    //data & 0x80 toggles
230
231    if((data & 0x7f) != old)
232        printf("misc = %X\n",old=data & 0x7f);
233
234    */
235}
236
237static ADDRESS_MAP_START( f1gpb_cpu1_map, ADDRESS_SPACE_PROGRAM, 16 )
238   AM_RANGE(0x000000, 0x03ffff) AM_ROM
239   AM_RANGE(0x100000, 0x2fffff) AM_READ(extrarom_r)
240   AM_RANGE(0xa00000, 0xbfffff) AM_READ(extrarom2_r)
241   AM_RANGE(0x800000, 0x801fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
242   AM_RANGE(0xc00000, 0xc3ffff) AM_READWRITE(f1gp_zoomdata_r, f1gp_zoomdata_w)
243   AM_RANGE(0xd00000, 0xd01fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w) AM_BASE(&f1gp_rozvideoram)
244   AM_RANGE(0xd02000, 0xd03fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w)   /* mirror */
245   AM_RANGE(0xd04000, 0xd05fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w)   /* mirror */
246   AM_RANGE(0xd06000, 0xd07fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w)   /* mirror */
247   AM_RANGE(0xe00000, 0xe03fff) AM_RAM //unused
248   AM_RANGE(0xe04000, 0xe07fff) AM_RAM //unused
249   AM_RANGE(0xf00000, 0xf003ff) AM_RAM //unused
250   AM_RANGE(0xf10000, 0xf103ff) AM_RAM //unused
251   AM_RANGE(0xff8000, 0xffbfff) AM_RAM
252   AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(&sharedram)
253   AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_WRITE(f1gp_fgvideoram_w) AM_BASE(&f1gp_fgvideoram)
254   AM_RANGE(0xffe000, 0xffefff) AM_RAM AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
255   AM_RANGE(0xfff000, 0xfff001) AM_READ(input_port_0_word_r)
256   AM_RANGE(0xfff004, 0xfff005) AM_READ(input_port_1_word_r)
257   AM_RANGE(0xfff006, 0xfff007) AM_READ(input_port_2_word_r)
258   AM_RANGE(0xfff008, 0xfff009) AM_READNOP //?
259   AM_RANGE(0xfff006, 0xfff007) AM_WRITENOP
260   AM_RANGE(0xfff00a, 0xfff00b) AM_RAM AM_BASE(&f1gpb_fgregs)
261   AM_RANGE(0xfff00e, 0xfff00f) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w)
262   AM_RANGE(0xfff00c, 0xfff00d) AM_WRITE(f1gpb_misc_w)
263   AM_RANGE(0xfff010, 0xfff011) AM_WRITENOP
264   AM_RANGE(0xfff020, 0xfff023) AM_RAM //?
265   AM_RANGE(0xfff050, 0xfff051) AM_READ(input_port_3_word_r)
266   AM_RANGE(0xfff800, 0xfff809) AM_RAM AM_BASE(&f1gpb_rozregs)
267ADDRESS_MAP_END
268
269static ADDRESS_MAP_START( f1gpb_cpu2_map, ADDRESS_SPACE_PROGRAM, 16 )
270   AM_RANGE(0x000000, 0x01ffff) AM_ROM
271   AM_RANGE(0xff8000, 0xffbfff) AM_RAM
272   AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w)
273   AM_RANGE(0xfff030, 0xfff031) AM_NOP //?
274ADDRESS_MAP_END
275
214276INPUT_PORTS_START( f1gp )
215277   PORT_START
216278   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
r1185r1186
524586MACHINE_DRIVER_END
525587
526588
527static MACHINE_DRIVER_START( sf1gp )
589static MACHINE_DRIVER_START( f1gpb )
528590
529591   /* basic machine hardware */
530592   MDRV_CPU_ADD_TAG("main",M68000,10000000)   /* 10 MHz ??? */
531   MDRV_CPU_PROGRAM_MAP(f1gp_readmem1,f1gp_writemem1)
593   MDRV_CPU_PROGRAM_MAP(f1gpb_cpu1_map,0)
532594   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
533595
534596   MDRV_CPU_ADD(M68000,10000000)   /* 10 MHz ??? */
535   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
597   MDRV_CPU_PROGRAM_MAP(f1gpb_cpu2_map,0)
536598   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
537599
538600   /* NO sound CPU */
r1185r1186
548610   MDRV_GFXDECODE(f1gp)
549611   MDRV_PALETTE_LENGTH(2048)
550612
551   MDRV_VIDEO_START(f1gp)
552   MDRV_VIDEO_UPDATE(f1gp)
613   MDRV_VIDEO_START(f1gpb)
614   MDRV_VIDEO_UPDATE(f1gpb)
553615
554616   /* sound hardware */
555617   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
r1185r1186
630692   the video hardware is different, it lacks the sound z80, and has less samples
631693 */
632694
633ROM_START( sf1gp )
695ROM_START( f1gpb )
634696   ROM_REGION( 0x40000, REGION_CPU1, 0 )   /* 68000 code */
635697   /* these have extra data at 0x30000 which isn't preset in the f1gp set, is it related to the changed sound hardware? */
636698   ROM_LOAD16_BYTE( "1.ic38",     0x000001, 0x20000, CRC(046dd83a) SHA1(ea65fa88f9d9a79664de666e63594a7a7de86650) )
r1185r1186
681743   ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_ERASE00 )   /* gfx data for the 053936 */
682744   /* RAM, not ROM - handled at run time */
683745
684   ROM_REGION( 0x100000, REGION_SOUND1, 0 ) /* sound samples */
685   ROM_LOAD( "6.ic13",   0x000000, 0x080000, CRC(6e83ffd8) SHA1(618fd6cd6c0844a4be96f77ff22cd41364718d16) )
746   ROM_REGION( 0x90000, REGION_SOUND1, 0 ) /* sound samples */
747   ROM_LOAD( "6.ic13",   0x000000, 0x030000, CRC(6e83ffd8) SHA1(618fd6cd6c0844a4be96f77ff22cd41364718d16) )
748   ROM_CONTINUE(         0x040000, 0x050000 )
686749ROM_END
687750
688751
r1185r1186
721784   ROM_LOAD( "rom3",         0x000000, 0x100000, CRC(7f8f066f) SHA1(5e051d5feb327ac818e9c7f7ac721dada3a102b6) )
722785ROM_END
723786
724DRIVER_INIT( sf1gp )
725{
726   // no sound z80 to send sound commands to.
727   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xfff008, 0xfff009, 0, 0, MWA16_NOP);
728}
729787
730
731788GAME( 1991, f1gp,  0,    f1gp,  f1gp,  0, ROT90, "Video System Co.", "F-1 Grand Prix",         GAME_NO_COCKTAIL )
732GAME( 1991, sf1gp, f1gp, sf1gp, f1gp,  sf1gp, ROT90, "[Video System Co.] (Playmark bootleg)", "Super Formula II (bootleg of F-1 Grand Prix)", GAME_NOT_WORKING ) // PCB marked 'Super Formula II', manufactured by Playmark.
789GAME( 1991, f1gpb, f1gp, f1gpb, f1gp,  0, ROT90, "[Video System Co.] (Playmark bootleg)", "F-1 Grand Prix (Playmark bootleg)", GAME_NOT_WORKING ) // PCB marked 'Super Formula II', manufactured by Playmark.
733790
734791GAME( 1992, f1gp2, 0,    f1gp2, f1gp2, 0, ROT90, "Video System Co.", "F-1 Grand Prix Part II", GAME_NO_COCKTAIL )
src/mame/drivers/harddriv.c
r1185r1186
34253425   memory_install_write16_handler(hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x823800, 0x823fff, 0, 0, hd68k_ds3_control_w);
34263426
34273427   /* if we have a sound DSP, boot it */
3428   if (hdcpu_sound != -1 && machine->drv->cpu[hdcpu_sound].cpu_type == CPU_ADSP2105)
3428   if (hdcpu_sound != -1 && machine->drv->cpu[hdcpu_sound].type == CPU_ADSP2105)
34293429      adsp2105_load_boot_data((UINT8 *)(memory_region(REGION_CPU1 + hdcpu_sound) + 0x10000),
34303430                        (UINT32 *)(memory_region(REGION_CPU1 + hdcpu_sound)));
3431   if (hdcpu_sounddsp != -1 && machine->drv->cpu[hdcpu_sounddsp].cpu_type == CPU_ADSP2105)
3431   if (hdcpu_sounddsp != -1 && machine->drv->cpu[hdcpu_sounddsp].type == CPU_ADSP2105)
34323432      adsp2105_load_boot_data((UINT8 *)(memory_region(REGION_CPU1 + hdcpu_sounddsp) + 0x10000),
34333433                        (UINT32 *)(memory_region(REGION_CPU1 + hdcpu_sounddsp)));
34343434
src/mame/drivers/dominob.c
r1185r1186
33
44 Driver by Tomasz Slanina
55 some bits by David Haywood
6 Fixed Dip Switches and additional infos by Stephh
67
7 based on the Arkanoid driver
8 Based on the Arkanoid driver
89
910 This is a hacked up version of Arkanoid with high colour backgrounds
1011 and gameplay modifications.  It runs on custom Korean hardware.
1112
1213 Button 1 = 'use Domino' - The ball will bounce along the bricks in a
13                           horizontal line, without coming down
14                           horizontal line without coming down
15                           until a "hole" or a grey or gold brick
1416
15 Button 2 = 'use Rocked' - Your paddle will jump to the top of the screen
16                           then back down, destroying everything in its
17                           path
17 Button 2 = 'use Rocket' - Your paddle will jump to the top of the screen
18                           then back down, destroying everything in its path
1819
20 Bonus Lives always at 200000, 500000, then every 300000 (no Dip Switch)
21
22 There are 6 stages of 5 rounds. When these 30 levels are completed,
23 you'll have to complete round 1 of each stage with a smaller bat.
24 When this stage 7 is completed, the game ends but you can't enter
25 your initials if you have achieved a high score !
26
27 It's funny to see that this game, as 'arkanoid', does NOT allow you
28 to enter "SEX" as initials (which will be replaced by "H !") ;)
29
1930***************************************************************************/
2031
2132#include "driver.h"
r1185r1186
8192          }
8293   }
8394
84
85
8695   {
8796      int x,y;
8897      for(y=0;y<32;y++)
r1185r1186
98107                  TRANSPARENCY_PEN,0);
99108          }
100109   }
110
101111   draw_sprites(machine, bitmap, cliprect);
102112
103113   return 0;
104114}
105115
106116
107/* Input Ports */
108INPUT_PORTS_START( dominob )
109   PORT_START_TAG("IN0")
110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
111   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) // works, but still gives 1 player game
112   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) // only service coin (from arkanoid) works, is it coin1 on this?
113   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
114   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
115   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
116   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_SPECIAL )
117   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )
118
119   PORT_START_TAG("IN1")
120   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
121   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
122   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
123   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN )
124
125   PORT_START_TAG("IN2")      /* Spinner Player 1 */
126   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15)
127
128   PORT_START_TAG("IN3")      /* Spinner Player 2  */ /* no player 2? */
129   //PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_COCKTAIL
130
131   PORT_START_TAG("DSW")
132   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
133   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
134   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
135   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
136   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
137   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
138   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
139   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
140   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
141   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
142   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
143   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
144   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
145   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
146   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
147   PORT_DIPNAME( 0x0060, 0x0040, DEF_STR( Lives ) )
148   PORT_DIPSETTING(      0x0060, "1" )
149   PORT_DIPSETTING(      0x0040, "3" )
150   PORT_DIPSETTING(      0x0020, "5" )
151   PORT_DIPSETTING(      0x0000, "7" )
152   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
153   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
154   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
155INPUT_PORTS_END
156
157
158117//UINT8 dominob_paddle_select;
159//UINT8 arkanoid_paddle_value;
118//UINT8 dominob_paddle_value;
160119
161120WRITE8_HANDLER( dominob_d008_w )
162121{
163   /* is there a purpose on this? */
122   /* is there a purpose on this ? always set to 0x00 (read from 0xc47b in RAM) */
164123}
165124
166125READ8_HANDLER( dominob_input_2_r )
r1185r1186
189148   AM_RANGE(0xfc00, 0xffff) AM_RAM
190149ADDRESS_MAP_END
191150
192/* I don't know if this has a purpose */
151/* I don't know if this has a purpose - also read in 'arkatayt' but not handled */
193152READ8_HANDLER( dominob_unk_port02_r )
194153{
195154   return 0xff;//mame_rand(Machine);
r1185r1186
201160ADDRESS_MAP_END
202161
203162
163INPUT_PORTS_START( dominob )
164   PORT_START_TAG("IN0")
165   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
166   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )             /* works (subs 2 credits), but starts a 1 player game as START1 */
167   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )              /* SERVICE1 in 'arkanoid' */
168   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )            /* TILT in 'arkanoid' */
169   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )           /* COIN1 in 'arkanoid' */
170   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )           /* COIN2 in 'arkanoid' */
171   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_SPECIAL )
172   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )
204173
174   PORT_START_TAG("IN1")
175   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )            /* also works in "demo mode" ! */
176   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )            /* also works in "demo mode" ! */
177   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )            /* player 2 BUTTON1 in 'arkanoid' - only read to select the girl */
178   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN )
179
180   PORT_START_TAG("IN2")      /* Spinner Player 1 */
181   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15)
182
183   PORT_START_TAG("IN3")      /* Spinner Player 2 */ /* No Player 2 */
184//  PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_COCKTAIL
185
186   PORT_START_TAG("DSW")
187   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
188   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
189   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
190   PORT_DIPNAME( 0x06, 0x06, "Difficulty 1" )              /* code at 0x1a82 - table at 0x1aa4 (4 * 8 bytes) */
191   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )             /* starting speed = 0x02/0x03/0x03/0x03/0x03 - max speed = 0x09 */
192   PORT_DIPSETTING(    0x04, DEF_STR( Medium ) )           /* starting speed = 0x03/0x04/0x04/0x04/0x04 - max speed = 0x09 */
193   PORT_DIPSETTING(    0x02, DEF_STR( Hard ) )             /* starting speed = 0x03/0x04/0x05/0x05/0x05 - max speed = 0x0b */
194   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )          /* starting speed = 0x04/0x05/0x06/0x06/0x06 - max speed = 0x0b */
195   PORT_DIPNAME( 0x18, 0x18, "Difficulty 2" )              /* code at 0x03b5 - table at 0x040c (4 * 16 bytes) */
196   PORT_DIPSETTING(    0x18, DEF_STR( Easy ) )             /* increase speed when 0x30/0x30/0x30/0x40/0x40/0x50/0x50/0x50/0x50/0x80 - when max speed, speed = 0x06 */
197   PORT_DIPSETTING(    0x10, DEF_STR( Medium ) )           /* increase speed when 0x30/0x30/0x30/0x30/0x40/0x40/0x40/0x40/0x40/0x90 - when max speed, speed = 0x07 */
198   PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )             /* increase speed when 0x30/0x30/0x20/0x20/0x30/0x30/0x30/0x40/0x40/0xa0 - when max speed, speed = 0x08 */
199   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )          /* increase speed when 0x20/0x20/0x20/0x20/0x20/0x30/0x30/0x30/0x40/0xc0 - when max speed, speed = 0x09 */
200   PORT_DIPNAME( 0x60, 0x40, DEF_STR( Lives ) )
201   PORT_DIPSETTING(    0x60, "1" )
202   PORT_DIPSETTING(    0x40, "3" )
203   PORT_DIPSETTING(    0x20, "5" )
204   PORT_DIPSETTING(    0x00, "7" )
205   PORT_DIPNAME( 0x80, 0x80, "Striptease" )
206   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
207   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
208INPUT_PORTS_END
209
210
205211static const gfx_layout charlayout =
206212{
207213   8,8,
src/mame/drivers/mcr68.c
r1185r1186
13211321   mcr68_common_init(MCR_CHIP_SQUEAK_DELUXE, 0, 0);
13221322
13231323   /* Zwackery doesn't care too much about this value; currently taken from Blasted */
1324   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * (256 + 16));
1324   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * (256 + 16));
13251325}
13261326
13271327
r1185r1186
13301330   mcr68_common_init(MCR_SOUNDS_GOOD, 0, 0);
13311331
13321332   /* Xenophobe doesn't care too much about this value; currently taken from Blasted */
1333   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * (256 + 16));
1333   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * (256 + 16));
13341334
13351335   /* install control port handler */
13361336   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, xenophobe_control_w);
r1185r1186
13421342   mcr68_common_init(MCR_TURBO_CHIP_SQUEAK | MCR_SOUNDS_GOOD, 0, -6);
13431343
13441344   /* Spy Hunter 2 doesn't care too much about this value; currently taken from Blasted */
1345   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * (256 + 16));
1345   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * (256 + 16));
13461346
13471347   /* analog port handling is a bit tricky */
13481348   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, spyhunt2_control_w);
r1185r1186
13581358   /* Blasted checks the timing of VBLANK relative to the 493 interrupt */
13591359   /* VBLANK is required to come within 220-256 E clocks (i.e., 2200-2560 CPU clocks) */
13601360   /* after the 493; we also allow 16 E clocks for latency  */
1361   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * (256 + 16));
1361   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * (256 + 16));
13621362
13631363   /* handle control writes */
13641364   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, blasted_control_w);
r1185r1186
13741374   mcr68_common_init(MCR_WILLIAMS_SOUND, 16, 0);
13751375
13761376   /* Arch Rivals doesn't care too much about this value; currently taken from Blasted */
1377   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * (256 + 16));
1377   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * (256 + 16));
13781378
13791379   /* handle control writes */
13801380   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, archrivl_control_w);
r1185r1186
13931393   mcr68_common_init(MCR_WILLIAMS_SOUND, 16, 0);
13941394
13951395   /* Pigskin doesn't care too much about this value; currently taken from Tri-Sports */
1396   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * 115);
1396   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * 115);
13971397
13981398   state_save_register_global_array(protection_data);
13991399}
r1185r1186
14061406   /* Tri-Sports checks the timing of VBLANK relative to the 493 interrupt */
14071407   /* VBLANK is required to come within 87-119 E clocks (i.e., 870-1190 CPU clocks) */
14081408   /* after the 493 */
1409   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].cpu_clock / 10) * 115);
1409   mcr68_timing_factor = make_mame_time(0, MAX_SUBSECONDS / (machine->drv->cpu[0].clock / 10) * 115);
14101410}
14111411
14121412
src/mame/drivers/cojag.c
r1185r1186
14231423static void cojag_common_init(running_machine *machine, UINT16 gpu_jump_offs, UINT16 spin_pc)
14241424{
14251425   /* copy over the ROM */
1426   cojag_is_r3000 = (machine->drv->cpu[0].cpu_type == CPU_R3000BE);
1426   cojag_is_r3000 = (machine->drv->cpu[0].type == CPU_R3000BE);
14271427
14281428   /* install synchronization hooks for GPU */
14291429   if (cojag_is_r3000)
src/mame/drivers/dlair.c
r1185r1186
281281static MACHINE_START( dleuro )
282282{
283283   /* initialize the CTC and SIO peripherals */
284   ctc_intf.baseclock = machine->drv->cpu[0].cpu_clock;
285   sio_intf.baseclock = machine->drv->cpu[0].cpu_clock;
284   ctc_intf.baseclock = machine->drv->cpu[0].clock;
285   sio_intf.baseclock = machine->drv->cpu[0].clock;
286286   z80ctc_init(0, &ctc_intf);
287287   z80sio_init(0, &sio_intf);
288288
src/mame/drivers/peplus.c
r1185r1186
1313
1414    Hardware:
1515
16    CPU =  83c02             ; I8052 compatible
17    VIDEO = SY6545           ; CRTC6845 compatible
16    CPU =  INTEL 83c02       ; I8052 compatible
17    VIDEO = ROCKWELL 6545    ; CRTC6845 compatible
1818    SND =  AY-3-8912         ; AY8910 compatible
1919
2020    History:
r1185r1186
4141#include "sound/ay8910.h"
4242#include "cpu/i8051/i8051.h"
4343
44#include "peplus.lh"
45#include "pepp0188.lh"
46#include "peset038.lh"
47
4448static tilemap *bg_tilemap;
4549
4650/* Pointers to External RAM */
4751UINT8 *program_ram;
48UINT8 *settings_ram;
49UINT8 *set038_ram;
52UINT8 *cmos_ram;
5053
5154/* Variables used instead of CRTC6845 system */
5255UINT8 vid_register = 0;
r1185r1186
5659/* Holds upper video address and palette number */
5760UINT8 *palette_ram;
5861
59UINT8 ramcheck;
62/* IO Ports */
63UINT8 *io_port;
64
65
6066/*****************
6167* Write Handlers *
6268******************/
r1185r1186
9298}
9399
94100/*
95    SY6545 - Transparent Memory Addressing
101    ROCKWELL 6545 - Transparent Memory Addressing
96102    The current CRTC6845 driver does not support these
97103    additional registers (R18, R19, R31)
98104*/
105WRITE8_HANDLER( peplus_crtc_mode_w )
106{
107    /* Mode Control - Register 8 */
108    /* Sets CRT to Transparent Memory Addressing Mode */
109}
110
99111WRITE8_HANDLER( peplus_crtc_register_w )
100112{
101113    switch(data) {
r1185r1186
123135{
124136    UINT16 vid_address = (vid_high<<8) | vid_low;
125137
126    /* P1 holds the following: */
127    /* high nibble = palette, low nibble = high address */
128    UINT8 p1 = i8051_get_intram(P1);
129
130138    videoram[vid_address] = data;
131   palette_ram[vid_address] = p1;
139   palette_ram[vid_address] = io_port[1];
132140
133141    tilemap_mark_tile_dirty(bg_tilemap, vid_address);
134142
r1185r1186
144152    // EEPROM is a X2404P 4K-bit Serial I2C Bus
145153}
146154
147WRITE8_HANDLER( peplus_ramcheck_w )
155WRITE8_HANDLER( peplus_io_w )
148156{
149    ramcheck = data;
157    io_port[offset] = data;
150158}
151159
160WRITE8_HANDLER( peplus_duart_w )
161{
162    // Used for Progressive Jackpot Communication
163}
152164
165WRITE8_HANDLER( peplus_cmos_w )
166{
167    cmos_ram[offset] = data;
168}
169
170WRITE8_HANDLER( peplus_output_bank_a_w )
171{
172    output_set_value("coinlockout",(data >> 0) & 1); /* Coin Lockout */
173    output_set_value("diverter",(data >> 1) & 1); /* Diverter */
174    output_set_value("bell",(data >> 2) & 1); /* Bell */
175    output_set_value("na1",(data >> 3) & 1); /* N/A */
176    output_set_value("hopper1",(data >> 4) & 1); /* Hopper 1 */
177    output_set_value("hopper2",(data >> 5) & 1); /* Hopper 2 */
178    output_set_value("na2",(data >> 6) & 1); /* N/A */
179    output_set_value("na3",(data >> 7) & 1); /* N/A */
180}
181
182WRITE8_HANDLER( peplus_output_bank_b_w )
183{
184    output_set_lamp_value(0,(data >> 0) & 1); /* Hold 2 3 4 Lt */
185    output_set_lamp_value(1,(data >> 1) & 1); /* Deal Draw Lt */
186    output_set_lamp_value(2,(data >> 2) & 1); /* Cash Out Lt */
187    output_set_lamp_value(3,(data >> 3) & 1); /* Hold 1 Lt */
188    output_set_lamp_value(4,(data >> 4) & 1); /* Bet Credits Lt */
189    output_set_lamp_value(5,(data >> 5) & 1); /* Change Request Lt */
190    output_set_lamp_value(6,(data >> 6) & 1); /* Door Open Lt */
191    output_set_lamp_value(7,(data >> 7) & 1); /* Hold 5 Lt */
192}
193
194WRITE8_HANDLER( peplus_output_bank_c_w )
195{
196    output_set_value("coininmeter",(data >> 0) & 1); /* Coin In Meter */
197    output_set_value("coinoutmeter",(data >> 1) & 1); /* Coin Out Meter */
198    output_set_value("coindropmeter",(data >> 2) & 1); /* Coin Drop Meter */
199    output_set_value("jackpotmeter",(data >> 3) & 1); /* Jackpot Meter */
200    output_set_value("billacceptor",(data >> 4) & 1); /* Bill Acceptor Enabled */
201    output_set_value("sdsout",(data >> 5) & 1); /* SDS Out */
202    output_set_value("na4",(data >> 6) & 1); /* N/A */
203    output_set_value("gamemeter",(data >> 7) & 1); /* Game Meter */
204}
205
206
153207/****************
154208* Read Handlers *
155209****************/
156210
211READ8_HANDLER( peplus_duart_r )
212{
213    // Used for Progressive Jackpot Communication
214    return 0x00;
215}
216
217READ8_HANDLER( peplus_cmos_r )
218{
219    switch (offset)
220    {
221        case 0x0db:
222            if ((readinputportbytag("DOOR") & 0x01) == 1) {
223                cmos_ram[offset] = 0x01;
224            }
225        case 0xb8d:
226            if ((readinputportbytag("DOOR") & 0x02) == 1)
227                cmos_ram[offset] = 0x01;
228    }
229
230    // Fake A Bunch of Coins In Hack
231    if ((readinputportbytag("SENSOR") & 0x01) == 1) {
232        cmos_ram[0x01E] = 0x01;
233    }
234
235    return cmos_ram[offset];
236}
237
157238/* External RAM Callback for I8052 */
158239READ32_HANDLER( peplus_external_ram_iaddr )
159240{
160    UINT8 p2 = i8051_get_intram(P2);
161
162    if (offset < 0x1000) {
163        return (p2 << 8) | offset;
241    if (mem_mask == 0xff) {
242        return (io_port[2] << 8) | offset;
164243    } else {
165244        return offset;
166245    }
r1185r1186
172251    return palette_get_color(Machine, 15); /* Return bgcolor from First Palette */
173252}
174253
254READ8_HANDLER( peplus_dropdoor_r )
255{
256    return 0x00; /* Drop Door 0x00=Closed 0x02=Open */
257}
175258
259READ8_HANDLER( peplus_c000_r )
260{
261    return 0xff; /* Unknown */
262}
263
176264/* Insufficient Code, will need more to handle cmos and coin pulses */
177265READ8_HANDLER( peplus_input_bank_a_r )
178266{
r1185r1186
186274        Bit 6 = LOW BATTERY
187275        Bit 7 = CMOS ACK (0=ACK)
188276    */
189    return 0x77;
190}
277    UINT8 tempbank = 0x00;
278    UINT8 coindetect = 0x00;
279    if ((readinputportbytag("SENSOR") & 0x01) == 0x01) {
280        coindetect = 0x07;
281    }
191282
192READ8_HANDLER( peplus_ramcheck_r )
193{
194    if (ramcheck == 0x3e)
195        return 0xff;
196    else
197        return ramcheck;
283    tempbank = (0x57 | (!(readinputportbytag("DOOR") & 0x01)<<5)) ^ (coindetect);
284    return tempbank;
198285}
199286
200287
201/*************************
202* Temporary Memory Hacks *
203*************************/
204
205/* Hack to test coins in */
206READ8_HANDLER( peplus_coinsin_r )
207{
208    return 0x05;
209}
210
211/* Hack to test credits */
212READ8_HANDLER( peplus_credits_r )
213{
214    return 0x20;
215}
216
217288/****************************
218289* Video/Character functions *
219290****************************/
r1185r1186
258329      int bit0, bit1, bit2, r, g, b;
259330
260331      /* red component */
261      bit0 = (color_prom[i] >> 0) & 0x01;
262      bit1 = (color_prom[i] >> 1) & 0x01;
263      bit2 = (color_prom[i] >> 2) & 0x01;
332      bit0 = (~color_prom[i] >> 0) & 0x01;
333      bit1 = (~color_prom[i] >> 1) & 0x01;
334      bit2 = (~color_prom[i] >> 2) & 0x01;
264335       r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
265336
266337      /* green component */
267      bit0 = (color_prom[i] >> 3) & 0x01;
268      bit1 = (color_prom[i] >> 4) & 0x01;
269      bit2 = (color_prom[i] >> 5) & 0x01;
338      bit0 = (~color_prom[i] >> 3) & 0x01;
339      bit1 = (~color_prom[i] >> 4) & 0x01;
340      bit2 = (~color_prom[i] >> 5) & 0x01;
270341      g = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
271342
272343      /* blue component */
273      bit0 = (color_prom[i] >> 6) & 0x01;
274      bit1 = (color_prom[i] >> 7) & 0x01;
344      bit0 = (~color_prom[i] >> 6) & 0x01;
345      bit1 = (~color_prom[i] >> 7) & 0x01;
275346        bit2 = 0;
276347      b = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
277348
278        /* TODO */
279        /* Add code to load last color in each palette with bgcolor */
280        /* Using default in color prom instead for now */
281
282349      palette_set_color(machine, i, MAKE_RGB(r, g, b));
283350   }
284351}
r1185r1186
309376GFXDECODE_END
310377
311378
312/***********************
313*    Sound Interface   *
314***********************/
315
316static struct AY8910interface ay8910_interface =
317{
318   input_port_3_r  /* SW1 is accessed via sound portA */
319};
320
321
322379/**************
323380* Driver Init *
324381***************/
r1185r1186
328385    /* External RAM callback */
329386    i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
330387
331    // Set038 Chip - For testing only, cannot stay in final driver
332    //program_ram[0x302] = 0x22;  /* disable memory test */
333    //program_ram[0x289f] = 0x22; /* disable program checksum */
334    //set038_ram[0x00] = 0xfe;
388    // For testing only, cannot stay in final driver
389    program_ram[0x990e] = 0xd3; /* SETB C - disable game test */
390    program_ram[0x990f] = 0x22; /* RET - disable game test */
335391
336    // PP0516 - For testing only, cannot stay in final driver
337    program_ram[0x9a24] = 0x22; /* disable memory test */
338    program_ram[0xd61d] = 0x22; /* disable program checksum */
392    program_ram[0xaf91] = 0x79; /* MOV R1, - disable I2C random read */
393    program_ram[0xaf92] = 0x00; /* #000H - disable I2C random read */
394    program_ram[0xaf93] = 0x22; /* RET - disable I2C random read */
339395
340    /* TODO: Machine settings and coin counts need to be loaded using save state system */
396    program_ram[0xd61d] = 0x22; /* RET - disable program checksum */
397
398    program_ram[0x5e7e] = 0x01; /* Allow Autohold Feature */
399
400    /* TODO: Machine settings and coin counts need to be loaded using eeprom data */
341401    /* below are some hardcoded examples of memory to patch */
342402
343    settings_ram[0x030] = 0x05; /* Maximum Coins - 5 */
344    settings_ram[0x06b] = 0x03; /* Current Denomination - 25c */
345    set038_ram[0x2a] = settings_ram[0x06b];
346    settings_ram[0x197] = 0x00; /* Bill Acceptor - Disabled */
347    set038_ram[0x2b] = settings_ram[0x197];
403    cmos_ram[0x129] = 0x08; /* Additional Operator Screens Enabled */
404    cmos_ram[0x130] = 0x05; /* Maximum Coins In */
405    cmos_ram[0x148] = 0xff; /* Maximum Payout Low Byte */
406    cmos_ram[0x149] = 0xff; /* Maximum Payout High Byte */
407    cmos_ram[0x14a] = 0xff; /* Maximum Cashout Low Byte */
408    cmos_ram[0x14b] = 0xff; /* Maximum Cashout High Byte */
409    cmos_ram[0x16b] = 0x03; /* Current Denomination = 25c */
410    cmos_ram[0x16e] = 0x40; /* Background Color */
411    cmos_ram[0x183] = 0x01; /* 0=Tones, 1=Music */
412    cmos_ram[0x188] = 0x7d; /* Game Type */
413    cmos_ram[0x248] = 0x01; /* SAS Mini System Address */
414    cmos_ram[0x284] = 0x55; /* 0=Disabled, 0x55=Drop Door */
415    cmos_ram[0x297] = 0x00; /* 0=Disabled, 0xa5=Bill Acceptor */
416    cmos_ram[0xb8f] = 0x01; /* 0=No Double Up, 1=Double Up */
417    cmos_ram[0xb90] = 0x01; /* 0=No Animation, 1=Animation */
418    cmos_ram[0xb91] = 0x00; /* 0=No Paytable, 1=Paytable */
419    cmos_ram[0xb93] = 0x01; /* 0=Disabled, 1=Autohold */
420    cmos_ram[0xb94] = 0x04; /* 0-9=Deal Speed */
421    cmos_ram[0xbd8] = 0xaa; /* Communication Type 0xaa=None, 0x5a=sas, 0xa5=miser */
422
423    /* Mirrored in cmos scratch area to eeprom */
424    cmos_ram[0xe01] = cmos_ram[0x188]; /* Game Type */
425    cmos_ram[0xe2a] = cmos_ram[0x16b]; /* Current Denomination */
426    cmos_ram[0xe2b] = cmos_ram[0x297]; /* Bill Acceptor */
427    cmos_ram[0xe60] = cmos_ram[0x130]; /* Maximum Coins In */
428    cmos_ram[0xe64] = cmos_ram[0x16e]; /* Background Color */
348429}
349430
431static DRIVER_INIT( pepp0188 )
432{
433    /* External RAM callback */
434    i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
435
436    // For testing only, cannot stay in final driver
437    program_ram[0x994b] = 0xd3; /* SETB C - disable game test */
438    program_ram[0x994c] = 0x22; /* RET - disable game test */
439
440    program_ram[0x9b3e] = 0x79; /* MOV R1, - disable I2C random read */
441    program_ram[0x9b3f] = 0x00; /* #000H - disable I2C random read */
442    program_ram[0x9b40] = 0x22; /* RET - disable I2C random read */
443
444    program_ram[0xf429] = 0x22; /* RET - disable program checksum */
445
446    program_ram[0x742f] = 0x01; /* Allow Autohold Feature */
447
448    /* TODO: Machine settings and coin counts need to be loaded using eeprom data */
449    /* below are some hardcoded examples of memory to patch */
450
451    cmos_ram[0x12d] = 0x08; /* Additional Operator Screens Enabled */
452    cmos_ram[0x134] = 0x05; /* Maximum Coins In */
453    cmos_ram[0x14c] = 0xff; /* Maximum Payout Low Byte */
454    cmos_ram[0x14d] = 0xff; /* Maximum Payout High Byte */
455    cmos_ram[0x14e] = 0xff; /* Maximum Cashout Low Byte */
456    cmos_ram[0x14f] = 0xff; /* Maximum Cashout High Byte */
457    cmos_ram[0x16f] = 0x03; /* Current Denomination = 25c */
458    cmos_ram[0x172] = 0x40; /* Background Color */
459    cmos_ram[0x187] = 0x01; /* 0=Tones, 1=Music */
460    cmos_ram[0x18c] = 0x85; /* Game Type */
461    cmos_ram[0x22e] = 0x01; /* SAS Mini System Address */
462    cmos_ram[0xb3a] = 0x55; /* 0=Disabled, 0x55=Drop Door */
463    cmos_ram[0x289] = 0x00; /* 0=Disabled, 0xa5=Bill Acceptor */
464    cmos_ram[0xaf6] = 0x01; /* 0=No Double Up, 1=Double Up */
465    cmos_ram[0xaf7] = 0x01; /* 0=No Animation, 1=Animation */
466    cmos_ram[0xaf8] = 0x00; /* 0=No Paytable, 1=Paytable */
467    cmos_ram[0xafa] = 0x01; /* 0=Disabled, 1=Autohold */
468    cmos_ram[0xafb] = 0x04; /* 0-9=Deal Speed */
469    cmos_ram[0xb51] = 0xaa; /* Communication Type 0xaa=None, 0x5a=sas, 0xa5=miser */
470    cmos_ram[0xbf5] = cmos_ram[0x134]; /* Maximum Coins In */
471
472    /* Mirrored in cmos scratch area to eeprom */
473    cmos_ram[0xe01] = cmos_ram[0x18c]; /* Game Type */
474    cmos_ram[0xe2a] = cmos_ram[0x16f]; /* Current Denomination */
475    cmos_ram[0xe2b] = cmos_ram[0x289]; /* Bill Acceptor */
476    cmos_ram[0xe60] = cmos_ram[0x134]; /* Maximum Coins In */
477    cmos_ram[0xe64] = cmos_ram[0x172]; /* Background Color */
478}
479
480static DRIVER_INIT( peset038 )
481{
482    /* External RAM callback */
483    i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
484
485    // For testing only, cannot stay in final driver
486    program_ram[0x302] = 0x22;  /* RET - disable memory test */
487    program_ram[0x3b5] = 0x22;  /* RET - disable I2C random read */
488    program_ram[0x289f] = 0x22; /* RET - disable program checksum */
489
490    cmos_ram[0xe01] = 0x7d; /* Game Type */
491}
492
350493/*************************
351494* Memory map information *
352495*************************/
r1185r1186
356499ADDRESS_MAP_END
357500
358501static ADDRESS_MAP_START( peplus_datamap, ADDRESS_SPACE_DATA, 8 )
502    // Battery-backed RAM
503    AM_RANGE(0x0000, 0x0fff) AM_RAM AM_READWRITE(peplus_cmos_r, peplus_cmos_w) AM_BASE(&cmos_ram)
504
505    // CRT Controller
506    AM_RANGE(0x2008, 0x2008) AM_WRITE(peplus_crtc_mode_w)
359507    AM_RANGE(0x2080, 0x2080) AM_WRITE(peplus_crtc_register_w)
360508    AM_RANGE(0x2081, 0x2081) AM_WRITE(peplus_crtc_address_w)
361509    AM_RANGE(0x2083, 0x2083) AM_WRITE(peplus_crtc_display_w)
362    AM_RANGE(0x20db, 0x20db) AM_READ(input_port_1_r) /* upper door */
363    AM_RANGE(0x2100, 0x21ff) AM_RAM AM_BASE(&settings_ram)
364    AM_RANGE(0x2b8d, 0x2b8d) AM_READ(input_port_2_r) /* lower door */
365    //AM_RANGE(0x2b9b, 0x2b9b) AM_READ(peplus_coinsin_r) /* hack to test coins in */
366    //AM_RANGE(0x2b9d, 0x2b9d) AM_READ(peplus_credits_r) /* hack to test credits */
367    AM_RANGE(0x2e01, 0x2eff) AM_RAM AM_BASE(&set038_ram)
510
511    // Sound and Dipswitches
368512   AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_control_port_0_w)
369   AM_RANGE(0x4004, 0x4004) AM_WRITE(AY8910_write_port_0_w)
370    //AM_RANGE(0x4175, 0x4175) AM_READ(peplus_ramcheck_r) AM_WRITE(peplus_ramcheck_w)
513   AM_RANGE(0x4004, 0x4004) AM_READ(input_port_3_r) AM_WRITE(AY8910_write_port_0_w)
371514
515    // Background Color Latch
372516    AM_RANGE(0x6000, 0x6000) AM_READ(peplus_bgcolor_r) AM_WRITE(peplus_bgcolor_w)
517
518    // Video RAM
373519    AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE(&videoram)
374    AM_RANGE(0x8000, 0x8000) AM_READ(peplus_input_bank_a_r)
375    AM_RANGE(0x9000, 0x9000) AM_WRITE(peplus_eeprom_w)
376    AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
377    AM_RANGE(0x0000, 0xffff) AM_RAM
520
521    // Input Bank A, Output Bank C
522    AM_RANGE(0x8000, 0x8000) AM_READ(peplus_input_bank_a_r) AM_WRITE(peplus_output_bank_c_w)
523
524    // Drop Door, I2C EEPROM Writes
525    AM_RANGE(0x9000, 0x9000) AM_READ(peplus_dropdoor_r) AM_WRITE(peplus_eeprom_w)
526
527    // Input Banks B & C, Output Bank B
528    AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) AM_WRITE(peplus_output_bank_b_w)
529
530    // Output Bank A
531    AM_RANGE(0xc000, 0xc000) AM_READ(peplus_c000_r) AM_WRITE(peplus_output_bank_a_w)
532
533    // DUART
534    AM_RANGE(0xe000, 0xe005) AM_READWRITE(peplus_duart_r, peplus_duart_w)
378535ADDRESS_MAP_END
379536
537static ADDRESS_MAP_START( peplus_iomap, ADDRESS_SPACE_IO, 8 )
538    ADDRESS_MAP_FLAGS(AMEF_ABITS(8))
539
540    // I/O Ports
541   AM_RANGE(0x00, 0x03) AM_WRITE(peplus_io_w) AM_BASE(&io_port)
542ADDRESS_MAP_END
543
380544/*************************
381545*      Input ports       *
382546*************************/
r1185r1186
400564    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
401565    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
402566
403    PORT_START_TAG("IN1")
567    PORT_START_TAG("DOOR")
404568    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
569    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
405570
406    PORT_START_TAG("IN2")
407    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
571    PORT_START_TAG("SENSOR")
572    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M)
408573
409574    PORT_START_TAG("SW1")
410   PORT_DIPNAME( 0x01, 0x01, "0-60HZ, 1-50HZ" )
411   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
575   PORT_DIPNAME( 0x01, 0x01, "Line Frequency" )
576   PORT_DIPSETTING(    0x01, "60HZ" )
577   PORT_DIPSETTING(    0x00, "50HZ" )
578   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
579   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
412580   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
581   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
582   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
583   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
584   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
585   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
586   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
587   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
588   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
589   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
590   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
591   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
592   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
593   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
594   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
595   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
596   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
597   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
598   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
599INPUT_PORTS_END
600
601INPUT_PORTS_START( pepp0188 )
602   PORT_START_TAG("IN0")
603    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
604    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
605    PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
606   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
607    PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
608    PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
609    PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
610    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
611    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
612    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
613   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN )
614    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
615   PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T)
616   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y)
617    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
618    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
619
620    PORT_START_TAG("DOOR")
621    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
622    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
623
624    PORT_START_TAG("SENSOR")
625    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M)
626
627    PORT_START_TAG("SW1")
628   PORT_DIPNAME( 0x01, 0x01, "Line Frequency" )
629   PORT_DIPSETTING(    0x01, "60HZ" )
630   PORT_DIPSETTING(    0x00, "50HZ" )
413631   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
414632   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
415633   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r1185r1186
433651   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
434652INPUT_PORTS_END
435653
654INPUT_PORTS_START( peset038 )
655   PORT_START_TAG("IN0")
656    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
657    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
658    PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
659   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
660    PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
661    PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
662    PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
663    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
664    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
665    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
666   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN )
667    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
668   PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T)
669   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y)
670    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
671    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
436672
673    PORT_START_TAG("DOOR")
674    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
675    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
676
677    PORT_START_TAG("SENSOR")
678    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M)
679
680    PORT_START_TAG("SW1")
681   PORT_DIPNAME( 0x01, 0x01, "Line Frequency" )
682   PORT_DIPSETTING(    0x01, "60HZ" )
683   PORT_DIPSETTING(    0x00, "50HZ" )
684   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
685   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
686   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
687   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
688   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
689   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
690   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
691   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
692   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
693   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
694   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
695   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
696   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
697   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
698   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
699   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
700   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
701   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
702   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
703   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
704   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
705INPUT_PORTS_END
706
707
437708/*************************
438709*     Machine Driver     *
439710*************************/
440711
441712static MACHINE_DRIVER_START( peplus )
442713   // basic machine hardware
443    MDRV_CPU_ADD(I8052, 3686400*2)
714    MDRV_CPU_ADD_TAG("main", I8052, 3686400*2)
444715   MDRV_CPU_PROGRAM_MAP(peplus_map, 0)
445716    MDRV_CPU_DATA_MAP(peplus_datamap, 0)
717    MDRV_CPU_IO_MAP(peplus_iomap, 0)
446718   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
447719
448720   MDRV_SCREEN_REFRESH_RATE(60)
r1185r1186
464736   // sound hardware
465737    MDRV_SOUND_ADD(AY8912, 20000000/12)
466738   MDRV_SPEAKER_STANDARD_MONO("mono")
467    MDRV_SOUND_CONFIG(ay8910_interface)
468739   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
469740MACHINE_DRIVER_END
470741
742static MACHINE_DRIVER_START( pepp0188 )
743   MDRV_IMPORT_FROM(peplus)
744MACHINE_DRIVER_END
471745
746static MACHINE_DRIVER_START( peset038 )
747   MDRV_IMPORT_FROM(peplus)
748MACHINE_DRIVER_END
749
750
472751/*************************
473752*        Rom Load        *
474753*************************/
r1185r1186
484763    ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
485764
486765   ROM_REGION( 0x100, REGION_PROMS, 0 )
487   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(9cd834bd) SHA1(ad66099d8ed8f784fb20b97df7c9dda51b19ff3f) )
766   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
488767ROM_END
489768
769ROM_START( pepp0188 )
770   ROM_REGION( 0x10000, REGION_CPU1, 0 )
771    ROM_LOAD( "pp0188.u68",   0x00000, 0x10000, CRC(cf36a53c) SHA1(99b578538ab24d9ff91971b1f77599272d1dbfc6) )
490772
773   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
774   ROM_LOAD( "mro-cg740.u72",    0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) )
775    ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
776    ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
777    ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
778
779   ROM_REGION( 0x100, REGION_PROMS, 0 )
780   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
781ROM_END
782
783ROM_START( peset038 )
784   ROM_REGION( 0x10000, REGION_CPU1, 0 )
785    ROM_LOAD( "set038.u68",   0x00000, 0x10000, CRC(9c4b1d1a) SHA1(8a65cd1d8e2d74c7b66f4dfc73e7afca8458e979) )
786
787   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
788   ROM_LOAD( "mro-cg740.u72",    0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) )
789    ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
790    ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
791    ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
792
793   ROM_REGION( 0x100, REGION_PROMS, 0 )
794   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
795ROM_END
796
797
491798/*************************
492799*      Game Drivers      *
493800*************************/
494801
495802/*    YEAR  NAME      PARENT  MACHINE   INPUT     INIT      ROT    COMPANY                                  FULLNAME                                             FLAGS   */
496803GAME( 1987, peplus,   0,      peplus,   peplus,   peplus,   ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0516) Double Bonus Poker",    0 )
804GAME( 1987, pepp0188, 0,      pepp0188, pepp0188, pepp0188, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0188) Standard Draw Poker",   0 )
805GAME( 1987, peset038, 0,      peset038, peset038, peset038, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (Set038) Set Chip",              0 )
src/mame/drivers/namcoic.c
r1185r1186
33#include "namcoic.h"
44
55/**************************************************************************************/
6static int mPalXOR;      /* XOR'd with palette select register; needed for System21 */
67
78static struct
89{
r1185r1186
351352                        UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0);
352353                        UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0);
353354                        int x, x_index = x_index_base;
354                        for( x=sx; x<ex; x++ )
355                        if( mPalXOR )
355356                        {
356                           int c = source[x_index>>16];
357                           if( c != transparent_color )
357                           for( x=sx; x<ex; x++ )
358358                           {
359                              if( pri[x]<=zpos )
359                              int c = source[x_index>>16];
360                              if( c != transparent_color )
360361                              {
361                                 if( color == 0xf && c==0xfe && shadow_offset )
362                                 if( pri[x]<=zpos )
362363                                 {
363                                    dest[x] |= shadow_offset;
364                                    switch( c )
365                                    {
366                                    case 0:
367                                       dest[x] = 0x4000|(dest[x]&0x1fff);
368                                       break;
369                                    case 1:
370                                       dest[x] = 0x6000|(dest[x]&0x1fff);
371                                       break;
372                                    default:
373                                       dest[x] = pal[c];
374                                       break;
375                                    }
376                                    pri[x] = zpos;
364377                                 }
365                                 else
378                              }
379                              x_index += dx;
380                           }
381                           y_index += dy;
382                        }
383                        else
384                        {
385                           for( x=sx; x<ex; x++ )
386                           {
387                              int c = source[x_index>>16];
388                              if( c != transparent_color )
389                              {
390                                 if( pri[x]<=zpos )
366391                                 {
367                                    dest[x] = pal[c];
392                                    if( color == 0xf && c==0xfe && shadow_offset )
393                                    {
394                                       dest[x] |= shadow_offset;
395                                    }
396                                    else
397                                    {
398                                       dest[x] = pal[c];
399                                    }
400                                    pri[x] = zpos;
368401                                 }
369                                 pri[x] = zpos;
370402                              }
403                              x_index += dx;
371404                           }
372                           x_index += dx;
405                           y_index += dy;
373406                        }
374                        y_index += dy;
375407                     }
376408                  }
377409               }
r1185r1186
676708
677709static int (*mpCodeToTile)( int code ); /* sprite banking callback */
678710static int mGfxC355;   /* gfx bank for sprites */
679static int mPalXOR;      /* XOR'd with palette select register; needed for System21 */
680711
681712/**
682713 * 0x00000 sprite attr (page0)
r1185r1186
740771   xscroll = (INT16)mSpritePos[1];
741772   yscroll = (INT16)mSpritePos[0];
742773
743   xscroll &= 0x3ff; if( xscroll & 0x200 ) xscroll |= ~0x3ff;
774//  xscroll &= 0x3ff; if( xscroll & 0x200 ) xscroll |= ~0x3ff;
775   xscroll &= 0x1ff; if( xscroll & 0x100 ) xscroll |= ~0x1ff;
744776   yscroll &= 0x1ff; if( yscroll & 0x100 ) yscroll |= ~0x1ff;
745777
746778   if( bitmap->width > 384 )
747779   { /* Medium Resolution: System21 adjust */
780         xscroll = (INT16)mSpritePos[1];
781         xscroll &= 0x3ff; if( xscroll & 0x200 ) xscroll |= ~0x3ff;
748782         if( yscroll<0 )
749783         { /* solvalou */
750784            yscroll += 0x20;
r1185r1186
912946void
913947namco_obj_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
914948{
949//  int offs = spriteram16[0x18000/2]; /* end-of-sprite-list */
915950   if( pri==0 )
916951   {
917952      fillbitmap( priority_bitmap, 0, cliprect );
918953   }
919   DrawObjectList(machine, bitmap,cliprect,pri,&spriteram16[0x02000/2], &spriteram16[0x00000/2] );
920   DrawObjectList(machine, bitmap,cliprect,pri,&spriteram16[0x14000/2], &spriteram16[0x10000/2] );
954//  if( offs==0 )
955   { /* boot */
956      DrawObjectList(machine, bitmap,cliprect,pri,&spriteram16[0x02000/2], &spriteram16[0x00000/2] );
957   }
958//  else
959   {
960      DrawObjectList(machine, bitmap,cliprect,pri,&spriteram16[0x14000/2], &spriteram16[0x10000/2] );
961   }
921962} /* namco_obj_draw */
922963
923964WRITE16_HANDLER( namco_obj16_w )
src/mame/drivers/tubep.c
r1185r1186
104104
105105#include "driver.h"
106106#include "cpu/z80/z80.h"
107#include "cpu/m6805/m6805.h"
107108#include "sound/ay8910.h"
108109#include "sound/msm5205.h"
109
110110#include "tubep.h"
111111
112112/* Global variables */
r1185r1186
116116
117117static mame_timer *interrupt_timer;
118118
119/*************************** Main CPU on main PCB **************************/
120119
120/*************************************
121 *
122 *  Main CPU on main PCB
123 *
124 *************************************/
121125
126
122127static WRITE8_HANDLER( tubep_LS259_w )
123128{
124129   switch(offset)
r1185r1186
186191ADDRESS_MAP_END
187192
188193
194/*************************************
195 *
196 *  Slave CPU on main PCB
197 *
198 *************************************/
189199
190200
191/************************** Slave CPU on main PCB ****************************/
192
193201static ADDRESS_MAP_START( tubep_g_map, ADDRESS_SPACE_PROGRAM, 8 )
194202   AM_RANGE(0x0000, 0x7fff) AM_ROM
195203   AM_RANGE(0xa000, 0xa000) AM_WRITE(tubep_background_a000_w)
r1185r1186
243251   AM_RANGE(0x07, 0x07) AM_WRITE(tubep_sound_unknown)
244252ADDRESS_MAP_END
245253
254
255/*************************************
256 *
257 *  Save state setup
258 *
259 *************************************/
260
261
246262static TIMER_CALLBACK( scanline_callback )
247263{
248264   int scanline = param;
r1185r1186
281297   mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64, time_zero);
282298}
283299
284
285300static MACHINE_START( rjammer )
286301{
287302   tubep_setup_save_state();
288303}
289304
290/****************************************************************/
305static MACHINE_RESET( rjammer )
306{}
291307
308
309/*************************************
310 *
311 *  Roller Jammer memory handlers
312 *
313 *************************************/
314
315
292316static WRITE8_HANDLER( rjammer_LS259_w )
293317{
294318   switch(offset)
r1185r1186
334358ADDRESS_MAP_END
335359
336360
337
338361static ADDRESS_MAP_START( rjammer_slave_portmap, ADDRESS_SPACE_IO, 8 )
339362   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
340363   AM_RANGE(0xb0, 0xb0) AM_WRITE(rjammer_background_page_w)
341364   AM_RANGE(0xd0, 0xd0) AM_WRITE(rjammer_background_LS377_w)
342365ADDRESS_MAP_END
343366
367
344368static ADDRESS_MAP_START( rjammer_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
345369   AM_RANGE(0x0000, 0x7fff) AM_ROM
346370   AM_RANGE(0xa000, 0xa7ff) AM_RAM                     /* M5M5117P @21G */
r1185r1186
350374ADDRESS_MAP_END
351375
352376
377/*************************************
378 *
379 *  NSC8105 memory handlers
380 *
381 *************************************/
382
383
353384/* MS2010-A CPU (equivalent to NSC8105 with one new opcode: 0xec) on graphics PCB */
354385static ADDRESS_MAP_START( nsc_map, ADDRESS_SPACE_PROGRAM, 8 )
355386   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE(3) AM_BASE(&tubep_sprite_colorsharedram)
r1185r1186
360391ADDRESS_MAP_END
361392
362393
394/*************************************
395 *
396 *  Sound CPU
397 *
398 *************************************/
363399
364400
365
366/****************************** Sound CPU *******************************/
367
368
369
370
371401static READ8_HANDLER( rjammer_soundlatch_r )
372402{
373403    int res = sound_latch;
r1185r1186
480510}
481511
482512
513/*************************************
514 *
515 *  Game-specific port definitions
516 *
517 *************************************/
483518
519
484520INPUT_PORTS_START( tubep )
485   PORT_START   /* Player 1 controls */
521   PORT_START_TAG("P1")
486522   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
487523   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
488524   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r1185r1186
492528   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
493529   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
494530
495   PORT_START   /* Player 2 controls */
531   PORT_START_TAG("P2")
496532   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_8WAY PORT_COCKTAIL
497533   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
498534   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
r1185r1186
502538   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
503539   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
504540
505   PORT_START   /* Coin, Start */
541   PORT_START_TAG("Coin_Start")
506542   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
507543   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
508544   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r1185r1186
512548   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
513549   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
514550
515   PORT_START   /* DSW1 */
516   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
551   PORT_START_TAG("DSW1")
552   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:6,5,4")
517553   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
518554   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
519555   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
r1185r1186
522558   PORT_DIPSETTING(    0x02, DEF_STR( 1C_6C ) )
523559   PORT_DIPSETTING(    0x01, DEF_STR( 1C_7C ) )
524560   PORT_DIPSETTING(    0x00, DEF_STR( 1C_8C ) )
525   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) )
561   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:3,2,1")
526562   PORT_DIPSETTING(    0x00, DEF_STR( 8C_1C ) )
527563   PORT_DIPSETTING(    0x08, DEF_STR( 7C_1C ) )
528564   PORT_DIPSETTING(    0x10, DEF_STR( 6C_1C ) )
r1185r1186
531567   PORT_DIPSETTING(    0x28, DEF_STR( 3C_1C ) )
532568   PORT_DIPSETTING(    0x30, DEF_STR( 2C_1C ) )
533569   PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
534   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
535   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
536   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
537   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
538   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
539   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
570   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
571   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
540572
541   PORT_START   /* DSW2 */
542   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
573   PORT_START_TAG("DSW2")
574   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:6,5")
543575   PORT_DIPSETTING(    0x03, "2" )
544576   PORT_DIPSETTING(    0x02, "3" )
545577   PORT_DIPSETTING(    0x01, "4" )
546578   PORT_DIPSETTING(    0x00, "5" )
547   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
579   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4,3")
548580   PORT_DIPSETTING(    0x0c, "40000" )
549581   PORT_DIPSETTING(    0x08, "50000" )
550582   PORT_DIPSETTING(    0x04, "60000" )
551583   PORT_DIPSETTING(    0x00, "80000" )
552   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
584   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2")
553585   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
554586   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
555   PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
556   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
557   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
587   PORT_DIPNAME( 0x20, 0x20, "Serivce mode" ) PORT_DIPLOCATION("SW2:1")
588   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
558589   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
559   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
560   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
561   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
590   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
591   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
562592
563   PORT_START   /* DSW3 */
564   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
593   PORT_START_TAG("DSW3")
594   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW3:6")
565595   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
566596   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
567   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
597   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:5")
568598   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
569599   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
570   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
600   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:4")
571601   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
572602   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
573   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
603   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:3")
574604   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
575605   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
576   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
606   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:2")
577607   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
578608   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
579   PORT_DIPNAME( 0x20, 0x20, "In Game Sounds" )
609   PORT_DIPNAME( 0x20, 0x20, "In Game Sounds" ) PORT_DIPLOCATION("SW3:1")
580610   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
581611   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
582   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
583   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
584   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
585   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
586   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
587   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
612   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
613   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
588614INPUT_PORTS_END
589615
590616
617INPUT_PORTS_START( tubepb )
618   PORT_INCLUDE(tubep )
591619
620   PORT_MODIFY("DSW2")
621   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4,3")
622   PORT_DIPSETTING(    0x0c, "10000" )
623   PORT_DIPSETTING(    0x08, "20000" )
624   PORT_DIPSETTING(    0x04, "30000" )
625   PORT_DIPSETTING(    0x00, "40000" )
626   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:2")
627   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
628   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
629INPUT_PORTS_END
592630
631
593632INPUT_PORTS_START( rjammer )
594   PORT_START   /* Player 1 controls */
633   PORT_START_TAG("P1")
595634   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
596635   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
597636   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
r1185r1186
601640   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
602641   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
603642
604   PORT_START   /* Player 2 controls */
643   PORT_START_TAG("P2")
605644   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
606645   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
607646   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_8WAY PORT_COCKTAIL
r1185r1186
611650   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
612651   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
613652
614   PORT_START   /* DSW2 */
615   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
653   PORT_START_TAG("DSW2")
654   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6")
616655   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
617656   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
618   PORT_DIPNAME( 0x02, 0x02, "Bonus Time" )
657   PORT_DIPNAME( 0x02, 0x02, "Bonus Time" ) PORT_DIPLOCATION("SW2:5")
619658   PORT_DIPSETTING(    0x02, "100" )
620659   PORT_DIPSETTING(    0x00, "200" )
621   PORT_DIPNAME( 0x0c, 0x0c, "Clear Men" )
660   PORT_DIPNAME( 0x0c, 0x0c, "Clear Men" ) PORT_DIPLOCATION("SW2:4,3")
622661   PORT_DIPSETTING(    0x0c, "20" )
623662   PORT_DIPSETTING(    0x08, "30" )
624663   PORT_DIPSETTING(    0x04, "40" )
625664   PORT_DIPSETTING(    0x00, "50" )
626   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
665   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2")
627666   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
628667   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
629   PORT_DIPNAME( 0x20, 0x20, "Time" )
668   PORT_DIPNAME( 0x20, 0x20, "Time" ) PORT_DIPLOCATION("SW2:1")
630669   PORT_DIPSETTING(    0x20, "40" )
631670   PORT_DIPSETTING(    0x00, "50" )
632   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
633   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
634   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
635   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
636   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
637   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
671   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
672   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
638673
639   PORT_START   /* DSW1 */
640   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
674   PORT_START_TAG("DSW1")
675   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6")
641676   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
642677   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
643   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
678   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:5")
644679   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
645680   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
646   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
681   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,3")
647682   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
648683   PORT_DIPSETTING(    0x04, DEF_STR( 2C_3C ) )
649684   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_3C ) )
650685   PORT_DIPSETTING(    0x08, DEF_STR( 1C_6C ) )
651   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
686   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:2,1")
652687   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
653688   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
654689   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
655690   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
656   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
657   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
658   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
659   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
660   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
661   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
691   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
692   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
662693
663   PORT_START
694   PORT_START_TAG("Coins_Service")
664695   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
665696   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
666697   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r1185r1186
672703INPUT_PORTS_END
673704
674705
706/*************************************
707 *
708 *  Graphics definitions
709 *
710 *************************************/
711
712
675713static const gfx_layout charlayout =
676714{
677715   8, 8,   /* 8*8 characters */
r1185r1186
690728   GFXDECODE_ENTRY( REGION_GFX1,      0, charlayout,       0, 16 )   /* 16 color codes */
691729GFXDECODE_END
692730
731
732/*************************************
733 *
734 *  Sound definitions
735 *
736 *************************************/
737
738
693739static struct AY8910interface ay8910_interface_1 =
694740{
695741   0,
r1185r1186
721767};
722768
723769
770/*************************************
771 *
772 *  Machine driver
773 *
774 *************************************/
724775
776
725777static MACHINE_DRIVER_START( tubep )
726778
727779   /* basic machine hardware */
728   MDRV_CPU_ADD(Z80,16000000 / 4)   /* 4 MHz */
780   MDRV_CPU_ADD_TAG("main",Z80,16000000 / 4)   /* 4 MHz */
729781   MDRV_CPU_PROGRAM_MAP(tubep_map,0)
730782   MDRV_CPU_IO_MAP(tubep_portmap,0)
731783   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
732784
733   MDRV_CPU_ADD(Z80,16000000 / 4)   /* 4 MHz */
785   MDRV_CPU_ADD_TAG("slave",Z80,16000000 / 4)   /* 4 MHz */
734786   MDRV_CPU_PROGRAM_MAP(tubep_g_map,0)
735787   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
736788
737   MDRV_CPU_ADD(Z80,19968000 / 8)   /* X2 19968000 Hz divided by LS669 (on Qc output) (signal RH0) */
789   MDRV_CPU_ADD_TAG("sound",Z80,19968000 / 8)   /* X2 19968000 Hz divided by LS669 (on Qc output) (signal RH0) */
738790   /* audio CPU */
739791   MDRV_CPU_PROGRAM_MAP(tubep_sound_map,0)
740792   MDRV_CPU_IO_MAP(tubep_sound_portmap,0)
741793
742   MDRV_CPU_ADD(NSC8105,6000000/4)   /* 6 MHz Xtal - divided internally ??? */
794   MDRV_CPU_ADD_TAG("nsc",NSC8105,6000000/4)   /* 6 MHz Xtal - divided internally ??? */
743795   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
744796   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
745797
r1185r1186
780832MACHINE_DRIVER_END
781833
782834
835static MACHINE_DRIVER_START( tubepb )
836   MDRV_IMPORT_FROM( tubep )
837
838   MDRV_CPU_REMOVE("nsc")
839
840   MDRV_CPU_ADD(M6802,6000000/4) /* ? MHz Xtal */
841   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
842   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
843MACHINE_DRIVER_END
844
845
783846static MACHINE_DRIVER_START( rjammer )
847   MDRV_IMPORT_FROM( tubep )
784848
785849   /* basic machine hardware */
786   MDRV_CPU_ADD(Z80,16000000 / 4)   /* 4 MHz */
850   MDRV_CPU_MODIFY("main")
787851   MDRV_CPU_PROGRAM_MAP(rjammer_map,0)
788852   MDRV_CPU_IO_MAP(rjammer_portmap,0)
789   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
790853
791   MDRV_CPU_ADD(Z80,16000000 / 4)   /* 4 MHz */
854   MDRV_CPU_MODIFY("slave")
792855   MDRV_CPU_PROGRAM_MAP(rjammer_slave_map,0)
793856   MDRV_CPU_IO_MAP(rjammer_slave_portmap,0)
794   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
795857
796   MDRV_CPU_ADD(Z80,19968000 / 8)   /* Xtal3 divided by LS669 (on Qc output) (signal RH0) */
797   /* audio CPU */
858   MDRV_CPU_MODIFY("sound")   /* Xtal3 divided by LS669 (on Qc output) (signal RH0) */
798859   MDRV_CPU_PROGRAM_MAP(rjammer_sound_map,0)
799860   MDRV_CPU_IO_MAP(rjammer_sound_portmap,0)
800861
801   MDRV_CPU_ADD(NSC8105,6000000/4)   /* 6 MHz Xtal - divided internally ??? */
802   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
803   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
804
805
806   MDRV_SCREEN_REFRESH_RATE(60)
807   MDRV_INTERLEAVE(100)
808
809862   MDRV_MACHINE_START(rjammer)
863   MDRV_MACHINE_RESET(rjammer)
810864
811865   /* video hardware */
812   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
813   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
814   MDRV_SCREEN_SIZE(32*8, 32*8)
815   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
816866   MDRV_GFXDECODE(rjammer)
817867   MDRV_PALETTE_LENGTH(64)
818868   MDRV_COLORTABLE_LENGTH(2*16 + 16*2)
819869
820870   MDRV_PALETTE_INIT(rjammer)
821   MDRV_VIDEO_START(tubep)
822   MDRV_VIDEO_EOF(tubep)
823871   MDRV_VIDEO_UPDATE(rjammer)
824872
825873   /* sound hardware */
826   MDRV_SPEAKER_STANDARD_MONO("mono")
827
828   MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2)
829   MDRV_SOUND_CONFIG(ay8910_interface_1)
830   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
831
832   MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2)
833   MDRV_SOUND_CONFIG(ay8910_interface_2)
834   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
835
836   MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2)
837   MDRV_SOUND_CONFIG(ay8910_interface_3)
838   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
839
840874   MDRV_SOUND_ADD(MSM5205, 384000)
841875   MDRV_SOUND_CONFIG(msm5205_interface)
842876   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
843877MACHINE_DRIVER_END
844878
845879
880/*************************************
881 *
882 *  ROM definition(s)
883 *
884 *************************************/
846885
847886
848887ROM_START( tubep )
r1185r1186
900939ROM_END
901940
902941
942ROM_START( tubepb )
943   ROM_REGION( 0x10000,REGION_CPU1, 0 ) /* Z80 (master) cpu code */
944   ROM_LOAD( "a15.bin", 0x0000, 0x1000, CRC(806370a8) SHA1(c1915fae15bd766ffbd3c47d65ade51d36117eb8) )
945   ROM_LOAD( "a16.bin", 0x1000, 0x1000, CRC(0917fb76) SHA1(1ce2680700d6ce28dfd202f238f1fc6e9c4a2758) )
946   ROM_LOAD( "a13.bin", 0x2000, 0x1000, CRC(6e4bb47e) SHA1(092eba1a90f43eb298ee9e4dc0f13d5411a14b4a) )
947   ROM_LOAD( "a14.bin", 0x3000, 0x1000, CRC(3df78441) SHA1(8e078d4f674da12034e3bb82878e781253f227f2) )
948   ROM_LOAD( "a11.bin", 0x4000, 0x1000, CRC(2b557e49) SHA1(b7b7fdca23b62ebf320d50548d0a09aa904dfe5d) )
949   ROM_LOAD( "a12.bin", 0x5000, 0x1000, CRC(d04a548e) SHA1(bdb4aacb636c9fc9c94af67384b455459c26272e) )
950   ROM_LOAD( "a9.bin",  0x6000, 0x1000, CRC(a20de3d1) SHA1(84f2417597dbaecace0ce72a1684345fb212fc3a) )
951   ROM_LOAD( "a10.bin", 0x7000, 0x1000, CRC(033ba70c) SHA1(de561c5db7cd493aee05e3513e48d52ed95bd510) )
952
953   ROM_REGION( 0x10000,REGION_CPU2, 0 ) /* Z80 (slave) cpu code */
954   ROM_LOAD( "a1.bin",  0x0000, 0x1000, CRC(8a68523d) SHA1(268c659a2312e4d1a29e2064f55dfa07e57f6bca) )
955   ROM_LOAD( "a2.bin",  0x1000, 0x1000, CRC(d15a8645) SHA1(9970377ff49ac525f2ef21c36ded8e7447ed700c) )
956   ROM_LOAD( "a3.bin",  0x2000, 0x1000, CRC(7acf777c) SHA1(042b051de8fcc1295aca459f762619771438625e) )
957   ROM_LOAD( "a4.bin",  0x3000, 0x1000, CRC(8f2bed23) SHA1(fa682172ed7a7a99161a2eaaf2c2e822bbab3f80) )
958   ROM_LOAD( "a5.bin",  0x4000, 0x1000, CRC(8ba045f0) SHA1(91196b96592d98cd49474672ad4cc6b8039a9bcf) )
959   ROM_LOAD( "a6.bin",  0x5000, 0x1000, CRC(8672ab0f) SHA1(784d74b71ab9613fb8177b39295bff083933a002) )
960   ROM_LOAD( "a7.bin",  0x6000, 0x1000, CRC(417dd321) SHA1(aa0faa19eed1397e46a67e8793c5a27991ea9c1b) )
961   ROM_LOAD( "a8.bin",  0x7000, 0x1000, CRC(d26ab4c0) SHA1(8d92386e75114494d65df4cfebdbacd09fddb48e) )
962
963   ROM_REGION( 0x10000,REGION_CPU3, 0 ) /* Z80 (sound) cpu code */
964   ROM_LOAD( "15.bin",  0x0000, 0x2000, CRC(78964fcc) SHA1(a2c6119275d6291d82ac11dcffdaf2e8726e935a) )
965   ROM_LOAD( "16.bin",  0x2000, 0x2000, CRC(61232e29) SHA1(a9ef0fefb7250392ef51173b69a69c903ff91ee8) )
966
967   ROM_REGION( 0x10000,REGION_CPU4, 0 ) /* 64k for the custom CPU */
968   ROM_LOAD( "5.bin",   0xc000, 0x2000, CRC(9f375b27) SHA1(9666d1b20169d899176fbdf5954df41df06b4b82) )
969   ROM_LOAD( "6.bin",   0xe000, 0x2000, CRC(46a273b5) SHA1(ff862c9337b3eeadee5a3d3f0837931a7a71393e) )
970
971   ROM_REGION( 0xc000, REGION_USER1, 0 ) /* background data */
972   ROM_LOAD( "9.bin",   0x0000, 0x2000, CRC(fda355e0) SHA1(3270c65a4ee5d01388727f38691f7fe38f541031) )
973   ROM_LOAD( "10.bin",  0x2000, 0x2000, CRC(0ccb23b0) SHA1(71660a3476ed299684e5662058b8c40153d4a168) )
974   ROM_LOAD( "11.bin",  0x4000, 0x2000, CRC(f5d118e7) SHA1(a899bef3accef8995c457e8142a0001eed033fae) )
975   ROM_LOAD( "12.bin",  0x6000, 0x2000, CRC(01952144) SHA1(d1074c79b51d3e2c152c9f3df6892027fe3a0e00) )
976   ROM_LOAD( "13.bin",  0x8000, 0x2000, CRC(4dabea43) SHA1(72b9df9a3665baf34fb1f7301c5b9dd2619ed206) )
977   ROM_LOAD( "14.bin",  0xa000, 0x2000, CRC(01952144) SHA1(d1074c79b51d3e2c152c9f3df6892027fe3a0e00) )
978
979   ROM_REGION( 0x18000,REGION_USER2, 0 )
980   ROM_LOAD( "d1.bin",  0x0000, 0x1000, CRC(702348d7) SHA1(717e48d8c3529acb9a216b4e99df1599fb2e6b3b) )
981   ROM_LOAD( "d2.bin",  0x1000, 0x1000, CRC(47601e8b) SHA1(4e56fe72644a000648199e92b306365c100cca30) )
982   ROM_LOAD( "d3.bin",  0x2000, 0x1000, CRC(caad3ee2) SHA1(a99b8da36bf26a193d92fa807f168e60ed4bdce5) )
983   ROM_LOAD( "d4.bin",  0x3000, 0x1000, CRC(ba5d8666) SHA1(83bf9a4a6c4cabed7312f1c09dcf317a69fdf26a) )
984   ROM_LOAD( "d5.bin",  0x4000, 0x1000, CRC(cc709b7f) SHA1(6218c4aaac8a1d025d00923e27e026f54eda8987) )
985   ROM_LOAD( "d6.bin",  0x5000, 0x1000, CRC(b9be626a) SHA1(94806056d9f16d455d8993795f220827d5b03183) )
986   ROM_LOAD( "d7.bin",  0x6000, 0x1000, CRC(934e09d4) SHA1(395a0ca3bdf76ef8f715bfddc514b583be9ed499) )
987   ROM_LOAD( "d8.bin",  0x7000, 0x1000, CRC(7e1970a0) SHA1(9e5fb5aa63149348f3da885844eb08d3471ec409) )
988   ROM_LOAD( "d15.bin", 0x8000, 0x1000, CRC(f1f15364) SHA1(e5b783acb3fa3e1b67770db8a8a623ad38dc6a73) )
989   ROM_LOAD( "d16.bin", 0x9000, 0x1000, CRC(05c52829) SHA1(21cc9334cf393bcc808e9b0999e84a15b94cedcb) )
990   ROM_LOAD( "d13.bin", 0xa000, 0x1000, CRC(7c0b9e16) SHA1(2ec6337d06702a542c0dae9eb963d2b8e1736232) )
991   ROM_LOAD( "d14.bin", 0xb000, 0x1000, CRC(81b31170) SHA1(cfaf768dd98116df730fb5ee0468ebc78dc42b2e) )
992   ROM_LOAD( "d11.bin", 0xc000, 0x1000, CRC(9e07ef70) SHA1(e814c7ed72d94011718e45fba640f8dafc49aa31) )
993   ROM_LOAD( "d12.bin", 0xd000, 0x1000, CRC(77e72279) SHA1(594e8018d64fd9862f54de0152723e610163e1b8) )
994   ROM_LOAD( "d9.bin",  0xe000, 0x1000, CRC(7a0edea8) SHA1(ca98c35ef2007363ead3d24a8556e24df031308b) )
995   ROM_LOAD( "d10.bin", 0xf000, 0x1000, CRC(0c1c2cb1) SHA1(addc9cea5247b25c114b88e3e9e1804305aa53c8) )
996   ROM_LOAD( "4.bin",  0x10000, 0x1000, CRC(40a1fe00) SHA1(2e1e12efe8083bf96233016a7712e6e486d968e4) ) /* 2732 eprom is used, but the PCB is prepared for 2764 eproms */
997   ROM_RELOAD(          0x11000, 0x1000 )
998   ROM_LOAD( "1.bin",   0x12000, 0x1000, CRC(4a7407a2) SHA1(7ca4e03c637a6f1c338ca438a7ab9e4ba537fee0) )
999   ROM_LOAD( "2.bin",   0x13000, 0x1000, CRC(f0b26c2e) SHA1(54057c619675bb384035547becd2019974bf23fa) )
1000
1001   ROM_LOAD( "7.bin",   0x14000, 0x2000, CRC(105cb9e4) SHA1(b9d8ffe35c1f66aa401e5d8e415bf7c016ff53bb) )
1002   ROM_LOAD( "8.bin",   0x16000, 0x2000, CRC(27e5e6c1) SHA1(f3896d0006351d165e36bafa4340175077b3d6ba) )
1003
1004   ROM_REGION( 0x1000, REGION_GFX1, 0 )
1005   ROM_LOAD( "3.bin",   0x0000, 0x1000, CRC(657a465d) SHA1(848217c3b736550586e8e9ba7a6e99e884094066) )   /* text characters */
1006
1007   ROM_REGION( 0x40,   REGION_PROMS, 0 ) /* color proms */
1008   ROM_LOAD( "prom6331.b", 0x0000, 0x0020, CRC(ac7e582f) SHA1(9d8f9eda7130b49b91d9c63bafa119b2a91eeda0) ) /* text and sprites palette */
1009   ROM_LOAD( "prom6331.a", 0x0020, 0x0020, CRC(cd0910d6) SHA1(1e6dae16115d5a03bbaf76c695327a06eb6da602) ) /* color control prom */
1010ROM_END
1011
1012
9031013ROM_START( rjammer )
9041014   ROM_REGION( 0x10000,REGION_CPU1, 0 ) /* Z80 (master) cpu code */
9051015   ROM_LOAD( "tp-p.1", 0x0000, 0x2000, CRC(93eeed67) SHA1(9ccfc49f42c6b451ff1c541d6487276f4bf9338e) )
r1185r1186
9541064   ROM_LOAD( "16a", 0x0020, 0x0020, CRC(90222a71) SHA1(c3fd49c8075b0af451f6d2a142a4c4a2e397ac08) ) /* background palette */
9551065ROM_END
9561066
957/*     year  rom      parent  machine  inp   init */
1067
1068/*************************************
1069 *
1070 *  Game driver(s)
1071 *
1072 *************************************/
1073
1074
1075/*     year  rom     parent  machine  inp   init */
9581076GAME( 1984, tubep,   0,      tubep,   tubep,   0, ROT0, "Nichibutsu + Fujitek", "Tube Panic", GAME_SUPPORTS_SAVE )
1077GAME( 1984, tubepb,  tubep,  tubepb,  tubepb,  0, ROT0, "bootleg", "Tube Panic (bootleg)", GAME_SUPPORTS_SAVE )
9591078GAME( 1984, rjammer, 0,      rjammer, rjammer, 0, ROT0, "Nichibutsu + Alice", "Roller Jammer", GAME_SUPPORTS_SAVE )
9601079
src/mame/drivers/gamecstl.c
r0r1186
1/*
2    Cristaltec "Game Cristal" (MAME bootleg)
3
4    Skeleton driver by R. Belmont, based on taitowlf.c by Ville Linde
5
6    Specs: P3-866, SiS 630 graphics card, SiS 7018 sound, Windows 98, DirectX 8.1.
7
8    Input is via a custom COM1 port JAMMA adaptor.
9
10    The custom emulator is a heavily modified version of MAME32.  If you extract the
11    disk image, it's in C:\GH4\GH4.EXE.  It's UPX compressed, so unpack it before doing
12    any forensics.  The emulator does run on Windows as new as XP Pro SP2 but you can't
13    control it due to the lack of the custom input.
14*/
15
16#include "driver.h"
17#include "memconv.h"
18#include "machine/8237dma.h"
19#include "machine/pic8259.h"
20#include "machine/pit8253.h"
21#include "machine/mc146818.h"
22#include "machine/pcshare.h"
23#include "machine/pci.h"
24#include "machine/8042kbdc.h"
25#include "machine/pckeybrd.h"
26#include "machine/idectrl.h"
27#include "cpu/i386/i386.h"
28
29static UINT32 *cga_ram;
30static UINT32 *bios_ram;
31
32static const rgb_t cga_palette[16] =
33{
34   MAKE_RGB( 0x00, 0x00, 0x00 ), MAKE_RGB( 0x00, 0x00, 0xaa ), MAKE_RGB( 0x00, 0xaa, 0x00 ), MAKE_RGB( 0x00, 0xaa, 0xaa ),
35   MAKE_RGB( 0xaa, 0x00, 0x00 ), MAKE_RGB( 0xaa, 0x00, 0xaa ), MAKE_RGB( 0xaa, 0x55, 0x00 ), MAKE_RGB( 0xaa, 0xaa, 0xaa ),
36   MAKE_RGB( 0x55, 0x55, 0x55 ), MAKE_RGB( 0x55, 0x55, 0xff ), MAKE_RGB( 0x55, 0xff, 0x55 ), MAKE_RGB( 0x55, 0xff, 0xff ),
37   MAKE_RGB( 0xff, 0x55, 0x55 ), MAKE_RGB( 0xff, 0x55, 0xff ), MAKE_RGB( 0xff, 0xff, 0x55 ), MAKE_RGB( 0xff, 0xff, 0xff ),
38};
39
40static VIDEO_START(gamecstl)
41{
42   int i;
43   for (i=0; i < 16; i++)
44   {
45      palette_set_color(machine, i, cga_palette[i]);
46   }
47}
48
49static void draw_char(mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
50{
51   int i,j;
52   UINT8 *dp;
53   int index = 0;
54   dp = gfx->gfxdata + ch * gfx->char_modulo;
55
56   for (j=y; j < y+8; j++)
57   {
58      UINT16 *p = BITMAP_ADDR16(bitmap, j, 0);
59      for (i=x; i < x+8; i++)
60      {
61         UINT8 pen = dp[index++];
62         if (pen)
63         {
64            p[i] = Machine->remapped_colortable[gfx->color_base + (att & 0xf)];
65         }
66         else
67         {
68            p[i] = Machine->remapped_colortable[gfx->color_base  + ((att >> 4) & 0x7)];
69         }
70      }
71   }
72}
73
74static VIDEO_UPDATE(gamecstl)
75{
76   int i, j;
77   const gfx_element *gfx = machine->gfx[0];
78   UINT32 *cga = cga_ram;
79   int index = 0;
80
81   fillbitmap(bitmap, 0, cliprect);
82
83   for (j=0; j < 25; j++)
84   {
85      for (i=0; i < 80; i+=2)
86      {
87         int att0 = (cga[index] >> 8) & 0xff;
88         int ch0 = (cga[index] >> 0) & 0xff;
89         int att1 = (cga[index] >> 24) & 0xff;
90         int ch1 = (cga[index] >> 16) & 0xff;
91
92         draw_char(bitmap, cliprect, gfx, ch0, att0, i*8, j*8);
93         draw_char(bitmap, cliprect, gfx, ch1, att1, (i*8)+8, j*8);
94         index++;
95      }
96   }
97   return 0;
98}
99
100static READ8_HANDLER(at_dma8237_1_r)
101{
102   return dma8237_1_r(offset / 2);
103}
104
105static WRITE8_HANDLER(at_dma8237_1_w)
106{
107   dma8237_1_w(offset / 2, data);
108}
109
110static READ32_HANDLER(at32_dma8237_1_r)
111{
112   return read32le_with_read8_handler(at_dma8237_1_r, offset, mem_mask);
113}
114
115static WRITE32_HANDLER(at32_dma8237_1_w)
116{
117   write32le_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask);
118}
119
120
121
122// Intel 82439TX System Controller (MXTC)
123static UINT8 mxtc_config_reg[256];
124
125static UINT8 mxtc_config_r(int function, int reg)
126{
127//  mame_printf_debug("MXTC: read %d, %02X\n", function, reg);
128
129   return mxtc_config_reg[reg];
130}
131
132static void mxtc_config_w(int function, int reg, UINT8 data)
133{
134//  mame_printf_debug("MXTC: write %d, %02X, %02X at %08X\n", function, reg, data, activecpu_get_pc());
135
136   switch(reg)
137   {
138      case 0x59:      // PAM0
139      {
140         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
141         {
142            memory_set_bankptr(1, bios_ram);
143         }
144         else               // disable RAM access (reads go to BIOS ROM)
145         {
146            memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000);
147         }
148         break;
149      }
150   }
151
152   mxtc_config_reg[reg] = data;
153}
154
155static void intel82439tx_init(void)
156{
157   mxtc_config_reg[0x60] = 0x02;
158   mxtc_config_reg[0x61] = 0x02;
159   mxtc_config_reg[0x62] = 0x02;
160   mxtc_config_reg[0x63] = 0x02;
161   mxtc_config_reg[0x64] = 0x02;
162   mxtc_config_reg[0x65] = 0x02;
163}
164
165static UINT32 intel82439tx_pci_r(int function, int reg, UINT32 mem_mask)
166{
167   UINT32 r = 0;
168   if (!(mem_mask & 0xff000000))
169   {
170      r |= mxtc_config_r(function, reg + 3) << 24;
171   }
172   if (!(mem_mask & 0x00ff0000))
173   {
174      r |= mxtc_config_r(function, reg + 2) << 16;
175   }
176   if (!(mem_mask & 0x0000ff00))
177   {
178      r |= mxtc_config_r(function, reg + 1) << 8;
179   }
180   if (!(mem_mask & 0x000000ff))
181   {
182      r |= mxtc_config_r(function, reg + 0) << 0;
183   }
184   return r;
185}
186
187static void intel82439tx_pci_w(int function, int reg, UINT32 data, UINT32 mem_mask)
188{
189   if (!(mem_mask & 0xff000000))
190   {
191      mxtc_config_w(function, reg + 3, (data >> 24) & 0xff);
192   }
193   if (!(mem_mask & 0x00ff0000))
194   {
195      mxtc_config_w(function, reg + 2, (data >> 16) & 0xff);
196   }
197   if (!(mem_mask & 0x0000ff00))
198   {
199      mxtc_config_w(function, reg + 1, (data >> 8) & 0xff);
200   }
201   if (!(mem_mask & 0x000000ff))
202   {
203      mxtc_config_w(function, reg + 0, (data >> 0) & 0xff);
204   }
205}
206
207// Intel 82371AB PCI-to-ISA / IDE bridge (PIIX4)
208static UINT8 piix4_config_reg[4][256];
209
210static UINT8 piix4_config_r(int function, int reg)
211{
212//  mame_printf_debug("PIIX4: read %d, %02X\n", function, reg);
213   return piix4_config_reg[function][reg];
214}
215
216static void piix4_config_w(int function, int reg, UINT8 data)
217{
218//  mame_printf_debug("PIIX4: write %d, %02X, %02X at %08X\n", function, reg, data, activecpu_get_pc());
219   piix4_config_reg[function][reg] = data;
220}
221
222static UINT32 intel82371ab_pci_r(int function, int reg, UINT32 mem_mask)
223{
224   UINT32 r = 0;
225   if (!(mem_mask & 0xff000000))
226   {
227      r |= piix4_config_r(function, reg + 3) << 24;
228   }
229   if (!(mem_mask & 0x00ff0000))
230   {
231      r |= piix4_config_r(function, reg + 2) << 16;
232   }
233   if (!(mem_mask & 0x0000ff00))
234   {
235      r |= piix4_config_r(function, reg + 1) << 8;
236   }
237   if (!(mem_mask & 0x000000ff))
238   {
239      r |= piix4_config_r(function, reg + 0) << 0;
240   }
241   return r;
242}
243
244static void intel82371ab_pci_w(int function, int reg, UINT32 data, UINT32 mem_mask)
245{
246   if (!(mem_mask & 0xff000000))
247   {
248      piix4_config_w(function, reg + 3, (data >> 24) & 0xff);
249   }
250   if (!(mem_mask & 0x00ff0000))
251   {
252      piix4_config_w(function, reg + 2, (data >> 16) & 0xff);
253   }
254   if (!(mem_mask & 0x0000ff00))
255   {
256      piix4_config_w(function, reg + 1, (data >> 8) & 0xff);
257   }
258   if (!(mem_mask & 0x000000ff))
259   {
260      piix4_config_w(function, reg + 0, (data >> 0) & 0xff);
261   }
262}
263
264// ISA Plug-n-Play
265static WRITE32_HANDLER( pnp_config_w )
266{
267   if (!(mem_mask & 0x0000ff00))
268   {
269//      mame_printf_debug("PNP Config: %02X\n", (data >> 8) & 0xff);
270   }
271}
272
273static WRITE32_HANDLER( pnp_data_w )
274{
275   if (!(mem_mask & 0x0000ff00))
276   {
277//      mame_printf_debug("PNP Data: %02X\n", (data >> 8) & 0xff);
278   }
279}
280
281
282
283static READ32_HANDLER( ide0_r )
284{
285   return ide_controller32_0_r(0x1f0/4 + offset, mem_mask);
286}
287
288static WRITE32_HANDLER( ide0_w )
289{
290   ide_controller32_0_w(0x1f0/4 + offset, data, mem_mask);
291}
292
293static READ32_HANDLER( fdc_r )
294{
295   return ide_controller32_0_r(0x3f0/4 + offset, mem_mask);
296}
297
298static WRITE32_HANDLER( fdc_w )
299{
300   //mame_printf_debug("FDC: write %08X, %08X, %08X\n", data, offset, mem_mask);
301   ide_controller32_0_w(0x3f0/4 + offset, data, mem_mask);
302}
303
304
305
306static WRITE32_HANDLER(bios_ram_w)
307{
308   if (mxtc_config_reg[0x59] & 0x20)      // write to RAM if this region is write-enabled
309   {
310      COMBINE_DATA(bios_ram + offset);
311   }
312}
313
314/*****************************************************************************/
315
316static ADDRESS_MAP_START( gamecstl_map, ADDRESS_SPACE_PROGRAM, 32 )
317   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
318   AM_RANGE(0x000a0000, 0x000affff) AM_RAM
319   AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_BASE(&cga_ram)
320   AM_RANGE(0x000e0000, 0x000effff) AM_RAM
321   AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK(1)
322   AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE(bios_ram_w)
323   AM_RANGE(0x00100000, 0x01ffffff) AM_RAM
324   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION(REGION_USER1, 0)   /* System BIOS */
325ADDRESS_MAP_END
326
327static ADDRESS_MAP_START(gamecstl_io, ADDRESS_SPACE_IO, 32)
328   AM_RANGE(0x0000, 0x001f) AM_READWRITE(dma8237_32le_0_r,         dma8237_32le_0_w)
329   AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_32le_0_r,         pic8259_32le_0_w)
330   AM_RANGE(0x0040, 0x005f) AM_READWRITE(pit8253_32le_0_r,         pit8253_32le_0_w)
331   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
332   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
333   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
334   AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_32le_1_r,         pic8259_32le_1_w)
335   AM_RANGE(0x00c0, 0x00df) AM_READWRITE(at32_dma8237_1_r,         at32_dma8237_1_w)
336   AM_RANGE(0x00e8, 0x00eb) AM_NOP
337   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide0_r, ide0_w)
338   AM_RANGE(0x0300, 0x03af) AM_NOP
339   AM_RANGE(0x03b0, 0x03df) AM_NOP
340   AM_RANGE(0x0278, 0x027b) AM_WRITE(pnp_config_w)
341   AM_RANGE(0x03f0, 0x03ff) AM_READWRITE(fdc_r, fdc_w)
342   AM_RANGE(0x0a78, 0x0a7b) AM_WRITE(pnp_data_w)
343   AM_RANGE(0x0cf8, 0x0cff) AM_READWRITE(pci_32le_r,            pci_32le_w)
344ADDRESS_MAP_END
345
346/*****************************************************************************/
347
348static const gfx_layout CGA_charlayout =
349{
350   8,8,               /* 8 x 16 characters */
351    256,                    /* 256 characters */
352    1,                      /* 1 bits per pixel */
353    { 0 },                  /* no bitplanes; 1 bit per pixel */
354    /* x offsets */
355    { 0,1,2,3,4,5,6,7 },
356    /* y offsets */
357   { 0*8,1*8,2*8,3*8,
358     4*8,5*8,6*8,7*8,
359     0*8,1*8,2*8,3*8,
360     4*8,5*8,6*8,7*8 },
361    8*8                     /* every char takes 8 bytes */
362};
363
364static GFXDECODE_START( CGA )
365/* Support up to four CGA fonts */
366   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, CGA_charlayout,              0, 256 )   /* Font 0 */
367   GFXDECODE_ENTRY( REGION_GFX1, 0x0800, CGA_charlayout,              0, 256 )   /* Font 1 */
368   GFXDECODE_ENTRY( REGION_GFX1, 0x1000, CGA_charlayout,              0, 256 )   /* Font 2 */
369   GFXDECODE_ENTRY( REGION_GFX1, 0x1800, CGA_charlayout,              0, 256 )   /* Font 3*/
370GFXDECODE_END
371
372#define AT_KEYB_HELPER(bit, text, key1) \
373   PORT_BIT( bit, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(text) PORT_CODE(key1)
374
375INPUT_PORTS_START(gamecstl)
376   PORT_START_TAG("pc_keyboard_0")
377   PORT_BIT ( 0x0001, 0x0000, IPT_UNUSED )    /* unused scancode 0 */
378   AT_KEYB_HELPER( 0x0002, "Esc",          KEYCODE_Q           ) /* Esc                         01  81 */
379
380   PORT_START_TAG("pc_keyboard_1")
381   AT_KEYB_HELPER( 0x0020, "Y",            KEYCODE_Y           ) /* Y                           15  95 */
382   AT_KEYB_HELPER( 0x1000, "Enter",        KEYCODE_ENTER       ) /* Enter                       1C  9C */
383
384   PORT_START_TAG("pc_keyboard_2")
385
386   PORT_START_TAG("pc_keyboard_3")
387   AT_KEYB_HELPER( 0x0002, "N",            KEYCODE_N           ) /* N                           31  B1 */
388   AT_KEYB_HELPER( 0x0800, "F1",           KEYCODE_S           ) /* F1                          3B  BB */
389
390   PORT_START_TAG("pc_keyboard_4")
391
392   PORT_START_TAG("pc_keyboard_5")
393
394   PORT_START_TAG("pc_keyboard_6")
395   AT_KEYB_HELPER( 0x0040, "(MF2)Cursor Up",      KEYCODE_UP          ) /* Up                          67  e7 */
396   AT_KEYB_HELPER( 0x0080, "(MF2)Page Up",         KEYCODE_PGUP        ) /* Page Up                     68  e8 */
397   AT_KEYB_HELPER( 0x0100, "(MF2)Cursor Left",      KEYCODE_LEFT        ) /* Left                        69  e9 */
398   AT_KEYB_HELPER( 0x0200, "(MF2)Cursor Right",   KEYCODE_RIGHT       ) /* Right                       6a  ea */
399   AT_KEYB_HELPER( 0x0800, "(MF2)Cursor Down",      KEYCODE_DOWN        ) /* Down                        6c  ec */
400   AT_KEYB_HELPER( 0x1000, "(MF2)Page Down",      KEYCODE_PGDN        ) /* Page Down                   6d  ed */
401   AT_KEYB_HELPER( 0x4000, "Del",                 KEYCODE_A           ) /* Delete                      6f  ef */
402
403   PORT_START_TAG("pc_keyboard_7")
404INPUT_PORTS_END
405
406static int irq_callback(int irqline)
407{
408   int r = 0;
409   r = pic8259_acknowledge(1);
410   if (r==0)
411   {
412      r = pic8259_acknowledge(0);
413   }
414   return r;
415}
416
417static MACHINE_RESET(gamecstl)
418{
419   memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000);
420
421   dma8237_reset();
422   cpunum_set_irq_callback(0, irq_callback);
423}
424
425static MACHINE_DRIVER_START(gamecstl)
426
427   /* basic machine hardware */
428   MDRV_CPU_ADD(PENTIUM, 200000000)
429   MDRV_CPU_PROGRAM_MAP(gamecstl_map, 0)
430   MDRV_CPU_IO_MAP(gamecstl_io, 0)
431
432   MDRV_SCREEN_REFRESH_RATE(60)
433   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
434
435   MDRV_MACHINE_RESET(gamecstl)
436
437   MDRV_NVRAM_HANDLER( mc146818 )
438
439    /* video hardware */
440   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER )
441   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15)
442   MDRV_SCREEN_SIZE(640, 480)
443   MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 199)
444   MDRV_GFXDECODE(CGA)
445   MDRV_PALETTE_LENGTH(16)
446
447   MDRV_VIDEO_START(gamecstl)
448   MDRV_VIDEO_UPDATE(gamecstl)
449
450MACHINE_DRIVER_END
451
452static struct pci_device_info intel82439tx =
453{
454   intel82439tx_pci_r,
455   intel82439tx_pci_w
456};
457
458static struct pci_device_info intel82371ab =
459{
460   intel82371ab_pci_r,
461   intel82371ab_pci_w
462};
463
464static void set_gate_a20(int a20)
465{
466   cpunum_set_input_line(0, INPUT_LINE_A20, a20);
467}
468
469static void keyboard_interrupt(int state)
470{
471   pic8259_set_irq_line(0, 1, state);
472}
473
474static void ide_interrupt(int state)
475{
476   pic8259_set_irq_line(1, 6, state);
477}
478
479static struct kbdc8042_interface at8042 =
480{
481   KBDC8042_AT386, set_gate_a20, keyboard_interrupt
482};
483
484static struct ide_interface ide_intf =
485{
486   ide_interrupt
487};
488
489static DRIVER_INIT( gamecstl )
490{
491   bios_ram = auto_malloc(0x10000);
492
493   init_pc_common(PCCOMMON_KEYBOARD_AT | PCCOMMON_DMA8237_AT | PCCOMMON_TIMER_8254);
494   mc146818_init(MC146818_STANDARD);
495
496   intel82439tx_init();
497
498   pci_init();
499   pci_add_device(0, 0, &intel82439tx);
500   pci_add_device(0, 7, &intel82371ab);
501
502   kbdc8042_init(&at8042);
503
504   ide_controller_init(0, &ide_intf);
505}
506
507/*****************************************************************************/
508
509// not the correct BIOS, f205v owes me a dump of it...
510ROM_START(gamecstl)
511   ROM_REGION32_LE(0x40000, REGION_USER1, 0)
512   ROM_LOAD("p5tx-la.bin", 0x00000, 0x40000, BAD_DUMP CRC(072e6d51) SHA1(70414349b37e478fc28ecbaba47ad1033ae583b7))
513
514   ROM_REGION(0x08100, REGION_GFX1, 0)
515   ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
516
517   DISK_REGION( REGION_DISKS )
518   DISK_IMAGE( "gamecstl", 0, MD5(501ddbebb530b8fd67eb64a4a2de3e35) SHA1(2477468ef1c1d4529057064a319ebfe9fd8facd7) )
519ROM_END
520
521/*****************************************************************************/
522
523GAME(2002, gamecstl, 0,   gamecstl, gamecstl, gamecstl,   ROT0,   "Cristaltec",  "GameCristal", GAME_NOT_WORKING | GAME_NO_SOUND);
524
src/mame/drivers/megasys1.c
r1185r1186
3535    Big Striker                     C           Inputs
363693  Chimera Beast                   C       *   Inputs
3737    Cybattler                       C           Inputs
38    Hayaoshi Quiz Ouza Ketteisen    B       *   Inputs
38    Hayaoshi Quiz Ouza Ketteisen    B           Inputs
3939    Peek-a-Boo!                     D           Inputs
4040--------------------------------------------^-------------------------------
4141                                            |
r1185r1186
9191                                Issues / To Do
9292                                --------------
9393
94- There's a 512 byte PROM in the video section (different for every game)
95  that controls the priorities. It's been dumped for only a few games, so
96  we have to use fake data for the missing ones.
94- There is a 512 byte PROM in the video section (differs by game) that
95  controls the priorities. This prom is currently missing for two games,
96  so we have to use fake data for those two (64th Street & Chimera Beast).
9797
9898- Making the M6295 status register return 0 fixes the music tempo in
9999  avspirit, 64street, astyanax etc. but makes most of the effects in
r1185r1186
17401740   ROM_LOAD16_BYTE( "edf1.f5",  0x000000, 0x020000, CRC(2290ea19) SHA1(64c9394bd4d5569d68833d2e57abaf2f1af5be97) )
17411741   ROM_LOAD16_BYTE( "edf2.f3",  0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) )
17421742
1743   ROM_REGION( 0x40000, REGION_CPU3, 0 ) /* MCU Internal Code */
1743   ROM_REGION( 0x40000, REGION_CPU3, 0 ) /* MCU Internal Code, 64 pin DIP surface scratched */
17441744   ROM_LOAD( "edf.mcu", 0x000000, 0x40000, NO_DUMP )
17451745
17461746   ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) /* Scroll 0 */
r1185r1186
17611761   ROM_REGION( 0x040000, REGION_SOUND2, 0 )      /* Samples */
17621762   ROM_LOAD( "edf_m01.rom",  0x000000, 0x040000, CRC(9149286b) SHA1(f6c66c5cd50b72c4d401a263c65a8d4ef8cf9221) )
17631763
1764   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM */
1765   ROM_LOAD( "prom.14m",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
1764   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM  (N82S131N compatible type PROM) */
1765   ROM_LOAD( "rd.20n",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
17661766ROM_END
17671767
17681768ROM_START( edfu )
r1185r1186
17761776   ROM_LOAD16_BYTE( "edf1.f5",  0x000000, 0x020000, CRC(2290ea19) SHA1(64c9394bd4d5569d68833d2e57abaf2f1af5be97) )
17771777   ROM_LOAD16_BYTE( "edf2.f3",  0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) )
17781778
1779   ROM_REGION( 0x40000, REGION_CPU3, 0 ) /* MCU Internal Code */
1779   ROM_REGION( 0x40000, REGION_CPU3, 0 ) /* MCU Internal Code, 64 pin DIP surface scratched */
17801780   ROM_LOAD( "edf.mcu", 0x000000, 0x40000, NO_DUMP )
17811781
17821782   ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) /* Scroll 0 */
r1185r1186
17971797   ROM_REGION( 0x040000, REGION_SOUND2, 0 )      /* Samples */
17981798   ROM_LOAD( "edf_m01.rom",  0x000000, 0x040000, CRC(9149286b) SHA1(f6c66c5cd50b72c4d401a263c65a8d4ef8cf9221) )
17991799
1800   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM */
1801   ROM_LOAD( "prom.14m",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
1800   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM  (N82S131N compatible type PROM) */
1801   ROM_LOAD( "rd.20n",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
18021802ROM_END
18031803
18041804INPUT_PORTS_START( edf )
r1185r1186
198219829  |              (actual label is ???????N?C?Y[9])
1983198310 /              (actual label is ???????N?C?Y[10])
19841984
1985PR-91044 (82S131N, not dumped)
1985PR-91044 (82S131N)
19861986
19871987***************************************************************************/
19881988
r1185r1186
20182018   ROM_REGION( 0x40000, REGION_SOUND2, 0 )      /* Samples */
20192019   ROM_LOAD( "4", 0x000000, 0x40000, CRC(ac3f9bd2) SHA1(7856f40daa30de9077e68a5ea977ec39c044c2f8) )
20202020
2021   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM */
2022   ROM_LOAD( "pr-91044",  0x0000, 0x0200, NO_DUMP )
2021   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM  (N82S131N compatible type BPROM) */
2022   ROM_LOAD( "pr-91044",  0x0000, 0x0200, CRC(c69423d6) SHA1(ba9644a9899df2d73a5a16bf7ceef1954c2e25f3) )
20232023ROM_END
20242024
20252025INPUT_PORTS_START( hayaosi1 )
r1185r1186
22792279   ROM_LOAD( "jp_8.bin",  0x000000, 0x040000, CRC(eca67632) SHA1(9f91081a26bd98fd79d5ddc6413b8a32006bb05f) )   // FIRST AND SECOND HALF IDENTICAL
22802280   ROM_CONTINUE(          0x000000, 0x040000             )
22812281
2282   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM */
2282   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM (N82S131N compatible type BPROM) */
22832283   ROM_LOAD( "bs.bpr",    0x0000, 0x0200, CRC(85b30ac4) SHA1(b03f577ceb0f26b67453ffa52ef61fea76a93184) )
22842284ROM_END
22852285
r1185r1186
26652665   ROM_LOAD( "p47j_10.bin", 0x000000, 0x020000, CRC(b9d79c1e) SHA1(315dbed9b7cc289b383c95e6c94267682324154c) )
26662666   ROM_LOAD( "p47j_11.bin", 0x020000, 0x020000, CRC(fa0d1887) SHA1(d24c17806669f5b12527b36bc9c10fd16222e23c) )
26672667
2668   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM */
2669   ROM_LOAD( "prom.14m",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
2668   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM  (N82S131N compatible type BPROM) */
2669   ROM_LOAD( "p-47.14m",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
26702670ROM_END
26712671
26722672
r1185r1186
27062706   ROM_LOAD( "p47j_10.bin", 0x000000, 0x020000, CRC(b9d79c1e) SHA1(315dbed9b7cc289b383c95e6c94267682324154c) )
27072707   ROM_LOAD( "p47j_11.bin", 0x020000, 0x020000, CRC(fa0d1887) SHA1(d24c17806669f5b12527b36bc9c10fd16222e23c) )
27082708
2709   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM */
2710   ROM_LOAD( "prom.14m",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
2709   ROM_REGION( 0x0200, REGION_PROMS, 0 )      /* Priority PROM  (N82S131N compatible type BPROM) */
2710   ROM_LOAD( "p-47.14m",    0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) )
27112711ROM_END
27122712
27132713INPUT_PORTS_START( p47 )
src/mame/drivers/pacman.c
r1185r1186
355355#define VBSTART            (224)   /*(224+16)*/
356356
357357
358UINT8 cannonb_bit_to_read;
358359
360
359361/*************************************
360362 *
361363 *  Machine init
r1185r1186
29232925
29242926INPUT_PORTS_START( cannonbp )
29252927   PORT_START_TAG("IN0")
2926   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_PLAYER(1) PORT_4WAY
2927   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_PLAYER(1) PORT_4WAY
2928   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(1) PORT_4WAY
2929   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_PLAYER(1) PORT_4WAY
2930   PORT_DIPNAME(0x10, 0x10, "Rack Test (Cheat)" )   PORT_CODE(KEYCODE_F1)
2931   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
2932   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2928   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_4WAY
2929   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_4WAY
2930   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_4WAY
2931   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_4WAY
2932   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
29332933   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
29342934   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
29352935   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
29362936
29372937   PORT_START_TAG("IN1")
2938   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL
2939   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL
2940   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL
2941   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL
2942   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
2943   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
2944   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
2945   PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
2946   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
2947   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
2938   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_4WAY PORT_COCKTAIL
2939   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_4WAY PORT_COCKTAIL
2940   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_4WAY PORT_COCKTAIL
2941   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_4WAY PORT_COCKTAIL
2942   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
2943   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" )
2944   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME( "Select" )
2945   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
29482946
29492947   PORT_START_TAG("DSW 1")
2950    PORT_DIPNAME( 0x0001, 0x0001, "DSW1" )
2951    PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
2952    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2953    PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
2954    PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
2955    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2956    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
2957    PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
2958    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2959    PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
2960    PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
2961    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2962    PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )
2963    PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
2964    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2965    PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
2966    PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
2967    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2968    PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
2969    PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
2970    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2971    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
2972    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
2973    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2948   PORT_DIPNAME( 0x03, 0x03, "Display" )
2949   PORT_DIPSETTING(    0x03, "Scores and Progession Bars" )
2950   PORT_DIPSETTING(    0x01, "Scores only" )
2951   PORT_DIPSETTING(    0x02, "Progession Bars only" )
2952   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
2953   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
2954   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
2955   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
2956   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )
2957   PORT_DIPSETTING(    0x00, "3" )
2958   PORT_DIPSETTING(    0x08, "4" )
2959   PORT_DIPSETTING(    0x10, "5" )
2960   PORT_DIPSETTING(    0x18, "6" )
2961   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
2962   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
2963   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
29742964
29752965   PORT_START_TAG("DSW 2")
2976    PORT_DIPNAME( 0x0001, 0x0001, "DSW2" )
2977    PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
2978    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2979    PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
2980    PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
2981    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2982    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
2983    PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
2984    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2985    PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
2986    PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
2987    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2988    PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )
2989    PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
2990    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2991    PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
2992    PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
2993    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2994    PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
2995    PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
2996    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2997    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
2998    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
2999    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2966   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
30002967INPUT_PORTS_END
30012968
30022969/*************************************
r1185r1186
53565323
53575324static READ8_HANDLER( cannonbp_protection_r )
53585325{
5359   /* at 6p where a rom would usually be there is an epoxy resin chip with 'Novomatic Industrie' Cannon Ball tm 1984 label. */
5326
5327   /* At 6p where a rom would usually be there is an epoxy resin chip with 'Novomatic Industrie' Cannon Ball tm 1984 label. */
5328   /* As I have no clue about what shall be in this chip, what follows is only a simulation which is enough to play the game. */
53605329   switch (offset)
53615330   {
53625331      default:
53635332         logerror("CPU0 %04x: Unhandled protection read, offset %04x\n", activecpu_get_pc(), offset);
53645333         return 0x00;
53655334
5366      case 0x000: // unknown
5367      case 0x003: // unknown
5368      case 0x012: // unknown
5335      case 0x0000: // unknown
5336      case 0x0003: // unknown
5337      case 0x0012: // unknown
53695338         return 0x00;
53705339
5371      case 0x001: // affects the ball hitting the blocks
5372         return 0xff;
5373
5374      case 0x105: // player start x position
5340      /* code at 0x2b77 :
5341             - after partial checksum (range 0x0000-0x1e7c), HL = 0x9d39
5342             - then L += A and HL += 0x717c to determine jump address after bonus round
5343               where A is the result of 8 reads from 0x3001
5344             - as jump address shall be 0x0efb, A = 0x46
5345             - as H after partial checksum is wrong in the bootlegs,
5346               they will reset or hang after bonus round
5347               unless you patch ROM at 0x2ba0 with this code :
5348                 2BA0: 21 FB 0E      ld   hl,$0EFB
5349                 2BA3: 00            nop
5350        */
5351      case 0x0004:
5352         cannonb_bit_to_read = 7;
53755353         return 0x00;
5354      case 0x0001: // affects the ball hitting the blocks as well as jump address after bonus round
5355         if (activecpu_get_pc() == 0x2b97)
5356            return (BIT(0x46, cannonb_bit_to_read--) << 7);
5357         else
5358            return 0xff;            /* value taken from the bootlegs */
53765359
5377      case 0x107: // player start y position
5378         return 0x70;
5360      /* code at 0x2613 : HL += 0xd088 for start position - in the bootlegs, start position = 0x1088 */
5361      case 0x0105: // player start x position -> register L
5362         return 0x00;
5363      case 0x0107: // player start y position -> register H
5364         return 0x40;
53795365   }
53805366}
53815367
r1185r1186
54715457GAME( 1986, rocktrv2, 0,        rocktrv2, rocktrv2, rocktrv2, ROT90,  "Triumph Software Inc.", "MTV Rock-N-Roll Trivia (Part 2)", GAME_SUPPORTS_SAVE )
54725458GAME( 1986, bigbucks, 0,        bigbucks, bigbucks, 0,        ROT90,  "Dynasoft Inc.", "Big Bucks", GAME_SUPPORTS_SAVE )
54735459GAME( 1995, mschamp,  mspacman, mschamp,  mschamp,  0,        ROT90,  "hack", "Ms. Pacman Champion Edition / Super Zola Pac Gal", GAME_SUPPORTS_SAVE )
5474GAME( 198?, cannonbp, cannonb,  pacman,   cannonbp, cannonbp, ROT90,  "Novomatic", "Cannon Ball (Pacman Hardware)", GAME_WRONG_COLORS|GAME_SUPPORTS_SAVE )
5460GAME( 198?, cannonbp, 0,        pacman,   cannonbp, cannonbp, ROT90,  "Novomatic", "Cannon Ball (Pacman Hardware)", GAME_WRONG_COLORS|GAME_SUPPORTS_SAVE )
src/mame/drivers/dec8.c
r1185r1186
33863386
33873387   sound_cpu = 1;
33883388   /* Oscar has three CPUs */
3389   if (machine->drv->cpu[2].cpu_type != CPU_DUMMY) sound_cpu = 2;
3389   if (machine->drv->cpu[2].type != CPU_DUMMY) sound_cpu = 2;
33903390
33913391   /* bits 5 and 6 of the opcodes are swapped */
33923392   rom = memory_region(REGION_CPU1+sound_cpu);
src/mame/drivers/genesis.c
r1185r1186
157157MACHINE_RESET( genesis )
158158{
159159   /* C2 doesn't have a Z80, so we can't just assume */
160   if (machine->drv->cpu[1].cpu_type == CPU_Z80)
160   if (machine->drv->cpu[1].type == CPU_Z80)
161161   {
162162       /* the following ensures that the Z80 begins without running away from 0 */
163163      /* 0x76 is just a forced 'halt' as soon as the CPU is initially run */
src/mame/drivers/segas18.c
r1185r1186
203203   fd1094_machine_init();
204204
205205   /* if we are running with a real live 8751, we need to boost the interleave at startup */
206   if (machine->drv->cpu[2].cpu_type == CPU_I8751)
206   if (machine->drv->cpu[2].type == CPU_I8751)
207207      timer_call_after_resynch(0, boost_interleave);
208208}
209209
src/osd/osdmini/miniwork.c
r1185r1186
7171
7272osd_work_item *osd_work_item_queue(osd_work_queue *queue, osd_work_callback callback, void *param, UINT32 flags)
7373{
74
7574   osd_work_item *item;
7675
7776   // allocate memory to hold the result
r1185r1186
8079      return NULL;
8180
8281   // execute the call directly
83   item->result = (*callback)(param);
82   item->result = (*callback)(param, 0);
8483   return item;
8584}
8685
src/osd/osdcore.h
r1185r1186
2222
2323#include "osdcomm.h"
2424
25#include "osinline.h"
2526
2627
28
2729/***************************************************************************
2830    FILE I/O INTERFACES
2931***************************************************************************/
r1185r1186
521523
522524        The original value from memory.
523525-----------------------------------------------------------------------------*/
526#ifndef osd_compare_exchange32
524527INT32 osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange);
528#endif
525529
526530
527531/*-----------------------------------------------------------------------------
r1185r1186
541545        The original value from memory.
542546-----------------------------------------------------------------------------*/
543547#ifdef PTR64
548#ifndef osd_compare_exchange64
544549INT64 osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange);
545550#endif
546
547
548/*-----------------------------------------------------------------------------
549    osd_compare_exchange_ptr: INLINE wrapper to compare and exchange a
550        pointer value of the appropriate size
551-----------------------------------------------------------------------------*/
552INLINE void *osd_compare_exchange_ptr(void * volatile *ptr, void *compare, void *exchange)
553{
554#ifdef PTR64
555   INT64 result = osd_compare_exchange64((INT64 volatile *)ptr, (INT64)compare, (INT64)exchange);
556   return (void *)result;
557#else
558   INT32 result = osd_compare_exchange32((INT32 volatile *)ptr, (INT32)compare, (INT32)exchange);
559   return (void *)result;
560551#endif
561}
562552
563553
564554/*-----------------------------------------------------------------------------
565555    osd_sync_add: INLINE wrapper to safely add a delta value to a
566556        32-bit integer, returning the final result
567557-----------------------------------------------------------------------------*/
558#ifndef osd_sync_add
568559INLINE INT32 osd_sync_add(INT32 volatile *ptr, INT32 delta)
569560{
570561   INT32 origvalue;
r1185r1186
578569   /* return the final result */
579570   return origvalue + delta;
580571}
572#endif
581573
582574
575/*-----------------------------------------------------------------------------
576    osd_compare_exchange_ptr: INLINE wrapper to compare and exchange a
577        pointer value of the appropriate size
578-----------------------------------------------------------------------------*/
579#ifndef osd_compare_exchange_ptr
580INLINE void *osd_compare_exchange_ptr(void * volatile *ptr, void *compare, void *exchange)
581{
582#ifdef PTR64
583   INT64 result = osd_compare_exchange64((INT64 volatile *)ptr, (INT64)compare, (INT64)exchange);
584   return (void *)result;
585#else
586   INT32 result = osd_compare_exchange32((INT32 volatile *)ptr, (INT32)compare, (INT32)exchange);
587   return (void *)result;
588#endif
589}
590#endif
583591
592
593
584594/***************************************************************************
585595    WORK ITEM INTERFACES
586596***************************************************************************/
587597
598/* this is the maximum number of supported threads for a single work queue */
599/* threadid values are expected to range from 0..WORK_MAX_THREADS-1 */
600#define WORK_MAX_THREADS         16
601
588602/* these flags can be set when creating a queue to give hints to the code about
589603   how to configure the queue */
590604#define WORK_QUEUE_FLAG_IO         0x0001
591605#define WORK_QUEUE_FLAG_MULTI      0x0002
606#define WORK_QUEUE_FLAG_HIGH_FREQ   0x0004
592607
593608/* these flags can be set when queueing a work item to indicate how to handle
594609   its deconstruction */
r1185r1186
601616typedef struct _osd_work_item osd_work_item;
602617
603618/* osd_work_callback is a callback function that does work */
604typedef void *(*osd_work_callback)(void *param);
619typedef void *(*osd_work_callback)(void *param, int threadid);
605620
606621
607622/*-----------------------------------------------------------------------------
r1185r1186
620635                take advantage of as many processors as it can; items queued
621636                here are assumed to be fully independent or shared
622637
638            WORK_QUEUE_FLAG_HIGH_FREQ - indicates that items are expected
639                to be queued at high frequency and acted upon quickly; in
640                general, this implies doing some spin-waiting internally
641                before falling back to OS-specific synchronization
642
623643    Return value:
624644
625645        A pointer to an allocated osd_work_queue object.
r1185r1186
864884void osd_break_into_debugger(const char *message);
865885
866886
867
868887#endif   /* __OSDEPEND_H__ */
src/osd/windows/winsync.c
r1185r1186
135135//  osd_compare_exchange32
136136//============================================================
137137
138#ifndef osd_compare_exchange32
138139INT32 osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
139140{
140141   return InterlockedCompareExchange((LPLONG)ptr, (LONG)exchange, (LONG)compare);
141142}
143#endif
142144
143145
144146//============================================================
r1185r1186
146148//============================================================
147149
148150#ifdef PTR64
151#ifndef osd_compare_exchange64
149152INT64 osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
150153{
151154   return InterlockedCompareExchange64((LONGLONG*)ptr, (LONGLONG)exchange, (LONGLONG)compare);
152155}
153156#endif
157#endif
src/osd/windows/vconv.c
r1185r1186
9393   { 0,      "-o*",            "/out:*" },
9494   { 0,      "-Wl,-Map,*",      "/map:*" },
9595    { 0,      "-Wl,--allow-multiple-definition", "/force:multiple" },
96   { 0,      "-Wl,--warn-common",   "" },
9697   { 0,      "-mno-cygwin",      "" },
9798   { 0,      "-s",            "" },
9899   { 0,      "-WO",            "" },
src/osd/windows/winwork.c
r1185r1186
3333//  PARAMETERS
3434//============================================================
3535
36#define MAX_THREADS            (16)
3736#define SPIN_LOOP_TIME         (osd_ticks_per_second() / 1000)
3837
3938
r1185r1186
5655#ifdef __GNUC__
5756INLINE void YieldProcessor(void)
5857{
59   __asm__ ( "rep; nop" );
58   __asm__ __volatile__ ( "rep; nop" );
6059}
6160#else
6261INLINE void YieldProcessor(void)
r1185r1186
7776{
7877   struct
7978   {
80      volatile UINT8    haslock;      // do we have the lock?
81      UINT8          filler[63];      // assumes a 64-bit cache line
82   } slot[MAX_THREADS];               // one slot per thread
79      volatile INT32    haslock;      // do we have the lock?
80      INT32          filler[64/4-1];   // assumes a 64-byte cache line
81   } slot[WORK_MAX_THREADS];         // one slot per thread
8382   volatile INT32       nextindex;      // index of next slot to use
8483};
8584
r1185r1186
9089   osd_work_queue *   queue;         // pointer back to the queue
9190   HANDLE            handle;         // handle to the thread
9291   HANDLE            wakeevent;      // wake event for the thread
93   volatile UINT8      active;         // are we actively processing work?
92   volatile INT32      active;         // are we actively processing work?
9493
9594#if KEEP_STATISTICS
95   INT32            itemsdone;
9696   osd_ticks_t         actruntime;
9797   osd_ticks_t         runtime;
9898   osd_ticks_t         spintime;
r1185r1186
109109   osd_work_item * volatile free;      // free list of work items
110110   volatile INT32      items;         // items in the queue
111111   volatile INT32      livethreads;   // number of live threads
112   volatile UINT8      waiting;      // is someone waiting on the queue to complete?
112   volatile INT32      waiting;      // is someone waiting on the queue to complete?
113113   volatile UINT8      exiting;      // should the threads exit on their next opportunity?
114114   UINT32            threads;      // number of threads in this queue
115115   UINT32            flags;         // creation flags
r1185r1186
134134   void *            result;         // callback result
135135   HANDLE            event;         // event signalled when complete
136136   UINT32            flags;         // creation flags
137   volatile UINT8      done;         // is the item done?
137   volatile INT32      done;         // is the item done?
138138};
139139
140140
r1185r1186
165165}
166166
167167
168INLINE INT32 interlocked_exchange32(INT32 volatile *ptr, INT32 value)
169{
170   return InterlockedExchange((LPLONG)ptr, value);
171}
172
173
168174INLINE INT32 interlocked_increment(INT32 volatile *ptr)
169175{
170176   return InterlockedIncrement((LPLONG)ptr);
r1185r1186
197203
198204INLINE INT32 scalable_lock_acquire(scalable_lock *lock)
199205{
200   INT32 myslot = (interlocked_increment(&lock->nextindex) - 1) & (MAX_THREADS - 1);
206   INT32 myslot = (interlocked_increment(&lock->nextindex) - 1) & (WORK_MAX_THREADS - 1);
201207   INT32 backoff = 1;
202208
203209   while (!lock->slot[myslot].haslock)
r1185r1186
214220
215221INLINE void scalable_lock_release(scalable_lock *lock, INT32 myslot)
216222{
217   lock->slot[(myslot + 1) & (MAX_THREADS - 1)].haslock = TRUE;
223   interlocked_exchange32(&lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock, TRUE);
218224}
219225
220226
r1185r1186
257263      queue->threads = (flags & WORK_QUEUE_FLAG_MULTI) ? (numprocs - 1) : 1;
258264
259265   // clamp to the maximum
260   queue->threads = MIN(queue->threads, MAX_THREADS);
266   queue->threads = MIN(queue->threads, WORK_MAX_THREADS);
261267
262268   // allocate memory for thread array (+1 to count the calling thread)
263269   queue->thread = malloc((queue->threads + 1) * sizeof(queue->thread[0]));
r1185r1186
339345      // process what we can as a worker thread
340346      worker_thread_process(queue, thread);
341347
342      // spin until we're done
343      begin_timing(thread->spintime);
344      while (queue->items != 0 && osd_ticks() < stopspin)
345         YieldProcessor();
346      end_timing(thread->spintime);
348      // if we're a high frequency queue, spin until done
349      if (queue->flags & WORK_QUEUE_FLAG_HIGH_FREQ)
350      {
351         // spin until we're done
352         begin_timing(thread->spintime);
353         while (queue->items != 0 && osd_ticks() < stopspin)
354            YieldProcessor();
355         end_timing(thread->spintime);
347356
357         begin_timing(thread->waittime);
358         return (queue->items == 0);
359      }
348360      begin_timing(thread->waittime);
349      return (queue->items == 0);
350361   }
351362
352363   // reset our done event and double-check the items before waiting
353364   ResetEvent(queue->doneevent);
354   queue->waiting = TRUE;
365   interlocked_exchange32(&queue->waiting, TRUE);
355366   if (queue->items != 0)
356367      WaitForSingleObject(queue->doneevent, timeout * 1000 / osd_ticks_per_second());
357   queue->waiting = FALSE;
368   interlocked_exchange32(&queue->waiting, FALSE);
358369
359370   // return TRUE if we actually hit 0
360371   return (queue->items == 0);
r1185r1186
407418      {
408419         thread_info *thread = &queue->thread[threadnum];
409420         osd_ticks_t total = thread->runtime + thread->waittime + thread->spintime;
410         printf("Thread %d:  run=%5.2f%% (%5.2f%%)  spin=%5.2f%%  wait/other=%5.2f%%\n",
411               threadnum,
421         printf("Thread %d:  items=%9d  run=%5.2f%% (%5.2f%%)  spin=%5.2f%%  wait/other=%5.2f%%\n",
422               threadnum, thread->itemsdone,
412423               (double)thread->runtime * 100.0 / (double)total,
413424               (double)thread->actruntime * 100.0 / (double)total,
414425               (double)thread->spintime * 100.0 / (double)total,
r1185r1186
626637   // otherwise, fetch the info from the system
627638   GetSystemInfo(&info);
628639
629   // max out at 2 for now since scaling above that seems to do poorly
630   return MIN(info.dwNumberOfProcessors, 2);
640   // max out at 4 for now since scaling above that seems to do poorly
641   return MIN(info.dwNumberOfProcessors, 4);
631642}
632643
633644
r1185r1186
657668         break;
658669
659670      // indicate that we are live
660      thread->active = TRUE;
671      interlocked_exchange32(&thread->active, TRUE);
661672      interlocked_increment(&queue->livethreads);
662673
663674      // process work items
r1185r1186
668679         // process as much as we can
669680         worker_thread_process(queue, thread);
670681
671         // spin for a while looking for more work
672         begin_timing(thread->spintime);
673         stopspin = osd_ticks() + SPIN_LOOP_TIME;
674         while (queue->list == NULL && osd_ticks() < stopspin)
675            YieldProcessor();
676         end_timing(thread->spintime);
682         // if we're a high frequency queue, spin for a while before giving up
683         if (queue->flags & WORK_QUEUE_FLAG_HIGH_FREQ)
684         {
685            // spin for a while looking for more work
686            begin_timing(thread->spintime);
687            stopspin = osd_ticks() + SPIN_LOOP_TIME;
688            while (queue->list == NULL && osd_ticks() < stopspin)
689               YieldProcessor();
690            end_timing(thread->spintime);
691         }
677692
678693         // if nothing more, release the processor
679694         if (queue->list == NULL)
r1185r1186
682697      }
683698
684699      // decrement the live thread count
685      thread->active = FALSE;
700      interlocked_exchange32(&thread->active, FALSE);
686701      interlocked_decrement(&queue->livethreads);
687702   }
688703   return 0;
r1185r1186
695710
696711static void worker_thread_process(osd_work_queue *queue, thread_info *thread)
697712{
713   int threadid = thread - queue->thread;
714
698715   begin_timing(thread->runtime);
699716
700717   // loop until everything is processed
r1185r1186
722739      {
723740         // call the callback and stash the result
724741         begin_timing(thread->actruntime);
725         item->result = (*item->callback)(item->param);
742         item->result = (*item->callback)(item->param, threadid);
726743         end_timing(thread->actruntime);
727744
728745         // decrement the item count after we are done
729746         interlocked_decrement(&queue->items);
730         item->done = TRUE;
747         interlocked_exchange32(&item->done, TRUE);
748         add_to_stat(&thread->itemsdone, 1);
731749
732750         // if it's an auto-release item, release it
733751         if (item->flags & WORK_ITEM_FLAG_AUTO_RELEASE)
src/osd/windows/debugwin.c
r1185r1186
25962596   info->minwidth = 0;
25972597   info->maxwidth = 0;
25982598   for (cpunum = MAX_CPU - 1; (INT32)cpunum >= 0; cpunum--)
2599      if (Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY)
2599      if (Machine->drv->cpu[cpunum].type != CPU_DUMMY)
26002600      {
26012601         UINT32 regchars, dischars, conchars;
26022602         UINT32 minwidth, maxwidth;
src/osd/windows/osinline.h
r1185r1186
1414
1515
1616//============================================================
17//  INLINE FUNCTIONS
17//  INLINE MATH FUNCTIONS
1818//============================================================
1919
2020#if defined(_MSC_VER) && defined(_M_IX86) && !defined(PTR64)
r1185r1186
3434    return result;
3535}
3636
37
38
39c:\Program Files (x86)\Microsoft Visual Studio 8\VC\include
40
3741#elif defined(__GNUC__) && !defined(PTR64)
3842
3943// GCC, x86, 32-bit
r1185r1186
6468
6569#endif // defined(_MSC_VER) && defined(_M_IX86) && !defined(PTR64)
6670
71
72
73//============================================================
74//  INLINE SYNCHRONIZATION FUNCTIONS
75//============================================================
76
77#if defined(_MSC_VER)
78
79// Microsoft Visual C
80#include <intrin.h>
81
82#pragma intrinsic(_InterlockedCompareExchange)
83#pragma intrinsic(_InterlockedCompareExchange64)
84#pragma intrinsic(_InterlockedExchangeAdd)
85
86#define osd_compare_exchange32 _osd_compare_exchange32
87INLINE INT32 _osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
88{
89   return _InterlockedCompareExchange(ptr, exchange, compare);
90}
91
92#ifdef PTR64
93#define osd_compare_exchange64 _osd_compare_exchange64
94INLINE INT64 _osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
95{
96   return _InterlockedCompareExchange64(ptr, exchange, compare);
97}
98#endif
99
100#define osd_sync_add _osd_sync_add
101INLINE INT32 osd_sync_add(INT32 volatile *ptr, INT32 delta)
102{
103   return _InterlockedExchangeAdd(ptr, delta) + delta;
104}
105
106#elif defined(__GNUC__) && !defined(PTR64)
107
108// need to copy this from the SDL implementation
109
110#endif
111
112
113
67114#endif /* __OSINLINE__ */
src/osd/winui/m32util.c
r1185r1186
363363         
364364         if (HAS_SAMPLES || HAS_VLM5030)
365365         {
366            for (i = 0; drv.sound[i].sound_type && i < MAX_SOUND; i++)
366            for (i = 0; drv.sound[i].type && i < MAX_SOUND; i++)
367367            {
368368               const char **samplenames = NULL;
369369               
370370#if (HAS_SAMPLES || HAS_VLM5030)
371               for( i = 0; drv.sound[i].sound_type && i < MAX_SOUND; i++ )
371               for( i = 0; drv.sound[i].type && i < MAX_SOUND; i++ )
372372               {
373373#if (HAS_SAMPLES)
374                  if( drv.sound[i].sound_type == SOUND_SAMPLES )
374                  if( drv.sound[i].type == SOUND_SAMPLES )
375375                     samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames;
376376#endif
377377               }
src/osd/winui/win32ui.c
r1185r1186
50855085
50865086static int GamePicker_Compare(HWND hwndPicker, int index1, int index2, int sort_subitem)
50875087{
5088   int value;
5088   int value = 0;  /* Default to 0, for unknown case */
50895089   const char *name1 = NULL;
50905090   const char *name2 = NULL;
50915091   int nTemp1, nTemp2;
r1185r1186
51055105   switch (sort_subitem)
51065106   {
51075107   case COLUMN_GAMES:
5108      value = mame_stricmp(ModifyThe(drivers[index1]->description),
5108      return mame_stricmp(ModifyThe(drivers[index1]->description),
51095109                  ModifyThe(drivers[index2]->description));
51105110      break;
51115111
r1185r1186
51355135      }
51365136
51375137      // ok, both are known
5138
51395138      if (IsAuditResultYes(nTemp1) && IsAuditResultYes(nTemp2))
51405139         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
51415140     
r1185r1186
51785177         else
51795178            nTemp2 = 2;
51805179      }
5181
5182      if (nTemp1 == nTemp2)
5183         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5184
51855180      value = nTemp2 - nTemp1;
51865181      break;
51875182
r1185r1186
51905185      break;
51915186
51925187      case COLUMN_SRCDRIVERS:
5193      if (mame_stricmp(drivers[index1]->source_file+12, drivers[index2]->source_file+12) == 0)
5194         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5195
5196      value = mame_stricmp(drivers[index1]->source_file+12, drivers[index2]->source_file+12);
5188      value = mame_stricmp(drivers[index1]->source_file, drivers[index2]->source_file);
51975189      break;
5190
51985191   case COLUMN_PLAYTIME:
51995192      value = GetPlayTime(index1) - GetPlayTime(index2);
5200      if (value == 0)
5201        return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5202
52035193      break;
52045194
52055195   case COLUMN_TYPE:
r1185r1186
52085198        expand_machine_driver(drivers[index1]->drv,&drv1);
52095199        expand_machine_driver(drivers[index2]->drv,&drv2);
52105200
5211      if ((drv1.video_attributes & VIDEO_TYPE_VECTOR) ==
5212         (drv2.video_attributes & VIDEO_TYPE_VECTOR))
5213         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5214
52155201      value = (drv1.video_attributes & VIDEO_TYPE_VECTOR) -
52165202            (drv2.video_attributes & VIDEO_TYPE_VECTOR);
52175203      break;
52185204    }
52195205   case COLUMN_TRACKBALL:
5220      if (DriverUsesTrackball(index1) == DriverUsesTrackball(index2))
5221         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5222
52235206      value = DriverUsesTrackball(index1) - DriverUsesTrackball(index2);
52245207      break;
52255208
52265209   case COLUMN_PLAYED:
52275210      value = GetPlayCount(index1) - GetPlayCount(index2);
5228      if (value == 0)
5229        return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5230
52315211      break;
52325212
52335213   case COLUMN_MANUFACTURER:
5234      if (mame_stricmp(drivers[index1]->manufacturer, drivers[index2]->manufacturer) == 0)
5235         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5236
52375214      value = mame_stricmp(drivers[index1]->manufacturer, drivers[index2]->manufacturer);
52385215      break;
52395216
52405217   case COLUMN_YEAR:
5241      if (mame_stricmp(drivers[index1]->year, drivers[index2]->year) == 0)
5242         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5243
52445218      value = mame_stricmp(drivers[index1]->year, drivers[index2]->year);
52455219      break;
52465220
r1185r1186
52535227      if (*name2 == '\0')
52545228         name2 = NULL;
52555229
5256      if (name1 == name2)
5257         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5258
5259      if (name2 == NULL)
5230      if (NULL == name1 && NULL == name2)
5231         value = 0;
5232      else if (name2 == NULL)
52605233         value = -1;
52615234      else if (name1 == NULL)
52625235         value = 1;
52635236      else
52645237         value = mame_stricmp(name1, name2);
52655238      break;
5266
5267   default :
5268      return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
52695239   }
52705240
5241   // Handle same comparisons here
5242   if (0 == value && COLUMN_GAMES != sort_subitem)
5243   {
5244      value = GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5245   }
52715246#ifdef DEBUG
52725247   if ((strcmp(drivers[index1]->name,"1941") == 0 && strcmp(drivers[index2]->name,"1942") == 0) ||
52735248      (strcmp(drivers[index1]->name,"1942") == 0 && strcmp(drivers[index2]->name,"1941") == 0))
src/osd/winui/mkhelp.c
r1185r1186
1515int compare( const void *arg1, const void *arg2 );
1616void extract_help_ids(const char *buffer, FILE *fp);
1717 
18#ifdef main
19#undef main
20#endif
21 
2218/*-------------------------------------------------
2319    main - primary entry point
2420-------------------------------------------------*/
src/osd/winui/winui.mak
r1185r1186
105105RC = @$(VCONV) windres
106106 
107107# make sure we use the multithreaded runtime
108ifdef DEBUG
109CC += /MTd
110else
108111CC += /MT
112endif
109113 
110114# turn on link-time codegen if the MAXOPT flag is also set
111115ifdef MAXOPT
r1185r1186
160164 
161165# debug build: enable guard pages on all memory allocations
162166ifdef DEBUG
163DEFS += -DMALLOC_DEBUG
167#DEFS += -DMALLOC_DEBUG
164168LDFLAGS += -Wl,--allow-multiple-definition
165169endif
166170 
r1185r1186
323327   $(UIOBJ)/mkhelp$(EXE) $(UISRC)/mame32.rc >$@
324328 
325329# rule to build the generator
326$(UIOBJ)/mkhelp$(EXE): $(UIOBJ)/mkhelp.o
330$(UIOBJ)/mkhelp$(EXE): $(UIOBJ)/mkhelp.o $(LIBOCORE)
327331   @echo Linking $@...
328332   $(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@
329333 
src/osd/winui/treeview.c
r1185r1186
915915      machine_config drv;
916916      expand_machine_driver(drivers[jj]->drv,&drv);
917917      for (n = 0; n < MAX_CPU; n++)
918         if (drv.cpu[n].cpu_type != CPU_DUMMY)
918         if (drv.cpu[n].type != CPU_DUMMY)
919919         {
920920            // cpu type #'s are one-based
921            AddGame(map[drv.cpu[n].cpu_type],jj);
921            AddGame(map[drv.cpu[n].type],jj);
922922         }
923923   }
924924}
r1185r1186
968968      expand_machine_driver(drivers[jj]->drv,&drv);
969969      // Additional range and null checking.
970970      for (n = 0; n < MAX_SOUND ; n++)
971         if (drv.sound[n].sound_type > SOUND_DUMMY &&
972            drv.sound[n].sound_type < MAX_SOUND)
971         if (drv.sound[n].type > SOUND_DUMMY &&
972            drv.sound[n].type < MAX_SOUND)
973973         {
974            if (map[drv.sound[n].sound_type] != NULL) {
974            if (map[drv.sound[n].type] != NULL) {
975975               // sound type #'s are one-based, though that doesn't affect us here
976               AddGame(map[drv.sound[n].sound_type],jj);
976               AddGame(map[drv.sound[n].type],jj);
977977            }
978978         }
979979   }
src/osd/winui/properties.c
r1185r1186
578578   cpuintrf_init(NULL);
579579
580580   i = 0;
581   while (i < MAX_CPU && drv.cpu[i].cpu_type)
581   while (i < MAX_CPU && drv.cpu[i].type)
582582   {
583      if (drv.cpu[i].cpu_clock >= 1000000)
583      if (drv.cpu[i].clock >= 1000000)
584584         sprintf(&buf[strlen(buf)], "%s %d.%06d MHz",
585               cputype_name(drv.cpu[i].cpu_type),
586               drv.cpu[i].cpu_clock / 1000000,
587               drv.cpu[i].cpu_clock % 1000000);
585               cputype_name(drv.cpu[i].type),
586               drv.cpu[i].clock / 1000000,
587               drv.cpu[i].clock % 1000000);
588588      else
589589         sprintf(&buf[strlen(buf)], "%s %d.%03d kHz",
590               cputype_name(drv.cpu[i].cpu_type),
591               drv.cpu[i].cpu_clock / 1000,
592               drv.cpu[i].cpu_clock % 1000);
590               cputype_name(drv.cpu[i].type),
591               drv.cpu[i].clock / 1000,
592               drv.cpu[i].clock % 1000);
593593
594594      strcat(buf, "\n");
595595
r1185r1186
610610   buf[0] = 0;
611611
612612   i = 0;
613   while (i < MAX_SOUND && drv.sound[i].sound_type)
613   while (i < MAX_SOUND && drv.sound[i].type)
614614   {
615615      int clock,sound_type,count;
616616
617      sound_type = drv.sound[i].sound_type;
617      sound_type = drv.sound[i].type;
618618      clock = drv.sound[i].clock;
619619
620620      count = 1;
621621      i++;
622622
623623      while (i < MAX_SOUND
624            && drv.sound[i].sound_type == sound_type
624            && drv.sound[i].type == sound_type
625625            && drv.sound[i].clock == clock)
626626      {
627627         count++;
r1185r1186
23612361      {
23622362         if (nIndex <= -1
23632363#if HAS_YM3812
2364         ||  drv.sound[i].sound_type == SOUND_YM3812
2364         ||  drv.sound[i].type == SOUND_YM3812
23652365#endif
23662366#if HAS_YM3526
2367         ||  drv.sound[i].sound_type == SOUND_YM3526
2367         ||  drv.sound[i].type == SOUND_YM3526
23682368#endif
23692369#if HAS_YM2413
2370         ||  drv.sound[i].sound_type == SOUND_YM2413
2370         ||  drv.sound[i].type == SOUND_YM2413
23712371#endif
23722372         )
23732373            enabled = TRUE;
r1185r1186
23952395      for (i = 0; i < MAX_SOUND; i++)
23962396      {
23972397         if (nIndex <= -1
2398         ||  drv.sound[i].sound_type == SOUND_SAMPLES
2398         ||  drv.sound[i].type == SOUND_SAMPLES
23992399#if HAS_VLM5030
2400         ||  drv.sound[i].sound_type == SOUND_VLM5030
2400         ||  drv.sound[i].type == SOUND_VLM5030
24012401#endif
24022402         )
24032403            enabled = TRUE;
src/emu/debug/debugcpu.c
r1185r1186
194194   /* loop over CPUs and build up their info */
195195   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
196196   {
197      int cputype = Machine->drv->cpu[cpunum].cpu_type;
197      cpu_type cputype = Machine->drv->cpu[cpunum].type;
198198
199199      /* if this is a dummy, stop looking */
200200      if (cputype == CPU_DUMMY)
src/emu/cpu/v30mz/v30mz.c
r1185r1186
8686
8787static nec_Regs I;
8888
89static UINT32 cpu_type;
89static UINT32 chip_type;
9090static UINT32 prefix_base;   /* base address of the latest prefix segment */
9191static char seg_prefix;      /* prefix segment indicator */
9292
r1185r1186
953953int v30mz_execute(int cycles)
954954{
955955   nec_ICount=cycles;
956   cpu_type=V30MZ;
956   chip_type=V30MZ;
957957
958958   while(nec_ICount>0) {
959959      /* Dispatch IRQ */
src/emu/cpu/v30mz/v30mz.h
r1185r1186
151151   {                              \
152152      static const UINT8 table[3]={3,10,10};    \
153153      I.ip = (WORD)(I.ip+tmp);         \
154      nec_ICount-=table[cpu_type/8];      \
154      nec_ICount-=table[chip_type/8];      \
155155      CHANGE_PC;                     \
156156      return;                        \
157157   }
r1185r1186
283283   if (seg_prefix) logerror("%06x: Warning: seg_prefix defined for add4s\n",activecpu_get_pc());   \
284284   I.ZeroVal = I.CarryVal = 0;                        \
285285   for (i=0;i<count;i++) {                           \
286      nec_ICount-=table[cpu_type/8];                  \
286      nec_ICount-=table[chip_type/8];                  \
287287      tmp = GetMemB(DS, si);                        \
288288      tmp2 = GetMemB(ES, di);                        \
289289      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
r1185r1186
308308   if (seg_prefix) logerror("%06x: Warning: seg_prefix defined for sub4s\n",activecpu_get_pc());   \
309309   I.ZeroVal = I.CarryVal = 0;                        \
310310   for (i=0;i<count;i++) {                           \
311      nec_ICount-=table[cpu_type/8];                  \
311      nec_ICount-=table[chip_type/8];                  \
312312      tmp = GetMemB(ES, di);                        \
313313      tmp2 = GetMemB(DS, si);                        \
314314      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
r1185r1186
338338   if (seg_prefix) logerror("%06x: Warning: seg_prefix defined for cmp4s\n",activecpu_get_pc());   \
339339   I.ZeroVal = I.CarryVal = 0;                        \
340340   for (i=0;i<count;i++) {                           \
341      nec_ICount-=table[cpu_type/8];                  \
341      nec_ICount-=table[chip_type/8];                  \
342342      tmp = GetMemB(ES, di);                        \
343343      tmp2 = GetMemB(DS, si);                        \
344344      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
src/emu/cpu/adsp2100/adsp2100.c
r1185r1186
989989            {
990990               if (CONDITION(op & 15))
991991               {
992                  switch ((op >> 4) & 3)
993                  {
994                     case 1:   adsp2100.flagout = !adsp2100.flagout;
995                     case 2: adsp2100.flagout = 0;
996                     case 3: adsp2100.flagout = 1;
997                  }
992                  if (op & 0x020) adsp2100.flagout = 0;
993                  if (op & 0x010) adsp2100.flagout ^= 1;
998994                  if (chip_type >= CHIP_TYPE_ADSP2101)
999995                  {
1000                     switch ((op >> 6) & 3)
1001                     {
1002                        case 1:   adsp2100.fl0 = !adsp2100.fl0;
1003                        case 2: adsp2100.fl0 = 0;
1004                        case 3: adsp2100.fl0 = 1;
1005                     }
1006                     switch ((op >> 8) & 3)
1007                     {
1008                        case 1:   adsp2100.fl1 = !adsp2100.fl1;
1009                        case 2: adsp2100.fl1 = 0;
1010                        case 3: adsp2100.fl1 = 1;
1011                     }
1012                     switch ((op >> 10) & 3)
1013                     {
1014                        case 1:   adsp2100.fl2 = !adsp2100.fl2;
1015                        case 2: adsp2100.fl2 = 0;
1016                        case 3: adsp2100.fl2 = 1;
1017                     }
996                     if (op & 0x080) adsp2100.fl0 = 0;
997                     if (op & 0x040) adsp2100.fl0 ^= 1;
998                     if (op & 0x200) adsp2100.fl1 = 0;
999                     if (op & 0x100) adsp2100.fl1 ^= 1;
1000                     if (op & 0x800) adsp2100.fl2 = 0;
1001                     if (op & 0x400) adsp2100.fl2 ^= 1;
10181002                  }
10191003               }
10201004            }
src/emu/cpu/m6502/mincce02.h
r0r1186
1/*****************************************************************************
2 *
3 *   mincce02.h
4 *   Base macros for 65ce02 CPU files
5 *
6 *****************************************************************************/
7
8/* 65ce02 flags */
9#define F_C   0x01
10#define F_Z   0x02
11#define F_I   0x04
12#define F_D   0x08
13#define F_B   0x10
14#define F_E   0x20
15#define F_V   0x40
16#define F_N   0x80
17
18/* some shortcuts for improved readability */
19#define A   m65ce02.a
20#define X   m65ce02.x
21#define Y   m65ce02.y
22#define P   m65ce02.p
23#define Z   m65ce02.z
24#define B   m65ce02.zp.b.h
25#define SW   m65ce02.sp.w.l
26#define SPL   m65ce02.sp.b.l
27#define SPH   m65ce02.sp.b.h
28#define SPD   m65ce02.sp.d
29
30#define NZ   m65ce02.nz
31
32#define EAL   m65ce02.ea.b.l
33#define EAH   m65ce02.ea.b.h
34#define EAW   m65ce02.ea.w.l
35#define EAD   m65ce02.ea.d
36
37#define ZPL   m65ce02.zp.b.l
38#define ZPH   m65ce02.zp.b.h
39#define ZPW   m65ce02.zp.w.l
40#define ZPD   m65ce02.zp.d
41
42#define PCL   m65ce02.pc.b.l
43#define PCH   m65ce02.pc.b.h
44#define PCW   m65ce02.pc.w.l
45#define PCD   m65ce02.pc.d
46
47#define PPC   m65ce02.ppc.d
48
49#define RDMEM_ID   m65ce02.rdmem_id
50#define WRMEM_ID   m65ce02.wrmem_id
51
52#define IRQ_STATE   m65ce02.irq_state
53#define AFTER_CLI   m65ce02.after_cli
54
55#define CHANGE_PC   change_pc(PCD)
56
57/***************************************************************
58 *  RDOP    read an opcode
59 ***************************************************************/
60#define RDOP()   cpu_readop(PCW++); m65ce02_ICount -= 1
61
62/***************************************************************
63 *  RDOPARG read an opcode argument
64 ***************************************************************/
65#define RDOPARG()   cpu_readop_arg(PCW++); m65ce02_ICount -= 1
66
67#define PEEK_OP()   cpu_readop(PCW)
68
69#define RDMEM(addr)         program_read_byte_8(addr); m65ce02_ICount -= 1
70#define WRMEM(addr,data)   program_write_byte_8(addr,data); m65ce02_ICount -= 1
71
src/emu/cpu/m6502/minc4510.h
r0r1186
1/*****************************************************************************
2 *
3 *   minc4510.h
4 *   Base macros for 4510 CPU files
5 *
6 *****************************************************************************/
7
8/* 4510 flags */
9#define F_C   0x01
10#define F_Z   0x02
11#define F_I   0x04
12#define F_D   0x08
13#define F_B   0x10
14#define F_E   0x20
15#define F_V   0x40
16#define F_N   0x80
17
18/* some shortcuts for improved readability */
19#define A   m4510.a
20#define X   m4510.x
21#define Y   m4510.y
22#define P   m4510.p
23#define Z   m4510.z
24#define B   m4510.zp.b.h
25#define SW   m4510.sp.w.l
26#define SPL   m4510.sp.b.l
27#define SPH   m4510.sp.b.h
28#define SPD   m4510.sp.d
29
30#define NZ   m4510.nz
31
32#define EAL   m4510.ea.b.l
33#define EAH   m4510.ea.b.h
34#define EAW   m4510.ea.w.l
35#define EAD   m4510.ea.d
36
37#define ZPL   m4510.zp.b.l
38#define ZPH   m4510.zp.b.h
39#define ZPW   m4510.zp.w.l
40#define ZPD   m4510.zp.d
41
42#define PCL   m4510.pc.b.l
43#define PCH   m4510.pc.b.h
44#define PCW   m4510.pc.w.l
45#define PCD   m4510.pc.d
46
47#define PPC   m4510.ppc.d
48
49#define IRQ_STATE   m4510.irq_state
50#define AFTER_CLI   m4510.after_cli
51
52#define M4510_MEM(addr)   (m4510.mem[(addr)>>13]+(addr))
53
54#define CHANGE_PC   change_pc(M4510_MEM(PCD))
55
56#define PEEK_OP()   cpu_readop(M4510_MEM(PCD))
57
58#define RDMEM(addr)         program_read_byte_8(addr); m4510_ICount -= 1
59#define WRMEM(addr,data)   program_write_byte_8(addr,data); m4510_ICount -= 1
60
61/***************************************************************
62 *  RDOP    read an opcode
63 ***************************************************************/
64#undef RDOP
65#define RDOP() m4510_cpu_readop(); m4510_ICount -= 1
66
67/***************************************************************
68 *  RDOPARG read an opcode argument
69 ***************************************************************/
70#undef RDOPARG
71#define RDOPARG() m4510_cpu_readop_arg(); m4510_ICount -= 1
72
src/emu/cpu/m6502/m4510.c
r1185r1186
104104#include "m6502.h"
105105#include "m4510.h"
106106
107#include "minc4510.h"
107108#include "opsce02.h"
108109#include "ops4510.h"
109110
src/emu/cpu/m6502/ops4510.h
r1185r1186
2222 *
2323 *****************************************************************************/
2424
25#define m65ce02 m4510
26#define m65ce02_ICount m4510_ICount
27
28#define M4510_MEM(addr) (m4510.mem[(addr)>>13]+(addr))
29
30#undef CHANGE_PC
31#define CHANGE_PC change_pc(M4510_MEM(PCD))
32
33/***************************************************************
34 *  RDOP    read an opcode
25/* 65ce02 ********************************************************
26 * TXS  Transfer index X to stack LSB
27 * no flags changed (sic!)
28 * txs tys not interruptable
3529 ***************************************************************/
36#undef RDOP
37#define RDOP() m4510_cpu_readop()
30#undef TXS
31#define TXS                        \
32   SPL = X;                     \
33   if (PEEK_OP() == 0x2b /*TYS*/ ) {   \
34      UINT8 op = RDOP();            \
35      (*m4510.insn[op])();         \
36   }
3837
39/***************************************************************
40 *  RDOPARG read an opcode argument
41 ***************************************************************/
42#undef RDOPARG
43#define RDOPARG() m4510_cpu_readop_arg()
44
45/***************************************************************
46 *  RDMEM   read memory
47 ***************************************************************/
48#undef RDMEM
49#undef RDMEM_ID
50#define RDMEM(addr) program_read_byte_8(M4510_MEM(addr))
51#define RDMEM_ID(addr) RDMEM(addr)
52
53/***************************************************************
54 *  WRMEM   write memory
55 ***************************************************************/
56#undef WRMEM
57#undef WRMEM_ID
58#define WRMEM(addr,data) program_write_byte_8(M4510_MEM(addr),data)
59#define WRMEM_ID(addr,data) WRMEM(addr,data)
60
6138/* c65 docu says transfer of axyz to the mapper register
6239   so no readback!? */
6340#define MAP                                        \
r1185r1186
9269  m4510.mem[7]=(m4510.high&0x8000) ? (m4510.high&0xfff)<<8:0; \
9370  CHANGE_PC; \
9471 } \
72   m4510_ICount -= 3; \
9573 { \
9674            UINT8 op = RDOP();                        \
97            (*m65ce02.insn[op])();                     \
75            (*m4510.insn[op])();                     \
9876 } \
9977
src/emu/cpu/m6502/opsce02.h
r1185r1186
2222 *
2323 *****************************************************************************/
2424
25/* 65ce02 flags */
26#define F_C 0x01
27#define F_Z 0x02
28#define F_I 0x04
29#define F_D 0x08
30#define F_B 0x10
31#define F_E 0x20
32#define F_V 0x40
33#define F_N 0x80
34
35/* some shortcuts for improved readability */
36#define A   m65ce02.a
37#define X   m65ce02.x
38#define Y   m65ce02.y
39#define P   m65ce02.p
40#define Z   m65ce02.z
41#define B   m65ce02.zp.b.h
42#define SW   m65ce02.sp.w.l
43#define SPL   m65ce02.sp.b.l
44#define SPH   m65ce02.sp.b.h
45#define SPD   m65ce02.sp.d
46
47#define NZ   m65ce02.nz
48
49#define EAL   m65ce02.ea.b.l
50#define EAH   m65ce02.ea.b.h
51#define EAW   m65ce02.ea.w.l
52#define EAD   m65ce02.ea.d
53
54#define ZPL   m65ce02.zp.b.l
55#define ZPH   m65ce02.zp.b.h
56#define ZPW   m65ce02.zp.w.l
57#define ZPD   m65ce02.zp.d
58
59#define PCL   m65ce02.pc.b.l
60#define PCH   m65ce02.pc.b.h
61#define PCW   m65ce02.pc.w.l
62#define PCD   m65ce02.pc.d
63
64#define PPC   m65ce02.ppc.d
65
66#define RDMEM_ID   m65ce02.rdmem_id
67#define WRMEM_ID   m65ce02.wrmem_id
68
6925#define SET_NZ(n)   if ((n) == 0) P = (P & ~F_N) | F_Z; else P = (P & ~(F_N | F_Z)) | ((n) & F_N)
7026#define SET_Z(n)   if ((n) == 0) P |= F_Z; else P &= ~F_Z
7127
72#define CHANGE_PC   change_pc(PCD)
73
74#define PEEK_OP() cpu_readop(PCW)
75
76#define RDMEM(addr)      program_read_byte_8(addr); m65ce02_ICount -= 1
77#define WRMEM(addr,data)   program_write_byte_8(addr,data); m65ce02_ICount -= 1
78
7928#define RDMEM_WORD(addr, pair)   pair.b.l=RDMEM( addr ); pair.b.h=RDMEM( (addr+1) & 0xffff )
8029#define WRMEM_WORD(addr,pair)   WRMEM(addr,pair.b.l); WRMEM((addr+1)&0xffff,pair.b.h)
8130
r1185r1186
437386 * CLI  Clear interrupt flag
438387 ***************************************************************/
439388#define CLI                              \
440   if ((m65ce02.irq_state != CLEAR_LINE) && (P & F_I)) {            \
441      m65ce02.after_cli = 1;                     \
389   if ((IRQ_STATE != CLEAR_LINE) && (P & F_I)) {            \
390      AFTER_CLI = 1;                     \
442391   }                              \
443392   P &= ~F_I
444393
r1185r1186
726675      UINT8 temp;                        \
727676      PULL(temp);                        \
728677      P=(P&F_E)|F_B|(temp&~F_E);                  \
729      if( m65ce02.irq_state != CLEAR_LINE && !(P & F_I) ) {         \
678      if( IRQ_STATE != CLEAR_LINE && !(P & F_I) ) {         \
730679         LOG(("M65ce02#%d PLP sets after_cli\n", cpu_getactivecpu()));   \
731         m65ce02.after_cli = 1;                  \
680         AFTER_CLI = 1;                  \
732681      }                           \
733682   } else {                           \
734683      UINT8 temp;                        \
r1185r1186
805754   P = (P&F_E)|F_B|(tmp&~F_E);                     \
806755   PULL(PCL);                           \
807756   PULL(PCH);                           \
808   if( m65ce02.irq_state != CLEAR_LINE && !(P & F_I) )            \
757   if( IRQ_STATE != CLEAR_LINE && !(P & F_I) )            \
809758   {                              \
810759      LOG(("M65ce02#%d RTI sets after_cli\n", cpu_getactivecpu()));      \
811      m65ce02.after_cli = 1;                     \
760      AFTER_CLI = 1;                     \
812761   }                              \
813762   CHANGE_PC
814763
r1185r1186
839788   P = (P&F_E)|F_B|(tmp&~F_E);                     \
840789   PULL(PCL);                           \
841790   PULL(PCH);                           \
842   if( m65ce02.irq_state != CLEAR_LINE && !(P & F_I) ) {            \
791   if( IRQ_STATE != CLEAR_LINE && !(P & F_I) ) {            \
843792   LOG(("M65ce02#%d RTI sets after_cli\n", cpu_getactivecpu()));         \
844      m65ce02.after_cli = 1;                     \
793      AFTER_CLI = 1;                     \
845794   }                              \
846795   CHANGE_PC
847796
src/emu/cpu/m6502/m65ce02.c
r1185r1186
4040#include "debugger.h"
4141#include "m65ce02.h"
4242
43#include "ops02.h"
44#include "opsc02.h"
43#include "mincce02.h"
4544#include "opsce02.h"
4645
4746#define VERBOSE 0
src/emu/cpu/m6502/t6509.c
r1185r1186
5757OP(31) { int tmp; RD_IDY_P; AND;               } /* 5 AND IDY page penalty */
5858OP(51) { int tmp; RD_IDY_P; EOR;               } /* 5 EOR IDY page penalty */
5959OP(71) { int tmp; RD_IDY_P; ADC;               } /* 5 ADC IDY page penalty */
60OP(91) { int tmp; STA; WR_IDY_NP;              } /* 6 STA IDY */
61OP(b1) { int tmp; RD_IDY_P; LDA;               } /* 5 LDA IDY page penalty */
60OP(91) { int tmp; STA; WR_IDY_6509;              } /* 6 STA IDY */
61OP(b1) { int tmp; RD_IDY_6509; LDA;               } /* 5 LDA IDY page penalty */
6262OP(d1) { int tmp; RD_IDY_P; CMP;               } /* 5 CMP IDY page penalty */
6363OP(f1) { int tmp; RD_IDY_P; SBC;               } /* 5 SBC IDY page penalty */
6464
src/emu/cpu/m6502/t65ce02.c
r1185r1186
237237OP(6b) { TZA; } /* 1 TZA */
238238OP(8b) { int tmp; STY; WR_ABX; } /* 4 STY ABX */
239239OP(ab) { int tmp; RD_ABS; LDZ; } /* 4 LDZ ABS */
240OP(cb) { PAIR tmp; tmp.d = 0; m65ce02_ICount-=7; RD_ABS_WORD; ASW; WB_EA_WORD;  } /* 7 ASW ABS */
241OP(eb) { PAIR tmp; m65ce02_ICount-=6; RD_ABS_WORD; ROW; WB_EA_WORD;  } /* 6 roW ABS */
240OP(cb) { PAIR tmp; tmp.d = 0; RD_ABS_WORD; ASW; WB_EA_WORD;  } /* 7 ASW ABS */
241OP(eb) { PAIR tmp; RD_ABS_WORD; ROW; WB_EA_WORD;  } /* 6/7? roW ABS */
242242
243243OP(1b) { INZ; } /* 1 INZ */
244244OP(3b) { DEZ; } /* 1 DEZ */
r1185r1186
261261OP(1c) { int tmp; RD_ABS; TRB; WB_EA;  } /* 5 TRB ABS */
262262OP(3c) { int tmp; RD_ABX; RD_DUM; BIT;        } /* 5 BIT ABX */
263263#ifdef M4510
264OP(5c) {        m65ce02_ICount-=4;      MAP;        } /* ? MAP */
264OP(5c) {        MAP;        } /* 4? MAP */
265265#else
266266OP(5c) { int t1,t2,t3; AUG; } /* 4 AUGMENT/no operation */
267267#endif
src/emu/cpu/nec/nec.c
r1185r1186
166166
167167static nec_Regs I;
168168
169static UINT32 cpu_type;
169static UINT32 chip_type;
170170static UINT32 prefix_base;   /* base address of the latest prefix segment */
171171static char seg_prefix;      /* prefix segment indicator */
172172
r1185r1186
11531153int v20_execute(int cycles)
11541154{
11551155   nec_ICount=cycles;
1156   cpu_type=V20;
1156   chip_type=V20;
11571157
11581158   while(nec_ICount>0) {
11591159      /* Dispatch IRQ */
r1185r1186
11841184}
11851185int v30_execute(int cycles) {
11861186   nec_ICount=cycles;
1187   cpu_type=V30;
1187   chip_type=V30;
11881188
11891189   while(nec_ICount>0) {
11901190      /* Dispatch IRQ */
r1185r1186
12161216int v33_execute(int cycles)
12171217{
12181218   nec_ICount=cycles;
1219   cpu_type=V33;
1219   chip_type=V33;
12201220
12211221   while(nec_ICount>0) {
12221222      /* Dispatch IRQ */
src/emu/cpu/nec/nec.h
r1185r1186
116116*/
117117
118118#define CLK(all) nec_ICount-=all
119#define CLKS(v20,v30,v33) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33; nec_ICount-=(ccount>>cpu_type)&0x7f; }
120#define CLKW(v20o,v30o,v33o,v20e,v30e,v33e,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; nec_ICount-=(addr&1)?((ocount>>cpu_type)&0x7f):((ecount>>cpu_type)&0x7f); }
121#define CLKM(v20,v30,v33,v20m,v30m,v33m) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33, mcount=(v20m<<16)|(v30m<<8)|v33m; nec_ICount-=( ModRM >=0xc0 )?((ccount>>cpu_type)&0x7f):((mcount>>cpu_type)&0x7f); }
122#define CLKR(v20o,v30o,v33o,v20e,v30e,v33e,vall,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; if (ModRM >=0xc0) nec_ICount-=vall; else nec_ICount-=(addr&1)?((ocount>>cpu_type)&0x7f):((ecount>>cpu_type)&0x7f); }
119#define CLKS(v20,v30,v33) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33; nec_ICount-=(ccount>>chip_type)&0x7f; }
120#define CLKW(v20o,v30o,v33o,v20e,v30e,v33e,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; nec_ICount-=(addr&1)?((ocount>>chip_type)&0x7f):((ecount>>chip_type)&0x7f); }
121#define CLKM(v20,v30,v33,v20m,v30m,v33m) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33, mcount=(v20m<<16)|(v30m<<8)|v33m; nec_ICount-=( ModRM >=0xc0 )?((ccount>>chip_type)&0x7f):((mcount>>chip_type)&0x7f); }
122#define CLKR(v20o,v30o,v33o,v20e,v30e,v33e,vall,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; if (ModRM >=0xc0) nec_ICount-=vall; else nec_ICount-=(addr&1)?((ocount>>chip_type)&0x7f):((ecount>>chip_type)&0x7f); }
123123
124124/************************************************************************/
125125#define CompressFlags() (WORD)(CF | (PF << 2) | (AF << 4) | (ZF << 6) \
r1185r1186
162162   {                              \
163163      static const UINT8 table[3]={3,10,10};    \
164164      I.ip = (WORD)(I.ip+tmp);         \
165      nec_ICount-=table[cpu_type/8];      \
165      nec_ICount-=table[chip_type/8];      \
166166      CHANGE_PC;                     \
167167      return;                        \
168168   }
r1185r1186
294294   if (seg_prefix) logerror("%06x: Warning: seg_prefix defined for add4s\n",activecpu_get_pc());   \
295295   I.ZeroVal = I.CarryVal = 0;                        \
296296   for (i=0;i<count;i++) {                           \
297      nec_ICount-=table[cpu_type/8];                  \
297      nec_ICount-=table[chip_type/8];                  \
298298      tmp = GetMemB(DS0, si);                        \
299299      tmp2 = GetMemB(DS1, di);                        \
300300      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
r1185r1186
319319   if (seg_prefix) logerror("%06x: Warning: seg_prefix defined for sub4s\n",activecpu_get_pc());   \
320320   I.ZeroVal = I.CarryVal = 0;                        \
321321   for (i=0;i<count;i++) {                           \
322      nec_ICount-=table[cpu_type/8];                  \
322      nec_ICount-=table[chip_type/8];                  \
323323      tmp = GetMemB(DS1, di);                        \
324324      tmp2 = GetMemB(DS0, si);                        \
325325      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
r1185r1186
349349   if (seg_prefix) logerror("%06x: Warning: seg_prefix defined for cmp4s\n",activecpu_get_pc());   \
350350   I.ZeroVal = I.CarryVal = 0;                        \
351351   for (i=0;i<count;i++) {                           \
352      nec_ICount-=table[cpu_type/8];                  \
352      nec_ICount-=table[chip_type/8];                  \
353353      tmp = GetMemB(DS1, di);                        \
354354      tmp2 = GetMemB(DS0, si);                        \
355355      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
src/emu/cpu/i8051/i8051.c
r1185r1186
464464   24,24,12,24,12,12,12,12,12,12,12,12,12,12,12,12,
465465   24,24,12,24,12,12,12,12,12,12,12,12,12,12,12,12,
466466   24,24,12,24,12,12,12,12,12,12,12,12,12,12,12,12,
467   24,24,24,24,12,24,12,12,24,24,24,24,24,24,24,24,
467   24,24,24,24,12,24,12,12,12,12,12,12,12,12,12,12,
468468   24,24,24,24,48,24,24,24,24,24,24,24,24,24,24,24,
469469   24,24,24,24,12,12,12,12,12,12,12,12,12,12,12,12,
470   24,24,12,24,48,12,24,24,12,12,12,12,12,12,12,12,
470   24,24,12,24,48,12,24,24,24,24,24,24,24,24,24,24,
471471   24,24,12,12,24,24,24,24,24,24,24,24,24,24,24,24,
472472   24,24,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
473473   24,24,12,12,12,24,12,12,24,24,24,24,24,24,24,24,
r1185r1186
19781978   //Update Timer 0
19791979   if(GET_TR0) {
19801980      //Determine Mode
1981      int mode = GET_M0_0 + GET_M0_1;
1981      int mode = (GET_M0_1<<1) | GET_M0_0;
19821982      int overflow;
19831983      UINT16 count = 0;
19841984      switch(mode) {
r1185r1186
20312031            R_TL0 = count & 0xff;
20322032            break;
20332033         case 3:         //Split Timer
2034                //Split Timer 1
2035            overflow = 0xff;
2036            count = R_TL0;
2037            //Check for overflow
2038                if(count+(cyc/12)>overflow) {
2039               count = overflow-count;
2040                    SET_TF0(1);
2041                }
2042            else
2043               count+=(cyc/12);
2044            //Update new values of the counter
2045            R_TL0 = count & 0xff;
2046
2047                //Split Timer 2
2048                if(GET_TR1) {
2049                overflow = 0xff;
2050                count = R_TH0;
2051                //Check for overflow
2052                    if(count+(cyc/12)>overflow) {
2053                   count = overflow-count;
2054                        SET_TF1(1);
2055                    }
2056                else
2057                        count+=(cyc/12);
2058                //Update new values of the counter
2059                R_TH0 = count & 0xff;
2060                }
20342061            break;
20352062      }
20362063   }
r1185r1186
20382065   //Update Timer 1
20392066   if(GET_TR1) {
20402067      //Determine Mode
2041      int mode = GET_M1_0 + GET_M1_1;
2068      int mode = (GET_M1_1<<1) | GET_M1_0;
20422069      int overflow;
20432070      UINT16 count = 0;
20442071      switch(mode) {
r1185r1186
21532180//NOTE: Enable Serial Port Interrupt bit is NOT required to send/receive data!
21542181INLINE void serial_transmit(UINT8 data)
21552182{
2156   int mode = GET_SM0+GET_SM1;
2183   int mode = (GET_SM0<<1) | GET_SM1;
21572184
21582185   //Flag that we're sending data
21592186   uart.sending = 1;
src/emu/cpu/m6800/m6800.c
r1185r1186
112112   PAIR   output_compare;   /* output compare       */
113113   UINT16   input_capture;   /* input capture        */
114114
115   int      clock;
116   UINT8   trcsr, rmcr, rdr, tdr, rsr, tsr;
117   int      rxbits, txbits, txstate, trcsr_read, tx;
118
119115   PAIR   timer_over;
120116}   m6800_Regs;
121117
122118/* 680x registers */
123119static m6800_Regs m6800;
124120
125static mame_timer *m6800_rx_timer;
126static mame_timer *m6800_tx_timer;
127
128121#define m6801   m6800
129122#define m6802   m6800
130123#define m6803   m6800
r1185r1186
204197   SET_TIMER_EVENT;                     \
205198}
206199
207// serial I/O
208
209#define M6800_RMCR_SS_MASK      0x03 // Speed Select
210#define M6800_RMCR_SS_4096      0x03 // E / 4096
211#define M6800_RMCR_SS_1024      0x02 // E / 1024
212#define M6800_RMCR_SS_128      0x01 // E / 128
213#define M6800_RMCR_SS_16      0x00 // E / 16
214#define M6800_RMCR_CC_MASK      0x0c // Clock Control/Format Select
215
216#define M6800_TRCSR_RDRF      0x80 // Receive Data Register Full
217#define M6800_TRCSR_ORFE      0x40 // Over Run Framing Error
218#define M6800_TRCSR_TDRE      0x20 // Transmit Data Register Empty
219#define M6800_TRCSR_RIE      0x10 // Receive Interrupt Enable
220#define M6800_TRCSR_RE         0x08 // Receive Enable
221#define M6800_TRCSR_TIE      0x04 // Transmit Interrupt Enable
222#define M6800_TRCSR_TE         0x02 // Transmit Enable
223#define M6800_TRCSR_WU         0x01 // Wake Up
224
225#define M6800_PORT2_IO4      0x10
226#define M6800_PORT2_IO3      0x08
227
228static const int M6800_RMCR_SS[] = { 16, 128, 1024, 4096 };
229
230#define M6800_SERIAL_START      0
231#define M6800_SERIAL_STOP      9
232
233enum
234{
235   M6800_TX_STATE_INIT = 0,
236   M6800_TX_STATE_READY
237};
238
239200/* take interrupt */
240201#define TAKE_ICI ENTER_INTERRUPT("M6800#%d take ICI\n",0xfff6)
241202#define TAKE_OCI ENTER_INTERRUPT("M6800#%d take OCI\n",0xfff4)
r1185r1186
243204#define TAKE_SCI ENTER_INTERRUPT("M6800#%d take SCI\n",0xfff0)
244205#define TAKE_TRAP ENTER_INTERRUPT("M6800#%d take TRAP\n",0xffee)
245206
207/* check IRQ2 (internal irq) */
208#define CHECK_IRQ2 {                                 \
209   if(m6800.irq2&(TCSR_ICF|TCSR_OCF|TCSR_TOF))               \
210   {                                             \
211      if(m6800.irq2&TCSR_ICF)                           \
212      {                                          \
213         TAKE_ICI;                                 \
214         if( m6800.irq_callback )                     \
215            (void)(*m6800.irq_callback)(M6800_TIN_LINE);   \
216      }                                          \
217      else if(m6800.irq2&TCSR_OCF)                     \
218      {                                          \
219         TAKE_OCI;                                 \
220      }                                          \
221      else if(m6800.irq2&TCSR_TOF)                     \
222      {                                          \
223         TAKE_TOI;                                 \
224      }                                          \
225   }                                             \
226}
227
246228/* operate one instruction for */
247229#define ONE_MORE_INSN() {      \
248230   UINT8 ireg;                      \
r1185r1186
265247            (void)(*m6800.irq_callback)(M6800_IRQ_LINE);   \
266248      }                                          \
267249      else                                       \
268         m6800_check_irq2();                           \
250         CHECK_IRQ2;                                 \
269251   }                                             \
270252}
271253
r1185r1186
529511   CHANGE_PC();
530512}
531513
532void m6800_check_irq2(void)
533{
534   if ((m6800.tcsr & (TCSR_EICI|TCSR_ICF)) == (TCSR_EICI|TCSR_ICF))
535   {
536      TAKE_ICI;
537      if( m6800.irq_callback )
538         (void)(*m6800.irq_callback)(M6800_TIN_LINE);
539   }
540   else if ((m6800.tcsr & (TCSR_EOCI|TCSR_OCF)) == (TCSR_EOCI|TCSR_OCF))
541   {
542      TAKE_OCI;
543   }
544   else if ((m6800.tcsr & (TCSR_ETOI|TCSR_TOF)) == (TCSR_ETOI|TCSR_TOF))
545   {
546      TAKE_TOI;
547   }
548   else if (((m6800.trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) == (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) ||
549          ((m6800.trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) == (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) ||
550          ((m6800.trcsr & (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)) == (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)))
551   {
552      TAKE_SCI;
553   }
554}
555
556514/* check OCI or TOI */
557515static void check_timer_event(void)
558516{
r1185r1186
589547/* include the opcode functions */
590548#include "6800ops.c"
591549
592static void m6800_tx(int value)
593{
594   m6800.port2_data = (m6800.port2_data & 0xef) | (value << 4);
595
596   if(m6800.port2_ddr == 0xff)
597      io_write_byte_8(M6803_PORT2,m6800.port2_data);
598   else
599      io_write_byte_8(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr)
600         | (io_read_byte_8(M6803_PORT2) & (m6800.port2_ddr ^ 0xff)));
601}
602
603static int m6800_rx(void)
604{
605   return (io_read_byte_8(M6803_PORT2) & M6800_PORT2_IO3) >> 3;
606}
607
608static TIMER_CALLBACK(m6800_tx_tick)
609{
610    int cpunum = param;
611
612   if (m6800.trcsr & M6800_TRCSR_TE)
613   {
614      // force Port 2 bit 4 as output
615      m6800.port2_ddr |= M6800_PORT2_IO4;
616
617      switch (m6800.txstate)
618      {
619      case M6800_TX_STATE_INIT:
620         m6800.tx = 1;
621         m6800.txbits++;
622
623         if (m6800.txbits == 10)
624         {
625            m6800.txstate = M6800_TX_STATE_READY;
626            m6800.txbits = M6800_SERIAL_START;
627         }
628         break;
629
630      case M6800_TX_STATE_READY:
631         switch (m6800.txbits)
632         {
633         case M6800_SERIAL_START:
634            if (m6800.trcsr & M6800_TRCSR_TDRE)
635            {
636               // transmit buffer is empty, send consecutive '1's
637               m6800.tx = 1;
638            }
639            else
640            {
641               // transmit buffer is full, send data
642
643               // load TDR to shift register
644               m6800.tsr = m6800.tdr;
645
646               // transmit buffer is empty, set TDRE flag
647               m6800.trcsr |= M6800_TRCSR_TDRE;
648
649               // send start bit '0'
650               m6800.tx = 0;
651
652               m6800.txbits++;
653            }
654            break;
655
656         case M6800_SERIAL_STOP:
657            // send stop bit '1'
658            m6800.tx = 1;
659
660             cpuintrf_push_context(cpunum);
661            CHECK_IRQ_LINES();
662            cpuintrf_pop_context();
663
664            m6800.txbits = M6800_SERIAL_START;
665            break;
666
667         default:
668            // send data bit '0' or '1'
669            m6800.tx = m6800.tsr & 0x01;
670
671            // shift transmit register
672            m6800.tsr >>= 1;
673
674            m6800.txbits++;
675            break;
676         }
677         break;
678      }
679   }
680
681   m6800_tx(m6800.tx);
682}
683
684static TIMER_CALLBACK(m6800_rx_tick)
685{
686    int cpunum = param;
687
688   if (m6800.trcsr & M6800_TRCSR_RE)
689   {
690      if (m6800.trcsr & M6800_TRCSR_WU)
691      {
692         // wait for 10 bits of '1'
693
694         if (m6800_rx() == 1)
695         {
696            m6800.rxbits++;
697
698            if (m6800.rxbits == 10)
699            {
700               m6800.trcsr &= ~M6800_TRCSR_WU;
701               m6800.rxbits = M6800_SERIAL_START;
702            }
703         }
704         else
705         {
706            m6800.rxbits = M6800_SERIAL_START;
707         }
708      }
709      else
710      {
711         // receive data
712
713         switch (m6800.rxbits)
714         {
715         case M6800_SERIAL_START:
716            if (m6800_rx() == 0)
717            {
718               // start bit found
719               m6800.rxbits++;
720            }
721            break;
722
723         case M6800_SERIAL_STOP:
724            if (m6800_rx() == 1)
725            {
726               if (m6800.trcsr & M6800_TRCSR_RDRF)
727               {
728                  // overrun error
729
730                  m6800.trcsr |= M6800_TRCSR_ORFE;
731
732                   cpuintrf_push_context(cpunum);
733                  CHECK_IRQ_LINES();
734                  cpuintrf_pop_context();
735               }
736               else
737               {
738                  if (!(m6800.trcsr & M6800_TRCSR_ORFE))
739                  {
740                     // transfer data into receive register
741                     m6800.rdr = m6800.rsr;
742
743                     // set RDRF flag
744                     m6800.trcsr |= M6800_TRCSR_RDRF;
745
746                     cpuintrf_push_context(cpunum);
747                     CHECK_IRQ_LINES();
748                     cpuintrf_pop_context();
749                  }
750               }
751            }
752            else
753            {
754               // framing error
755
756               if (!(m6800.trcsr & M6800_TRCSR_ORFE))
757               {
758                  // transfer unframed data into receive register
759                  m6800.rdr = m6800.rsr;
760               }
761
762               m6800.trcsr |= M6800_TRCSR_ORFE;
763               m6800.trcsr &= ~M6800_TRCSR_RDRF;
764
765               cpuintrf_push_context(cpunum);
766               CHECK_IRQ_LINES();
767               cpuintrf_pop_context();
768            }
769
770            m6800.rxbits = M6800_SERIAL_START;
771            break;
772
773         default:
774            // shift receive register
775            m6800.rsr >>= 1;
776
777            // receive bit into register
778            m6800.rsr |= (m6800_rx() << 7);
779
780            m6800.rxbits++;
781            break;
782         }
783      }
784   }
785}
786
787550/****************************************************************************
788551 * Reset registers to their initial values
789552 ****************************************************************************/
r1185r1186
846609   OCD = 0xffff;
847610   TOD = 0xffff;
848611   m6800.ram_ctrl |= 0x40;
849
850#if (HAS_HD63701)
851   m6800.trcsr = M6800_TRCSR_TDRE;
852   m6800.rmcr = 0;
853   mame_timer_enable(m6800_rx_timer, 0);
854   mame_timer_enable(m6800_tx_timer, 0);
855   m6800.txstate = M6800_TX_STATE_INIT;
856   m6800.txbits = m6800.rxbits = 0;
857   m6800.trcsr_read = 0;
858#endif
859612}
860613
861614/****************************************************************************
r1185r1186
923676         m6800.input_capture = CT;
924677         MODIFIED_tcsr;
925678         if( !(CC & 0x10) )
926            m6800_check_irq2();
679            CHECK_IRQ2
927680         break;
928681      default:
929682         return;
r1185r1186
15951348 * HD63701 similiar to the M6800
15961349 ****************************************************************************/
15971350#if (HAS_HD63701)
1598
15991351static void hd63701_init(int index, int clock, const void *config, int (*irqcallback)(int))
16001352{
16011353//  m6800.subtype = SUBTYPE_HD63701;
16021354   m6800.insn = hd63701_insn;
16031355   m6800.cycles = cycles_63701;
16041356   m6800.irq_callback = irqcallback;
1605
1606   m6800.clock = clock;
1607   m6800_rx_timer = mame_timer_alloc(m6800_rx_tick);
1608   m6800_tx_timer = mame_timer_alloc(m6800_tx_tick);
1609
16101357   state_register("hd63701", index);
16111358}
16121359/****************************************************************************
r1185r1186
22652012               | (m6800.port4_data & m6800.port4_ddr);
22662013      case 0x08:
22672014         m6800.pending_tcsr = 0;
2015//logerror("CPU #%d PC %04x: warning - read TCSR register\n",cpu_getactivecpu(),activecpu_get_pc());
22682016         return m6800.tcsr;
22692017      case 0x09:
22702018         if(!(m6800.pending_tcsr&TCSR_TOF))
r1185r1186
22992047      case 0x0e:
23002048         return (m6800.input_capture >> 8) & 0xff;
23012049      case 0x0f:
2302         logerror("CPU #%d PC %04x: warning - read from unsupported register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),offset);
2303         return 0;
23042050      case 0x10:
2305         return m6800.rmcr;
23062051      case 0x11:
2307         m6800.trcsr_read = 1;
2308         return m6800.trcsr;
23092052      case 0x12:
2310         if (m6800.trcsr_read)
2311         {
2312            m6800.trcsr_read = 0;
2313            m6800.trcsr = m6800.trcsr & 0x3f;
2314         }
2315         return m6800.rdr;
23162053      case 0x13:
2317         return m6800.tdr;
2054         logerror("CPU #%d PC %04x: warning - read from unsupported internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),offset);
2055         return 0;
23182056      case 0x14:
23192057         logerror("CPU #%d PC %04x: read RAM control register\n",cpu_getactivecpu(),activecpu_get_pc());
23202058         return m6800.ram_ctrl;
r1185r1186
23752113               | (io_read_byte_8(M6803_PORT1) & (m6800.port1_ddr ^ 0xff)));
23762114         break;
23772115      case 0x03:
2378         m6800.port2_data = (m6800.port2_data & 0xef) | (m6800.tx << 4);
2116         m6800.port2_data = data;
2117         m6800.port2_ddr = data;
23792118         if(m6800.port2_ddr == 0xff)
23802119            io_write_byte_8(M6803_PORT2,m6800.port2_data);
23812120         else
r1185r1186
24252164         m6800.pending_tcsr &= m6800.tcsr;
24262165         MODIFIED_tcsr;
24272166         if( !(CC & 0x10) )
2428            m6800_check_irq2();
2167            CHECK_IRQ2;
2168//logerror("CPU #%d PC %04x: TCSR = %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data);
24292169         break;
24302170      case 0x09:
24312171         latch09 = data & 0xff;   /* 6301 only */
r1185r1186
24542194         break;
24552195      case 0x0d:
24562196      case 0x0e:
2457      case 0x12:
24582197         logerror("CPU #%d PC %04x: warning - write %02x to read only internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
24592198         break;
24602199      case 0x0f:
2461         logerror("CPU #%d PC %04x: warning - write %02x to unsupported internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
2462         break;
24632200      case 0x10:
2464         m6800.rmcr = data & 0x0f;
2465
2466         switch ((m6800.rmcr & M6800_RMCR_CC_MASK) >> 2)
2467         {
2468         case 0:
2469         case 3: // not implemented
2470            mame_timer_enable(m6800_rx_timer, 0);
2471            mame_timer_enable(m6800_tx_timer, 0);
2472            break;
2473
2474         case 1:
2475         case 2:
2476            {
2477               int divisor = M6800_RMCR_SS[m6800.rmcr & M6800_RMCR_SS_MASK];
2478
2479               mame_timer_adjust(m6800_rx_timer, time_zero, cpu_getactivecpu(), MAME_TIME_IN_HZ(m6800.clock / divisor));
2480               mame_timer_adjust(m6800_tx_timer, time_zero, cpu_getactivecpu(), MAME_TIME_IN_HZ(m6800.clock / divisor));
2481            }
2482            break;
2483         }
2484         break;
24852201      case 0x11:
2486         if ((data & M6800_TRCSR_TE) && !(m6800.trcsr & M6800_TRCSR_TE))
2487         {
2488            m6800.txstate = M6800_TX_STATE_INIT;
2489         }
2490         m6800.trcsr = (m6800.trcsr & 0xe0) | (data & 0x1f);
2491         break;
2202      case 0x12:
24922203      case 0x13:
2493         if (m6800.trcsr_read)
2494         {
2495            m6800.trcsr_read = 0;
2496            m6800.trcsr &= ~M6800_TRCSR_TDRE;
2497         }
2498         m6800.tdr = data;
2204         logerror("CPU #%d PC %04x: warning - write %02x to unsupported internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
24992205         break;
25002206      case 0x14:
25012207         logerror("CPU #%d PC %04x: write %02x to RAM control register\n",cpu_getactivecpu(),activecpu_get_pc(),data);
r1185r1186
25712277      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
25722278      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
25732279      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2574      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 9;               break;
2280      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
25752281      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
25762282      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
25772283
src/emu/video/polynew.h
r0r1186
1/***************************************************************************
2
3    polynew.h
4
5    New polygon helper routines.
6
7****************************************************************************
8
9    Pixel model:
10
11    (0.0,0.0)       (1.0,0.0)       (2.0,0.0)       (3.0,0.0)
12        +---------------+---------------+---------------+
13        |               |               |               |
14        |               |               |               |
15        |   (0.5,0.5)   |   (1.5,0.5)   |   (2.5,0.5)   |
16        |       *       |       *       |       *       |
17        |               |               |               |
18        |               |               |               |
19    (0.0,1.0)       (1.0,1.0)       (2.0,1.0)       (3.0,1.0)
20        +---------------+---------------+---------------+
21        |               |               |               |
22        |               |               |               |
23        |   (0.5,1.5)   |   (1.5,1.5)   |   (2.5,1.5)   |
24        |       *       |       *       |       *       |
25        |               |               |               |
26        |               |               |               |
27        |               |               |               |
28        +---------------+---------------+---------------+
29    (0.0,2.0)       (1.0,2.0)       (2.0,2.0)       (3.0,2.0)
30
31***************************************************************************/
32
33#pragma once
34
35#ifndef __POLYNEW_H__
36#define __POLYNEW_H__
37
38#include "mamecore.h"
39
40
41/***************************************************************************
42    CONSTANTS
43***************************************************************************/
44
45#define MAX_VERTEX_PARAMS      6
46
47#define POLYFLAG_INCLUDE_BOTTOM_EDGE      0x01
48#define POLYFLAG_INCLUDE_RIGHT_EDGE         0x02
49#define POLYFLAG_NO_WORK_QUEUE            0x04
50
51
52
53/***************************************************************************
54    TYPE DEFINITIONS
55***************************************************************************/
56
57/* opaque reference to the poly manager */
58typedef struct _poly_manager poly_manager;
59
60
61/* scanline_extent describes start/end points for a scanline */
62typedef struct _scanline_extent scanline_extent;
63struct _scanline_extent
64{
65   INT16      startx;
66   INT16      stopx;
67};
68
69
70/* input vertex data */
71typedef struct _poly_vertex poly_vertex;
72struct _poly_vertex
73{
74   float      x;                     /* screen X coordinate */
75   float      y;                     /* screen Y coordinate */
76   float      p[MAX_VERTEX_PARAMS];      /* interpolated parameter values */
77};
78
79
80/* single set of polygon per-parameter data */
81typedef struct _poly_param poly_param;
82struct _poly_param
83{
84   float      start;                  /* parameter value at starting X,Y */
85   float      dpdx;                  /* dp/dx relative to starting X */
86   float      dpdy;                  /* dp/dy relative to starting Y */
87};
88
89
90/* polygon constant data */
91typedef struct _poly_params poly_params;
92struct _poly_params
93{
94   void *      extra;                  /* pointer to the extra data */
95   INT32      xorigin;               /* X origin for all parameters */
96   INT32      yorigin;               /* Y origin for all parameters */
97   poly_param   param[MAX_VERTEX_PARAMS];   /* array of parameter data */
98};
99
100
101/* callback routine to process a batch of scanlines */
102typedef void (*poly_draw_scanline)(void *dest, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
103
104
105
106/***************************************************************************
107    TYPE DEFINITIONS
108***************************************************************************/
109
110
111/* ----- initialization/teardown ----- */
112
113/* allocate a new poly manager */
114poly_manager *poly_alloc(int max_queued_polygons, size_t extra_data_size, UINT8 flags);
115
116/* free a poly manager */
117void poly_free(poly_manager *poly);
118
119
120
121/* ----- synchronization ----- */
122
123/* wait until all polygons in the queue have been rendered */
124void poly_wait(poly_manager *poly, const char *debug_reason);
125
126
127
128/* ----- core rendering ----- */
129
130/* get a pointer to the extra data for the next polygon */
131void *poly_get_extra_data(poly_manager *poly);
132
133/* render a single triangle given 3 vertexes */
134UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3);
135
136/* perform a custom render of an object, given specific extents */
137UINT32 poly_render_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const scanline_extent *extents);
138
139
140
141/***************************************************************************
142    INLINE FUNCTIONS
143***************************************************************************/
144
145/*-------------------------------------------------
146    poly_param_value - return parameter value
147    at specified X,Y coordinate
148-------------------------------------------------*/
149
150INLINE float poly_param_value(INT32 x, INT32 y, int whichparam, const poly_params *data)
151{
152   return data->param[whichparam].start + (float)(x - data->xorigin) * data->param[whichparam].dpdx + (float)(y - data->yorigin) * data->param[whichparam].dpdy;
153}
154
155
156#endif   /* __POLY_H__ */
src/emu/video/voodoo.c
r1185r1186
136136
137137#include "driver.h"
138138#include "profiler.h"
139#include "video/polynew.h"
139140#include "voodoo.h"
140141#include "vooddefs.h"
141142#include "ui.h"
r1185r1186
155156#define LOG_FIFO         (0)
156157#define LOG_FIFO_VERBOSE   (0)
157158#define LOG_REGISTERS      (0)
159#define LOG_WAITS         (0)
158160#define LOG_LFB            (0)
159161#define LOG_TEXTURE_RAM      (0)
160162#define LOG_RASTERIZERS      (0)
r1185r1186
211213static UINT32 banshee_io_r(voodoo_state *v, offs_t offset, UINT32 mem_mask);
212214static UINT32 banshee_rom_r(voodoo_state *v, offs_t offset, UINT32 mem_mask);
213215
214/* work item management */
215static void work_item_enqueue(voodoo_state *v, work_info *work, int numitems);
216static void work_item_wait(voodoo_state *v);
217static void *work_item_callback(void *param);
218
219216/* command handlers */
220217static INT32 fastfill(voodoo_state *v);
221218static INT32 swapbuffer(voodoo_state *v, UINT32 data);
r1185r1186
233230static void dump_rasterizer_stats(voodoo_state *v);
234231
235232/* generic rasterizers */
236static void raster_fastfill(work_info *work, INT32 scanline, INT32 startx, INT32 stopx);
237static void raster_generic_0tmu(work_info *work, INT32 y, INT32 startx, INT32 stopx);
238static void raster_generic_1tmu(work_info *work, INT32 y, INT32 startx, INT32 stopx);
239static void raster_generic_2tmu(work_info *work, INT32 y, INT32 startx, INT32 stopx);
233static void raster_fastfill(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
234static void raster_generic_0tmu(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
235static void raster_generic_1tmu(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
236static void raster_generic_2tmu(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid);
240237
241238
242239
r1185r1186
282279
283280void voodoo_start(int which, int scrnum, int type, int fbmem_in_mb, int tmem0_in_mb, int tmem1_in_mb)
284281{
282   const raster_info *info;
285283   void *fbmem, *tmumem[2];
286284   voodoo_state *v;
287285   int val;
r1185r1186
292290   voodoo[which] = v;
293291
294292   /* create a multiprocessor work queue */
295   v->work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI);
293   v->poly = poly_alloc(64, sizeof(poly_extra_data), 0);
294   v->thread_stats = auto_malloc(sizeof(v->thread_stats[0]) * WORK_MAX_THREADS);
296295
297296   /* create a table of precomputed 1/n and log2(n) values */
298297   /* n ranges from 1.0000 to 2.0000 */
r1185r1186
371370   v->trigger = 51324 + which;
372371
373372   /* build the rasterizer table */
374#ifndef VOODOO_DRC
375{
376   const raster_info *info;
377373   for (info = predef_raster_table; info->callback; info++)
378374      add_rasterizer(v, info);
379}
380#endif
381375
382376   /* set up the PCI FIFO */
383377   v->pci.fifo.base = v->pci.fifo_mem;
r1185r1186
448442void voodoo_exit(int which)
449443{
450444   /* release the work queue, ensuring all work is finished */
451   if (voodoo[which] != NULL && voodoo[which]->work_queue != NULL)
452      osd_work_queue_free(voodoo[which]->work_queue);
445   if (voodoo[which] != NULL && voodoo[which]->poly != NULL)
446      poly_free(voodoo[which]->poly);
453447}
454448
455449
r1185r1186
919913
920914/*************************************
921915 *
916 *  Statistics management
917 *
918 *************************************/
919
920static void accumulate_statistics(voodoo_state *v, const stats_block *stats)
921{
922   /* apply internal voodoo statistics */
923   v->reg[fbiPixelsIn].u += stats->pixels_in;
924   v->reg[fbiPixelsOut].u += stats->pixels_out;
925   v->reg[fbiChromaFail].u += stats->chroma_fail;
926   v->reg[fbiZfuncFail].u += stats->zfunc_fail;
927   v->reg[fbiAfuncFail].u += stats->afunc_fail;
928
929   /* apply emulation statistics */
930   v->stats.total_pixels_in += stats->pixels_in;
931   v->stats.total_pixels_out += stats->pixels_out;
932   v->stats.total_chroma_fail += stats->chroma_fail;
933   v->stats.total_zfunc_fail += stats->zfunc_fail;
934   v->stats.total_afunc_fail += stats->afunc_fail;
935   v->stats.total_clipped += stats->clip_fail;
936   v->stats.total_stippled += stats->stipple_count;
937}
938
939
940static void update_statistics(voodoo_state *v, int accumulate)
941{
942   int threadnum;
943
944   /* accumulate/reset statistics from all units */
945   for (threadnum = 0; threadnum < ARRAY_LENGTH(v->thread_stats); threadnum++)
946   {
947      if (accumulate)
948         accumulate_statistics(v, &v->thread_stats[threadnum]);
949      memset(&v->thread_stats[threadnum], 0, sizeof(v->thread_stats[threadnum]));
950   }
951
952   /* accumulate/reset statistics from the LFB */
953   if (accumulate)
954      accumulate_statistics(v, &v->fbi.lfb_stats);
955   memset(&v->fbi.lfb_stats, 0, sizeof(v->fbi.lfb_stats));
956}
957
958
959
960/*************************************
961 *
922962 *  VBLANK management
923963 *
924964 *************************************/
r1185r1186
9881028   if (v->stats.display)
9891029   {
9901030      int screen_area = (Machine->screen[v->scrnum].visarea.max_x - Machine->screen[v->scrnum].visarea.min_x + 1) * (Machine->screen[v->scrnum].visarea.max_y - Machine->screen[v->scrnum].visarea.min_y + 1);
991      int pixelcount = v->stats.total_pixels_out;
9921031      char *statsptr = v->stats.buffer;
1032      int pixelcount;
9931033      int i;
9941034
1035      update_statistics(v, TRUE);
1036      pixelcount = v->stats.total_pixels_out;
1037
9951038      statsptr += sprintf(statsptr, "Swap:%6d\n", v->stats.swaps);
9961039      statsptr += sprintf(statsptr, "Hist:%08X\n", v->reg[fbiSwapHistory].u);
9971040      statsptr += sprintf(statsptr, "Stal:%6d\n", v->stats.stalls);
r1185r1186
11081151
11091152static void reset_counters(voodoo_state *v)
11101153{
1154   update_statistics(v, FALSE);
11111155   v->reg[fbiPixelsIn].u = 0;
11121156   v->reg[fbiChromaFail].u = 0;
11131157   v->reg[fbiZfuncFail].u = 0;
r1185r1186
14911535}
14921536
14931537
1494INLINE void prepare_tmu(tmu_state *t)
1538INLINE INT32 prepare_tmu(tmu_state *t)
14951539{
14961540   INT64 texdx, texdy;
1541   INT32 lodbase;
14971542
14981543   /* if the texture parameters are dirty, update them */
14991544   if (t->regdirty)
1545   {
15001546      recompute_texture_params(t);
15011547
1502   /* ensure that the NCC tables are up to date */
1503   if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1)
1504   {
1505      ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)];
1506      t->texel[1] = t->texel[9] = n->texel;
1507      if (n->dirty)
1508         ncc_table_update(n);
1548      /* ensure that the NCC tables are up to date */
1549      if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1)
1550      {
1551         ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)];
1552         t->texel[1] = t->texel[9] = n->texel;
1553         if (n->dirty)
1554            ncc_table_update(n);
1555      }
15091556   }
15101557
15111558   /* compute (ds^2 + dt^2) in both X and Y as 28.36 numbers */
r1185r1186
15221569   /* adjust the result: negative to get the log of the original value */
15231570   /* plus 12 to account for the extra exponent, and divided by 2 to */
15241571   /* get the log of the square root of texdx */
1525   (void)fast_reciplog(texdx, &t->lodbase);
1526   t->lodbase = (-t->lodbase + (12 << 8)) / 2;
1572   (void)fast_reciplog(texdx, &lodbase);
1573   return (-lodbase + (12 << 8)) / 2;
15271574}
15281575
15291576
r1185r1186
22072254      return 0;
22082255   }
22092256
2210   /* wait for any outstanding work to finish */
2211   if (regnum < vertexAx || regnum > fdWdY)
2212      work_item_wait(v);
2213
22142257   /* switch off the register */
22152258   switch (regnum)
22162259   {
r1185r1186
24542497
24552498      /* mask off invalid bits for different cards */
24562499      case fbzColorPath:
2500         poly_wait(v->poly, v->regnames[regnum]);
24572501         if (v->type < VOODOO_2)
24582502            data &= 0x0fffffff;
24592503         if (chips & 1) v->reg[fbzColorPath].u = data;
24602504         break;
24612505
24622506      case fbzMode:
2507         poly_wait(v->poly, v->regnames[regnum]);
24632508         if (v->type < VOODOO_2)
24642509            data &= 0x001fffff;
24652510         if (chips & 1) v->reg[fbzMode].u = data;
24662511         break;
24672512
24682513      case fogMode:
2514         poly_wait(v->poly, v->regnames[regnum]);
24692515         if (v->type < VOODOO_2)
24702516            data &= 0x0000003f;
24712517         if (chips & 1) v->reg[fogMode].u = data;
r1185r1186
24942540
24952541      /* other commands */
24962542      case nopCMD:
2543         poly_wait(v->poly, v->regnames[regnum]);
24972544         if (data & 1)
24982545            reset_counters(v);
24992546         if (data & 2)
r1185r1186
25052552         break;
25062553
25072554      case swapbufferCMD:
2555         poly_wait(v->poly, v->regnames[regnum]);
25082556         cycles = swapbuffer(v, data);
25092557         break;
25102558
25112559      case userIntrCMD:
2560         poly_wait(v->poly, v->regnames[regnum]);
25122561         fatalerror("userIntrCMD");
25132562         break;
25142563
r1185r1186
25162565      case clutData:
25172566         if (v->type <= VOODOO_2 && (chips & 1))
25182567         {
2568            poly_wait(v->poly, v->regnames[regnum]);
25192569            if (!FBIINIT1_VIDEO_TIMING_RESET(v->reg[fbiInit1].u))
25202570            {
25212571               int index = data >> 24;
r1185r1186
25342584      case dacData:
25352585         if (v->type <= VOODOO_2 && (chips & 1))
25362586         {
2587            poly_wait(v->poly, v->regnames[regnum]);
25372588            if (!(data & 0x800))
25382589               dacdata_w(&v->dac, (data >> 8) & 7, data & 0xff);
25392590            else
r1185r1186
25482599      case videoDimensions:
25492600         if (v->type <= VOODOO_2 && (chips & 1))
25502601         {
2602            poly_wait(v->poly, v->regnames[regnum]);
25512603            v->reg[regnum].u = data;
25522604            if (v->reg[hSync].u != 0 && v->reg[vSync].u != 0 && v->reg[videoDimensions].u != 0)
25532605            {
r1185r1186
26252677
26262678      /* fbiInit0 can only be written if initEnable says we can -- Voodoo/Voodoo2 only */
26272679      case fbiInit0:
2680         poly_wait(v->poly, v->regnames[regnum]);
26282681         if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable))
26292682         {
26302683            v->reg[fbiInit0].u = data;
r1185r1186
26482701      case fbiInit1:
26492702      case fbiInit2:
26502703      case fbiInit4:
2704         poly_wait(v->poly, v->regnames[regnum]);
26512705         if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable))
26522706         {
26532707            v->reg[regnum].u = data;
r1185r1186
26572711         break;
26582712
26592713      case fbiInit3:
2714         poly_wait(v->poly, v->regnames[regnum]);
26602715         if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable))
26612716         {
26622717            v->reg[regnum].u = data;
r1185r1186
26702725/*      case swapPending: -- Banshee */
26712726         if (v->type == VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable))
26722727         {
2728            poly_wait(v->poly, v->regnames[regnum]);
26732729            v->reg[regnum].u = data;
26742730            v->fbi.cmdfifo[0].enable = FBIINIT7_CMDFIFO_ENABLE(data);
26752731            v->fbi.cmdfifo[0].count_holes = !FBIINIT7_DISABLE_CMDFIFO_HOLES(data);
r1185r1186
26822738      case cmdFifoBaseAddr:
26832739         if (v->type == VOODOO_2 && (chips & 1))
26842740         {
2741            poly_wait(v->poly, v->regnames[regnum]);
26852742            v->reg[regnum].u = data;
26862743            v->fbi.cmdfifo[0].base = (data & 0x3ff) << 12;
26872744            v->fbi.cmdfifo[0].end = (((data >> 16) & 0x3ff) + 1) << 12;
r1185r1186
27632820      case nccTable+9:
27642821      case nccTable+10:
27652822      case nccTable+11:
2823         poly_wait(v->poly, v->regnames[regnum]);
27662824         if (chips & 2) ncc_table_write(&v->tmu[0].ncc[0], regnum - nccTable, data);
27672825         if (chips & 4) ncc_table_write(&v->tmu[1].ncc[0], regnum - nccTable, data);
27682826         break;
r1185r1186
27792837      case nccTable+21:
27802838      case nccTable+22:
27812839      case nccTable+23:
2840         poly_wait(v->poly, v->regnames[regnum]);
27822841         if (chips & 2) ncc_table_write(&v->tmu[0].ncc[1], regnum - (nccTable+12), data);
27832842         if (chips & 4) ncc_table_write(&v->tmu[1].ncc[1], regnum - (nccTable+12), data);
27842843         break;
r1185r1186
28162875      case fogTable+29:
28172876      case fogTable+30:
28182877      case fogTable+31:
2878         poly_wait(v->poly, v->regnames[regnum]);
28192879         if (chips & 1)
28202880         {
28212881            int base = 2 * (regnum - fogTable);
r1185r1186
28342894      case texBaseAddr_1:
28352895      case texBaseAddr_2:
28362896      case texBaseAddr_3_8:
2897         poly_wait(v->poly, v->regnames[regnum]);
28372898         if (chips & 2)
28382899         {
28392900            v->tmu[0].reg[regnum].u = data;
r1185r1186
28462907         }
28472908         break;
28482909
2910      /* these registers are referenced in the renderer; we must wait for pending work before changing */
2911      case chromaRange:
2912      case chromaKey:
2913      case alphaMode:
2914      case fogColor:
2915      case stipple:
2916      case zaColor:
2917      case color1:
2918      case color0:
2919      case clipLowYHighY:
2920      case clipLeftRight:
2921         poly_wait(v->poly, v->regnames[regnum]);
2922         /* fall through to default implementation */
2923
28492924      /* by default, just feed the data to the chips */
28502925      default:
28512926         if (chips & 1) v->reg[0x000 + regnum].u = data;
r1185r1186
31063181   depthmax = v->fbi.auxmax;
31073182
31083183   /* wait for any outstanding work to finish */
3109   work_item_wait(v);
3184   poly_wait(v->poly, "LFB Write");
31103185
31113186   /* simple case: no pipeline */
31123187   if (!LFBMODE_ENABLE_PIXEL_PIPELINE(v->reg[lfbMode].u))
r1185r1186
31683243   else
31693244   {
31703245      DECLARE_DITHER_POINTERS;
3171      DECLARE_STATISTICS;
31723246
31733247      if (LOG_LFB) logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", v->index, LFBMODE_WRITE_FORMAT(v->reg[lfbMode].u), x, y, data, mem_mask);
31743248
r1185r1186
31913265         /* make sure we care about this pixel */
31923266         if (mask & 0x0f)
31933267         {
3268            stats_block *stats = &v->fbi.lfb_stats;
31943269            INT64 iterw = sw[pixel] << (30-16);
31953270            INT32 iterz = sw[pixel] << 12;
31963271            rgb_union color;
r1185r1186
32033278                  scry < ((v->reg[clipLowYHighY].u >> 16) & 0x3ff) ||
32043279                  scry >= (v->reg[clipLowYHighY].u & 0x3ff))
32053280               {
3206                  pixin++;
3207                  v->stats.total_clipped++;
3281                  stats->pixels_in++;
3282                  stats->clip_fail++;
32083283                  continue;
32093284               }
32103285            }
32113286
32123287            /* pixel pipeline part 1 handles depth testing and stippling */
3213            PIXEL_PIPELINE_BEGIN(v, x, y, v->reg[fbzColorPath].u, v->reg[fbzMode].u, iterz, iterw);
3288            PIXEL_PIPELINE_BEGIN(v, stats, x, y, v->reg[fbzColorPath].u, v->reg[fbzMode].u, iterz, iterw);
32143289
32153290            /* use the RGBA we stashed above */
32163291            color.rgb.r = r = sr[pixel];
r1185r1186
32193294            color.rgb.a = a = sa[pixel];
32203295
32213296            /* apply chroma key, alpha mask, and alpha testing */
3222            APPLY_CHROMAKEY(v, v->reg[fbzMode].u, color);
3223            APPLY_ALPHAMASK(v, v->reg[fbzMode].u, color.rgb.a);
3224            APPLY_ALPHATEST(v, v->reg[alphaMode].u, color.rgb.a);
3297            APPLY_CHROMAKEY(v, stats, v->reg[fbzMode].u, color);
3298            APPLY_ALPHAMASK(v, stats, v->reg[fbzMode].u, color.rgb.a);
3299            APPLY_ALPHATEST(v, stats, v->reg[alphaMode].u, color.rgb.a);
32253300
32263301            /* pixel pipeline part 2 handles color combine, fog, alpha, and final output */
3227            PIXEL_PIPELINE_END(v, dither, dither4, dither_lookup, x, dest, depth, v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, iterz, iterw, v->reg[zaColor]);
3302            PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, iterz, iterw, v->reg[zaColor]);
32283303         }
32293304
32303305         /* advance our pointers */
32313306         x++;
32323307         mask >>= 4;
32333308      }
3234
3235      UPDATE_STATISTICS(v);
32363309   }
32373310
32383311   return 0;
r1185r1186
32633336      fatalerror("Texture direct write!");
32643337
32653338   /* wait for any outstanding work to finish */
3266   work_item_wait(v);
3339   poly_wait(v->poly, "Texture write");
32673340
32683341   /* update texture info if dirty */
32693342   if (t->regdirty)
r1185r1186
38113884         break;
38123885
38133886      /* all counters are 24-bit only */
3814      case fbiTrianglesOut:
38153887      case fbiPixelsIn:
38163888      case fbiChromaFail:
38173889      case fbiZfuncFail:
38183890      case fbiAfuncFail:
38193891      case fbiPixelsOut:
3820         result &= 0xffffff;
3892         update_statistics(v, TRUE);
3893      case fbiTrianglesOut:
3894         result = v->reg[regnum].u & 0xffffff;
38213895         break;
38223896   }
38233897
r1185r1186
39033977      return 0xffffffff;
39043978
39053979   /* wait for any outstanding work to finish */
3906   work_item_wait(v);
3980   poly_wait(v->poly, "LFB read");
39073981
39083982   /* compute the data */
39093983   data = buffer[bufoffs + 0] | (buffer[bufoffs + 1] << 16);
r1185r1186
45004574
45014575
45024576/***************************************************************************
4503    WORK ITEM MANAGEMENT
4504***************************************************************************/
4505
4506/*-------------------------------------------------
4507    work_item_enqueue - enqueue a new work item,
4508    remembering starting statistics
4509-------------------------------------------------*/
4510
4511static void work_item_enqueue(voodoo_state *v, work_info *work, int numitems)
4512{
4513   /* remember the starting statistics values */
4514   work->start_pixels_in = v->reg[fbiPixelsIn].u;
4515   work->start_pixels_out = v->reg[fbiPixelsOut].u;
4516   work->start_chroma_fail = v->reg[fbiChromaFail].u;
4517   work->start_zfunc_fail = v->reg[fbiZfuncFail].u;
4518   work->start_afunc_fail = v->reg[fbiAfuncFail].u;
4519
4520   /* set the state */
4521   work->state = v;
4522
4523   /* enqueue the work item */
4524   osd_work_item_queue_multiple(v->work_queue, work_item_callback, numitems, work->unit, sizeof(*work->unit), WORK_ITEM_FLAG_AUTO_RELEASE);
4525}
4526
4527
4528/*-------------------------------------------------
4529    work_item_wait - wait for all pending work
4530    items to complete, then update statistics
4531-------------------------------------------------*/
4532
4533static void work_item_wait(voodoo_state *v)
4534{
4535   work_info *work = &v->work;
4536
4537   /* wait for the work item to complete */
4538   osd_work_queue_wait(v->work_queue, osd_ticks_per_second());
4539
4540   /* update our global stats based on the results */
4541   v->stats.total_pixels_in += v->reg[fbiPixelsIn].u - work->start_pixels_in;
4542   v->stats.total_pixels_out += v->reg[fbiPixelsOut].u - work->start_pixels_out;
4543   v->stats.total_chroma_fail += v->reg[fbiChromaFail].u - work->start_chroma_fail;
4544   v->stats.total_zfunc_fail += v->reg[fbiZfuncFail].u - work->start_zfunc_fail;
4545   v->stats.total_afunc_fail += v->reg[fbiAfuncFail].u - work->start_afunc_fail;
4546   if (work->info != NULL)
4547      work->info->hits += v->reg[fbiPixelsIn].u - work->start_pixels_in;
4548
4549   /* remember the starting statistics values */
4550   work->start_pixels_in = v->reg[fbiPixelsIn].u;
4551   work->start_pixels_out = v->reg[fbiPixelsOut].u;
4552   work->start_chroma_fail = v->reg[fbiChromaFail].u;
4553   work->start_zfunc_fail = v->reg[fbiZfuncFail].u;
4554   work->start_afunc_fail = v->reg[fbiAfuncFail].u;
4555}
4556
4557
4558/*-------------------------------------------------
4559    work_item_callback - work item callback;
4560    loop over scanlines and call the rasterizer
4561    for each one
4562-------------------------------------------------*/
4563
4564static void *work_item_callback(void *param)
4565{
4566   work_unit *unit = param;
4567   work_info *work = unit->work;
4568   int extnum;
4569
4570   /* iterate over extents */
4571   for (extnum = 0; extnum < unit->count; extnum++)
4572      (*work->callback)(work, unit->scanline + extnum, unit->extent[extnum].startx, unit->extent[extnum].stopx);
4573   return NULL;
4574}
4575
4576
4577
4578/***************************************************************************
45794577    COMMAND HANDLERS
45804578***************************************************************************/
45814579
r1185r1186
45904588   int ex = (v->reg[clipLeftRight].u >> 0) & 0x3ff;
45914589   int sy = (v->reg[clipLowYHighY].u >> 16) & 0x3ff;
45924590   int ey = (v->reg[clipLowYHighY].u >> 0) & 0x3ff;
4593   work_info *work = &v->work;
4594   work_unit *unit = work->unit;
4595   int x, y;
4591   scanline_extent extents[256];
4592   UINT16 dithermatrix[16];
4593   UINT16 *drawbuf = NULL;
4594   UINT32 pixels = 0;
4595   int extnum, x, y;
45964596
45974597   /* if we're not clearing either, take no time */
45984598   if (!FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u) && !FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u))
r1185r1186
46064606      switch (destbuf)
46074607      {
46084608         case 0:      /* front buffer */
4609            work->drawbuf = v->fbi.rgb[v->fbi.frontbuf];
4609            drawbuf = v->fbi.rgb[v->fbi.frontbuf];
46104610            break;
46114611
46124612         case 1:      /* back buffer */
4613            work->drawbuf = v->fbi.rgb[v->fbi.backbuf];
4613            drawbuf = v->fbi.rgb[v->fbi.backbuf];
46144614            break;
46154615
46164616         default:   /* reserved */
r1185r1186
46244624         COMPUTE_DITHER_POINTERS(v->reg[fbzMode].u, y);
46254625         for (x = 0; x < 4; x++)
46264626         {
4627            int r = RGB_RED(v->reg[color1].u);
4628            int g = RGB_GREEN(v->reg[color1].u);
4629            int b = RGB_BLUE(v->reg[color1].u);
4627            int r = v->reg[color1].rgb.r;
4628            int g = v->reg[color1].rgb.g;
4629            int b = v->reg[color1].rgb.b;
46304630
46314631            APPLY_DITHER(v->reg[fbzMode].u, x, dither_lookup, r, g, b);
4632            work->dither[y*4 + x] = (r << 11) | (g << 5) | b;
4632            dithermatrix[y*4 + x] = (r << 11) | (g << 5) | b;
46334633         }
46344634      }
46354635   }
46364636
4637   /* create a shared work item to actually perform the fill */
4638   work->startscanline = sy;
4639   work->callback = raster_fastfill;
4640   work->info = NULL;
4641   for (y = sy; y < ey; y += SCANLINES_PER_WORK)
4637   /* fill in a block of extents */
4638   extents[0].startx = sx;
4639   extents[0].stopx = ex;
4640   for (extnum = 1; extnum < ARRAY_LENGTH(extents); extnum++)
4641      extents[extnum] = extents[0];
4642
4643   /* iterate over blocks of extents */
4644   for (y = sy; y < ey; y += ARRAY_LENGTH(extents))
46424645   {
4643      int extnum;
4646      poly_extra_data *extra = poly_get_extra_data(v->poly);
4647      int count = MIN(ey - y, ARRAY_LENGTH(extents));
46444648
4645      unit->work = work;
4646      unit->scanline = y;
4647      unit->count = MIN(ey - y, SCANLINES_PER_WORK);
4648      for (extnum = 0; extnum < unit->count; extnum++)
4649      {
4650         unit->extent[extnum].startx = sx;
4651         unit->extent[extnum].stopx = ex;
4652      }
4653      unit++;
4649      extra->state = v;
4650      memcpy(extra->dither, dithermatrix, sizeof(extra->dither));
4651
4652      pixels += poly_render_custom(v->poly, drawbuf, NULL, raster_fastfill, y, count, extents);
46544653   }
4655   work_item_enqueue(v, work, unit - work->unit);
46564654
4657   /* track pixel writes to the frame buffer regardless of mask */
4658   if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u))
4659      v->reg[fbiPixelsOut].u += (ey - sy) * (ex - sx);
4660
46614655   /* 2 pixels per clock */
4662   return ((ey - sy) * (ex - sx)) / 2;
4656   return pixels / 2;
46634657}
46644658
46654659
r1185r1186
46954689
46964690static INT32 triangle(voodoo_state *v)
46974691{
4698   int texcount = 0, texnum;
4692   int texcount = 0;
46994693   UINT16 *drawbuf;
47004694   int destbuf;
47014695   int pixels;
r1185r1186
47434737   }
47444738
47454739   /* wait for any outstanding work to finish */
4746   work_item_wait(v);
4740//  poly_wait(v->poly, "triangle");
47474741
4748   /* set up the textures */
4749   for (texnum = 0; texnum < texcount; texnum++)
4750   {
4751      prepare_tmu(&v->tmu[texnum]);
4752      v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[texnum].reg[textureMode].u)]++;
4753   }
4754
47554742   /* determine the draw buffer */
47564743   destbuf = (v->type >= VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u);
47574744   switch (destbuf)
r1185r1186
49974984
49984985static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount)
49994986{
4987   poly_extra_data *extra = poly_get_extra_data(v->poly);
50004988   raster_info *info = find_rasterizer(v, texcount);
5001   work_info *work = &v->work;
5002   work_unit *unit = work->unit;
5003   int curscan, pixels = 0;
5004   INT32 dxdy_minmid;
5005   INT32 dxdy_minmax;
5006   INT32 dxdy_midmax;
5007   INT32 minx, miny;
5008   INT32 midx, midy;
5009   INT32 maxx, maxy;
5010   INT32 endscanline;
4989   poly_vertex vert[3];
50114990
5012   /* sort the vertices */
5013   /* note that this is not necessary on the Voodoo 1 as the card assumes the vertices */
5014   /* are presorted such that ay <= by <= cy, but we do it anyway because it is cheap enough */
5015   if (v->fbi.ay <= v->fbi.by)
5016   {
5017      if (v->fbi.by <= v->fbi.cy)
5018      {
5019         minx = v->fbi.ax;   miny = v->fbi.ay;
5020         midx = v->fbi.bx;   midy = v->fbi.by;
5021         maxx = v->fbi.cx;   maxy = v->fbi.cy;
5022      }
5023      else if (v->fbi.ay <= v->fbi.cy)
5024      {
5025         minx = v->fbi.ax;   miny = v->fbi.ay;
5026         midx = v->fbi.cx;   midy = v->fbi.cy;
5027         maxx = v->fbi.bx;   maxy = v->fbi.by;
5028      }
5029      else
5030      {
5031         minx = v->fbi.cx;   miny = v->fbi.cy;
5032         midx = v->fbi.ax;   midy = v->fbi.ay;
5033         maxx = v->fbi.bx;   maxy = v->fbi.by;
5034      }
5035   }
5036   else
5037   {
5038      if (v->fbi.ay <= v->fbi.cy)
5039      {
5040         minx = v->fbi.bx;   miny = v->fbi.by;
5041         midx = v->fbi.ax;   midy = v->fbi.ay;
5042         maxx = v->fbi.cx;   maxy = v->fbi.cy;
5043      }
5044      else if (v->fbi.by <= v->fbi.cy)
5045      {
5046         minx = v->fbi.bx;   miny = v->fbi.by;
5047         midx = v->fbi.cx;   midy = v->fbi.cy;
5048         maxx = v->fbi.ax;   maxy = v->fbi.ay;
5049      }
5050      else
5051      {
5052         minx = v->fbi.cx;   miny = v->fbi.cy;
5053         midx = v->fbi.bx;   midy = v->fbi.by;
5054         maxx = v->fbi.ax;   maxy = v->fbi.ay;
5055      }
5056   }
4991   /* fill in the vertex data */
4992   vert[0].x = (float)v->fbi.ax * (1.0f / 16.0f);
4993   vert[0].y = (float)v->fbi.ay * (1.0f / 16.0f);
4994   vert[1].x = (float)v->fbi.bx * (1.0f / 16.0f);
4995   vert[1].y = (float)v->fbi.by * (1.0f / 16.0f);
4996   vert[2].x = (float)v->fbi.cx * (1.0f / 16.0f);
4997   vert[2].y = (float)v->fbi.cy * (1.0f / 16.0f);
50574998
5058   /* clamp to full pixels */
5059   work->startscanline = (miny + 7) >> 4;
5060   endscanline = (maxy + 7) >> 4;
5061   if (work->startscanline >= endscanline)
5062      return 0;
4999   /* fill in the extra data */
5000   extra->state = v;
5001   extra->info = info;
50635002
5064   /* compute the slopes as 16.16 numbers */
5065   dxdy_minmid = (miny == midy) ? 0 : ((midx - minx) << 16) / (midy - miny);
5066   dxdy_minmax = (miny == maxy) ? 0 : ((maxx - minx) << 16) / (maxy - miny);
5067   dxdy_midmax = (midy == maxy) ? 0 : ((maxx - midx) << 16) / (maxy - midy);
5003   /* fill in triangle parameters */
5004   extra->ax = v->fbi.ax;
5005   extra->ay = v->fbi.ay;
5006   extra->startr = v->fbi.startr;
5007   extra->startg = v->fbi.startg;
5008   extra->startb = v->fbi.startb;
5009   extra->starta = v->fbi.starta;
5010   extra->startz = v->fbi.startz;
5011   extra->startw = v->fbi.startw;
5012   extra->drdx = v->fbi.drdx;
5013   extra->dgdx = v->fbi.dgdx;
5014   extra->dbdx = v->fbi.dbdx;
5015   extra->dadx = v->fbi.dadx;
5016   extra->dzdx = v->fbi.dzdx;
5017   extra->dwdx = v->fbi.dwdx;
5018   extra->drdy = v->fbi.drdy;
5019   extra->dgdy = v->fbi.dgdy;
5020   extra->dbdy = v->fbi.dbdy;
5021   extra->dady = v->fbi.dady;
5022   extra->dzdy = v->fbi.dzdy;
5023   extra->dwdy = v->fbi.dwdy;
50685024
5069   /* compute the X extents for each scanline */
5070   for (curscan = work->startscanline; curscan < endscanline; curscan += SCANLINES_PER_WORK)
5071   {
5072      int extnum;
5073
5074      /* fill in the work unit basics */
5075      unit->work = work;
5076      unit->scanline = curscan;
5077      unit->count = MIN(endscanline - curscan, SCANLINES_PER_WORK);
5078
5079      /* iterate over extents */
5080      for (extnum = 0; extnum < unit->count; extnum++)
5081      {
5082         INT32 fully = ((curscan + extnum) << 4) + 8;
5083         INT32 startx = minx + (((fully - miny) * dxdy_minmax) >> 16);
5084         INT32 stopx;
5085
5086         /* compute the ending X based on which part of the triangle we're in */
5087         if (fully < midy)
5088            stopx = minx + (((fully - miny) * dxdy_minmid) >> 16);
5089         else
5090            stopx = midx + (((fully - midy) * dxdy_midmax) >> 16);
5091
5092         /* clamp to full pixels */
5093         startx = (startx + 7) >> 4;
5094         stopx = (stopx + 7) >> 4;
5095
5096         /* force start < stop */
5097         if (startx > stopx)
5098         {
5099            int temp = startx;
5100            startx = stopx;
5101            stopx = temp;
5102         }
5103
5104         /* set the extent and update the total pixel count */
5105         unit->extent[extnum].startx = startx;
5106         unit->extent[extnum].stopx = stopx;
5107         pixels += stopx - startx;
5108      }
5109      unit++;
5110   }
5111
5112   /* copy data */
5113   work->ax = v->fbi.ax;
5114   work->ay = v->fbi.ay;
5115   work->startr = v->fbi.startr;
5116   work->startg = v->fbi.startg;
5117   work->startb = v->fbi.startb;
5118   work->starta = v->fbi.starta;
5119   work->startz = v->fbi.startz;
5120   work->startw = v->fbi.startw;
5121   work->drdx = v->fbi.drdx;
5122   work->dgdx = v->fbi.dgdx;
5123   work->dbdx = v->fbi.dbdx;
5124   work->dadx = v->fbi.dadx;
5125   work->dzdx = v->fbi.dzdx;
5126   work->dwdx = v->fbi.dwdx;
5127   work->drdy = v->fbi.drdy;
5128   work->dgdy = v->fbi.dgdy;
5129   work->dbdy = v->fbi.dbdy;
5130   work->dady = v->fbi.dady;
5131   work->dzdy = v->fbi.dzdy;
5132   work->dwdy = v->fbi.dwdy;
5025   /* fill in texture 0 parameters */
51335026   if (texcount > 0)
51345027   {
5135      work->starts0 = v->tmu[0].starts;
5136      work->startt0 = v->tmu[0].startt;
5137      work->startw0 = v->tmu[0].startw;
5138      work->ds0dx = v->tmu[0].dsdx;
5139      work->dt0dx = v->tmu[0].dtdx;
5140      work->dw0dx = v->tmu[0].dwdx;
5141      work->ds0dy = v->tmu[0].dsdy;
5142      work->dt0dy = v->tmu[0].dtdy;
5143      work->dw0dy = v->tmu[0].dwdy;
5028      extra->starts0 = v->tmu[0].starts;
5029      extra->startt0 = v->tmu[0].startt;
5030      extra->startw0 = v->tmu[0].startw;
5031      extra->ds0dx = v->tmu[0].dsdx;
5032      extra->dt0dx = v->tmu[0].dtdx;
5033      extra->dw0dx = v->tmu[0].dwdx;
5034      extra->ds0dy = v->tmu[0].dsdy;
5035      extra->dt0dy = v->tmu[0].dtdy;
5036      extra->dw0dy = v->tmu[0].dwdy;
5037      extra->lodbase0 = prepare_tmu(&v->tmu[0]);
5038      v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[0].reg[textureMode].u)]++;
5039
5040      /* fill in texture 1 parameters */
51445041      if (texcount > 1)
51455042      {
5146         work->starts1 = v->tmu[1].starts;
5147         work->startt1 = v->tmu[1].startt;
5148         work->startw1 = v->tmu[1].startw;
5149         work->ds1dx = v->tmu[1].dsdx;
5150         work->dt1dx = v->tmu[1].dtdx;
5151         work->dw1dx = v->tmu[1].dwdx;
5152         work->ds1dy = v->tmu[1].dsdy;
5153         work->dt1dy = v->tmu[1].dtdy;
5154         work->dw1dy = v->tmu[1].dwdy;
5043         extra->starts1 = v->tmu[1].starts;
5044         extra->startt1 = v->tmu[1].startt;
5045         extra->startw1 = v->tmu[1].startw;
5046         extra->ds1dx = v->tmu[1].dsdx;
5047         extra->dt1dx = v->tmu[1].dtdx;
5048         extra->dw1dx = v->tmu[1].dwdx;
5049         extra->ds1dy = v->tmu[1].dsdy;
5050         extra->dt1dy = v->tmu[1].dtdy;
5051         extra->dw1dy = v->tmu[1].dwdy;
5052         extra->lodbase1 = prepare_tmu(&v->tmu[1]);
5053         v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[1].reg[textureMode].u)]++;
51555054      }
51565055   }
51575056
51585057   /* farm the rasterization out to other threads */
5159   work->callback = info->callback;
5160   work->drawbuf = drawbuf;
5161   work->info = info;
5162   work_item_enqueue(v, work, unit - work->unit);
5163
5164   /* update statistics */
51655058   info->polys++;
5166   return pixels;
5059   return poly_render_triangle(v->poly, drawbuf, NULL, info->callback, 0, &vert[0], &vert[1], &vert[2]);
51675060}
51685061
51695062
r1185r1186
53185211    implementation of the 'fastfill' command
53195212-------------------------------------------------*/
53205213
5321static void raster_fastfill(work_info *work, INT32 scanline, INT32 startx, INT32 stopx)
5214static void raster_fastfill(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid)
53225215{
5323   voodoo_state *v = work->state;
5216   poly_extra_data *extra = poly->extra;
5217   voodoo_state *v = extra->state;
5218   stats_block *stats = &v->thread_stats[threadid];
53245219   int scry, x;
53255220
53265221   /* determine the screen Y */
r1185r1186
53315226   /* fill this RGB row */
53325227   if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u))
53335228   {
5334      UINT16 *ditherow = &work->dither[(scanline & 3) * 4];
5335      UINT16 *dest = work->drawbuf + scry * v->fbi.rowpixels;
5229      UINT16 *ditherow = &extra->dither[(scanline & 3) * 4];
5230      UINT64 expanded = *(UINT64 *)ditherow;
5231      UINT16 *dest = (UINT16 *)destbase + scry * v->fbi.rowpixels;
53365232
5337      for (x = startx; x < stopx; x++)
5233      for (x = startx; x < stopx && (x & 3) != 0; x++)
53385234         dest[x] = ditherow[x & 3];
5235      for ( ; x < (stopx & ~3); x += 4)
5236         *(UINT64 *)&dest[x] = expanded;
5237      for ( ; x < stopx; x++)
5238         dest[x] = ditherow[x & 3];
5239      stats->pixels_out += stopx - startx;
53395240   }
53405241
53415242   /* fill this dest buffer row */
53425243   if (FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u) && v->fbi.aux)
53435244   {
53445245      UINT16 color = v->reg[zaColor].u;
5246      UINT64 expanded = ((UINT64)color << 48) | ((UINT64)color << 32) | (color << 16) | color;
53455247      UINT16 *dest = v->fbi.aux + scry * v->fbi.rowpixels;
53465248
5347      for (x = startx; x < stopx; x++)
5249      for (x = startx; x < stopx && (x & 3) != 0; x++)
53485250         dest[x] = color;
5251      for ( ; x < (stopx & ~3); x += 4)
5252         *(UINT64 *)&dest[x] = expanded;
5253      for ( ; x < stopx; x++)
5254         dest[x] = color;
53495255   }
53505256}
53515257
src/emu/video/vooddefs.h
r1185r1186
2424/* maximum number of TMUs */
2525#define MAX_TMU               2
2626
27/* scanlines per work item */
28#define SCANLINES_PER_WORK      4
29
3027/* accumulate operations less than this number of clocks */
3128#define ACCUMULATE_THRESHOLD   0
3229
r1185r1186
13361333 *************************************/
13371334
13381335typedef struct _voodoo_state voodoo_state;
1339typedef struct _work_info work_info;
1336typedef struct _poly_extra_data poly_extra_data;
13401337
13411338
13421339typedef struct _rgba rgba;
r1185r1186
13631360typedef voodoo_reg rgb_union;
13641361
13651362
1363typedef struct _voodoo_stats voodoo_stats;
1364struct _voodoo_stats
1365{
1366   UINT8      lastkey;            /* last key state */
1367   UINT8      display;            /* display stats? */
1368   INT32      swaps;               /* total swaps */
1369   INT32      stalls;               /* total stalls */
1370   INT32      total_triangles;      /* total triangles */
1371   INT32      total_pixels_in;      /* total pixels in */
1372   INT32      total_pixels_out;      /* total pixels out */
1373   INT32      total_chroma_fail;      /* total chroma fail */
1374   INT32      total_zfunc_fail;      /* total z func fail */
1375   INT32      total_afunc_fail;      /* total a func fail */
1376   INT32      total_clipped;         /* total clipped */
1377   INT32      total_stippled;         /* total stippled */
1378   INT32      lfb_writes;            /* LFB writes */
1379   INT32      lfb_reads;            /* LFB reads */
1380   INT32      reg_writes;            /* register writes */
1381   INT32      reg_reads;            /* register reads */
1382   INT32      tex_writes;            /* texture writes */
1383   INT32      texture_mode[16];      /* 16 different texture modes */
1384   UINT8      render_override;      /* render override */
1385   char      buffer[1024];         /* string */
1386};
1387
1388
1389/* note that this structure is an even 32 bytes long */
1390typedef struct _stats_block stats_block;
1391struct _stats_block
1392{
1393   INT32      pixels_in;            /* pixels in statistic */
1394   INT32      pixels_out;            /* pixels out statistic */
1395   INT32      chroma_fail;         /* chroma test fail statistic */
1396   INT32      zfunc_fail;            /* z function test fail statistic */
1397   INT32      afunc_fail;            /* alpha function test fail statistic */
1398   INT32      clip_fail;            /* clipping fail statistic */
1399   INT32      stipple_count;         /* stipple statistic */
1400   INT32      filler[64/4 - 7];      /* pad this structure to 64 bytes */
1401};
1402
1403
13661404typedef struct _fifo_state fifo_state;
13671405struct _fifo_state
13681406{
r1185r1186
13921430struct _pci_state
13931431{
13941432   fifo_state   fifo;               /* PCI FIFO */
1395   UINT32      fifo_mem[64*2];         /* memory backing the PCI FIFO */
13961433   UINT32      init_enable;         /* initEnable value */
13971434   UINT8      stall_state;         /* state of the system if we're stalled */
13981435   void      (*stall_callback)(int); /* callback for stalling/unstalling */
13991436   UINT8      op_pending;            /* true if an operation is pending */
14001437   mame_time   op_end_time;         /* time when the pending operation ends */
14011438   mame_timer *continue_timer;         /* timer to use to continue processing */
1439   UINT32      fifo_mem[64*2];         /* memory backing the PCI FIFO */
14021440};
14031441
14041442
r1185r1186
14101448   INT32       ir[4], ig[4], ib[4];   /* I values for R,G,B */
14111449   INT32       qr[4], qg[4], qb[4];   /* Q values for R,G,B */
14121450   INT32       y[16];               /* Y values */
1413   rgb_t      texel[256];            /* texel lookup */
14141451   rgb_t *      palette;            /* pointer to associated RGB palette */
14151452   rgb_t *      palettea;            /* pointer to associated ARGB palette */
1453   rgb_t      texel[256];            /* texel lookup */
14161454};
14171455
14181456
r1185r1186
14381476   INT32      lodbias;            /* LOD bias */
14391477   UINT32      lodmask;            /* mask of available LODs */
14401478   UINT32      lodoffset[9];         /* offset of texture base for each LOD */
1441   INT32      lodbase;            /* used during rasterization */
14421479   INT32      detailmax;            /* detail clamp */
14431480   INT32      detailbias;            /* detail bias */
14441481   UINT8      detailscale;         /* detail scale */
r1185r1186
15121549   UINT32      tile_height;         /* height of video tiles */
15131550   UINT32      x_tiles;            /* number of tiles in the X direction */
15141551
1515   rgb_t      pen[65536];            /* mapping from pixels to pens */
1516   rgb_t      clut[512];            /* clut gamma data */
1517   UINT8      clut_dirty;            /* do we need to recompute? */
1518
15191552   mame_timer *vblank_timer;         /* VBLANK timer */
15201553   UINT8      vblank;               /* VBLANK state */
15211554   UINT8      vblank_count;         /* number of VBLANKs since last swap */
r1185r1186
15241557   UINT8      vblank_dont_swap;      /* don't actually swap when we hit this point */
15251558   void      (*vblank_client)(int);   /* client callback */
15261559
1527   fifo_state   fifo;               /* framebuffer memory fifo */
1528   cmdfifo_info cmdfifo[2];         /* command FIFOs */
1529
1530   UINT8      fogblend[64];         /* 64-entry fog table */
1531   UINT8      fogdelta[64];         /* 64-entry fog table */
1532   UINT8      fogdelta_mask;         /* mask for for delta (0xff for V1, 0xfc for V2) */
1533
15341560   /* triangle setup info */
15351561   UINT8      cheating_allowed;      /* allow cheating? */
15361562   INT32      sign;               /* triangle sign */
r1185r1186
15471573   INT32      dzdy;               /* delta Z per Y */
15481574   INT64      dwdy;               /* delta W per Y */
15491575
1576   stats_block   lfb_stats;            /* LFB-access statistics */
1577
15501578   UINT8      sverts;               /* number of vertices ready */
15511579   setup_vertex svert[3];            /* 3 setup vertices */
1580
1581   fifo_state   fifo;               /* framebuffer memory fifo */
1582   cmdfifo_info cmdfifo[2];         /* command FIFOs */
1583
1584   UINT8      fogblend[64];         /* 64-entry fog table */
1585   UINT8      fogdelta[64];         /* 64-entry fog table */
1586   UINT8      fogdelta_mask;         /* mask for for delta (0xff for V1, 0xfc for V2) */
1587
1588   rgb_t      pen[65536];            /* mapping from pixels to pens */
1589   rgb_t      clut[512];            /* clut gamma data */
1590   UINT8      clut_dirty;            /* do we need to recompute? */
15521591};
15531592
15541593
r1185r1186
15601599};
15611600
15621601
1563typedef struct _voodoo_stats voodoo_stats;
1564struct _voodoo_stats
1565{
1566   char      buffer[1024];         /* string */
1567   UINT8      lastkey;            /* last key state */
1568   UINT8      display;            /* display stats? */
1569   INT32      swaps;               /* total swaps */
1570   INT32      stalls;               /* total stalls */
1571   INT32      total_triangles;      /* total triangles */
1572   INT32      total_pixels_in;      /* total pixels in */
1573   INT32      total_pixels_out;      /* total pixels out */
1574   INT32      total_chroma_fail;      /* total chroma fail */
1575   INT32      total_zfunc_fail;      /* total z func fail */
1576   INT32      total_afunc_fail;      /* total a func fail */
1577   INT32      total_clipped;         /* total clipped */
1578   INT32      total_stippled;         /* total stippled */
1579   INT32      lfb_writes;            /* LFB writes */
1580   INT32      lfb_reads;            /* LFB reads */
1581   INT32      reg_writes;            /* register writes */
1582   INT32      reg_reads;            /* register reads */
1583   INT32      tex_writes;            /* texture writes */
1584   INT32      texture_mode[16];      /* 16 different texture modes */
1585   UINT8      render_override;      /* render override */
1586};
1587
1588
1589typedef void (*raster_callback)(work_info *, INT32, INT32, INT32);
1590
1591
15921602typedef struct _raster_info raster_info;
15931603struct _raster_info
15941604{
15951605   struct _raster_info *next;         /* pointer to next entry with the same hash */
1596   raster_callback callback;          /* callback pointer */
1606   poly_draw_scanline callback;       /* callback pointer */
15971607   UINT8      is_generic;            /* TRUE if this is one of the generic rasterizers */
15981608   UINT8      display;            /* display index */
15991609   UINT32      hits;               /* how many hits (pixels) we've used this for */
r1185r1186
16071617};
16081618
16091619
1610typedef struct _work_unit work_unit;
1611struct _work_unit
1620struct _poly_extra_data
16121621{
1613   work_info *work;            /* pointer back to the work info */
1614   INT16   scanline, count;      /* starting scanline and count */
1615   struct
1616   {
1617      INT32   startx, stopx;      /* starting/ending X points for each scanline */
1618   } extent[SCANLINES_PER_WORK];
1619};
1620
1621
1622struct _work_info
1623{
16241622   voodoo_state *state;            /* pointer back to the voodoo state */
1625
1626   raster_callback callback;         /* callback to handle a scanline's worth of work */
1627   UINT16 *   drawbuf;            /* pointer to render buffer */
1628
1629   INT32      startscanline;         /* starting scanline */
1630
1631   UINT16       dither[16];            /* dither matrix, for fastfill */
1632
1633   INT32       start_pixels_in;      /* starting fbiPixelsIn value */
1634   INT32       start_pixels_out;      /* starting fbiPixelsOut value */
1635   INT32       start_chroma_fail;      /* starting fbiChromaFail value */
1636   INT32       start_zfunc_fail;      /* starting fbiZfuncFail value */
1637   INT32       start_afunc_fail;      /* starting fbiAfuncFail value */
16381623   raster_info *info;               /* pointer to rasterizer information */
16391624
16401625   INT16      ax, ay;               /* vertex A x,y (12.4) */
r1185r1186
16541639   INT64      dw0dx;               /* delta W per X */
16551640   INT64      ds0dy, dt0dy;         /* delta S,T per Y */
16561641   INT64      dw0dy;               /* delta W per Y */
1642   INT32      lodbase0;            /* used during rasterization */
16571643
16581644   INT64      starts1, startt1;      /* starting S,T (14.18) */
16591645   INT64      startw1;            /* starting W (2.30) */
r1185r1186
16611647   INT64      dw1dx;               /* delta W per X */
16621648   INT64      ds1dy, dt1dy;         /* delta S,T per Y */
16631649   INT64      dw1dy;               /* delta W per Y */
1650   INT32      lodbase1;            /* used during rasterization */
16641651
1665   work_unit   unit[4100/SCANLINES_PER_WORK];   /* individual work units */
1652   UINT16       dither[16];            /* dither matrix, for fastfill */
16661653};
16671654
16681655
r1185r1186
17051692   tmu_shared_state tmushare;         /* TMU shared state */
17061693   banshee_info banshee;            /* Banshee state */
17071694
1708   work_info    work;               /* work queue management */
1709   osd_work_queue *work_queue;         /* work queue for offloading rasterization */
1695   poly_manager *poly;               /* polygon manager */
1696   stats_block   *thread_stats;         /* per-thread statistics */
17101697
17111698   voodoo_stats stats;               /* internal statistics */
17121699
r1185r1186
22122199 *
22132200 *************************************/
22142201
2215#define APPLY_CHROMAKEY(VV, FBZMODE, COLOR)                              \
2202#define APPLY_CHROMAKEY(VV, STATS, FBZMODE, COLOR)                        \
22162203do                                                             \
22172204{                                                            \
22182205   if (FBZMODE_ENABLE_CHROMAKEY(FBZMODE))                              \
r1185r1186
22222209      {                                                      \
22232210         if (((COLOR.u ^ (VV)->reg[chromaKey].u) & 0xffffff) == 0)         \
22242211         {                                                   \
2225            chromafail++;                                       \
2212            (STATS)->chroma_fail++;                                 \
22262213            goto skipdrawdepth;                                    \
22272214         }                                                   \
22282215      }                                                      \
r1185r1186
22612248         {                                                   \
22622249            if (results != 0)                                    \
22632250            {                                                \
2264               chromafail++;                                    \
2251               (STATS)->chroma_fail++;                              \
22652252               goto skipdrawdepth;                                 \
22662253            }                                                \
22672254         }                                                   \
r1185r1186
22692256         {                                                   \
22702257            if (results == 7)                                    \
22712258            {                                                \
2272               chromafail++;                                    \
2259               (STATS)->chroma_fail++;                              \
22732260               goto skipdrawdepth;                                 \
22742261            }                                                \
22752262         }                                                   \
r1185r1186
22862273 *
22872274 *************************************/
22882275
2289#define APPLY_ALPHAMASK(VV, FBZMODE, AA)                              \
2276#define APPLY_ALPHAMASK(VV, STATS, FBZMODE, AA)                           \
22902277do                                                             \
22912278{                                                            \
22922279   if (FBZMODE_ENABLE_ALPHA_MASK(FBZMODE))                              \
22932280   {                                                         \
22942281      if (((AA) & 1) == 0)                                       \
22952282      {                                                      \
2296         afail++;                                             \
2283         (STATS)->afunc_fail++;                                    \
22972284         goto skipdrawdepth;                                       \
22982285      }                                                      \
22992286   }                                                         \
r1185r1186
23082295 *
23092296 *************************************/
23102297
2311#define APPLY_ALPHATEST(VV, ALPHAMODE, AA)                              \
2298#define APPLY_ALPHATEST(VV, STATS, ALPHAMODE, AA)                        \
23122299do                                                             \
23132300{                                                            \
23142301   if (ALPHAMODE_ALPHATEST(ALPHAMODE))                                 \
23152302   {                                                         \
2303      UINT8 alpharef = (VV)->reg[alphaMode].rgb.a;                     \
23162304      switch (ALPHAMODE_ALPHAFUNCTION(ALPHAMODE))                        \
23172305      {                                                      \
23182306         case 0:      /* alphaOP = never */                           \
2319            afail++;                                          \
2307            (STATS)->afunc_fail++;                                 \
23202308            goto skipdrawdepth;                                    \
23212309                                                            \
23222310         case 1:      /* alphaOP = less than */                        \
2323            if ((AA) >= v->reg[alphaMode].rgb.a)                     \
2311            if ((AA) >= alpharef)                                 \
23242312            {                                                \
2325               afail++;                                       \
2313               (STATS)->afunc_fail++;                              \
23262314               goto skipdrawdepth;                                 \
23272315            }                                                \
23282316            break;                                             \
23292317                                                            \
23302318         case 2:      /* alphaOP = equal */                           \
2331            if ((AA) != v->reg[alphaMode].rgb.a)                     \
2319            if ((AA) != alpharef)                                 \
23322320            {                                                \
2333               afail++;                                       \
2321               (STATS)->afunc_fail++;                              \
23342322               goto skipdrawdepth;                                 \
23352323            }                                                \
23362324            break;                                             \
23372325                                                            \
23382326         case 3:      /* alphaOP = less than or equal */                  \
2339            if ((AA) > v->reg[alphaMode].rgb.a)                        \
2327            if ((AA) > alpharef)                                 \
23402328            {                                                \
2341               afail++;                                       \
2329               (STATS)->afunc_fail++;                              \
23422330               goto skipdrawdepth;                                 \
23432331            }                                                \
23442332            break;                                             \
23452333                                                            \
23462334         case 4:      /* alphaOP = greater than */                     \
2347            if ((AA) <= v->reg[alphaMode].rgb.a)                     \
2335            if ((AA) <= alpharef)                                 \
23482336            {                                                \
2349               afail++;                                       \
2337               (STATS)->afunc_fail++;                              \
23502338               goto skipdrawdepth;                                 \
23512339            }                                                \
23522340            break;                                             \
23532341                                                            \
23542342         case 5:      /* alphaOP = not equal */                        \
2355            if ((AA) == v->reg[alphaMode].rgb.a)                     \
2343            if ((AA) == alpharef)                                 \
23562344            {                                                \
2357               afail++;                                       \
2345               (STATS)->afunc_fail++;                              \
23582346               goto skipdrawdepth;                                 \
23592347            }                                                \
23602348            break;                                             \
23612349                                                            \
23622350         case 6:      /* alphaOP = greater than or equal */               \
2363            if ((AA) < v->reg[alphaMode].rgb.a)                        \
2351            if ((AA) < alpharef)                                 \
23642352            {                                                \
2365               afail++;                                       \
2353               (STATS)->afunc_fail++;                              \
23662354               goto skipdrawdepth;                                 \
23672355            }                                                \
23682356            break;                                             \
r1185r1186
25522540{                                                            \
25532541   if (FOGMODE_ENABLE_FOG(FOGMODE))                                 \
25542542   {                                                         \
2543      rgb_union fogcolor = (VV)->reg[fogColor];                        \
25552544      INT32 fr, fg, fb;                                          \
25562545                                                            \
25572546      /* constant fog bypasses everything else */                        \
25582547      if (FOGMODE_FOG_CONSTANT(FOGMODE))                              \
25592548      {                                                      \
2560         fr = (VV)->reg[fogColor].rgb.r;                              \
2561         fg = (VV)->reg[fogColor].rgb.g;                              \
2562         fb = (VV)->reg[fogColor].rgb.b;                              \
2549         fr = fogcolor.rgb.r;                                    \
2550         fg = fogcolor.rgb.g;                                    \
2551         fb = fogcolor.rgb.b;                                    \
25632552      }                                                      \
25642553                                                            \
25652554      /* non-constant fog comes from several sources */                  \
r1185r1186
25702559         /* if fog_add is zero, we start with the fog color */            \
25712560         if (FOGMODE_FOG_ADD(FOGMODE) == 0)                           \
25722561         {                                                   \
2573            fr = (VV)->reg[fogColor].rgb.r;                           \
2574            fg = (VV)->reg[fogColor].rgb.g;                           \
2575            fb = (VV)->reg[fogColor].rgb.b;                           \
2562            fr = fogcolor.rgb.r;                                 \
2563            fg = fogcolor.rgb.g;                                 \
2564            fb = fogcolor.rgb.b;                                 \
25762565         }                                                   \
25772566         else                                                \
25782567            fr = fg = fb = 0;                                    \
r1185r1186
30223011 *
30233012 *************************************/
30243013
3025#define PIXEL_PIPELINE_BEGIN(VV, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW)   \
3014#define PIXEL_PIPELINE_BEGIN(VV, STATS, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW)   \
30263015do                                                             \
30273016{                                                            \
30283017   INT32 depthval, wfloat;                                          \
30293018   INT32 prefogr, prefogg, prefogb;                                 \
30303019   INT32 r, g, b, a;                                             \
30313020                                                            \
3032   pixin++;                                                   \
3021   (STATS)->pixels_in++;                                          \
30333022                                                            \
30343023   /* apply clipping */                                          \
30353024   /* note that for perf reasons, we assume the caller has done clipping */   \
30363025                                                            \
3037   /* rotate stipple pattern */                                    \
3038   if (FBZMODE_STIPPLE_PATTERN(FBZMODE) == 0)                           \
3039      (VV)->reg[stipple].u = ((VV)->reg[stipple].u << 1) | ((VV)->reg[stipple].u >> 31);\
3040                                                            \
30413026   /* handle stippling */                                          \
30423027   if (FBZMODE_ENABLE_STIPPLE(FBZMODE))                              \
30433028   {                                                         \
30443029      /* rotate mode */                                          \
30453030      if (FBZMODE_STIPPLE_PATTERN(FBZMODE) == 0)                        \
30463031      {                                                      \
3032         (VV)->reg[stipple].u = ((VV)->reg[stipple].u << 1) | ((VV)->reg[stipple].u >> 31);\
30473033         if (((VV)->reg[stipple].u & 0x80000000) == 0)                  \
30483034         {                                                   \
3049            v->stats.total_stippled++;                              \
3035            (VV)->stats.total_stippled++;                           \
30503036            goto skipdrawdepth;                                    \
30513037         }                                                   \
30523038      }                                                      \
r1185r1186
30573043         int stipple_index = (((YY) & 3) << 3) | (~(XX) & 7);            \
30583044         if ((((VV)->reg[stipple].u >> stipple_index) & 1) == 0)            \
30593045         {                                                   \
3060            v->stats.total_stippled++;                              \
3046            (VV)->stats.total_stippled++;                           \
30613047            goto skipdrawdepth;                                    \
30623048         }                                                   \
30633049      }                                                      \
r1185r1186
31033089   /* add the bias */                                             \
31043090   if (FBZMODE_ENABLE_DEPTH_BIAS(FBZMODE))                              \
31053091   {                                                         \
3106      depthval += (INT16)v->reg[zaColor].u;                           \
3092      depthval += (INT16)(VV)->reg[zaColor].u;                        \
31073093      CLAMP(depthval, 0, 0xffff);                                    \
31083094   }                                                         \
31093095                                                            \
r1185r1186
31173103      if (FBZMODE_DEPTH_SOURCE_COMPARE(FBZMODE) == 0)                     \
31183104         depthsource = depthval;                                    \
31193105      else                                                   \
3120         depthsource = v->reg[zaColor].u & 0xffff;                     \
3106         depthsource = (UINT16)(VV)->reg[zaColor].u;                     \
31213107                                                            \
31223108      /* test against the depth buffer */                              \
31233109      switch (FBZMODE_DEPTH_FUNCTION(FBZMODE))                        \
31243110      {                                                      \
31253111         case 0:      /* depthOP = never */                           \
3126            zfail++;                                          \
3112            (STATS)->zfunc_fail++;                                 \
31273113            goto skipdrawdepth;                                    \
31283114                                                            \
31293115         case 1:      /* depthOP = less than */                        \
31303116            if (depthsource >= depth[XX])                           \
31313117            {                                                \
3132               zfail++;                                       \
3118               (STATS)->zfunc_fail++;                              \
31333119               goto skipdrawdepth;                                 \
31343120            }                                                \
31353121            break;                                             \
r1185r1186
31373123         case 2:      /* depthOP = equal */                           \
31383124            if (depthsource != depth[XX])                           \
31393125            {                                                \
3140               zfail++;                                       \
3126               (STATS)->zfunc_fail++;                              \
31413127               goto skipdrawdepth;                                 \
31423128            }                                                \
31433129            break;                                             \
r1185r1186
31453131         case 3:      /* depthOP = less than or equal */                  \
31463132            if (depthsource > depth[XX])                           \
31473133            {                                                \
3148               zfail++;                                       \
3134               (STATS)->zfunc_fail++;                              \
31493135               goto skipdrawdepth;                                 \
31503136            }                                                \
31513137            break;                                             \
r1185r1186
31533139         case 4:      /* depthOP = greater than */                     \
31543140            if (depthsource <= depth[XX])                           \
31553141            {                                                \
3156               zfail++;                                       \
3142               (STATS)->zfunc_fail++;                              \
31573143               goto skipdrawdepth;                                 \
31583144            }                                                \
31593145            break;                                             \
r1185r1186
31613147         case 5:      /* depthOP = not equal */                        \
31623148            if (depthsource == depth[XX])                           \
31633149            {                                                \
3164               zfail++;                                       \
3150               (STATS)->zfunc_fail++;                              \
31653151               goto skipdrawdepth;                                 \
31663152            }                                                \
31673153            break;                                             \
r1185r1186
31693155         case 6:      /* depthOP = greater than or equal */               \
31703156            if (depthsource < depth[XX])                           \
31713157            {                                                \
3172               zfail++;                                       \
3158               (STATS)->zfunc_fail++;                              \
31733159               goto skipdrawdepth;                                 \
31743160            }                                                \
31753161            break;                                             \
r1185r1186
31803166   }
31813167
31823168
3183#define PIXEL_PIPELINE_END(VV, DITHER, DITHER4, DITHER_LOOKUP, XX, dest, depth, FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, ITERZ, ITERW, ITERAXXX) \
3169#define PIXEL_PIPELINE_END(VV, STATS, DITHER, DITHER4, DITHER_LOOKUP, XX, dest, depth, FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, ITERZ, ITERW, ITERAXXX) \
31843170                                                            \
31853171   /* perform fogging */                                          \
31863172   prefogr = r;                                                \
r1185r1186
32133199   }                                                         \
32143200                                                            \
32153201   /* track pixel writes to the frame buffer regardless of mask */            \
3216   pixout++;                                                   \
3202   (STATS)->pixels_out++;                                          \
32173203                                                            \
32183204skipdrawdepth:                                                   \
32193205   ;                                                         \
r1185r1186
32653251
32663252    INT32 r, g, b, a;
32673253*/
3268#define COLORPATH_PIPELINE(VV, FBZCOLORPATH, FBZMODE, ALPHAMODE, TEXELARGB, ITERZ, ITERW, ITERARGB) \
3254#define COLORPATH_PIPELINE(VV, STATS, FBZCOLORPATH, FBZMODE, ALPHAMODE, TEXELARGB, ITERZ, ITERW, ITERARGB) \
32693255do                                                             \
32703256{                                                            \
32713257   INT32 blendr, blendg, blendb, blenda;                              \
r1185r1186
32933279   }                                                         \
32943280                                                            \
32953281   /* handle chroma key */                                          \
3296   APPLY_CHROMAKEY(VV, FBZMODE, c_other);                              \
3282   APPLY_CHROMAKEY(VV, STATS, FBZMODE, c_other);                        \
32973283                                                            \
32983284   /* compute a_other */                                          \
32993285   switch (FBZCP_CC_ASELECT(FBZCOLORPATH))                              \
r1185r1186
33163302   }                                                         \
33173303                                                            \
33183304   /* handle alpha mask */                                          \
3319   APPLY_ALPHAMASK(VV, FBZMODE, c_other.rgb.a);                        \
3305   APPLY_ALPHAMASK(VV, STATS, FBZMODE, c_other.rgb.a);                     \
33203306                                                            \
33213307   /* handle alpha test */                                          \
3322   APPLY_ALPHATEST(VV, ALPHAMODE, c_other.rgb.a);                        \
3308   APPLY_ALPHATEST(VV, STATS, ALPHAMODE, c_other.rgb.a);                  \
33233309                                                            \
33243310   /* compute c_local */                                          \
33253311   if (FBZCP_CC_LOCALSELECT_OVERRIDE(FBZCOLORPATH) == 0)                  \
r1185r1186
35163502
35173503/*************************************
35183504 *
3519 *  Statistics manipulation
3520 *
3521 *************************************/
3522
3523#define DECLARE_STATISTICS                                          \
3524   INT32 pixin = 0, pixout = 0, afail = 0, zfail = 0, chromafail = 0         \
3525
3526#define UPDATE_STATISTICS(VV)                                       \
3527do                                                            \
3528{                                                            \
3529   /* update statistics atomically */                                 \
3530   if (pixin != 0)                                                \
3531      osd_sync_add((INT32 volatile *)&(VV)->reg[fbiPixelsIn].u, pixin);      \
3532   if (pixout != 0)                                             \
3533      osd_sync_add((INT32 volatile *)&(VV)->reg[fbiPixelsOut].u, pixout);      \
3534   if (afail != 0)                                                \
3535      osd_sync_add((INT32 volatile *)&(VV)->reg[fbiAfuncFail].u, afail);      \
3536   if (zfail != 0)                                                \
3537      osd_sync_add((INT32 volatile *)&(VV)->reg[fbiZfuncFail].u, zfail);      \
3538   if (chromafail != 0)                                          \
3539      osd_sync_add((INT32 volatile *)&(VV)->reg[fbiChromaFail].u, chromafail);\
3540}                                                            \
3541while (0)
3542
3543
3544
3545/*************************************
3546 *
35473505 *  Rasterizer generator macro
35483506 *
35493507 *************************************/
35503508
35513509#define RASTERIZER(name, TMUS, FBZCOLORPATH, FBZMODE, ALPHAMODE, FOGMODE, TEXMODE0, TEXMODE1) \
35523510                                                            \
3553static void raster_##name(work_info *work, INT32 y, INT32 startx, INT32 stopx)   \
3511static void raster_##name(void *destbase, INT32 y, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) \
35543512{                                                            \
3555   voodoo_state *v = work->state;                                    \
3513   poly_extra_data *extra = poly->extra;                              \
3514   voodoo_state *v = extra->state;                                    \
3515   stats_block *stats = &v->thread_stats[threadid];                     \
35563516   DECLARE_DITHER_POINTERS;                                       \
3557   DECLARE_STATISTICS;                                             \
35583517   INT32 iterr, iterg, iterb, itera;                                 \
35593518   INT32 iterz;                                                \
35603519   INT64 iterw, iterw0 = 0, iterw1 = 0;                              \
r1185r1186
35833542      if (scry < ((v->reg[clipLowYHighY].u >> 16) & 0x3ff) ||               \
35843543         scry >= (v->reg[clipLowYHighY].u & 0x3ff))                     \
35853544      {                                                      \
3586         pixin += stopx - startx;                                 \
3587         v->stats.total_clipped += stopx - startx;                     \
3545         stats->pixels_in += stopx - startx;                           \
3546         stats->clip_fail += stopx - startx;                           \
35883547         return;                                                \
35893548      }                                                      \
35903549                                                            \
r1185r1186
35923551      tempclip = (v->reg[clipLeftRight].u >> 16) & 0x3ff;                  \
35933552      if (startx < tempclip)                                       \
35943553      {                                                      \
3595         pixin += tempclip - startx;                                 \
3554         stats->pixels_in += tempclip - startx;                        \
35963555         v->stats.total_clipped += tempclip - startx;                  \
35973556         startx = tempclip;                                       \
35983557      }                                                      \
35993558      tempclip = v->reg[clipLeftRight].u & 0x3ff;                        \
36003559      if (stopx >= tempclip)                                       \
36013560      {                                                      \
3602         pixin += stopx - tempclip;                                 \
3561         stats->pixels_in += stopx - tempclip;                        \
36033562         v->stats.total_clipped += stopx - tempclip;                     \
36043563         stopx = tempclip - 1;                                    \
36053564      }                                                      \
36063565   }                                                         \
36073566                                                            \
36083567   /* get pointers to the target buffer and depth buffer */               \
3609   dest = work->drawbuf + scry * v->fbi.rowpixels;                        \
3568   dest = (UINT16 *)destbase + scry * v->fbi.rowpixels;                     \
36103569   depth = v->fbi.aux ? (v->fbi.aux + scry * v->fbi.rowpixels) : NULL;         \
36113570                                                            \
36123571   /* compute the starting parameters */                              \
3613   dx = startx - (work->ax >> 4);                                    \
3614   dy = y - (work->ay >> 4);                                       \
3615   iterr = work->startr + dy * work->drdy + dx * work->drdx;               \
3616   iterg = work->startg + dy * work->dgdy + dx * work->dgdx;               \
3617   iterb = work->startb + dy * work->dbdy + dx * work->dbdx;               \
3618   itera = work->starta + dy * work->dady + dx * work->dadx;               \
3619   iterz = work->startz + dy * work->dzdy + dx * work->dzdx;               \
3620   iterw = work->startw + dy * work->dwdy + dx * work->dwdx;               \
3572   dx = startx - (extra->ax >> 4);                                    \
3573   dy = y - (extra->ay >> 4);                                       \
3574   iterr = extra->startr + dy * extra->drdy + dx * extra->drdx;            \
3575   iterg = extra->startg + dy * extra->dgdy + dx * extra->dgdx;            \
3576   iterb = extra->startb + dy * extra->dbdy + dx * extra->dbdx;            \
3577   itera = extra->starta + dy * extra->dady + dx * extra->dadx;            \
3578   iterz = extra->startz + dy * extra->dzdy + dx * extra->dzdx;            \
3579   iterw = extra->startw + dy * extra->dwdy + dx * extra->dwdx;            \
36213580   if (TMUS >= 1)                                                \
36223581   {                                                         \
3623      iterw0 = work->startw0 + dy * work->dw0dy +   dx * work->dw0dx;         \
3624      iters0 = work->starts0 + dy * work->ds0dy + dx * work->ds0dx;         \
3625      itert0 = work->startt0 + dy * work->dt0dy + dx * work->dt0dx;         \
3582      iterw0 = extra->startw0 + dy * extra->dw0dy +   dx * extra->dw0dx;      \
3583      iters0 = extra->starts0 + dy * extra->ds0dy + dx * extra->ds0dx;      \
3584      itert0 = extra->startt0 + dy * extra->dt0dy + dx * extra->dt0dx;      \
36263585   }                                                         \
36273586   if (TMUS >= 2)                                                \
36283587   {                                                         \
3629      iterw1 = work->startw1 + dy * work->dw1dy +   dx * work->dw1dx;         \
3630      iters1 = work->starts1 + dy * work->ds1dy + dx * work->ds1dx;         \
3631      itert1 = work->startt1 + dy * work->dt1dy + dx * work->dt1dx;         \
3588      iterw1 = extra->startw1 + dy * extra->dw1dy +   dx * extra->dw1dx;      \
3589      iters1 = extra->starts1 + dy * extra->ds1dy + dx * extra->ds1dx;      \
3590      itert1 = extra->startt1 + dy * extra->dt1dy + dx * extra->dt1dx;      \
36323591   }                                                         \
36333592                                                            \
36343593   /* loop in X */                                                \
r1185r1186
36383597      rgb_union texel = { 0 };                                    \
36393598                                                            \
36403599      /* pixel pipeline part 1 handles depth testing and stippling */         \
3641      PIXEL_PIPELINE_BEGIN(v, x, y, FBZCOLORPATH, FBZMODE,                \
3600      PIXEL_PIPELINE_BEGIN(v, stats, x, y, FBZCOLORPATH, FBZMODE,          \
36423601                        iterz, iterw);                           \
36433602                                                            \
36443603      /* run the texture pipeline on TMU1 to produce a value in texel */      \
36453604      /* note that they set LOD min to 8 to "disable" a TMU */            \
36463605      if (TMUS >= 2 && v->tmu[1].lodmin < (8 << 8))                     \
36473606         TEXTURE_PIPELINE(&v->tmu[1], x, dither4, TEXMODE1, texel,         \
3648                        v->tmu[1].lookup, v->tmu[1].lodbase,         \
3607                        v->tmu[1].lookup, extra->lodbase1,            \
36493608                        iters1, itert1, iterw1, texel);               \
36503609                                                            \
36513610      /* run the texture pipeline on TMU0 to produce a final */            \
r1185r1186
36533612      /* note that they set LOD min to 8 to "disable" a TMU */            \
36543613      if (TMUS >= 1 && v->tmu[0].lodmin < (8 << 8))                     \
36553614         TEXTURE_PIPELINE(&v->tmu[0], x, dither4, TEXMODE0, texel,         \
3656                        v->tmu[0].lookup, v->tmu[0].lodbase,         \
3615                        v->tmu[0].lookup, extra->lodbase0,            \
36573616                        iters0, itert0, iterw0, texel);               \
36583617                                                            \
36593618      /* colorpath pipeline selects source colors and does blending */      \
36603619      CLAMPED_ARGB(iterr, iterg, iterb, itera, FBZCOLORPATH, iterargb);      \
3661      COLORPATH_PIPELINE(v, FBZCOLORPATH, FBZMODE, ALPHAMODE,   texel,         \
3620      COLORPATH_PIPELINE(v, stats, FBZCOLORPATH, FBZMODE, ALPHAMODE, texel,   \
36623621                     iterz, iterw, iterargb);                     \
36633622                                                            \
36643623      /* pixel pipeline part 2 handles fog, alpha, and final output */      \
3665      PIXEL_PIPELINE_END(v, dither, dither4, dither_lookup, x, dest, depth,    \
3624      PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, \
36663625                     FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE,          \
36673626                     iterz, iterw, iterargb);                     \
36683627                                                            \
36693628      /* update the iterated parameters */                           \
3670      iterr += work->drdx;                                       \
3671      iterg += work->dgdx;                                       \
3672      iterb += work->dbdx;                                       \
3673      itera += work->dadx;                                       \
3674      iterz += work->dzdx;                                       \
3675      iterw += work->dwdx;                                       \
3629      iterr += extra->drdx;                                       \
3630      iterg += extra->dgdx;                                       \
3631      iterb += extra->dbdx;                                       \
3632      itera += extra->dadx;                                       \
3633      iterz += extra->dzdx;                                       \
3634      iterw += extra->dwdx;                                       \
36763635      if (TMUS >= 1)                                             \
36773636      {                                                      \
3678         iterw0 += work->dw0dx;                                    \
3679         iters0 += work->ds0dx;                                    \
3680         itert0 += work->dt0dx;                                    \
3637         iterw0 += extra->dw0dx;                                    \
3638         iters0 += extra->ds0dx;                                    \
3639         itert0 += extra->dt0dx;                                    \
36813640      }                                                      \
36823641      if (TMUS >= 2)                                             \
36833642      {                                                      \
3684         iterw1 += work->dw1dx;                                    \
3685         iters1 += work->ds1dx;                                    \
3686         itert1 += work->dt1dx;                                    \
3643         iterw1 += extra->dw1dx;                                    \
3644         iters1 += extra->ds1dx;                                    \
3645         itert1 += extra->dt1dx;                                    \
36873646      }                                                      \
36883647   }                                                         \
3689   UPDATE_STATISTICS(v);                                          \
36903648}
src/emu/video/polynew.c
r0r1186
1/***************************************************************************
2
3    polynew.c
4
5    Helper routines for polygon rendering.
6
7***************************************************************************/
8
9#include "polynew.h"
10#include "mame.h"
11#include <math.h>
12
13
14/***************************************************************************
15    DEBUGGING
16***************************************************************************/
17
18/* keep statistics */
19#define KEEP_STATISTICS               0
20
21/* turn this on to log the reasons for any long waits */
22#define LOG_WAITS                  0
23
24/* number of profiling ticks before we consider a wait "long" */
25#define LOG_WAIT_THRESHOLD            1000
26
27
28
29/***************************************************************************
30    CONSTANTS
31***************************************************************************/
32
33#define SCANLINES_PER_BUCKET         8
34#define CACHE_LINE_SIZE               64         /* this is a general guess */
35#define TOTAL_BUCKETS               (512 / SCANLINES_PER_BUCKET)
36#define UNITS_PER_POLY               (100 / SCANLINES_PER_BUCKET)
37
38
39
40/***************************************************************************
41    TYPE DEFINITIONS
42***************************************************************************/
43
44/* forward definitions */
45typedef struct _polygon_info polygon_info;
46
47
48/* work_unit describes a single "unit" of work, which is a small number of scanlines */
49typedef struct _work_unit work_unit;
50struct _work_unit
51{
52   polygon_info *      polygon;            /* pointer to polygon */
53   volatile UINT32      count_next;            /* number of scanlines and index of next item to process */
54   INT16            scanline;            /* starting scanline and count */
55   UINT16            previtem;            /* index of previous item in the same bucket */
56   scanline_extent    extent[SCANLINES_PER_BUCKET]; /* array of scanline extents */
57};
58
59
60/* polygon_info describes a single polygon, which includes the poly_params */
61struct _polygon_info
62{
63   poly_manager *      poly;               /* pointer back to the poly manager */
64   void *            dest;               /* pointer to the destination we are rendering to */
65   poly_draw_scanline    callback;            /* callback to handle a scanline's worth of work */
66   poly_params         params;               /* poly_params structure */
67};
68
69
70/* full poly manager description */
71struct _poly_manager
72{
73   /* queue management */
74   osd_work_queue *   queue;               /* work queue */
75
76   /* work units */
77   work_unit **      unit;               /* array of work unit pointers */
78   UINT32            unit_next;            /* index of next unit to allocate */
79   UINT32            unit_count;            /* number of work units available */
80   size_t            unit_size;            /* size of each work unit, in bytes */
81
82   /* poly data */
83   polygon_info **      polygon;            /* array of polygon pointers */
84   UINT32            polygon_next;         /* index of next polygon to allocate */
85   UINT32            polygon_count;         /* number of polygon items available */
86   size_t            polygon_size;         /* size of each polygon, in bytes */
87
88   /* misc data */
89   UINT8            flags;               /* flags */
90
91   /* buckets */
92   UINT16            unit_bucket[TOTAL_BUCKETS]; /* buckets for tracking unit usage */
93
94   /* statistics */
95   UINT32            polygons;            /* number of polygons queued */
96   UINT64            pixels;               /* number of pixels rendered */
97#if KEEP_STATISTICS
98   UINT32            conflicts[WORK_MAX_THREADS]; /* number of conflicts found, per thread */
99   UINT32            resolved[WORK_MAX_THREADS];   /* number of conflicts resolved, per thread */
100#endif
101};
102
103
104
105/***************************************************************************
106    FUNCTION PROTOTYPES
107***************************************************************************/
108
109static void *poly_item_callback(void *param, int threadid);
110
111
112
113/***************************************************************************
114    INLINE FUNCTIONS
115***************************************************************************/
116
117/*-------------------------------------------------
118    round_coordinate - round a coordinate to
119    an integer, following rules that 0.5 rounds
120    down
121-------------------------------------------------*/
122
123INLINE INT32 round_coordinate(float value)
124{
125   INT32 result = floor(value);
126   return result + (value - (float)result > 0.5f);
127}
128
129
130
131/***************************************************************************
132    INITIALIZATION/TEARDOWN
133***************************************************************************/
134
135/*-------------------------------------------------
136    poly_alloc - initialize a new polygon
137    manager
138-------------------------------------------------*/
139
140poly_manager *poly_alloc(int max_queued_polygons, size_t extra_data_size, UINT8 flags)
141{
142   int polynum, unitnum;
143   poly_manager *poly;
144
145   /* allocate the manager itself */
146   poly = malloc_or_die(sizeof(*poly));
147   memset(poly, 0, sizeof(*poly));
148   poly->flags = flags;
149
150   /* allocate polygons */
151   poly->polygon_size = sizeof(polygon_info) + extra_data_size;
152   poly->polygon_count = MAX(max_queued_polygons, 1);
153   poly->polygon = malloc_or_die(sizeof(*poly->polygon) * poly->polygon_count);
154   memset(poly->polygon, 0, sizeof(*poly->polygon) * poly->polygon_count);
155   poly->polygon[0] = malloc_or_die(sizeof(*poly->polygon[0]) * poly->polygon_count * poly->polygon_size);
156   memset(poly->polygon[0], 0, sizeof(*poly->polygon[0]) * poly->polygon_count * poly->polygon_size);
157
158   /* initialize the pointers */
159   for (polynum = 0; polynum < poly->polygon_count; polynum++)
160   {
161      poly->polygon[polynum] = (void *)((UINT8 *)poly->polygon[0] + polynum * poly->polygon_size);
162      poly->polygon[polynum]->params.extra = (void *)((UINT8 *)poly->polygon[polynum] + sizeof(polygon_info));
163   }
164
165   /* allocate work units */
166   poly->unit_size = ((sizeof(work_unit) + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE) * CACHE_LINE_SIZE;
167   poly->unit_count = MIN(poly->polygon_count * UNITS_PER_POLY, 65535);
168   poly->unit = malloc_or_die(sizeof(*poly->unit) * poly->unit_count);
169   memset(poly->unit, 0, sizeof(*poly->unit) * poly->unit_count);
170   poly->unit[0] = malloc_or_die(sizeof(*poly->unit[0]) * poly->unit_count * poly->unit_size);
171   memset(poly->unit[0], 0, sizeof(*poly->unit[0]) * poly->unit_count * poly->unit_size);
172
173   /* initialize the work units */
174   for (unitnum = 0; unitnum < poly->unit_count; unitnum++)
175      poly->unit[unitnum] = (void *)((UINT8 *)poly->unit[0] + unitnum * poly->unit_size);
176
177   /* create the work queue */
178   if (!(flags & POLYFLAG_NO_WORK_QUEUE))
179      poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
180   return poly;
181}
182
183
184/*-------------------------------------------------
185    poly_free - free a polygon manager
186-------------------------------------------------*/
187
188void poly_free(poly_manager *poly)
189{
190#if KEEP_STATISTICS
191{
192   int i, conflicts = 0, resolved = 0;
193   for (i = 0; i < ARRAY_LENGTH(poly->conflicts); i++)
194   {
195      conflicts += poly->conflicts[i];
196      resolved += poly->resolved[i];
197   }
198   printf("Total polygons = %d\n", poly->polygons);
199   if (poly->pixels > 1000000000)
200      printf("Total pixels   = %d%09d\n", (UINT32)(poly->pixels / 1000000000), (UINT32)(poly->pixels % 1000000000));
201   else
202      printf("Total pixels   = %d\n", (UINT32)poly->pixels);
203   printf("Resolved conflicts = %d/%d\n", resolved, conflicts);
204}
205#endif
206
207   /* free the work queue */
208   if (poly->queue != NULL)
209      osd_work_queue_free(poly->queue);
210
211   /* free the work units */
212   if (poly->unit != NULL)
213   {
214      if (poly->unit[0] != NULL)
215         free(poly->unit[0]);
216      free(poly->unit);
217   }
218
219   /* free the polygon */
220   if (poly->polygon != NULL)
221   {
222      if (poly->polygon[0] != NULL)
223         free(poly->polygon[0]);
224      free(poly->polygon);
225   }
226
227   /* free the manager itself */
228   free(poly);
229}
230
231
232
233/***************************************************************************
234    SYNCHRONIZATION
235***************************************************************************/
236
237/*-------------------------------------------------
238    poly_wait - wait for all pending rendering
239    to complete
240-------------------------------------------------*/
241
242void poly_wait(poly_manager *poly, const char *debug_reason)
243{
244   osd_ticks_t time;
245
246   /* remember the start time if we're logging */
247   if (LOG_WAITS)
248      time = osd_profiling_ticks();
249
250   /* wait for all pending work items to complete */
251   if (poly->queue != NULL)
252      osd_work_queue_wait(poly->queue, osd_ticks_per_second() * 100);
253
254   /* if we don't have a queue, just run the whole list now */
255   else
256   {
257      int unitnum;
258      for (unitnum = 0; unitnum < poly->unit_next; unitnum++)
259         poly_item_callback(poly->unit[unitnum], 0);
260   }
261
262   /* log any long waits */
263   if (LOG_WAITS)
264   {
265      time = osd_profiling_ticks() - time;
266      if (time > LOG_WAIT_THRESHOLD)
267         logerror("Poly:Waited %d cycles for %s\n", (int)time, debug_reason);
268   }
269
270   /* reset the state */
271   poly->polygon_next = poly->unit_next = 0;
272   memset(poly->unit_bucket, 0xff, sizeof(poly->unit_bucket));
273}
274
275
276
277/***************************************************************************
278    CORE RENDERING
279***************************************************************************/
280
281/*-------------------------------------------------
282    poly_get_extra_data - get a pointer to the
283    extra data for the next polygon
284-------------------------------------------------*/
285
286void *poly_get_extra_data(poly_manager *poly)
287{
288   /* wait for a work item if we have to */
289   if (poly->polygon_next + 1 > poly->polygon_count)
290      poly_wait(poly, "Out of polygons");
291
292   /* return a pointer to the extra data for the next item */
293   return poly->polygon[poly->polygon_next]->params.extra;
294}
295
296
297
298/***************************************************************************
299    CORE RENDERING
300***************************************************************************/
301
302/*-------------------------------------------------
303    poly_render_triangle - render a single
304    triangle given 3 vertexes
305-------------------------------------------------*/
306
307UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3)
308{
309   float dxdy_minmid, dxdy_minmax, dxdy_midmax;
310   const poly_vertex *tv;
311   INT32 curscan, scaninc;
312   polygon_info *polygon;
313   INT32 v1yclip, v3yclip;
314   INT32 v1y, v3y, v1x;
315   INT32 pixels = 0;
316   UINT32 startunit;
317
318   /* first sort by Y */
319   if (v2->y < v1->y)
320   {
321      tv = v1;
322      v1 = v2;
323      v2 = tv;
324   }
325   if (v3->y < v2->y)
326   {
327      tv = v2;
328      v2 = v3;
329      v3 = tv;
330      if (v2->y < v1->y)
331      {
332         tv = v1;
333         v1 = v2;
334         v2 = tv;
335      }
336   }
337
338   /* compute some integral X/Y vertex values */
339   v1x = round_coordinate(v1->x);
340   v1y = round_coordinate(v1->y);
341   v3y = round_coordinate(v3->y);
342
343   /* clip coordinates */
344   v1yclip = v1y;
345   v3yclip = v3y + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
346   if (cliprect != NULL)
347   {
348      v1yclip = MAX(v1yclip, cliprect->min_y);
349      v3yclip = MIN(v3yclip, cliprect->max_y + 1);
350   }
351   if (v3yclip - v1yclip <= 0)
352      return 0;
353
354   /* wait for a work item if we have to */
355   if (poly->polygon_next + 1 > poly->polygon_count)
356      poly_wait(poly, "Out of polygons");
357   else if (poly->unit_next + (v3yclip - v1yclip) / SCANLINES_PER_BUCKET + 2 > poly->unit_count)
358      poly_wait(poly, "Out of work units");
359   polygon = poly->polygon[poly->polygon_next++];
360
361   /* fill in the polygon information */
362   polygon->poly = poly;
363   polygon->dest = dest;
364   polygon->callback = callback;
365
366   /* set the start X/Y coordinates */
367   polygon->params.xorigin = v1x;
368   polygon->params.yorigin = v1y;
369
370   /* compute the slopes for each portion of the triangle */
371   dxdy_minmid = (v2->y == v1->y) ? 0.0f : (v2->x - v1->x) / (v2->y - v1->y);
372   dxdy_minmax = (v3->y == v1->y) ? 0.0f : (v3->x - v1->x) / (v3->y - v1->y);
373   dxdy_midmax = (v3->y == v2->y) ? 0.0f : (v3->x - v2->x) / (v3->y - v2->y);
374
375   /* compute the X extents for each scanline */
376   startunit = poly->unit_next;
377   for (curscan = v1yclip; curscan < v3yclip; curscan += scaninc)
378   {
379      UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS;
380      UINT32 unit_index = poly->unit_next++;
381      work_unit *unit = poly->unit[unit_index];
382      int extnum;
383
384      /* determine how much to advance to hit the next bucket */
385      scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET;
386
387      /* fill in the work unit basics */
388      unit->polygon = polygon;
389      unit->count_next = MIN(v3yclip - curscan, scaninc);
390      unit->scanline = curscan;
391      unit->previtem = poly->unit_bucket[bucketnum];
392      poly->unit_bucket[bucketnum] = unit_index;
393
394      /* iterate over extents */
395      for (extnum = 0; extnum < unit->count_next; extnum++)
396      {
397         float fully = (float)(curscan + extnum) + 0.5f;
398         float startx = v1->x + (fully - v1->y) * dxdy_minmax;
399         float stopx;
400         INT32 istartx, istopx;
401
402         /* compute the ending X based on which part of the triangle we're in */
403         if (fully < v2->y)
404            stopx = v1->x + (fully - v1->y) * dxdy_minmid;
405         else
406            stopx = v2->x + (fully - v2->y) * dxdy_midmax;
407
408         /* clamp to full pixels */
409         istartx = round_coordinate(startx);
410         istopx = round_coordinate(stopx);
411
412         /* force start < stop */
413         if (istartx > istopx)
414         {
415            INT32 temp = istartx;
416            istartx = istopx;
417            istopx = temp;
418         }
419
420         /* include the right edge if requested */
421         if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
422            istopx++;
423
424         /* apply left/right clipping */
425         if (cliprect != NULL)
426         {
427            if (istartx < cliprect->min_x)
428               istartx = cliprect->min_x;
429            if (istopx > cliprect->max_x)
430               istopx = cliprect->max_x + 1;
431         }
432
433         /* set the extent and update the total pixel count */
434         if (istartx >= istopx)
435            istartx = istopx = 0;
436         unit->extent[extnum].startx = istartx;
437         unit->extent[extnum].stopx = istopx;
438         pixels += istopx - istartx;
439      }
440   }
441
442   /* compute parameter starting points and deltas */
443   if (paramcount > 0)
444   {
445      float divisor, dx1, dx2, dy1, dy2, xoffset, yoffset;
446      int paramnum;
447
448      /* compute the divisor */
449      divisor = 1.0f / ((v1->x - v2->x) * (v1->y - v3->y) - (v1->x - v3->x) * (v1->y - v2->y));
450
451      /* compute the dx/dy values */
452      dx1 = v1->y - v3->y;
453      dx2 = v1->y - v2->y;
454      dy1 = v1->x - v2->x;
455      dy2 = v1->x - v3->x;
456
457      /* determine x/y offset for subpixel correction so that the starting values are
458           relative to the integer coordinates */
459      xoffset = v1->x - ((float)polygon->params.xorigin + 0.5f);
460      yoffset = v1->y - ((float)polygon->params.yorigin + 0.5f);
461
462      /* iterate over parameters */
463      for (paramnum = 0; paramnum < paramcount; paramnum++)
464      {
465         poly_param *params = &polygon->params.param[paramnum];
466         params->dpdx = ((v1->p[paramnum] - v2->p[paramnum]) * dx1 - (v1->p[paramnum] - v3->p[paramnum]) * dx2) * divisor;
467         params->dpdy = ((v1->p[paramnum] - v3->p[paramnum]) * dy1 - (v1->p[paramnum] - v2->p[paramnum]) * dy2) * divisor;
468         params->start = v1->p[paramnum] - xoffset * params->dpdx - yoffset * params->dpdy;
469      }
470   }
471
472   /* enqueue the work items */
473   if (poly->queue != NULL)
474      osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE);
475
476   /* return the total number of pixels in the triangle */
477   poly->polygons++;
478   poly->pixels += pixels;
479   return pixels;
480}
481
482
483/*-------------------------------------------------
484    poly_render_custom - perform a custom render
485    of an object, given specific extents
486-------------------------------------------------*/
487
488UINT32 poly_render_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const scanline_extent *extents)
489{
490   INT32 curscan, scaninc;
491   polygon_info *polygon;
492   INT32 v1yclip, v3yclip;
493   INT32 pixels = 0;
494   UINT32 startunit;
495
496   /* clip coordinates */
497   if (cliprect != NULL)
498   {
499      v1yclip = MAX(startscanline, cliprect->min_y);
500      v3yclip = MIN(startscanline + numscanlines, cliprect->max_y + 1);
501   }
502   else
503   {
504      v1yclip = startscanline;
505      v3yclip = startscanline + numscanlines;
506   }
507   if (v3yclip - v1yclip <= 0)
508      return 0;
509
510   /* wait for a work item if we have to */
511   if (poly->polygon_next + 1 > poly->polygon_count)
512      poly_wait(poly, "Out of polygons");
513   else if (poly->unit_next + (v3yclip - v1yclip) / SCANLINES_PER_BUCKET + 2 > poly->unit_count)
514      poly_wait(poly, "Out of work units");
515   polygon = poly->polygon[poly->polygon_next++];
516
517   /* fill in the polygon information */
518   polygon->poly = poly;
519   polygon->dest = dest;
520   polygon->callback = callback;
521
522   /* compute the X extents for each scanline */
523   startunit = poly->unit_next;
524   for (curscan = v1yclip; curscan < v3yclip; curscan += scaninc)
525   {
526      UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS;
527      UINT32 unit_index = poly->unit_next++;
528      work_unit *unit = poly->unit[unit_index];
529      int extnum;
530
531      /* determine how much to advance to hit the next bucket */
532      scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET;
533
534      /* fill in the work unit basics */
535      unit->polygon = polygon;
536      unit->count_next = MIN(v3yclip - curscan, scaninc);
537      unit->scanline = curscan;
538      unit->previtem = poly->unit_bucket[bucketnum];
539      poly->unit_bucket[bucketnum] = unit_index;
540
541      /* iterate over extents */
542      for (extnum = 0; extnum < unit->count_next; extnum++)
543      {
544         const scanline_extent *extent = &extents[(curscan + extnum) - startscanline];
545         INT32 istartx = extent->startx, istopx = extent->stopx;
546
547         /* force start < stop */
548         if (istartx > istopx)
549         {
550            INT32 temp = istartx;
551            istartx = istopx;
552            istopx = temp;
553         }
554
555         /* apply left/right clipping */
556         if (cliprect != NULL)
557         {
558            if (istartx < cliprect->min_x)
559               istartx = cliprect->min_x;
560            if (istopx > cliprect->max_x)
561               istopx = cliprect->max_x + 1;
562         }
563
564         /* set the extent and update the total pixel count */
565         unit->extent[extnum].startx = istartx;
566         unit->extent[extnum].stopx = istopx;
567         if (istartx < istopx)
568            pixels += istopx - istartx;
569      }
570   }
571
572   /* enqueue the work items */
573   if (poly->queue != NULL)
574      osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE);
575
576   /* return the total number of pixels in the object */
577   poly->polygons++;
578   poly->pixels += pixels;
579   return pixels;
580}
581
582
583
584/***************************************************************************
585    WORK ITEM CALLBACK
586***************************************************************************/
587
588/*-------------------------------------------------
589    poly_item_callback - callback for each poly
590    item
591-------------------------------------------------*/
592
593static void *poly_item_callback(void *param, int threadid)
594{
595   while (1)
596   {
597      work_unit *unit = param;
598      polygon_info *polygon = unit->polygon;
599      int count = unit->count_next & 0xffff;
600      UINT32 orig_count_next;
601      int extnum;
602
603      /* if our previous item isn't done yet, enqueue this item to the end and proceed */
604      if (unit->previtem != 0xffff)
605      {
606         work_unit *prevunit = polygon->poly->unit[unit->previtem];
607         if (prevunit->count_next != 0)
608         {
609            UINT32 unitnum = ((UINT8 *)unit - (UINT8 *)polygon->poly->unit[0]) / polygon->poly->unit_size;
610            UINT32 new_count_next;
611
612            /* attempt to atomically swap in this new value */
613            do
614            {
615               orig_count_next = prevunit->count_next;
616               new_count_next = orig_count_next | (unitnum << 16);
617            } while (osd_compare_exchange32((volatile INT32 *)&prevunit->count_next, orig_count_next, new_count_next) != orig_count_next);
618
619#if KEEP_STATISTICS
620            /* track resolved conflicts */
621            polygon->poly->conflicts[threadid]++;
622            if (orig_count_next != 0)
623               polygon->poly->resolved[threadid]++;
624#endif
625            /* if we succeeded, skip out early so we can do other work */
626            if (orig_count_next != 0)
627               break;
628         }
629      }
630
631      /* iterate over extents */
632      for (extnum = 0; extnum < count; extnum++)
633         (*polygon->callback)(polygon->dest, unit->scanline + extnum, unit->extent[extnum].startx, unit->extent[extnum].stopx, &polygon->params, threadid);
634
635      /* set our count to 0 and re-fetch the original count value */
636      do
637      {
638         orig_count_next = unit->count_next;
639      } while (osd_compare_exchange32((volatile INT32 *)&unit->count_next, orig_count_next, 0) != orig_count_next);
640
641      /* if we have no more work to do, do nothing */
642      orig_count_next >>= 16;
643      if (orig_count_next == 0)
644         break;
645      param = polygon->poly->unit[orig_count_next];
646   }
647   return NULL;
648}
src/emu/info.c
r1185r1186
558558
559559   expand_machine_driver(game->drv, &drv);
560560
561   for( i = 0; i < MAX_SOUND && drv.sound[i].sound_type != SOUND_DUMMY; i++ )
561   for( i = 0; i < MAX_SOUND && drv.sound[i].type != SOUND_DUMMY; i++ )
562562   {
563563      const char **samplenames = NULL;
564      if( drv.sound[i].sound_type == SOUND_SAMPLES )
564      if( drv.sound[i].type == SOUND_SAMPLES )
565565         samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames;
566566      if (samplenames != 0 && samplenames[0] != 0) {
567567         int k = 0;
r1185r1186
585585
586586   expand_machine_driver(game->drv, &drv);
587587
588   for( i = 0; i < MAX_SOUND && drv.sound[i].sound_type != SOUND_DUMMY; i++ )
588   for( i = 0; i < MAX_SOUND && drv.sound[i].type != SOUND_DUMMY; i++ )
589589   {
590590      const char **samplenames = NULL;
591      if( drv.sound[i].sound_type == SOUND_SAMPLES )
591      if( drv.sound[i].type == SOUND_SAMPLES )
592592         samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames;
593593      if (samplenames != 0 && samplenames[0] != 0) {
594594         int k = 0;
r1185r1186
626626
627627   for(j=0;j<MAX_CPU;++j)
628628   {
629      if (cpu[j].cpu_type != CPU_DUMMY)
629      if (cpu[j].type != CPU_DUMMY)
630630      {
631631         fprintf(out, "\t\t<chip");
632632         fprintf(out, " type=\"cpu\"");
633633
634         fprintf(out, " name=\"%s\"", xml_normalize_string(cputype_name(cpu[j].cpu_type)));
634         fprintf(out, " name=\"%s\"", xml_normalize_string(cputype_name(cpu[j].type)));
635635
636         fprintf(out, " clock=\"%d\"", cpu[j].cpu_clock);
636         fprintf(out, " clock=\"%d\"", cpu[j].clock);
637637         fprintf(out, "/>\n");
638638      }
639639   }
640640
641641   for(j=0;j<MAX_SOUND;++j)
642642   {
643      if (sound[j].sound_type != SOUND_DUMMY)
643      if (sound[j].type != SOUND_DUMMY)
644644      {
645645         fprintf(out, "\t\t<chip");
646646         fprintf(out, " type=\"audio\"");
647         fprintf(out, " name=\"%s\"", xml_normalize_string(sndtype_name(sound[j].sound_type)));
647         fprintf(out, " name=\"%s\"", xml_normalize_string(sndtype_name(sound[j].type)));
648648         if (sound[j].clock)
649649            fprintf(out, " clock=\"%d\"", sound[j].clock);
650650         fprintf(out, "/>\n");
r1185r1186
728728   i = 0;
729729   while (i < MAX_SOUND && !has_sound)
730730   {
731      if (sound[i].sound_type != SOUND_DUMMY)
731      if (sound[i].type != SOUND_DUMMY)
732732         has_sound = 1;
733733      ++i;
734734   }
src/emu/audit.c
r1185r1186
129129   expand_machine_driver(gamedrv->drv, &config);
130130#if HAS_SAMPLES
131131   for (sndnum = 0; sndnum < ARRAY_LENGTH(config.sound); sndnum++)
132      if (config.sound[sndnum].sound_type == SOUND_SAMPLES)
132      if (config.sound[sndnum].type == SOUND_SAMPLES)
133133      {
134134         struct Samplesinterface *intf = (struct Samplesinterface *)config.sound[sndnum].config;
135135
r1185r1186
154154
155155   /* now iterate over sample entries */
156156   for (sndnum = 0; sndnum < ARRAY_LENGTH(config.sound); sndnum++)
157      if (config.sound[sndnum].sound_type == SOUND_SAMPLES)
157      if (config.sound[sndnum].type == SOUND_SAMPLES)
158158      {
159159         struct Samplesinterface *intf = (struct Samplesinterface *)config.sound[sndnum].config;
160160         const char *sharedname = NULL;
src/emu/memory.c
r1185r1186
11241124
11251125void construct_address_map(address_map *map, const machine_config *drv, int cpunum, int spacenum)
11261126{
1127   int cputype = drv->cpu[cpunum].cpu_type;
1127   int cputype = drv->cpu[cpunum].type;
11281128   construct_map_t internal_map = (construct_map_t)cputype_get_info_fct(cputype, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
11291129
11301130   map->flags = AM_FLAGS_END;
r1185r1186
11541154   memset(&cpudata, 0, sizeof(cpudata));
11551155
11561156   /* loop over CPUs */
1157   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
1157   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
11581158   {
11591159      /* set the RAM/ROM base */
11601160      cpudata[cpunum].op_ram = cpudata[cpunum].op_rom = memory_region(REGION_CPU1 + cpunum);
r1185r1186
12031203static void init_addrspace(UINT8 cpunum, UINT8 spacenum)
12041204{
12051205   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1206   int cputype = Machine->drv->cpu[cpunum].cpu_type;
1206   cpu_type cputype = Machine->drv->cpu[cpunum].type;
12071207   int abits = cputype_addrbus_width(cputype, spacenum);
12081208   int dbits = cputype_databus_width(cputype, spacenum);
12091209   int accessorindex = (dbits == 8) ? 0 : (dbits == 16) ? 1 : (dbits == 32) ? 2 : 3;
r1185r1186
13131313   memset(&bankdata, 0, sizeof(bankdata));
13141314
13151315   /* loop over CPUs */
1316   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
1316   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
13171317      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
13181318         if (cpudata[cpunum].spacemask & (1 << spacenum))
13191319         {
r1185r1186
14131413   int cpunum, spacenum;
14141414
14151415   /* loop over CPUs and address spaces */
1416   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
1416   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
14171417      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
14181418         if (cpudata[cpunum].spacemask & (1 << spacenum))
14191419         {
r1185r1186
20222022   int cpunum, spacenum;
20232023
20242024   /* loop over all CPUs and memory spaces */
2025   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
2025   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
20262026      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
20272027         if (cpudata[cpunum].spacemask & (1 << spacenum))
20282028         {
r1185r1186
22532253   int cpunum, spacenum, banknum;
22542254
22552255   /* loop over CPUs and address spaces */
2256   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
2256   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
22572257      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
22582258         if (cpudata[cpunum].spacemask & (1 << spacenum))
22592259         {
r1185r1186
33813381      return;
33823382
33833383   /* loop over CPUs */
3384   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
3384   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
33853385      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
33863386         if (cpudata[cpunum].space[spacenum].abits)
33873387         {
src/emu/emu.mak
r1185r1186
163163    $(EMUVIDEO)/crtc6845.o \
164164   $(EMUVIDEO)/generic.o \
165165   $(EMUVIDEO)/poly.o \
166   $(EMUVIDEO)/polynew.o \
166167   $(EMUVIDEO)/resnet.o \
167168   $(EMUVIDEO)/s2636.o \
168169   $(EMUVIDEO)/tlc34076.o \
src/emu/machine/6532riot.c
r1185r1186
313313   r6532[which].intf = intf;
314314
315315   /* Default clock is CPU #0 clock */
316   r6532_set_clock( which, Machine->drv->cpu[0].cpu_clock );
316   r6532_set_clock( which, Machine->drv->cpu[0].clock );
317317}
318318
319319
src/emu/machine/6522via.c
r1185r1186
165165   via[which].time2 = via[which].time1 = mame_timer_get_time();
166166
167167   /* Default clock is from CPU1 */
168   via_set_clock (which, Machine->drv->cpu[0].cpu_clock);
168   via_set_clock (which, Machine->drv->cpu[0].clock);
169169}
170170
171171/******************* external interrupt check *******************/
src/emu/machine/8042kbdc.c
r1185r1186
521521         at_8042_receive(PS2_MOUSE_ON ? 0x00 : 0xff);
522522         break;
523523      case 0xaa:   /* selftest */
524         if (Machine->drv->cpu[0].cpu_type == CPU_I486)
524         if (Machine->drv->cpu[0].type == CPU_I486)
525525            mame_timer_set(MAME_TIME_IN_MSEC(10), 0x55, at_8042_receive_timer); /* HACK */
526526         else
527527            at_8042_receive(0x55);
src/emu/machine/tmp68301.c
r1185r1186
9090      {
9191         int scale = (TCR & 0x3c00)>>10;         // P4..1
9292         if (scale > 8) scale = 8;
93         duration = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[0].cpu_clock), (1 << scale) * max);
93         duration = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[0].clock), (1 << scale) * max);
9494      }
9595      break;
9696   }
src/emu/cpuintrf.c
r1185r1186
246246struct _cpuintrf_data
247247{
248248   cpu_interface intf;             /* copy of the interface data */
249   int cputype;                /* type index of this CPU */
249   cpu_type cputype;                /* type index of this CPU */
250250   int family;                /* family index of this CPU */
251251   void *context;               /* dynamically allocated context buffer */
252252};
r1185r1186
909909   /* build the cpuintrf array */
910910   for (mapindex = 0; mapindex < sizeof(cpuintrf_map) / sizeof(cpuintrf_map[0]); mapindex++)
911911   {
912      int cputype = cpuintrf_map[mapindex].cputype;
912      cpu_type cputype = cpuintrf_map[mapindex].cputype;
913913      cpu_interface *intf = &cpuintrf[cputype];
914914      cpuinfo info;
915915
r1185r1186
990990      /* loop over all defined CPUs */
991991      for (totalcpu = 0; totalcpu < CPU_COUNT; totalcpu++)
992992      {
993         int cputype = Machine->drv->cpu[totalcpu].cpu_type;
993         cpu_type cputype = Machine->drv->cpu[totalcpu].type;
994994         char familyname[256];
995995         int j;
996996
r1185r1186
10351035 *
10361036 *************************************/
10371037
1038int cpuintrf_init_cpu(int cpunum, int cputype, int clock, const void *config, int (*irqcallback)(int))
1038int cpuintrf_init_cpu(int cpunum, cpu_type cputype, int clock, const void *config, int (*irqcallback)(int))
10391039{
10401040   cpuinfo info;
10411041
r1185r1186
15211521    Get info accessors
15221522--------------------------*/
15231523
1524INT64 cputype_get_info_int(int cputype, UINT32 state)
1524INT64 cputype_get_info_int(cpu_type cputype, UINT32 state)
15251525{
15261526   cpuinfo info;
15271527
r1185r1186
15311531   return info.i;
15321532}
15331533
1534void *cputype_get_info_ptr(int cputype, UINT32 state)
1534void *cputype_get_info_ptr(cpu_type cputype, UINT32 state)
15351535{
15361536   cpuinfo info;
15371537
r1185r1186
15411541   return info.p;
15421542}
15431543
1544genf *cputype_get_info_fct(int cputype, UINT32 state)
1544genf *cputype_get_info_fct(cpu_type cputype, UINT32 state)
15451545{
15461546   cpuinfo info;
15471547
r1185r1186
15511551   return info.f;
15521552}
15531553
1554const char *cputype_get_info_string(int cputype, UINT32 state)
1554const char *cputype_get_info_string(cpu_type cputype, UINT32 state)
15551555{
15561556   cpuinfo info;
15571557
src/emu/cpuexec.c
r1185r1186
209209   /* loop over all our CPUs */
210210   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
211211   {
212      int cputype = machine->drv->cpu[cpunum].cpu_type;
212      cpu_type cputype = machine->drv->cpu[cpunum].type;
213213      int num_regs;
214214
215215      /* if this is a dummy, stop looking */
r1185r1186
219219      /* initialize the cpuinfo struct */
220220      memset(&cpu[cpunum], 0, sizeof(cpu[cpunum]));
221221      cpu[cpunum].suspend = SUSPEND_REASON_RESET;
222      cpu[cpunum].clock = machine->drv->cpu[cpunum].cpu_clock;
222      cpu[cpunum].clock = machine->drv->cpu[cpunum].clock;
223223      cpu[cpunum].clockscale = 1.0;
224224      cpu[cpunum].localtime = time_zero;
225225
r1185r1186
296296   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
297297   {
298298      /* enable all CPUs (except for disabled CPUs) */
299      if (!(machine->drv->cpu[cpunum].cpu_flags & CPU_DISABLE))
299      if (!(machine->drv->cpu[cpunum].flags & CPU_DISABLE))
300300         cpunum_resume(cpunum, SUSPEND_ANY_REASON);
301301      else
302302         cpunum_suspend(cpunum, SUSPEND_REASON_DISABLE, 1);
r1185r1186
474474   LOG(("cpu_timeslice: target = %.9f\n", mame_time_to_double(target)));
475475
476476   /* process any pending suspends */
477   for (cpunum = 0; Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
477   for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
478478   {
479479      if (cpu[cpunum].suspend != cpu[cpunum].nextsuspend)
480480         LOG(("--> updated CPU%d suspend from %X to %X\n", cpunum, cpu[cpunum].suspend, cpu[cpunum].nextsuspend));
r1185r1186
483483   }
484484
485485   /* loop over CPUs */
486   for (cpunum = 0; Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
486   for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
487487   {
488488      /* only process if we're not suspended */
489489      if (!cpu[cpunum].suspend)
r1185r1186
529529   }
530530
531531   /* update the local times of all CPUs */
532   for (cpunum = 0; Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
532   for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
533533   {
534534      /* if we're suspended and counting, process */
535535      if (cpu[cpunum].suspend && cpu[cpunum].eatcycles && compare_mame_times(cpu[cpunum].localtime, target) < 0)
r1185r1186
970970   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
971971   {
972972      /* if this is a dummy, stop looking */
973      if (Machine->drv->cpu[cpunum].cpu_type == CPU_DUMMY)
973      if (Machine->drv->cpu[cpunum].type == CPU_DUMMY)
974974         break;
975975
976976      /* see if this is a matching trigger */
r1185r1186
13791379   /* start with a huge time factor and find the 2nd smallest cycle time */
13801380   perfect_interleave = time_zero;
13811381   perfect_interleave.subseconds = MAX_SUBSECONDS - 1;
1382   for (cpunum = 1; Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum++)
1382   for (cpunum = 1; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
13831383   {
13841384      /* find the 2nd smallest cycle interval */
13851385      if (subseconds_per_cycle[cpunum] < smallest)
src/emu/cpuintrf.h
r1185r1186
2626
2727#define MAX_CPU 8
2828
29/* Enum listing all the CPUs */
30enum
31{
32   CPU_DUMMY,
33   CPU_Z80,
34   CPU_Z180,
35   CPU_8080,
36   CPU_8085A,
37   CPU_M6502,
38   CPU_M65C02,
39   CPU_M65SC02,
40   CPU_M65CE02,
41   CPU_M6509,
42   CPU_M6510,
43   CPU_M6510T,
44   CPU_M7501,
45   CPU_M8502,
46   CPU_N2A03,
47   CPU_DECO16,
48   CPU_M4510,
49   CPU_H6280,
50   CPU_I8086,
51   CPU_I8088,
52   CPU_I80186,
53   CPU_I80188,
54   CPU_I80286,
55   CPU_V20,
56   CPU_V25,
57   CPU_V30,
58   CPU_V33,
59   CPU_V35,
60   CPU_V60,
61   CPU_V70,
62   CPU_I8035,
63   CPU_I8039,
64   CPU_I8048,
65   CPU_N7751,
66   CPU_I8X41,
67   CPU_I8051,
68   CPU_I8052,
69   CPU_I8751,
70   CPU_I8752,
71   CPU_M6800,
72   CPU_M6801,
73   CPU_M6802,
74   CPU_M6803,
75   CPU_M6808,
76   CPU_HD63701,
77   CPU_NSC8105,
78   CPU_M6805,
79   CPU_M68705,
80   CPU_HD63705,
81   CPU_HD6309,
82   CPU_M6809,
83   CPU_M6809E,
84   CPU_KONAMI,
85   CPU_M68000,
86   CPU_M68008,
87   CPU_M68010,
88   CPU_M68EC020,
89   CPU_M68020,
90   CPU_M68040,
91   CPU_T11,
92   CPU_S2650,
93   CPU_TMS34010,
94   CPU_TMS34020,
95   CPU_TI990_10,
96   CPU_TMS9900,
97   CPU_TMS9940,
98   CPU_TMS9980,
99   CPU_TMS9985,
100   CPU_TMS9989,
101   CPU_TMS9995,
102   CPU_TMS99100,
103   CPU_TMS99105A,
104   CPU_TMS99110A,
105   CPU_Z8000,
106   CPU_TMS32010,
107   CPU_TMS32025,
108   CPU_TMS32026,
109   CPU_TMS32031,
110   CPU_TMS32051,
111   CPU_CCPU,
112   CPU_ADSP2100,
113    CPU_ADSP2101,
114   CPU_ADSP2104,
115   CPU_ADSP2105,
116   CPU_ADSP2115,
117   CPU_ADSP2181,
118   CPU_PSXCPU,
119   CPU_ASAP,
120   CPU_UPD7810,
121   CPU_UPD7807,
122   CPU_JAGUARGPU,
123   CPU_JAGUARDSP,
124   CPU_R3000BE,
125   CPU_R3000LE,
126   CPU_R4600BE,
127   CPU_R4600LE,
128   CPU_R4650BE,
129   CPU_R4650LE,
130   CPU_R4700BE,
131   CPU_R4700LE,
132   CPU_R5000BE,
133   CPU_R5000LE,
134   CPU_QED5271BE,
135   CPU_QED5271LE,
136   CPU_RM7000BE,
137   CPU_RM7000LE,
138   CPU_ARM,
139   CPU_ARM7,
140   CPU_SH2,
141   CPU_SH4,
142   CPU_DSP32C,
143   CPU_PIC16C54,
144   CPU_PIC16C55,
145   CPU_PIC16C56,
146   CPU_PIC16C57,
147   CPU_PIC16C58,
148   CPU_G65816,
149   CPU_SPC700,
150   CPU_E116T,
151   CPU_E116XT,
152   CPU_E116XS,
153   CPU_E116XSR,
154   CPU_E132N,
155   CPU_E132T,
156   CPU_E132XN,
157   CPU_E132XT,
158   CPU_E132XS,
159   CPU_E132XSR,
160   CPU_GMS30C2116,
161   CPU_GMS30C2132,
162   CPU_GMS30C2216,
163   CPU_GMS30C2232,
164   CPU_I386,
165   CPU_I486,
166   CPU_PENTIUM,
167   CPU_MEDIAGX,
168   CPU_I960,
169   CPU_H83002,
170   CPU_V810,
171   CPU_M37702,
172   CPU_M37710,
173   CPU_PPC403,
174   CPU_PPC601,
175   CPU_PPC602,
176   CPU_PPC603,
177   CPU_MPC8240,
178   CPU_SE3208,
179   CPU_MC68HC11,
180   CPU_ADSP21062,
181   CPU_DSP56156,
182   CPU_RSP,
183   CPU_ALPHA8201,
184   CPU_ALPHA8301,
185   CPU_CDP1802,
186   CPU_COP420,
187   CPU_COP410,
188   CPU_COP411,
189   CPU_TMP90840,
190   CPU_TMP90841,
191   CPU_TMP91640,
192   CPU_TMP91641,
193   CPU_APEXC,
194   CPU_CP1610,
195   CPU_F8,
196   CPU_LH5801,
197   CPU_PDP1,
198   CPU_SATURN,
199   CPU_SC61860,
200   CPU_TX0_64KW,
201   CPU_TX0_8KW,
202   CPU_Z80GB,
203   CPU_TMS7000,
204   CPU_TMS7000_EXL,
205   CPU_SM8500,
206   CPU_V30MZ,
207   CPU_MB8841,
208   CPU_MB8842,
209   CPU_MB8843,
210   CPU_MB8844,
211   CPU_MB86233,
212   CPU_SSP1610,
213   CPU_MINX,
214    CPU_COUNT
215};
21629
217
21830/* Interrupt line constants */
21931enum
22032{
r1185r1186
460272void cpuintrf_init(running_machine *machine);
461273
462274/* set up the interface for one CPU of a given type */
463int   cpuintrf_init_cpu(int cpunum, int cputype, int clock, const void *config, int (*irqcallback)(int));
275int   cpuintrf_init_cpu(int cpunum, cpu_type cputype, int clock, const void *config, int (*irqcallback)(int));
464276
465277/* clean up the interface for one CPU */
466278void cpuintrf_exit_cpu(int cpunum);
r1185r1186
620432***************************************************************************/
621433
622434/* get info accessors */
623INT64 cputype_get_info_int(int cputype, UINT32 state);
624void *cputype_get_info_ptr(int cputype, UINT32 state);
625genf *cputype_get_info_fct(int cputype, UINT32 state);
626const char *cputype_get_info_string(int cputype, UINT32 state);
435INT64 cputype_get_info_int(cpu_type cputype, UINT32 state);
436void *cputype_get_info_ptr(cpu_type cputype, UINT32 state);
437genf *cputype_get_info_fct(cpu_type cputype, UINT32 state);
438const char *cputype_get_info_string(cpu_type cputype, UINT32 state);
627439
628440#define cputype_context_size(cputype)         cputype_get_info_int(cputype, CPUINFO_INT_CONTEXT_SIZE)
629441#define cputype_input_lines(cputype)         cputype_get_info_int(cputype, CPUINFO_INT_INPUT_LINES)
r1185r1186
663475***************************************************************************/
664476
665477/* return a pointer to the interface struct for a given CPU type */
666INLINE const cpu_interface *cputype_get_interface(int cputype)
478INLINE const cpu_interface *cputype_get_interface(cpu_type cputype)
667479{
668480   extern cpu_interface cpuintrf[];
669481   return &cpuintrf[cputype];
src/emu/cpuexec.h
r1185r1186
1818#include "timer.h"
1919
2020
21/* Enum listing all the CPUs */
22typedef enum _cpu_type cpu_type;
23enum _cpu_type
24{
25   CPU_DUMMY,
26   CPU_Z80,
27   CPU_Z180,
28   CPU_8080,
29   CPU_8085A,
30   CPU_M6502,
31   CPU_M65C02,
32   CPU_M65SC02,
33   CPU_M65CE02,
34   CPU_M6509,
35   CPU_M6510,
36   CPU_M6510T,
37   CPU_M7501,
38   CPU_M8502,
39   CPU_N2A03,
40   CPU_DECO16,
41   CPU_M4510,
42   CPU_H6280,
43   CPU_I8086,
44   CPU_I8088,
45   CPU_I80186,
46   CPU_I80188,
47   CPU_I80286,
48   CPU_V20,
49   CPU_V25,
50   CPU_V30,
51   CPU_V33,
52   CPU_V35,
53   CPU_V60,
54   CPU_V70,
55   CPU_I8035,
56   CPU_I8039,
57   CPU_I8048,
58   CPU_N7751,
59   CPU_I8X41,
60   CPU_I8051,
61   CPU_I8052,
62   CPU_I8751,
63   CPU_I8752,
64   CPU_M6800,
65   CPU_M6801,
66   CPU_M6802,
67   CPU_M6803,
68   CPU_M6808,
69   CPU_HD63701,
70   CPU_NSC8105,
71   CPU_M6805,
72   CPU_M68705,
73   CPU_HD63705,
74   CPU_HD6309,
75   CPU_M6809,
76   CPU_M6809E,
77   CPU_KONAMI,
78   CPU_M68000,
79   CPU_M68008,
80   CPU_M68010,
81   CPU_M68EC020,
82   CPU_M68020,
83   CPU_M68040,
84   CPU_T11,
85   CPU_S2650,
86   CPU_TMS34010,
87   CPU_TMS34020,
88   CPU_TI990_10,
89   CPU_TMS9900,
90   CPU_TMS9940,
91   CPU_TMS9980,
92   CPU_TMS9985,
93   CPU_TMS9989,
94   CPU_TMS9995,
95   CPU_TMS99100,
96   CPU_TMS99105A,
97   CPU_TMS99110A,
98   CPU_Z8000,
99   CPU_TMS32010,
100   CPU_TMS32025,
101   CPU_TMS32026,
102   CPU_TMS32031,
103   CPU_TMS32051,
104   CPU_CCPU,
105   CPU_ADSP2100,
106    CPU_ADSP2101,
107   CPU_ADSP2104,
108   CPU_ADSP2105,
109   CPU_ADSP2115,
110   CPU_ADSP2181,
111   CPU_PSXCPU,
112   CPU_ASAP,
113   CPU_UPD7810,
114   CPU_UPD7807,
115   CPU_JAGUARGPU,
116   CPU_JAGUARDSP,
117   CPU_R3000BE,
118   CPU_R3000LE,
119   CPU_R4600BE,
120   CPU_R4600LE,
121   CPU_R4650BE,
122   CPU_R4650LE,
123   CPU_R4700BE,
124   CPU_R4700LE,
125   CPU_R5000BE,
126   CPU_R5000LE,
127   CPU_QED5271BE,
128   CPU_QED5271LE,
129   CPU_RM7000BE,
130   CPU_RM7000LE,
131   CPU_ARM,
132   CPU_ARM7,
133   CPU_SH2,
134   CPU_SH4,
135   CPU_DSP32C,
136   CPU_PIC16C54,
137   CPU_PIC16C55,
138   CPU_PIC16C56,
139   CPU_PIC16C57,
140   CPU_PIC16C58,
141   CPU_G65816,
142   CPU_SPC700,
143   CPU_E116T,
144   CPU_E116XT,
145   CPU_E116XS,
146   CPU_E116XSR,
147   CPU_E132N,
148   CPU_E132T,
149   CPU_E132XN,
150   CPU_E132XT,
151   CPU_E132XS,
152   CPU_E132XSR,
153   CPU_GMS30C2116,
154   CPU_GMS30C2132,
155   CPU_GMS30C2216,
156   CPU_GMS30C2232,
157   CPU_I386,
158   CPU_I486,
159   CPU_PENTIUM,
160   CPU_MEDIAGX,
161   CPU_I960,
162   CPU_H83002,
163   CPU_V810,
164   CPU_M37702,
165   CPU_M37710,
166   CPU_PPC403,
167   CPU_PPC601,
168   CPU_PPC602,
169   CPU_PPC603,
170   CPU_MPC8240,
171   CPU_SE3208,
172   CPU_MC68HC11,
173   CPU_ADSP21062,
174   CPU_DSP56156,
175   CPU_RSP,
176   CPU_ALPHA8201,
177   CPU_ALPHA8301,
178   CPU_CDP1802,
179   CPU_COP420,
180   CPU_COP410,
181   CPU_COP411,
182   CPU_TMP90840,
183   CPU_TMP90841,
184   CPU_TMP91640,
185   CPU_TMP91641,
186   CPU_APEXC,
187   CPU_CP1610,
188   CPU_F8,
189   CPU_LH5801,
190   CPU_PDP1,
191   CPU_SATURN,
192   CPU_SC61860,
193   CPU_TX0_64KW,
194   CPU_TX0_8KW,
195   CPU_Z80GB,
196   CPU_TMS7000,
197   CPU_TMS7000_EXL,
198   CPU_SM8500,
199   CPU_V30MZ,
200   CPU_MB8841,
201   CPU_MB8842,
202   CPU_MB8843,
203   CPU_MB8844,
204   CPU_MB86233,
205   CPU_SSP1610,
206   CPU_MINX,
207    CPU_COUNT
208};
21209
210
22211/*************************************
23212 *
24213 *  CPU description for drivers
r1185r1186
28217typedef struct _cpu_config cpu_config;
29218struct _cpu_config
30219{
31   int         cpu_type;               /* index for the CPU type */
32   int         cpu_flags;               /* flags; see #defines below */
33   int         cpu_clock;               /* in Hertz */
220   cpu_type      type;               /* index for the CPU type */
221   int         flags;               /* flags; see #defines below */
222   int         clock;               /* in Hertz */
34223   construct_map_t construct_map[ADDRESS_SPACES][2]; /* 2 memory maps per address space */
35224   void       (*vblank_interrupt)(void);   /* for interrupts tied to VBLANK */
36225   int       vblank_interrupts_per_frame;/* usually 1 */
src/emu/sound/ay8910.c
r1185r1186
672672}
673673
674674
675void *ay8910_start_ym(int chip_type, int sndindex, int clock, int streams,
675void *ay8910_start_ym(sound_type chip_type, int sndindex, int clock, int streams,
676676      read8_handler portAread, read8_handler portBread,
677677      write8_handler portAwrite, write8_handler portBwrite)
678678{
src/emu/sound/ay8910.h
r1185r1186
7777
7878/*********** An interface for SSG of YM2203 ***********/
7979
80void *ay8910_start_ym(int chip_type, int sndindex, int clock, int streams,
80void *ay8910_start_ym(sound_type chip_type, int sndindex, int clock, int streams,
8181      read8_handler portAread, read8_handler portBread,
8282      write8_handler portAwrite, write8_handler portBwrite);
8383
src/emu/sound/scsp.c
r1185r1186
767767         {
768768            SCSP->udata.data[0x20/2]&=~SCSP->udata.data[0x22/2];
769769            ResetInterrupts(SCSP);
770
771            // behavior from real hardware: if you SCIRE a timer that's expired,
772            // it'll immediately pop up again in SCIPD.  ask Sakura Taisen on the Saturn...
773            if (SCSP->TimCnt[0] == 0xffff)
774            {
775               SCSP->udata.data[0x20/2] |= 0x40;
776            }
777            if (SCSP->TimCnt[1] == 0xffff)
778            {
779               SCSP->udata.data[0x20/2] |= 0x80;
780            }
781            if (SCSP->TimCnt[2] == 0xffff)
782            {
783               SCSP->udata.data[0x20/2] |= 0x100;
784            }
770785         }
771786         break;
772787      case 0x24:
src/emu/sound/2610intf.c
r1185r1186
1919
2020#if (BUILD_YM2610||BUILD_YM2610B)
2121
22static int sound_type = SOUND_YM2610;
22static sound_type chip_type = SOUND_YM2610;
2323struct ym2610_info
2424{
2525   sound_stream *   stream;
r1185r1186
130130   int  pcmsizea,pcmsizeb;
131131   struct ym2610_info *info;
132132
133   sound_type = SOUND_YM2610;
133   chip_type = SOUND_YM2610;
134134
135135   info = auto_malloc(sizeof(*info));
136136   memset(info, 0, sizeof(*info));
r1185r1186
182182   int  pcmsizea,pcmsizeb;
183183   struct ym2610_info *info;
184184
185   sound_type = SOUND_YM2610B;
185   chip_type = SOUND_YM2610B;
186186
187187   info = auto_malloc(sizeof(*info));
188188   memset(info, 0, sizeof(*info));
r1185r1186
233233/************************************************/
234234READ8_HANDLER( YM2610_status_port_0_A_r )
235235{
236//logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,0));
237   struct ym2610_info *info = sndti_token(sound_type,0);
236//logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,0));
237   struct ym2610_info *info = sndti_token(chip_type,0);
238238   return YM2610Read(info->chip,0);
239239}
240240
241241READ16_HANDLER( YM2610_status_port_0_A_lsb_r )
242242{
243//logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,0));
244   struct ym2610_info *info = sndti_token(sound_type,0);
243//logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,0));
244   struct ym2610_info *info = sndti_token(chip_type,0);
245245   return YM2610Read(info->chip,0);
246246}
247247
248248READ8_HANDLER( YM2610_status_port_0_B_r )
249249{
250//logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,2));
251   struct ym2610_info *info = sndti_token(sound_type,0);
250//logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,2));
251   struct ym2610_info *info = sndti_token(chip_type,0);
252252   return YM2610Read(info->chip,2);
253253}
254254
255255READ16_HANDLER( YM2610_status_port_0_B_lsb_r )
256256{
257//logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,2));
258   struct ym2610_info *info = sndti_token(sound_type,0);
257//logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,2));
258   struct ym2610_info *info = sndti_token(chip_type,0);
259259   return YM2610Read(info->chip,2);
260260}
261261
r1185r1186
263263/* Status Read for YM2610 - Chip 1              */
264264/************************************************/
265265READ8_HANDLER( YM2610_status_port_1_A_r ) {
266   struct ym2610_info *info = sndti_token(sound_type,1);
266   struct ym2610_info *info = sndti_token(chip_type,1);
267267   return YM2610Read(info->chip,0);
268268}
269269
270270READ16_HANDLER( YM2610_status_port_1_A_lsb_r ) {
271   struct ym2610_info *info = sndti_token(sound_type,1);
271   struct ym2610_info *info = sndti_token(chip_type,1);
272272   return YM2610Read(info->chip,0);
273273}
274274
275275READ8_HANDLER( YM2610_status_port_1_B_r ) {
276   struct ym2610_info *info = sndti_token(sound_type,1);
276   struct ym2610_info *info = sndti_token(chip_type,1);
277277   return YM2610Read(info->chip,2);
278278}
279279
280280READ16_HANDLER( YM2610_status_port_1_B_lsb_r ) {
281   struct ym2610_info *info = sndti_token(sound_type,1);
281   struct ym2610_info *info = sndti_token(chip_type,1);
282282   return YM2610Read(info->chip,2);
283283}
284284
r1185r1186
286286/* Port Read for YM2610 - Chip 0                */
287287/************************************************/
288288READ8_HANDLER( YM2610_read_port_0_r ){
289   struct ym2610_info *info = sndti_token(sound_type,0);
289   struct ym2610_info *info = sndti_token(chip_type,0);
290290   return YM2610Read(info->chip,1);
291291}
292292
293293READ16_HANDLER( YM2610_read_port_0_lsb_r ){
294   struct ym2610_info *info = sndti_token(sound_type,0);
294   struct ym2610_info *info = sndti_token(chip_type,0);
295295   return YM2610Read(info->chip,1);
296296}
297297
r1185r1186
299299/* Port Read for YM2610 - Chip 1                */
300300/************************************************/
301301READ8_HANDLER( YM2610_read_port_1_r ){
302   struct ym2610_info *info = sndti_token(sound_type,1);
302   struct ym2610_info *info = sndti_token(chip_type,1);
303303   return YM2610Read(info->chip,1);
304304}
305305
306306READ16_HANDLER( YM2610_read_port_1_lsb_r ){
307   struct ym2610_info *info = sndti_token(sound_type,1);
307   struct ym2610_info *info = sndti_token(chip_type,1);
308308   return YM2610Read(info->chip,1);
309309}
310310
r1185r1186
315315WRITE8_HANDLER( YM2610_control_port_0_A_w )
316316{
317317//logerror("PC %04x: 2610 Reg A %02X",activecpu_get_pc(),data);
318   struct ym2610_info *info = sndti_token(sound_type,0);
318   struct ym2610_info *info = sndti_token(chip_type,0);
319319   YM2610Write(info->chip,0,data);
320320}
321321
r1185r1186
324324//logerror("PC %04x: 2610 Reg A %02X",activecpu_get_pc(),data);
325325   if (ACCESSING_LSB)
326326   {
327      struct ym2610_info *info = sndti_token(sound_type,0);
327      struct ym2610_info *info = sndti_token(chip_type,0);
328328      YM2610Write(info->chip,0,data);
329329   }
330330}
r1185r1186
332332WRITE8_HANDLER( YM2610_control_port_0_B_w )
333333{
334334//logerror("PC %04x: 2610 Reg B %02X",activecpu_get_pc(),data);
335   struct ym2610_info *info = sndti_token(sound_type,0);
335   struct ym2610_info *info = sndti_token(chip_type,0);
336336   YM2610Write(info->chip,2,data);
337337}
338338
r1185r1186
341341//logerror("PC %04x: 2610 Reg B %02X",activecpu_get_pc(),data);
342342   if (ACCESSING_LSB)
343343   {
344      struct ym2610_info *info = sndti_token(sound_type,0);
344      struct ym2610_info *info = sndti_token(chip_type,0);
345345      YM2610Write(info->chip,2,data);
346346   }
347347}
r1185r1186
351351/* Consists of 2 addresses                      */
352352/************************************************/
353353WRITE8_HANDLER( YM2610_control_port_1_A_w ){
354   struct ym2610_info *info = sndti_token(sound_type,1);
354   struct ym2610_info *info = sndti_token(chip_type,1);
355355   YM2610Write(info->chip,0,data);
356356}
357357
358358WRITE16_HANDLER( YM2610_control_port_1_A_lsb_w ){
359359   if (ACCESSING_LSB)
360360   {
361      struct ym2610_info *info = sndti_token(sound_type,1);
361      struct ym2610_info *info = sndti_token(chip_type,1);
362362      YM2610Write(info->chip,0,data);
363363   }
364364}
365365
366366WRITE8_HANDLER( YM2610_control_port_1_B_w ){
367   struct ym2610_info *info = sndti_token(sound_type,1);
367   struct ym2610_info *info = sndti_token(chip_type,1);
368368   YM2610Write(info->chip,2,data);
369369}
370370
371371WRITE16_HANDLER( YM2610_control_port_1_B_lsb_w ){
372372   if (ACCESSING_LSB)
373373   {
374      struct ym2610_info *info = sndti_token(sound_type,1);
374      struct ym2610_info *info = sndti_token(chip_type,1);
375375      YM2610Write(info->chip,2,data);
376376   }
377377}
r1185r1186
383383WRITE8_HANDLER( YM2610_data_port_0_A_w )
384384{
385385//logerror(" =%02X\n",data);
386   struct ym2610_info *info = sndti_token(sound_type,0);
386   struct ym2610_info *info = sndti_token(chip_type,0);
387387   YM2610Write(info->chip,1,data);
388388}
389389
r1185r1186
392392//logerror(" =%02X\n",data);
393393   if (ACCESSING_LSB)
394394   {
395      struct ym2610_info *info = sndti_token(sound_type,0);
395      struct ym2610_info *info = sndti_token(chip_type,0);
396396      YM2610Write(info->chip,1,data);
397397   }
398398}
r1185r1186
400400WRITE8_HANDLER( YM2610_data_port_0_B_w )
401401{
402402//logerror(" =%02X\n",data);
403   struct ym2610_info *info = sndti_token(sound_type,0);
403   struct ym2610_info *info = sndti_token(chip_type,0);
404404   YM2610Write(info->chip,3,data);
405405}
406406
r1185r1186
409409//logerror(" =%02X\n",data);
410410   if (ACCESSING_LSB)
411411   {
412      struct ym2610_info *info = sndti_token(sound_type,0);
412      struct ym2610_info *info = sndti_token(chip_type,0);
413413      YM2610Write(info->chip,3,data);
414414   }
415415}
r1185r1186
419419/* Consists of 2 addresses                      */
420420/************************************************/
421421WRITE8_HANDLER( YM2610_data_port_1_A_w ){
422   struct ym2610_info *info = sndti_token(sound_type,1);
422   struct ym2610_info *info = sndti_token(chip_type,1);
423423   YM2610Write(info->chip,1,data);
424424}
425425
426426WRITE16_HANDLER( YM2610_data_port_1_A_lsb_w ){
427427   if (ACCESSING_LSB)
428428   {
429      struct ym2610_info *info = sndti_token(sound_type,1);
429      struct ym2610_info *info = sndti_token(chip_type,1);
430430      YM2610Write(info->chip,1,data);
431431   }
432432}
433433
434434WRITE8_HANDLER( YM2610_data_port_1_B_w ){
435   struct ym2610_info *info = sndti_token(sound_type,1);
435   struct ym2610_info *info = sndti_token(chip_type,1);
436436   YM2610Write(info->chip,3,data);
437437}
438438
439439WRITE16_HANDLER( YM2610_data_port_1_B_lsb_w ){
440440   if (ACCESSING_LSB)
441441   {
442      struct ym2610_info *info = sndti_token(sound_type,1);
442      struct ym2610_info *info = sndti_token(chip_type,1);
443443      YM2610Write(info->chip,3,data);
444444   }
445445}
src/emu/sound/gaelco.c
r1185r1186
5050UINT16 *gaelco_sndregs;
5151
5252/* fix me -- asumes that only one type can be active at a time */
53static int chip_type;
53static sound_type chip_type;
5454
5555/* this structure defines a channel */
5656struct gaelcosnd_channel
r1185r1186
252252                        CG-1V/GAE1 Init
253253  ============================================================================*/
254254
255static void *gaelcosnd_start(int sndtype, int sndindex, int clock, const void *config)
255static void *gaelcosnd_start(sound_type sndtype, int sndindex, int clock, const void *config)
256256{
257257   int j, vol;
258258   const struct gaelcosnd_interface *intf = config;
src/emu/sound/es5506.c
r1185r1186
819819
820820***********************************************************************************************/
821821
822static void *es5506_start_common(int sndtype, int sndindex, int clock, const void *config)
822static void *es5506_start_common(sound_type sndtype, int sndindex, int clock, const void *config)
823823{
824824   const struct ES5506interface *intf = config;
825825   struct ES5506Chip *chip;
826826   int j;
827   UINT32 accum_mask;
827828
828829   chip = auto_malloc(sizeof(*chip));
829830   memset(chip, 0, sizeof(*chip));
r1185r1186
851852   chip->irqv = 0x80;
852853
853854   /* init the voices */
855   accum_mask = (sndtype == SOUND_ES5506) ? 0xffffffff : 0x7fffffff;
854856   for (j = 0; j < 32; j++)
855857   {
856858      chip->voice[j].index = j;
r1185r1186
858860      chip->voice[j].lvol = 0xffff;
859861      chip->voice[j].rvol = 0xffff;
860862      chip->voice[j].exbank = 0;
861      chip->voice[j].accum_mask = (sndtype == SOUND_ES5506) ? 0xffffffff : 0x7fffffff;
863      chip->voice[j].accum_mask = accum_mask;
862864   }
863865
864866   /* allocate memory */
src/emu/sound/sid6581.c
r1185r1186
1414
1515static SID6581 *get_sid(int indx)
1616{
17   int type = sndnum_to_sndti(indx, NULL);
17   sound_type type = sndnum_to_sndti(indx, NULL);
1818   assert((type == SOUND_SID6581) || (type == SOUND_SID8580));
1919   return (SID6581 *) sndti_token(type, indx);
2020}
src/emu/ui.c
r1185r1186
10841084   bufptr += sprintf(bufptr, "%s\n%s %s\n\n%s:\n", Machine->gamedrv->description, Machine->gamedrv->year, Machine->gamedrv->manufacturer, ui_getstring(UI_cpu));
10851085
10861086   /* loop over all CPUs */
1087   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].cpu_type != CPU_DUMMY; cpunum += count)
1087   for (cpunum = 0; cpunum < MAX_CPU && Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum += count)
10881088   {
1089      int type = Machine->drv->cpu[cpunum].cpu_type;
1090      int clock = Machine->drv->cpu[cpunum].cpu_clock;
1089      cpu_type type = Machine->drv->cpu[cpunum].type;
1090      int clock = Machine->drv->cpu[cpunum].clock;
10911091
10921092      /* count how many identical CPUs we have */
10931093      for (count = 1; cpunum + count < MAX_CPU; count++)
1094         if (Machine->drv->cpu[cpunum + count].cpu_type != type ||
1095              Machine->drv->cpu[cpunum + count].cpu_clock != clock)
1094         if (Machine->drv->cpu[cpunum + count].type != type ||
1095              Machine->drv->cpu[cpunum + count].clock != clock)
10961096             break;
10971097
10981098      /* if more than one, prepend a #x in front of the CPU name */
r1185r1186
11111111   bufptr += sprintf(bufptr, "\n%s:\n", ui_getstring(UI_sound));
11121112
11131113   /* loop over all sound chips */
1114   for (sndnum = 0; sndnum < MAX_SOUND && Machine->drv->sound[sndnum].sound_type != SOUND_DUMMY; sndnum += count)
1114   for (sndnum = 0; sndnum < MAX_SOUND && Machine->drv->sound[sndnum].type != SOUND_DUMMY; sndnum += count)
11151115   {
1116      int type = Machine->drv->sound[sndnum].sound_type;
1116      sound_type type = Machine->drv->sound[sndnum].type;
11171117      int clock = sndnum_clock(sndnum);
11181118
11191119      /* count how many identical sound chips we have */
11201120      for (count = 1; sndnum + count < MAX_SOUND; count++)
1121         if (Machine->drv->sound[sndnum + count].sound_type != type ||
1121         if (Machine->drv->sound[sndnum + count].type != type ||
11221122              sndnum_clock(sndnum + count) != clock)
11231123             break;
11241124
src/emu/sndintrf.c
r1185r1186
5454struct _sndintrf_data
5555{
5656   sound_interface   intf;          /* copy of the interface data */
57   int            sndtype;       /* type index of this sound chip */
58   int            aliastype;      /* aliased type index of this sound chip */
57   sound_type         sndtype;       /* type index of this sound chip */
58   sound_type         aliastype;      /* aliased type index of this sound chip */
5959   int            index;          /* index of this sound chip */
6060   int            clock;          /* clock for this sound chip */
6161   void *         token;         /* dynamically allocated token data */
r1185r1186
178178
179179static const struct
180180{
181   int      sndtype;
181   sound_type   sndtype;
182182   void   (*get_info)(void *token, UINT32 state, sndinfo *info);
183183} sndintrf_map[] =
184184{
r1185r1186
498498   /* build the sndintrf array */
499499   for (mapindex = 0; mapindex < sizeof(sndintrf_map) / sizeof(sndintrf_map[0]); mapindex++)
500500   {
501      int sndtype = sndintrf_map[mapindex].sndtype;
501      sound_type sndtype = sndintrf_map[mapindex].sndtype;
502502      sound_interface *intf = &sndintrf[sndtype];
503503      sndinfo info;
504504
r1185r1186
542542    particular sndnum
543543-------------------------------------------------*/
544544
545int sndintrf_init_sound(int sndnum, int sndtype, int clock, const void *config)
545int sndintrf_init_sound(int sndnum, sound_type sndtype, int clock, const void *config)
546546{
547547   sndintrf_data *info = &sound[sndnum];
548548   int index;
r1185r1186
614614    pair describes an existing chip
615615-------------------------------------------------*/
616616
617int sndti_exists(int type, int index)
617int sndti_exists(sound_type type, int index)
618618{
619619   return (sound_matrix[type][index] != 0);
620620}
r1185r1186
625625    a sound number
626626-------------------------------------------------*/
627627
628int sndti_to_sndnum(int type, int index)
628int sndti_to_sndnum(sound_type type, int index)
629629{
630630   return sound_matrix[type][index] - 1;
631631}
r1185r1186
636636    (type,index) pair
637637-------------------------------------------------*/
638638
639int sndnum_to_sndti(int sndnum, int *index)
639sound_type sndnum_to_sndti(int sndnum, int *index)
640640{
641641   if (index != NULL)
642642      *index = sound[sndnum].index;
r1185r1186
756756    Get info accessors
757757-------------------------------------------------*/
758758
759INT64 sndti_get_info_int(int sndtype, int sndindex, UINT32 state)
759INT64 sndti_get_info_int(sound_type sndtype, int sndindex, UINT32 state)
760760{
761761   sndinfo info;
762762   int sndnum;
r1185r1186
768768   return info.i;
769769}
770770
771void *sndti_get_info_ptr(int sndtype, int sndindex, UINT32 state)
771void *sndti_get_info_ptr(sound_type sndtype, int sndindex, UINT32 state)
772772{
773773   sndinfo info;
774774   int sndnum;
r1185r1186
780780   return info.p;
781781}
782782
783genf *sndti_get_info_fct(int sndtype, int sndindex, UINT32 state)
783genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state)
784784{
785785   sndinfo info;
786786   int sndnum;
r1185r1186
792792   return info.f;
793793}
794794
795const char *sndti_get_info_string(int sndtype, int sndindex, UINT32 state)
795const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state)
796796{
797797   sndinfo info;
798798   int sndnum;
r1185r1186
809809    Set info accessors
810810-------------------------------------------------*/
811811
812void sndti_set_info_int(int sndtype, int sndindex, UINT32 state, INT64 data)
812void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 data)
813813{
814814   sndinfo info;
815815   int sndnum;
r1185r1186
820820   (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info);
821821}
822822
823void sndti_set_info_ptr(int sndtype, int sndindex, UINT32 state, void *data)
823void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data)
824824{
825825   sndinfo info;
826826   int sndnum;
r1185r1186
831831   (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info);
832832}
833833
834void sndti_set_info_fct(int sndtype, int sndindex, UINT32 state, genf *data)
834void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data)
835835{
836836   sndinfo info;
837837   int sndnum;
r1185r1186
847847    Misc accessors
848848-------------------------------------------------*/
849849
850void sndti_reset(int sndtype, int sndindex)
850void sndti_reset(sound_type sndtype, int sndindex)
851851{
852852   int sndnum;
853853
r1185r1186
857857      (*sound[sndnum].intf.reset)(sound[sndnum].token);
858858}
859859
860int sndti_clock(int sndtype, int sndindex)
860int sndti_clock(sound_type sndtype, int sndindex)
861861{
862862   int sndnum;
863863   VERIFY_SNDTI(sndti_clock);
r1185r1186
865865   return sound[sndnum].clock;
866866}
867867
868void *sndti_token(int sndtype, int sndindex)
868void *sndti_token(sound_type sndtype, int sndindex)
869869{
870870   int sndnum;
871871   VERIFY_SNDTI(sndti_token);
r1185r1186
883883    Get info accessors
884884-------------------------------------------------*/
885885
886INT64 sndtype_get_info_int(int sndtype, UINT32 state)
886INT64 sndtype_get_info_int(sound_type sndtype, UINT32 state)
887887{
888888   sndinfo info;
889889
r1185r1186
893893   return info.i;
894894}
895895
896void *sndtype_get_info_ptr(int sndtype, UINT32 state)
896void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state)
897897{
898898   sndinfo info;
899899
r1185r1186
903903   return info.p;
904904}
905905
906genf *sndtype_get_info_fct(int sndtype, UINT32 state)
906genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state)
907907{
908908   sndinfo info;
909909
r1185r1186
913913   return info.f;
914914}
915915
916const char *sndtype_get_info_string(int sndtype, UINT32 state)
916const char *sndtype_get_info_string(sound_type sndtype, UINT32 state)
917917{
918918   sndinfo info;
919919
src/emu/sound.c
r1185r1186
259259
260260   /* stop all the sound chips */
261261   for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
262      if (Machine->drv->sound[sndnum].sound_type != SOUND_DUMMY)
262      if (Machine->drv->sound[sndnum].type != SOUND_DUMMY)
263263         sndintrf_exit_sound(sndnum);
264264
265265   /* reset variables */
r1185r1186
296296      int index;
297297
298298      /* stop when we hit an empty entry */
299      if (msound->sound_type == SOUND_DUMMY)
299      if (msound->type == SOUND_DUMMY)
300300         break;
301301      totalsnd++;
302302
r1185r1186
308308      info->sound = msound;
309309
310310      /* start the chip, tagging all its streams */
311      VPRINTF(("sndnum = %d -- sound_type = %d\n", sndnum, msound->sound_type));
311      VPRINTF(("sndnum = %d -- sound_type = %d\n", sndnum, msound->type));
312312      num_regs = state_save_get_reg_count();
313313      streams_set_tag(Machine, info);
314      if (sndintrf_init_sound(sndnum, msound->sound_type, msound->clock, msound->config) != 0)
314      if (sndintrf_init_sound(sndnum, msound->type, msound->clock, msound->config) != 0)
315315         fatalerror("Sound chip #%d (%s) failed to initialize!", sndnum, sndnum_name(sndnum));
316316
317317      /* if no state registered for saving, we can't save */
r1185r1186
517517
518518   /* reset all the sound chips */
519519   for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
520      if (Machine->drv->sound[sndnum].sound_type != SOUND_DUMMY)
520      if (Machine->drv->sound[sndnum].type != SOUND_DUMMY)
521521         sndnum_reset(sndnum);
522522}
523523
r1185r1186
815815    particular output
816816-------------------------------------------------*/
817817
818void sndti_set_output_gain(int type, int index, int output, float gain)
818void sndti_set_output_gain(sound_type type, int index, int output, float gain)
819819{
820820   int sndnum = sndti_to_sndnum(type, index);
821821
src/emu/driver.c
r1185r1186
7171    driver expansion
7272-------------------------------------------------*/
7373
74cpu_config *driver_add_cpu(machine_config *machine, const char *tag, int type, int cpuclock)
74cpu_config *driver_add_cpu(machine_config *machine, const char *tag, cpu_type type, int cpuclock)
7575{
7676   int cpunum;
7777
7878   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
79      if (machine->cpu[cpunum].cpu_type == CPU_DUMMY)
79      if (machine->cpu[cpunum].type == CPU_DUMMY)
8080      {
8181         machine->cpu[cpunum].tag = tag;
82         machine->cpu[cpunum].cpu_type = type;
83         machine->cpu[cpunum].cpu_clock = cpuclock;
82         machine->cpu[cpunum].type = type;
83         machine->cpu[cpunum].clock = cpuclock;
8484         return &machine->cpu[cpunum];
8585      }
8686
r1185r1186
196196    machine driver expansion
197197-------------------------------------------------*/
198198
199sound_config *driver_add_sound(machine_config *machine, const char *tag, int type, int clock)
199sound_config *driver_add_sound(machine_config *machine, const char *tag, sound_type type, int clock)
200200{
201201   int soundnum;
202202
203203   for (soundnum = 0; soundnum < MAX_SOUND; soundnum++)
204      if (machine->sound[soundnum].sound_type == SOUND_DUMMY)
204      if (machine->sound[soundnum].type == SOUND_DUMMY)
205205      {
206206         machine->sound[soundnum].tag = tag;
207         machine->sound[soundnum].sound_type = type;
207         machine->sound[soundnum].type = type;
208208         machine->sound[soundnum].clock = clock;
209209         machine->sound[soundnum].config = NULL;
210210         machine->sound[soundnum].routes = 0;
src/emu/sndintrf.h
r1185r1186
2626#define MAX_SOUND 32
2727
2828/* Enum listing all the sound chips */
29enum
29typedef enum _sound_type sound_type;
30enum _sound_type
3031{
3132   SOUND_DUMMY,
3233   SOUND_CUSTOM,
r1185r1186
221222***************************************************************************/
222223
223224/* get info accessors */
224INT64 sndti_get_info_int(int sndtype, int sndindex, UINT32 state);
225void *sndti_get_info_ptr(int sndtype, int sndindex, UINT32 state);
226genf *sndti_get_info_fct(int sndtype, int sndindex, UINT32 state);
227const char *sndti_get_info_string(int sndtype, int sndindex, UINT32 state);
225INT64 sndti_get_info_int(sound_type sndtype, int sndindex, UINT32 state);
226void *sndti_get_info_ptr(sound_type sndtype, int sndindex, UINT32 state);
227genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state);
228const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state);
228229
229230/* set info accessors */
230void sndti_set_info_int(int sndtype, int sndindex, UINT32 state, INT64 data);
231void sndti_set_info_ptr(int sndtype, int sndindex, UINT32 state, void *data);
232void sndti_set_info_fct(int sndtype, int sndindex, UINT32 state, genf *data);
231void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 data);
232void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data);
233void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data);
233234
234235#define sndti_name(sndtype, sndindex)         sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_NAME)
235236#define sndti_core_family(sndtype, sndindex)   sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FAMILY)
r1185r1186
238239#define sndti_core_credits(sndtype, sndindex)   sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_CREDITS)
239240
240241/* misc accessors */
241void sndti_reset(int type, int index);
242int sndti_clock(int sndtype, int sndindex);
243void *sndti_token(int sndtype, int sndindex);
242void sndti_reset(sound_type sndtype, int sndindex);
243int sndti_clock(sound_type sndtype, int sndindex);
244void *sndti_token(sound_type sndtype, int sndindex);
244245
245246/* driver gain controls on chip outputs */
246void sndti_set_output_gain(int type, int index, int output, float gain);
247void sndti_set_output_gain(sound_type sndtype, int sndindex, int output, float gain);
247248
248249
249250
r1185r1186
252253***************************************************************************/
253254
254255/* get info accessors */
255INT64 sndtype_get_info_int(int sndtype, UINT32 state);
256void *sndtype_get_info_ptr(int sndtype, UINT32 state);
257genf *sndtype_get_info_fct(int sndtype, UINT32 state);
258const char *sndtype_get_info_string(int sndtype, UINT32 state);
256INT64 sndtype_get_info_int(sound_type sndtype, UINT32 state);
257void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state);
258genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state);
259const char *sndtype_get_info_string(sound_type sndtype, UINT32 state);
259260
260261#define sndtype_name(sndtype)               sndtype_get_info_string(sndtype, SNDINFO_STR_NAME)
261262#define sndtype_core_family(sndtype)         sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FAMILY)
r1185r1186
271272
272273/* Initialization/Tear down */
273274void sndintrf_init(running_machine *machine);
274int sndintrf_init_sound(int sndnum, int sndtype, int clock, const void *config);
275int sndintrf_init_sound(int sndnum, sound_type sndtype, int clock, const void *config);
275276void sndintrf_exit_sound(int sndnum);
276277void sndintrf_register_token(void *token);
277278
278279/* Misc helpers */
279int sndti_exists(int type, int index);
280int sndti_to_sndnum(int type, int index);
281int sndnum_to_sndti(int sndnum, int *index);
280int sndti_exists(sound_type sndtype, int sndindex);
281int sndti_to_sndnum(sound_type type, int index);
282sound_type sndnum_to_sndti(int sndnum, int *index);
282283
283284
284285#endif   /* __SNDINTRF_H__ */
src/emu/sound.h
r1185r1186
4343typedef struct _sound_config sound_config;
4444struct _sound_config
4545{
46   int         sound_type;            /* what type of sound chip? */
46   sound_type      type;         /* what type of sound chip? */
4747   int         clock;               /* clock speed */
4848   const void *config;               /* configuration for this chip */
4949   const char *tag;               /* tag for this chip */
src/emu/input.c
r1185r1186
11221122   modifier = code_to_string(modifier_token_table, INPUT_CODE_MODIFIER(code));
11231123
11241124   /* determine the itemclass part; if we match the native class, we don't include this */
1125   if (item->itemclass == INPUT_CODE_ITEMCLASS(code))
1125   if (item == NULL || item->itemclass == INPUT_CODE_ITEMCLASS(code))
11261126      itemclass = "";
11271127   else
11281128      itemclass = code_to_string(itemclass_token_table, INPUT_CODE_ITEMCLASS(code));
src/emu/driver.h
r1185r1186
281281   driver_remove_cpu(machine, tag);                           \
282282   cpu = NULL;                                             \
283283
284#define MDRV_CPU_REPLACE(tag, type, clock)                        \
284#define MDRV_CPU_REPLACE(tag, _type, _clock)                        \
285285   cpu = driver_find_cpu(machine, tag);                        \
286   cpu->cpu_type = (CPU_##type);                              \
287   cpu->cpu_clock = (clock);                                 \
286   cpu->type = (CPU_##_type);                              \
287   cpu->clock = (_clock);                                 \
288288
289289
290290/* CPU parameters */
291#define MDRV_CPU_FLAGS(flags)                                 \
291#define MDRV_CPU_FLAGS(_flags)                                 \
292292   if (cpu)                                             \
293      cpu->cpu_flags = (flags);                              \
293      cpu->flags = (_flags);                              \
294294
295295#define MDRV_CPU_CONFIG(config)                                 \
296296   if (cpu)                                             \
r1185r1186
482482   if (sound)                                             \
483483      sound->config = &(_config);                              \
484484
485#define MDRV_SOUND_REPLACE(tag, type, _clock)                     \
485#define MDRV_SOUND_REPLACE(tag, _type, _clock)                     \
486486   sound = driver_find_sound(machine, tag);                     \
487487   if (sound)                                             \
488488   {                                                   \
489      sound->sound_type = SOUND_##type;                        \
489      sound->type = SOUND_##_type;                        \
490490      sound->clock = (_clock);                              \
491491      sound->config = NULL;                                 \
492492      sound->routes = 0;                                    \
r1185r1186
578578
579579void expand_machine_driver(void (*constructor)(machine_config *), machine_config *output);
580580
581cpu_config *driver_add_cpu(machine_config *machine, const char *tag, int type, int cpuclock);
581cpu_config *driver_add_cpu(machine_config *machine, const char *tag, cpu_type type, int cpuclock);
582582cpu_config *driver_find_cpu(machine_config *machine, const char *tag);
583583void driver_remove_cpu(machine_config *machine, const char *tag);
584584
r1185r1186
586586speaker_config *driver_find_speaker(machine_config *machine, const char *tag);
587587void driver_remove_speaker(machine_config *machine, const char *tag);
588588
589sound_config *driver_add_sound(machine_config *machine, const char *tag, int type, int clock);
589sound_config *driver_add_sound(machine_config *machine, const char *tag, sound_type type, int clock);
590590sound_config *driver_find_sound(machine_config *machine, const char *tag);
591591void driver_remove_sound(machine_config *machine, const char *tag);
592592
src/emu/cpuint.c
r1185r1186
125125      {
126126         input_line_state[cpunum][line] = CLEAR_LINE;
127127         interrupt_vector[cpunum][line] =
128         input_line_vector[cpunum][line] = cputype_default_irq_vector(Machine->drv->cpu[cpunum].cpu_type);
128         input_line_vector[cpunum][line] = cputype_default_irq_vector(Machine->drv->cpu[cpunum].type);
129129         input_event_index[cpunum][line] = 0;
130130      }
131131   }
r1185r1186
234234         {
235235            case PULSE_LINE:
236236               /* temporary: PULSE_LINE only makes sense for NMI lines on Z80 */
237               assert(machine->drv->cpu[cpunum].cpu_type != CPU_Z80 || line == INPUT_LINE_NMI);
237               assert(machine->drv->cpu[cpunum].type != CPU_Z80 || line == INPUT_LINE_NMI);
238238               activecpu_set_input_line(line, INTERNAL_ASSERT_LINE);
239239               activecpu_set_input_line(line, INTERNAL_CLEAR_LINE);
240240               break;
src/emu/clifront.c
r1185r1186
563563         expand_machine_driver(drivers[drvindex]->drv, &drv);
564564
565565         /* find samples interfaces */
566         for (sndnum = 0; sndnum < MAX_SOUND && drv.sound[sndnum].sound_type != SOUND_DUMMY; sndnum++)
567            if (drv.sound[sndnum].sound_type == SOUND_SAMPLES)
566         for (sndnum = 0; sndnum < MAX_SOUND && drv.sound[sndnum].type != SOUND_DUMMY; sndnum++)
567            if (drv.sound[sndnum].type == SOUND_SAMPLES)
568568            {
569569               const char **samplenames = ((struct Samplesinterface *)drv.sound[sndnum].config)->samplenames;
570570               int sampnum;
src/emu/cheat.c
r1185r1186
89378937      case kSearchSpeed_Fast:
89388938
89398939#if HAS_SH2
8940         if(Machine->drv->cpu[0].cpu_type == CPU_SH2)
8940         if(Machine->drv->cpu[0].type == CPU_SH2)
89418941         {
89428942            if(   (info->targetType == kRegionType_CPU) && (info->targetIdx == 0) && (region->address == 0x06000000))
89438943               return 1;
r1185r1186
89638963#if HAS_TMS34010
89648964
89658965         /* ----- for exterminator, search bank one ----- */
8966         if(   (Machine->drv->cpu[1].cpu_type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) &&
8966         if(   (Machine->drv->cpu[1].type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) &&
89678967            (info->targetIdx == 1) && (handler == MWA8_BANK1))
89688968            return 1;
89698969
89708970         /* ----- for smashtv, search bank two ----- */
8971         if(   (Machine->drv->cpu[0].cpu_type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) &&
8971         if(   (Machine->drv->cpu[0].type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) &&
89728972            (info->targetIdx == 0) && (handler == MWA8_BANK2))
89738973            return 1;
89748974
r1185r1186
1185211852         CPUInfo   * info = &cpuInfoList[i];
1185311853         CPUInfo   * regionInfo = &regionInfoList[REGION_CPU1 + i - REGION_INVALID];
1185411854
11855         int      type = Machine->drv->cpu[i].cpu_type;
11855         cpu_type type = Machine->drv->cpu[i].type;
1185611856
1185711857         info->type = type;
1185811858         info->dataBits = cputype_databus_width(type, ADDRESS_SPACE_PROGRAM);
src/emu/validity.c
r1185r1186
264264
265265#ifndef MESS
266266   /* make sure sound-less drivers are flagged */
267   if ((driver->flags & GAME_IS_BIOS_ROOT) == 0 && drv->sound[0].sound_type == SOUND_DUMMY && (driver->flags & GAME_NO_SOUND) == 0 && strcmp(driver->name, "minivadr"))
267   if ((driver->flags & GAME_IS_BIOS_ROOT) == 0 && drv->sound[0].type == SOUND_DUMMY && (driver->flags & GAME_NO_SOUND) == 0 && strcmp(driver->name, "minivadr"))
268268   {
269269      mame_printf_error("%s: %s missing GAME_NO_SOUND flag\n", driver->source_file, driver->name);
270270      error = TRUE;
r1185r1186
471471      int spacenum;
472472
473473      /* skip empty entries */
474      if (cpu->cpu_type == CPU_DUMMY)
474      if (cpu->type == CPU_DUMMY)
475475         continue;
476476
477477      /* checks to see if this driver is using a dummy CPU */
478      if (cputype_get_interface(cpu->cpu_type)->get_info == dummy_get_info)
478      if (cputype_get_interface(cpu->type)->get_info == dummy_get_info)
479479      {
480480         mame_printf_error("%s: %s uses non-present CPU\n", driver->source_file, driver->name);
481481         error = TRUE;
r1185r1186
483483      }
484484
485485      /* check the CPU for incompleteness */
486      if (!cputype_get_info_fct(cpu->cpu_type, CPUINFO_PTR_GET_CONTEXT)
487         || !cputype_get_info_fct(cpu->cpu_type, CPUINFO_PTR_SET_CONTEXT)
488         || !cputype_get_info_fct(cpu->cpu_type, CPUINFO_PTR_RESET)
489         || !cputype_get_info_fct(cpu->cpu_type, CPUINFO_PTR_EXECUTE))
486      if (!cputype_get_info_fct(cpu->type, CPUINFO_PTR_GET_CONTEXT)
487         || !cputype_get_info_fct(cpu->type, CPUINFO_PTR_SET_CONTEXT)
488         || !cputype_get_info_fct(cpu->type, CPUINFO_PTR_RESET)
489         || !cputype_get_info_fct(cpu->type, CPUINFO_PTR_EXECUTE))
490490      {
491491         mame_printf_error("%s: %s uses an incomplete CPU\n", driver->source_file, driver->name);
492492         error = TRUE;
r1185r1186
499499#define SPACE_SHIFT(a)      ((addr_shift < 0) ? ((a) << -addr_shift) : ((a) >> addr_shift))
500500#define SPACE_SHIFT_END(a)   ((addr_shift < 0) ? (((a) << -addr_shift) | ((1 << -addr_shift) - 1)) : ((a) >> addr_shift))
501501         static const char *spacename[] = { "program", "data", "I/O" };
502         int databus_width = cputype_databus_width(cpu->cpu_type, spacenum);
503         int addr_shift = cputype_addrbus_shift(cpu->cpu_type, spacenum);
502         int databus_width = cputype_databus_width(cpu->type, spacenum);
503         int addr_shift = cputype_addrbus_shift(cpu->type, spacenum);
504504         int alignunit = databus_width/8;
505505         address_map addrmap[MAX_ADDRESS_MAP_SIZE*2];
506506         address_map *map;
r1185r1186
11101110         }
11111111
11121112      /* make sure there are no sound chips with the same tag */
1113      for (check = 0; check < MAX_SOUND && drv->sound[check].sound_type != SOUND_DUMMY; check++)
1113      for (check = 0; check < MAX_SOUND && drv->sound[check].type != SOUND_DUMMY; check++)
11141114         if (drv->sound[check].tag && !strcmp(drv->speaker[speaknum].tag, drv->sound[check].tag))
11151115         {
11161116            mame_printf_error("%s: %s has both a speaker and a sound chip tagged as '%s'\n", driver->source_file, driver->name, drv->speaker[speaknum].tag);
r1185r1186
11191119   }
11201120
11211121   /* make sure the sounds are wired to the speakers correctly */
1122   for (sndnum = 0; sndnum < MAX_SOUND && drv->sound[sndnum].sound_type != SOUND_DUMMY; sndnum++)
1122   for (sndnum = 0; sndnum < MAX_SOUND && drv->sound[sndnum].type != SOUND_DUMMY; sndnum++)
11231123   {
11241124      int routenum;
11251125
r1185r1186
11361136         {
11371137            int check;
11381138
1139            for (check = 0; check < MAX_SOUND && drv->sound[check].sound_type != SOUND_DUMMY; check++)
1139            for (check = 0; check < MAX_SOUND && drv->sound[check].type != SOUND_DUMMY; check++)
11401140               if (check != sndnum && drv->sound[check].tag && !strcmp(drv->sound[check].tag, drv->sound[sndnum].route[routenum].target))
11411141                  break;
11421142
11431143            /* if we didn't find one, it's an error */
1144            if (check >= MAX_SOUND || drv->sound[check].sound_type == SOUND_DUMMY)
1144            if (check >= MAX_SOUND || drv->sound[check].type == SOUND_DUMMY)
11451145            {
11461146               mame_printf_error("%s: %s attempting to route sound to non-existant speaker '%s'\n", driver->source_file, driver->name, drv->sound[sndnum].route[routenum].target);
11471147               error = TRUE;
src/emu/romload.c
r1185r1186
452452   /* if this is a CPU region, override with the CPU width and endianness */
453453   if (type >= REGION_CPU1 && type < REGION_CPU1 + MAX_CPU)
454454   {
455      int cputype = Machine->drv->cpu[type - REGION_CPU1].cpu_type;
455      cpu_type cputype = Machine->drv->cpu[type - REGION_CPU1].type;
456456      if (cputype != CPU_DUMMY)
457457      {
458458         datawidth = cputype_databus_width(cputype, ADDRESS_SPACE_PROGRAM) / 8;
src/lib/util/chd.c
r1185r1186
194194***************************************************************************/
195195
196196/* internal async operations */
197static void *async_read_callback(void *param);
198static void *async_write_callback(void *param);
197static void *async_read_callback(void *param, int threadid);
198static void *async_write_callback(void *param, int threadid);
199199
200200/* internal header operations */
201201static chd_error header_validate(const chd_header *header);
r1185r1186
15771577    callback
15781578-------------------------------------------------*/
15791579
1580static void *async_read_callback(void *param)
1580static void *async_read_callback(void *param, int threadid)
15811581{
15821582   chd_file *chd = param;
15831583   chd_error err;
r1185r1186
15951595    callback
15961596-------------------------------------------------*/
15971597
1598static void *async_write_callback(void *param)
1598static void *async_write_callback(void *param, int threadid)
15991599{
16001600   chd_file *chd = param;
16011601   chd_error err;
src/mess/devices/cartslot.c
r1185r1186
7676      /* if the region is inverted, do that now */
7777      if (type >= REGION_CPU1 && type < REGION_CPU1 + MAX_CPU)
7878      {
79         int cputype = Machine->drv->cpu[type - REGION_CPU1].cpu_type;
79         int cputype = Machine->drv->cpu[type - REGION_CPU1].type;
8080         if (cputype != 0)
8181         {
8282            datawidth = cputype_databus_width(cputype, ADDRESS_SPACE_PROGRAM) / 8;
src/mess/audio/svision.c
r1185r1186
3434         svision_dma.size = (data ? data : 0x100) * 32;
3535         break;
3636      case 3:
37         svision_dma.step = Machine->drv->cpu[0].cpu_clock / (256.0 * Machine->sample_rate * (1 + (data & 3)));
37         svision_dma.step = Machine->drv->cpu[0].clock / (256.0 * Machine->sample_rate * (1 + (data & 3)));
3838         svision_dma.right = data & 4;
3939         svision_dma.left = data & 8;
4040         svision_dma.ca14to16 = ((data & 0x70) >> 4) << 14;
r1185r1186
5757   {
5858      case 0:
5959         svision_noise.volume=data&0xf;
60         svision_noise.step=Machine->drv->cpu[0].cpu_clock/(256.0*Machine->sample_rate*(1+(data>>4)));
60         svision_noise.step=Machine->drv->cpu[0].clock/(256.0*Machine->sample_rate*(1+(data>>4)));
6161         break;
6262      case 1:
6363         svision_noise.count = data + 1;
r1185r1186
8989         if (size)
9090         {
9191            //   channel->size=(int)(Machine->sample_rate*(size<<5)/4e6);
92            channel->size= (int) (Machine->sample_rate * (size << 5) / Machine->drv->cpu[0].cpu_clock);
92            channel->size= (int) (Machine->sample_rate * (size << 5) / Machine->drv->cpu[0].clock);
9393         }
9494         else
9595         {
src/mess/video/pc_vga.c
r1185r1186
590590      }
591591   }
592592
593   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
593   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
594594   switch(buswidth)
595595   {
596596      case 8:
r1185r1186
11061106   memset(vga.crtc.data, '\0', vga.svga_intf.crtc_regcount);
11071107   memset(vga.gc.data, '\0', vga.svga_intf.gc_regcount);
11081108
1109   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
1109   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
11101110   switch(buswidth)
11111111   {
11121112      case 8:
src/mess/video/pc_mda.c
r1185r1186
188188{
189189   int buswidth;
190190
191   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
191   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
192192   switch(buswidth)
193193   {
194194      case 8:
src/mess/video/pc_aga.c
r1185r1186
208208
209209   pc_mda_europc_init();
210210
211   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
211   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
212212   switch(buswidth)
213213   {
214214      case 8:
r1185r1186
241241
242242   video_start_pc_aga(machine);
243243
244   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
244   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
245245   switch(buswidth)
246246   {
247247      case 8:
src/mess/video/pc_cga.c
r1185r1186
290290    * Plantronics chipset.
291291    * TODO: Cards which don't support Plantronics should repeat at
292292    * BC000h */
293   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
293   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
294294   switch(buswidth)
295295   {
296296      case 8:
src/mess/video/odyssey2.c
r1185r1186
176176INLINE int get_horiz_clock_beam_pos( void )
177177{
178178    int h;
179    h = scale_up_mame_time(sub_mame_times(mame_timer_get_time(), line_time), Machine->drv->cpu[0].cpu_clock * 8).seconds;
179    h = scale_up_mame_time(sub_mame_times(mame_timer_get_time(), line_time), Machine->drv->cpu[0].clock * 8).seconds;
180180
181181    return h;
182182}
r1185r1186
184184INLINE int get_horiz_clock( void )
185185{
186186    int h;
187    h = scale_up_mame_time(sub_mame_times(mame_timer_get_time(), line_time), Machine->drv->cpu[0].cpu_clock).seconds;
187    h = scale_up_mame_time(sub_mame_times(mame_timer_get_time(), line_time), Machine->drv->cpu[0].clock).seconds;
188188
189189    return h;
190190}
src/mess/eventlst.c
r1185r1186
6666{
6767
6868        if (!CyclesPerFrame)
69                CyclesPerFrame = (int)(Machine->drv->cpu[0].cpu_clock / Machine->screen[0].refresh);   //totalcycles();   //_(int)(Machine->drv->cpu[0].cpu_clock / Machine->drv->frames_per_second);
69                CyclesPerFrame = (int)(Machine->drv->cpu[0].clock / Machine->screen[0].refresh);   //totalcycles();   //_(int)(Machine->drv->cpu[0].cpu_clock / Machine->drv->frames_per_second);
7070
7171        if (NumEvents < TotalEvents)
7272        {
src/mess/machine/at.c
r1185r1186
9494static void at_map_vga_memory(offs_t begin, offs_t end, read8_handler rh, write8_handler wh)
9595{
9696   int buswidth;
97   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
97   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
9898   switch(buswidth)
9999   {
100100      case 8:
src/mess/machine/pc.c
r1185r1186
152152static void pc_map_vga_memory(offs_t begin, offs_t end, read8_handler rh, write8_handler wh)
153153{
154154   int buswidth;
155   buswidth = cputype_databus_width(Machine->drv->cpu[0].cpu_type, ADDRESS_SPACE_PROGRAM);
155   buswidth = cputype_databus_width(Machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
156156   switch(buswidth)
157157   {
158158      case 8:
src/mess/drivers/svision.c
r1185r1186
444444   svision.timer1 = mame_timer_alloc(svision_timer);
445445   svision_pet.on = TRUE;
446446   svision_pet.timer = mame_timer_alloc(svision_pet_timer);
447   mame_timer_pulse(scale_up_mame_time(MAME_TIME_IN_SEC(8), 256/Machine->drv->cpu[0].cpu_clock), 0, svision_pet_timer); 
447   mame_timer_pulse(scale_up_mame_time(MAME_TIME_IN_SEC(8), 256/Machine->drv->cpu[0].clock), 0, svision_pet_timer); 
448448}
449449
450450static MACHINE_RESET( svision )
docs/messnew.txt
r1185r1186
3838
3939Source Changes:
4040----------------
41(none)
41- The core is based on MAME 0.120u1.  This incorporates all features of the
42  update to this core.  [MAME team]
4243
4344
4445
makefile
r1185r1186
394394
395395# LDFLAGS are used generally; LDFLAGSEMULATOR are additional
396396# flags only used when linking the core emulator
397LDFLAGS =
397LDFLAGS = -Wl,--warn-common
398398LDFLAGSEMULATOR =
399399
400400# add profiling information for the linker
r1185r1186
479479# include files which define additional targets
480480#-------------------------------------------------
481481
482all: maketree emulator tools
482all: maketree buildtools emulator tools
483483
484484
485485
r1185r1186
508508
509509emulator: maketree $(BUILD) $(EMULATOR)
510510
511buildtools: maketree $(BUILD)
512
511513tools: maketree $(TOOLS)
512514
513515maketree: $(sort $(OBJDIRS))

Previous 15994 Revisions Next


© 1998-2018 The MESS Team