Previous 15994 Revisions Next

r5614 Monday 7th September, 2009 at 02:41:24 UTC by Nathan Woods
Updated to MAME 0.133u5 core
[docs]messnew.txt
[src/emu]cheat.c cheat.h cpuintrf.h crsshair.c eigccppc.h eigccx86.h eminline.h fileio.c fileio.h inptport.c inptport.h inpttype.h input.c input.h inputseq.c inputseq.h mame.c mame.h profiler.c sound.c sound.h ui.c uigfx.c uiinput.c uimenu.c validity.c
[src/emu/cpu]cpu.mak
[src/emu/cpu/i386]i386op16.c i386op32.c i386ops.c i386priv.h
[src/emu/cpu/m37710]m37710op.h
[src/emu/cpu/mc68hc11]hc11dasm.c mc68hc11.c mc68hc11.h
[src/emu/cpu/mips]mips3com.c mips3dsm.c
[src/emu/cpu/pic16c5x]pic16c5x.c
[src/emu/cpu/sharc]sharcops.c
[src/emu/cpu/tms34010]34010gfx.c
[src/emu/cpu/tms57002]tms57002.c
[src/emu/cpu/z8]z8.c z8.h z8dasm.c z8ops.c
[src/emu/debug]debugcmd.c debugcpu.c debugcpu.h debughlp.c
[src/emu/machine]6526cia.c 68681.c
[src/emu/sound]ay8910.c disc_dev.c disc_flt.c disc_inp.c disc_mth.c disc_sys.c* disc_wav.c discrete.c discrete.h k054539.c sn76477.c sound.mak
[src/emu/video]poly.c v9938.c voodoo.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]8080bw.c astrof.c bzone.c cinemat.c circus.c dkong.c galaxian.c mw8080bw.c scramble.c segag80r.c turbo.c
[src/mame/drivers]adp.c astinvad.c bingoc.c bishjan.c blackt96.c btime.c buggychl.c bzone.c calomega.c cb2001.c chihiro.c circusc.c cmmb.c crbaloon.c darius.c darkhors.c ddenlovr.c djmain.c dunhuang.c firebeat.c funworld.c gaiden.c galaxi.c galaxian.c galaxold.c getrivia.c ghosteo.c goldnpkr.c gottlieb.c hshavoc.c hvyunit.c igs009.c igs017.c igs_blit.c igspoker.c ilpag.c itgambl2.c itgambl3.c jackie.c kaneko16.c kchamp.c kickgoal.c lastfght.c littlerb.c m10.c magicard.c maxaflex.c mazerbla.c meritm.c midas.c midtunit.c midyunit.c namcos10.c naomi.c ninjaw.c nmk16.c norautp.c playmark.c pntnpuzl.c pokechmp.c polepos.c psikyo.c quizpun2.c raiden2.c scobra.c segahang.c segaorun.c segaxbd.c segaybd.c seta.c speedbal.c spoker.c srmp6.c system1.c thepit.c tmaster.c trvmadns.c tutankhm.c uapce.c warriorb.c wheelfir.c
[src/mame/includes]bzone.h dc.h deco16ic.h midyunit.h nmk16.h
[src/mame/layout]connect4.lay
[src/mame/machine]archimds.c atarigen.c dc.c harddriv.c kaneko16.c midyunit.c naomibd.c seicop.c
[src/mame/video]amiga.c amigaaga.c argus.c bking.c blmbycar.c btoads.c cave.c cischeat.c cps1.c dc.c dday.c deco16ic.c deco_mlc.c decocass.c dynax.c esd16.c espial.c fitfight.c funybubl.c fuukifg2.c fuukifg3.c gaelco3d.c gaiden.c galastrm.c galpani2.c gcpinbal.c ginganin.c gticlub.c gunbustr.c holeland.c hyprduel.c itech32.c jaguar.c konamigx.c konamiic.c lordgun.c mcatadv.c metro.c midtunit.c midvunit.c midyunit.c midzeus.c midzeus2.c model1.c model2.c model3.c ms32.c namcos2.c namcos22.c nmk16.c nycaptor.c paradise.c pitnrun.c pokechmp.c powerins.c psikyo.c psikyosh.c psx.c realbrk.c rollerg.c segas18.c segas32.c seta.c slapfght.c slapshot.c ssv.c st0016.c stvvdp1.c stvvdp2.c suna16.c suna8.c superchs.c taito_h.c taitoair.c taitoic.c taitojc.c tmnt.c toaplan1.c toaplan2.c topspeed.c tsamurai.c twin16.c twincobr.c undrfire.c unico.c wgp.c yunsung8.c
[src/mess]inputx.c uimess.c
[src/mess/drivers]palm.c
[src/mess/machine]coco.c dgn_beta.c mac.c
[src/mess/osd/windows]dialog.c
[src/osd]osdcore.h
[src/osd/osdmini]minitime.c
[src/osd/windows]eivcx86.h input.c wintime.c winwork.c
[src/osd/winui]mui_opts.c
[src/tools]unidasm.c

src/mame/audio/cinemat.c
r5613r5614
14821482
14831483   /* bit 2 controls the global mute */
14841484   if ((data & 4) != (last_portb_write & 4))
1485      sound_global_enable(!(data & 4));
1485      sound_global_enable(device->machine, !(data & 4));
14861486
14871487   /* remember the last value written */
14881488   last_portb_write = data;
src/mame/audio/galaxian.c
r5613r5614
270270
271271   /* Group Background and pitch */
272272   DISCRETE_TASK_START()
273   
273
274274      /************************************************/
275275      /* Background                                   */
276276      /************************************************/
277   
277
278278      DISCRETE_DAC_R1(NODE_100, 1, GAL_INP_BG_DAC, TTL_OUT, &galaxian_bck_dac)
279279      DISCRETE_555_CC(NODE_105, 1, NODE_100, GAL_R21, GAL_C15, 0, 0, 0, &galaxian_bck_vco)
280280      // Next is mult/add opamp circuit
r5613r5614
285285      DISCRETE_555_ASTABLE_CV(NODE_115, GAL_INP_FS1, GAL_R22, GAL_R23, GAL_C17, NODE_111, &galaxian_555_vco_desc)
286286      DISCRETE_555_ASTABLE_CV(NODE_116, GAL_INP_FS2, GAL_R25, GAL_R26, GAL_C18, NODE_111, &galaxian_555_vco_desc)
287287      DISCRETE_555_ASTABLE_CV(NODE_117, GAL_INP_FS3, GAL_R28, GAL_R29, GAL_C19, NODE_111, &galaxian_555_vco_desc)
288   
288
289289      DISCRETE_MIXER3(NODE_120, 1, NODE_115, NODE_116, NODE_117, &galaxian_bck_mixer_desc)
290     
290
291291      /************************************************/
292292      /* PITCH                                        */
293293      /************************************************/
294   
294
295295      /* two cascaded LS164 which are reset to pitch latch value,
296        * thus generating SOUND_CLOCK / (256 - pitch_clock) signal
297        *
298        * One possibility to implement this is
299        * DISCRETE_TRANSFORM3(NODE_130, SOUND_CLOCK, 256, GAL_INP_PITCH, "012-/")
300        * DISCRETE_COUNTER(NODE_132, 1, 0, NODE_130, 15, DISC_COUNT_UP, 0, DISC_CLK_IS_FREQ)
301        * but there is a native choice:
302        */
296         * thus generating SOUND_CLOCK / (256 - pitch_clock) signal
297         *
298         * One possibility to implement this is
299         * DISCRETE_TRANSFORM3(NODE_130, SOUND_CLOCK, 256, GAL_INP_PITCH, "012-/")
300         * DISCRETE_COUNTER(NODE_132, 1, 0, NODE_130, 15, DISC_COUNT_UP, 0, DISC_CLK_IS_FREQ)
301         * but there is a native choice:
302         */
303303       DISCRETE_NOTE(NODE_132, 1, SOUND_CLOCK, GAL_INP_PITCH, 255, 15,  DISC_CLK_IS_FREQ)
304   
304
305305       /* from the 74393 (counter 2 above) only QA, QC, QD are used.
306        * We decode three here and use SUB_NODE(133,x) below to access.
307        */
306         * We decode three here and use SUB_NODE(133,x) below to access.
307         */
308308       DISCRETE_BITS_DECODE(NODE_133, NODE_132, 0, 3, TTL_OUT)      /* QA-QD 74393 */
309309
310310    /* End of this task */
311    DISCRETE_TASK_END5(NODE_120, NODE_SUB(133,0),NODE_SUB(133,1),NODE_SUB(133,2),NODE_SUB(133,3))
312   
311    DISCRETE_TASK_END()
312
313313    /* Group Hit and Fire */
314314
315315    DISCRETE_TASK_START()
r5613r5614
320320
321321       /* NOISE */
322322       /* since only a sample of the LFSR is latched @V2 we let the lfsr
323        * run at a lower speed
324        */
323         * run at a lower speed
324         */
325325       DISCRETE_LFSR_NOISE(NODE_150, 1, 1, RNG_RATE/100, 1.0, 0, 0.5, &galaxian_lfsr)
326326      DISCRETE_SQUAREWFIX(NODE_151,1,60*264/2,1.0,50,0.5,0)  /* 2V signal */
327327      DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,1,NODE_151,NODE_150)
328328
329   
329
330330      /* Not 100% correct - switching causes high impedance input for node_157
331        * this is not emulated */
331         * this is not emulated */
332332      DISCRETE_RCDISC5(NODE_155, NODE_152, GAL_INP_HIT, (GAL_R35 + GAL_R36), GAL_C21)
333333      DISCRETE_OP_AMP_FILTER(NODE_157, 1, NODE_155, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &galaxian_bandpass_desc)
334     
334
335335      /************************************************/
336336      /* FIRE                                         */
337337      /************************************************/
338     
338
339339      DISCRETE_LOGIC_INVERT(NODE_170, 1, GAL_INP_FIRE)
340340      DISCRETE_MULTIPLY(NODE_171, 1, TTL_OUT, GAL_INP_FIRE)
341341      DISCRETE_MULTIPLY(NODE_172, 1, TTL_OUT, NODE_170) // inverted
r5613r5614
348348      //DISCRETE_MULTIPLY(NODE_176, 1, 1.0/GAL_R48, NODE_173)
349349      //DISCRETE_ADDER2(NODE_177, 1, NODE_175, NODE_176)
350350      DISCRETE_MULTIPLY(NODE_178, 1, RES_2_PARALLEL(GAL_R46, GAL_R48), NODE_177)
351   
351
352352      DISCRETE_555_ASTABLE_CV(NODE_181, 1, GAL_R44, GAL_R45, GAL_C27, NODE_178, &galaxian_555_fire_vco_desc)
353   
353
354354      /* 555 toggles discharge on rc discharge module */
355355      DISCRETE_RCDISC5(NODE_182, NODE_181, NODE_171, (GAL_R41), GAL_C25)
356356
357357   /* End of task */
358   DISCRETE_TASK_END2(NODE_157, NODE_182)
358   DISCRETE_TASK_END()
359359
360360   /************************************************/
361361   /* FINAL MIX                                    */
src/mame/audio/circus.c
r5613r5614
278278   }
279279
280280   /* Bit 7 enables amplifier (0 = on) */
281   sound_global_enable(~data & 0x80);
281   sound_global_enable(space->machine, ~data & 0x80);
282282}
src/mame/audio/turbo.c
r5613r5614
413413   sample_set_volume(samples, 11, (data & 0x40) ? 0 : 1.0);
414414
415415   /* /GAME START */
416   sound_global_enable(!(data & 0x80));
416   sound_global_enable(device->machine, !(data & 0x80));
417417}
418418
419419
r5613r5614
568568   if ((diff & 0x40) && !(data & 0x40) &&  sample_playing(samples, 5)) sample_stop(samples, 5);
569569
570570   /* GAME ON */
571   sound_global_enable(data & 0x80);
571   sound_global_enable(device->machine, data & 0x80);
572572}
573573
574574
src/mame/audio/astrof.c
r5613r5614
106106   /* D6 - don't know. Probably something to do with the explosion sounds */
107107
108108   /* D7 - sound enable bit */
109   sound_global_enable(data & 0x80);
109   sound_global_enable(space->machine, data & 0x80);
110110
111111   port_1_last = data;
112112}
r5613r5614
237237   /* D6 - explosion */
238238
239239   /* D7 - sound enable bit */
240   sound_global_enable(data & 0x80);
240   sound_global_enable(space->machine, data & 0x80);
241241}
242242
243243
src/mame/audio/bzone.c
r5613r5614
2222#include "streams.h"
2323#include "bzone.h"
2424
25#if !BZONE_DISCRETE
26#define OUTPUT_RATE (6000*4)
27
28
29/* Statics */
30static INT16 *discharge = NULL;
31#define EXP(charge,n) (charge ? 0x7fff - discharge[0x7fff-n] : discharge[n])
32
33static sound_stream *channel;
34static int latch;
35static int poly_counter;
36static int poly_shift;
37
38static int explosion_clock;
39static int explosion_out;
40static int explosion_amp;
41static int explosion_amp_counter;
42
43static int shell_clock;
44static int shell_out;
45static int shell_amp;
46static int shell_amp_counter;
47
48static int motor_counter;
49static int motor_counter_a;
50static int motor_counter_b;
51static int motor_rate;
52static int motor_rate_new;
53static int motor_rate_counter;
54static int motor_amp;
55static int motor_amp_new;
56static int motor_amp_step;
57static int motor_amp_counter;
58
59WRITE8_HANDLER( bzone_sounds_w )
60{
61   if( data == latch )
62      return;
63
64   stream_update(channel);
65    latch = data;
66
67    sound_global_enable(latch & 0x20);
68}
69
70static STREAM_UPDATE( bzone_sound_update )
71{
72   stream_sample_t *buffer = outputs[0];
73   while( samples-- )
74   {
75      static int last_val = 0;
76      int sum = 0;
77
78      /* polynome shifter H5 and H4 (LS164) clocked with 6kHz */
79      poly_counter -= 6000;
80      while( poly_counter <= 0 )
81      {
82         int clock;
83
84         poly_counter += OUTPUT_RATE;
85         if( ((poly_shift & 0x0008) == 0) == ((poly_shift & 0x4000) == 0) )
86            poly_shift = (poly_shift << 1) | 1;
87         else
88            poly_shift <<= 1;
89
90         /* NAND gate J4 */
91         clock = ((poly_shift & 0x7000) == 0x7000) ? 0 : 1;
92
93         /* raising edge on pin 3 of J5 (LS74)? */
94         if( clock && !explosion_clock )
95            explosion_out ^= 1;
96
97         /* save explo clock level */
98         explosion_clock = clock;
99
100         /* input 11 of J5 (LS74) */
101         clock = (poly_shift >> 15) & 1;
102
103         /* raising edge on pin 11 of J5 (LS74)? */
104         if( clock && !shell_clock )
105            shell_out ^= 1;
106
107         /* save shell clock level */
108         shell_clock = clock;
109      }
110
111      /* explosion enable: charge C14 */
112      if( latch & 0x01 )
113         explosion_amp = 32767;
114
115      /* explosion output? */
116      if( explosion_out )
117      {
118         if( explosion_amp > 0 )
119         {
120            /*
121                 * discharge C14 through R17 + R16
122                 * time constant is 10e-6 * 23000 = 0.23 seconds
123                 * (samples were decaying much slower: 1/4th rate? )
124                 */
125            explosion_amp_counter -= (int)(32767 / (0.23*4));
126            if( explosion_amp_counter < 0 )
127            {
128               int n = (-explosion_amp_counter / OUTPUT_RATE) + 1;
129               explosion_amp_counter += n * OUTPUT_RATE;
130               if( (explosion_amp -= n) < 0 )
131                  explosion_amp = 0;
132            }
133         }
134         /*
135             * I don't know the amplification of the op-amp
136             * and feedback, so the loud/soft values are arbitrary
137             */
138         if( latch & 0x02 )   /* explosion loud ? */
139            sum += EXP(0,explosion_amp)/3;
140         else
141            sum += EXP(0,explosion_amp)/4;
142      }
143
144      /* shell enable: charge C9 */
145      if( latch & 0x04 )
146         shell_amp = 32767;
147
148      /* shell output? */
149      if( shell_out )
150      {
151         if( shell_amp > 0 )
152         {
153            /*
154                 * discharge C9 through R14 + R15
155                 * time constant is 4.7e-6 * 23000 = 0.1081 seconds
156                 * (samples were decaying much slower: 1/4th rate? )
157                 */
158            shell_amp_counter -= (int)(32767 / (0.1081*4));
159            if( shell_amp_counter < 0 )
160            {
161               int n = (-shell_amp_counter / OUTPUT_RATE) + 1;
162               shell_amp_counter += n * OUTPUT_RATE;
163               if( (shell_amp -= n) < 0 )
164                  shell_amp = 0;
165            }
166         }
167         /*
168             * I don't know the amplification of the op-amp
169             * and feedback, so the loud/soft values are arbitrary
170             */
171         if( latch & 0x08 )   /* shell loud ? */
172            sum += EXP(0,shell_amp)/3;
173         else
174            sum += EXP(0,shell_amp)/4;
175      }
176
177      if( latch & 0x80 )
178      {
179         /* NE5555 timer
180             * C = 0.018u, Ra = 100k, Rb = 125k
181             * charge time = 0.693 * (Ra + Rb) * C = 3870us
182             * discharge time = 0.693 * Rb * C = 1559.25us
183             * freq approx. 184 Hz
184             * I have no idea what frequencies are coming from the NE555
185             * with "MOTOR REV EN" being high or low. I took 240Hz as
186             * higher rate and sweep up or down to the new rate in 0.25s
187             */
188         motor_rate_new = (latch & 0x10) ? 240 : 184;
189         if( motor_rate != motor_rate_new )
190         {
191            /* sweep rate to new rate */
192            motor_rate_counter -= (int)((240 - 184) / 0.25);
193            while( motor_rate_counter <= 0 )
194            {
195               motor_rate_counter += OUTPUT_RATE;
196               motor_rate += (motor_rate < motor_rate_new) ? +1 : -1;
197            }
198         }
199         motor_counter -= motor_rate;
200         while( motor_counter <= 0 )
201         {
202            double r0, r1;
203
204            motor_counter += OUTPUT_RATE;
205
206            r0 = 1.0/1e12;
207            r1 = 1.0/1e12;
208
209            if( ++motor_counter_a == 16 )
210               motor_counter_a = 6;
211            if( ++motor_counter_b == 16 )
212               motor_counter_b = 4;
213
214            if( motor_counter_a & 8 )   /* bit 3 */
215               r1 += 1.0/33000;
216            else
217               r0 += 1.0/33000;
218            if( motor_counter_a == 15 ) /* ripple carry */
219               r1 += 1.0/33000;
220            else
221               r0 += 1.0/33000;
222
223            if( motor_counter_b & 8 )   /* bit 3 */
224               r1 += 1.0/33000;
225            else
226               r0 += 1.0/33000;
227            if( motor_counter_b == 15 ) /* ripple carry */
228               r1 += 1.0/33000;
229            else
230               r0 += 1.0/33000;
231
232            /* new voltage at C29 */
233            r0 = 1.0/r0;
234            r1 = 1.0/r1;
235            motor_amp_new = (int)(32767 * r0 / (r0 + r1));
236
237            /* charge/discharge C29 (0.47uF) */
238            if( motor_amp_new > motor_amp )
239               motor_amp_step = (int)((motor_amp_new - motor_amp) / (r1*0.47e-6));
240            else
241               motor_amp_step = (int)((motor_amp - motor_amp_new) / (r0*0.47e-6));
242         }
243         if( motor_amp != motor_amp_new )
244         {
245            motor_amp_counter -= motor_amp_step;
246            if( motor_amp_counter < 0 )
247            {
248               int n = (-motor_amp_counter / OUTPUT_RATE) + 1;
249               motor_amp_counter += n * OUTPUT_RATE;
250               if( motor_amp > motor_amp_new )
251               {
252                  motor_amp -= n;
253                  if( motor_amp < motor_amp_new )
254                     motor_amp = motor_amp_new;
255               }
256               else
257               {
258                  motor_amp += n;
259                  if( motor_amp > motor_amp_new )
260                     motor_amp = motor_amp_new;
261               }
262            }
263         }
264         sum += EXP((motor_amp<motor_amp_new),motor_amp)/3;
265      }
266
267      *buffer++ = (sum + last_val) / 2;
268
269      /* crude 75% low pass filter */
270      last_val = (sum + last_val * 3) / 4;
271   }
272}
273
274static DEVICE_START( bzone_sound )
275{
276   int i;
277
278   discharge = auto_alloc_array(device->machine, INT16, 32768);
279   for( i = 0; i < 0x8000; i++ )
280      discharge[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096));
281
282   channel = stream_create(device, 0, 1, OUTPUT_RATE, 0, bzone_sound_update);
283}
284
285
286DEVICE_GET_INFO( bzone_sound )
287{
288   switch (state)
289   {
290      /* --- the following bits of info are returned as pointers to data or functions --- */
291      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(bzone_sound);   break;
292
293      /* --- the following bits of info are returned as NULL-terminated strings --- */
294      case DEVINFO_STR_NAME:                     strcpy(info->s, "Battlezone Engine");         break;
295      case DEVINFO_STR_SOURCE_FILE:                  strcpy(info->s, __FILE__);                  break;
296   }
297}
298
299#else
300
30125#include "sound/discrete.h"
30226#include "sound/pokey.h"
30327
r5613r5614
567291   discrete_sound_w(device, BZ_INPUT, data);
568292
569293   output_set_value("startled", (data >> 6) & 1);
570    sound_global_enable(data & 0x20);
294    sound_global_enable(device->machine, data & 0x20);
571295}
572296
573297
r5613r5614
584308
585309   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
586310MACHINE_DRIVER_END
587
588#endif
src/mame/audio/dkong.c
r5613r5614
335335   context->r_total[0] = RES_2_PARALLEL(context->r_in[0] + DKONG_CUSTOM_R4, NE555_CV_R);
336336   context->r_total[1] = RES_2_PARALLEL((context->r_in[1] + DKONG_CUSTOM_R4), NE555_CV_R);
337337   /* precalculate charging exponents */
338   context->exp[0] = RC_CHARGE_EXP(context->r_total[0] * DKONG_CUSTOM_C);
339   context->exp[1] = RC_CHARGE_EXP(context->r_total[1] * DKONG_CUSTOM_C);
338   context->exp[0] = RC_CHARGE_EXP(node, context->r_total[0] * DKONG_CUSTOM_C);
339   context->exp[1] = RC_CHARGE_EXP(node, context->r_total[1] * DKONG_CUSTOM_C);
340340
341341   node->output[0] = 0;
342342}
r5613r5614
348348};
349349#endif
350350
351
352static DISCRETE_SOUND_START(dkong2b_dac)
353   DISCRETE_INPUT_DATA(DS_DAC)
354   DISCRETE_OUTPUT(DS_DAC, 1)
355DISCRETE_SOUND_END
356
357351static DISCRETE_SOUND_START(dkong2b)
358352
359353   /************************************************/
r5613r5614
390384
391385   DISCRETE_RCINTEGRATE(NODE_22,NODE_20,DK_R5, RES_2_PARALLEL(DK_R4+DK_R3,DK_R6),0,DK_C19,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
392386   DISCRETE_MULTIPLY(DS_OUT_SOUND0,1,NODE_22,DK_R3/R_SERIES(DK_R3,DK_R4))
393   DISCRETE_TASK_END(DS_OUT_SOUND0)
387   DISCRETE_TASK_END()
394388
395389   /************************************************/
396390   /* Jump                                         */
r5613r5614
424418
425419   DISCRETE_RCINTEGRATE(NODE_39,NODE_38,DK_R27, RES_2_PARALLEL(DK_R28,DK_R26+DK_R25),0,DK_C16,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
426420   DISCRETE_MULTIPLY(DS_OUT_SOUND1,1,NODE_39,DK_R25/(DK_R26+DK_R25))
427   DISCRETE_TASK_END(DS_OUT_SOUND1)
421   DISCRETE_TASK_END()
428422
429423   /************************************************/
430424   /* Walk                                         */
r5613r5614
450444   /* Filter and divide - omitted C22 */
451445   DISCRETE_CRFILTER(NODE_61, 1, NODE_60, DK_R15+DK_R16, DK_C23)
452446   DISCRETE_MULTIPLY(DS_OUT_SOUND2, 1, NODE_61, DK_R15/(DK_R15+DK_R16))
453   DISCRETE_TASK_END(DS_OUT_SOUND2)
447   DISCRETE_TASK_END()
454448
455449   /************************************************/
456450   /* DAC                                          */
457451   /************************************************/
458452
459453   DISCRETE_TASK_START()
460   DISCRETE_INPUTX_STREAM(DS_DAC, 0, 1.0, 0)
454   /* Buffer DAC first to input stream 0 */
455   DISCRETE_INPUT_BUFFER(DS_DAC, 0)
456   //DISCRETE_INPUT_DATA(DS_DAC)
461457   /* Signal decay circuit Q7, R20, C32 */
462458   DISCRETE_RCDISC(NODE_70, DS_DISCHARGE_INV, 1, DK_R20, DK_C32)
463459   DISCRETE_TRANSFORM4(NODE_71, DS_DAC,  DK_SUP_V/256.0, NODE_70, DS_DISCHARGE_INV, "01*3!2+*")
r5613r5614
478474#else
479475   DISCRETE_MULTIPLY(DS_OUT_DAC, 1, NODE_73, DS_ADJ_DAC)
480476#endif
481   DISCRETE_TASK_END(DS_OUT_DAC)
477   DISCRETE_TASK_END()
482478
483479   /************************************************/
484480   /* Amplifier                                    */
r5613r5614
497493   DISCRETE_OUTPUT(NODE_288, 32767.0/5.0 * 10)
498494#else
499495   DISCRETE_OUTPUT(NODE_296, 32767.0/5.0 * 3.41)
496   /* Test */
497   //DISCRETE_CSVLOG2(NODE_296, NODE_288)
498   //DISCRETE_WAVELOG1(NODE_296, 32767.0/5.0 * 3.41)
500499#endif
501500
502501DISCRETE_SOUND_END
r5613r5614
639638   DISCRETE_INPUT_NOT(DS_DISCHARGE_INV)
640639
641640   /* Must be in task if tasks added */
642   DISCRETE_INPUTX_STREAM(DS_DAC, 0, 1.0, 0)
641   DISCRETE_INPUT_BUFFER(DS_DAC, 0)
643642   //DISCRETE_INPUT_DATA(DS_DAC)
644643
645644   /* Mixing - DAC */
r5613r5614
11711170                   AM_WRITE(dkong_voice_w)
11721171   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_DEVREAD("ls175.3d", dkong_tune_r)
11731172                           AM_WRITE(dkong_voice_w)
1174   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE("discdac", dkong_p1_w) /* only write to dac */
1173   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE("discrete", dkong_p1_w) /* only write to dac */
11751174   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_READWRITE("virtual_p2")
11761175   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_LATCH8_READBIT("ls259.6h", 5)
11771176   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
r5613r5614
11871186
11881187static ADDRESS_MAP_START( radarsc1_sound_io_map, ADDRESS_SPACE_IO, 8 )
11891188   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_DEVREAD("ls175.3d", latch8_r)
1190   AM_RANGE(0x00, 0xff) AM_DEVWRITE("discdac", dkong_p1_w) /* DAC here */
1189   AM_RANGE(0x00, 0xff) AM_DEVWRITE("discrete", dkong_p1_w) /* DAC here */
11911190   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_LATCH8_READ("virtual_p1")
11921191                         AM_DEVWRITE("tms", M58817_command_w)
11931192   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_WRITE("virtual_p2")
r5613r5614
12621261   MDRV_CPU_IO_MAP(dkong_sound_io_map)
12631262
12641263   MDRV_SPEAKER_STANDARD_MONO("mono")
1265
1266   MDRV_SOUND_ADD("discdac", DISCRETE, 0)
1267   MDRV_SOUND_CONFIG_DISCRETE(dkong2b_dac)
1268   MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 0)
1269
12701264   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
12711265   MDRV_SOUND_CONFIG_DISCRETE(dkong2b)
12721266   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
src/mame/audio/segag80r.c
r5613r5614
274274         if ((data & 0x10) && sample_playing(samples, 4)) sample_stop(samples, 4);
275275
276276         /* MUTE */
277         sound_global_enable(!(data & 0x20));
277         sound_global_enable(space->machine, !(data & 0x20));
278278
279279         /* REFILL: channel 5 */
280280         if (!(data & 0x40) && !sample_playing(samples, 5)) sample_start(samples, 5, 9, FALSE);
src/mame/audio/scramble.c
r5613r5614
8484   TTL7474_update(device->machine, 2);
8585
8686   /* bit 4 is sound disable */
87   sound_global_enable(~data & 0x10);
87   sound_global_enable(device->machine, ~data & 0x10);
8888}
8989
9090WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w )
src/mame/audio/8080bw.c
r5613r5614
5252
5353    c8080bw_screen_red_w(data & 0x04);
5454
55   sound_global_enable(data & 0x20);
55   sound_global_enable(space->machine, data & 0x20);
5656
5757   port_1_last_extra = data;
5858
r5613r5614
145145   if (rising_bits & 0x08) sample_start(samples, 1, 0, 0);      /* Alien Hit */
146146   if (rising_bits & 0x10) sample_start(samples, 2, 5, 0);      /* Bonus Ship (not confirmed) */
147147
148   sound_global_enable(data & 0x20);
148   sound_global_enable(space->machine, data & 0x20);
149149
150150   c8080bw_screen_red_w(data & 0x04);
151151
r5613r5614
204204   if (rising_bits & 0x08) sample_start(samples, 1, 7, 0);      /* Hit a Bomb */
205205   if (rising_bits & 0x10) sample_start(samples, 3, 8, 0);      /* Bonus Base at 1500 points */
206206
207   sound_global_enable(data & 0x20);
207   sound_global_enable(space->machine, data & 0x20);
208208
209209   c8080bw_screen_red_w(data & 0x04);
210210
r5613r5614
281281   if (rising_bits & 0x04) sample_start(samples, 2, 3, 0);      /* Move */
282282   if (rising_bits & 0x08) sample_start(samples, 3, 2, 0);      /* Hit */
283283
284   sound_global_enable(data & 0x20);
284   sound_global_enable(space->machine, data & 0x20);
285285
286286   c8080bw_screen_red_w(data & 0x01);
287287
r5613r5614
876876
877877   const device_config *discrete = devtag_get_device(space->machine, "discrete");
878878
879    printf( "schaser_sh_port_2_w: %02x\n", data );
879    //printf( "schaser_sh_port_2_w: %02x\n", data );
880880
881881   discrete_sound_w(discrete, SCHASER_MUSIC_BIT, data & 0x01);
882882
883883   discrete_sound_w(discrete, SCHASER_SND_EN, data & 0x02);
884   sound_global_enable(data & 0x02);
884   sound_global_enable(space->machine, data & 0x02);
885885
886886   coin_lockout_global_w(data & 0x04);
887887
r5613r5614
10901090
10911091   speaker_level_w(speaker, (data & 0x01) ? 1 : 0);      /* End-of-Level */
10921092
1093   sound_global_enable(data & 0x10);
1093   sound_global_enable(space->machine, data & 0x10);
10941094
10951095   c8080bw_flip_screen_w(space, data & 0x20);
10961096}
r5613r5614
11121112   if (rising_bits & 0x08) sample_start(samples, 1, 2, 0);         /* Man dead */
11131113   if (rising_bits & 0x10) sample_start(samples, 5, 8, 0);         /* Bonus Man? */
11141114
1115   sound_global_enable(data & 0x20);
1115   sound_global_enable(space->machine, data & 0x20);
11161116
11171117   port_1_last_extra = data;
11181118}
src/mame/audio/mw8080bw.c
r5613r5614
10581058
10591059   coin_counter_w(0, (data >> 2) & 0x01);
10601060
1061   sound_global_enable((data >> 3) & 0x01);
1061   sound_global_enable(device->machine, (data >> 3) & 0x01);
10621062
10631063   discrete_sound_w(device, CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03);
10641064   discrete_sound_w(device, CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03);
r5613r5614
16531653
16541654   coin_counter_w(0, (data >> 2) & 0x01);
16551655
1656   sound_global_enable((data >> 3) & 0x01);
1656   sound_global_enable(space->machine, (data >> 3) & 0x01);
16571657
16581658   /* if (data & 0x10)  enable RIGHT MISSILE sound (goes to right speaker) */
16591659   if (rising_bits & 0x10) sample_start(samples1, 0, 0, 0);
r5613r5614
17491749
17501750   coin_counter_w(0, (data >> 2) & 0x01);
17511751
1752   sound_global_enable((data >> 3) & 0x01);
1752   sound_global_enable(space->machine, (data >> 3) & 0x01);
17531753
17541754   /* if (data & 0x10)  enable LEFT PLAYER SHOT sound (goes to left speaker) */
17551755   if (rising_bits & 0x10) sample_start(samples0, 0, 0, 0);
r5613r5614
20522052
20532053   discrete_sound_w(device, CLOWNS_POP_TOP_EN, (data >> 2) & 0x01);
20542054
2055   sound_global_enable((data >> 3) & 0x01);
2055   sound_global_enable(device->machine, (data >> 3) & 0x01);
20562056
20572057   discrete_sound_w(device, CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01);
20582058
r5613r5614
21092109
21102110   /* if (data & 0x02)  enable SHUFFLE ROLLOVER sound */
21112111
2112   sound_global_enable((data >> 2) & 0x01);
2112   sound_global_enable(space->machine, (data >> 2) & 0x01);
21132113
21142114   /* set SHUFFLE ROLLING sound((data >> 3) & 0x07)  0, if not rolling,
21152115                                                      faster rolling = higher number */
r5613r5614
21982198
21992199   coin_counter_w(0, (data >> 2) & 0x01);
22002200
2201   sound_global_enable((data >> 3) & 0x01);
2201   sound_global_enable(space->machine, (data >> 3) & 0x01);
22022202
22032203   /* if (data & 0x10)  enable LEFT SHOOT sound */
22042204
r5613r5614
27422742
27432743WRITE8_DEVICE_HANDLER( spcenctr_audio_1_w )
27442744{
2745   sound_global_enable((data >> 0) & 0x01);
2745   sound_global_enable(device->machine, (data >> 0) & 0x01);
27462746
27472747   /* D1 is marked as 'OPTIONAL SWITCH VIDEO FOR COCKTAIL',
27482748       but it is never set by the software */
r5613r5614
28302830
28312831   /* if (data & 0x02)  enable ENEMY SHOT sound */
28322832
2833   sound_global_enable((data >> 2) & 0x01);
2833   sound_global_enable(space->machine, (data >> 2) & 0x01);
28342834
28352835   coin_counter_w(0, (data >> 3) & 0x01);
28362836
r5613r5614
29562956
29572957   coin_counter_w(0, (data >> 1) & 0x01);
29582958
2959   sound_global_enable((data >> 2) & 0x01);
2959   sound_global_enable(device->machine, (data >> 2) & 0x01);
29602960
29612961   discrete_sound_w(device, BOWLER_FOWL_EN, (data >> 3) & 0x01);
29622962
r5613r5614
36933693   discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
36943694   discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
36953695
3696   sound_global_enable(data & 0x20);
3696   sound_global_enable(device->machine, data & 0x20);
36973697
36983698   /* D6 and D7 are not connected */
36993699}
r5613r5614
40754075   discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
40764076   discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
40774077
4078   sound_global_enable(data & 0x20);
4078   sound_global_enable(device->machine, data & 0x20);
40794079
40804080   /* D6 and D7 are not connected */
40814081}
src/mame/machine/midyunit.c
r5613r5614
463463}
464464
465465
466/*************************************
467 *
468 *  MK Turbo Ninja protection
469 *
470 *************************************/
471
472static READ16_HANDLER( mkturbo_prot_r )
473{
474   /* the security GAL overlays a counter of some sort at 0xfffff400 in ROM space.
475     * A startup protection check expects to read back two different values in succession */
476   return mame_rand(space->machine);
477}
478
479DRIVER_INIT( mkyturbo )
480{
481   /* protection */
482   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfffff400, 0xfffff40f, 0, 0, mkturbo_prot_r);
483
484   DRIVER_INIT_CALL(mkyunit);
485}
486
466487/********************** Terminator 2 **********************/
467488
468489static void term2_init_common(running_machine *machine, write16_space_func hack_w)
src/mame/machine/dc.c
r5613r5614
112112
113113#endif
114114
115static UINT8 dc_controller_id[0x70] =
116{
117   0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00,   0x00, 0x00, 0x00, 0x00,
118   0xff, 0x00, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x63, 0x61, 0x73, 0x74, 0x20,   0x43, 0x6f, 0x6e, 0x74,
119   0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,   0x20, 0x20, 0x20, 0x20,
120   0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x42, 0x79, 0x20,   0x6f, 0x72, 0x20, 0x55,
121   0x6e, 0x64, 0x65, 0x72, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65,   0x20, 0x46, 0x72, 0x6f,
122   0x6d, 0x20, 0x53, 0x45, 0x47, 0x41, 0x20, 0x45, 0x4e, 0x54, 0x45, 0x52,   0x50, 0x52, 0x49, 0x53,
123   0x45, 0x53, 0x2c, 0x4c, 0x54, 0x44, 0x2e, 0x20, 0x20, 0x20, 0x20, 0x20,   0xae, 0x01, 0xf4, 0x01
124};
125
126static UINT8 dc_controller_version[0x50] =
127{
128   0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x2e, 0x30, 0x31, 0x30, 0x2c, 0x31, 0x39,
129   0x39, 0x38, 0x2f, 0x30, 0x39, 0x2f, 0x32, 0x38, 0x2c, 0x33, 0x31, 0x35, 0x2d, 0x36, 0x32, 0x31,
130   0x31, 0x2d, 0x41, 0x42, 0x20, 0x20, 0x20, 0x2c, 0x41, 0x6e, 0x61, 0x6c,   0x6f, 0x67, 0x20, 0x4d,
131   0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x3a, 0x20, 0x54, 0x68, 0x65, 0x20,   0x34, 0x74, 0x68, 0x20,
132   0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x35, 0x2f, 0x38, 0x20,   0x20, 0x2b, 0x44, 0x46
133};
134
115135// selected Maple registers
116136enum
117137{
r5613r5614
517537   #endif
518538}
519539
520READ64_HANDLER( dc_maple_r )
540// Naomi/Naomi2 implementation with Maple/JVS bridging
541READ64_HANDLER( naomi_maple_r )
521542{
522543   int reg;
523544   UINT64 shift;
r5613r5614
530551   return (UINT64)maple_regs[reg] << shift;
531552}
532553
533WRITE64_HANDLER( dc_maple_w )
554WRITE64_HANDLER( naomi_maple_w )
534555{
535556   int reg;
536557   UINT64 shift;
r5613r5614
542563   static int jvs_command = 0,jvs_address = 0;
543564   int chk;
544565   int a;
545   int off,len;
566   int off,len,func;
546567
547568   reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
548569   dat = (UINT32)(data >> shift);
r5613r5614
563584         {
564585            maple_regs[reg] = 1;
565586            dat=maple_regs[SB_MDSTAR];
566            //printf("Maple DMA: %08x %08x %08x %08x\n",maple_regs[SB_MDSTAR],maple_regs[SB_MDTSEL],maple_regs[SB_MDEN],maple_regs[SB_MDST]);
567            //printf("           %08x %08x %08x %08x\n",maple_regs[SB_MSYS],maple_regs[SB_MST],maple_regs[SB_MSHTCL],maple_regs[SB_MMSEL]);
587//            printf("Maple DMA: %08x %08x %08x %08x\n",maple_regs[SB_MDSTAR],maple_regs[SB_MDTSEL],maple_regs[SB_MDEN],maple_regs[SB_MDST]);
588//            printf("           %08x %08x %08x %08x\n",maple_regs[SB_MSYS],maple_regs[SB_MST],maple_regs[SB_MSHTCL],maple_regs[SB_MMSEL]);
568589            while (1) // do transfers
569590            {
570591               ddtdata.source=dat;      // source address
r5613r5614
587608               command=buff[2] & 255;
588609               dap=(buff[2] >> 8) & 255;
589610               sap=(buff[2] >> 16) & 255;
611               func = buff[3];
590612               //buff[0]=0;
591613               //if(buff[1] == 0x700)
592614               //  printf("%08x %08x",buff[0],buff[2]);
r5613r5614
602624                     case 3:
603625                        ddtdata.length=1;
604626                        #if DEBUG_MAPLE
605                        printf("MAPLE: transfer command %x port %x\n", command, port);
627                        printf("MAPLE: transfer command %x port %x length %x\n", command, port, length);
606628                        #endif
607629                        break;
630
608631                     case 0x80: // get data and compute checksum
609632                        ddtdata.length=length;
610633                        ddtdata.direction=0;
r5613r5614
842865
843866               if (endflag)
844867               {
845                  #if ENABLE_MAPLE_IRQ
868                  #if 1 //ENABLE_MAPLE_IRQ
846869                  /*TODO: this fixes moeru but breaks other games, understand why.*/
847870                  dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_MAPLE;
848871                  dc_update_interrupt_status(space->machine);
r5613r5614
867890   }
868891}
869892
893// implementation for Dreamcast and Atomiswave supports only standard Sega Dreamcast Maple commands and peripherals
894READ64_HANDLER( dc_maple_r )
895{
896   int reg;
897   UINT64 shift;
898
899   reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
900
901   #if DEBUG_MAPLE_REGS
902   mame_printf_verbose("MAPLE:  Unmapped read %08x\n", 0x5f6c00+reg*4);
903   #endif
904   return (UINT64)maple_regs[reg] << shift;
905}
906
907WRITE64_HANDLER( dc_maple_w )
908{
909   int reg, func;
910   UINT64 shift;
911   UINT32 old,dat;
912   struct sh4_ddt_dma ddtdata;
913   UINT32 buff[512];
914   UINT32 endflag,port,pattern,length,command,dap,sap,destination;
915
916   reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
917   dat = (UINT32)(data >> shift);
918   old = maple_regs[reg];
919
920   #if DEBUG_MAPLE_REGS
921   mame_printf_verbose("MAPLE: [%08x=%x] write %" I64FMT "x to %x (reg %x: %s), mask %" I64FMT "x\n", 0x5f6c00+reg*4, dat, data >> shift, offset, reg, maple_names[reg], mem_mask);
922   #endif
923
924   maple_regs[reg] = dat; // 5f6c00+reg*4=dat
925   switch (reg)
926   {
927   case SB_MDST:
928      maple_regs[reg] = old;
929      if (!(old & 1) && (dat & 1) && maple_regs[SB_MDEN] & 1) // 0 -> 1
930      {
931         if (!(maple_regs[SB_MDTSEL] & 1))
932         {
933            maple_regs[reg] = 1;
934            dat=maple_regs[SB_MDSTAR];
935//            printf("Maple DMA: %08x %08x %08x %08x\n",maple_regs[SB_MDSTAR],maple_regs[SB_MDTSEL],maple_regs[SB_MDEN],maple_regs[SB_MDST]);
936//            printf("           %08x %08x %08x %08x\n",maple_regs[SB_MSYS],maple_regs[SB_MST],maple_regs[SB_MSHTCL],maple_regs[SB_MMSEL]);
937            while (1) // do transfers
938            {
939               ddtdata.source=dat;      // source address
940               ddtdata.length=3;      // words to transfer
941               ddtdata.size=4;         // bytes per word
942               ddtdata.buffer=buff;   // destination buffer
943               ddtdata.direction=0;   // 0 source to buffer, 1 buffer to source
944               ddtdata.channel= -1;   // not used
945               ddtdata.mode= -1;      // copy from/to buffer
946               sh4_dma_ddt(cputag_get_cpu(space->machine, "maincpu"), &ddtdata);
947
948               maple_regs[reg] = 0;
949               endflag=buff[0] & 0x80000000;
950               port=(buff[0] >> 16) & 3;
951               pattern=(buff[0] >> 8) & 7;
952               length=buff[0] & 255;
953               //if(length == 0)
954               //  length = 0x100;
955               destination=buff[1];
956               command=buff[2] & 255;
957               dap=(buff[2] >> 8) & 255;
958               sap=(buff[2] >> 16) & 255;
959               func = buff[3];
960               //buff[0]=0;
961               //if(buff[1] == 0x700)
962               //  printf("%08x %08x",buff[0],buff[2]);
963               ddtdata.size=4;
964
965               if (pattern == 0)
966               {
967                  char pL[8], pH[8];
968
969                  if (port > 0)
970                     buff[0]=0xffffffff;
971                  switch (command)
972                  {
973                     case 1: // AW/DC MAPLE_CMD_INFO
974                        ddtdata.length = sizeof(dc_controller_id)/4;
975                       
976                        buff[0] = 5;   // MAPLE_RESP_INFO
977                        memcpy(&buff[1], dc_controller_id, sizeof(dc_controller_id));
978                        break;
979
980                     case 2: // AW/DC MAPLE_CMD_EXT_INFO
981                        ddtdata.length = sizeof(dc_controller_id)+sizeof(dc_controller_version)/4;
982                       
983                        buff[0] = 6;   // MAPLE_RESP_EXT_INFO
984                        memcpy(&buff[1], dc_controller_id, sizeof(dc_controller_id));
985                        memcpy(&buff[1+(0x70/4)], dc_controller_version, sizeof(dc_controller_version));
986                        break;
987
988                     case 3:   // AW/DC MAPLE_CMD_RESET
989                        ddtdata.length=1;
990                        #if DEBUG_MAPLE
991                        printf("MAPLE: transfer command %x port %x length %x\n", command, port, length);
992                        #endif
993                        break;
994
995                     case 9: // AW/DC MAPLE_CMD_GET_COND
996                        buff[0] = 8;   // MAPLE_RESP_DATA
997                       
998                        sprintf(pL, "P%dL", port+1);
999                        sprintf(pH, "P%dH", port+1);
1000                       
1001                        buff[1] = func;
1002                        buff[2] = input_port_read(space->machine, pH)<<8 | input_port_read(space->machine, pL) | 0xffff0000;
1003                        buff[3] = 0xffffffff;
1004                        ddtdata.length=(8/4)+1;
1005                        break;
1006                     default:
1007                        #if DEBUG_MAPLE
1008                        printf("MAPLE: unknown transfer command %x port %x\n", command, port);
1009                        #endif
1010                        ddtdata.length=0;
1011                        endflag = 1; /*TODO: check this */
1012                        //buff[0]=0xffffffff;
1013                        break;
1014                  }
1015               }
1016               ddtdata.destination=destination;
1017               ddtdata.buffer=buff;
1018               ddtdata.direction=1;
1019               sh4_dma_ddt(cputag_get_cpu(space->machine, "maincpu"),&ddtdata);
1020
1021               if (endflag)
1022               {
1023                  #if ENABLE_MAPLE_IRQ
1024                  dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_MAPLE;
1025                  dc_update_interrupt_status(space->machine);
1026                  #endif
1027                  break;
1028               }
1029               // skip fixed packet header
1030               dat += 8;
1031               // skip transfer data
1032               dat += (length + 1) * 4;
1033            } // do transfers
1034            maple_regs[reg] = 0;
1035         }
1036         else
1037         {
1038            #if DEBUG_MAPLE
1039            printf("MAPLE: hardware trigger not supported yet\n");
1040            #endif
1041         }
1042      }
1043      break;
1044   }
1045}
1046
8701047INPUT_CHANGED( dc_coin_slots_callback )
8711048{
8721049   UINT32 *counter = (UINT32 *)param;
r5613r5614
9501127            mame_printf_verbose("G1CTRL: unsupported transfer\n");
9511128            return;
9521129         }
953//          printf("ROM board DMA to %x (PC %x)\n", g1bus_regs[SB_GDSTAR], cpu_get_pc(space->cpu));
1130//          printf("ROM board DMA to %x len %x (PC %x)\n", g1bus_regs[SB_GDSTAR], g1bus_regs[SB_GDLEN], cpu_get_pc(space->cpu));
9541131          ROM = (UINT8 *)devtag_get_info_ptr(space->machine, "rom_board", DEVINFO_PTR_MEMORY);
9551132          dmaoffset = (UINT32)devtag_get_info_int(space->machine, "rom_board", DEVINFO_INT_DMAOFFSET);
9561133         ddtdata.destination=g1bus_regs[SB_GDSTAR];      // destination address
src/mame/machine/atarigen.c
r5613r5614
10741074
10751075   /* use this for debugging the video controller values */
10761076#if 0
1077   if (input_code_pressed(KEYCODE_8))
1077   if (input_code_pressed(machine, KEYCODE_8))
10781078   {
10791079      static FILE *out;
10801080      if (!out) out = fopen("scroll.log", "w");
src/mame/machine/naomibd.c
r5613r5614
182182#define NAOMIBD_FLAG_SPECIAL_MODE   (4)   // used to access protection registers
183183#define NAOMIBD_FLAG_ADDRESS_SHUFFLE   (2)   // 0 to let protection chip en/decrypt, 1 for normal
184184
185#define NAOMIBD_PRINTF_PROTECTION   (0)   // 1 to printf protection access details
186
185187/*************************************
186188 *
187189 *  Prototypes
r5613r5614
225227
226228   UINT32            *prot_translate;
227229   int            prot_reverse_bytes;
230   #if NAOMIBD_PRINTF_PROTECTION
231   int            prot_pio_count;
232   #endif
228233};
229234
230235// maps protection offsets to real addresses
r5613r5614
254259         0xad8c, 0, 0xf0000, 0x923d, 0, 0x100000, 0x4a65, 0, 0x110000, 0x9958, 0, 0x120000, 0x8216, 0, 0x130000,
255260         0xaa91, 0, 0x140000, 0xd007, 0, 0x150000, 0xead, 0, 0x160000, 0x492, 0, 0x170000,
256261         0xffffffff, 0xffffffff, 0xffffffff } },
262   { "pjustic", 0, { 0x923d, 0, 0, 0x3e41, 0, 0x10000, 0xb7af, 0, 0x20000,
263           0x9651, 0, 0x30000, 0xad8c, 0, 0x40000, 0xffffffff, 0xffffffff, 0xffffffff } },
264   { "hmgeo",   0, { 0x6cc8, 0, 0x000000, 0x7b92, 0, 0x010000, 0x69bc, 0, 0x020000,
265           0x6d16, 0, 0x030000, 0x6134, 0, 0x040000, 0x1340, 0, 0x050000,
266           0x7716, 0, 0x060000, 0x2e1a, 0, 0x070000, 0x3030, 0, 0x080000,
267           0x0870, 0, 0x090000, 0x2856, 0, 0x0a0000, 0x4224, 0, 0x0b0000,
268           0x6df0, 0, 0x0c0000, 0x0dd8, 0, 0x0d0000, 0x576c, 0, 0x0e0000,
269           0x0534, 0, 0x0f0000, 0x0904, 0, 0x100000, 0x2f14, 0, 0x110000,
270           0x1792, 0, 0x120000, 0x6866, 0, 0x130000, 0x06fa, 0, 0x140000,
271           0x2842, 0, 0x150000, 0x7cc8, 0, 0x160000, 0xffffffff, 0xffffffff, 0xffffffff } }, 
272   { "wwfroyal",0, { 0xaaaa, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
273   { "gwing2",  0, { -1, 0x85ddc0, 0, 0xd567, 0, 0x10000, 0xe329, 0, 0x30000, 0xc112, 0, 0x50000,
274           0xabcd, 0, 0x70000, 0xef01, 0, 0x90000, 0x1234, 0, 0xb0000, 0x5678, 0, 0xd0000,
275           0x5555, 0, 0xf0000, 0x6666, 0, 0x110000, 0xa901, 0, 0x130000, 0xa802, 0, 0x150000,
276           0x3232, 0, 0x170000, 0x8989, 0, 0x190000, 0x6655, 0, 0x1a0000,
277           0x3944, 0, 0x1c0000, 0x655a, 0, 0x1d0000, 0xf513, 0, 0x1e0000,
278           0xb957, 0, 0, 0x37ca, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
279/*   { "pstone2", 0, { 0x4a65, 0, 0x000000, 0x0ead, 0, 0x010000, 0x0492, 0, 0x020000, 0x414a, 0, 0x030000,
280           0xad8c, 0, 0x040000, 0x923d, 0, 0x050000, 0x4a65, 0, 0x060000, 0x9958, 0, 0x070000,
281           0x8216, 0, 0x080000, 0xaa91, 0, 0x090000, 0xd007, 0, 0x0a0000, 0x71ee, 0, 0x0b0000,
282           0x3e41, 0, 0x0c0000, 0xb7af, 0, 0x0d0000, 0x9651, 0, 0x0e0000, 0x0492, 0, 0x0f0000,
283           0x414a, 0, 0x100000, 0xaf99, 0, 0x110000, 0x5182, 0, 0x120000, 0x08aa, 0, 0x130000,
284           0x69d0, 0, 0x140000, 0x9d71, 0, 0x150000, 0xd319, 0, 0x160000, 0xcc09, 0, 0x170000,
285           0x5ec4, 0, 0x180000, 0x7103, 0, 0x190000, 0xffffffff, 0xffffffff, 0xffffffff } },
286*/
287   { "toyfight", 0,{ 0x0615, 0, 0x0000, 0x1999, 0, 0x1000, 0x7510, 0, 0x2000, 0x5736, 0, 0x3000,
288                0xffffffff, 0xffffffff, 0xffffffff } },
289   { "ggx",      0,{ -1, 0x200000, 0x100000, -1, 0x210004, 0x110000, -1, 0x220008, 0x120000, -1, 0x228000, 0x130000,
290                0x3af9, 0, 0x000000, 0x2288, 0, 0x010000, 0xe5e6, 0, 0x020000, 0xebb0, 0, 0x030000,
291           0x0228, 0, 0x040000, 0x872c, 0, 0x050000, 0xbba0, 0, 0x060000, 0x772f, 0, 0x070000,
292           0x2924, 0, 0x080000, 0x3222, 0, 0x090000, 0x7954, 0, 0x0a0000, 0x5acd, 0, 0x0b0000,
293           0xdd19, 0, 0x0c0000, 0x2428, 0, 0x0d0000, 0x3329, 0, 0x0e0000, 0x2142, 0, 0x0f0000,
294                0xffffffff, 0xffffffff, 0xffffffff } },
257295};
258296
259297/***************************************************************************
r5613r5614
378416
379417            if (v->prot_translate == NULL)
380418            {
381               logerror("naomibd: reading protection data, but none was supplied\n");
419               #if NAOMIBD_PRINTF_PROTECTION
420               v->prot_pio_count += 2;
421               printf("naomibd: reading protection data, but none was supplied (now %x bytes)\n", v->prot_pio_count);
422               #endif
382423               return 0;
383424            }
384425
426            #if NAOMIBD_PRINTF_PROTECTION
427            v->prot_pio_count += 2;
428            printf("naomibd: PIO read count %x\n", v->prot_pio_count);
429            #endif
430
385431             if (v->prot_reverse_bytes)
386432            {
387433               ret = (UINT64)(prot[byte_offset+1] | (prot[byte_offset]<<8));
r5613r5614
393439
394440            v->prot_offset++;
395441         }
442         #if NAOMIBD_PRINTF_PROTECTION
396443         else
397444         {
398            logerror("Bad protection offset read %x\n", v->rom_offset);
445            printf("Bad protection offset read %x\n", v->rom_offset);
399446         }
447         #endif
400448      }
401449      else
402450      {
r5613r5614
564612            v->rom_offset &= 0xffff0000;
565613            v->rom_offset |= ((data >> 32) & 0xffff);
566614         }
615
616         #if NAOMIBD_PRINTF_PROTECTION
617         printf("PIO: offset to %x\n", v->rom_offset);
618         #endif
567619      }
568620      break;
569621      case 1:
r5613r5614
593645               case 0x1fffc:   // decryption key
594646                  v->prot_key = data;
595647
596//                      printf("Protection: set up read @ %x, key %x (PIO %x DMA %x) [%s]\n", v->prot_offset, v->prot_key, v->rom_offset, v->dma_offset, cpuexec_describe_context(device->machine));
648                  #if NAOMIBD_PRINTF_PROTECTION
649                  printf("Protection: set up read @ %x, key %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->rom_offset, v->dma_offset, cpuexec_describe_context(device->machine));
597650
651                  v->prot_pio_count = 0;
652                  #endif
653
598654                  // translate address if necessary
599655                  if (v->prot_translate != NULL)
600656                  {
r5613r5614
606662                        {
607663                           if (v->prot_translate[i] == v->prot_key)
608664                           {
609                              mame_printf_verbose("Protection: got key %x, translated to %x\n", v->prot_key, v->prot_translate[i+2]);
665                              #if NAOMIBD_PRINTF_PROTECTION
666                              printf("Protection: got key %x, translated to %x\n", v->prot_key, v->prot_translate[i+2]);
667                              #endif
610668                              v->prot_offset = v->prot_translate[i+2]/2;
611669                              break;
612670                           }
r5613r5614
619677                        {
620678                           if (v->prot_translate[i+1] == (v->prot_offset*2))
621679                           {
622                              mame_printf_verbose("Protection: got offset %x, translated to %x\n", v->prot_offset, v->prot_translate[i+2]);
680                              #if NAOMIBD_PRINTF_PROTECTION
681                              printf("Protection: got offset %x, translated to %x\n", v->prot_offset, v->prot_translate[i+2]);
682                              #endif
623683                              v->prot_offset = v->prot_translate[i+2]/2;
624684                              break;
625685                           }
r5613r5614
630690                        }
631691                     }
632692                  }
693                  #if NAOMIBD_PRINTF_PROTECTION
633694                  else
634695                  {
635                     logerror("naomibd: protection not handled for this game\n");
696                     printf("naomibd: protection not handled for this game\n");
636697                  }
698                  #endif
637699                  break;
638700
639701               default:
640                  mame_printf_verbose("naomibd: unknown protection write %x @ %x\n", (UINT32)data, offset);
702                  #if NAOMIBD_PRINTF_PROTECTION
703                  printf("naomibd: unknown protection write %x @ %x\n", (UINT32)data, offset);
704                  #endif
641705                  break;
642706            }
643707         }
r5613r5614
908972
909973   /* find the protection address translation for this game */
910974   v->prot_translate = (UINT32 *)0;
975   #if NAOMIBD_PRINTF_PROTECTION
976   v->prot_pio_count = 0;
977   #endif
911978   for (i=0; i<ARRAY_LENGTH(naomibd_translate_tbl); i++)
912979   {
913980      if (!strcmp(device->machine->gamedrv->name, naomibd_translate_tbl[i].name))
r5613r5614
10301097      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = sizeof(naomibd_config);            break;
10311098      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_PERIPHERAL;            break;
10321099      case DEVINFO_INT_DMAOFFSET:
1033//          printf("DMA source %x, flags %x\n", get_safe_token(device)->dma_offset, get_safe_token(device)->dma_offset_flags);
1100         #if NAOMIBD_PRINTF_PROTECTION
1101              printf("DMA source %08x, flags %x\n", get_safe_token(device)->dma_offset, get_safe_token(device)->dma_offset_flags);
1102         #endif
10341103
10351104         // if the flag is cleared that lets the protection chip go,
1036         // we need to handle this specially.
1037         if (!(get_safe_token(device)->dma_offset_flags & NAOMIBD_FLAG_ADDRESS_SHUFFLE))
1105         // we need to handle this specially.  but not on DIMM boards.
1106         if (!(get_safe_token(device)->dma_offset_flags & NAOMIBD_FLAG_ADDRESS_SHUFFLE) && (get_safe_token(device)->type == ROM_BOARD))
10381107         {
10391108            if (!strcmp(device->machine->gamedrv->name, "qmegamis"))
10401109            {
r5613r5614
10891158         }
10901159         break;
10911160      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Naomi/Atomiswave plug-in board");         break;
1092      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                     break;
1161      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.1");                     break;
10931162      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                  break;
10941163      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
10951164   }
src/mame/machine/archimds.c
r5613r5614
202202      }
203203      else
204204      {
205         printf("ARCHIMEDES_MEMC: Reading unmapped page, what do we do?\n");
205         logerror("ARCHIMEDES_MEMC: Reading unmapped page, what do we do?\n");
206206      }
207207   }
208208
r5613r5614
232232      }
233233      else
234234      {
235         printf("ARCHIMEDES_MEMC: Writing unmapped page, what do we do?\n");
235         logerror("ARCHIMEDES_MEMC: Writing unmapped page, what do we do?\n");
236236      }
237237   }
238238}
src/mame/machine/harddriv.c
r5613r5614
379379   UINT16 new_wheel = input_port_read(space->machine, "12BADC0") << 4;
380380
381381   /* hack to display the wheel position */
382   if (input_code_pressed(KEYCODE_LSHIFT))
382   if (input_code_pressed(space->machine, KEYCODE_LSHIFT))
383383      popmessage("%04X", new_wheel);
384384
385385   /* if we crossed the center line, latch the edge bit */
r5613r5614
888888
889889static TIMER_CALLBACK( deferred_adsp_bank_switch )
890890{
891   if (LOG_COMMANDS && m68k_adsp_buffer_bank != param && input_code_pressed(KEYCODE_L))
891   if (LOG_COMMANDS && m68k_adsp_buffer_bank != param && input_code_pressed(machine, KEYCODE_L))
892892   {
893893      static FILE *commands;
894894      if (!commands) commands = fopen("commands.log", "w");
src/mame/machine/kaneko16.c
r5613r5614
3737    - see notes about this "calculator" implementation in drivers\galpanic.c
3838    - bonkadv only uses Random Number, XY Overlap Collision bit and register '0x02'
3939*/
40READ16_HANDLER(shogwarr_calc_r);
41WRITE16_HANDLER(shogwarr_calc_w);
4042
41
4243static struct {
4344   UINT16 x1p, y1p, x1s, y1s;
4445   UINT16 x2p, y2p, x2s, y2s;
r5613r5614
123124
124125WRITE16_HANDLER(bloodwar_calc_w)
125126{
127
128   int isbrap = ( !strcmp(space->machine->gamedrv->name,"brapboysj") || !strcmp(space->machine->gamedrv->name,"brapboys"));
129
130   /* our implementation is incomplete, b.rap boys requires some modifications */
131   if (isbrap)
132   {
133      shogwarr_calc_w(space,offset,data,mem_mask);
134      return;
135   }
136
126137   switch (offset)
127138   {
128139      // p is position, s is size
r5613r5614
188199   UINT16 data = 0;
189200   INT16 x_coll, y_coll;
190201
202   /* our implementation is incomplete, b.rap boys requires some modifications */
203   int isbrap = ( !strcmp(space->machine->gamedrv->name,"brapboysj") || !strcmp(space->machine->gamedrv->name,"brapboys"));
204
205   if (isbrap)
206   {
207      return shogwarr_calc_r(space,offset,mem_mask);
208   }
209
191210   x_coll = calc_compute_x();
192211   y_coll = calc_compute_y();
193212
r5613r5614
592611         - this is usually '3', but if it's larger than 3 it enables an 'inline encryption' mode, whereby the decryption table is stored in the
593612         - right before the length register
594613
595OFFSET 1 - a 'mode' register of some sort, usually 0,1,2 or 3 for used data, shogun also called a 'blank' command (length 0) with mode 8
614OFFSET 1 - a 'mode' register of some sort, usually 0,1,2 or 3 for used data, shogun also called a 'blank' command (length 0) with mode 8 and mode 6
615         - seems to cause eeprom access and reset write addresses
596616
597617OFFSET 2 - unknown, might be some kind of 'step' register
618         - 4 bits are 'shift' used in the decryption
619         - the other 4 bits probably control if the odd/even bytes are inverted, and if an alt shift is applied every other byte
598620
599OFFSET 3 - decryption key - specifies which decryption table to use (ignored for inline tables, see offset 0)
621OFFSET 3 - decryption key - specifies which decryption table to use (ignored for inline tables, see offset 0), key 00 is blank
600622
601623(inline decryption table goes here if specified)
602624
r5613r5614
611633
612634*/
613635
614/*
615636
616
617Status
618
619Blocks marked ** are decrypted and verified
620              .. means I have the data to study
621
622(Shogun Warriors)
623
624   Block 10 Found Base 0060 - Mode? 01 Unknown 14 Key 00 Length 0532
625   Block 11 Found Base 0598 - Mode? 01 Unknown 48 Key 00 Length 03f4
626
627** Block 19 Found Base 09bc - Mode? 03 Unknown 01 Key 01 Length 00da
628
629   Block 30 Found Base 0b20 - Mode? 02 Unknown 01 Key 10 Length 022a
630   Block 31 Found Base 0d50 - Mode? 02 Unknown 03 Key 11 Length 0246
631   Block 32 Found Base 0f9c - Mode? 02 Unknown 01 Key 12 Length 0226
632   Block 33 Found Base 11c8 - Mode? 02 Unknown 02 Key 13 Length 0216
633   Block 34 Found Base 13e4 - Mode? 02 Unknown 02 Key 14 Length 0226
634   Block 35 Found Base 1610 - Mode? 02 Unknown 03 Key 15 Length 024a
635   Block 36 Found Base 1860 - Mode? 02 Unknown 03 Key 16 Length 0222
636   Block 37 Found Base 1a88 - Mode? 02 Unknown 02 Key 17 Length 0216
637   Block 38 Found Base 1ca4 - Mode? 02 Unknown 02 Key 18 Length 0222
638   Block 39 Found Base 1ecc - Mode? 02 Unknown 01 Key 19 Length 0206
639   Block 3a Found Base 20d8 - Mode? 02 Unknown 01 Key 1a Length 0202
640   Block 3b Found Base 22e0 - Mode? 02 Unknown 02 Key 1b Length 021e
641
642** Block 40 Found Base 251c - Inline Encryption (size 22) - Mode? 01 Unknown 03 Key (unused?) 62 Length 1008
643** Block 41 Found Base 354c - Mode? 01 Unknown 7c Key 00 Length 1008
644
645** Block 58 Found Base 45de - Mode? 01 Unknown 02 Key 15 Length 1d4e
646
647   Block 60 Found Base 635c - Mode? 02 Unknown 3f Key b0 Length 00e6
648   Block 61 Found Base 6448 - Mode? 02 Unknown 3f Key 31 Length 00e6
649   Block 62 Found Base 6534 - Mode? 02 Unknown 3f Key 32 Length 00e6
650   Block 63 Found Base 6620 - Inline Encryption (size 33) - Mode? 02 Unknown 3f Key (unused?) 73 Length 00e6
651   Block 64 Found Base 673f - Mode? 02 Unknown 3f Key 34 Length 00e6
652   Block 65 Found Base 682b - Inline Encryption (size 35) - Mode? 02 Unknown 3f Key (unused?) 75 Length 00e6
653   Block 66 Found Base 694c - Mode? 02 Unknown 3f Key 36 Length 00e6
654   Block 67 Found Base 6a38 - Mode? 02 Unknown 3f Key b7 Length 00e6
655   Block 68 Found Base 6b24 - Mode? 02 Unknown 3f Key 38 Length 00e6
656   Block 69 Found Base 6c10 - Inline Encryption (size 39) - Mode? 02 Unknown 3f Key (unused?) 79 Length 00e6
657   Block 6a Found Base 6d35 - Mode? 02 Unknown 3f Key 3a Length 00e6
658   Block 6b Found Base 6e21 - Mode? 02 Unknown 3f Key bb Length 00e6
659
660** Block 80 Found Base 6f85 - Mode? 00 Unknown 3f Key 01 Length 02b0
661
662
663(BRap Boys Special)
664
665** Block 10 Found Base 0060 - Mode? 01 Unknown 02 Key 04 Length 00d0
666** Block 11 Found Base 0136 - Inline Encryption (size 13) - Mode? 00 Unknown 3f Key (unused?) 53 Length 00fe
667** Block 12 Found Base 024d - Mode? 02 Unknown 38 Key 00 Length 0050                                           | just a shift
668** Block 13 Found Base 02a3 - Mode? 02 Unknown 6f Key bc Length 09e0                                           | shift 2 places - (test mode code / data!)
669** Block 14 Found Base 0c89 - Mode? 03 Unknown 01 Key 31 Length 1880                                           | just a table
670** Block 15 Found Base 250f - Mode? 02 Unknown 3f Key 24 Length 03b8                                           | shift 3 places + table, contains GAME OVER, CONTINUE
671** Block 16 Found Base 28cd - Mode? 01 Unknown 03 Key 80 Length 018a
672** Block 17 Found Base 2a5d - Mode? 01 Unknown 1f Key 15 Length 018a
673** Block 18 Found Base 2bed - Mode? 01 Unknown 44 Key 00 Length 0184                                           | 4 place shift
674** Block 19 Found Base 2d77 - Mode? 01 Unknown 03 Key 19 Length 0184                                           | just a table
675** Block 1a Found Base 2f01 - Inline Encryption (size 21) - Mode? 02 Unknown 3f Key (unused?) 61 Length 0a24
676** Block 1b Found Base 394c - Mode? 01 Unknown 5f Key 22 Length 0e02
677** Block 1c Found Base 4754 - Mode? 01 Unknown 1f Key 3f Length 0e02
678** Block 1d Found Base 555c - Mode? 01 Unknown 03 Key bf Length 0e02
679** Block 1e Found Base 6364 - Mode? 01 Unknown 01 Key 24 Length 0e02
680** Block 1f Found Base 716c - Mode? 02 Unknown 1f Key 39 Length 02ac                                           | 1 place shift + table
681** Block 20 Found Base 741e - Mode? 03 Unknown 03 Key af Length 01a4
682** Block 21 Found Base 75c8 - Inline Encryption (size 3d) - Mode? 03 Unknown 2f Key (unused?) 7d Length 01fa
683** Block 22 Found Base 7805 - Mode? 03 Unknown 1f Key 17 Length 010c                                           | 1 place shift + table
684** Block 23 Found Base 7917 - Mode? 03 Unknown 03 Key 89 Length 018c                                           | just a table
685** Block 24 Found Base 7aa9 - Inline Encryption (size 03) - Mode? 03 Unknown 5f Key (unused?) 43 Length 0214
686** Block 25 Found Base 7cc6 - Inline Encryption (size 1d) - Mode? 03 Unknown 02 Key (unused?) 5d Length 0178
687** Block 26 Found Base 7e61 - Mode? 03 Unknown 03 Key 05 Length 04e2
688** Block 27 Found Base 8349 - Mode? 03 Unknown 3f Key a7 Length 00fa
689** Block 28 Found Base 8449 - Inline Encryption (size 23) - Mode? 03 Unknown 1f Key (unused?) 63 Length 015a
690** Block 29 Found Base 85cc - Mode? 03 Unknown 03 Key 15 Length 00d6
691** Block 2a Found Base 86a8 - Mode? 03 Unknown 3f Key a1 Length 00aa
692** Block 2b Found Base 8758 - Mode? 03 Unknown 2f Key 04 Length 01a2
693** Block 2c Found Base 8900 - Mode? 03 Unknown 2f Key 04 Length 04cc
694** Block 2d Found Base 8dd2 - Mode? 03 Unknown 03 Key 15 Length 0486
695
696
697*/
698
699637UINT16 calc3_mcu_crc;
700638
701639/* decryption tables */
702640
703/* table 0x00 = not encrypted? (but can still be bitswapped) */
704static UINT8 calc3_key00[64] = {
705   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
706   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
707   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
708   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
709};
641/* this should probably be derived from the final block at the end of the MCU rom somehow ...
642    (see 'finalblock' debug output when verbose = 1)
643   for now just putting it in a bit table, only used keys are filled in as nothing else was
644   extracted when getting the tables, unknown values are filled in as -1
710645
711/* ok */
712static UINT8 calc3_key01[64] = {
713   0xce,0xab,0xa1,0xaa,0x20,0x20,0xcb,0x57,0x5b,0x65,0xd6,0x65,0x5e,0x92,0x6c,0x0a,
714   0xf8,0xea,0xb6,0xfd,0x76,0x35,0x47,0xaf,0xed,0xe0,0xcc,0x4d,0x4c,0xd6,0x74,0x78,
715   0x20,0x1c,0x1f,0xc1,0x25,0x2e,0x49,0xe7,0x90,0x1b,0xb4,0xcf,0x1e,0x61,0xd7,0x46,
716   0xda,0x89,0x08,0x77,0xb1,0x81,0x6b,0x2d,0xb6,0xbc,0x99,0xc9,0x35,0x0a,0x0f,0x01
717};
646   key 0 means no decryption, this could be done in logic rather than expecting the first
647   part of the table to be 0
648*/
718649
719
720/* ok - brapboys initial transfer */
721static UINT8 calc3_key04[64] = {
722    0xff,0x4a,0x62,0xa3,0xf4,0xb4,0x8c,0x2d,0x84,0xbd,0x87,0x3a,0x9e,0xe9,0xd7,0x12,
723    0xff,0x50,0x40,0x39,0xa6,0x47,0xd9,0x38,0x89,0x3c,0x62,0xa0,0x86,0xe2,0xd7,0x4d,
724   0x9c,0x8e,0x45,0xe8,0x5b,0xe1,0xdd,0xaf,0x99,0xa8,0x47,0x79,0x67,0x00,0x38,0xf4,
725   0x43,0xbe,0x47,0x32,0x8f,0x0e,0xfd,0x64,0x42,0x59,0x2b,0xe5,0xde,0x6d,0x80,0x7a,
650static INT16 calc3_keydata[0x40*0x100] = {
6510x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
6520x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
6530x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
6540x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
6550xce,0x55,0xa1,0x56,0x20,0xe0,0xcb,0xa9,0x5b,0x9b,0xd6,0x9b,0x5e,0x6e,0x6c,0xf6,
6560xf8,0x16,0xb6,0x03,0x76,0xcb,0x47,0x51,0xed,0x20,0xcc,0xb3,0x4c,0x2a,0x74,0x88,
6570x20,0xe4,0x1f,0x3f,0x25,0xd2,0x49,0x19,0x90,0xe5,0xb4,0x31,0x1e,0x9f,0xd7,0xba,
6580xda,0x77,0x08,0x89,0xb1,0x7f,0x6b,0xd3,0xb6,0x44,0x99,0x37,0x35,0xf6,0x0f,0xff,
659  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
660  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
661  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
662  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
663  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
664  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
665  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
666  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
6670x01,0x4a,0x9e,0xa3,0x0c,0xb4,0x74,0x2d,0x7c,0xbd,0x79,0x3a,0x62,0xe9,0x29,0x12,
6680x01,0x50,0xc0,0x39,0x5a,0x47,0x27,0x38,0x77,0x3c,0x9e,0xa0,0x7a,0xe2,0x29,0x4d,
6690x64,0x8e,0xbb,0xe8,0xa5,0xe1,0x23,0xaf,0x67,0xa8,0xb9,0x79,0x99,0x00,0xc8,0xf4,
6700xbd,0xbe,0xb9,0x32,0x71,0x0e,0x03,0x64,0xbe,0x59,0xd5,0xe5,0x22,0x6d,0x80,0x7a,
6710x5e,0xd8,0xa6,0xd7,0x00,0x94,0x23,0x66,0xaf,0xea,0xbe,0x45,0x38,0x90,0x8e,0x8d,
6720x5b,0x14,0x2c,0xda,0x55,0x7e,0x9d,0x08,0x2d,0x31,0xfd,0x3a,0xbe,0x13,0xeb,0x21,
6730x87,0xee,0xb7,0x7b,0x34,0x15,0x4d,0xd9,0xeb,0x4a,0xde,0xa6,0x57,0xdf,0x53,0x65,
6740x75,0x1c,0x72,0x3a,0x20,0xe1,0xcd,0xac,0x5d,0x8c,0x6d,0xa9,0x66,0x1d,0x41,0xca,
675  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
676  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
677  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
678  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
679  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
680  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
681  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
682  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
683  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
684  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
685  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
686  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
687  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
688  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
689  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
690  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
691  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
692  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
693  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
694  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
695  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
696  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
697  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
698  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
699  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
700  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
701  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
702  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
703  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
704  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
705  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
706  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
707  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
708  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
709  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
710  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
711  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
712  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
713  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
714  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
7150xca,0x23,0x9e,0x00,0x37,0x72,0x61,0x0d,0x71,0x99,0x02,0xb1,0x5b,0x8f,0x50,0x22,
7160x06,0xdb,0xd6,0xd5,0x44,0x42,0xcd,0x44,0xf0,0xa2,0xc4,0xef,0xfa,0x1e,0x11,0xa1,
7170x34,0x7b,0xf6,0xf4,0xdf,0xca,0x92,0x17,0xf3,0x48,0x8d,0xcf,0x30,0x82,0x81,0xbc,
7180xe8,0xbd,0x29,0xde,0x89,0x94,0x4b,0x57,0xed,0xe3,0x66,0x73,0x60,0xe4,0x1b,0xe5,
7190x75,0x98,0x5b,0x53,0x88,0x69,0x54,0x16,0x11,0x0d,0x1c,0x3b,0xae,0xad,0x1a,0xcd,
7200xed,0x47,0x37,0x56,0xdd,0x51,0xc8,0xa3,0x52,0x9f,0x38,0xc8,0xfb,0x86,0x78,0x64,
7210x25,0x42,0x27,0x26,0x4b,0x95,0x80,0x90,0x64,0xb1,0x07,0xfb,0xeb,0x58,0xf2,0xdc,
7220xad,0x42,0x57,0x45,0x56,0xbf,0x19,0xaf,0xb9,0x9d,0x93,0xf6,0xe1,0x4c,0x01,0xa5,
7230xdb,0x40,0xb2,0x74,0x40,0x97,0xee,0x0f,0x84,0xfc,0xa7,0x19,0x01,0xcb,0xe1,0x71,
7240xc1,0x75,0xe2,0xb4,0x0d,0x26,0x19,0x03,0xb9,0xa6,0xce,0x06,0x2c,0x7d,0x8d,0x30,
7250x31,0x5b,0x52,0x45,0x7f,0xb7,0x75,0x1a,0x09,0xb5,0x53,0x9c,0x06,0x4d,0xc0,0x14,
7260xbf,0xaa,0x2f,0xa9,0x1a,0xd0,0x9d,0x27,0xe9,0x82,0x41,0xff,0xf2,0x63,0xf5,0x8e,
7270xbd,0x5b,0x62,0xa2,0x20,0x3c,0xed,0x3a,0x8b,0xa6,0x64,0x8d,0x13,0x27,0x67,0x4e,
7280x40,0xa7,0x96,0x2f,0x95,0x04,0x7f,0xa4,0xe3,0xf9,0x45,0xe9,0x4c,0x44,0x10,0x46,
7290x19,0x08,0x38,0x91,0x3b,0x70,0x2f,0xf5,0xa2,0x95,0x31,0xf3,0x40,0xa2,0xad,0xa6,
7300xdb,0x35,0x70,0x4b,0x96,0x09,0x97,0x00,0x3d,0xd2,0x32,0xcc,0x52,0x69,0xb7,0xe0,
7310xdb,0x29,0x2c,0x1d,0xe8,0x99,0x12,0xd6,0xe6,0x4b,0x12,0xd6,0xa6,0x04,0x6a,0xa5,
7320x2a,0x1c,0x15,0x07,0x35,0x28,0xbc,0xc6,0x90,0xd7,0x5e,0xb1,0x1d,0x1a,0xc1,0xe5,
7330x9c,0x88,0x96,0x4b,0x3f,0x00,0x6f,0x62,0xef,0x90,0x60,0x3f,0x5b,0x95,0x77,0xd1,
7340xc4,0x24,0xdc,0x6a,0x8a,0xa9,0xc6,0x7b,0x74,0xce,0x24,0x9f,0xc3,0x9f,0x06,0xdc,
7350xf4,0xeb,0xd0,0x25,0x58,0xed,0x1d,0x23,0x54,0x2b,0x73,0x34,0x78,0x9f,0xab,0xb5,
7360x41,0x15,0x1d,0x7c,0xac,0xd4,0x8e,0xa9,0x82,0x80,0xd9,0x9f,0x5d,0x3f,0x5f,0x4d,
7370x7c,0x1b,0x2f,0xb2,0x4b,0xa7,0xf4,0xa0,0xaf,0xe6,0xa2,0xc0,0x15,0x68,0xde,0xd6,
7380x38,0xb6,0x31,0x46,0xb5,0xf0,0xeb,0xd7,0x50,0xb5,0xd7,0xb8,0x03,0x43,0xa4,0xc0,
7390xca,0xe0,0x0d,0xfa,0x2f,0x78,0xcd,0x61,0x97,0x87,0x45,0xe8,0x4a,0x39,0xe9,0xbe,
7400x43,0xd0,0x6f,0xcf,0xbc,0x47,0xb6,0x8e,0x77,0x35,0x76,0xf2,0xcc,0xf3,0xab,0xbe,
7410x77,0x01,0xc1,0x06,0x1e,0xa6,0x80,0xef,0xa3,0xd7,0xb5,0xb6,0x2e,0x5a,0xa4,0xf4,
7420xf8,0x2b,0x30,0x20,0xd8,0x1f,0xc6,0x55,0x8f,0xc7,0x0d,0x55,0xd2,0x97,0x4f,0xce,
7430x1b,0x48,0xa4,0xdd,0x2e,0x7a,0xe3,0xd1,0x6d,0x9e,0x49,0x31,0xdb,0x13,0xe6,0x00,
7440xf1,0x8f,0xcb,0x3f,0x23,0xc1,0xf3,0xb4,0x30,0x35,0xf4,0xea,0x2c,0x77,0x65,0x79,
7450x4e,0x7b,0x0e,0x87,0x79,0x3c,0xd1,0x8f,0x8b,0xa4,0x5a,0x61,0x68,0xac,0x87,0x6b,
7460xc4,0xc4,0x98,0x36,0xb3,0x75,0x16,0x33,0xf2,0x45,0x84,0xb8,0xf2,0xdb,0xc7,0x46,
7470xa8,0x63,0x55,0x0d,0x15,0x34,0x1f,0xb2,0x96,0xb0,0x3f,0x4f,0xec,0x6c,0x60,0xbb,
7480x0b,0x91,0xf0,0x0d,0xa2,0x83,0x07,0x5b,0x6c,0xc0,0x14,0xc7,0x3b,0x0a,0x4d,0xbd,
7490xc0,0xc8,0xd3,0x76,0x1c,0xaa,0xa8,0xc1,0x27,0x8c,0x50,0x02,0x81,0x9d,0x48,0x7b,
7500x5c,0xc0,0x2a,0xca,0x06,0x32,0x9d,0xb3,0x38,0x6d,0xfd,0x20,0x21,0x4d,0xce,0x66,
7510x30,0x72,0xe0,0xca,0xa4,0xe5,0x41,0x44,0xd4,0xfe,0xe6,0x82,0x3e,0x85,0x18,0x30,
7520x50,0x17,0x9f,0x77,0xf8,0xcb,0xb0,0xc4,0xed,0x16,0x96,0xca,0xba,0xec,0x22,0xca,
7530x8f,0x28,0xd3,0x12,0xc6,0x2e,0xc4,0xc3,0x36,0xcf,0x59,0xd8,0x3a,0x6c,0xa7,0x64,
7540x7f,0x5f,0xa6,0x1b,0x90,0x96,0x19,0x14,0x22,0x81,0x38,0xcd,0x20,0x2f,0x22,0x70,
7550x74,0xb4,0x04,0x55,0x9a,0xcd,0x09,0xc7,0xe5,0xc7,0xff,0x0b,0x8e,0x9c,0xce,0x9e,
7560x81,0x5f,0x98,0xbf,0xe7,0xdb,0xaf,0x2d,0x71,0x77,0x3a,0x32,0x69,0x5d,0xa5,0xe0,
7570x79,0xdc,0xcc,0x9b,0x38,0x0a,0xe6,0xd7,0x79,0xad,0x33,0x23,0x53,0x5c,0x64,0x67,
7580xee,0xe1,0xcc,0x6a,0x13,0xe2,0x4a,0x97,0x71,0xc0,0xf4,0x00,0xae,0xc0,0x84,0xa3,
7590x34,0x69,0x83,0xec,0xb8,0x2c,0x36,0x7c,0x8a,0x4b,0x4a,0x29,0x9f,0xf3,0x41,0x46,
7600x5e,0xab,0x9b,0x24,0x2d,0xf2,0xc4,0xd8,0xb9,0x24,0xbf,0x3f,0x08,0x9e,0x96,0x40,
7610x3f,0x22,0x7f,0x51,0x32,0x7d,0xcf,0x3d,0xb0,0x67,0x9f,0x24,0x8b,0xaa,0x3e,0xc3,
7620x69,0x87,0x5c,0xf5,0x4d,0x55,0xf2,0x7a,0xe2,0x6b,0xf3,0xf8,0x8d,0x40,0xb4,0x3f,
763  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
764  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
765  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
766  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
767  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
768  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
769  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
770  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
771  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
772  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
773  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
774  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
775  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
776  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
777  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
778  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
779  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
780  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
781  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
782  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
783  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
784  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
785  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
786  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
7870xfe,0xf7,0xc7,0x85,0xe4,0xd3,0x93,0xd0,0x36,0x61,0xc8,0x4d,0x0c,0x3e,0x2a,0x1c,
7880x32,0x1a,0xbf,0x1a,0xb0,0x60,0xb5,0xa8,0x1a,0x19,0x16,0xaf,0x96,0x0d,0x2d,0xe0,
7890xb1,0x2c,0xb6,0x41,0xe1,0x2d,0xc8,0xe5,0xd9,0x75,0x82,0xfa,0x90,0x3a,0x77,0x09,
7900x0e,0xe8,0xda,0x7a,0xfb,0xc4,0x68,0x57,0xe8,0xcf,0x18,0x51,0x5b,0xed,0x83,0x08,
791  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
792  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
793  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
794  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
7950x75,0x49,0x7a,0xd6,0x84,0xbd,0x70,0xbe,0x10,0x19,0x6c,0xb2,0xa9,0x5f,0x6b,0x78,
7960x14,0x29,0x2a,0x15,0xd0,0x4a,0x10,0x93,0x69,0xb2,0xdf,0x02,0x7f,0x92,0x19,0xbd,
7970x95,0xc1,0x32,0xee,0x99,0x5e,0x7a,0x55,0x37,0xb7,0xc8,0x45,0xdc,0x6a,0xe6,0xef,
7980x8b,0xca,0xbe,0xe2,0x63,0x85,0x49,0xd3,0xeb,0x83,0x32,0x9a,0x23,0x11,0x4c,0x7e,
799  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
800  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
801  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
802  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
803  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
804  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
805  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
806  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
807  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
808  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
809  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
810  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
811  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
812  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
813  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
814  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
815  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
816  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
817  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
818  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
819  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
820  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
821  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
822  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
823  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
824  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
825  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
826  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
827  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
828  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
829  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
830  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
831  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
832  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
833  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
834  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
835  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
836  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
837  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
838  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
839  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
840  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
841  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
842  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
843  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
844  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
845  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
846  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
8470x02,0xdf,0x0f,0x0e,0x98,0x3a,0xa7,0xaf,0xbd,0xb0,0xe6,0x3a,0x8d,0xeb,0xb4,0x3b,
8480x18,0x67,0x78,0xbb,0xeb,0x1c,0x09,0x06,0x5c,0x5c,0x51,0xb1,0x98,0xfe,0xc0,0xdc,
8490x6d,0xbc,0x77,0xb5,0xd7,0xda,0x2f,0x3d,0x4c,0x08,0xee,0x4f,0xc7,0x8a,0x68,0xde,
8500x94,0x96,0x35,0x7e,0xe0,0xfe,0xb7,0x26,0xff,0x0e,0xc7,0x34,0x7b,0xb8,0x25,0xb1,
8510xe0,0xee,0x9d,0xd7,0x49,0x50,0xf9,0xd0,0xa8,0x07,0xa9,0xc1,0xd8,0xf1,0x33,0x07,
8520x63,0xfe,0x5b,0xc0,0x13,0xda,0x12,0x8e,0x3a,0xcc,0x1e,0x97,0xc1,0xdd,0x8d,0xd1,
8530xf2,0x3e,0xda,0x7c,0x04,0xe4,0xdc,0xef,0x69,0x75,0x72,0x98,0xd9,0x67,0xee,0x3f,
8540x1d,0x66,0x44,0x8a,0x9c,0xf7,0xf2,0xc6,0xa7,0x5c,0xae,0xe4,0x83,0xb7,0xd1,0xc2,
855  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
856  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
857  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
858  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
8590xd0,0xa8,0x87,0xcf,0xe1,0x22,0x8d,0xe7,0xfa,0x26,0x85,0xce,0x6d,0xfa,0x2c,0x8b,
8600xbd,0x75,0xfe,0x64,0x2b,0xab,0x25,0xa1,0x02,0xcc,0x1f,0x93,0xa2,0x4a,0x31,0xd5,
8610x4d,0x3a,0x8e,0xd2,0xb3,0xfd,0x46,0x87,0x3f,0x1f,0xef,0x8a,0x1e,0x7f,0x15,0x4c,
8620x13,0xb1,0x61,0x9b,0xfc,0xa0,0x8b,0x6b,0x22,0x78,0x00,0xd5,0x44,0xc3,0x52,0x60,
863  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
864  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
865  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
866  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
8670xaf,0x2e,0xd9,0xfd,0x18,0xd1,0xb8,0xc2,0x9b,0x33,0x28,0x30,0x01,0xff,0x1c,0xf4,
8680xc6,0xf9,0xc9,0x7c,0xa2,0x9a,0x8f,0xb9,0xd9,0xfa,0xa7,0x24,0x42,0xf3,0x8b,0xff,
8690x18,0x84,0x29,0xdd,0x82,0x73,0xc7,0x64,0xe3,0x37,0xb3,0x52,0xe2,0x14,0xb2,0xbe,
8700x37,0x88,0x25,0xa0,0x3b,0xe6,0xfb,0x94,0x2d,0x41,0x59,0xdb,0x44,0x8b,0x0b,0xa3,
871  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
872  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
873  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
874  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
8750x7c,0x82,0x91,0x60,0xee,0x5d,0x7a,0x63,0x8a,0x2c,0x91,0xe7,0x94,0x02,0x02,0x42,
8760x7d,0x8a,0xba,0x09,0x78,0xa6,0x50,0xd6,0xbe,0x55,0xb5,0x49,0xa1,0xda,0x9d,0x4d,
8770x51,0x1b,0xab,0x9d,0x70,0x47,0x5f,0x86,0x57,0xbb,0xbf,0xee,0x24,0x27,0xc6,0x95,
8780x8b,0xec,0x90,0x9b,0x58,0xc9,0x42,0x43,0xc6,0xb7,0xba,0xf6,0x82,0x11,0xfa,0x8b,
8790x7d,0xf8,0x54,0xc5,0x74,0xf6,0x54,0x1d,0x40,0xe1,0x71,0xc2,0xdd,0x03,0x72,0xdf,
8800x3b,0x77,0xa1,0x1c,0xc7,0xd6,0xb1,0x67,0xb7,0x13,0x6f,0xf4,0x18,0xa4,0x2a,0x82,
8810x98,0xe3,0xe3,0xe1,0x12,0xb3,0x33,0xb1,0xde,0x66,0xff,0x6c,0xd5,0xde,0xdd,0xa6,
8820x26,0xf3,0x44,0x94,0xdb,0x15,0x76,0xcc,0x28,0x33,0x2d,0x4b,0x79,0xdb,0x06,0xbc,
8830x39,0xa2,0xb0,0xf7,0x63,0xc6,0xd4,0xc9,0xc9,0x12,0xc2,0xf3,0x26,0x02,0xe0,0x75,
8840xe4,0x28,0xd2,0x0c,0xad,0xce,0x68,0xf9,0xb3,0xdd,0x4b,0x04,0xbe,0xfd,0x65,0xc1,
8850xfa,0xfe,0x14,0x12,0x7d,0x77,0x0e,0xed,0x99,0xad,0x11,0x5f,0xe6,0xb6,0x52,0xd1,
8860x0d,0xde,0xa2,0x8a,0x55,0x49,0x60,0x76,0xee,0xda,0x21,0x26,0x00,0x54,0x20,0x17,
887  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
888  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
889  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
890  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
891  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
892  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
893  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
894  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
895  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
896  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
897  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
898  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
899  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
900  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
901  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
902  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
9030x27,0xb4,0xc1,0xba,0x5f,0xd4,0x47,0x04,0x1f,0xfe,0x42,0xa5,0xce,0xb5,0x23,0xbe,
9040x42,0xcc,0x59,0x71,0x51,0x13,0x41,0xa4,0x18,0x35,0xcf,0x02,0x0d,0xe1,0xfb,0x43,
9050xc5,0x28,0xed,0xae,0x84,0x27,0xe8,0xdc,0x89,0xe5,0xf6,0xbe,0x16,0x7e,0x57,0xe1,
9060x41,0x82,0xa9,0xf1,0x7c,0x98,0xd7,0x7c,0xe5,0x67,0xc2,0xf9,0x4d,0xb6,0xb0,0x09,
907  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
908  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
909  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
910  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
911  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
912  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
913  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
914  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
915  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
916  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
917  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
918  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
919  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
920  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
921  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
922  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
923  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
924  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
925  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
926  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
927  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
928  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
929  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
930  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
931  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
932  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
933  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
934  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
935  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
936  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
937  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
938  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
939  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
940  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
941  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
942  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
943  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
944  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
945  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
946  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
947  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
948  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
949  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
950  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
951  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
952  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
953  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
954  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
955  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
956  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
957  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
958  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
959  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
960  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
961  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
962  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
963  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
964  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
965  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
966  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
967  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
968  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
969  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
970  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
971  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
972  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
973  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
974  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
975  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
976  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
977  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
978  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
979  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
980  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
981  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
982  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
983  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
984  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
985  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
986  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
987  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
988  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
989  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
990  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
991  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
992  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
993  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
994  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
995  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
996  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
997  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
998  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
999  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1000  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1001  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1002  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1003  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1004  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1005  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1006  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1007  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1008  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1009  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1010  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1011  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1012  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1013  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1014  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1015  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1016  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1017  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1018  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1019  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1020  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1021  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1022  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1023  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1024  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1025  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1026  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1027  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1028  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1029  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1030  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1031  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1032  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1033  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1034  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1035  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1036  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1037  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1038  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1039  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1040  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1041  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1042  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1043  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1044  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1045  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1046  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1047  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1048  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1049  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1050  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1051  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1052  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1053  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1054  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1055  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1056  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1057  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1058  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1059  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1060  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1061  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1062  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1063  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1064  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1065  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1066  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1067  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1068  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1069  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1070  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1071  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1072  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1073  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1074  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1075  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1076  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1077  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1078  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1079  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1080  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1081  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1082  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1083  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1084  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1085  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1086  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1087  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1088  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1089  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1090  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1091  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1092  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1093  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1094  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1095  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1096  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1097  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1098  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1099  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1100  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1101  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1102  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1103  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1104  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1105  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1106  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1107  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1108  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1109  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1110  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1111  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1112  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1113  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1114  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1115  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1116  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1117  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1118  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1119  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1120  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1121  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1122  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1123  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1124  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1125  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1126  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1127  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1128  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1129  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1130  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1131  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1132  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1133  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1134  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1135  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1136  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1137  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1138  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1139  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1140  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1141  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1142  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1143  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1144  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1145  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1146  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1147  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1148  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1149  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1150  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1151  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1152  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1153  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1154  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1155  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1156  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1157  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1158  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1159  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1160  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1161  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1162  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
11630x33,0x8e,0x6f,0x22,0xac,0x01,0x9f,0x7a,0xc7,0xca,0x23,0xc4,0xa4,0x9c,0x07,0xf8,
11640x98,0xc1,0x17,0x4a,0xb2,0xbc,0xcc,0xf4,0x0e,0x2e,0xf6,0x35,0xdd,0xf6,0x29,0x9a,
11650x2f,0x9c,0xe8,0x7c,0x86,0xf0,0x93,0xca,0x1a,0xee,0x10,0x08,0xec,0xe5,0x3a,0x98,
11660x8c,0xd8,0x0d,0x39,0xaa,0x25,0x8d,0xcd,0x5d,0x64,0x7a,0x5f,0x35,0x92,0xb5,0x64,
1167  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1168  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1169  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1170  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1171  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1172  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1173  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1174  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1175  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1176  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1177  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1178  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1179  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1180  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1181  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1182  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1183  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1184  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1185  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1186  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1187  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1188  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1189  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1190  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1191  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1192  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1193  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1194  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1195  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1196  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1197  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1198  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
11990xdd,0xa9,0x15,0x18,0x9d,0x01,0x24,0x9c,0xed,0x7a,0xeb,0x42,0x8b,0x9e,0xf3,0x72,
12000x26,0xc9,0x45,0x18,0xea,0xd2,0x54,0x5f,0xcf,0xed,0xac,0xbc,0xa1,0xd0,0x5f,0x2f,
12010xce,0x15,0x2a,0xc6,0xf1,0xe0,0x69,0x62,0x22,0xc1,0xc0,0xbd,0xfa,0xdc,0x85,0xac,
12020x67,0x47,0xee,0xa2,0x35,0xb3,0xff,0x76,0x57,0x4f,0x30,0x66,0xf8,0xe9,0xe0,0x5b,
1203  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1204  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1205  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1206  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1207  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1208  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1209  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1210  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1211  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1212  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1213  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1214  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1215  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1216  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1217  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1218  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1219  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1220  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1221  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1222  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1223  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1224  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1225  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1226  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1227  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1228  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1229  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1230  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1231  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1232  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1233  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1234  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1235  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1236  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1237  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1238  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1239  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1240  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1241  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1242  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1243  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1244  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1245  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1246  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1247  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1248  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1249  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1250  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1251  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1252  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1253  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1254  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1255  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1256  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1257  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1258  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1259  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1260  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1261  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1262  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1263  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1264  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1265  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1266  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1267  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1268  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1269  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1270  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1271  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1272  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1273  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1274  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1275  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1276  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1277  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1278  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1279  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1280  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1281  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1282  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1283  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1284  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1285  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1286  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1287  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1288  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1289  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1290  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1291  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1292  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1293  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1294  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
12950x0f,0x35,0xa3,0x7c,0xf1,0x75,0xea,0x27,0x36,0x4d,0x4b,0x1a,0x3b,0x24,0xef,0x9d,
12960x4e,0x39,0x7e,0x7b,0x3d,0x42,0x0d,0xc2,0x9f,0x53,0xc7,0xc4,0xdf,0x02,0x5d,0x61,
12970x0c,0xc9,0x2d,0x89,0x63,0xab,0x34,0xfc,0x97,0x1b,0xb5,0x54,0xe6,0x19,0xa5,0x46,
12980xdc,0x9e,0xdc,0x25,0xe4,0x3a,0xfc,0xa7,0x93,0xfc,0x1f,0xec,0xb3,0x92,0x43,0xbc,
1299  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1300  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1301  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1302  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1303  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1304  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1305  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1306  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1307  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1308  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1309  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1310  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1311  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1312  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1313  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1314  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1315  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1316  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1317  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1318  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
13190x5d,0xdd,0xd4,0xbe,0xc0,0xff,0xe1,0x1b,0x3a,0xd6,0x61,0xc8,0x90,0x02,0x23,0x08,
13200xfa,0x7a,0xfa,0x1d,0xab,0x2b,0xa0,0x0b,0x24,0xe1,0x6b,0x9e,0x38,0x6b,0xb2,0xae,
13210xdd,0xfa,0xfc,0xa2,0xb8,0xcb,0xed,0x33,0x66,0x06,0xef,0x72,0x8b,0xe5,0xa3,0x0d,
13220x9b,0x18,0x05,0xce,0x6a,0x69,0x61,0x64,0x74,0x9c,0xf9,0x66,0xec,0x99,0x72,0x95,
1323  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1324  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1325  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1326  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1327  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1328  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1329  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1330  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1331  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1332  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1333  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1334  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1335  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1336  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1337  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1338  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1339  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1340  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1341  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1342  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1343  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1344  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1345  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1346  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1347  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1348  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1349  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1350  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
13510x2c,0xf3,0x0d,0x50,0x30,0x77,0xc2,0x25,0x91,0x83,0x5f,0xac,0xf4,0x56,0x96,0xc8,
13520x70,0x86,0x16,0x5a,0x1b,0xa1,0x7d,0x08,0x53,0x15,0xfd,0x3c,0xcb,0x4d,0xd0,0x70,
13530x5c,0x1d,0x5c,0xaa,0x87,0x60,0x24,0x42,0xcc,0xe0,0x75,0xeb,0xae,0x75,0xcc,0xf1,
13540x81,0x71,0x09,0xc0,0xf8,0x3c,0x55,0xa6,0x71,0x3c,0xd2,0xda,0xfe,0xf8,0x07,0xbc,
13550x33,0x7c,0x08,0x5e,0xb1,0xff,0x68,0x44,0x75,0xc3,0xdf,0x68,0xdf,0x3d,0xba,0x81,
13560x84,0x76,0x06,0x85,0xb4,0xb1,0x7a,0x6d,0xc9,0x4e,0x27,0x38,0x35,0xee,0xe1,0x32,
13570x48,0xd8,0x6b,0x76,0xc4,0x9b,0x65,0xb2,0x22,0xf5,0xf6,0x2a,0xa1,0xf4,0x37,0x00,
13580x12,0x5b,0x65,0xb2,0x65,0x47,0xc5,0xe4,0xf2,0x13,0x55,0x60,0x87,0x78,0x37,0x5b,
1359  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1360  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1361  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1362  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1363  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1364  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1365  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1366  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1367  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1368  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1369  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1370  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1371  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1372  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1373  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1374  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1375  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1376  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1377  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1378  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1379  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1380  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1381  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1382  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
13830xeb,0xd8,0xb6,0x33,0x90,0xbf,0x13,0x7f,0xd8,0x00,0xce,0xe0,0x48,0x79,0x78,0xd7,
13840xd7,0x62,0xa3,0xe7,0x7b,0xe8,0xc9,0x54,0x71,0x18,0xff,0x2b,0x4f,0xff,0x5e,0x82,
13850xca,0x10,0x2c,0x01,0x47,0xc5,0xcc,0xa2,0x22,0x89,0x6b,0xb4,0xc1,0xd6,0x66,0x26,
13860x56,0x9b,0x7c,0x02,0x77,0xe0,0xb8,0x38,0x5f,0xac,0x1b,0x9d,0x00,0x27,0x0c,0x33,
1387  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1388  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1389  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1390  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1391  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1392  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1393  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1394  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1395  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1396  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1397  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1398  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
13990x65,0x19,0xf5,0x62,0x7a,0x92,0xc5,0x4a,0x55,0xcc,0x2f,0xf8,0x6c,0x79,0x34,0x3d,
14000xa4,0x9e,0xd3,0xec,0xe4,0x3a,0xf9,0x99,0x5a,0x28,0x2a,0xa0,0x8a,0x46,0xef,0x69,
14010x1b,0xd7,0xfd,0xeb,0x60,0x26,0x2a,0x6f,0xa7,0x6c,0x0f,0x97,0x44,0xf4,0x7d,0x9e,
14020x5b,0x7d,0xa0,0xe1,0x70,0xe0,0xf3,0x9f,0xb0,0xf3,0xea,0xfd,0xfc,0xac,0x58,0x4d,
14030xb8,0x8a,0xa5,0x8f,0x58,0x30,0xb0,0x38,0xa6,0x53,0x84,0x33,0xd4,0xd7,0xbd,0x26,
14040x45,0x35,0xb7,0xf6,0x1a,0x20,0x7b,0x8d,0x7e,0x68,0x69,0xdb,0xb1,0x1e,0xa5,0x1a,
14050xd5,0xf9,0x42,0x57,0x7a,0xf8,0x30,0x2e,0xea,0x49,0xe5,0xd5,0x34,0x6a,0xcd,0x5b,
14060xfa,0x8e,0x71,0x32,0xfa,0x42,0x69,0xec,0x5d,0x50,0x02,0x42,0xc2,0xe4,0xae,0x5a,
1407  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1408  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1409  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1410  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1411  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1412  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1413  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1414  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
14150x9a,0x8e,0xcf,0x66,0xe0,0xd8,0xd4,0x2a,0x0f,0x4d,0xad,0x64,0x8c,0x6d,0xcb,0x37,
14160x2e,0x0e,0x9f,0xc4,0xca,0xff,0x85,0xf1,0x7f,0xec,0x71,0x69,0xc2,0x81,0x5c,0xe4,
14170x28,0xd2,0x6b,0xa9,0xf6,0xfb,0xe4,0x51,0x68,0x03,0xd0,0xcd,0xc3,0x07,0x6f,0xab,
14180x1c,0x94,0x5f,0x94,0xe6,0x54,0x8b,0x1a,0x3c,0xed,0xd4,0xb0,0xf3,0x26,0x81,0xfa,
1419  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1420  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1421  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1422  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1423  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1424  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1425  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1426  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1427  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1428  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1429  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1430  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1431  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1432  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1433  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1434  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1435  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1436  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1437  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1438  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1439  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1440  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1441  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1442  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1443  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1444  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1445  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1446  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1447  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1448  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1449  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1450  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1451  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1452  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1453  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1454  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1455  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1456  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1457  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1458  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1459  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1460  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1461  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1462  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1463  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1464  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1465  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1466  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1467  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1468  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1469  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1470  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1471  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1472  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1473  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1474  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1475  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1476  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1477  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1478  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1479  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1480  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1481  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1482  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1483  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1484  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1485  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1486  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1487  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1488  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1489  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1490  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1491  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1492  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1493  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1494  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1495  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1496  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1497  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1498  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1499  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1500  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1501  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1502  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1503  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1504  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1505  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1506  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1507  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1508  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1509  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1510  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1511  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1512  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1513  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1514  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1515  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1516  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1517  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1518  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1519  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1520  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1521  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1522  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1523  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1524  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1525  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1526  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1527  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1528  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1529  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1530  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1531  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1532  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1533  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1534  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1535  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1536  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1537  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1538  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1539  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1540  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1541  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1542  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1543  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1544  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1545  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1546  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1547  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1548  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1549  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1550  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1551  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1552  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1553  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1554  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1555  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1556  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1557  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1558  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1559  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1560  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1561  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1562  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1563  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1564  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1565  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1566  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1567  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1568  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1569  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1570  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1571  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1572  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1573  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1574  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1575  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1576  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1577  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1578  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1579  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1580  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1581  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1582  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1583  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1584  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1585  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1586  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1587  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1588  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1589  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1590  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1591  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1592  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1593  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1594  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1595  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1596  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1597  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1598  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1599  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1600  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1601  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1602  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1603  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1604  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1605  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1606  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1607  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1608  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1609  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1610  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1611  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1612  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1613  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1614  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1615  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1616  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1617  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1618  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1619  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1620  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1621  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1622  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1623  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1624  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1625  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1626  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1627  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1628  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1629  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1630  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1631  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1632  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1633  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1634  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1635  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1636  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1637  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1638  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1639  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1640  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1641  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1642  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1643  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1644  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1645  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1646  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1647  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1648  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1649  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1650  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1651  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1652  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1653  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1654  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1655  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1656  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1657  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1658  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1659  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1660  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1661  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1662  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1663  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1664  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1665  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1666  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1667  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1668  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1669  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1670  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1671  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1672  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1673  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
1674  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
7261675 };
7271676
728 static UINT8 calc3_key05[64] = {
729    0x5e,0xd8,0xa6,0xd7,0x00,0x94,0x23,0x66,0xaf,0xea,0xbe,0x45,0x38,0x90,0x8e,0x8d,
730   0x5b,0x14,0x2c,0xda,0x55,0x7e,0x9d,0x08,0x2d,0x31,0xfd,0x3a,0xbe,0x13,0xeb,0x21,
731   0x87,0xee,0xb7,0x7b,0x34,0x15,0x4d,0xd9,0xeb,0x4a,0xde,0xa6,0x57,0xdf,0x53,0x65,
732   0x75,0x1c,0x72,0x3a,0x20,0xe1,0xcd,0xac,0x5d,0x8c,0x6d,0xa9,0x66,0x1d,0x41,0xca,
733};
734
735/* ok - shogwarr */
736static UINT8 calc3_key15[64] = {
737   0x0C,0xEB,0x30,0x25,0xA8,0xED,0xE3,0x23,0xAC,0x2B,0x8D,0x34,0x88,0x9F,0x55,0xB5,
738   0xBF,0x15,0xE3,0x7C,0x54,0xD4,0x72,0xA9,0x7E,0x80,0x27,0x9F,0xA3,0x3F,0xA1,0x4D,
739   0x84,0x1B,0xD1,0xB2,0xB5,0xA7,0x0C,0xA0,0x51,0xE6,0x5E,0xC0,0xEB,0x68,0x22,0xD6,
740   0xC8,0xB6,0xCF,0x46,0x4B,0xF0,0x15,0xD7,0xB0,0xB5,0x29,0xB8,0xFD,0x43,0x5C,0xC0
741};
742
743  static UINT8 calc3_key17[64] = {
744    0x1b,0x48,0xa4,0xdd,0x2e,0x7a,0xe3,0xd1,0x6d,0x9e,0x49,0x31,0xdb,0x13,0xe6,0x00,
745   0xf1,0x8f,0xcb,0x3f,0x23,0xc1,0xf3,0xb4,0x30,0x35,0xf4,0xea,0x2c,0x77,0x65,0x79,
746   0x4e,0x7b,0x0e,0x87,0x79,0x3c,0xd1,0x8f,0x8b,0xa4,0x5a,0x61,0x68,0xac,0x87,0x6b,
747   0xc4,0xc4,0x98,0x36,0xb3,0x75,0x16,0x33,0xf2,0x45,0x84,0xb8,0xf2,0xdb,0xc7,0x46,
748 };
749
750 static UINT8 calc3_key19[64] = {
751   0x30,0x72,0xe0,0xca,0xa4,0xe5,0x41,0x44,0xd4,0xfe,0xe6,0x82,0x3e,0x85,0x18,0x30,
752   0x50,0x17,0x9f,0x77,0xf8,0xcb,0xb0,0xc4,0xed,0x16,0x96,0xca,0xba,0xec,0x22,0xca,
753   0x8f,0x28,0xd3,0x12,0xc6,0x2e,0xc4,0xc3,0x36,0xcf,0x59,0xd8,0x3a,0x6c,0xa7,0x64,
754   0x7f,0x5f,0xa6,0x1b,0x90,0x96,0x19,0x14,0x22,0x81,0x38,0xcd,0x20,0x2f,0x22,0x70,
755};
756
757  static UINT8 calc3_key22[64] = {
758    0xfe,0xf7,0xc7,0x85,0xe4,0xd3,0x93,0xd0,0x36,0x61,0xc8,0x4d,0x0c,0x3e,0x2a,0x1c,
759   0x32,0x1a,0xbf,0x1a,0xb0,0x60,0xb5,0xa8,0x1a,0x19,0x16,0xaf,0x96,0x0d,0x2d,0xe0,
760   0xb1,0x2c,0xb6,0x41,0xe1,0x2d,0xc8,0xe5,0xd9,0x75,0x82,0xfa,0x90,0x3a,0x77,0x09,
761   0x0e,0xe8,0xda,0x7a,0xfb,0xc4,0x68,0x57,0xe8,0xcf,0x18,0x51,0x5b,0xed,0x83,0x08,
762};
763
764  static UINT8 calc3_key24[64] = {
765    0x75,0x49,0x7a,0xd6,0x84,0xbd,0x70,0xbe,0x10,0x19,0x6c,0xb2,0xa9,0x5f,0x6b,0x78,
766   0x14,0x29,0x2a,0x15,0xd0,0x4a,0x10,0x93,0x69,0xb2,0xdf,0x02,0x7f,0x92,0x19,0xbd,
767   0x95,0xc1,0x32,0xee,0x99,0x5e,0x7a,0x55,0x37,0xb7,0xc8,0x45,0xdc,0x6a,0xe6,0xef,
768   0x8b,0xca,0xbe,0xe2,0x63,0x85,0x49,0xd3,0xeb,0x83,0x32,0x9a,0x23,0x11,0x4c,0x7e,
769 };
770
771static UINT8 calc3_key31[64] = {
772    0x02,0x21,0x0f,0xf2,0x98,0xc6,0xa7,0x51,0xbd,0x50,0xe6,0xc6,0x8d,0x15,0xb4,0xc5,
773   0x18,0x99,0x78,0x45,0xeb,0xe4,0x09,0xfa,0x5c,0xa4,0x51,0x4f,0x98,0x02,0xc0,0x24,
774   0x6d,0x44,0x77,0x4b,0xd7,0x26,0x2f,0xc3,0x4c,0xf8,0xee,0xb1,0xc7,0x76,0x68,0x22,
775   0x94,0x6a,0x35,0x82,0xe0,0x02,0xb7,0xda,0xff,0xf2,0xc7,0xcc,0x7b,0x48,0x25,0x4f,
776};
777
778 static UINT8 calc3_key39[64] = {
779   0x7d,0xf8,0x54,0xc5,0x74,0xf6,0x54,0x1d,0x40,0xe1,0x71,0xc2,0xdd,0x03,0x72,0xdf,
780   0x3b,0x77,0xa1,0x1c,0xc7,0xd6,0xb1,0x67,0xb7,0x13,0x6f,0xf4,0x18,0xa4,0x2a,0x82,
781   0x98,0xe3,0xe3,0xe1,0x12,0xb3,0x33,0xb1,0xde,0x66,0xff,0x6c,0xd5,0xde,0xdd,0xa6,
782   0x26,0xf3,0x44,0x94,0xdb,0x15,0x76,0xcc,0x28,0x33,0x2d,0x4b,0x79,0xdb,0x06,0xbc
783};
784
785static UINT8 calc3_key3f[64] = {
786   0x27,0xb4,0xc1,0xba,0x5f,0xd4,0x47,0x04,0x1f,0xfe,0x42,0xa5,0xce,0xb5,0x23,0xbe,
787   0x42,0xcc,0x59,0x71,0x51,0x13,0x41,0xa4,0x18,0x35,0xcf,0x02,0x0d,0xe1,0xfb,0x43,
788   0xc5,0x28,0xed,0xae,0x84,0x27,0xe8,0xdc,0x89,0xe5,0xf6,0xbe,0x16,0x7e,0x57,0xe1,
789   0x41,0x82,0xa9,0xf1,0x7c,0x98,0xd7,0x7c,0xe5,0x67,0xc2,0xf9,0x4d,0xb6,0xb0,0x09,
790};
791
792 static UINT8 calc3_key80[64] = {
793    0x33,0x8e,0x6f,0x22,0xac,0x01,0x9f,0x7a,0xc7,0xca,0x23,0xc4,0xa4,0x9c,0x07,0xf8,
794   0x98,0xc1,0x17,0x4a,0xb2,0xbc,0xcc,0xf4,0x0e,0x2e,0xf6,0x35,0xdd,0xf6,0x29,0x9a,
795   0x2f,0x9c,0xe8,0x7c,0x86,0xf0,0x93,0xca,0x1a,0xee,0x10,0x08,0xec,0xe5,0x3a,0x98,
796   0x8c,0xd8,0x0d,0x39,0xaa,0x25,0x8d,0xcd,0x5d,0x64,0x7a,0x5f,0x35,0x92,0xb5,0x64,
797};
798
799 static UINT8 calc3_key89[64] = {
800    0xdd,0xa9,0x15,0x18,0x9d,0x01,0x24,0x9c,0xed,0x7a,0xeb,0x42,0x8b,0x9e,0xf3,0x72,
801   0x26,0xc9,0x45,0x18,0xea,0xd2,0x54,0x5f,0xcf,0xed,0xac,0xbc,0xa1,0xd0,0x5f,0x2f,
802   0xce,0x15,0x2a,0xc6,0xf1,0xe0,0x69,0x62,0x22,0xc1,0xc0,0xbd,0xfa,0xdc,0x85,0xac,
803   0x67,0x47,0xee,0xa2,0x35,0xb3,0xff,0x76,0x57,0x4f,0x30,0x66,0xf8,0xe9,0xe0,0x5b,
804};
805
806 static UINT8 calc3_keya1[64] = {
807    0x0f,0x35,0xa3,0x7c,0xf1,0x75,0xea,0x27,0x36,0x4d,0x4b,0x1a,0x3b,0x24,0xef,0x9d,
808   0x4e,0x39,0x7e,0x7b,0x3d,0x42,0x0d,0xc2,0x9f,0x53,0xc7,0xc4,0xdf,0x02,0x5d,0x61,
809   0x0c,0xc9,0x2d,0x89,0x63,0xab,0x34,0xfc,0x97,0x1b,0xb5,0x54,0xe6,0x19,0xa5,0x46,
810   0xdc,0x9e,0xdc,0x25,0xe4,0x3a,0xfc,0xa7,0x93,0xfc,0x1f,0xec,0xb3,0x92,0x43,0xbc,
811};
812
813 static UINT8 calc3_keya7[64] = {
814    0x5d,0xdd,0xd4,0xbe,0xc0,0xff,0xe1,0x1b,0x3a,0xd6,0x61,0xc8,0x90,0x02,0x23,0x08,
815   0xfa,0x7a,0xfa,0x1d,0xab,0x2b,0xa0,0x0b,0x24,0xe1,0x6b,0x9e,0x38,0x6b,0xb2,0xae,
816   0xdd,0xfa,0xfc,0xa2,0xb8,0xcb,0xed,0x33,0x66,0x06,0xef,0x72,0x8b,0xe5,0xa3,0x0d,
817   0x9b,0x18,0x05,0xce,0x6a,0x69,0x61,0x64,0x74,0x9c,0xf9,0x66,0xec,0x99,0x72,0x95,
818};
819
820 static UINT8 calc3_keyaf[64] = {
821    0x2c,0xf3,0x0d,0x50,0x30,0x77,0xc2,0x25,0x91,0x83,0x5f,0xac,0xf4,0x56,0x96,0xc8,
822   0x70,0x86,0x16,0x5a,0x1b,0xa1,0x7d,0x08,0x53,0x15,0xfd,0x3c,0xcb,0x4d,0xd0,0x70,
823   0x5c,0x1d,0x5c,0xaa,0x87,0x60,0x24,0x42,0xcc,0xe0,0x75,0xeb,0xae,0x75,0xcc,0xf1,
824   0x81,0x71,0x09,0xc0,0xf8,0x3c,0x55,0xa6,0x71,0x3c,0xd2,0xda,0xfe,0xf8,0x07,0xbc,
825};
826
827static UINT8 calc3_keybc[64] = {
828    0xb8,0x8a,0xa5,0x8f,0x58,0x30,0xb0,0x38,0xa6,0x53,0x84,0x33,0xd4,0xd7,0xbd,0x26,
829   0x45,0x35,0xb7,0xf6,0x1a,0x20,0x7b,0x8d,0x7e,0x68,0x69,0xdb,0xb1,0x1e,0xa5,0x1a,
830   0xd5,0xf9,0x42,0x57,0x7a,0xf8,0x30,0x2e,0xea,0x49,0xe5,0xd5,0x34,0x6a,0xcd,0x5b,
831   0xfa,0x8e,0x71,0x32,0xfa,0x42,0x69,0xec,0x5d,0x50,0x02,0x42,0xc2,0xe4,0xae,0x5a,
832 };
833
834 static UINT8 calc3_keybf[64] = {
835   0x9a,0x8e,0xcf,0x66,0xe0,0xd8,0xd4,0x2a,0x0f,0x4d,0xad,0x64,0x8c,0x6d,0xcb,0x37,
836   0x2e,0x0e,0x9f,0xc4,0xca,0xff,0x85,0xf1,0x7f,0xec,0x71,0x69,0xc2,0x81,0x5c,0xe4,
837   0x28,0xd2,0x6b,0xa9,0xf6,0xfb,0xe4,0x51,0x68,0x03,0xd0,0xcd,0xc3,0x07,0x6f,0xab,
838   0x1c,0x94,0x5f,0x94,0xe6,0x54,0x8b,0x1a,0x3c,0xed,0xd4,0xb0,0xf3,0x26,0x81,0xfa,
839};
840
8411677// global so we can use them in the filename when we save out the data (debug..)
8421678static UINT8 calc3_decryption_key_byte;
843static UINT8 calc3_unknown;
1679static UINT8 calc3_alternateswaps;
8441680static UINT8 calc3_shift;
1681static UINT8 calc3_subtracttype;
8451682static UINT8 calc3_mode;
8461683static UINT8 calc3_blocksize_offset;
8471684static UINT16 calc3_dataend;
r5613r5614
8751712// endian safe? you're having a laugh
8761713int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* dstram, int dstoffset)
8771714{
1715
1716
1717
1718
8781719   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
8791720   UINT8* rom = memory_region(machine,"cpu1");
8801721   UINT8 numregions;
r5613r5614
8821723   int local_counter=0;
8831724   int x;
8841725   int offset = 0;
885   int isbrap = ( !strcmp(machine->gamedrv->name,"brapboysj") || !strcmp(machine->gamedrv->name,"brapboys"));
8861726
8871727   numregions = rom[offset+0];
8881728
r5613r5614
9101750      calc3_database = offset;
9111751      calc3_blocksize_offset =    rom[offset+0]; // location of the 'block length'
9121752      calc3_mode =                rom[offset+1];
913      calc3_unknown =             rom[offset+2];
914      calc3_shift = (calc3_unknown &0xf0)>>4;
915      calc3_unknown &= 0x0f;
1753      calc3_alternateswaps =             rom[offset+2];
1754      calc3_shift = (calc3_alternateswaps &0xf0)>>4;
1755      calc3_subtracttype = (calc3_alternateswaps &0x03);
1756      calc3_alternateswaps &= 0x0c;
1757      calc3_alternateswaps >>=2;
1758
9161759      calc3_decryption_key_byte = rom[offset+3];
9171760
9181761
r5613r5614
9311774#if CALC3_VERBOSE_OUTPUT
9321775      if (inline_table_size)
9331776      {
934         printf("Block %02x Found Base %04x - Inline Encryption (size %02x) - Mode? %02x Shift %01x Unk %01x Key (unused?) %02x Length %04x\n", tabnum, calc3_database, inline_table_size, calc3_shift, calc3_mode, calc3_unknown, calc3_decryption_key_byte, length);
1777         printf("Block %02x Found Base %04x - Inline Encryption (size %02x) - Mode? %02x Shift %01x Subtract Type %01x AltSwaps %01x Key (unused?) %02x Length %04x\n", tabnum, calc3_database, inline_table_size, calc3_shift, calc3_mode, calc3_subtracttype, calc3_alternateswaps, calc3_decryption_key_byte, length);
9351778      }
9361779      else
9371780      {
938         printf("Block %02x Found Base %04x - Mode? %02x Shift %01x Unk %01x Key %02x Length %04x\n", tabnum, calc3_database, calc3_mode, calc3_shift, calc3_unknown, calc3_decryption_key_byte, length);
1781         printf("Block %02x Found Base %04x - Mode? %02x Shift %01x Subtract Type %01x AltSwaps %01x Key %02x Length %04x\n", tabnum, calc3_database, calc3_mode, calc3_shift, calc3_subtracttype, calc3_alternateswaps, calc3_decryption_key_byte, length);
9391782      }
9401783#endif
9411784      // copy + decrypt the table to the specified memory area
r5613r5614
9601803
9611804            if (calc3_mode==0x06)
9621805            {
963               calc3_writeaddress_current = 0x202000;
1806               calc3_writeaddress_current = 0x202000; // this is reasoanble for brapboys, not sure about shogun, needs emulating properly!
1807               //calc3_writeaddress_current = 0x20c000;
9641808            }
9651809            else if (calc3_mode==0x07)
9661810            {
r5613r5614
10031847            for (i=0;i<length;i++)
10041848            {
10051849               UINT8 dat=0;
1006               int extrasign = -1;
10071850
10081851
1009               if (
1010                   (tabnum==0x11 && isbrap) ||
1011                     (tabnum==0x1a && isbrap) ||
1012                   (tabnum==0x21 && isbrap) ||
1013                   (tabnum==0x24 && isbrap) ||
1014                   (tabnum==0x28 && isbrap)
1015                  /*(tabnum==0x40 && !isbrap)*/
1016                  )
1017                     extrasign = 0;
1852               /* special case for Shogun Warriors table 0x40 */
1853               if (calc3_subtracttype==3 && calc3_alternateswaps ==0)
1854               {
1855                  UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)];
1856                  dat = rom[offset+i];
10181857
1019               if ((tabnum==0x25 && isbrap))
1020                  extrasign = 1;
1858                  dat -= inlinet;
10211859
1022
1023
1024               if (extrasign !=-1)
1860                  if (((i%inline_table_size)&1)==0)
1861                  {
1862                     dat -= extra[(i%inline_table_size)>>1];
1863                  }
1864               }
1865               else
10251866               {
10261867                  if ( ((i / inline_table_size)&1)==0)
10271868                  {
r5613r5614
10381879                        UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)];
10391880                        dat = rom[offset+i];
10401881
1041                        if (extrasign==0)
1882                        if (calc3_subtracttype!=0x02)
10421883                        {
10431884                           dat -= inlinet;
10441885                           dat -= extra[(i%inline_table_size)>>1];
r5613r5614
10651906                     {
10661907                        dat = rom[offset+i];
10671908
1068                        if (extrasign==0)
1909                        if (calc3_subtracttype!=0x02)
10691910                        {
10701911                           dat -= extra2[(i%inline_table_size)>>1];
10711912                        }
r5613r5614
10771918                     }
10781919                  }
10791920               }
1080               // the above rule doesn't work for this case... hmm ..
1081               else if (tabnum==0x40 && !isbrap) // fjbuster / shogun warriors japanese character select (what enables this extra?)
1082               {
1083                  UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)];
1084                  dat = rom[offset+i];
1085                  //printf("%02x, ",inlinet);
1086                  dat -= inlinet;
10871921
1088                  // note the original, table is an odd number of words, so we can't just check if i is odd / even because the additional overlay
1089                  // is relative to the start of the original table, and has a size of 0x11 (17) bytes which loop.
1090                  if (((i%inline_table_size)&1)==0)
1091                  {
1092                     dat -= extra[(i%inline_table_size)>>1];
1093                  }
1094               }
1095               else
1096               {
1097                  if (i==1)
1098                     printf("unhandled inline case\n");
1099
1100               }
1101
11021922               if(local_counter>1)
11031923               {
11041924                  if (space)
r5613r5614
11201940         }
11211941         else
11221942         {
1123            UINT8* key = calc3_key00;
1943            INT16* key = calc3_keydata+(calc3_decryption_key_byte*0x40);
11241944
1125            // 0x00 seems to have no 'encryption'
1126            if (calc3_decryption_key_byte == 0x00) key = calc3_key00;
1945            if (key[0] == -1)
1946            {
1947               fatalerror("attempting to use invalid decryption data\n");
1948            }
11271949
1128            // each key seems to relate directly to a 0x40 byte decryption table, only these ones handled so far
1129            if (calc3_decryption_key_byte == 0x01) key = calc3_key01;
1130            if (calc3_decryption_key_byte == 0x04) key = calc3_key04;
1131            if (calc3_decryption_key_byte == 0x05) key = calc3_key05;
1132            if (calc3_decryption_key_byte == 0x15) key = calc3_key15;
1133            if (calc3_decryption_key_byte == 0x17) key = calc3_key17;
1134            if (calc3_decryption_key_byte == 0x19) key = calc3_key19;
1135            if (calc3_decryption_key_byte == 0x22) key = calc3_key22;
1136            if (calc3_decryption_key_byte == 0x24) key = calc3_key24;
1137            if (calc3_decryption_key_byte == 0x31) key = calc3_key31;
1138            if (calc3_decryption_key_byte == 0x39) key = calc3_key39;
1139            if (calc3_decryption_key_byte == 0x3f) key = calc3_key3f;
1140            if (calc3_decryption_key_byte == 0x80) key = calc3_key80;
1141            if (calc3_decryption_key_byte == 0x89) key = calc3_key89;
1142            if (calc3_decryption_key_byte == 0xa1) key = calc3_keya1;
1143            if (calc3_decryption_key_byte == 0xa7) key = calc3_keya7;
1144            if (calc3_decryption_key_byte == 0xaf) key = calc3_keyaf;
1145            if (calc3_decryption_key_byte == 0xbc) key = calc3_keybc;
1146            if (calc3_decryption_key_byte == 0xbf) key = calc3_keybf;
1147
11481950            for (i=0;i<length;i++)
11491951            {
1150
1151
11521952               UINT8 dat = rom[offset+i];
1953               UINT8 keydat = (UINT8)key[i&0x3f];
11531954
1154               if ((tabnum==0x10 && isbrap) ||
1155                   (tabnum==0x13 && isbrap) ||
1156                   (tabnum==0x14 && isbrap) ||
1157                   (tabnum==0x15 && isbrap) ||
1158                   (tabnum==0x16 && isbrap) ||
1159                   (tabnum==0x18 && isbrap) ||
1160                   (tabnum==0x19 && isbrap) ||
1161                   (tabnum==0x1b && isbrap) ||
1162                   (tabnum==0x1c && isbrap) ||
1163                   (tabnum==0x1d && isbrap) ||
1164                   (tabnum==0x1f && isbrap) ||
1165                   (tabnum==0x20 && isbrap) ||
1166                   (tabnum==0x22 && isbrap) ||
1167                   (tabnum==0x23 && isbrap) ||
1168                   (tabnum==0x26 && isbrap) ||
1169                   (tabnum==0x27 && isbrap) ||
1170                   (tabnum==0x2a && isbrap) ||
1171                  (tabnum==0x41 && !isbrap))
11721955               {
1173                  dat -= key[i&0x3f];
1956                  if (calc3_subtracttype==0)
1957                  {
1958                     //dat = dat;
1959                  }
1960                  else if (calc3_subtracttype==1)
1961                  {
1962                     if ((i&1)==1) dat += keydat;
1963                     else dat -= keydat;
1964                  }
1965                  else if (calc3_subtracttype==2)
1966                  {
1967                     if ((i&1)==0) dat += keydat;
1968                     else dat -= keydat;
1969                  }
1970                  else if (calc3_subtracttype==3)
1971                  {
1972                     dat -= keydat;
1973                  }
11741974
1175                  if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift);
1176                  else          dat = shift_bits(dat, calc3_shift);
1177
1975                  if (calc3_alternateswaps == 0)
1976                  {
1977                     if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift);
1978                     else          dat = shift_bits(dat, calc3_shift);
1979                  }
1980                  else if (calc3_alternateswaps==1)
1981                  {
1982                     dat = shift_bits(dat, 8-calc3_shift);
1983                  }
1984                  else if (calc3_alternateswaps==2)
1985                  {
1986                     dat = shift_bits(dat, calc3_shift);
1987                  }
1988                  else if (calc3_alternateswaps==3)
1989                  {
1990                     // same as 0
1991                     if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift);
1992                     else          dat = shift_bits(dat, calc3_shift);
1993                  }
11781994               }
1179               else if ((tabnum==0x17 && isbrap) ||
1180                        (tabnum==0x29 && isbrap) ||
1181                      (tabnum==0x2b && isbrap) ||
1182                      (tabnum==0x2c && isbrap) ||
1183                      (tabnum==0x2d && isbrap))
1184               {
1185                  if ((i&1)==0) dat += key[i&0x3f];
1186                  else dat -= key[i&0x3f];
11871995
1188                  if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift);
1189                  else          dat = shift_bits(dat, calc3_shift);
1190               }
1191               else if ((tabnum==0x1e && isbrap) ||
1192                        (tabnum==0x80 && !isbrap))
1193               {
1194                  // note we've already seen this table, but like many others, it's + instead of - on some bytes..
1195                  if ((i&1)==1) dat += key[i&0x3f];
1196                  else dat -= key[i&0x3f];
1197
1198                  if ((i&1)==0) dat = shift_bits(dat, 8-calc3_shift);
1199                  else          dat = shift_bits(dat, calc3_shift);
1200               }
1201               else if (tabnum==0x12 && isbrap)
1202               {
1203                  // this one doesn't alternate the shifts...  'unknown' is 8
1204                  dat = BITSWAP8(dat, 4,3,2,1,0,7,6,5);
1205               }
1206               else
1207               {
1208                  if (i==1) printf("unhandled non-inline case!\n");
1209                  // plain table case
1210                  dat -= key[i&0x3f];
1211               }
1212
12131996               if(local_counter>1)
12141997               {
12151998                  if (space)
r5613r5614
12772060         {
12782061            sprintf(filename,"data_%s_table_%04x k%02x m%02x u%02x length %04x",
12792062                  machine->gamedrv->name,
1280                  x, calc3_decryption_key_byte, calc3_mode, calc3_unknown, length);
2063                  x, calc3_decryption_key_byte, calc3_mode, calc3_alternateswaps, length);
12812064         }
12822065         else
12832066         {
12842067            sprintf(filename,"data_%s_table_%04x k%02x (use indirect size %02x) m%02x u%02x length %04x",
12852068               machine->gamedrv->name,
1286               x, calc3_decryption_key_byte, calc3_blocksize_offset-3, calc3_mode, calc3_unknown, length);
2069               x, calc3_decryption_key_byte, calc3_blocksize_offset-3, calc3_mode, calc3_alternateswaps, length);
12872070         }
12882071
12892072         fp=fopen(filename, "w+b");
r5613r5614
14312214                  printf("writing back address %08x to %08x %08x\n", calc3_writeaddress_current, commandaddr,write);
14322215#endif
14332216
1434                  //memory_write_byte(space,write+0x200001, data_header[0]); // maybe not.. check first boss brapboysj
2217                  memory_write_byte(space,write+0x200000, data_header[0]);
14352218                  memory_write_byte(space,write+0x200001, data_header[1]);
14362219
14372220                  write=commandaddr+(char)commandunk;
14382221                  memory_write_word(space,write+0x200000, (calc3_writeaddress_current>>16)&0xffff);
14392222                  memory_write_word(space,write+0x200002,  (calc3_writeaddress_current&0xffff));
1440                 
2223
14412224                  calc3_writeaddress_current += ((length+3)&(~1));
14422225               }
14432226
src/mame/machine/seicop.c
r5613r5614
8686   copd2_table_3[copd2_offs/8] = cop_43a;
8787   copd2_table_4[copd2_offs/8] = cop_43c;
8888
89   {
90      FILE *fp;
91      char filename[256];
92      sprintf(filename,"copdat_%s.table2", machine->gamedrv->name);
93      fp=fopen(filename, "w+b");
94      if (fp)
95      {
96         fwrite(copd2_table_2, 0x200/8, 1, fp);
97         fclose(fp);
98      }
99   }
100   {
101      FILE *fp;
102      char filename[256];
103      sprintf(filename,"copdat_%s.table3", machine->gamedrv->name);
104      fp=fopen(filename, "w+b");
105      if (fp)
106      {
107         fwrite(copd2_table_3, 0x200/8, 1, fp);
108         fclose(fp);
109      }
110   }
111   {
112      FILE *fp;
113      char filename[256];
114      sprintf(filename,"copdat_%s.table4", machine->gamedrv->name);
115      fp=fopen(filename, "w+b");
116      if (fp)
117      {
118         fwrite(copd2_table_4, 0x200/8, 1, fp);
119         fclose(fp);
120      }
121   }
89/* Uncommented until actively worked on
90    {
91        FILE *fp;
92        char filename[256];
93        sprintf(filename,"copdat_%s.table2", machine->gamedrv->name);
94        fp=fopen(filename, "w+b");
95        if (fp)
96        {
97            fwrite(copd2_table_2, 0x200/8, 1, fp);
98            fclose(fp);
99        }
100    }
101    {
102        FILE *fp;
103        char filename[256];
104        sprintf(filename,"copdat_%s.table3", machine->gamedrv->name);
105        fp=fopen(filename, "w+b");
106        if (fp)
107        {
108            fwrite(copd2_table_3, 0x200/8, 1, fp);
109            fclose(fp);
110        }
111    }
112    {
113        FILE *fp;
114        char filename[256];
115        sprintf(filename,"copdat_%s.table4", machine->gamedrv->name);
116        fp=fopen(filename, "w+b");
117        if (fp)
118        {
119            fwrite(copd2_table_4, 0x200/8, 1, fp);
120            fclose(fp);
121        }
122    }
123*/
122124
123125}
124126
r5613r5614
127129   copd2_table[copd2_offs] = data;
128130   logerror("mcu_data %04x\n", data);
129131
130   {
131      FILE *fp;
132      char filename[256];
133      sprintf(filename,"copdat_%s.data", machine->gamedrv->name);
134      fp=fopen(filename, "w+b");
135      if (fp)
136      {
137         fwrite(copd2_table, 0x200, 1, fp);
138         fclose(fp);
139      }
140   }
132/* Uncommented until actively worked on
133    {
134        FILE *fp;
135        char filename[256];
136        sprintf(filename,"copdat_%s.data", machine->gamedrv->name);
137        fp=fopen(filename, "w+b");
138        if (fp)
139        {
140            fwrite(copd2_table, 0x200, 1, fp);
141            fclose(fp);
142        }
143    }
144*/
141145}
142146
143147
r5613r5614
12671271        *********************************************************************/
12681272
12691273      case (0x180/2):   { return xy_check; } /*hit protection*/
1270      case (0x182/2):   { if(input_code_pressed(KEYCODE_X)) { return 0; } else { return 3; } } /*---- ---- ---- --xx used bits*/
1271      case (0x184/2):   { if(input_code_pressed(KEYCODE_C)) { return 0; } else { return 3; } } /*---- ---- ---- --xx used bits*/
1274      case (0x182/2):   { if(input_code_pressed(space->machine, KEYCODE_X)) { return 0; } else { return 3; } } /*---- ---- ---- --xx used bits*/
1275      case (0x184/2):   { if(input_code_pressed(space->machine, KEYCODE_C)) { return 0; } else { return 3; } } /*---- ---- ---- --xx used bits*/
12721276
12731277       case (0x1b0/2): return (0xffff); /* bit 15 is branched on a few times in the $1938 area */
12741278      case (0x1b4/2):   return (0xffff); /* read at $1932 and stored in ram before +0x5b0 bit 15 tested */
src/mame/mamedriv.c
r5613r5614
286286   DRIVER( suprheli )   /* bootleg */
287287   DRIVER( stratgyx )   /* GX306 (c) 1981 Konami */
288288   DRIVER( stratgys )   /* GX306 (c) 1981 Stern */
289   DRIVER( strongx )   /* bootleg */
289290   DRIVER( armorcar )   /* (c) 1981 Stern */
290291   DRIVER( armorcar2 )   /* (c) 1981 Stern */
291292   DRIVER( moonwar )   /* (c) 1981 Stern */
r5613r5614
31073108
31083109   /* Namco System 10 */
31093110   DRIVER( mrdrilr2 )   /* 2000.07 Mr Driller 2 (DR21 Ver.A) */
3111   DRIVER( mrdrlr2a )      /* 2000.?? Mr Driller 2 (DR22 Ver.A) */
31103112                  /* 2000.12 Gunbarina */
31113113                  /* 2001.02 Photo Battole */
31123114                  /* 2001.02 Taiko no Tatsujin */
r5613r5614
43374339   DRIVER( naomi2 )
43384340
43394341   DRIVER( hod2bios )   /* 1998.11 The House of the Dead 2 */
4342   DRIVER( hotd2 )      /* 1998.11 The House of the Dead 2 */
43404343   DRIVER( dybbnao )   /* 1998.12 Dynamite Baseball NAOMI */
4344   DRIVER( smlg99 )        /* 1999.?? Super Major League '99 */
43414345   DRIVER( pstone )   /* 1999.02 Power Stone */
43424346                  /* 1999.02 Crazy Taxi */
43434347   DRIVER( zombrvn )   /* 1999.02 Zombie Revenge */
r5613r5614
44144418                  /* 2001.06 Crackin' DJ Part2 */
44154419   DRIVER( wsbbgd )   /* 2001.06 Super Major League */
44164420   DRIVER( spkrbtl )   /* 2001.07 Spikers Battle */
4417                  /* 2001.07 Gun Survivor 2: Bio Hazard Code Veronica */
4421   DRIVER( gunsur2 )   /* 2001.07 Gun Survivor 2: Bio Hazard Code Veronica */
44184422                  /* 2001.07 Dokidoki Idol Star Seeker */
44194423   DRIVER( cvs2gd )   /* 2001.08 Capcom vs. SNK 2 */
44204424   DRIVER( gundmxgd )   /* 2001.09 Kidou Senshi Gundam Renpou vs. Zeon DX */
r5613r5614
45084512                  /* 2001.06 Club Kart */
45094513   DRIVER( beachspi )   /* 2001.07 Beach Spikers */
45104514                  /* 2001.08 Wave Runner GP */
4511   DRIVER( vf4 )      /* 2001.08.02 Virtua Fighter 4 */
4515   DRIVER( vf4cart )        /* 2001.08.02 Virtua Fighter 4 (cartridge) */
4516   DRIVER( vf4 )      /* 2001.08.02 Virtua Fighter 4 (GD-ROM) */
45124517   DRIVER( vf4b )      /* 2001.08.20 Virtua Fighter 4 ver.B */
45134518   DRIVER( vf4c )      /* 2002.01.31 Virtua Fighter 4 ver.C */
45144519                  /* 2002.02 The King of Route 66 */
45154520   DRIVER( initd )      /* 2002.03 Initial D Arcade Stage */
45164521   DRIVER( initdexp )   /* 200?.?? Initial D Export Version */
4522   DRIVER( clubkrte )   /* 2002.?? Club Kart: European Session */
45174523                  /* 2002.06 WCCF SERIE A 2001-2002 */
45184524                  /* 2002.07 Soul Surfer */
45194525   DRIVER( vf4evoa )   /* 2002.08 Virtua Fighter 4 Evolution */
r5613r5614
45464552   DRIVER( sprtshot )   /* 2002.12 Sports Shooting USA */
45474553                  /* 2003.03 Guilty Gear X ver.1.5 */
45484554   DRIVER( demofist )   /* 2003.06 Demolish Fist */
4549                  /* 2003.08 Dolphin Blue */
4550                  /* 2003.12 Guilty Gear Isuka */
4555   DRIVER( dolphin  )   /* 2003.08 Dolphin Blue */
4556   DRIVER( ggisuka )   /* 2003.12 Guilty Gear Isuka */
45514557                  /* 2003.12 Sangoku Senki Shichisei Tensei (IGS) */
4552                  /* 2004.03 The Rumble Fish */
4558   DRIVER( rumblef )    /* 2004.03 The Rumble Fish */
45534559   DRIVER( rangrmsn )   /* 2004.03 Ranger Mission */
45544560                  /* 2004.06 Salary Man Kintarou Net Select */
4555                  /* 2004.07 The King of Fighters Neo Wave */
4561   DRIVER( kofnw )      /* 2004.07 The King of Fighters Neo Wave */
45564562   DRIVER( xtrmhunt )   /* 2004.09 Extreme Hunting */
45574563                  /* 2004.09 Dirty Pig Skin Football */
45584564                  /* 2004.09 Faster than Speed */
4565   DRIVER( kov7sprt )   /* 2004.?? Knights of Valour - The Seven Sprits */
45594566                  /* 2005.03 Net Select Keiba Victory Furlong */
45604567                  /* 2005.03 The Rumble Fish 2 */
4561                  /* 2005.07 NeoGeo Battle Colloseum */
4568   DRIVER( ngbc )      /* 2005.07 NeoGeo Battle Colloseum */
45624569                  /* 2005.09 Samurai Spirits Tenkaichi Kenkakuden */
45634570                  /* 2005.10 The King of Fighters XI */
45644571   DRIVER( fotns )      /* 2005.12 Hokuto no Ken */
r5613r5614
47794786   DRIVER( kchamp )   /* (c) 1984 Data East USA (US) */
47804787   DRIVER( karatedo )   /* (c) 1984 Data East Corporation (Japan) */
47814788   DRIVER( kchampvs )   /* (c) 1984 Data East USA (US) */
4789   DRIVER( kchampvs2 ) /* (c) 1984 Data East USA (US) */
47824790   DRIVER( karatevs )   /* (c) 1984 Data East Corporation (Japan) */
47834791   DRIVER( compgolf )   /* (c) 1985 Data East Corporation (Japan) */
47844792   DRIVER( compgolfo )   /* (c) 1985 Data East Corporation (Japan) */
r5613r5614
50785086   DRIVER( gaiden )   /* 6215 - (c) 1988 Tecmo (US) */
50795087   DRIVER( ryukendn )   /* 6215 - (c) 1989 Tecmo (Japan) */
50805088   DRIVER( ryukendna )   /* 6215 - (c) 1989 Tecmo (Japan) */
5089   DRIVER( mastninj )   /* bootleg */
50815090   DRIVER( wildfang )   /* (c) 1989 Tecmo */
50825091   DRIVER( tknight )   /* (c) 1989 Tecmo */
50835092   DRIVER( stratof )   /* (c) 1991 Tecmo */
r5613r5614
67136722   /* Williams/Midway TMS games */
67146723   DRIVER( narc )      /* (c) 1988 Williams */
67156724   DRIVER( narc3 )      /* (c) 1988 Williams */
6725   DRIVER( narc2 )      /* (c) 1988 Williams */
67166726   DRIVER( trog )      /* (c) 1990 Midway */
67176727   DRIVER( trog4 )      /* (c) 1990 Midway */
67186728   DRIVER( trog3 )      /* (c) 1990 Midway */
r5613r5614
67346744   DRIVER( strkforc )   /* (c) 1991 Midway */
67356745   DRIVER( mk )      /* (c) 1992 Midway */
67366746   DRIVER( mkr4 )      /* (c) 1992 Midway */
6737   DRIVER( mkturbo )   /* bootleg */
6747   DRIVER( mktturbo )   /* hack */
6748   DRIVER( mkyturbo )   /* hack */
67386749   DRIVER( mkprot8 )   /* (c) 1992 Midway */
67396750   DRIVER( mkprot9 )   /* (c) 1992 Midway */
67406751   DRIVER( mkla1 )      /* (c) 1992 Midway */
r5613r5614
75197530   DRIVER( kiwame )   /* (c) 1994 Athena */
75207531   DRIVER( krzybowl )   /* (c) 1994 American Sammy */
75217532   DRIVER( orbs )      /* (c) 1994 American Sammy */
7533   DRIVER( keroppi )   /* (c) 1993 Sammy */
75227534   DRIVER( extdwnhl )   /* (c) 1995 Sammy Japan */
75237535   DRIVER( gundhara )   /* (c) 1995 Banpresto */
75247536   DRIVER( sokonuke )   /* (c) 1995 Sammy Industries */
r5613r5614
89508962   DRIVER( witchcdb )   /* 1991, Unknown */
89518963   DRIVER( witchcdc )   /* 1991, Unknown */
89528964   DRIVER( witchcdd )   /* 1991, Unknown */
8965   DRIVER( witchcde )   /* 1994, Unknown */
8966   DRIVER( witchcdf )   /* (c) 1991 PlayMan */
89538967   DRIVER( sloco93 )   /* 1993, Unknown */
89548968   DRIVER( sloco93a )   /* 1993, Unknown */
89558969   DRIVER( maverik )   /* 198?, Unknown */
r5613r5614
89798993   DRIVER( bsuerteu )   /* 1991, Unknown */
89808994
89818995   /* Cal Omega */
8996   DRIVER( comg074 )   /* (c) 1981 Cal Omega Inc. */
89828997   DRIVER( comg076 )   /* (c) 1981 Cal Omega Inc. */
89838998   DRIVER( comg079 )   /* (c) 1981 Cal Omega Inc. */
89848999   DRIVER( comg080 )   /* (c) 1981 Cal Omega Inc. */
src/mame/includes/nmk16.h
r5613r5614
2828WRITE16_HANDLER( mustang_scroll_w );
2929WRITE16_HANDLER( bioshipbg_scroll_w );
3030WRITE16_HANDLER( vandyke_scroll_w );
31WRITE16_HANDLER( vandykeb_scroll_w );
3132WRITE16_HANDLER( manybloc_scroll_w );
3233
3334VIDEO_START( macross );
src/mame/includes/midyunit.h
r5613r5614
2626DRIVER_INIT( shimpact );
2727DRIVER_INIT( strkforc );
2828DRIVER_INIT( mkyunit );
29DRIVER_INIT( mkyturbo );
2930DRIVER_INIT( mkyawdim );
3031DRIVER_INIT( term2 );
3132DRIVER_INIT( term2la2 );
src/mame/includes/bzone.h
r5613r5614
44
55*************************************************************************/
66
7#define BZONE_DISCRETE      (1)
8
97#define BZONE_MASTER_CLOCK (XTAL_12_096MHz)
108#define BZONE_CLOCK_3KHZ  (MASTER_CLOCK / 4096)
119
r5613r5614
1614
1715/*----------- defined in audio/bzone.c -----------*/
1816
19#if BZONE_DISCRETE
2017
2118WRITE8_DEVICE_HANDLER( bzone_sounds_w );
2219
2320MACHINE_DRIVER_EXTERN( bzone_audio );
24#else
25WRITE8_HANDLER( bzone_sounds_w );
2621
27DEVICE_GET_INFO( bzone_sound );
28#define SOUND_BZONE DEVICE_GET_INFO_NAME(bzone_sound)
29#endif
30
3122/*----------- defined in audio/redbaron.c -----------*/
3223
3324WRITE8_HANDLER( redbaron_sounds_w );
src/mame/includes/deco16ic.h
r5613r5614
5757
5858READ16_HANDLER( deco16_71_r );
5959
60void deco16_print_debug_info(bitmap_t *bitmap);
60void deco16_print_debug_info(running_machine *machine, bitmap_t *bitmap);
src/mame/includes/dc.h
r5613r5614
1313WRITE64_HANDLER( dc_sysctrl_w );
1414READ64_HANDLER( dc_maple_r );
1515WRITE64_HANDLER( dc_maple_w );
16READ64_HANDLER( naomi_maple_r );
17WRITE64_HANDLER( naomi_maple_w );
1618READ64_HANDLER( dc_gdrom_r );
1719WRITE64_HANDLER( dc_gdrom_w );
1820READ64_HANDLER( dc_g1_ctrl_r );
src/mame/mame.mak
r5613r5614
115115CPUS += TMS0980
116116CPUS += I4004
117117CPUS += SUPERFX
118CPUS += Z8
118119
119120
120121#-------------------------------------------------
src/mame/video/nycaptor.c
r5613r5614
199199   x - no bg/sprite pri.
200200*/
201201
202#define mKEY_MASK(x,y) if (input_code_pressed_once(x)){nycaptor_mask|=y;tilemap_mark_all_tiles_dirty( bg_tilemap );}
202#define mKEY_MASK(x,y) if (input_code_pressed_once(machine, x)){nycaptor_mask|=y;tilemap_mark_all_tiles_dirty( bg_tilemap );}
203203
204static void nycaptor_setmask(void)
204static void nycaptor_setmask(running_machine *machine)
205205{
206206  mKEY_MASK(KEYCODE_Q,1); /* bg */
207207  mKEY_MASK(KEYCODE_W,2);
r5613r5614
217217  mKEY_MASK(KEYCODE_J,0x400);
218218  mKEY_MASK(KEYCODE_K,0x800);
219219
220  if (input_code_pressed_once(KEYCODE_Z)){nycaptor_mask=0;tilemap_mark_all_tiles_dirty( bg_tilemap );} /* disable */
221  if (input_code_pressed_once(KEYCODE_X)){nycaptor_mask|=0x1000;tilemap_mark_all_tiles_dirty( bg_tilemap );} /* no layers */
220  if (input_code_pressed_once(machine, KEYCODE_Z)){nycaptor_mask=0;tilemap_mark_all_tiles_dirty( bg_tilemap );} /* disable */
221  if (input_code_pressed_once(machine, KEYCODE_X)){nycaptor_mask|=0x1000;tilemap_mark_all_tiles_dirty( bg_tilemap );} /* no layers */
222222}
223223#endif
224224
225225VIDEO_UPDATE( nycaptor )
226226{
227227#if NYCAPTOR_DEBUG
228  nycaptor_setmask();
228  nycaptor_setmask(screen->machine);
229229  if(nycaptor_mask&0x1000)
230230  {
231231        tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|3,0);
src/mame/video/deco_mlc.c
r5613r5614
3232}
3333
3434#ifdef UNUSED_FUNCTION
35static void blitRaster(bitmap_t *bitmap, int rasterMode)
35static void blitRaster(running_machine *machine, bitmap_t *bitmap, int rasterMode)
3636{
3737   int x,y;
3838   for (y=0; y<256; y++) //todo
r5613r5614
4141      UINT32* dst=BITMAP_ADDR32(bitmap, y, 0);
4242      UINT32 xptr=(mlc_raster_table[0][y]<<13);
4343
44      if (input_code_pressed(KEYCODE_X))
44      if (input_code_pressed(machine, KEYCODE_X))
4545         xptr=0;
4646
4747      for (x=0; x<320; x++)
r5613r5614
4949         if (src[x])
5050            dst[x]=src[(xptr>>16)&0x1ff];
5151
52         //if (input_code_pressed(KEYCODE_X))
52         //if (input_code_pressed(machine, KEYCODE_X))
5353         //  xptr+=0x10000;
5454         //else if(rasterHackTest[0][y]<0)
5555            xptr+=0x10000 - ((mlc_raster_table[2][y]&0x3ff)<<5);
r5613r5614
499499
500500//      if (lastRasterMode!=0 && rasterDirty)
501501//      {
502//          blitRaster(bitmap, rasterMode);
502//          blitRaster(machine, bitmap, rasterMode);
503503//          bitmap_fill(temp_bitmap,cliprect,0);
504504//          rasterDirty=0;
505505//      }
src/mame/video/midyunit.c
r5613r5614
455455
456456if (LOG_DMA)
457457{
458   if (input_code_pressed(KEYCODE_L))
458   if (input_code_pressed(space->machine, KEYCODE_L))
459459   {
460460      logerror("----\n");
461461      logerror("DMA command %04X: (xflip=%d yflip=%d)\n",
src/mame/video/stvvdp1.c
r5613r5614
19971997   int framebufer_changed = 0;
19981998
19991999//  int enable;
2000//  if (input_code_pressed (KEYCODE_R)) vdp1_sprite_log = 1;
2001//  if (input_code_pressed (KEYCODE_T)) vdp1_sprite_log = 0;
2000//  if (input_code_pressed (machine, KEYCODE_R)) vdp1_sprite_log = 1;
2001//  if (input_code_pressed (machine, KEYCODE_T)) vdp1_sprite_log = 0;
20022002
2003//  if (input_code_pressed (KEYCODE_Y)) vdp1_sprite_log = 0;
2003//  if (input_code_pressed (machine, KEYCODE_Y)) vdp1_sprite_log = 0;
20042004//  {
20052005//      FILE *fp;
20062006//
src/mame/video/twincobr.c
r5613r5614
404404
405405
406406
407#ifdef MAME_DEBUG
408static void twincobr_log_vram(void)
407static void twincobr_log_vram(running_machine *machine)
409408{
410   if ( input_code_pressed(KEYCODE_M) )
409#ifdef MAME_DEBUG
410   if ( input_code_pressed(machine, KEYCODE_M) )
411411   {
412412      offs_t tile_voffs;
413413      int tcode[4];
414      while (input_code_pressed(KEYCODE_M)) ;
414      while (input_code_pressed(machine, KEYCODE_M)) ;
415415      logerror("Scrolls             BG-X BG-Y  FG-X FG-Y  TX-X  TX-Y\n");
416416      logerror("------>             %04x %04x  %04x %04x  %04x  %04x\n",bgscrollx,bgscrolly,fgscrollx,fgscrolly,txscrollx,txscrolly);
417417      for ( tile_voffs = 0; tile_voffs < (twincobr_txvideoram_size/2); tile_voffs++ )
r5613r5614
439439                     tcode[1] & 0xf000 >> 12, tcode[1] & 0x0fff);
440440      }
441441   }
442}
443442#endif
443}
444444
445445
446446/***************************************************************************
r5613r5614
486486
487487VIDEO_UPDATE( toaplan0 )
488488{
489#ifdef MAME_DEBUG
490   twincobr_log_vram();
491#endif
489   twincobr_log_vram(screen->machine);
492490
493491   if (wardner_sprite_hack) wardner_sprite_priority_hack();
494492
src/mame/video/bking.c
r5613r5614
186186
187187   palette_bank = (data >> 1) & 0x03;
188188
189   sound_global_enable(~data & 0x08);
189   sound_global_enable(space->machine, ~data & 0x08);
190190}
191191
192192
src/mame/video/galpani2.c
r5613r5614
152152   int layers_ctrl = -1;
153153
154154#ifdef MAME_DEBUG
155if (input_code_pressed(KEYCODE_Z))
155if (input_code_pressed(screen->machine, KEYCODE_Z))
156156{   int msk = 0;
157   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
158   if (input_code_pressed(KEYCODE_W))   msk |= 2;
159   if (input_code_pressed(KEYCODE_E))   msk |= 4;
160   if (input_code_pressed(KEYCODE_A))   msk |= 8;
157   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
158   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
159   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 4;
160   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
161161   if (msk != 0) layers_ctrl &= msk;   }
162162#endif
163163
src/mame/video/midtunit.c
r5613r5614
719719
720720if (LOG_DMA)
721721{
722   if (input_code_pressed(KEYCODE_L))
722   if (input_code_pressed(space->machine, KEYCODE_L))
723723   {
724724      logerror("DMA command %04X: (bpp=%d skip=%d xflip=%d yflip=%d preskip=%d postskip=%d)\n",
725725            command, (command >> 12) & 7, (command >> 7) & 1, (command >> 4) & 1, (command >> 5) & 1, (command >> 8) & 3, (command >> 10) & 3);
src/mame/video/powerins.c
r5613r5614
352352   tilemap_set_scrolly( tilemap_1, 0,  0x00);
353353
354354#ifdef MAME_DEBUG
355if (input_code_pressed(KEYCODE_Z))
355if (input_code_pressed(screen->machine, KEYCODE_Z))
356356{
357357   int msk = 0;
358358
359   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
360   if (input_code_pressed(KEYCODE_W))   msk |= 2;
361//  if (input_code_pressed(KEYCODE_E))    msk |= 4;
362   if (input_code_pressed(KEYCODE_A))   msk |= 8;
359   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
360   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
361//  if (input_code_pressed(screen->machine, KEYCODE_E))    msk |= 4;
362   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
363363   if (msk != 0) layers_ctrl &= msk;
364364}
365365#endif
src/mame/video/stvvdp2.c
r5613r5614
21632163
21642164#define mul_fixed32( a, b ) mul_32x32_shift( a, b, 16 )
21652165
2166static void stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter )
2166static void stv_vdp2_fill_rotation_parameter_table( running_machine *machine, UINT8 rot_parameter )
21672167{
21682168   UINT32 address;
21692169
r5613r5614
22222222   /*Attempt to show on screen the rotation table*/
22232223   if(LOG_ROZ == 2)
22242224   {
2225      if(input_code_pressed_once(JOYCODE_Y_UP_SWITCH))
2225      if(input_code_pressed_once(machine, JOYCODE_Y_UP_SWITCH))
22262226         debug.roz++;
22272227
2228      if(input_code_pressed_once(JOYCODE_Y_DOWN_SWITCH))
2228      if(input_code_pressed_once(machine, JOYCODE_Y_DOWN_SWITCH))
22292229         debug.roz--;
22302230
22312231      if(debug.roz > 10)
r5613r5614
47524752static void stv_vdp2_draw_rotation_screen(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int iRP)
47534753{
47544754   rectangle roz_clip_rect, mycliprect;
4755   int planesizex = 0, planesizey = 0, planerenderedsizex, planerenderedsizey;
4755   int planesizex = 0, planesizey = 0;
4756   int planerenderedsizex, planerenderedsizey;
47564757   UINT8 colour_calculation_enabled;
47574758   UINT8 window_control;
47584759   UINT8 fade_control;
r5613r5614
48004801      stv2_current_tilemap.map_count = 16;
48014802   }
48024803
4803   stv_vdp2_fill_rotation_parameter_table(iRP);
4804   stv_vdp2_fill_rotation_parameter_table(machine, iRP);
48044805
48054806   if ( iRP == 1 )
48064807   {
r5613r5614
62266227   stv_vdp2_draw_back(screen->machine, bitmap,cliprect);
62276228
62286229   #if DEBUG_MODE
6229   if(input_code_pressed_once(KEYCODE_T))
6230   if(input_code_pressed_once(screen->machine, KEYCODE_T))
62306231   {
62316232      debug.l_en^=1;
62326233      popmessage("NBG3 %sabled",debug.l_en & 1 ? "en" : "dis");
62336234   }
6234   if(input_code_pressed_once(KEYCODE_Y))
6235   if(input_code_pressed_once(screen->machine, KEYCODE_Y))
62356236   {
62366237      debug.l_en^=2;
62376238      popmessage("NBG2 %sabled",debug.l_en & 2 ? "en" : "dis");
62386239   }
6239   if(input_code_pressed_once(KEYCODE_U))
6240   if(input_code_pressed_once(screen->machine, KEYCODE_U))
62406241   {
62416242      debug.l_en^=4;
62426243      popmessage("NBG1 %sabled",debug.l_en & 4 ? "en" : "dis");
62436244   }
6244   if(input_code_pressed_once(KEYCODE_I))
6245   if(input_code_pressed_once(screen->machine, KEYCODE_I))
62456246   {
62466247      debug.l_en^=8;
62476248      popmessage("NBG0 %sabled",debug.l_en & 8 ? "en" : "dis");
62486249   }
6249   if(input_code_pressed_once(KEYCODE_K))
6250   if(input_code_pressed_once(screen->machine, KEYCODE_K))
62506251   {
62516252      debug.l_en^=0x10;
62526253      popmessage("RBG0 %sabled",debug.l_en & 0x10 ? "en" : "dis");
62536254   }
6254   if(input_code_pressed_once(KEYCODE_O))
6255   if(input_code_pressed_once(screen->machine, KEYCODE_O))
62556256   {
62566257      debug.l_en^=0x20;
62576258      popmessage("SPRITE %sabled",debug.l_en & 0x20 ? "en" : "dis");
r5613r5614
62946295    ,STV_VDP2_N1ZMXI,STV_VDP2_N1ZMXD
62956296    ,STV_VDP2_N1ZMYI,STV_VDP2_N1ZMYD);*/
62966297
6297   if ( input_code_pressed_once(KEYCODE_W) )
6298   if ( input_code_pressed_once(screen->machine, KEYCODE_W) )
62986299   {
62996300      int tilecode;
63006301
r5613r5614
63386339      }
63396340   }
63406341
6341   if ( input_code_pressed_once(KEYCODE_N) )
6342   if ( input_code_pressed_once(screen->machine, KEYCODE_N) )
63426343   {
63436344      FILE *fp;
63446345
r5613r5614
63506351      }
63516352   }
63526353
6353   if ( input_code_pressed_once(KEYCODE_M) )
6354   if ( input_code_pressed_once(screen->machine, KEYCODE_M) )
63546355   {
63556356      FILE *fp;
63566357
src/mame/video/dynax.c
r5613r5614
10531053   hanamai_priority = BITSWAP8(data, 3,2,1,0, 4,7,5,6);
10541054}
10551055
1056static int debug_mask(void)
1056static int debug_mask(running_machine *machine)
10571057{
10581058#ifdef MAME_DEBUG
10591059   int msk = 0;
1060   if (input_code_pressed(KEYCODE_Z))
1060   if (input_code_pressed(machine, KEYCODE_Z))
10611061   {
1062      if (input_code_pressed(KEYCODE_Q))   msk |= 0x01;   // layer 0
1063      if (input_code_pressed(KEYCODE_W))   msk |= 0x02;   // layer 1
1064      if (input_code_pressed(KEYCODE_E))   msk |= 0x04;   // layer 2
1065      if (input_code_pressed(KEYCODE_R))   msk |= 0x08;   // layer 3
1066      if (input_code_pressed(KEYCODE_A))   msk |= 0x10;   // layer 4
1067      if (input_code_pressed(KEYCODE_S))   msk |= 0x20;   // layer 5
1068      if (input_code_pressed(KEYCODE_D))   msk |= 0x40;   // layer 6
1069      if (input_code_pressed(KEYCODE_F))   msk |= 0x80;   // layer 7
1062      if (input_code_pressed(machine, KEYCODE_Q))   msk |= 0x01;   // layer 0
1063      if (input_code_pressed(machine, KEYCODE_W))   msk |= 0x02;   // layer 1
1064      if (input_code_pressed(machine, KEYCODE_E))   msk |= 0x04;   // layer 2
1065      if (input_code_pressed(machine, KEYCODE_R))   msk |= 0x08;   // layer 3
1066      if (input_code_pressed(machine, KEYCODE_A))   msk |= 0x10;   // layer 4
1067      if (input_code_pressed(machine, KEYCODE_S))   msk |= 0x20;   // layer 5
1068      if (input_code_pressed(machine, KEYCODE_D))   msk |= 0x40;   // layer 6
1069      if (input_code_pressed(machine, KEYCODE_F))   msk |= 0x80;   // layer 7
10701070      if (msk != 0)   return msk;
10711071   }
10721072#endif
r5613r5614
10831083{
10841084#ifdef MAME_DEBUG
10851085   static int toggle;
1086   if (input_code_pressed_once(KEYCODE_T))   toggle = 1-toggle;
1086   if (input_code_pressed_once(machine, KEYCODE_T))   toggle = 1-toggle;
10871087   if (toggle)   {
10881088      UINT8 *RAM   =   memory_region( machine, "gfx1" );
10891089      size_t size      =   memory_region_length( machine, "gfx1" );
10901090      static int i = 0, c = 0, r = 0;
10911091
1092      if (input_code_pressed_once(KEYCODE_I))   c = (c-1) & 0x1f;
1093      if (input_code_pressed_once(KEYCODE_O))   c = (c+1) & 0x1f;
1094      if (input_code_pressed_once(KEYCODE_R))   { r = (r+1) & 0x7;   i = size/8 * r; }
1095      if (input_code_pressed(KEYCODE_M) | input_code_pressed_once(KEYCODE_K))   {
1092      if (input_code_pressed_once(machine, KEYCODE_I))   c = (c-1) & 0x1f;
1093      if (input_code_pressed_once(machine, KEYCODE_O))   c = (c+1) & 0x1f;
1094      if (input_code_pressed_once(machine, KEYCODE_R))   { r = (r+1) & 0x7;   i = size/8 * r; }
1095      if (input_code_pressed(machine, KEYCODE_M) | input_code_pressed_once(machine, KEYCODE_K))   {
10961096         while( i < size && RAM[i] ) i++;      while( i < size && !RAM[i] ) i++;   }
1097      if (input_code_pressed(KEYCODE_N) | input_code_pressed_once(KEYCODE_J))   {
1097      if (input_code_pressed(machine, KEYCODE_N) | input_code_pressed_once(machine, KEYCODE_J))   {
10981098         if (i >= 2) i-=2;   while( i > 0 && RAM[i] ) i--;   i++;   }
10991099
11001100      dynax_blit_palettes = (c & 0xf) * 0x111;
r5613r5614
11241124   int lay[4];
11251125
11261126   if (debug_viewer(screen->machine,bitmap,cliprect))   return 0;
1127   layers_ctrl &= debug_mask();
1127   layers_ctrl &= debug_mask(screen->machine);
11281128
11291129   bitmap_fill(bitmap, cliprect,
11301130      (dynax_blit_backpen & 0xff) + (dynax_blit_palbank & 1) * 256);
r5613r5614
11581158   int pri;
11591159
11601160   if (debug_viewer(screen->machine,bitmap,cliprect))   return 0;
1161   layers_ctrl &= debug_mask();
1161   layers_ctrl &= debug_mask(screen->machine);
11621162
11631163   bitmap_fill(bitmap, cliprect,
11641164      (dynax_blit_backpen & 0xff) + (dynax_blit_palbank & 0x0f) * 256);
r5613r5614
11911191   int layers_ctrl = ~dynax_layer_enable;
11921192
11931193   if (debug_viewer(screen->machine,bitmap,cliprect))   return 0;
1194   layers_ctrl &= debug_mask();
1194   layers_ctrl &= debug_mask(screen->machine);
11951195
11961196   bitmap_fill(bitmap, cliprect,
11971197      (dynax_blit_backpen & 0xff) + (dynax_blit_palbank & 1) * 256);
r5613r5614
12101210   const device_config *bottom_screen = devtag_get_device(screen->machine, "bottom");
12111211
12121212   if (debug_viewer(screen->machine,bitmap,cliprect))   return 0;
1213   layers_ctrl &= debug_mask();
1213   layers_ctrl &= debug_mask(screen->machine);
12141214
12151215   bitmap_fill(bitmap, cliprect,
12161216      (dynax_blit_backpen & 0xff) + (dynax_blit_palbank & 1) * 256);
r5613r5614
12391239   int layers_ctrl = ~dynax_layer_enable;
12401240
12411241   if (debug_viewer(screen->machine,bitmap,cliprect))   return 0;
1242   layers_ctrl &= debug_mask();
1242   layers_ctrl &= debug_mask(screen->machine);
12431243
12441244   bitmap_fill(bitmap, cliprect,
12451245      (dynax_blit_backpen & 0xff) + (dynax_blit_palbank & 1) * 256);
src/mame/video/paradise.c
r5613r5614
228228   int layers_ctrl = -1;
229229
230230#ifdef MAME_DEBUG
231if (input_code_pressed(KEYCODE_Z))
231if (input_code_pressed(screen->machine, KEYCODE_Z))
232232{
233233   int mask = 0;
234   if (input_code_pressed(KEYCODE_Q))   mask |= 1;
235   if (input_code_pressed(KEYCODE_W))   mask |= 2;
236   if (input_code_pressed(KEYCODE_E))   mask |= 4;
237   if (input_code_pressed(KEYCODE_R))   mask |= 8;
238   if (input_code_pressed(KEYCODE_A))   mask |= 16;
234   if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 1;
235   if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 2;
236   if (input_code_pressed(screen->machine, KEYCODE_E))   mask |= 4;
237   if (input_code_pressed(screen->machine, KEYCODE_R))   mask |= 8;
238   if (input_code_pressed(screen->machine, KEYCODE_A))   mask |= 16;
239239   if (mask != 0) layers_ctrl &= mask;
240240}
241241#endif
src/mame/video/itech32.c
r5613r5614
405405 *
406406 *************************************/
407407
408static void logblit(const char *tag)
408static void logblit(running_machine *machine, const char *tag)
409409{
410   if (!input_code_pressed(KEYCODE_L))
410   if (!input_code_pressed(machine, KEYCODE_L))
411411      return;
412412   if (is_drivedge && VIDEO_TRANSFER_FLAGS == 0x5490)
413413   {
r5613r5614
12031203      /* command 1: blit raw data */
12041204      case 1:
12051205         profiler_mark_start(PROFILER_USER1);
1206         if (BLIT_LOGGING) logblit("Blit Raw");
1206         if (BLIT_LOGGING) logblit(machine, "Blit Raw");
12071207
12081208         if (is_drivedge)
12091209         {
r5613r5614
12211221      /* command 2: blit RLE-compressed data */
12221222      case 2:
12231223         profiler_mark_start(PROFILER_USER2);
1224         if (BLIT_LOGGING) logblit("Blit RLE");
1224         if (BLIT_LOGGING) logblit(machine, "Blit RLE");
12251225
12261226         if (enable_latch[0]) draw_rle(videoplane[0], color_latch[0]);
12271227         if (enable_latch[1]) draw_rle(videoplane[1], color_latch[1]);
r5613r5614
12311231
12321232      /* command 3: set up raw data transfer */
12331233      case 3:
1234         if (BLIT_LOGGING) logblit("Raw Xfer");
1234         if (BLIT_LOGGING) logblit(machine, "Raw Xfer");
12351235         xfer_xcount = VIDEO_TRANSFER_WIDTH;
12361236         xfer_ycount = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT);
12371237         xfer_xcur = VIDEO_TRANSFER_X & 0xfff;
r5613r5614
12491249      /* command 6: perform shift register copy */
12501250      case 6:
12511251         profiler_mark_start(PROFILER_USER3);
1252         if (BLIT_LOGGING) logblit("ShiftReg");
1252         if (BLIT_LOGGING) logblit(machine, "ShiftReg");
12531253
12541254         if (is_drivedge)
12551255         {
src/mame/video/fitfight.c
r5613r5614
116116   if (vblank > 0)
117117      bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
118118   else {
119//      if (input_code_pressed(KEYCODE_Q))
119//      if (input_code_pressed(screen->machine, KEYCODE_Q))
120120//          scrollbak = ((fof_a00000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x0038) >> 3);
121//      else if (input_code_pressed(KEYCODE_W))
121//      else if (input_code_pressed(screen->machine, KEYCODE_W))
122122//          scrollbak = ((fof_a00000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x01c0) >> 6);
123//      else if (input_code_pressed(KEYCODE_E))
123//      else if (input_code_pressed(screen->machine, KEYCODE_E))
124124//          scrollbak = ((fof_a00000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x01c0) >> 6);
125//      else if (input_code_pressed(KEYCODE_R))
125//      else if (input_code_pressed(screen->machine, KEYCODE_R))
126126//          scrollbak = ((fof_a00000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x0038) >> 3);
127127//      else
128128         scrollbak = ((fof_a00000[0]&0xff00) >> 5);
r5613r5614
132132
133133      draw_sprites(screen->machine,bitmap,cliprect,0);
134134
135//      if (input_code_pressed(KEYCODE_A))
135//      if (input_code_pressed(screen->machine, KEYCODE_A))
136136//          scrollmid = ((fof_900000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x01c0) >> 6);
137//      else if (input_code_pressed(KEYCODE_S))
137//      else if (input_code_pressed(screen->machine, KEYCODE_S))
138138//          scrollmid = ((fof_900000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x0038) >> 3);
139//      else if (input_code_pressed(KEYCODE_D))
139//      else if (input_code_pressed(screen->machine, KEYCODE_D))
140140//          scrollmid = ((fof_900000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x0038) >> 3);
141//      else if (input_code_pressed(KEYCODE_F))
141//      else if (input_code_pressed(screen->machine, KEYCODE_F))
142142//          scrollmid = ((fof_900000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x01c0) >> 6);
143143//      else
144144         scrollmid = ((fof_900000[0]&0xff00) >> 5);
145145      tilemap_set_scrollx(fof_mid_tilemap,0, scrollmid );
146146      tilemap_set_scrolly(fof_mid_tilemap,0, fof_900000[0]&0xff);
147//      if (!input_code_pressed(KEYCODE_F))
147//      if (!input_code_pressed(screen->machine, KEYCODE_F))
148148         tilemap_draw(bitmap,cliprect,fof_mid_tilemap,0,0);
149149
150150      draw_sprites(screen->machine,bitmap,cliprect,1);
src/mame/video/undrfire.c
r5613r5614
370370#endif
371371
372372#ifdef MAME_DEBUG
373   if (input_code_pressed_once (KEYCODE_X))
373   if (input_code_pressed_once (screen->machine, KEYCODE_X))
374374   {
375375      dislayer[5] ^= 1;
376376      popmessage("piv text: %01x",dislayer[5]);
377377   }
378   if (input_code_pressed_once (KEYCODE_C))
378   if (input_code_pressed_once (screen->machine, KEYCODE_C))
379379   {
380380      dislayer[0] ^= 1;
381381      popmessage("bg0: %01x",dislayer[0]);
382382   }
383383
384   if (input_code_pressed_once (KEYCODE_V))
384   if (input_code_pressed_once (screen->machine, KEYCODE_V))
385385   {
386386      dislayer[1] ^= 1;
387387      popmessage("bg1: %01x",dislayer[1]);
388388   }
389389
390   if (input_code_pressed_once (KEYCODE_B))
390   if (input_code_pressed_once (screen->machine, KEYCODE_B))
391391   {
392392      dislayer[2] ^= 1;
393393      popmessage("bg2: %01x",dislayer[2]);
394394   }
395395
396   if (input_code_pressed_once (KEYCODE_N))
396   if (input_code_pressed_once (screen->machine, KEYCODE_N))
397397   {
398398      dislayer[3] ^= 1;
399399      popmessage("bg3: %01x",dislayer[3]);
400400   }
401401
402   if (input_code_pressed_once (KEYCODE_M))
402   if (input_code_pressed_once (screen->machine, KEYCODE_M))
403403   {
404404      dislayer[4] ^= 1;
405405      popmessage("sprites: %01x",dislayer[4]);
r5613r5614
514514#endif
515515
516516#ifdef MAME_DEBUG
517   if (input_code_pressed_once (KEYCODE_X))
517   if (input_code_pressed_once (screen->machine, KEYCODE_X))
518518   {
519519      dislayer[5] ^= 1;
520520      popmessage("piv text: %01x",dislayer[5]);
521521   }
522   if (input_code_pressed_once (KEYCODE_C))
522   if (input_code_pressed_once (screen->machine, KEYCODE_C))
523523   {
524524      dislayer[0] ^= 1;
525525      popmessage("bg0: %01x",dislayer[0]);
526526   }
527527
528   if (input_code_pressed_once (KEYCODE_V))
528   if (input_code_pressed_once (screen->machine, KEYCODE_V))
529529   {
530530      dislayer[1] ^= 1;
531531      popmessage("bg1: %01x",dislayer[1]);
532532   }
533533
534   if (input_code_pressed_once (KEYCODE_B))
534   if (input_code_pressed_once (screen->machine, KEYCODE_B))
535535   {
536536      dislayer[2] ^= 1;
537537      popmessage("bg2: %01x",dislayer[2]);
538538   }
539539
540   if (input_code_pressed_once (KEYCODE_N))
540   if (input_code_pressed_once (screen->machine, KEYCODE_N))
541541   {
542542      dislayer[3] ^= 1;
543543      popmessage("bg3: %01x",dislayer[3]);
544544   }
545545
546   if (input_code_pressed_once (KEYCODE_M))
546   if (input_code_pressed_once (screen->machine, KEYCODE_M))
547547   {
548548      dislayer[4] ^= 1;
549549      popmessage("sprites: %01x",dislayer[4]);
src/mame/video/amiga.c
r5613r5614
962962#if GUESS_COPPER_OFFSET
963963   if (video_screen_get_frame_number(machine->primary_screen) % 64 == 0 && scanline == 0)
964964   {
965      if (input_code_pressed(KEYCODE_Q))
965      if (input_code_pressed(machine, KEYCODE_Q))
966966         popmessage("%d", wait_offset -= 1);
967      if (input_code_pressed(KEYCODE_W))
967      if (input_code_pressed(machine, KEYCODE_W))
968968         popmessage("%d", wait_offset += 1);
969969   }
970970#endif
src/mame/video/midzeus.c
r5613r5614
8989static void zeus_register_update(running_machine *machine, offs_t offset);
9090static int zeus_fifo_process(running_machine *machine, const UINT32 *data, int numwords);
9191static void zeus_draw_model(running_machine *machine, UINT32 texdata, int logit);
92static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texdata, int logit);
92static void zeus_draw_quad(running_machine *machine, const UINT32 *databuffer, UINT32 texdata, int logit);
9393
9494static void render_poly_4bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
9595static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
r5613r5614
314314   poly_wait(poly, "VIDEO_UPDATE");
315315
316316   /* normal update case */
317   if (!input_code_pressed(KEYCODE_W))
317   if (!input_code_pressed(screen->machine, KEYCODE_W))
318318   {
319319      const void *base = waveram1_ptr_from_expanded_addr(zeusbase[0xcc]);
320320      int xoffs = video_screen_get_visible_area(screen)->min_x;
r5613r5614
333333      static int width = 256;
334334      const void *base;
335335
336      if (input_code_pressed(KEYCODE_DOWN)) yoffs += input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
337      if (input_code_pressed(KEYCODE_UP)) yoffs -= input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
338      if (input_code_pressed(KEYCODE_LEFT) && width > 4) { width >>= 1; while (input_code_pressed(KEYCODE_LEFT)) ; }
339      if (input_code_pressed(KEYCODE_RIGHT) && width < 512) { width <<= 1; while (input_code_pressed(KEYCODE_RIGHT)) ; }
336      if (input_code_pressed(screen->machine, KEYCODE_DOWN)) yoffs += input_code_pressed(screen->machine, KEYCODE_LSHIFT) ? 0x40 : 1;
337      if (input_code_pressed(screen->machine, KEYCODE_UP)) yoffs -= input_code_pressed(screen->machine, KEYCODE_LSHIFT) ? 0x40 : 1;
338      if (input_code_pressed(screen->machine, KEYCODE_LEFT) && width > 4) { width >>= 1; while (input_code_pressed(screen->machine, KEYCODE_LEFT)) ; }
339      if (input_code_pressed(screen->machine, KEYCODE_RIGHT) && width < 512) { width <<= 1; while (input_code_pressed(screen->machine, KEYCODE_RIGHT)) ; }
340340
341341      if (yoffs < 0) yoffs = 0;
342342      base = waveram0_ptr_from_block_addr(yoffs << 12);
r5613r5614
738738
739739      case 0xcc:
740740         video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
741         log_fifo = input_code_pressed(KEYCODE_L);
741         log_fifo = input_code_pressed(machine, KEYCODE_L);
742742         break;
743743
744744      case 0xe0:
r5613r5614
10321032
10331033               case 0x25:   /* mk4 */
10341034               case 0x30:   /* invasn */
1035                  zeus_draw_quad(databuffer, texdata, logit);
1035                  zeus_draw_quad(machine, databuffer, texdata, logit);
10361036                  break;
10371037
10381038               default:
r5613r5614
10561056 *
10571057 *************************************/
10581058
1059static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texdata, int logit)
1059static void zeus_draw_quad(running_machine *machine, const UINT32 *databuffer, UINT32 texdata, int logit)
10601060{
10611061   poly_draw_scanline_func callback;
10621062   poly_extra_data *extra;
r5613r5614
10981098   {
10991099      if (logit)
11001100         logerror("quad (culled %08X)\n", rotnormal[2]);
1101//      if (input_code_pressed(KEYCODE_COMMA))
1101//      if (input_code_pressed(machine, KEYCODE_COMMA))
11021102//          return;
11031103   }
11041104
r5613r5614
11111111   val2 = (texdata >> 16) & 0x3ff;
11121112   texwshift = (val2 >> 6) & 7;
11131113
1114//if (input_code_pressed(KEYCODE_Z) && (val2 & 0x01)) return;
1115//if (input_code_pressed(KEYCODE_X) && (val2 & 0x02)) return;
1116//if (input_code_pressed(KEYCODE_C) && (val2 & 0x04)) return;
1117//if (input_code_pressed(KEYCODE_V) && (val2 & 0x08)) return;
1118//if (input_code_pressed(KEYCODE_B) && (val2 & 0x10)) return;
1119//if (input_code_pressed(KEYCODE_N) && (val2 & 0x20)) return;
1120//if (input_code_pressed(KEYCODE_M) && (val2 & 0x200)) return;
1114//if (input_code_pressed(machine, KEYCODE_Z) && (val2 & 0x01)) return;
1115//if (input_code_pressed(machine, KEYCODE_X) && (val2 & 0x02)) return;
1116//if (input_code_pressed(machine, KEYCODE_C) && (val2 & 0x04)) return;
1117//if (input_code_pressed(machine, KEYCODE_V) && (val2 & 0x08)) return;
1118//if (input_code_pressed(machine, KEYCODE_B) && (val2 & 0x10)) return;
1119//if (input_code_pressed(machine, KEYCODE_N) && (val2 & 0x20)) return;
1120//if (input_code_pressed(machine, KEYCODE_M) && (val2 & 0x200)) return;
11211121
11221122   uscale = (8 >> ((zeusbase[0x04] >> 4) & 3)) * 0.125f * 256.0f;
11231123   vscale = (8 >> ((zeusbase[0x04] >> 6) & 3)) * 0.125f * 256.0f;
src/mame/video/argus.c
r5613r5614
11521152}
11531153
11541154
1155#ifdef MAME_DEBUG
1156static void butasan_log_vram(void)
1155static void butasan_log_vram(running_machine *machine)
11571156{
1157#ifdef MAME_DEBUG
11581158   int offs;
11591159
1160   if (input_code_pressed(KEYCODE_M))
1160   if (input_code_pressed(machine, KEYCODE_M))
11611161   {
11621162      int i;
11631163      logerror("\nSprite RAM\n");
r5613r5614
12011201         }
12021202      }
12031203   }
1204}
12051204#endif
1205}
12061206
12071207VIDEO_UPDATE( argus )
12081208{
r5613r5614
12451245   butasan_draw_sprites(screen->machine, bitmap, cliprect);
12461246   tilemap_draw(bitmap, cliprect, tx_tilemap,  0, 0);
12471247
1248#ifdef MAME_DEBUG
1249   butasan_log_vram();
1250#endif
1248   butasan_log_vram(screen->machine);
12511249   return 0;
12521250}
src/mame/video/gaiden.c
r5613r5614
8686   tilemap_set_transparent_pen(text_layer, 0);
8787}
8888
89VIDEO_START( mastninj )
90{
91   /* set up tile layers */
92   background = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,  16, 16, 64, 32);
93   foreground = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,  16, 16, 64, 32);
94   text_layer = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows,   8,  8, 32, 32);
95
96//  tilemap_set_transparent_pen(background, 15);
97   tilemap_set_transparent_pen(foreground, 15);
98   tilemap_set_transparent_pen(text_layer, 15);
99
100   tilemap_set_scrolldx(background, -248, 248);
101   tilemap_set_scrolldx(foreground, -252, 252);
102}
103
89104VIDEO_START( raiga )
90105{
91106   int width = video_screen_get_width(machine->primary_screen);
src/mame/video/amigaaga.c
r5613r5614
11611161#if GUESS_COPPER_OFFSET
11621162   if (video_screen_get_frame_number(machine->primary_screen) % 64 == 0 && scanline == 0)
11631163   {
1164      if (input_code_pressed(KEYCODE_Q))
1164      if (input_code_pressed(machine, KEYCODE_Q))
11651165         popmessage("%d", wait_offset -= 1);
1166      if (input_code_pressed(KEYCODE_W))
1166      if (input_code_pressed(machine, KEYCODE_W))
11671167         popmessage("%d", wait_offset += 1);
11681168   }
11691169#endif
src/mame/video/gticlub.c
r5613r5614
996996   if( tick >= 5 ) {
997997      tick = 0;
998998
999      if( input_code_pressed(KEYCODE_O) )
999      if( input_code_pressed(screen->machine, KEYCODE_O) )
10001000         debug_tex_page++;
10011001
1002      if( input_code_pressed(KEYCODE_I) )
1002      if( input_code_pressed(screen->machine, KEYCODE_I) )
10031003         debug_tex_page--;
10041004
1005      if (input_code_pressed(KEYCODE_U))
1005      if (input_code_pressed(screen->machine, KEYCODE_U))
10061006         debug_tex_palette++;
1007      if (input_code_pressed(KEYCODE_Y))
1007      if (input_code_pressed(screen->machine, KEYCODE_Y))
10081008         debug_tex_palette--;
10091009
10101010      if (debug_tex_page < 0)
src/mame/video/psx.c
r5613r5614
420420
421421static void DebugCheckKeys( running_machine *machine )
422422{
423   if( input_code_pressed_once( KEYCODE_M ) )
423   if( input_code_pressed_once( machine, KEYCODE_M ) )
424424      m_debug.b_mesh = !m_debug.b_mesh;
425425
426   if( input_code_pressed_once( KEYCODE_V ) )
426   if( input_code_pressed_once( machine, KEYCODE_V ) )
427427      m_debug.b_texture = !m_debug.b_texture;
428428
429429   if( m_debug.b_mesh || m_debug.b_texture )
r5613r5614
435435   else
436436      video_screen_set_visarea(machine->primary_screen, 0, m_n_screenwidth - 1, 0, m_n_screenheight - 1 );
437437
438   if( input_code_pressed_once( KEYCODE_I ) )
438   if( input_code_pressed_once( machine, KEYCODE_I ) )
439439   {
440440      if( m_debug.b_texture )
441441      {
r5613r5614
463463   }
464464
465465#if 0
466   if( input_code_pressed_once( KEYCODE_D ) )
466   if( input_code_pressed_once( machine, KEYCODE_D ) )
467467   {
468468      FILE *f;
469469      int n_x;
r5613r5614
473473            fprintf( f, "%04u,%04u = %04x\n", n_y, n_x, m_p_p_vram[ n_y ][ n_x ] );
474474      fclose( f );
475475   }
476   if( input_code_pressed_once( KEYCODE_S ) )
476   if( input_code_pressed_once( machine, KEYCODE_S ) )
477477   {
478478      FILE *f;
479479      popmessage( "saving..." );
r5613r5614
482482         fwrite( m_p_p_vram[ n_y ], 1024 * 2, 1, f );
483483      fclose( f );
484484   }
485   if( input_code_pressed_once( KEYCODE_L ) )
485   if( input_code_pressed_once( machine, KEYCODE_L ) )
486486   {
487487      FILE *f;
488488      popmessage( "loading..." );
src/mame/video/ms32.c
r5613r5614
346346      }
347347
348348#if 0
349if (input_code_pressed(KEYCODE_A) && (pri & 8)) color = rand();
350if (input_code_pressed(KEYCODE_S) && (pri & 4)) color = rand();
351if (input_code_pressed(KEYCODE_D) && (pri & 2)) color = rand();
352if (input_code_pressed(KEYCODE_F) && (pri & 1)) color = rand();
349if (input_code_pressed(machine, KEYCODE_A) && (pri & 8)) color = rand();
350if (input_code_pressed(machine, KEYCODE_S) && (pri & 4)) color = rand();
351if (input_code_pressed(machine, KEYCODE_D) && (pri & 2)) color = rand();
352if (input_code_pressed(machine, KEYCODE_F) && (pri & 1)) color = rand();
353353#endif
354354
355355      /* TODO: priority handling is completely wrong, but better than nothing */
src/mame/video/model1.c
r5613r5614
13321332static void tgp_scan(void)
13331333{
13341334#if 0
1335   if (input_code_pressed_once(KEYCODE_F))
1335   if (input_code_pressed_once(machine, KEYCODE_F))
13361336        {
13371337         FILE *fp;
13381338         fp=fopen("tgp-ram.bin", "w+b");
r5613r5614
14651465      double delta;
14661466      delta = 1;
14671467
1468      if(input_code_pressed(KEYCODE_F)) {
1468      if(input_code_pressed(screen->machine, KEYCODE_F)) {
14691469         mod = 1;
14701470         vxx -= delta;
14711471      }
1472      if(input_code_pressed(KEYCODE_G)) {
1472      if(input_code_pressed(screen->machine, KEYCODE_G)) {
14731473         mod = 1;
14741474         vxx += delta;
14751475      }
1476      if(input_code_pressed(KEYCODE_H)) {
1476      if(input_code_pressed(screen->machine, KEYCODE_H)) {
14771477         mod = 1;
14781478         vyy -= delta;
14791479      }
1480      if(input_code_pressed(KEYCODE_J)) {
1480      if(input_code_pressed(screen->machine, KEYCODE_J)) {
14811481         mod = 1;
14821482         vyy += delta;
14831483      }
1484      if(input_code_pressed(KEYCODE_K)) {
1484      if(input_code_pressed(screen->machine, KEYCODE_K)) {
14851485         mod = 1;
14861486         vzz -= delta;
14871487      }
1488      if(input_code_pressed(KEYCODE_L)) {
1488      if(input_code_pressed(screen->machine, KEYCODE_L)) {
14891489         mod = 1;
14901490         vzz += delta;
14911491      }
1492      if(input_code_pressed(KEYCODE_U)) {
1492      if(input_code_pressed(screen->machine, KEYCODE_U)) {
14931493         mod = 1;
14941494         ayy -= 0.05;
14951495      }
1496      if(input_code_pressed(KEYCODE_I)) {
1496      if(input_code_pressed(screen->machine, KEYCODE_I)) {
14971497         mod = 1;
14981498         ayy += 0.05;
14991499      }
src/mame/video/taitoic.c
r5613r5614
39963996   int priority_switch_line = (road_ctrl & 0x00ff) - y_offs;
39973997
39983998#ifdef MAME_DEBUG
3999   if (input_code_pressed_once (KEYCODE_X))
3999   if (input_code_pressed_once (machine, KEYCODE_X))
40004000   {
40014001      dislayer[0] ^= 1;
40024002      popmessage("RoadA body: %01x",dislayer[0]);
40034003   }
40044004
4005   if (input_code_pressed_once (KEYCODE_C))
4005   if (input_code_pressed_once (machine, KEYCODE_C))
40064006   {
40074007      dislayer[1] ^= 1;
40084008      popmessage("RoadA l-edge: %01x",dislayer[1]);
40094009   }
40104010
4011   if (input_code_pressed_once (KEYCODE_V))
4011   if (input_code_pressed_once (machine, KEYCODE_V))
40124012   {
40134013      dislayer[2] ^= 1;
40144014      popmessage("RoadA r-edge: %01x",dislayer[2]);
40154015   }
40164016
4017   if (input_code_pressed_once (KEYCODE_B))
4017   if (input_code_pressed_once (machine, KEYCODE_B))
40184018   {
40194019      dislayer[3] ^= 1;
40204020      popmessage("RoadB body: %01x",dislayer[3]);
40214021   }
40224022
4023   if (input_code_pressed_once (KEYCODE_N))
4023   if (input_code_pressed_once (machine, KEYCODE_N))
40244024   {
40254025      dislayer[4] ^= 1;
40264026      popmessage("RoadB l-edge: %01x",dislayer[4]);
40274027   }
4028   if (input_code_pressed_once (KEYCODE_M))
4028   if (input_code_pressed_once (machine, KEYCODE_M))
40294029   {
40304030      dislayer[5] ^= 1;
40314031      popmessage("RoadB r-edge: %01x",dislayer[5]);
src/mame/video/suna8.c
r5613r5614
9898static TILE_GET_INFO( get_tile_info )
9999{
100100   UINT8 code, attr;
101   if (input_code_pressed(KEYCODE_X))
101   if (input_code_pressed(screen->machine, KEYCODE_X))
102102   {   UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000 + 0x4000*rombank;
103103      code = rom[ 2 * tile_index + 0 ];
104104      attr = rom[ 2 * tile_index + 1 ];   }
r5613r5614
412412
413413#ifdef MAME_DEBUG
414414#if TILEMAPS
415   if (input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X))
415   if (input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X))
416416   {
417417      int max_tiles = memory_region_length(machine, "gfx1") / (0x400 * 0x20);
418418
419      if (input_code_pressed_once(KEYCODE_Q))   { page--;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
420      if (input_code_pressed_once(KEYCODE_W))   { page++;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
421      if (input_code_pressed_once(KEYCODE_E))   { tiles--;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
422      if (input_code_pressed_once(KEYCODE_R))   { tiles++;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
423      if (input_code_pressed_once(KEYCODE_A))   { rombank--;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
424      if (input_code_pressed_once(KEYCODE_S))   { rombank++;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
419      if (input_code_pressed_once(screen->machine, KEYCODE_Q))   { page--;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
420      if (input_code_pressed_once(screen->machine, KEYCODE_W))   { page++;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
421      if (input_code_pressed_once(screen->machine, KEYCODE_E))   { tiles--;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
422      if (input_code_pressed_once(screen->machine, KEYCODE_R))   { tiles++;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
423      if (input_code_pressed_once(screen->machine, KEYCODE_A))   { rombank--;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
424      if (input_code_pressed_once(screen->machine, KEYCODE_S))   { rombank++;   tilemap_mark_all_tiles_dirty_all(screen->machine);   }
425425
426426      rombank  &= 0xf;
427427      page  &= (suna8_text_dim > 0)?3:7;
src/mame/video/cps1.c
r5613r5614
24692469   int yoffs = 16-cps2_port(CPS2_OBJ_YOFFS);
24702470
24712471#ifdef MAME_DEBUG
2472   if (input_code_pressed(KEYCODE_Z) && input_code_pressed(KEYCODE_R))
2472   if (input_code_pressed(machine, KEYCODE_Z) && input_code_pressed(machine, KEYCODE_R))
24732473   {
24742474      return;
24752475   }
r5613r5614
27952795         cps2_port(CPS2_OBJ_UK1),
27962796         cps2_port(CPS2_OBJ_UK2));
27972797
2798if (0 && input_code_pressed(KEYCODE_Z))
2798if (0 && input_code_pressed(screen->machine, KEYCODE_Z))
27992799   popmessage("order: %d (%d) %d (%d) %d (%d) %d (%d)",l0,l0pri,l1,l1pri,l2,l2pri,l3,l3pri);
28002800#endif
28012801
src/mame/video/gaelco3d.c
r5613r5614
456456{
457457   int x, y, ret;
458458
459   if (DISPLAY_TEXTURE && (input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X)))
459   if (DISPLAY_TEXTURE && (input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X)))
460460   {
461461      static int xv = 0, yv = 0x1000;
462462      UINT8 *base = gaelco3d_texture;
463463      int length = gaelco3d_texture_size;
464464
465      if (input_code_pressed(KEYCODE_X))
465      if (input_code_pressed(screen->machine, KEYCODE_X))
466466      {
467467         base = gaelco3d_texmask;
468468         length = gaelco3d_texmask_size;
469469      }
470470
471      if (input_code_pressed(KEYCODE_LEFT) && xv >= 4)
471      if (input_code_pressed(screen->machine, KEYCODE_LEFT) && xv >= 4)
472472         xv -= 4;
473      if (input_code_pressed(KEYCODE_RIGHT) && xv < 4096 - 4)
473      if (input_code_pressed(screen->machine, KEYCODE_RIGHT) && xv < 4096 - 4)
474474         xv += 4;
475475
476      if (input_code_pressed(KEYCODE_UP) && yv >= 4)
476      if (input_code_pressed(screen->machine, KEYCODE_UP) && yv >= 4)
477477         yv -= 4;
478      if (input_code_pressed(KEYCODE_DOWN) && yv < 0x40000)
478      if (input_code_pressed(screen->machine, KEYCODE_DOWN) && yv < 0x40000)
479479         yv += 4;
480480
481481      for (y = cliprect->min_y; y <= cliprect->max_y; y++)
src/mame/video/hyprduel.c
r5613r5614
688688   flip_screen_set(screen->machine, screenctrl & 1);
689689
690690#if 0
691if (input_code_pressed(KEYCODE_Z))
691if (input_code_pressed(screen->machine, KEYCODE_Z))
692692{   int msk = 0;
693   if (input_code_pressed(KEYCODE_Q))   msk |= 0x01;
694   if (input_code_pressed(KEYCODE_W))   msk |= 0x02;
695   if (input_code_pressed(KEYCODE_E))   msk |= 0x04;
696   if (input_code_pressed(KEYCODE_A))   msk |= 0x08;
693   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 0x01;
694   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 0x02;
695   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 0x04;
696   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 0x08;
697697   if (msk != 0)
698698   {   bitmap_fill(bitmap,cliprect,0);
699699      layers_ctrl &= msk;   }
src/mame/video/model2.c
r5613r5614
10311031      return;
10321032
10331033#if DEBUG
1034   if (input_code_pressed(KEYCODE_Q))
1034   if (input_code_pressed(machine, KEYCODE_Q))
10351035   {
10361036      UINT32   i;
10371037
src/mame/video/lordgun.c
r5613r5614
263263   int y;
264264
265265#ifdef MAME_DEBUG
266if (input_code_pressed(KEYCODE_Z))
266if (input_code_pressed(screen->machine, KEYCODE_Z))
267267{
268268   int msk = 0;
269269
270   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
271   if (input_code_pressed(KEYCODE_W))   msk |= 2;
272   if (input_code_pressed(KEYCODE_E))    msk |= 4;
273   if (input_code_pressed(KEYCODE_R))   msk |= 8;
274   if (input_code_pressed(KEYCODE_A))   msk |= 16;
270   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
271   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
272   if (input_code_pressed(screen->machine, KEYCODE_E))    msk |= 4;
273   if (input_code_pressed(screen->machine, KEYCODE_R))   msk |= 8;
274   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 16;
275275   if (msk != 0) layers_ctrl &= msk;
276276}
277277#endif
src/mame/video/espial.c
r5613r5614
157157{
158158   flipscreen = data;
159159
160   tilemap_set_flip(0, flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
160   tilemap_set_flip(bg_tilemap, flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
161161}
162162
163163
src/mame/video/toaplan1.c
r5613r5614
738738
739739
740740
741#ifdef MAME_DEBUG
742static void toaplan1_log_vram(void)
741static void toaplan1_log_vram(running_machine *machine)
743742{
744   if ( input_code_pressed(KEYCODE_M) )
743#ifdef MAME_DEBUG
744   if ( input_code_pressed(machine, KEYCODE_M) )
745745   {
746746      offs_t sprite_voffs;
747      while (input_code_pressed(KEYCODE_M)) ;
747      while (input_code_pressed(machine, KEYCODE_M)) ;
748748      if (toaplan1_spritesizeram16)         /* FCU controller */
749749      {
750750         int schar,sattr,sxpos,sypos,bschar,bsattr,bsxpos,bsypos;
r5613r5614
789789      }
790790   }
791791
792   if ( input_code_pressed(KEYCODE_SLASH) )
792   if ( input_code_pressed(machine, KEYCODE_SLASH) )
793793   {
794794      UINT16 *size  = (UINT16 *)(toaplan1_spritesizeram16);
795795      UINT16 *bsize = (UINT16 *)(toaplan1_buffered_spritesizeram16);
796796      offs_t offs;
797      while (input_code_pressed(KEYCODE_SLASH)) ;
797      while (input_code_pressed(machine, KEYCODE_SLASH)) ;
798798      if (toaplan1_spritesizeram16)         /* FCU controller */
799799      {
800800         logerror("Scrolls    PF1-X  PF1-Y     PF2-X  PF2-Y     PF3-X  PF3-Y     PF4-X  PF4-Y\n");
r5613r5614
810810      }
811811   }
812812
813   if ( input_code_pressed(KEYCODE_N) )
813   if ( input_code_pressed(machine, KEYCODE_N) )
814814   {
815815      offs_t tile_voffs;
816816      int tchar[5], tattr[5];
817      while (input_code_pressed(KEYCODE_N)) ;   /* BCU controller */
817      while (input_code_pressed(machine, KEYCODE_N)) ;   /* BCU controller */
818818      logerror("Scrolls    PF1-X  PF1-Y     PF2-X  PF2-Y     PF3-X  PF3-Y     PF4-X  PF4-Y\n");
819819      logerror("------>    #%04x  #%04x     #%04x  #%04x     #%04x  #%04x     #%04x  #%04x\n",pf1_scrollx,pf1_scrolly,pf2_scrollx,pf2_scrolly,pf3_scrollx,pf3_scrolly,pf4_scrollx,pf4_scrolly);
820820      for ( tile_voffs = 0; tile_voffs < (TOAPLAN1_TILEVRAM_SIZE/2); tile_voffs += 2 )
r5613r5614
834834      }
835835   }
836836
837   if ( input_code_pressed(KEYCODE_W) )
837   if ( input_code_pressed(machine, KEYCODE_W) )
838838   {
839      while (input_code_pressed(KEYCODE_W)) ;
839      while (input_code_pressed(machine, KEYCODE_W)) ;
840840      logerror("Mark here\n");
841841   }
842   if ( input_code_pressed(KEYCODE_E) )
842   if ( input_code_pressed(machine, KEYCODE_E) )
843843   {
844      while (input_code_pressed(KEYCODE_E)) ;
844      while (input_code_pressed(machine, KEYCODE_E)) ;
845845      displog += 1;
846846      displog &= 1;
847847   }
r5613r5614
850850      logerror("Scrolls    PF1-X  PF1-Y     PF2-X  PF2-Y     PF3-X  PF3-Y     PF4-X  PF4-Y\n");
851851      logerror("------>    #%04x  #%04x     #%04x  #%04x     #%04x  #%04x     #%04x  #%04x\n",pf1_scrollx,pf1_scrolly,pf2_scrollx,pf2_scrolly,pf3_scrollx,pf3_scrolly,pf4_scrollx,pf4_scrolly);
852852   }
853   if ( input_code_pressed(KEYCODE_B) )
853   if ( input_code_pressed(machine, KEYCODE_B) )
854854   {
855//      while (input_code_pressed(KEYCODE_B)) ;
855//      while (input_code_pressed(machine, KEYCODE_B)) ;
856856      scrollx_offs1 += 0x1; scrollx_offs2 += 0x1; scrollx_offs3 += 0x1; scrollx_offs4 += 0x1;
857857      logerror("Scrollx_offs now = %08x\n",scrollx_offs4);
858858      tilemap_set_scrollx(pf1_tilemap,0,(pf1_scrollx >> 7) - (tiles_offsetx - scrollx_offs1));
r5613r5614
860860      tilemap_set_scrollx(pf3_tilemap,0,(pf3_scrollx >> 7) - (tiles_offsetx - scrollx_offs3));
861861      tilemap_set_scrollx(pf4_tilemap,0,(pf4_scrollx >> 7) - (tiles_offsetx - scrollx_offs4));
862862   }
863   if ( input_code_pressed(KEYCODE_V) )
863   if ( input_code_pressed(machine, KEYCODE_V) )
864864   {
865//      while (input_code_pressed(KEYCODE_V)) ;
865//      while (input_code_pressed(machine, KEYCODE_V)) ;
866866      scrollx_offs1 -= 0x1; scrollx_offs2 -= 0x1; scrollx_offs3 -= 0x1; scrollx_offs4 -= 0x1;
867867      logerror("Scrollx_offs now = %08x\n",scrollx_offs4);
868868      tilemap_set_scrollx(pf1_tilemap,0,(pf1_scrollx >> 7) - (tiles_offsetx - scrollx_offs1));
r5613r5614
870870      tilemap_set_scrollx(pf3_tilemap,0,(pf3_scrollx >> 7) - (tiles_offsetx - scrollx_offs3));
871871      tilemap_set_scrollx(pf4_tilemap,0,(pf4_scrollx >> 7) - (tiles_offsetx - scrollx_offs4));
872872   }
873   if ( input_code_pressed(KEYCODE_C) )
873   if ( input_code_pressed(machine, KEYCODE_C) )
874874   {
875//      while (input_code_pressed(KEYCODE_C)) ;
875//      while (input_code_pressed(machine, KEYCODE_C)) ;
876876      scrolly_offs += 0x1;
877877      logerror("Scrolly_offs now = %08x\n",scrolly_offs);
878878      tilemap_set_scrolly(pf1_tilemap,0,(pf1_scrolly >> 7) - (tiles_offsety - scrolly_offs));
r5613r5614
880880      tilemap_set_scrolly(pf3_tilemap,0,(pf3_scrolly >> 7) - (tiles_offsety - scrolly_offs));
881881      tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs));
882882   }
883   if ( input_code_pressed(KEYCODE_X) )
883   if ( input_code_pressed(machine, KEYCODE_X) )
884884   {
885//      while (input_code_pressed(KEYCODE_X)) ;
885//      while (input_code_pressed(machine, KEYCODE_X)) ;
886886      scrolly_offs -= 0x1;
887887      logerror("Scrolly_offs now = %08x\n",scrolly_offs);
888888      tilemap_set_scrolly(pf1_tilemap,0,(pf1_scrolly >> 7) - (tiles_offsety - scrolly_offs));
r5613r5614
891891      tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs));
892892   }
893893
894   if ( input_code_pressed(KEYCODE_L) )      /* Turn Playfield 4 on/off */
894   if ( input_code_pressed(machine, KEYCODE_L) )      /* Turn Playfield 4 on/off */
895895   {
896      while (input_code_pressed(KEYCODE_L)) ;
896      while (input_code_pressed(machine, KEYCODE_L)) ;
897897      display_pf4 += 1;
898898      display_pf4 &= 1;
899899      tilemap_set_enable(pf4_tilemap, display_pf4);
900900   }
901   if ( input_code_pressed(KEYCODE_K) )      /* Turn Playfield 3 on/off */
901   if ( input_code_pressed(machine, KEYCODE_K) )      /* Turn Playfield 3 on/off */
902902   {
903      while (input_code_pressed(KEYCODE_K)) ;
903      while (input_code_pressed(machine, KEYCODE_K)) ;
904904      display_pf3 += 1;
905905      display_pf3 &= 1;
906906      tilemap_set_enable(pf3_tilemap, display_pf3);
907907   }
908   if ( input_code_pressed(KEYCODE_J) )      /* Turn Playfield 2 on/off */
908   if ( input_code_pressed(machine, KEYCODE_J) )      /* Turn Playfield 2 on/off */
909909   {
910      while (input_code_pressed(KEYCODE_J)) ;
910      while (input_code_pressed(machine, KEYCODE_J)) ;
911911      display_pf2 += 1;
912912      display_pf2 &= 1;
913913      tilemap_set_enable(pf2_tilemap, display_pf2);
914914   }
915   if ( input_code_pressed(KEYCODE_H) )      /* Turn Playfield 1 on/off */
915   if ( input_code_pressed(machine, KEYCODE_H) )      /* Turn Playfield 1 on/off */
916916   {
917      while (input_code_pressed(KEYCODE_H)) ;
917      while (input_code_pressed(machine, KEYCODE_H)) ;
918918      display_pf1 += 1;
919919      display_pf1 &= 1;
920920      tilemap_set_enable(pf1_tilemap, display_pf1);
921921   }
922}
923922#endif
923}
924924
925925
926926
r5613r5614
11341134{
11351135   int priority;
11361136
1137#ifdef MAME_DEBUG
1138   toaplan1_log_vram();
1139#endif
1137   toaplan1_log_vram(screen->machine);
11401138
11411139   bitmap_fill(bitmap,cliprect,0);
11421140
r5613r5614
11581156{
11591157   int priority;
11601158
1161#ifdef MAME_DEBUG
1162   toaplan1_log_vram();
1163#endif
1159   toaplan1_log_vram(screen->machine);
11641160
11651161   bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
11661162   bitmap_fill(bitmap,cliprect,0x120);
r5613r5614
11851181{
11861182   int priority;
11871183
1188#ifdef MAME_DEBUG
1189   toaplan1_log_vram();
1190#endif
1184   toaplan1_log_vram(screen->machine);
11911185
11921186   bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
11931187   bitmap_fill(bitmap,cliprect,0x120);
src/mame/video/tmnt.c
r5613r5614
173173static void blswhstl_sprite_callback(int *code,int *color,int *priority_mask)
174174{
175175#if 0
176if (input_code_pressed(KEYCODE_Q) && (*color & 0x20)) *color = rand();
177if (input_code_pressed(KEYCODE_W) && (*color & 0x40)) *color = rand();
178if (input_code_pressed(KEYCODE_E) && (*color & 0x80)) *color = rand();
176if (input_code_pressed(machine, KEYCODE_Q) && (*color & 0x20)) *color = rand();
177if (input_code_pressed(machine, KEYCODE_W) && (*color & 0x40)) *color = rand();
178if (input_code_pressed(machine, KEYCODE_E) && (*color & 0x80)) *color = rand();
179179#endif
180180   int pri = 0x20 | ((*color & 0x60) >> 2);
181181   if (pri <= layerpri[2])                        *priority_mask = 0;
src/mame/video/dc.c
r5613r5614
3434static int dilatechose[64];
3535static float wbuffer[480][640];
3636static UINT32 debug_dip_status;
37static void pvr_accumulationbuffer_to_framebuffer(const address_space *space, int x,int y);
3738
3839UINT64 *dc_framebuffer_ram; // '32-bit access area'
3940UINT64 *dc_texture_ram; // '64-bit access area'
r5613r5614
4647static emu_timer *endofrender_timer_video;
4748
4849static int scanline;
49static bitmap_t *fakeframebuffer_bitmap;
50static void testdrawscreen(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect);
5150
51// the real accumulation buffer is a 32x32x8bpp buffer into which tiles get rendered before they get copied to the framebuffer
52//  our implementation is not currently tile based, and thus the accumulation buffer is screen sized
53static bitmap_t *fake_accumulationbuffer_bitmap;
54static void render_to_accumulation_buffer(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect);
55
5256typedef struct texinfo {
5357   UINT32 address, vqbase;
5458   int textured, sizex, sizey, sizes, pf, palette, mode, mipmapped, blend_mode, filter_mode, flip_u, flip_v;
r5613r5614
10031007   int reg;
10041008   UINT64 shift;
10051009   UINT32 old,dat;
1006   #if DEBUG_PVRTA
1007   UINT32 sizera,offsetra,v;
1008   #endif
1010   UINT32 sizera,offsetra;
10091011   int a;
1012   int sanitycount;
10101013
10111014   reg = decode_reg_64(offset, mem_mask, &shift);
10121015   dat = (UINT32)(data >> shift);
r5613r5614
10501053      mame_printf_verbose("Start Render Received:\n");
10511054      mame_printf_verbose("  Region Array at %08x\n",pvrta_regs[REGION_BASE]);
10521055      mame_printf_verbose("  ISP/TSP Parameters at %08x\n",pvrta_regs[PARAM_BASE]);
1053      if (pvrta_regs[FPU_PARAM_CFG] & 0x200000)
1054         sizera=6;
1055      else
1056         sizera=5;
1057      offsetra=pvrta_regs[REGION_BASE];
1058      for (;;)
1059      {
1060         v=memory_read_dword(space,0x05000000+offsetra);
1061         mame_printf_verbose("Tile X:%d Y:%d\n  ", (v >> 2) & 0x3f, (v >> 8) & 0x3f);
1062         offsetra = offsetra+4;
1063         v=memory_read_dword(space,0x05000000+offsetra);
1064         if (!(v & 0x80000000))
1065            mame_printf_verbose("OLP %d ",v & 0xFFFFFC);
1066         offsetra = offsetra+4;
1067         v=memory_read_dword(space,0x05000000+offsetra);
1068         if (!(v & 0x80000000))
1069            mame_printf_verbose("OMVLP %d ",v & 0xFFFFFC);
1070         offsetra = offsetra+4;
1071         v=memory_read_dword(space,0x05000000+offsetra);
1072         if (!(v & 0x80000000))
1073            mame_printf_verbose("TLP %d ",v & 0xFFFFFC);
1074         offsetra = offsetra+4;
1075         v=memory_read_dword(space,0x05000000+offsetra);
1076         if (!(v & 0x80000000))
1077            mame_printf_verbose("TMVLP %d ",v & 0xFFFFFC);
1078         if (sizera == 6)
1079         {
1080            offsetra = offsetra+4;
1081            v=memory_read_dword(space,0x05000000+offsetra);
1082            if (!(v & 0x80000000))
1083               mame_printf_verbose("PTLP %d ",v & 0xFFFFFC);
1084         }
1085         mame_printf_verbose("\n");
1086         if (v & 0x80000000)
1087            break;
1088      }
1056
10891057      #endif
10901058      // select buffer to draw using PARAM_BASE
10911059      for (a=0;a < NUM_BUFFERS;a++)
r5613r5614
11071075            clip.min_y = 0;
11081076            clip.max_y = 1023;
11091077
1110            // we've got a request to draw, so, draw to the fake fraembuffer!
1111            testdrawscreen(space->machine,fakeframebuffer_bitmap,&clip);
1078            // we've got a request to draw, so, draw to the accumulation buffer!
1079            // this should really be done for each tile!
1080            render_to_accumulation_buffer(space->machine,fake_accumulationbuffer_bitmap,&clip);
11121081
11131082            timer_adjust_oneshot(endofrender_timer_isp, ATTOTIME_IN_USEC(4000) , 0); // hack, make sure render takes some amount of time
11141083
1084            /* copy the tiles to the framebuffer (really the rendering should be in this loop too) */
1085            if (pvrta_regs[FPU_PARAM_CFG] & 0x200000)
1086               sizera=6;
1087            else
1088               sizera=5;
1089            offsetra=pvrta_regs[REGION_BASE];
1090
1091            //printf("base is %08x\n", offsetra);
1092
1093            // sanity
1094            sanitycount = 0;
1095            for (;;)
1096            {
1097               UINT32 st[6];
1098
1099               st[0]=memory_read_dword(space,(0x05000000+offsetra));
1100               st[1]=memory_read_dword(space,(0x05000004+offsetra)); // Opaque List Pointer
1101               st[2]=memory_read_dword(space,(0x05000008+offsetra)); // Opaque Modifier Volume List Pointer
1102               st[3]=memory_read_dword(space,(0x0500000c+offsetra)); // Translucent List Pointer
1103               st[4]=memory_read_dword(space,(0x05000010+offsetra)); // Translucent Modifier Volume List Pointer
1104
1105               if (sizera == 6)
1106               {
1107                  st[5] = memory_read_dword(space,(0x05000014+offsetra)); // Punch Through List Pointer
1108                  offsetra+=0x18;
1109               }
1110               else
1111               {
1112                  st[5] = 0;
1113                  offsetra+=0x14;
1114               }
1115
1116               {
1117                  int x = ((st[0]&0x000000fc)>>2)*32;
1118                  int y = ((st[0]&0x00003f00)>>8)*32;
1119                  //printf("tiledata %08x %d %d - %08x %08x %08x %08x %08x\n",st[0],x,y,st[1],st[2],st[3],st[4],st[5]);
1120
1121                  // should render to the accumulation buffer here using pointers we filled in when processing the data
1122                  // sent to the TA.  HOWEVER, we don't process the TA data and create the real format object lists, so
1123                  // instead just use these co-ordinates to copy data from our fake full-screnen accumnulation buffer into
1124                  // the framebuffer
1125
1126                  pvr_accumulationbuffer_to_framebuffer(space, x,y);
1127               }
1128
1129               if (st[0] & 0x80000000)
1130                  break;
1131
1132               // prevent infinite loop if asked to process invalid data
1133               if(sanitycount>2000)
1134                  break;
1135            }
1136
1137
1138
1139
11151140            break;
11161141         }
11171142      }
r5613r5614
18541879   render_tri_sorted(bitmap, ti, v+i0, v+i1, v+i2);
18551880}
18561881
1857static void testdrawscreen(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect)
1882static void render_to_accumulation_buffer(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect)
18581883{
18591884   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
18601885   int cs,rs,ns;
r5613r5614
18751900   c=pvrta_regs[ISP_BACKGND_T];
18761901   c=memory_read_dword(space,0x05000000+((c&0xfffff8)>>1)+(3+3)*4);
18771902   bitmap_fill(bitmap,cliprect,c);
1878#if 0
1879   stride=pvrta_regs[FB_W_LINESTRIDE] << 3;
1880   c=pvrta_regs[ISP_BACKGND_T];
1881   a=(c & 0xfffff8) >> 1;
1882   cs=(c >> 24) & 7;
1883   cs=cs+3; // cs*2+3
1884   c=memory_read_dword(space,0x05000000+a+3*4+(cs-1)*4);
1885   dx=(int)u2f(memory_read_dword(space,0x05000000+a+3*4+cs*4+0));
1886   dy=(int)u2f(memory_read_dword(space,0x05000000+a+3*4+2*cs*4+4));
1887   for (y=0;y < dy;y++)
1888   {
1889      addrp=state_ta.grab[rs].fbwsof1+y*stride;
1890      for (x=0;x < dx;x++)
1891      {
1892         bmpaddr16=((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1);
1893         *bmpaddr16=((c & 0xf80000) >> 8) | ((c & 0xfc00) >> 5) | ((c & 0xf8) >> 3);
1894         addrp+=2;
1895      }
1896   }
1897#endif
18981903
1904
18991905   ns=state_ta.grab[rs].strips_size;
19001906   if(ns)
19011907      memset(wbuffer, 0x00, sizeof(wbuffer));
r5613r5614
19221928   state_ta.grab[rs].busy=0;
19231929}
19241930
1925#if 0
1926static void testdrawscreenframebuffer(bitmap_t *bitmap,const rectangle *cliprect)
1931// copies the accumulation buffer into the framebuffer, converting to the specified format
1932// not accurate, ignores field stuff and just uses SOF1 for now
1933// also ignores scale effects (can scale accumulation buffer to half size with filtering etc.)
1934// also can specify dither etc.
1935// basically, just a crude implementation!
1936
1937/*
1938
19390x0 0555 KRGB 16 bit (default) Bit 15 is the value of fb_kval 7.
19400x1 565 RGB 16 bit
19410x2 4444 ARGB 16 bit
19420x3 1555 ARGB 16 bit The alpha value is determined by comparison with the value of fb_alpha_threshold.
19430x4 888 RGB 24 bit packed
19440x5 0888 KRGB 32 bit K is the value of fk_kval.
19450x6 8888 ARGB 32 bit
19460x7 Setting prohibited.
1947
1948*/
1949
1950static void pvr_accumulationbuffer_to_framebuffer(const address_space *space, int x,int y)
19271951{
1952   // the accumulation buffer is always 8888
1953   //
1954   // the standard format for the framebuffer appears to be 565
1955   // yes, this means colour data is lost in the conversion
1956
1957   UINT32 wc = pvrta_regs[FB_W_CTRL];
1958   UINT32 stride = pvrta_regs[FB_W_LINESTRIDE];
1959   UINT32 writeoffs = pvrta_regs[FB_W_SOF1];
1960
1961   UINT32* src;
1962
1963
1964   UINT8 packmode = wc & 0x7;
1965
1966   switch (packmode)
1967   {
1968      case 0x01: //565 RGB 16 bit
1969      {
1970         int xcnt,ycnt;
1971         for (ycnt=0;ycnt<32;ycnt++)
1972         {
1973            UINT32 realwriteoffs = 0x05000000 + writeoffs + (y+ycnt) * (stride<<3) + (x*2);
1974            src = BITMAP_ADDR32(fake_accumulationbuffer_bitmap, y+ycnt, x);
1975
1976
1977            for (xcnt=0;xcnt<32;xcnt++)
1978            {
1979               // data is 8888 format
1980               UINT32 data = src[xcnt];
1981               UINT16 newdat = ((((data & 0x000000f8) >> 3)) << 0)   |
1982                               ((((data & 0x0000fc00) >> 10)) << 5)  |
1983                           ((((data & 0x00f80000) >> 19)) << 11);
1984
1985               memory_write_word(space,realwriteoffs+xcnt*2, newdat);
1986            }
1987         }
1988      }
1989      break;
1990
1991
1992      case 0x00:
1993
1994      case 0x02:
1995      case 0x03:
1996      case 0x04:
1997      case 0x05:
1998      case 0x06:
1999      case 0x07:
2000      default:
2001
2002         printf("pvr_accumulationbuffer_to_framebuffer buffer to tile at %d,%d - unsupported pack mode %02x\n",x,y,packmode);
2003   }
2004
2005
2006}
2007
2008
2009static void pvr_drawframebuffer(bitmap_t *bitmap,const rectangle *cliprect)
2010{
19282011   int x,y,dy,xi;
19292012   UINT32 addrp;
19302013   UINT32 *fbaddr;
r5613r5614
19342017   // only for rgb565 framebuffer
19352018   xi=((pvrta_regs[FB_R_SIZE] & 0x3ff)+1) << 1;
19362019   dy=((pvrta_regs[FB_R_SIZE] >> 10) & 0x3ff)+1;
2020
2021   dy*=2; // probably depends on interlace mode, fields etc...
2022
2023
19372024   for (y=0;y < dy;y++)
19382025   {
19392026      addrp=pvrta_regs[FB_R_SOF1]+y*xi*2;
19402027      for (x=0;x < xi;x++)
19412028      {
19422029         fbaddr=BITMAP_ADDR32(bitmap,y,x);
1943         c=*(((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1));
2030         c=*(((UINT16 *)dc_framebuffer_ram) + (WORD2_XOR_LE(addrp) >> 1));
2031
19442032         b = (c & 0x001f) << 3;
19452033         g = (c & 0x07e0) >> 3;
19462034         r = (c & 0xf800) >> 8;
1947         *fbaddr = b | (g<<8) | (r<<16);
2035
2036         if (y<cliprect->max_y)
2037            *fbaddr = b | (g<<8) | (r<<16);
19482038         addrp+=2;
19492039      }
19502040   }
19512041}
1952#endif
19532042
2043
19542044#if DEBUG_PALRAM
19552045static void debug_paletteram(running_machine *machine)
19562046{
r5613r5614
21302220   timer_adjust_oneshot(endofrender_timer_tsp, attotime_never, 0);
21312221   timer_adjust_oneshot(endofrender_timer_video, attotime_never, 0);
21322222
2133   fakeframebuffer_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_RGB32);
2223   fake_accumulationbuffer_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_RGB32);
21342224
21352225}
21362226
r5613r5614
21502240    ******************/
21512241
21522242//  static int useframebuffer=1;
2153   const rectangle *visarea = video_screen_get_visible_area(screen);
2154   int y,x;
2243//  const rectangle *visarea = video_screen_get_visible_area(screen);
2244//  int y,x;
21552245   //printf("videoupdate\n");
21562246
21572247#if DEBUG_PALRAM
r5613r5614
21592249#endif
21602250
21612251   // copy our fake framebuffer bitmap (where things have been rendered) to the screen
2252#if 0
21622253   for (y = visarea->min_y ; y <= visarea->max_y ; y++)
21632254   {
21642255      for (x = visarea->min_x ; x <= visarea->max_x ; x++)
21652256      {
2166         UINT32* src = BITMAP_ADDR32(fakeframebuffer_bitmap, y, x);
2257         UINT32* src = BITMAP_ADDR32(fake_accumulationbuffer_bitmap, y, x);
21672258         UINT32* dst = BITMAP_ADDR32(bitmap, y, x);
21682259         dst[0] = src[0];
21692260      }
21702261   }
2262#endif
21712263
2264   pvr_drawframebuffer(bitmap,cliprect);
2265
21722266   // update this here so we only do string lookup once per frame
21732267   debug_dip_status = input_port_read(screen->machine, "MAMEDEBUG");
21742268
src/mame/video/taitojc.c
r5613r5614
214214    if( tick >= 5 ) {
215215        tick = 0;
216216
217        if( input_code_pressed(KEYCODE_O) )
217        if( input_code_pressed(screen->machine, KEYCODE_O) )
218218            debug_tex_pal++;
219219
220        if( input_code_pressed(KEYCODE_I) )
220        if( input_code_pressed(screen->machine, KEYCODE_I) )
221221            debug_tex_pal--;
222222
223223        debug_tex_pal &= 0x7f;
src/mame/video/pitnrun.c
r5613r5614
216216   rectangle myclip=*cliprect;
217217
218218#ifdef MAME_DEBUG
219   if (input_code_pressed_once(KEYCODE_Q))
219   if (input_code_pressed_once(screen->machine, KEYCODE_Q))
220220   {
221221      UINT8 *ROM = memory_region(screen->machine, "maincpu");
222222      ROM[0x84f6]=0; /* lap 0 - normal */
223223   }
224224
225   if (input_code_pressed_once(KEYCODE_W))
225   if (input_code_pressed_once(screen->machine, KEYCODE_W))
226226   {
227227      UINT8 *ROM = memory_region(screen->machine, "maincpu");
228228      ROM[0x84f6]=6; /* lap 6 = spotlight */
229229   }
230230
231   if (input_code_pressed_once(KEYCODE_E))
231   if (input_code_pressed_once(screen->machine, KEYCODE_E))
232232   {
233233      UINT8 *ROM = memory_region(screen->machine, "maincpu");
234234      ROM[0x84f6]=2; /* lap 3 (trial 2)= lightnings */
src/mame/video/midzeus2.c
r5613r5614
107107static void zeus_pointer_write(UINT8 which, UINT32 value);
108108static int zeus_fifo_process(running_machine *machine, const UINT32 *data, int numwords);
109109static void zeus_draw_model(running_machine *machine, UINT32 baseaddr, UINT16 count, int logit);
110static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit);
110static void zeus_draw_quad(running_machine *machine, const UINT32 *databuffer, UINT32 texoffs, int logit);
111111static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
112112
113113static void log_fifo_command(const UINT32 *data, int numwords, const char *suffix);
r5613r5614
361361
362362   poly_wait(poly, "VIDEO_UPDATE");
363363
364if (input_code_pressed(KEYCODE_UP)) { zbase += 1.0f; popmessage("Zbase = %f", zbase); }
365if (input_code_pressed(KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Zbase = %f", zbase); }
364if (input_code_pressed(screen->machine, KEYCODE_UP)) { zbase += 1.0f; popmessage("Zbase = %f", zbase); }
365if (input_code_pressed(screen->machine, KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Zbase = %f", zbase); }
366366
367367   /* normal update case */
368   if (!input_code_pressed(KEYCODE_W))
368   if (!input_code_pressed(screen->machine, KEYCODE_W))
369369   {
370370      const void *base = waveram1_ptr_from_expanded_addr(zeusbase[0x38]);
371371      int xoffs = video_screen_get_visible_area(screen)->min_x;
r5613r5614
384384      static int width = 256;
385385      const UINT64 *base;
386386
387      if (input_code_pressed(KEYCODE_DOWN)) yoffs += input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
388      if (input_code_pressed(KEYCODE_UP)) yoffs -= input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
389      if (input_code_pressed(KEYCODE_LEFT) && width > 4) { width >>= 1; while (input_code_pressed(KEYCODE_LEFT)) ; }
390      if (input_code_pressed(KEYCODE_RIGHT) && width < 512) { width <<= 1; while (input_code_pressed(KEYCODE_RIGHT)) ; }
387      if (input_code_pressed(screen->machine, KEYCODE_DOWN)) yoffs += input_code_pressed(screen->machine, KEYCODE_LSHIFT) ? 0x40 : 1;
388      if (input_code_pressed(screen->machine, KEYCODE_UP)) yoffs -= input_code_pressed(screen->machine, KEYCODE_LSHIFT) ? 0x40 : 1;
389      if (input_code_pressed(screen->machine, KEYCODE_LEFT) && width > 4) { width >>= 1; while (input_code_pressed(screen->machine, KEYCODE_LEFT)) ; }
390      if (input_code_pressed(screen->machine, KEYCODE_RIGHT) && width < 512) { width <<= 1; while (input_code_pressed(screen->machine, KEYCODE_RIGHT)) ; }
391391
392392      if (yoffs < 0) yoffs = 0;
393393      base = (const UINT64 *)waveram0_ptr_from_expanded_addr(yoffs << 16);
r5613r5614
584584            UINT32 temp = zeusbase[0x38];
585585            zeusbase[0x38] = oldval;
586586            video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
587            log_fifo = input_code_pressed(KEYCODE_L);
587            log_fifo = input_code_pressed(machine, KEYCODE_L);
588588            zeusbase[0x38] = temp;
589589         }
590590         break;
r5613r5614
10101010                  break;
10111011
10121012               case 0x38:   /* crusnexo/thegrid */
1013                  zeus_draw_quad(databuffer, texoffs, logit);
1013                  zeus_draw_quad(machine, databuffer, texoffs, logit);
10141014                  break;
10151015
10161016               default:
r5613r5614
10391039 *
10401040 *************************************/
10411041
1042static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit)
1042static void zeus_draw_quad(running_machine *machine, const UINT32 *databuffer, UINT32 texoffs, int logit)
10431043{
10441044   poly_draw_scanline_func callback;
10451045   poly_extra_data *extra;
r5613r5614
10571057   if (logit)
10581058      logerror("quad\n");
10591059
1060if (input_code_pressed(KEYCODE_Q) && (texoffs & 0xffff) == 0x119) return;
1061if (input_code_pressed(KEYCODE_E) && (texoffs & 0xffff) == 0x01d) return;
1062if (input_code_pressed(KEYCODE_R) && (texoffs & 0xffff) == 0x11d) return;
1063if (input_code_pressed(KEYCODE_T) && (texoffs & 0xffff) == 0x05d) return;
1064if (input_code_pressed(KEYCODE_Y) && (texoffs & 0xffff) == 0x0dd) return;
1065//if (input_code_pressed(KEYCODE_U) && (texoffs & 0xffff) == 0x119) return;
1066//if (input_code_pressed(KEYCODE_I) && (texoffs & 0xffff) == 0x119) return;
1067//if (input_code_pressed(KEYCODE_O) && (texoffs & 0xffff) == 0x119) return;
1068//if (input_code_pressed(KEYCODE_L) && (texoffs & 0x100)) return;
1060if (input_code_pressed(machine, KEYCODE_Q) && (texoffs & 0xffff) == 0x119) return;
1061if (input_code_pressed(machine, KEYCODE_E) && (texoffs & 0xffff) == 0x01d) return;
1062if (input_code_pressed(machine, KEYCODE_R) && (texoffs & 0xffff) == 0x11d) return;
1063if (input_code_pressed(machine, KEYCODE_T) && (texoffs & 0xffff) == 0x05d) return;
1064if (input_code_pressed(machine, KEYCODE_Y) && (texoffs & 0xffff) == 0x0dd) return;
1065//if (input_code_pressed(machine, KEYCODE_U) && (texoffs & 0xffff) == 0x119) return;
1066//if (input_code_pressed(machine, KEYCODE_I) && (texoffs & 0xffff) == 0x119) return;
1067//if (input_code_pressed(machine, KEYCODE_O) && (texoffs & 0xffff) == 0x119) return;
1068//if (input_code_pressed(machine, KEYCODE_L) && (texoffs & 0x100)) return;
10691069
10701070   callback = render_poly_8bit;
10711071
src/mame/video/psikyo.c
r5613r5614
243243      tilemap_set_scroll_cols(tilemap_1_size3,1);
244244}
245245
246VIDEO_START( sngkace )
247{
248   VIDEO_START_CALL( psikyo );
246249
250   psikyo_switch_banks(0, 0); // sngkace / samuraia don't use banking
251   psikyo_switch_banks(1, 1); // They share "gfx2" to save memory on other boards
252}
247253
254
255
248256/***************************************************************************
249257
250258                                Sprites Drawing
src/mame/video/esd16.c
r5613r5614
343343   tilemap_set_scrolly(esdtilemap_1, 0, esd16_scroll_1[1]);
344344
345345#ifdef MAME_DEBUG
346if ( input_code_pressed(KEYCODE_Z) )
346if ( input_code_pressed(screen->machine, KEYCODE_Z) )
347347{   int msk = 0;
348   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
349   if (input_code_pressed(KEYCODE_W))   msk |= 2;
350   if (input_code_pressed(KEYCODE_A))   msk |= 4;
348   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
349   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
350   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 4;
351351   if (msk != 0) layers_ctrl &= msk;   }
352352#endif
353353
r5613r5614
369369
370370
371371#ifdef MAME_DEBUG
372if ( input_code_pressed(KEYCODE_Z) )
372if ( input_code_pressed(screen->machine, KEYCODE_Z) )
373373{   int msk = 0;
374   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
375   if (input_code_pressed(KEYCODE_W))   msk |= 2;
376   if (input_code_pressed(KEYCODE_A))   msk |= 4;
374   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
375   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
376   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 4;
377377   if (msk != 0) layers_ctrl &= msk;   }
378378#endif
379379
r5613r5614
431431
432432
433433#ifdef MAME_DEBUG
434if ( input_code_pressed(KEYCODE_Z) )
434if ( input_code_pressed(screen->machine, KEYCODE_Z) )
435435{   int msk = 0;
436   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
437   if (input_code_pressed(KEYCODE_W))   msk |= 2;
438   if (input_code_pressed(KEYCODE_A))   msk |= 4;
436   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
437   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
438   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 4;
439439   if (msk != 0) layers_ctrl &= msk;   }
440440#endif
441441
src/mame/video/model3.c
r5613r5614
410410   if( tick >= 5 ) {
411411      tick = 0;
412412
413      if( input_code_pressed(KEYCODE_Y) )
413      if( input_code_pressed(screen->machine, KEYCODE_Y) )
414414         debug_layer_disable ^= 0x1;
415      if( input_code_pressed(KEYCODE_U) )
415      if( input_code_pressed(screen->machine, KEYCODE_U) )
416416         debug_layer_disable ^= 0x2;
417      if( input_code_pressed(KEYCODE_I) )
417      if( input_code_pressed(screen->machine, KEYCODE_I) )
418418         debug_layer_disable ^= 0x4;
419      if( input_code_pressed(KEYCODE_O) )
419      if( input_code_pressed(screen->machine, KEYCODE_O) )
420420         debug_layer_disable ^= 0x8;
421      if( input_code_pressed(KEYCODE_T) )
421      if( input_code_pressed(screen->machine, KEYCODE_T) )
422422         debug_layer_disable ^= 0x10;
423423   }
424424
src/mame/video/st0016.c
r5613r5614
594594{
595595
596596#ifdef MAME_DEBUG
597   if(input_code_pressed_once(KEYCODE_Z))
597   if(input_code_pressed_once(screen->machine, KEYCODE_Z))
598598   {
599599      int h,j;
600600      FILE *p=fopen("vram.bin","wb");
src/mame/video/mcatadv.c
r5613r5614
225225   for (i=0; i<=3; i++)
226226   {
227227   #ifdef MAME_DEBUG
228         if (!input_code_pressed(KEYCODE_Q))
228         if (!input_code_pressed(screen->machine, KEYCODE_Q))
229229   #endif
230230         mcatadv_draw_tilemap_part(mcatadv_scroll,  mcatadv_videoram1, i, mcatadv_tilemap1, bitmap, cliprect);
231231
232232   #ifdef MAME_DEBUG
233         if (!input_code_pressed(KEYCODE_W))
233         if (!input_code_pressed(screen->machine, KEYCODE_W))
234234   #endif
235235            mcatadv_draw_tilemap_part(mcatadv_scroll2, mcatadv_videoram2, i, mcatadv_tilemap2, bitmap, cliprect);
236236   }
237237
238238   profiler_mark_start(PROFILER_USER1);
239239#ifdef MAME_DEBUG
240   if (!input_code_pressed(KEYCODE_E))
240   if (!input_code_pressed(screen->machine, KEYCODE_E))
241241#endif
242242      draw_sprites (screen->machine, bitmap, cliprect);
243243   profiler_mark_end();
src/mame/video/toaplan2.c
r5613r5614
10291029      vid_controllers = 2;
10301030   }
10311031
1032   if ( input_code_pressed_once(KEYCODE_W) )
1032   if ( input_code_pressed_once(machine, KEYCODE_W) )
10331033   {
10341034      display_tx += 1;
10351035      display_tx &= 1;
10361036      if (toaplan2_txvideoram16 != 0)
10371037         tilemap_set_enable(tx_tilemap, display_tx);
10381038   }
1039   if ( input_code_pressed_once(KEYCODE_L) )
1039   if ( input_code_pressed_once(machine, KEYCODE_L) )
10401040   {
10411041      display_sp[0] += 1;
10421042      display_sp[0] &= 1;
10431043   }
1044   if ( input_code_pressed_once(KEYCODE_K) )
1044   if ( input_code_pressed_once(machine, KEYCODE_K) )
10451045   {
10461046      display_top[0] += 1;
10471047      display_top[0] &= 1;
10481048      tilemap_set_enable(top_tilemap[0], display_top[0]);
10491049   }
1050   if ( input_code_pressed_once(KEYCODE_J) )
1050   if ( input_code_pressed_once(machine, KEYCODE_J) )
10511051   {
10521052      display_fg[0] += 1;
10531053      display_fg[0] &= 1;
10541054      tilemap_set_enable(fg_tilemap[0], display_fg[0]);
10551055   }
1056   if ( input_code_pressed_once(KEYCODE_H) )
1056   if ( input_code_pressed_once(machine, KEYCODE_H) )
10571057   {
10581058      display_bg[0] += 1;
10591059      display_bg[0] &= 1;
r5613r5614
10611061   }
10621062   if (vid_controllers == 2)
10631063   {
1064      if ( input_code_pressed_once(KEYCODE_O) )
1064      if ( input_code_pressed_once(machine, KEYCODE_O) )
10651065      {
10661066         display_sp[1] += 1;
10671067         display_sp[1] &= 1;
10681068      }
1069      if ( input_code_pressed_once(KEYCODE_I) )
1069      if ( input_code_pressed_once(machine, KEYCODE_I) )
10701070      {
10711071         display_top[1] += 1;
10721072         display_top[1] &= 1;
10731073         tilemap_set_enable(top_tilemap[1], display_top[1]);
10741074      }
1075      if ( input_code_pressed_once(KEYCODE_U) )
1075      if ( input_code_pressed_once(machine, KEYCODE_U) )
10761076      {
10771077         display_fg[1] += 1;
10781078         display_fg[1] &= 1;
10791079         tilemap_set_enable(fg_tilemap[1], display_fg[1]);
10801080      }
1081      if ( input_code_pressed_once(KEYCODE_Y) )
1081      if ( input_code_pressed_once(machine, KEYCODE_Y) )
10821082      {
10831083         display_bg[1] += 1;
10841084         display_bg[1] &= 1;
r5613r5614
11501150
11511151
11521152
1153#ifdef MAME_DEBUG
1154static void toaplan2_log_vram(void)
1153static void toaplan2_log_vram(running_machine *machine)
11551154{
1155#ifdef MAME_DEBUG
11561156   offs_t sprite_voffs, tile_voffs;
11571157   int vid_controllers = 1;
11581158
r5613r5614
11621162      vid_controllers = 2;
11631163   }
11641164
1165   if ( input_code_pressed_once(KEYCODE_M) )
1165   if ( input_code_pressed_once(machine, KEYCODE_M) )
11661166   {
11671167      UINT16 *source_now0  = (UINT16 *)(spriteram16_now[0]);
11681168      UINT16 *source_new0  = (UINT16 *)(spriteram16_new[0]);
r5613r5614
12131213         }
12141214      }
12151215   }
1216   if ( input_code_pressed_once(KEYCODE_N) )
1216   if ( input_code_pressed_once(machine, KEYCODE_N) )
12171217   {
12181218      int tchar[2], tattr[2];
12191219      logerror("Scrolls   BG-X  BG-Y   FG-X  FG-Y   TOP-X  TOP-Y   Sprite-X  Sprite-Y\n");
r5613r5614
12381238         }
12391239      }
12401240   }
1241   if ( input_code_pressed_once(KEYCODE_B) )
1241   if ( input_code_pressed_once(machine, KEYCODE_B) )
12421242   {
12431243      int tchar[2], tattr[2];
12441244      logerror("Scrolls   BG-X  BG-Y   FG-X  FG-Y   TOP-X  TOP-Y   Sprite-X  Sprite-Y\n");
r5613r5614
12631263         }
12641264      }
12651265   }
1266   if ( input_code_pressed_once(KEYCODE_V) )
1266   if ( input_code_pressed_once(machine, KEYCODE_V) )
12671267   {
12681268      int tchar[2], tattr[2];
12691269      logerror("Scrolls   BG-X  BG-Y   FG-X  FG-Y   TOP-X  TOP-Y   Sprite-X  Sprite-Y\n");
r5613r5614
12891289      }
12901290   }
12911291
1292   if ( input_code_pressed_once(KEYCODE_C) )
1292   if ( input_code_pressed_once(machine, KEYCODE_C) )
12931293      logerror("Mark here\n");
12941294
1295   if ( input_code_pressed_once(KEYCODE_E) )
1295   if ( input_code_pressed_once(machine, KEYCODE_E) )
12961296   {
12971297      displog += 1;
12981298      displog &= 1;
r5613r5614
13061306         logerror("---1-->   %04x  %04x   %04x  %04x    %04x  %04x       %04x    %04x\n", bg_scrollx[1],bg_scrolly[1],fg_scrollx[1],fg_scrolly[1],top_scrollx[1],top_scrolly[1],sprite_scrollx[1], sprite_scrolly[1]);
13071307      }
13081308   }
1309}
13101309#endif
1310}
13111311
13121312
13131313
r5613r5614
14931493{
14941494   int priority;
14951495
1496   toaplan2_log_vram(screen->machine);
14961497
1497#ifdef MAME_DEBUG
1498   toaplan2_log_vram();
1499#endif
1500
15011498   mark_sprite_priority(0);
15021499   mark_tile_priority(0);
15031500
r5613r5614
15181515{
15191516   int priority;
15201517
1518   toaplan2_log_vram(screen->machine);
15211519
1522#ifdef MAME_DEBUG
1523   toaplan2_log_vram();
1524#endif
1525
15261520   mark_sprite_priority(0);
15271521   mark_sprite_priority(1);
15281522   mark_tile_priority(0);
r5613r5614
15531547{
15541548   int priority;
15551549
1550   toaplan2_log_vram(screen->machine);
15561551
1557#ifdef MAME_DEBUG
1558   toaplan2_log_vram();
1559#endif
1560
15611552   mark_sprite_priority(0);
15621553   mark_sprite_priority(1);
15631554   mark_tile_priority(0);
r5613r5614
16011592   rectangle clip;
16021593   const rectangle *visarea = video_screen_get_visible_area(screen);
16031594
1604#ifdef MAME_DEBUG
1605   toaplan2_log_vram();
1606#endif
1595   toaplan2_log_vram(screen->machine);
16071596
16081597   mark_sprite_priority(0);
16091598   mark_tile_priority(0);
r5613r5614
16481637{
16491638   int priority;
16501639
1640   toaplan2_log_vram(screen->machine);
16511641
1652#ifdef MAME_DEBUG
1653   toaplan2_log_vram();
1654#endif
1655
16561642   mark_sprite_priority(0);
16571643   mark_tile_priority(0);
16581644
src/mame/video/galastrm.c
r5613r5614
493493#if 0
494494   if (layer[0]==0 && layer[1]==3 && layer[2]==2 && layer[3]==1)
495495   {
496      if (!input_code_pressed(KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1);
497      if (!input_code_pressed(KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,4);
498      if (!input_code_pressed(KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4);
499      if (!input_code_pressed(KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,4);
496      if (!input_code_pressed(screen->machine, KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1);
497      if (!input_code_pressed(screen->machine, KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,4);
498      if (!input_code_pressed(screen->machine, KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4);
499      if (!input_code_pressed(screen->machine, KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,4);
500500   }
501501   else
502502   {
503      if (!input_code_pressed(KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1);
504      if (!input_code_pressed(KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,2);
505      if (!input_code_pressed(KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4);
506      if (!input_code_pressed(KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,8);
503      if (!input_code_pressed(screen->machine, KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1);
504      if (!input_code_pressed(screen->machine, KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,2);
505      if (!input_code_pressed(screen->machine, KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4);
506      if (!input_code_pressed(screen->machine, KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,8);
507507   }
508508
509509   if (layer[0]==3 && layer[1]==0 && layer[2]==1 && layer[3]==2)
r5613r5614
532532   bitmap_fill(priority_bitmap, cliprect, 0);
533533   draw_sprites(screen->machine,bitmap,cliprect,primasks,0);
534534
535   if (!input_code_pressed(KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,0);
536   if (!input_code_pressed(KEYCODE_M)) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[2],0,0);
535   if (!input_code_pressed(screen->machine, KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,0);
536   if (!input_code_pressed(screen->machine, KEYCODE_M)) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[2],0,0);
537537
538538
539539#else
src/mame/video/btoads.c
r5613r5614
524524#if BT_DEBUG
525525   popmessage("screen_control = %02X", screen_control & 0x7f);
526526
527   if (input_code_pressed(KEYCODE_X))
527   if (input_code_pressed(screen->machine, KEYCODE_X))
528528   {
529529      static int count = 0;
530530      char name[10];
531531      FILE *f;
532532      int i;
533533
534      while (input_code_pressed(KEYCODE_X)) ;
534      while (input_code_pressed(screen->machine, KEYCODE_X)) ;
535535
536536      sprintf(name, "disp%d.log", count++);
537537      f = fopen(name, "w");
src/mame/video/cischeat.c
r5613r5614
872872
873873      /* dimension of a tile after zoom */
874874#ifdef MAME_DEBUG
875      if ( input_code_pressed(KEYCODE_Z) && input_code_pressed(KEYCODE_M) )
875      if ( input_code_pressed(machine, KEYCODE_Z) && input_code_pressed(machine, KEYCODE_M) )
876876      {
877877         xdim   =   16 << 16;
878878         ydim   =   16 << 16;
r5613r5614
938938      }
939939#ifdef MAME_DEBUG
940940#if 0
941if (input_code_pressed(KEYCODE_X))
941if (input_code_pressed(machine, KEYCODE_X))
942942{   /* Display some info on each sprite */
943943   sprintf(buf, "%04x",attr);
944944   ui_draw_text(buf, sx>>16, sy>>16);
r5613r5614
10281028
10291029      /* dimension of a tile after zoom */
10301030#ifdef MAME_DEBUG
1031      if ( input_code_pressed(KEYCODE_Z) && input_code_pressed(KEYCODE_M) )
1031      if ( input_code_pressed(machine, KEYCODE_Z) && input_code_pressed(machine, KEYCODE_M) )
10321032      {
10331033         xdim   =   16 << 16;
10341034         ydim   =   16 << 16;
r5613r5614
10921092      }
10931093#ifdef MAME_DEBUG
10941094#if 0
1095if (input_code_pressed(KEYCODE_X))
1095if (input_code_pressed(machine, KEYCODE_X))
10961096{   /* Display some info on each sprite */
10971097   sprintf(buf, "%04x",attr);
10981098   ui_draw_text(buf, sx>>16, sy>>16);
r5613r5614
11131113
11141114#define CISCHEAT_LAYERSCTRL \
11151115debugsprites = 0; \
1116if ( input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X) ) \
1116if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) ) \
11171117{ \
11181118   int msk = 0; \
1119   if (input_code_pressed(KEYCODE_Q))   { msk |= 0x01;} \
1120   if (input_code_pressed(KEYCODE_W))   { msk |= 0x02;} \
1121   if (input_code_pressed(KEYCODE_E))   { msk |= 0x04;} \
1122   if (input_code_pressed(KEYCODE_A))   { msk |= 0x08; debugsprites = 1;} \
1123   if (input_code_pressed(KEYCODE_S))   { msk |= 0x08; debugsprites = 2;} \
1124   if (input_code_pressed(KEYCODE_D))   { msk |= 0x08; debugsprites = 3;} \
1125   if (input_code_pressed(KEYCODE_F))   { msk |= 0x08; debugsprites = 4;} \
1126   if (input_code_pressed(KEYCODE_R))   { msk |= 0x10;} \
1127   if (input_code_pressed(KEYCODE_T))   { msk |= 0x20;} \
1119   if (input_code_pressed(screen->machine, KEYCODE_Q))   { msk |= 0x01;} \
1120   if (input_code_pressed(screen->machine, KEYCODE_W))   { msk |= 0x02;} \
1121   if (input_code_pressed(screen->machine, KEYCODE_E))   { msk |= 0x04;} \
1122   if (input_code_pressed(screen->machine, KEYCODE_A))   { msk |= 0x08; debugsprites = 1;} \
1123   if (input_code_pressed(screen->machine, KEYCODE_S))   { msk |= 0x08; debugsprites = 2;} \
1124   if (input_code_pressed(screen->machine, KEYCODE_D))   { msk |= 0x08; debugsprites = 3;} \
1125   if (input_code_pressed(screen->machine, KEYCODE_F))   { msk |= 0x08; debugsprites = 4;} \
1126   if (input_code_pressed(screen->machine, KEYCODE_R))   { msk |= 0x10;} \
1127   if (input_code_pressed(screen->machine, KEYCODE_T))   { msk |= 0x20;} \
11281128 \
11291129   if (msk != 0) megasys1_active_layers &= msk; \
11301130} \
11311131\
11321132{ \
11331133   static int show_unknown; \
1134   if ( input_code_pressed(KEYCODE_Z) && input_code_pressed_once(KEYCODE_U) ) \
1134   if ( input_code_pressed(screen->machine, KEYCODE_Z) && input_code_pressed_once(screen->machine, KEYCODE_U) ) \
11351135      show_unknown ^= 1; \
11361136   if (show_unknown) \
11371137      popmessage("0:%04X 2:%04X 4:%04X 6:%04X c:%04X", \
r5613r5614
13271327
13281328#ifdef MAME_DEBUG
13291329debugsprites = 0;
1330if ( input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X) )
1330if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) )
13311331{
13321332   int msk = 0;
1333   if (input_code_pressed(KEYCODE_Q))   { msk |= 0x1;}
1334   if (input_code_pressed(KEYCODE_W))   { msk |= 0x2;}
1335   if (input_code_pressed(KEYCODE_E))   { msk |= 0x4;}
1336   if (input_code_pressed(KEYCODE_A))   { msk |= 0x8; debugsprites = 1;}
1337   if (input_code_pressed(KEYCODE_S))   { msk |= 0x8; debugsprites = 2;}
1338   if (input_code_pressed(KEYCODE_D))   { msk |= 0x8; debugsprites = 3;}
1339   if (input_code_pressed(KEYCODE_F))   { msk |= 0x8; debugsprites = 4;}
1333   if (input_code_pressed(screen->machine, KEYCODE_Q))   { msk |= 0x1;}
1334   if (input_code_pressed(screen->machine, KEYCODE_W))   { msk |= 0x2;}
1335   if (input_code_pressed(screen->machine, KEYCODE_E))   { msk |= 0x4;}
1336   if (input_code_pressed(screen->machine, KEYCODE_A))   { msk |= 0x8; debugsprites = 1;}
1337   if (input_code_pressed(screen->machine, KEYCODE_S))   { msk |= 0x8; debugsprites = 2;}
1338   if (input_code_pressed(screen->machine, KEYCODE_D))   { msk |= 0x8; debugsprites = 3;}
1339   if (input_code_pressed(screen->machine, KEYCODE_F))   { msk |= 0x8; debugsprites = 4;}
13401340
13411341   if (msk != 0) megasys1_active_layers &= msk;
13421342#if 1
src/mame/video/namcos22.c
r5613r5614
22772277   ApplyGamma( screen->machine, bitmap );
22782278
22792279#ifdef MAME_DEBUG
2280   if( input_code_pressed(KEYCODE_D) )
2280   if( input_code_pressed(screen->machine, KEYCODE_D) )
22812281   {
22822282      FILE *f = fopen( "dump.txt", "wb" );
22832283      if( f )
r5613r5614
23092309         Dump(space, f,0xc00000, 0xc1ffff, "polygonram");
23102310         fclose( f );
23112311      }
2312      while( input_code_pressed(KEYCODE_D) ){}
2312      while( input_code_pressed(screen->machine, KEYCODE_D) ){}
23132313   }
23142314#endif
23152315   return 0;
r5613r5614
23272327   ApplyGamma( screen->machine, bitmap );
23282328
23292329#ifdef MAME_DEBUG
2330   if( input_code_pressed(KEYCODE_D) )
2330   if( input_code_pressed(screen->machine, KEYCODE_D) )
23312331   {
23322332      FILE *f = fopen( "dump.txt", "wb" );
23332333      if( f )
r5613r5614
23412341//         Dump(space, f,0x70000000, 0x7001ffff, "polygonram");
23422342         fclose( f );
23432343      }
2344      while( input_code_pressed(KEYCODE_D) ){}
2344      while( input_code_pressed(screen->machine, KEYCODE_D) ){}
23452345   }
23462346#endif
23472347   return 0;
src/mame/video/wgp.c
r5613r5614
653653#endif
654654
655655#ifdef MAME_DEBUG
656   if (input_code_pressed_once (KEYCODE_V))
656   if (input_code_pressed_once (screen->machine, KEYCODE_V))
657657   {
658658      dislayer[0] ^= 1;
659659      popmessage("piv0: %01x",dislayer[0]);
660660   }
661661
662   if (input_code_pressed_once (KEYCODE_B))
662   if (input_code_pressed_once (screen->machine, KEYCODE_B))
663663   {
664664      dislayer[1] ^= 1;
665665      popmessage("piv1: %01x",dislayer[1]);
666666   }
667667
668   if (input_code_pressed_once (KEYCODE_N))
668   if (input_code_pressed_once (screen->machine, KEYCODE_N))
669669   {
670670      dislayer[2] ^= 1;
671671      popmessage("piv2: %01x",dislayer[2]);
672672   }
673673
674   if (input_code_pressed_once (KEYCODE_M))
674   if (input_code_pressed_once (screen->machine, KEYCODE_M))
675675   {
676676      dislayer[3] ^= 1;
677677      popmessage("TC0100SCN top bg layer: %01x",dislayer[3]);
src/mame/video/ssv.c
r5613r5614
900900            }
901901
902902            #ifdef MAME_DEBUG
903            if (input_code_pressed(KEYCODE_Z))   /* Display some info on each sprite */
903            if (input_code_pressed(machine, KEYCODE_Z))   /* Display some info on each sprite */
904904            {   char buf[30];
905905               sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8);
906906               ui_draw_text(buf, sx, sy);
r5613r5614
10781078         }
10791079
10801080         #ifdef MAME_DEBUG
1081         if (input_code_pressed(KEYCODE_Z))   /* Display some info on each sprite */
1081         if (input_code_pressed(machine, KEYCODE_Z))   /* Display some info on each sprite */
10821082         {
10831083            char buf[10];
10841084            sprintf(buf, "%X",size);
src/mame/video/taitoair.c
r5613r5614
361361   bitmap_fill(bitmap, cliprect, 0x41);
362362
363363#ifdef MAME_DEBUG
364   if ( !input_code_pressed(KEYCODE_A) )
364   if ( !input_code_pressed(screen->machine, KEYCODE_A) )
365365      TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,0,0);
366   if ( !input_code_pressed(KEYCODE_S) )
366   if ( !input_code_pressed(screen->machine, KEYCODE_S) )
367367      draw_sprites(screen->machine,bitmap,cliprect,0);
368   if ( !input_code_pressed(KEYCODE_D) )
368   if ( !input_code_pressed(screen->machine, KEYCODE_D) )
369369      TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0);
370   if ( !input_code_pressed(KEYCODE_F) )
370   if ( !input_code_pressed(screen->machine, KEYCODE_F) )
371371      draw_sprites(screen->machine,bitmap,cliprect,1);
372372#else
373373   TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,0,0);
src/mame/video/metro.c
r5613r5614
923923
924924
925925#ifdef MAME_DEBUG
926if (input_code_pressed(KEYCODE_Z))
926if (input_code_pressed(screen->machine, KEYCODE_Z))
927927{
928928   int msk = 0;
929   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
930   if (input_code_pressed(KEYCODE_W))   msk |= 2;
931   if (input_code_pressed(KEYCODE_E))   msk |= 4;
932   if (input_code_pressed(KEYCODE_A))   msk |= 8;
929   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
930   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
931   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 4;
932   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
933933   if (msk != 0)
934934   {   bitmap_fill(bitmap,cliprect,0);
935935      layers_ctrl &= msk;   }
src/mame/video/midvunit.c
r5613r5614
378378
379379WRITE32_HANDLER( midvunit_dma_queue_w )
380380{
381   if (LOG_DMA && input_code_pressed(KEYCODE_L))
381   if (LOG_DMA && input_code_pressed(space->machine, KEYCODE_L))
382382      logerror("%06X:queue(%X) = %08X\n", cpu_get_pc(space->cpu), dma_data_index, data);
383383   if (dma_data_index < 16)
384384      dma_data[dma_data_index++] = data;
r5613r5614
396396{
397397   if (offset)
398398   {
399      if (LOG_DMA && input_code_pressed(KEYCODE_L))
399      if (LOG_DMA && input_code_pressed(space->machine, KEYCODE_L))
400400         logerror("%06X:trigger\n", cpu_get_pc(space->cpu));
401401      process_dma_queue(space->machine);
402402      dma_data_index = 0;
r5613r5614
418418   if ((page_control ^ data) & 1)
419419   {
420420      video_changed = TRUE;
421      if (LOG_DMA && input_code_pressed(KEYCODE_L))
421      if (LOG_DMA && input_code_pressed(space->machine, KEYCODE_L))
422422         logerror("##########################################################\n");
423423      video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen) - 1);
424424   }
src/mame/video/suna16.c
r5613r5614
228228   int layers_ctrl = -1;
229229
230230#ifdef MAME_DEBUG
231if (input_code_pressed(KEYCODE_Z))
231if (input_code_pressed(screen->machine, KEYCODE_Z))
232232{   int msk = 0;
233   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
234   if (input_code_pressed(KEYCODE_W))   msk |= 2;
233   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
234   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
235235   if (msk != 0) layers_ctrl &= msk;
236236}
237237#endif
src/mame/video/yunsung8.c
r5613r5614
189189   int layers_ctrl = (~yunsung8_layers_ctrl) >> 4;
190190
191191#ifdef MAME_DEBUG
192if (input_code_pressed(KEYCODE_Z))
192if (input_code_pressed(screen->machine, KEYCODE_Z))
193193{
194194   int msk = 0;
195   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
196   if (input_code_pressed(KEYCODE_W))   msk |= 2;
195   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
196   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
197197   if (msk != 0) layers_ctrl &= msk;
198198}
199199#endif
src/mame/video/jaguar.c
r5613r5614
656656   if (gpu_regs[PIT0])
657657   {
658658      sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(cputag_get_cpu(machine,"gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1]));
659//      timer_set(machine, sample_period, NULL, 0, jaguar_pit);
659//      timer_set(machine, sample_period, NULL, 0, jaguar_pit);
660660   }
661661}
662662#endif
663   
663
664664WRITE16_HANDLER( jaguar_tom_regs_w )
665665{
666666   UINT32 reg_store = gpu_regs[offset];
667//   attotime sample_period;
667//  attotime sample_period;
668668   if (offset < GPU_REGS)
669669   {
670670      COMBINE_DATA(&gpu_regs[offset]);
r5613r5614
825825            {
826826               UINT8 r = pen_table[(scanline[x]&0xff)|256];
827827               UINT8 g = pen_table[(scanline[x]>>8)|512];
828               UINT8 b = pen_table[scanline[x+1]&0xff];               
828               UINT8 b = pen_table[scanline[x+1]&0xff];
829829               dest[hdb++] = MAKE_RGB(r, g, b);
830830            }
831831      }
src/mame/video/holeland.c
r5613r5614
2323   int attr = colorram[tile_index];
2424   int tile_number = videoram[tile_index] | ((attr & 0x03) << 8);
2525
26/*if (input_code_pressed(KEYCODE_Q) && (attr & 0x10)) tile_number = rand(); */
27/*if (input_code_pressed(KEYCODE_W) && (attr & 0x20)) tile_number = rand(); */
28/*if (input_code_pressed(KEYCODE_E) && (attr & 0x40)) tile_number = rand(); */
29/*if (input_code_pressed(KEYCODE_R) && (attr & 0x80)) tile_number = rand(); */
26/*if (input_code_pressed(machine, KEYCODE_Q) && (attr & 0x10)) tile_number = rand(); */
27/*if (input_code_pressed(machine, KEYCODE_W) && (attr & 0x20)) tile_number = rand(); */
28/*if (input_code_pressed(machine, KEYCODE_E) && (attr & 0x40)) tile_number = rand(); */
29/*if (input_code_pressed(machine, KEYCODE_R) && (attr & 0x80)) tile_number = rand(); */
3030   SET_TILE_INFO(
3131         0,
3232         tile_number,
src/mame/video/seta.c
r5613r5614
965965
966966
967967#ifdef MAME_DEBUG
968if (input_code_pressed(KEYCODE_Z))
968if (input_code_pressed(screen->machine, KEYCODE_Z))
969969{   int msk = 0;
970   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
971   if (input_code_pressed(KEYCODE_W))   msk |= 2;
972   if (input_code_pressed(KEYCODE_A))   msk |= 8;
970   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
971   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
972   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
973973   if (msk != 0) layers_ctrl &= msk;
974974
975975   if (tilemap_2)      popmessage("VR:%04X-%04X-%04X L0:%04X L1:%04X",seta_vregs[0],seta_vregs[1],seta_vregs[2],seta_vctrl_0[4/2],seta_vctrl_2[4/2]);
src/mame/video/deco16ic.c
r5613r5614
800800
801801/*****************************************************************************************/
802802
803void deco16_print_debug_info(bitmap_t *bitmap)
803void deco16_print_debug_info(running_machine *machine, bitmap_t *bitmap)
804804{
805805   char buf[64*5];
806806
807   if (input_code_pressed(KEYCODE_O))
807   if (input_code_pressed(machine, KEYCODE_O))
808808      return;
809809
810810   if (deco16_pf12_control) {
src/mame/video/unico.c
r5613r5614
346346   tilemap_set_scrollx(tilemap_2, 0, *unico_scrollx_2);
347347
348348#ifdef MAME_DEBUG
349if ( input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X) )
349if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) )
350350{
351351   int msk = 0;
352   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
353   if (input_code_pressed(KEYCODE_W))   msk |= 2;
354   if (input_code_pressed(KEYCODE_E))   msk |= 4;
355   if (input_code_pressed(KEYCODE_A))   msk |= 8;
352   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
353   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
354   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 4;
355   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
356356   if (msk != 0) layers_ctrl &= msk;
357357}
358358#endif
r5613r5614
385385   tilemap_set_scrolly(tilemap_2, 0, unico_scroll32[1] >> 16);
386386
387387#ifdef MAME_DEBUG
388if ( input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X) )
388if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) )
389389{
390390   int msk = 0;
391   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
392   if (input_code_pressed(KEYCODE_W))   msk |= 2;
393   if (input_code_pressed(KEYCODE_E))   msk |= 4;
394   if (input_code_pressed(KEYCODE_A))   msk |= 8;
391   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
392   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
393   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 4;
394   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
395395   if (msk != 0) layers_ctrl &= msk;
396396}
397397#endif
src/mame/video/gcpinbal.c
r5613r5614
281281#endif
282282
283283#ifdef MAME_DEBUG
284   if (input_code_pressed_once (KEYCODE_V))
284   if (input_code_pressed_once (screen->machine, KEYCODE_V))
285285   {
286286      dislayer[0] ^= 1;
287287      popmessage("bg0: %01x",dislayer[0]);
288288   }
289289
290   if (input_code_pressed_once (KEYCODE_B))
290   if (input_code_pressed_once (screen->machine, KEYCODE_B))
291291   {
292292      dislayer[1] ^= 1;
293293      popmessage("bg1: %01x",dislayer[1]);
294294   }
295295
296   if (input_code_pressed_once (KEYCODE_N))
296   if (input_code_pressed_once (screen->machine, KEYCODE_N))
297297   {
298298      dislayer[2] ^= 1;
299299      popmessage("fg: %01x",dislayer[2]);
src/mame/video/realbrk.c
r5613r5614
502502   tilemap_set_scrollx(tilemap_1, 0, realbrk_vregs[0x6/2]);
503503
504504#ifdef MAME_DEBUG
505if ( input_code_pressed(KEYCODE_Z) )
505if ( input_code_pressed(screen->machine, KEYCODE_Z) )
506506{   int msk = 0;
507   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
508   if (input_code_pressed(KEYCODE_W))   msk |= 2;
509   if (input_code_pressed(KEYCODE_E))   msk |= 4;
510   if (input_code_pressed(KEYCODE_A))   msk |= 8;
507   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
508   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
509   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 4;
510   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
511511   if (msk != 0) layers_ctrl &= msk;   }
512512#endif
513513
r5613r5614
570570   tilemap_set_scrolly( tilemap_1, 0, bgy1 );
571571
572572#ifdef MAME_DEBUG
573if ( input_code_pressed(KEYCODE_Z) )
573if ( input_code_pressed(screen->machine, KEYCODE_Z) )
574574{   int msk = 0;
575   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
576   if (input_code_pressed(KEYCODE_W))   msk |= 2;
577   if (input_code_pressed(KEYCODE_E))   msk |= 4;
578   if (input_code_pressed(KEYCODE_A))   msk |= 8;
575   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
576   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
577   if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= 4;
578   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
579579   if (msk != 0) layers_ctrl &= msk;   }
580580#endif
581581
src/mame/video/superchs.c
r5613r5614
231231       sprites as pdrawgfx cannot yet cope with more than 4 layers */
232232
233233#ifdef MAME_DEBUG
234   if (!input_code_pressed (KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],TILEMAP_DRAW_OPAQUE,0);
235   if (!input_code_pressed (KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,1);
236   if (!input_code_pressed (KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[2],0,2);
237   if (!input_code_pressed (KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[3],0,4);
238   if (!input_code_pressed (KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,8);
239   if (!input_code_pressed (KEYCODE_N)) draw_sprites(screen->machine,bitmap,cliprect,primasks,48,-116);
234   if (!input_code_pressed (screen->machine, KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],TILEMAP_DRAW_OPAQUE,0);
235   if (!input_code_pressed (screen->machine, KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,1);
236   if (!input_code_pressed (screen->machine, KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[2],0,2);
237   if (!input_code_pressed (screen->machine, KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[3],0,4);
238   if (!input_code_pressed (screen->machine, KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,8);
239   if (!input_code_pressed (screen->machine, KEYCODE_N)) draw_sprites(screen->machine,bitmap,cliprect,primasks,48,-116);
240240#else
241241   TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],TILEMAP_DRAW_OPAQUE,0);
242242   TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,1);
src/mame/video/taito_h.c
r5613r5614
396396
397397
398398
399#ifdef MAME_DEBUG
400
401static void taitoh_log_vram(void)
399static void taitoh_log_vram(running_machine *machine)
402400{
401#ifdef MAME_DEBUG
403402   // null function: the necessary pointers are now internal to taitoic.c
404403   // Recreate it there if wanted (add prototype to taitoic.h)
404#endif
405405}
406406
407#endif
408407
409
410408/**************************************************************************/
411409
412410VIDEO_UPDATE( syvalion )
413411{
414412   TC0080VCO_tilemap_update(screen->machine);
415413
416#ifdef MAME_DEBUG
417   taitoh_log_vram();
418#endif
414   taitoh_log_vram(screen->machine);
419415
420416   bitmap_fill(bitmap, cliprect, 0);
421417
r5613r5614
431427{
432428   TC0080VCO_tilemap_update(screen->machine);
433429
434#ifdef MAME_DEBUG
435   taitoh_log_vram();
436#endif
430   taitoh_log_vram(screen->machine);
437431
438432   bitmap_fill(bitmap, cliprect, 0);
439433
440434#ifdef MAME_DEBUG
441   if ( !input_code_pressed(KEYCODE_A) )
435   if ( !input_code_pressed(screen->machine, KEYCODE_A) )
442436      TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0);
443   if ( !input_code_pressed(KEYCODE_S) )
437   if ( !input_code_pressed(screen->machine, KEYCODE_S) )
444438      recordbr_draw_sprites(screen->machine,bitmap,cliprect,0);
445   if ( !input_code_pressed(KEYCODE_D) )
439   if ( !input_code_pressed(screen->machine, KEYCODE_D) )
446440      TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0);
447   if ( !input_code_pressed(KEYCODE_F) )
441   if ( !input_code_pressed(screen->machine, KEYCODE_F) )
448442      recordbr_draw_sprites(screen->machine,bitmap,cliprect,1);
449443#else
450444   TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0);
r5613r5614
462456{
463457   TC0080VCO_tilemap_update(screen->machine);
464458
465#ifdef MAME_DEBUG
466   taitoh_log_vram();
467#endif
459   taitoh_log_vram(screen->machine);
468460
469461   bitmap_fill(bitmap, cliprect, 0);
470462
471463#ifdef MAME_DEBUG
472   if ( !input_code_pressed(KEYCODE_A) )
464   if ( !input_code_pressed(screen->machine, KEYCODE_A) )
473465      TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0);
474   if ( !input_code_pressed(KEYCODE_S) )
466   if ( !input_code_pressed(screen->machine, KEYCODE_S) )
475467      dleague_draw_sprites(screen->machine,bitmap,cliprect,0);
476   if ( !input_code_pressed(KEYCODE_D) )
468   if ( !input_code_pressed(screen->machine, KEYCODE_D) )
477469      TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0);
478   if ( !input_code_pressed(KEYCODE_F) )
470   if ( !input_code_pressed(screen->machine, KEYCODE_F) )
479471      dleague_draw_sprites(screen->machine,bitmap,cliprect,1);
480472#else
481473   TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0);
src/mame/video/ginganin.c
r5613r5614
250250   layers_ctrl1 = layers_ctrl;
251251
252252#ifdef MAME_DEBUG
253if (input_code_pressed(KEYCODE_Z))
253if (input_code_pressed(screen->machine, KEYCODE_Z))
254254{
255255   int msk = 0;
256256   static int posx,posy;
257257
258   if (input_code_pressed(KEYCODE_Q)) { msk |= 0xfff1;}
259   if (input_code_pressed(KEYCODE_W)) { msk |= 0xfff2;}
260   if (input_code_pressed(KEYCODE_E)) { msk |= 0xfff4;}
261   if (input_code_pressed(KEYCODE_A))   { msk |= 0xfff8;}
258   if (input_code_pressed(screen->machine, KEYCODE_Q)) { msk |= 0xfff1;}
259   if (input_code_pressed(screen->machine, KEYCODE_W)) { msk |= 0xfff2;}
260   if (input_code_pressed(screen->machine, KEYCODE_E)) { msk |= 0xfff4;}
261   if (input_code_pressed(screen->machine, KEYCODE_A))   { msk |= 0xfff8;}
262262   if (msk != 0) layers_ctrl1 &= msk;
263263
264264#define SETSCROLL \
r5613r5614
268268   tilemap_set_scrolly(fg_tilemap, 0, posy); \
269269   popmessage("B>%04X:%04X F>%04X:%04X",posx%(BG_NX*16),posy%(BG_NY*16),posx%(FG_NX*16),posy%(FG_NY*16));
270270
271   if (input_code_pressed(KEYCODE_L))   { posx +=8; SETSCROLL }
272   if (input_code_pressed(KEYCODE_J))   { posx -=8; SETSCROLL }
273   if (input_code_pressed(KEYCODE_K))   { posy +=8; SETSCROLL }
274   if (input_code_pressed(KEYCODE_I))   { posy -=8; SETSCROLL }
275   if (input_code_pressed(KEYCODE_H))   { posx = posy = 0;   SETSCROLL }
271   if (input_code_pressed(screen->machine, KEYCODE_L))   { posx +=8; SETSCROLL }
272   if (input_code_pressed(screen->machine, KEYCODE_J))   { posx -=8; SETSCROLL }
273   if (input_code_pressed(screen->machine, KEYCODE_K))   { posy +=8; SETSCROLL }
274   if (input_code_pressed(screen->machine, KEYCODE_I))   { posy -=8; SETSCROLL }
275   if (input_code_pressed(screen->machine, KEYCODE_H))   { posx = posy = 0;   SETSCROLL }
276276
277277}
278278#endif
src/mame/video/slapshot.c
r5613r5614
520520#endif
521521
522522#ifdef MAME_DEBUG
523   if (input_code_pressed_once (KEYCODE_Z))
523   if (input_code_pressed_once (screen->machine, KEYCODE_Z))
524524   {
525525      dislayer[0] ^= 1;
526526      popmessage("bg0: %01x",dislayer[0]);
527527   }
528528
529   if (input_code_pressed_once (KEYCODE_X))
529   if (input_code_pressed_once (screen->machine, KEYCODE_X))
530530   {
531531      dislayer[1] ^= 1;
532532      popmessage("bg1: %01x",dislayer[1]);
533533   }
534534
535   if (input_code_pressed_once (KEYCODE_C))
535   if (input_code_pressed_once (screen->machine, KEYCODE_C))
536536   {
537537      dislayer[2] ^= 1;
538538      popmessage("bg2: %01x",dislayer[2]);
539539   }
540540
541   if (input_code_pressed_once (KEYCODE_V))
541   if (input_code_pressed_once (screen->machine, KEYCODE_V))
542542   {
543543      dislayer[3] ^= 1;
544544      popmessage("bg3: %01x",dislayer[3]);
545545   }
546546
547   if (input_code_pressed_once (KEYCODE_B))
547   if (input_code_pressed_once (screen->machine, KEYCODE_B))
548548   {
549549      dislayer[4] ^= 1;
550550      popmessage("text: %01x",dislayer[4]);
src/mame/video/tsamurai.c
r5613r5614
260260{
261261   #ifdef MAME_DEBUG
262262   static int k;
263   if( input_code_pressed( KEYCODE_Q ) ){
264      while( input_code_pressed( KEYCODE_Q ) ){
263   if( input_code_pressed( screen->machine, KEYCODE_Q ) ){
264      while( input_code_pressed( screen->machine, KEYCODE_Q ) ){
265265         k++;
266266         vsgongf_color = k;
267267         tilemap_mark_all_tiles_dirty( foreground );
src/mame/video/namcos2.c
r5613r5614
207207{
208208   COMBINE_DATA(&namcos2_68k_roz_ram[offset]);
209209   tilemap_mark_tile_dirty(tilemap_roz,offset);
210//      if( input_code_pressed(KEYCODE_Q) )
210//      if( input_code_pressed(space->machine, KEYCODE_Q) )
211211//      {
212212//          debugger_break(space->machine);
213213//      }
src/mame/video/konamiic.c
r5613r5614
13071307   K007121_ctrlram[0][0x00],K007121_ctrlram[0][0x01],K007121_ctrlram[0][0x02],K007121_ctrlram[0][0x03],K007121_ctrlram[0][0x04],K007121_ctrlram[0][0x05],K007121_ctrlram[0][0x06],K007121_ctrlram[0][0x07],
13081308   K007121_ctrlram[1][0x00],K007121_ctrlram[1][0x01],K007121_ctrlram[1][0x02],K007121_ctrlram[1][0x03],K007121_ctrlram[1][0x04],K007121_ctrlram[1][0x05],K007121_ctrlram[1][0x06],K007121_ctrlram[1][0x07]);
13091309
1310if (input_code_pressed(KEYCODE_D))
1310if (input_code_pressed(gfx->machine, KEYCODE_D))
13111311{
13121312   FILE *fp;
13131313   fp=fopen(chip?"SPRITE1.DMP":"SPRITE0.DMP", "w+b");
r5613r5614
16461646   {
16471647      static int current_layer = 0;
16481648
1649      if (input_code_pressed_once(KEYCODE_Z)) current_layer = !current_layer;
1649      if (input_code_pressed_once(machine, KEYCODE_Z)) current_layer = !current_layer;
16501650      tilemap_set_enable(K007342_tilemap[current_layer], 1);
16511651      tilemap_set_enable(K007342_tilemap[!current_layer], 0);
16521652
r5613r5614
18551855   {
18561856      static int current_sprite = 0;
18571857
1858      if (input_code_pressed_once(KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1);
1859      if (input_code_pressed_once(KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1);
1858      if (input_code_pressed_once(machine, KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1);
1859      if (input_code_pressed_once(machine, KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1);
18601860
18611861      popmessage("%02x:%02x %02x %02x %02x %02x %02x %02x %02x", current_sprite,
18621862         K007420_ram[(current_sprite*8)+0], K007420_ram[(current_sprite*8)+1],
r5613r5614
24142414      (K052109_scrollctrl & 0xc0) != 0)
24152415   popmessage("scrollcontrol = %02x",K052109_scrollctrl);
24162416
2417if (input_code_pressed(KEYCODE_F))
2417if (input_code_pressed(machine, KEYCODE_F))
24182418{
24192419   FILE *fp;
24202420   fp=fopen("TILE.DMP", "w+b");
r5613r5614
28722872      }
28732873   }
28742874#if 0
2875if (input_code_pressed(KEYCODE_D))
2875if (input_code_pressed(machine, KEYCODE_D))
28762876{
28772877   FILE *fp;
28782878   fp=fopen("SPRITE.DMP", "w+b");
r5613r5614
34403440      }
34413441   }
34423442#if 0
3443if (input_code_pressed(KEYCODE_D))
3443if (input_code_pressed(machine, KEYCODE_D))
34443444{
34453445   FILE *fp;
34463446   fp=fopen("SPRITE.DMP", "w+b");
r5613r5614
36773677      }
36783678   }
36793679#if 0
3680if (input_code_pressed(KEYCODE_D))
3680if (input_code_pressed(machine, KEYCODE_D))
36813681{
36823682   FILE *fp;
36833683   fp=fopen("SPRITE.DMP", "w+b");
r5613r5614
50135013   }
50145014
50155015#if 0
5016if (input_code_pressed(KEYCODE_D))
5016if (input_code_pressed(machine, KEYCODE_D))
50175017   popmessage("%04x %04x %04x %04x\n%04x %04x %04x %04x\n%04x %04x %04x %04x\n%04x %04x %04x %04x",
50185018         ctrl[0x00],
50195019         ctrl[0x01],
r5613r5614
78447844   if(chip && ++kk == 3) {
78457845      int kx=0, kkc = 0;
78467846      kk = 0;
7847      if(input_code_pressed(KEYCODE_Y)) {
7847      if(input_code_pressed(machine, KEYCODE_Y)) {
78487848         kx = 1;
78497849         kc--;
78507850         if(kc<-1)
78517851            kc = 511;
78527852      }
7853      if(input_code_pressed(KEYCODE_U)) {
7853      if(input_code_pressed(machine, KEYCODE_U)) {
78547854         kx = 1;
78557855         kc++;
78567856         if(kc==512)
78577857            kc = -1;
78587858      }
78597859
7860      if(input_code_pressed(KEYCODE_T)) {
7860      if(input_code_pressed(machine, KEYCODE_T)) {
78617861         kkc = 1;
78627862         kyy--;
78637863      }
7864      if(input_code_pressed(KEYCODE_V)) {
7864      if(input_code_pressed(machine, KEYCODE_V)) {
78657865         kkc = 1;
78667866         kyy++;
78677867      }
7868      if(input_code_pressed(KEYCODE_F)) {
7868      if(input_code_pressed(machine, KEYCODE_F)) {
78697869         kkc = 1;
78707870         kxx--;
78717871      }
7872      if(input_code_pressed(KEYCODE_G)) {
7872      if(input_code_pressed(machine, KEYCODE_G)) {
78737873         kkc = 1;
78747874         kxx++;
78757875      }
src/mame/video/blmbycar.c
r5613r5614
230230   tilemap_set_scrollx( tilemap_1, 0, blmbycar_scroll_1[ 1 ]+5);
231231
232232#ifdef MAME_DEBUG
233if (input_code_pressed(KEYCODE_Z))
233if (input_code_pressed(screen->machine, KEYCODE_Z))
234234{
235235   int msk = 0;
236236
237   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
238   if (input_code_pressed(KEYCODE_W))   msk |= 2;
239//  if (input_code_pressed(KEYCODE_E))    msk |= 4;
240   if (input_code_pressed(KEYCODE_A))   msk |= 8;
237   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
238   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
239//  if (input_code_pressed(screen->machine, KEYCODE_E))    msk |= 4;
240   if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 8;
241241   if (msk != 0) layers_ctrl &= msk;
242242}
243243#endif
src/mame/video/pokechmp.c
r5613r5614
5858
5959         drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
6060               spriteram[offs+3] + ((spriteram[offs+1] & 1) << 8),
61               (spriteram[offs+1] & 0x70) >> 4,
61               (spriteram[offs+1] & 0xf0) >> 4,
6262               flipx,flipy,
6363               sx,sy,0);
6464      }
src/mame/video/topspeed.c
r5613r5614
125125#endif
126126
127127#ifdef MAME_DEBUG
128   if (input_code_pressed_once (KEYCODE_V))
128   if (input_code_pressed_once (screen->machine, KEYCODE_V))
129129   {
130130      dislayer[0] ^= 1;
131131      popmessage("bg: %01x",dislayer[0]);
132132   }
133133
134   if (input_code_pressed_once (KEYCODE_B))
134   if (input_code_pressed_once (screen->machine, KEYCODE_B))
135135   {
136136      dislayer[1] ^= 1;
137137      popmessage("fg: %01x",dislayer[1]);
138138   }
139139
140   if (input_code_pressed_once (KEYCODE_N))
140   if (input_code_pressed_once (screen->machine, KEYCODE_N))
141141   {
142142      dislayer[2] ^= 1;
143143      popmessage("bg2: %01x",dislayer[2]);
144144   }
145145
146   if (input_code_pressed_once (KEYCODE_M))
146   if (input_code_pressed_once (screen->machine, KEYCODE_M))
147147   {
148148      dislayer[3] ^= 1;
149149      popmessage("fg2: %01x",dislayer[3]);
150150   }
151151
152   if (input_code_pressed_once (KEYCODE_C))
152   if (input_code_pressed_once (screen->machine, KEYCODE_C))
153153   {
154154      dislayer[4] ^= 1;
155155      popmessage("sprites: %01x",dislayer[4]);
src/mame/video/gunbustr.c
r5613r5614
234234       sprites as pdrawgfx cannot yet cope with more than 4 layers */
235235
236236#ifdef MAME_DEBUG
237   if (!input_code_pressed (KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],TILEMAP_DRAW_OPAQUE,0);
238   if (!input_code_pressed (KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,1);
239   if (!input_code_pressed (KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[2],0,2);
240   if (!input_code_pressed (KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[3],0,4);
241   if (!input_code_pressed (KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,8);
242   if (!input_code_pressed (KEYCODE_N)) draw_sprites(screen->machine,bitmap,cliprect,primasks,48,-116);
237   if (!input_code_pressed (screen->machine, KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],TILEMAP_DRAW_OPAQUE,0);
238   if (!input_code_pressed (screen->machine, KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,1);
239   if (!input_code_pressed (screen->machine, KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[2],0,2);
240   if (!input_code_pressed (screen->machine, KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[3],0,4);
241   if (!input_code_pressed (screen->machine, KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,8);
242   if (!input_code_pressed (screen->machine, KEYCODE_N)) draw_sprites(screen->machine,bitmap,cliprect,primasks,48,-116);
243243#else
244244   TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],TILEMAP_DRAW_OPAQUE,0);
245245   TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,1);
src/mame/video/dday.c
r5613r5614
297297
298298   /* bit 4 is sound enable */
299299   if (!(data & 0x10) && (control & 0x10))
300      devtag_reset(space->machine, "ay");
300      devtag_reset(space->machine, "ay1");
301301
302   sound_global_enable(data & 0x10);
302   sound_global_enable(space->machine, data & 0x10);
303303
304304   /* bit 6 is search light enable */
305305   sl_enable = data & 0x40;
src/mame/video/segas32.c
r5613r5614
954954   /* configure the layer */
955955   opaque = 0;
956956//opaque = (system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1;
957//if (input_code_pressed(KEYCODE_Z) && bgnum == 0) opaque = 1;
958//if (input_code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1;
957//if (input_code_pressed(screen->machine, KEYCODE_Z) && bgnum == 0) opaque = 1;
958//if (input_code_pressed(screen->machine, KEYCODE_X) && bgnum == 1) opaque = 1;
959959
960960   /* determine if we're flipped */
961961   flip = ((system32_videoram[0x1ff00/2] >> 9) ^ (system32_videoram[0x1ff00/2] >> bgnum)) & 1;
r5613r5614
11081108   /* configure the layer */
11091109   opaque = 0;
11101110//opaque = (system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1;
1111//if (input_code_pressed(KEYCODE_C) && bgnum == 2) opaque = 1;
1112//if (input_code_pressed(KEYCODE_V) && bgnum == 3) opaque = 1;
1111//if (input_code_pressed(screen->machine, KEYCODE_C) && bgnum == 2) opaque = 1;
1112//if (input_code_pressed(screen->machine, KEYCODE_V) && bgnum == 3) opaque = 1;
11131113
11141114   /* determine if we're flipped */
11151115   flip = ((system32_videoram[0x1ff00/2] >> 9) ^ (system32_videoram[0x1ff00/2] >> bgnum)) & 1;
r5613r5614
24662466
24672467   /* debugging */
24682468#if QWERTY_LAYER_ENABLE
2469   if (input_code_pressed(KEYCODE_Q)) enablemask = 0x01;
2470   if (input_code_pressed(KEYCODE_W)) enablemask = 0x02;
2471   if (input_code_pressed(KEYCODE_E)) enablemask = 0x04;
2472   if (input_code_pressed(KEYCODE_R)) enablemask = 0x08;
2473   if (input_code_pressed(KEYCODE_T)) enablemask = 0x10;
2474   if (input_code_pressed(KEYCODE_Y)) enablemask = 0x20;
2469   if (input_code_pressed(screen->machine, KEYCODE_Q)) enablemask = 0x01;
2470   if (input_code_pressed(screen->machine, KEYCODE_W)) enablemask = 0x02;
2471   if (input_code_pressed(screen->machine, KEYCODE_E)) enablemask = 0x04;
2472   if (input_code_pressed(screen->machine, KEYCODE_R)) enablemask = 0x08;
2473   if (input_code_pressed(screen->machine, KEYCODE_T)) enablemask = 0x10;
2474   if (input_code_pressed(screen->machine, KEYCODE_Y)) enablemask = 0x20;
24752475#endif
24762476
24772477   /* do the mixing */
r5613r5614
24792479   mix_all_layers(0, 0, bitmap, cliprect, enablemask);
24802480   profiler_mark_end();
24812481
2482   if (LOG_SPRITES && input_code_pressed(KEYCODE_L))
2482   if (LOG_SPRITES && input_code_pressed(screen->machine, KEYCODE_L))
24832483   {
24842484      const rectangle *visarea = video_screen_get_visible_area(screen);
24852485      FILE *f = fopen("sprite.txt", "w");
r5613r5614
25572557{
25582558   int showclip = -1;
25592559
2560//  if (input_code_pressed(KEYCODE_V))
2560//  if (input_code_pressed(screen->machine, KEYCODE_V))
25612561//      showclip = 0;
2562//  if (input_code_pressed(KEYCODE_B))
2562//  if (input_code_pressed(screen->machine, KEYCODE_B))
25632563//      showclip = 1;
2564//  if (input_code_pressed(KEYCODE_N))
2564//  if (input_code_pressed(screen->machine, KEYCODE_N))
25652565//      showclip = 2;
2566//  if (input_code_pressed(KEYCODE_M))
2566//  if (input_code_pressed(screen->machine, KEYCODE_M))
25672567//      showclip = 3;
25682568//  if (showclip != -1)
25692569for (showclip = 0; showclip < 4; showclip++)
r5613r5614
26462646
26472647   /* debugging */
26482648#if QWERTY_LAYER_ENABLE
2649   if (input_code_pressed(KEYCODE_Q)) enablemask = 0x01;
2650   if (input_code_pressed(KEYCODE_W)) enablemask = 0x02;
2651   if (input_code_pressed(KEYCODE_E)) enablemask = 0x04;
2652   if (input_code_pressed(KEYCODE_R)) enablemask = 0x08;
2653   if (input_code_pressed(KEYCODE_T)) enablemask = 0x10;
2654   if (input_code_pressed(KEYCODE_Y)) enablemask = 0x20;
2649   if (input_code_pressed(screen->machine, KEYCODE_Q)) enablemask = 0x01;
2650   if (input_code_pressed(screen->machine, KEYCODE_W)) enablemask = 0x02;
2651   if (input_code_pressed(screen->machine, KEYCODE_E)) enablemask = 0x04;
2652   if (input_code_pressed(screen->machine, KEYCODE_R)) enablemask = 0x08;
2653   if (input_code_pressed(screen->machine, KEYCODE_T)) enablemask = 0x10;
2654   if (input_code_pressed(screen->machine, KEYCODE_Y)) enablemask = 0x20;
26552655#endif
26562656
26572657   /* do the mixing */
r5613r5614
26612661
26622662if (PRINTF_MIXER_DATA)
26632663{
2664   if (!input_code_pressed(KEYCODE_M)) print_mixer_data(0);
2664   if (!input_code_pressed(screen->machine, KEYCODE_M)) print_mixer_data(0);
26652665   else print_mixer_data(1);
26662666}
2667   if (LOG_SPRITES && input_code_pressed(KEYCODE_L))
2667   if (LOG_SPRITES && input_code_pressed(screen->machine, KEYCODE_L))
26682668   {
26692669      const rectangle *visarea = video_screen_get_visible_area(screen);
26702670      FILE *f = fopen("sprite.txt", "w");
src/mame/video/slapfght.c
r5613r5614
132132   slapfight_palette_bank = offset;
133133}
134134
135#ifdef MAME_DEBUG
136static void slapfght_log_vram(void)
135static void slapfght_log_vram(running_machine *machine)
137136{
138   if ( input_code_pressed_once(KEYCODE_B) )
137#ifdef MAME_DEBUG
138   if ( input_code_pressed_once(machine, KEYCODE_B) )
139139   {
140140      int i;
141141      for (i=0; i<0x800; i++)
r5613r5614
143143         logerror("Offset:%03x   TileRAM:%02x   AttribRAM:%02x   SpriteRAM:%02x\n",i, videoram[i],colorram[i],spriteram[i]);
144144      }
145145   }
146}
147146#endif
147}
148148
149149/***************************************************************************
150150
r5613r5614
199199   tilemap_draw(bitmap,cliprect,pf1_tilemap,0,0);
200200   draw_sprites(screen->machine, bitmap,cliprect,0x80);
201201
202#ifdef MAME_DEBUG
203   slapfght_log_vram();
204#endif
202   slapfght_log_vram(screen->machine);
205203   return 0;
206204}
207205
r5613r5614
245243
246244   tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
247245
248#ifdef MAME_DEBUG
249   slapfght_log_vram();
250#endif
246   slapfght_log_vram(screen->machine);
251247   return 0;
252248}
src/mame/video/psikyosh.c
r5613r5614
10511051
10521052#if 0
10531053#ifdef MAME_DEBUG
1054            if (input_code_pressed(KEYCODE_Z))   /* Display some info on each sprite */
1054            if (input_code_pressed(machine, KEYCODE_Z))   /* Display some info on each sprite */
10551055            {
10561056               char buf[10];
10571057               int x, y;
src/mame/video/decocass.c
r5613r5614
537537#ifdef MAME_DEBUG
538538   {
539539      static int showmsg;
540      if (input_code_pressed_once(KEYCODE_I))
540      if (input_code_pressed_once(screen->machine, KEYCODE_I))
541541         showmsg ^= 1;
542542      if (showmsg)
543543         popmessage("mode:$%02x cm:$%02x ccb:$%02x h:$%02x vl:$%02x vr:$%02x ph:$%02x pv:$%02x ch:$%02x cv:$%02x",
src/mame/video/konamigx.c
r5613r5614
493493   {
494494      const pen_t *paldata = screen->machine->pens;
495495
496      if ( input_code_pressed(KEYCODE_W) )
496      if ( input_code_pressed(screen->machine, KEYCODE_W) )
497497      {
498498         int y,x;
499499
src/mame/video/fuukifg2.c
r5613r5614
223223
224224#ifdef MAME_DEBUG
225225#if 0
226if (input_code_pressed(KEYCODE_X))
226if (input_code_pressed(screen->machine, KEYCODE_X))
227227{   /* Display some info on each sprite */
228228   char buf[40];
229229   sprintf(buf, "%Xx%X %X",xnum,ynum,(attr>>6)&3);
src/mame/video/twin16.c
r5613r5614
3838enum
3939{
4040   // user-defined priorities
41   TWIN16_BG_LAYER1      = 0x01,
41   TWIN16_BG_LAYER1         = 0x01,
4242   TWIN16_SPRITE_PRI_L1      = 0x02,
43   TWIN16_BG_LAYER2      = 0x04,
43   TWIN16_BG_LAYER2         = 0x04,
4444   TWIN16_SPRITE_PRI_L2      = 0x08,
4545   TWIN16_SPRITE_OCCUPIED      = 0x10, // sprite on screen pixel
4646   TWIN16_SPRITE_CAST_SHADOW   = 0x20
r5613r5614
497497   text_tilemap = tilemap_create(machine, get_text_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
498498   tilemap_set_transparent_pen(text_tilemap, 0);
499499
500   palette_set_shadow_factor(machine,0.4); // screenshots estimate
501
500502   memset(twin16_sprite_buffer,0xff,0x800*sizeof(UINT16));
501503   twin16_sprite_busy = 0;
502504   twin16_sprite_timer = timer_alloc(machine, twin16_sprite_tick, NULL);
src/mame/video/cave.c
r5613r5614
14911491#ifdef MAME_DEBUG
14921492{
14931493   static int rasflag, old_rasflag;
1494   if ( input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X) || input_code_pressed(KEYCODE_C) ||
1495        input_code_pressed(KEYCODE_V) || input_code_pressed(KEYCODE_B) )
1494   if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) || input_code_pressed(screen->machine, KEYCODE_C) ||
1495        input_code_pressed(screen->machine, KEYCODE_V) || input_code_pressed(screen->machine, KEYCODE_B) )
14961496   {
14971497      int msk = 0, val = 0;
14981498
1499      if (input_code_pressed(KEYCODE_X))   val = 1;   // priority 0 only
1500      if (input_code_pressed(KEYCODE_C))   val = 2;   // ""       1
1501      if (input_code_pressed(KEYCODE_V))   val = 4;   // ""       2
1502      if (input_code_pressed(KEYCODE_B))   val = 8;   // ""       3
1499      if (input_code_pressed(screen->machine, KEYCODE_X))   val = 1;   // priority 0 only
1500      if (input_code_pressed(screen->machine, KEYCODE_C))   val = 2;   // ""       1
1501      if (input_code_pressed(screen->machine, KEYCODE_V))   val = 4;   // ""       2
1502      if (input_code_pressed(screen->machine, KEYCODE_B))   val = 8;   // ""       3
15031503
1504      if (input_code_pressed(KEYCODE_Z))   val = 1|2|4|8;   // All of the above priorities
1504      if (input_code_pressed(screen->machine, KEYCODE_Z))   val = 1|2|4|8;   // All of the above priorities
15051505
1506      if (input_code_pressed(KEYCODE_Q))   msk |= val <<  0;   // for layer 0
1507      if (input_code_pressed(KEYCODE_W))   msk |= val <<  4;   // for layer 1
1508      if (input_code_pressed(KEYCODE_E))   msk |= val <<  8;   // for layer 2
1509      if (input_code_pressed(KEYCODE_R))   msk |= val << 12;   // for layer 3
1510      if (input_code_pressed(KEYCODE_A))   msk |= val << 16;   // for sprites
1506      if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= val <<  0;   // for layer 0
1507      if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= val <<  4;   // for layer 1
1508      if (input_code_pressed(screen->machine, KEYCODE_E))   msk |= val <<  8;   // for layer 2
1509      if (input_code_pressed(screen->machine, KEYCODE_R))   msk |= val << 12;   // for layer 3
1510      if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= val << 16;   // for sprites
15111511      if (msk != 0) layers_ctrl &= msk;
15121512
15131513#if 1
src/mame/video/fuukifg3.c
r5613r5614
223223      else      { ystart = 0;       yend = ynum;  yinc = +1; }
224224
225225#if 0
226      if(!( (input_code_pressed(KEYCODE_V) && (((attr >> 6)&3) == 0))
227         || (input_code_pressed(KEYCODE_B) && (((attr >> 6)&3) == 1))
228         || (input_code_pressed(KEYCODE_N) && (((attr >> 6)&3) == 2))
229         || (input_code_pressed(KEYCODE_M) && (((attr >> 6)&3) == 3))
226      if(!( (input_code_pressed(screen->machine, KEYCODE_V) && (((attr >> 6)&3) == 0))
227         || (input_code_pressed(screen->machine, KEYCODE_B) && (((attr >> 6)&3) == 1))
228         || (input_code_pressed(screen->machine, KEYCODE_N) && (((attr >> 6)&3) == 2))
229         || (input_code_pressed(screen->machine, KEYCODE_M) && (((attr >> 6)&3) == 3))
230230         ))
231231#endif
232232
r5613r5614
255255
256256#ifdef MAME_DEBUG
257257#if 0
258if (input_code_pressed(KEYCODE_X))
258if (input_code_pressed(screen->machine, KEYCODE_X))
259259{   /* Display some info on each sprite */
260260   char buf[40];
261261   sprintf(buf, "%Xx%X %X",xnum,ynum,(attr>>6)&3);
src/mame/video/rollerg.c
r5613r5614
1515static void sprite_callback(int *code,int *color,int *priority_mask)
1616{
1717#if 0
18if (input_code_pressed(KEYCODE_Q) && (*color & 0x80)) *color = rand();
19if (input_code_pressed(KEYCODE_W) && (*color & 0x40)) *color = rand();
20if (input_code_pressed(KEYCODE_E) && (*color & 0x20)) *color = rand();
21if (input_code_pressed(KEYCODE_R) && (*color & 0x10)) *color = rand();
18if (input_code_pressed(machine, KEYCODE_Q) && (*color & 0x80)) *color = rand();
19if (input_code_pressed(machine, KEYCODE_W) && (*color & 0x40)) *color = rand();
20if (input_code_pressed(machine, KEYCODE_E) && (*color & 0x20)) *color = rand();
21if (input_code_pressed(machine, KEYCODE_R) && (*color & 0x10)) *color = rand();
2222#endif
2323   *priority_mask = (*color & 0x10) ? 0 : 0x02;
2424   *color = sprite_colorbase + (*color & 0x0f);
src/mame/video/segas18.c
r5613r5614
192192   vdppri = (vdp_mixing & 1) ? (1 << vdplayer) : 0;
193193
194194#if DEBUG_VDP
195   if (input_code_pressed(KEYCODE_Q)) vdplayer = 0;
196   if (input_code_pressed(KEYCODE_W)) vdplayer = 1;
197   if (input_code_pressed(KEYCODE_E)) vdplayer = 2;
198   if (input_code_pressed(KEYCODE_R)) vdplayer = 3;
199   if (input_code_pressed(KEYCODE_A)) vdppri = 0x00;
200   if (input_code_pressed(KEYCODE_S)) vdppri = 0x01;
201   if (input_code_pressed(KEYCODE_D)) vdppri = 0x02;
202   if (input_code_pressed(KEYCODE_F)) vdppri = 0x04;
203   if (input_code_pressed(KEYCODE_G)) vdppri = 0x08;
195   if (input_code_pressed(screen->machine, KEYCODE_Q)) vdplayer = 0;
196   if (input_code_pressed(screen->machine, KEYCODE_W)) vdplayer = 1;
197   if (input_code_pressed(screen->machine, KEYCODE_E)) vdplayer = 2;
198   if (input_code_pressed(screen->machine, KEYCODE_R)) vdplayer = 3;
199   if (input_code_pressed(screen->machine, KEYCODE_A)) vdppri = 0x00;
200   if (input_code_pressed(screen->machine, KEYCODE_S)) vdppri = 0x01;
201   if (input_code_pressed(screen->machine, KEYCODE_D)) vdppri = 0x02;
202   if (input_code_pressed(screen->machine, KEYCODE_F)) vdppri = 0x04;
203   if (input_code_pressed(screen->machine, KEYCODE_G)) vdppri = 0x08;
204204#endif
205205
206206   /* if no drawing is happening, fill with black and get out */
r5613r5614
241241   segaic16_sprites_draw(screen, bitmap, cliprect, 0);
242242
243243#if DEBUG_VDP
244   if (vdp_enable && input_code_pressed(KEYCODE_V))
244   if (vdp_enable && input_code_pressed(screen->machine, KEYCODE_V))
245245   {
246246      bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
247247      update_system18_vdp(bitmap, cliprect);
248248   }
249   if (vdp_enable && input_code_pressed(KEYCODE_B))
249   if (vdp_enable && input_code_pressed(screen->machine, KEYCODE_B))
250250   {
251251      FILE *f = fopen("vdp.bin", "w");
252252      fwrite(tempbitmap->base, 1, tempbitmap->rowpixels * (tempbitmap->bpp / 8) * tempbitmap->height, f);
src/mame/video/funybubl.c
r5613r5614
9999
100100   draw_sprites(screen->machine,bitmap,cliprect);
101101
102/*
103    if ( input_code_pressed_once(KEYCODE_W) )
104    {
105        FILE *fp;
102#if 0
103   if ( input_code_pressed_once(screen->machine, KEYCODE_W) )
104   {
105      FILE *fp;
106106
107        fp=fopen("funnybubsprites", "w+b");
108        if (fp)
109        {
110            fwrite(&funybubl_banked_videoram[0x1000], 0x1000, 1, fp);
111            fclose(fp);
112        }
113    }
114*/
107      fp=fopen("funnybubsprites", "w+b");
108      if (fp)
109      {
110         fwrite(&funybubl_banked_videoram[0x1000], 0x1000, 1, fp);
111         fclose(fp);
112      }
113   }
114#endif
115115   return 0;
116116}
src/mame/video/nmk16.c
r5613r5614
329329   tilemap_set_scrolly(bg_tilemap0,0,scroll[2] * 256 + (scroll[3] >> 8));
330330}
331331
332WRITE16_HANDLER( vandykeb_scroll_w )
333{
334   static UINT16 scroll[8];
335
336   COMBINE_DATA(&scroll[offset]);
337
338   tilemap_set_scrollx(bg_tilemap0,0,scroll[6] * 256 + (scroll[5] >> 8));
339   tilemap_set_scrolly(bg_tilemap0,0,scroll[1] * 256 + (scroll[0] >> 8));
340}
341
332342WRITE16_HANDLER( manybloc_scroll_w )
333343{
334344   COMBINE_DATA(&gunnail_scrollram[offset]);
src/mame/layout/connect4.lay
r5613r5614
66   </led7seg>
77   </element>
88   <element name="play" defstate="0">
9      <rect>
9      <text string="PLAY" state="1">
1010         <color red="1.0" green="1.0" blue="1.0" />
11      </rect>
12      <text string="PLAY" state="1">
13         <color red="0.0" green="0.0" blue="0.0" />
1411         <bounds x="0" y="0.1" width="1" height="0.8" />
1512      </text>
1613   </element>
1714   <element name="pass" defstate="0">
18      <rect>
15      <text string="PASS" state="1">
1916         <color red="1.0" green="1.0" blue="1.0" />
20      </rect>
21      <text string="PASS" state="1">
22         <color red="0.0" green="0.0" blue="0.0" />
2317         <bounds x="0" y="0.1" width="1" height="0.8" />
2418      </text>
2519   </element>
r5613r5614
117111      </text>
118112   </element>
119113
114   <element name="20p" defstate="0">
115      <text string="20p" state="0">
116         <color red="1.0" green="1.0" blue="1.0" />
117         <bounds x="0" y="0.1" width="1" height="0.8" />
118      </text>
119      <text string="20p" state="1">
120         <color red="1.0" green="1.0" blue="0.0" />
121         <bounds x="0" y="0.1" width="1" height="0.8" />
122      </text>
123   </element>
124
125   <element name="50p" defstate="0">
126      <text string="50p" state="0">
127         <color red="1.0" green="1.0" blue="1.0" />
128         <bounds x="0" y="0.1" width="1" height="0.8" />
129      </text>
130      <text string="50p" state="1">
131         <color red="1.0" green="1.0" blue="0.0" />
132         <bounds x="0" y="0.1" width="1" height="0.8" />
133      </text>
134   </element>
135
136   <element name="100p" defstate="0">
137      <text string="100p" state="0">
138         <color red="1.0" green="1.0" blue="1.0" />
139         <bounds x="0" y="0.1" width="1" height="0.8" />
140      </text>
141      <text string="100p" state="1">
142         <color red="1.0" green="1.0" blue="0.0" />
143         <bounds x="0" y="0.1" width="1" height="0.8" />
144      </text>
145   </element>
146
147   <element name="200p" defstate="0">
148      <text string="200p" state="0">
149         <color red="1.0" green="1.0" blue="1.0" />
150         <bounds x="0" y="0.1" width="1" height="0.8" />
151      </text>
152      <text string="200p" state="1">
153         <color red="1.0" green="1.0" blue="0.0" />
154         <bounds x="0" y="0.1" width="1" height="0.8" />
155      </text>
156   </element>
157
158   <element name="500p" defstate="0">
159      <text string="500p" state="0">
160         <color red="1.0" green="1.0" blue="1.0" />
161         <bounds x="0" y="0.1" width="1" height="0.8" />
162      </text>
163      <text string="500p" state="1">
164         <color red="1.0" green="1.0" blue="0.0" />
165         <bounds x="0" y="0.1" width="1" height="0.8" />
166      </text>
167   </element>
168
169   <element name="1000p" defstate="0">
170      <text string="1000p" state="0">
171         <color red="1.0" green="1.0" blue="1.0" />
172         <bounds x="0" y="0.1" width="1" height="0.8" />
173      </text>
174      <text string="1000p" state="1">
175         <color red="1.0" green="1.0" blue="0.0" />
176         <bounds x="0" y="0.1" width="1" height="0.8" />
177      </text>
178   </element>
179
120180   <element name="vfd0">
121181   <led16segsc>
122182         <color red="0" green="0.6" blue="1.0" />
r5613r5614
549609         <bounds x="56" y="48" width="7" height="7"/>
550610      </backdrop>
551611
612      <backdrop name="lamp71" element="20p" state="0">
613         <bounds x="64" y="48" width="7" height="7"/>
614      </backdrop>
615
616      <backdrop name="lamp79" element="50p" state="0">
617         <bounds x="64" y="40" width="7" height="7"/>
618      </backdrop>
619
620      <backdrop name="lamp87" element="100p" state="0">
621         <bounds x="64" y="32" width="7" height="7"/>
622      </backdrop>
623
624      <backdrop name="lamp95" element="200p" state="0">
625         <bounds x="64" y="24" width="7" height="7"/>
626      </backdrop>
627
628      <backdrop name="lamp103" element="500p" state="0">
629         <bounds x="64" y="16" width="7" height="7"/>
630      </backdrop>
631
632      <backdrop name="lamp111" element="1000p" state="0">
633         <bounds x="64" y="8" width="7" height="7"/>
634      </backdrop>
635
552636      <backdrop name="lamp119" element="timeout" state="0">
553637         <bounds x="30" y="56" width="28" height="14"/>
554638      </backdrop>
r5613r5614
563647         <bounds x="30" y="56" width="28" height="14"/>
564648      </backdrop>
565649
566      <backdrop name="lamp27" element="play" state="0">
567         <bounds x="0" y="72" width="28" height="14"/>
650      <backdrop name="lamp122" element="play" state="0">
651         <bounds x="0" y="140" width="28" height="14"/>
568652      </backdrop>
569      <backdrop name="lamp26" element="pass" state="0">
570         <bounds x="20" y="72" width="28" height="14"/>
653      <backdrop name="lamp121" element="pass" state="0">
654         <bounds x="40" y="140" width="28" height="14"/>
571655      </backdrop>
572656      <backdrop name="lamp24" element="select" state="0">
573657         <bounds x="0" y="90" width="28" height="14"/>
src/mame/drivers/magicard.c
r5613r5614
517517/*Probably there's a mask somewhere if it REALLY uses irqs at all...irq vectors dynamically changes after some time.*/
518518static INTERRUPT_GEN( magicard_irq )
519519{
520   if(input_code_pressed(KEYCODE_Z)) //vblank?
520   if(input_code_pressed(device->machine, KEYCODE_Z)) //vblank?
521521      cpu_set_input_line_and_vector(device, 1, HOLD_LINE,0xe4/4);
522   if(input_code_pressed(KEYCODE_X)) //uart irq
522   if(input_code_pressed(device->machine, KEYCODE_X)) //uart irq
523523      cpu_set_input_line_and_vector(device, 1, HOLD_LINE,0xf0/4);
524524}
525525
src/mame/drivers/segaxbd.c
r5613r5614
567567                D7: Amplifier mute control (1= sounding, 0= muted)
568568                D6-D0: CN D pin A17-A23 (output level 1= high, 0= low)
569569            */
570         sound_global_enable(data & 0x80);
570         sound_global_enable(space->machine, data & 0x80);
571571         return;
572572   }
573573
r5613r5614
653653   coin_counter_w(0, (data >> 4) & 0x01);
654654   output_set_lamp_value(0, (data >> 5) & 0x01);   /* lock on lamp */
655655   output_set_lamp_value(1, (data >> 6) & 0x01);   /* danger lamp */
656   sound_global_enable((data >> 7) & 0x01);
656   sound_global_enable(space->machine, (data >> 7) & 0x01);
657657}
658658
659659
src/mame/drivers/itgambl2.c
r5613r5614
7272   const UINT8 *blit_ram = memory_region(screen->machine,"gfx1");
7373   static int test_x = 256,test_y = 256,start_offs;
7474
75   if(input_code_pressed(KEYCODE_Z))
75   if(input_code_pressed(screen->machine, KEYCODE_Z))
7676      test_x++;
7777
78   if(input_code_pressed(KEYCODE_X))
78   if(input_code_pressed(screen->machine, KEYCODE_X))
7979      test_x--;
8080
81   if(input_code_pressed(KEYCODE_A))
81   if(input_code_pressed(screen->machine, KEYCODE_A))
8282      test_y++;
8383
84   if(input_code_pressed(KEYCODE_S))
84   if(input_code_pressed(screen->machine, KEYCODE_S))
8585      test_y--;
8686
87   if(input_code_pressed(KEYCODE_Q))
87   if(input_code_pressed(screen->machine, KEYCODE_Q))
8888      start_offs+=0x200;
8989
90   if(input_code_pressed(KEYCODE_W))
90   if(input_code_pressed(screen->machine, KEYCODE_W))
9191      start_offs-=0x200;
9292
93   if(input_code_pressed(KEYCODE_E))
93   if(input_code_pressed(screen->machine, KEYCODE_E))
9494      start_offs++;
9595
96   if(input_code_pressed(KEYCODE_R))
96   if(input_code_pressed(screen->machine, KEYCODE_R))
9797      start_offs--;
9898
9999   popmessage("%d %d %04x",test_x,test_y,start_offs);
src/mame/drivers/norautp.c
r5613r5614
11/******************************************************************************
22
3   - NORAUT POKER -
4  ------------------
3   - NORAUT POKER SYSTEM -
4  -------------------------
55
66  Driver by Roberto Fresca & Angelo Salese.
77
r5613r5614
160160  Video Blue    35   10p in Meter
161161  Video Red     36   Spark Detect (Not on all boards)
162162
163
163164*******************************************************************************
164165
165166  Control Panel
r5613r5614
182183
183184   HOLD buttons              = red.
184185   BET, DEAL, HI & LO        = yellow.
185   HALF GAMBLE & CHANGE CARD = orange.
186   HALF GAMBLE & CHANGE CARD = orange.
186187
187188
188189  * The alternate one (12 button-lamps) for systems with CANCEL button.
189190
190191  .-------------------------------------------------------------.
191  | .------. .------. .------. .------. .------.   .----------. |
192  | .------. .------. .------. .------. .------.   .----------. |
192193  | | HOLD | | HOLD | | HOLD | | HOLD | | HOLD |   |   HIGH   | |
193194  | '------' '------' '------' '------' '------'   '----------' |
194195  | .------. .------. .------. .------. .------.   .----------. |
r5613r5614
305306  7654 3210
306307  ---- ---x  * HI lamp.
307308  ---- --x-  * LO lamp.
308  ---- -x--  unknown.
309  ---- -x--  * HOPPER MOTOR DRIVE
309310  ---- x---  * Payout pulse.
310311  ---x ----  * Coin 2 counter.
311312  --x- ----  * Coin 1 counter.
312  -x-- ----  unknown.
313  x--- ----  unknown (always activated).
313  -x-- ----  + Coin counter related.
314  x--- ----  + DEFLECT (always activated).
314315
315316
316317-----------------------------------------------------------
r5613r5614
323324  ---- --x-  * BET / CHANGE CARD button.
324325  ---- -x--  * COIN 1 mech.
325326  ---- x---  * COIN 2 mech.
326  ---x ----  * READOUT button.
327  ---x ----  * READOUT button (noraut11).
327328  --x- ----  * HI button.
328329  -x-- ----  * LO button.
329330  x--- ----  * PAYOUT button.
r5613r5614
349350  7654 3210
350351  ---- ---x  * DEAL / DRAW Lamp.
351352  ---- --x-  * BET / COLLECT Lamp.
352  ---- -x--  unknown (always activated after initalize).
353  ---- x---  unknown.
353  ---- -x--  + PANEL LIGHTS RESET (always activated after initalize).
354  ---- x---  + PANEL LAMPS CLOCK
354355  xxxx ----  * Discrete Sound Lines.
355356
356357
r5613r5614
363364  xxxx xxxx  VRAM DATA.
364365
365366
366  PPI-2 (a0h-a3h); PortB IN? (should be OUT)
367  PPI-2 (a0h-a3h); PortB OUT
367368  VRAM Handlers:
368369
369370  7654 3210
370371  xxxx xxxx  VRAM ADDRESSING.
371372
372373
373  PPI-2 (a0h-a3h); PortC (PortA handshake lines)
374  VRAM Handlers:
374  PPI-2 (a0h-a3h); PortC IN/OUT.
375  PortA handshake lines & PC0-PC2 (noraut11 = OUT; noraut12 = IN):
375376
376377  7654 3210
377  xxxx xxxx  HANDSHAKE LINES.
378  ---- ---x  * N/C (noraut11).
379  ---- --x-  * N/C (noraut11).
380  ---- -x--  * N/C (noraut11).
381  ---- ---x  * N/C (noraut12).
382  ---- --x-  * READOUT SWITCH (noraut12).
383  ---- -x--  * LOW LEVEL HOPPER (noraut12).
384  xxxx x---  * PortA HANDSHAKE LINES (all systems).
378385
379386
380387*******************************************************************************
r5613r5614
384391
385392
386393  - norautjp:
387 
388   At the first start-up, the game will give you a very clever
394
395    At the first start-up, the game will give you a very clever
389396    "FU" screen. Press the following buttons *together* on different times
390397    to get rid of it (and actually initialize the machine):
391398
r5613r5614
408415
409416  0x60 - 0x63        ; PPI 8255 0 - DIP Switches, lamps & counters.
410417  0xA0 - 0xA3        ; PPI 8255 1 - Regular Inputs, sound lines & remaining lamps.
411  0xC0 - 0xC3        ; PPI 8255 2 - Video RAM access.
418  0xC0 - 0xC3        ; PPI 8255 2 - Video RAM access & other stuff.
412419
413420
414421*******************************************************************************
r5613r5614
485492  - Updated technical notes.
486493
487494
495  [2009-08-30]
496
497  - Corrected CPU clock to Xtal/8.
498  - Discovered 3 new I/O lines coming from PPI-2, PC0-PC2. They are mixed with the handshake ones.
499  - Added the READOUT button to noraut12 games.
500  - Splitted the main machine driver to cover 2 different Noraut systems.
501  - Added partial support for PPI-2, PC0-PC2 output lines on noraut11 games.
502  - Figured out other remaining I/O lines.
503  - Added new handlers to simulate the handshake lines. Still need real support through PPI-2.
504  - Updated technical notes.
505
506
507  [2009-09-03]
508
509  - Routed the whole video RAM access through PPI-2.
510    (bypassed the handshake lines for now).
511  - Merged back the noraut machine drivers after the 3rd PPI connection.
512  - Added Low Level Hopper manual input.
513  - Added a new machine driver for extended hardware.
514    It has 2 jumpers that cut the a14 and a15 addressing lines.
515
516
488517  TODO:
489518
490  - Analize the third 8255 at 0xc0-0xc3 (full bidirectional port w/hshk lines)
491  - Video RAM (through 3rd PPI?).
519  - Analize PPI-2 at 0xc0-0xc3. OBF handshake line (PC7) doesn't seems to work properly.
492520  - Find if wide chars are hardcoded or tied to a bit.
493521  - Discrete sound.
494522  - Save support.
r5613r5614
498526
499527
500528#define MASTER_CLOCK   XTAL_18_432MHz
529#define CPU_CLOCK      MASTER_CLOCK / 8   /* 2.30275 MHz - Measured: 2.305 MHz */
501530
502531#include "driver.h"
503532#include "cpu/z80/z80.h"
r5613r5614
610639/*  PPI-1 (a0h-a3h); PortC OUT.
611640    Sound & Lamps:
612641
613    7654 3210
614    ---- ---x  * DEAL / DRAW Lamp.
615    ---- --x-  * BET / COLLECT Lamp.
616    ---- -x--  unknown (always activated after initalize).
617    ---- x---  unknown.
618    xxxx ----  * Discrete Sound Lines.
642  7654 3210
643  ---- ---x  * DEAL / DRAW Lamp.
644  ---- --x-  * BET / COLLECT Lamp.
645  ---- -x--  + PANEL LIGHTS RESET (always activated after initalize).
646  ---- x---  + PANEL LAMPS CLOCK
647  xxxx ----  * Discrete Sound Lines.
619648*/
620649   output_set_lamp_value(8, (data >> 0) & 1);   /* DEAL / DRAW lamp */
621650   output_set_lamp_value(9, (data >> 1) & 1);   /* BET / COLLECT lamp */
r5613r5614
632661    7654 3210
633662    ---- ---x  * HI lamp.
634663    ---- --x-  * LO lamp.
635    ---- -x--  unknown.
664    ---- -x--  * HOPPER MOTOR DRIVE
636665    ---- x---  * Payout pulse.
637666    ---x ----  * Coin 2 counter.
638667    --x- ----  * Coin 1 counter.
639    -x-- ----  unknown.
640    x--- ----  unknown (always activated).
668    -x-- ----  + Coin counter related.
669    x--- ----  + DEFLECT (always activated).
641670*/
642671   output_set_lamp_value(10, (data >> 0) & 1);   /* HI lamp */
643672   output_set_lamp_value(11, (data >> 1) & 1);   /* LO lamp */
r5613r5614
648677}
649678
650679
651/* game waits for bit 7 (0x80) to be set.*/
652static READ8_HANDLER( test_r )
680/* Game waits for bit 7 (0x80) to be set.
681   This should be the /OBF line (PC7) from PPI-2 (handshake).
682   PC0-PC2 could be set as input or output.
683*/
684
685static READ8_DEVICE_HANDLER( ppi2_portc_r )
653686{
654   return 0xff;
687   UINT8 ppi2_pcmix = 0;
688   UINT8 hndshk = 0x80;   /* simulating the handshake lines (bits 3-7) */
689   ppi2_pcmix = (hndshk | (input_port_read(device->machine, "IN2") & 0x07));
690//  popmessage("portc read: %02x", ppi2_pcmix);
691
692   return ppi2_pcmix;
655693}
656694
657/* game waits for bit 4 (0x10) to be reset.*/
658static READ8_HANDLER( test2_r )
695static WRITE8_DEVICE_HANDLER( ppi2_portc_w )
659696{
660   return 0x00;
697   /* PC0-PC2 don't seems to be connected to any output */
698//  popmessage("portc write: %02x", data);
661699}
662700
663static WRITE8_HANDLER( vram_data_w )
701static READ8_DEVICE_HANDLER( vram_data_r )
664702{
703   return np_vram[np_addr];
704}
705
706static WRITE8_DEVICE_HANDLER( vram_data_w )
707{
665708   np_vram[np_addr] = data & 0xff;
666709}
667710
668static WRITE8_HANDLER( vram_addr_w )
711static WRITE8_DEVICE_HANDLER( vram_addr_w )
669712{
670713   np_addr = data;
671714}
672715
716/* game waits for bit 4 (0x10) to be reset.*/
717static READ8_HANDLER( test2_r )
718{
719   return 0x00;
720}
673721
722
674723/*************************
675724* Memory Map Information *
676725*************************/
r5613r5614
684733   ADDRESS_MAP_GLOBAL_MASK(0xff)
685734   AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
686735   AM_RANGE(0xa0, 0xa3) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
687   AM_RANGE(0xc0, 0xc0) AM_WRITE(vram_data_w)
688   AM_RANGE(0xc1, 0xc1) AM_WRITE(vram_addr_w)
689   AM_RANGE(0xc2, 0xc2) AM_READ(test_r)
690//  AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
736   AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
691737ADDRESS_MAP_END
692738
693739/*
694740  Video RAM R/W:
695741
696  c0 --> W  ; data (in case of PPI, port data)
742  c0 --> W  ; data
697743  c1 --> W  ; addressing
698  c2 --> R  ; status?
699  c3 --> W  ; alternate 00 & 01 (in case of PPI, setting resetting bit 0 of handshaked port)
744  c2 --> R  ; status
745  c3 --> W  ; alternate 00 & 01 (control?)
700746
701  The strange issue is that some sets just configure the PPI to mixed mode2 and mode0 input.
702  it means that port A should be bidirectional and port B just as input. (port C as hshk regs).
703  So... it doesn't match the addressing through c1.
704747*/
705748
749static ADDRESS_MAP_START( norautxp_map, ADDRESS_SPACE_PROGRAM, 8 )
750   AM_RANGE(0x0000, 0xcfff) AM_ROM   /* need to be checked */
751   AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) /* need to be checked */
752ADDRESS_MAP_END
753
754static ADDRESS_MAP_START( norautxp_portmap, ADDRESS_SPACE_IO, 8 )
755   ADDRESS_MAP_GLOBAL_MASK(0xff)
756//  AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
757//  AM_RANGE(0xa0, 0xa3) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
758//  AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
759ADDRESS_MAP_END
760
706761static ADDRESS_MAP_START( gtipoker_map, ADDRESS_SPACE_PROGRAM, 8 )
707762   AM_RANGE(0x0000, 0x1fff) AM_ROM
708763   AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
r5613r5614
712767   ADDRESS_MAP_GLOBAL_MASK(0xff)
713768   AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
714769   AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
715   AM_RANGE(0xdc, 0xdc) AM_WRITE(vram_data_w)
716   AM_RANGE(0xdd, 0xdd) AM_WRITE(vram_addr_w)
717   AM_RANGE(0xde, 0xde) AM_READ(test_r)
718//  AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
770   AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
719771   AM_RANGE(0xef, 0xef) AM_READ(test2_r)
720772ADDRESS_MAP_END
721773
r5613r5614
725777*************************/
726778
727779static INPUT_PORTS_START( norautp )
780
728781   PORT_START("IN0")
729782   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Draw")
730783   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET )   PORT_NAME("Bet / Collect")
731784   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)   /* Coin A */
732785   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)   /* Coin B */
733   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )     PORT_NAME("Readout") PORT_CODE(KEYCODE_9)
786   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER )      PORT_CODE(KEYCODE_K) PORT_NAME("IN0-5")
734787   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Hi")
735788   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_LOW )  PORT_NAME("Lo")
736789   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
r5613r5614
745798   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
746799   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2)   /* Coin C */
747800
801   PORT_START("IN2")   /* Only 3 lines: PPI-2; PC0-PC2 */
802   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER )       PORT_CODE(KEYCODE_J) PORT_NAME("IN2-1")
803   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )     PORT_CODE(KEYCODE_9) PORT_NAME("Readout")
804   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER )       PORT_CODE(KEYCODE_L) PORT_NAME("Low Level Hopper")
805
806
748807   PORT_START("DSW1")
749808   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
750809   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
r5613r5614
773832INPUT_PORTS_END
774833
775834static INPUT_PORTS_START( norautrh )
835
776836   PORT_START("IN0")
777837   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Draw")
778838   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET )   PORT_NAME("Bet / Change Card")
r5613r5614
793853   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
794854   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_CANCEL )   /* Coin C for other games */
795855
856   PORT_START("IN2")   /* Only 3 lines: PPI-2; PC0-PC2 */
857   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
858   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
859   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
860
861
796862   PORT_START("DSW1")
797863   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )   PORT_DIPLOCATION("DSW1:8")
798864   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
r5613r5614
819885   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
820886INPUT_PORTS_END
821887
822static INPUT_PORTS_START( naroutpn )
888static INPUT_PORTS_START( norautpn )
889
823890   PORT_START("IN0")
824891   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Start")
825892   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET )   PORT_NAME("Bet / Change Card")
r5613r5614
840907   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
841908   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_CANCEL )
842909
910   PORT_START("IN2")   /* Only 3 lines: PPI-2; PC0-PC2 */
911   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
912   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
913   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
914
915
843916   PORT_START("DSW1")
844917   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
845918   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
r5613r5614
9341007      DEVCB_NULL,                  /* Port B write */
9351008      DEVCB_HANDLER(soundlamps_w)      /* Port C write */
9361009   },
937   {   /* (c0-c3) Group A Mode 2 (5-handshacked bidirectional port) */
938      DEVCB_NULL,                  /* Port A read */
1010   {   /* (c0-c3) Group A Mode 2 (5-handshacked bidirectional port)
1011                   Group B Mode 0, output;  (see below for lines PC0-PC2) */
1012      DEVCB_HANDLER(vram_data_r),      /* Port A read */
9391013      DEVCB_NULL,                  /* Port B read */
940      DEVCB_NULL,                  /* Port C read  (should has test_r tied) */
941      DEVCB_NULL,                  /* Port A write (should has vram_data_w tied) */
942      DEVCB_NULL,                  /* Port B write (should has vram_addr_w tied) */
943      DEVCB_NULL                  /* Port C write */
1014      DEVCB_HANDLER(ppi2_portc_r),   /* Port C read */
1015      DEVCB_HANDLER(vram_data_w),      /* Port A write (vram_data_w tied) */
1016      DEVCB_HANDLER(vram_addr_w),      /* Port B write (vram_addr_w tied) */
1017      DEVCB_HANDLER(ppi2_portc_w)      /* Port C write */
9441018   }
1019   /*  PPI-2 is configured as mixed mode2 and mode0 output.
1020        It means that port A should be bidirectional and port B just as output.
1021        Port C as hshk regs, and P0-P2 as output (noraut11) or input (noraut12).
1022    */
9451023};
9461024
9471025
r5613r5614
9521030static MACHINE_DRIVER_START( norautp )
9531031
9541032   /* basic machine hardware */
955   MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6)   /* guess */
1033   MDRV_CPU_ADD("maincpu", Z80, CPU_CLOCK)
9561034   MDRV_CPU_PROGRAM_MAP(norautp_map)
9571035   MDRV_CPU_IO_MAP(norautp_portmap)
9581036   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
r5613r5614
9851063   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
9861064MACHINE_DRIVER_END
9871065
1066static MACHINE_DRIVER_START( norautxp )
1067   MDRV_IMPORT_FROM(norautp)
1068
1069   MDRV_CPU_MODIFY("maincpu")
1070   MDRV_CPU_PROGRAM_MAP(norautxp_map)
1071   MDRV_CPU_IO_MAP(norautxp_portmap)
1072
1073MACHINE_DRIVER_END
1074
9881075static MACHINE_DRIVER_START( gtipoker )
9891076   MDRV_IMPORT_FROM(norautp)
9901077
r5613r5614
11271214
11281215ROM_START( norautu )
11291216   ROM_REGION( 0x10000, "maincpu", 0 )
1130   ROM_LOAD( "2563.bin",    0x0000, 0x8000, CRC(6cbe68bd) SHA1(93201baaf03a9bba6c52c64cc26e8e445aa6454e) )
1217   ROM_LOAD( "2563.bin",   0x0000, 0x8000, CRC(6cbe68bd) SHA1(93201baaf03a9bba6c52c64cc26e8e445aa6454e) )
1218   ROM_RELOAD(            0x8000, 0x8000 )
11311219
11321220   ROM_REGION( 0x1000,  "gfx", 0 )
11331221   ROM_LOAD( "club250.bin", 0x0000, 0x1000, CRC(d94be899) SHA1(b7212162324fa2d67383a475052e3b351bb1af5f) )
r5613r5614
11891277ROM_END
11901278
11911279
1280/**************************
1281*       Driver Init       *
1282**************************/
1283
1284/* These are to patch the check for OBF handshake line,
1285   that seems to be wrong. Otherwise will enter in an infinite loop.
1286
1287  110D: DB C2      in   a,($C2)  ; read from PPI-2, portC. (OBF should be set, but isn't)
1288  110F: 07         rlca          ; rotate left.
1289  1110: 30 FB      jr   nc,$110D
1290
1291*/
1292static DRIVER_INIT( norautrh )
1293{
1294   UINT8 *ROM = memory_region(machine, "maincpu");
1295   ROM[0x1110] = 0x00;
1296   ROM[0x1111] = 0x00;
1297}
1298
1299static DRIVER_INIT( norautpn )
1300{
1301   UINT8 *ROM = memory_region(machine, "maincpu");
1302   ROM[0x0827] = 0x00;
1303   ROM[0x0828] = 0x00;
1304}
1305
1306static DRIVER_INIT( gtipoker )
1307{
1308//  UINT8 *ROM = memory_region(machine, "maincpu");
1309//  ROM[0x0cc6] = 0x00;
1310//  ROM[0x0cc7] = 0x00;
1311}
1312
1313
11921314/*************************
11931315*      Game Drivers      *
11941316*************************/
11951317
1196/*     YEAR  NAME      PARENT   MACHINE   INPUT     INIT  ROT    COMPANY        FULLNAME                       FLAGS                              LAYOUT */
1197GAMEL( 1988, norautp,  0,       norautp,  norautp,  0,    ROT0, "Noraut Ltd.", "Noraut Poker",                 GAME_NO_SOUND,                     layout_noraut11 )
1198GAMEL( 1988, norautjp, norautp, norautp,  norautp,  0,    ROT0, "Noraut Ltd.", "Noraut Joker Poker",           GAME_NO_SOUND,                     layout_noraut11 )
1199GAMEL( 1988, norautrh, 0,       norautp,  norautrh, 0,    ROT0, "Noraut Ltd.", "Noraut Red Hot Joker Poker",   GAME_NO_SOUND,                     layout_noraut12 )
1200GAME(  1988, norautu,  0,       norautp,  norautp,  0,    ROT0, "Noraut Ltd.", "Noraut Poker (NTX10A)",        GAME_NO_SOUND | GAME_NOT_WORKING )
1201GAME(  1988, norautv3, 0,       norautp,  norautp,  0,    ROT0, "Noraut Ltd.", "Noraut Joker Poker (V3.010a)", GAME_NO_SOUND | GAME_NOT_WORKING )
1202GAME(  1983, gtipoker, 0,       gtipoker, norautp,  0,    ROT0, "GTI Inc",     "GTI Poker",                    GAME_NO_SOUND | GAME_NOT_WORKING )
1318/*     YEAR  NAME      PARENT   MACHINE   INPUT     INIT      ROT    COMPANY        FULLNAME                       FLAGS                              LAYOUT */
1319GAMEL( 1988, norautp,  0,       norautp,  norautp,  0,        ROT0, "Noraut Ltd.", "Noraut Poker",                 GAME_NO_SOUND,                     layout_noraut11 )
1320GAMEL( 1988, norautjp, norautp, norautp,  norautp,  0,        ROT0, "Noraut Ltd.", "Noraut Joker Poker",           GAME_NO_SOUND,                     layout_noraut11 )
1321GAMEL( 1988, norautrh, 0,       norautp,  norautrh, norautrh, ROT0, "Noraut Ltd.", "Noraut Red Hot Joker Poker",   GAME_NO_SOUND,                     layout_noraut12 )
1322GAME(  1988, norautu,  0,       norautxp, norautp,  0,        ROT0, "Noraut Ltd.", "Noraut Poker (NTX10A)",        GAME_NO_SOUND | GAME_NOT_WORKING )
1323GAME(  1988, norautv3, 0,       norautxp, norautp,  0,        ROT0, "Noraut Ltd.", "Noraut Joker Poker (V3.010a)", GAME_NO_SOUND | GAME_NOT_WORKING )
1324GAME(  1983, gtipoker, 0,       gtipoker, norautpn, gtipoker, ROT0, "GTI Inc",     "GTI Poker",                    GAME_NO_SOUND | GAME_NOT_WORKING )
12031325
12041326/*The following has everything uncertain, seems a bootleg/hack and doesn't have any identification strings in program rom. */
1205GAMEL( 198?, norautpn, norautp, norautp,  naroutpn, 0,    ROT0, "bootleg?",    "Noraut Poker (bootleg)",       GAME_NO_SOUND,                     layout_noraut12 )
1327GAMEL( 198?, norautpn, norautp, norautp,  norautpn, norautpn, ROT0, "bootleg?",    "Noraut Poker (bootleg)",       GAME_NO_SOUND,                     layout_noraut12 )
src/mame/drivers/maxaflex.c
r5613r5614
8282      cputag_set_input_line(space->machine, "mcu", M6805_IRQ_LINE, CLEAR_LINE );
8383
8484   /* AUDMUTE */
85   sound_global_enable((data >> 5) & 1);
85   sound_global_enable(space->machine, (data >> 5) & 1);
8686
8787   /* RES600 */
8888   if (diff & 0x10)
src/mame/drivers/segaybd.c
r5613r5614
177177      int old = irq2_scanline;
178178
179179      /* Q = -10 scanlines, W = -1 scanline, E = +1 scanline, R = +10 scanlines */
180      if (input_code_pressed(KEYCODE_Q)) { while (input_code_pressed(KEYCODE_Q)) ; irq2_scanline -= 10; }
181      if (input_code_pressed(KEYCODE_W)) { while (input_code_pressed(KEYCODE_W)) ; irq2_scanline -= 1; }
182      if (input_code_pressed(KEYCODE_E)) { while (input_code_pressed(KEYCODE_E)) ; irq2_scanline += 1; }
183      if (input_code_pressed(KEYCODE_R)) { while (input_code_pressed(KEYCODE_R)) ; irq2_scanline += 10; }
180      if (input_code_pressed(machine, KEYCODE_Q)) { while (input_code_pressed(machine, KEYCODE_Q)) ; irq2_scanline -= 10; }
181      if (input_code_pressed(machine, KEYCODE_W)) { while (input_code_pressed(machine, KEYCODE_W)) ; irq2_scanline -= 1; }
182      if (input_code_pressed(machine, KEYCODE_E)) { while (input_code_pressed(machine, KEYCODE_E)) ; irq2_scanline += 1; }
183      if (input_code_pressed(machine, KEYCODE_R)) { while (input_code_pressed(machine, KEYCODE_R)) ; irq2_scanline += 10; }
184184      if (old != irq2_scanline)
185185         popmessage("scanline = %d", irq2_scanline);
186186   }
r5613r5614
332332      case 0x0e/2:
333333         /* D7 = /MUTE */
334334         /* D6-D0 = FLT31-25 */
335         sound_global_enable(data & 0x80);
335         sound_global_enable(space->machine, data & 0x80);
336336         break;
337337
338338      /* CNT register */
src/mame/drivers/ddenlovr.c
r5613r5614
12351235   ddenlovr_clip_ctrl = 0x0f;
12361236   next = blit_draw(screen->machine,base,0);
12371237   popmessage("GFX %06x",base);
1238   if (input_code_pressed(KEYCODE_S)) base = next;
1239   if (input_code_pressed_once(KEYCODE_X)) base = next;
1240   if (input_code_pressed(KEYCODE_C)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
1241   if (input_code_pressed(KEYCODE_V)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
1242   if (input_code_pressed_once(KEYCODE_D)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
1243   if (input_code_pressed_once(KEYCODE_F)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
1238   if (input_code_pressed(screen->machine, KEYCODE_S)) base = next;
1239   if (input_code_pressed_once(screen->machine, KEYCODE_X)) base = next;
1240   if (input_code_pressed(screen->machine, KEYCODE_C)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
1241   if (input_code_pressed(screen->machine, KEYCODE_V)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
1242   if (input_code_pressed_once(screen->machine, KEYCODE_D)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
1243   if (input_code_pressed_once(screen->machine, KEYCODE_F)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
12441244#endif
12451245
12461246   bitmap_fill(bitmap,cliprect,ddenlovr_bgcolor);
12471247
12481248#ifdef MAME_DEBUG
1249   if (input_code_pressed(KEYCODE_Z))
1249   if (input_code_pressed(screen->machine, KEYCODE_Z))
12501250   {
12511251      int mask,mask2;
12521252
12531253      mask = 0;
12541254
1255      if (input_code_pressed(KEYCODE_Q))   mask |= 1;
1256      if (input_code_pressed(KEYCODE_W))   mask |= 2;
1257      if (input_code_pressed(KEYCODE_E))   mask |= 4;
1258      if (input_code_pressed(KEYCODE_R))   mask |= 8;
1255      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 1;
1256      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 2;
1257      if (input_code_pressed(screen->machine, KEYCODE_E))   mask |= 4;
1258      if (input_code_pressed(screen->machine, KEYCODE_R))   mask |= 8;
12591259
12601260      mask2 = 0;
12611261
12621262      if (extra_layers)
12631263      {
1264         if (input_code_pressed(KEYCODE_A))   mask2 |= 1;
1265         if (input_code_pressed(KEYCODE_S))   mask2 |= 2;
1266         if (input_code_pressed(KEYCODE_D))   mask2 |= 4;
1267         if (input_code_pressed(KEYCODE_F))   mask2 |= 8;
1264         if (input_code_pressed(screen->machine, KEYCODE_A))   mask2 |= 1;
1265         if (input_code_pressed(screen->machine, KEYCODE_S))   mask2 |= 2;
1266         if (input_code_pressed(screen->machine, KEYCODE_D))   mask2 |= 4;
1267         if (input_code_pressed(screen->machine, KEYCODE_F))   mask2 |= 8;
12681268      }
12691269
12701270      if (mask || mask2)
src/mame/drivers/kaneko16.c
r5613r5614
5959
6060[brapboys / shogwarr]
6161
62- Verify collision protection on real hardware
62- Verify collision protection on real hardware (appears to be a function of the system/memory controller, NOT the MCU)
63  - currently B.Rap Boys has it's own special case, it should work with the same code as Blood Warriors / Shogun Warriors (and probably SuperNova)
6364- Figure out how MCU resets writeback address (currently hacked)
6465- Find relationship between Key tables and final datablock
6566- Clean up debug code file writes etc. (when above are done only!)
6667- Interrupt timing? (some sprites flicker)
67- Sprite buffering (2 frames?, or related to above)
68- Sprite buffering (1-2 frames?, or related to above)
6869
6970Dip locations verified from manual for:
7071
r5613r5614
7778- gtmr2
7879- shogwarr
7980
81[general]
82- replace sample bank copying with new ADDRESS MAP system for OKI and do banking like CPUs
8083
81
8284***************************************************************************/
8385
8486#include "driver.h"
r5613r5614
840842   AM_RANGE(0x603000, 0x603fff) AM_RAM AM_BASE(&kaneko16_vscroll_0)
841843   AM_RANGE(0x800000, 0x80000f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs)   // Layers 0 Regs
842844   AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs)   // Sprites Regs
843   AM_RANGE(0xa00000, 0xa0007f) AM_READWRITE(shogwarr_calc_r, shogwarr_calc_w)      // Random Number ?
845   AM_RANGE(0xa00000, 0xa0007f) AM_READWRITE(bloodwar_calc_r, bloodwar_calc_w)
844846   AM_RANGE(0xa80000, 0xa80001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w)   // Watchdog
845847   AM_RANGE(0xb80000, 0xb80001) AM_READ_PORT("P1")
846848   AM_RANGE(0xb80002, 0xb80003) AM_READ_PORT("P2")
r5613r5614
33473349
33483350***************************************************************************/
33493351
3352
3353// the 'green garbage' on the VS logo shown in the video ( http://www.youtube.com/watch?v=lz4gY9d7uxw ) doesn't happen on the real PCB,
3354// it appears to be an encoding artifact on the videos uploaded by this poster
3355
33503356ROM_START( shogwarr )
33513357    ROM_REGION( 0x040000, "maincpu", 0 )         /* 68000 Code */
33523358   ROM_LOAD16_BYTE( "fb030a.u61", 0x000000, 0x020000, CRC(a04106c6) SHA1(95ab084f2e709be7cec2964cb09bcf5a8d3aacdf) )
r5613r5614
33553361    ROM_REGION( 0x020000, "cpu1", 0 )         /* MCU Code */
33563362   ROM_LOAD( "fb040a.u33",  0x000000, 0x020000, CRC(4b62c4d9) SHA1(35c943dde70438a411714070e42a84366db5ef83) )
33573363
3358   ROM_REGION( 0x1000000, "gfx1", 0 )   /* Sprites */ /* not sure these are all correct size */
3364   ROM_REGION( 0x1000000, "gfx1", ROMREGION_ERASEFF )   /* Sprites */
33593365   ROM_LOAD( "fb-020a.u1", 0x000000, 0x100000, CRC(87e55c6d) SHA1(87886c045d7c30b8dee3c8fb0bf8f2cdbc5fd7fb) )
33603366   ROM_LOAD( "fb020b.u2",  0x100000, 0x100000, CRC(276b9d7b) SHA1(7a154f65b4737f2b6ac8effa3352711079f571dc) )
33613367   ROM_LOAD( "fb021a.u3",  0x200000, 0x100000, CRC(7da15d37) SHA1(345cf2242e8210a697294a45197f2b3b974de885) )
33623368   ROM_LOAD( "fb021b.u4",  0x300000, 0x100000, CRC(6a512d7b) SHA1(7fc3002d23262a9a590a283ea9e111e38d889ef2) )
3363   ROM_LOAD( "fb022a.u5",  0x400000, 0x080000, CRC(60aa1282) SHA1(4648816016e00df3256226ba5134f6e5bb429909) )
3364   ROM_LOAD( "fb022b.u6",  0x480000, 0x080000, CRC(cd05a5c8) SHA1(9f000cca8d31e19fdc4b38c00c3ed13f71e5541c) )
3365   ROM_LOAD( "fb023.u7",   0x500000, 0x100000, CRC(132794bd) SHA1(bcc73c3183c59a4b66f79d04774773b8a9239501) )
3369   ROM_LOAD( "fb-22a.u5",  0x400000, 0x100000, CRC(9039e5d3) SHA1(222452cd7947f7c99c68e495835cca62e0449b5c) )
3370   ROM_LOAD( "fb-22b.u6",  0x500000, 0x100000, CRC(96ac9e54) SHA1(2b066375963dc57fe2ce89d65f6c0a9d183a838d) )
3371   ROM_LOAD( "fb023.u7",   0x600000, 0x100000, CRC(132794bd) SHA1(bcc73c3183c59a4b66f79d04774773b8a9239501) )
33663372
33673373   ROM_REGION( 0x400000, "gfx2", 0 )   /* Tiles (scrambled) */
33683374   ROM_LOAD( "fb010.u65",  0x000000, 0x100000, CRC(296ffd92) SHA1(183a28e4594c428deb4726ed22d5166592b94b60) )   // 42 pin mask rom
33693375   ROM_LOAD( "fb011.u66",  0x100000, 0x080000, CRC(500a0367) SHA1(6dc5190f81b21f59ee56a3b2332c8d86d6599782) )   // 40 pin mask rom (verified correct)
33703376
3371   ROM_REGION( 0x100000, "oki1", 0 )   /* Samples */
3372   ROM_LOAD( "fb000e.u42",  0x000000, 0x080000, CRC(969f1465) SHA1(4f56d1ad341b08f4db41b7ab2498740612ff7c3d) )   // 2 x $40000
3373   ROM_LOAD( "fb001e.u43",  0x080000, 0x080000, CRC(f524aaa1) SHA1(006a886f9df2e57c51b61c6cea70a6574fc20304) )   // 2 x $40000
3377   ROM_REGION( 0x300000, "samples", 0 )
3378   ROM_LOAD( "fb001e.u43",  0x000000, 0x080000, CRC(f524aaa1) SHA1(006a886f9df2e57c51b61c6cea70a6574fc20304) )
3379   ROM_LOAD( "fb000e.u42",  0x080000, 0x080000, CRC(969f1465) SHA1(4f56d1ad341b08f4db41b7ab2498740612ff7c3d) )
33743380
3375   ROM_REGION( 0x100000, "oki2", 0 )   /* Samples */
3376   ROM_LOAD( "fb002.u44",   0x000000, 0x080000, CRC(05d7c2a9) SHA1(e34d395985caec10139a22daa179bb185df157d6) )   // 2 x $40000
3377   ROM_LOAD( "fb003.u45",   0x080000, 0x080000, CRC(405722e9) SHA1(92e51093d50f74f650ba137f5fc2910e0f85337e) )   // 2 x $40000
3381   /* Sound data is copied here during driver init */
3382   ROM_REGION( 0x400000*16, "oki1", 0 )
3383   ROM_FILL(                0x00000, 0x400000*16, 0x00 )
3384
3385   ROM_REGION( 0x200000, "oki2", 0 )
3386   ROM_LOAD( "fb-002.u45",   0x000000, 0x100000, CRC(010acc17) SHA1(2dc0897c7778eacf6bce12ff0adbadb307ea6c17) )
3387   ROM_LOAD( "fb-003.u44",   0x100000, 0x100000, CRC(0aea4ac5) SHA1(8f3b30e505b0ba51c140a0a2c071680d4fa05db9) )
33783388ROM_END
33793389
33803390/***************************************************************************
r5613r5614
34143424    ROM_REGION( 0x020000, "cpu1", 0 )         /* MCU Code */
34153425   ROM_LOAD( "fb040e.u33",  0x000000, 0x020000, CRC(299d0746) SHA1(67fe3a47ab01fa02ce2bb5836c2041986c19d875) )
34163426
3417   ROM_REGION( 0x1000000, "gfx1", 0 )   /* Sprites */ /* not sure these are all correct size */
3427   ROM_REGION( 0x1000000, "gfx1", ROMREGION_ERASEFF )   /* Sprites */
34183428   ROM_LOAD( "fb-020a.u1", 0x000000, 0x100000, CRC(87e55c6d) SHA1(87886c045d7c30b8dee3c8fb0bf8f2cdbc5fd7fb) )
34193429   ROM_LOAD( "fb020b.u2",  0x100000, 0x100000, CRC(276b9d7b) SHA1(7a154f65b4737f2b6ac8effa3352711079f571dc) )
34203430   ROM_LOAD( "fb021a.u3",  0x200000, 0x100000, CRC(7da15d37) SHA1(345cf2242e8210a697294a45197f2b3b974de885) )
34213431   ROM_LOAD( "fb021b.u4",  0x300000, 0x100000, CRC(6a512d7b) SHA1(7fc3002d23262a9a590a283ea9e111e38d889ef2) )
3422   ROM_LOAD( "fb022a.u5",  0x400000, 0x080000, CRC(60aa1282) SHA1(4648816016e00df3256226ba5134f6e5bb429909) )
3423   ROM_LOAD( "fb022b.u6",  0x480000, 0x080000, CRC(cd05a5c8) SHA1(9f000cca8d31e19fdc4b38c00c3ed13f71e5541c) )
3424   ROM_LOAD( "fb023.u7",   0x500000, 0x100000, CRC(132794bd) SHA1(bcc73c3183c59a4b66f79d04774773b8a9239501) )
3432   ROM_LOAD( "fb-22a.u5",  0x400000, 0x100000, CRC(9039e5d3) SHA1(222452cd7947f7c99c68e495835cca62e0449b5c) )
3433   ROM_LOAD( "fb-22b.u6",  0x500000, 0x100000, CRC(96ac9e54) SHA1(2b066375963dc57fe2ce89d65f6c0a9d183a838d) )
3434   ROM_LOAD( "fb023.u7",   0x600000, 0x100000, CRC(132794bd) SHA1(bcc73c3183c59a4b66f79d04774773b8a9239501) )
34253435
34263436   ROM_REGION( 0x400000, "gfx2", 0 )   /* Tiles (scrambled) */
34273437   ROM_LOAD( "fb010.u65",  0x000000, 0x100000, CRC(296ffd92) SHA1(183a28e4594c428deb4726ed22d5166592b94b60) )   // 42 pin mask rom
34283438   ROM_LOAD( "fb011.u66",  0x100000, 0x080000, CRC(500a0367) SHA1(6dc5190f81b21f59ee56a3b2332c8d86d6599782) )   // 40 pin mask rom (verified correct)
34293439
3430   ROM_REGION( 0x100000, "oki1", 0 )   /* Samples */
3431   ROM_LOAD( "fb000e.u42",  0x000000, 0x080000, CRC(969f1465) SHA1(4f56d1ad341b08f4db41b7ab2498740612ff7c3d) )   // 2 x $40000
3432   ROM_LOAD( "fb001e.u43",  0x080000, 0x080000, CRC(f524aaa1) SHA1(006a886f9df2e57c51b61c6cea70a6574fc20304) )   // 2 x $40000
3440   ROM_REGION( 0x300000, "samples", 0 )
3441   ROM_LOAD( "fb001e.u43",  0x000000, 0x080000, CRC(f524aaa1) SHA1(006a886f9df2e57c51b61c6cea70a6574fc20304) )
3442   ROM_LOAD( "fb000e.u42",  0x080000, 0x080000, CRC(969f1465) SHA1(4f56d1ad341b08f4db41b7ab2498740612ff7c3d) )
34333443
3434   ROM_REGION( 0x100000, "oki2", 0 )   /* Samples */
3435   ROM_LOAD( "fb002.u44",   0x000000, 0x080000, CRC(05d7c2a9) SHA1(e34d395985caec10139a22daa179bb185df157d6) )   // 2 x $40000
3436   ROM_LOAD( "fb003.u45",   0x080000, 0x080000, CRC(405722e9) SHA1(92e51093d50f74f650ba137f5fc2910e0f85337e) )   // 2 x $40000
3444   /* Sound data is copied here during driver init */
3445   ROM_REGION( 0x400000*16, "oki1", 0 )
3446   ROM_FILL(                0x00000, 0x400000*16, 0x00 )
3447
3448   ROM_REGION( 0x200000, "oki2", 0 )
3449   ROM_LOAD( "fb-002.u45",   0x000000, 0x100000, CRC(010acc17) SHA1(2dc0897c7778eacf6bce12ff0adbadb307ea6c17) )
3450   ROM_LOAD( "fb-003.u44",   0x100000, 0x100000, CRC(0aea4ac5) SHA1(8f3b30e505b0ba51c140a0a2c071680d4fa05db9) )
34373451ROM_END
34383452
34393453/***************************************************************************
r5613r5614
34823496    ROM_REGION( 0x020000, "cpu1", 0 )         /* MCU Code */
34833497   ROM_LOAD( "fb040j.u33",  0x000000, 0x020000, CRC(299d0746) SHA1(67fe3a47ab01fa02ce2bb5836c2041986c19d875) )
34843498
3485   ROM_REGION( 0x1000000, "gfx1", 0 )   /* Sprites */ /* not sure these are all correct size */
3499   ROM_REGION( 0x1000000, "gfx1", ROMREGION_ERASEFF )   /* Sprites */
34863500   ROM_LOAD( "fb-020a.u1", 0x000000, 0x100000, CRC(87e55c6d) SHA1(87886c045d7c30b8dee3c8fb0bf8f2cdbc5fd7fb) )
34873501   ROM_LOAD( "fb020b.u2",  0x100000, 0x100000, CRC(276b9d7b) SHA1(7a154f65b4737f2b6ac8effa3352711079f571dc) )
34883502   ROM_LOAD( "fb021a.u3",  0x200000, 0x100000, CRC(7da15d37) SHA1(345cf2242e8210a697294a45197f2b3b974de885) )
34893503   ROM_LOAD( "fb021b.u4",  0x300000, 0x100000, CRC(6a512d7b) SHA1(7fc3002d23262a9a590a283ea9e111e38d889ef2) )
3490   ROM_LOAD( "fb022a.u5",  0x400000, 0x080000, CRC(60aa1282) SHA1(4648816016e00df3256226ba5134f6e5bb429909) )
3491   ROM_LOAD( "fb022b.u6",  0x480000, 0x080000, CRC(cd05a5c8) SHA1(9f000cca8d31e19fdc4b38c00c3ed13f71e5541c) )
3492   ROM_LOAD( "fb023.u7",   0x500000, 0x100000, CRC(132794bd) SHA1(bcc73c3183c59a4b66f79d04774773b8a9239501) )
3504   ROM_LOAD( "fb-22a.u5",  0x400000, 0x100000, CRC(9039e5d3) SHA1(222452cd7947f7c99c68e495835cca62e0449b5c) )
3505   ROM_LOAD( "fb-22b.u6",  0x500000, 0x100000, CRC(96ac9e54) SHA1(2b066375963dc57fe2ce89d65f6c0a9d183a838d) )
3506   ROM_LOAD( "fb023.u7",   0x600000, 0x100000, CRC(132794bd) SHA1(bcc73c3183c59a4b66f79d04774773b8a9239501) )
34933507
34943508   ROM_REGION( 0x400000, "gfx2", 0 )   /* Tiles (scrambled) */
34953509   ROM_LOAD( "fb010.u65",  0x000000, 0x100000, CRC(296ffd92) SHA1(183a28e4594c428deb4726ed22d5166592b94b60) )   // 42 pin mask rom
34963510   ROM_LOAD( "fb011.u66",  0x100000, 0x080000, CRC(500a0367) SHA1(6dc5190f81b21f59ee56a3b2332c8d86d6599782) )   // 40 pin mask rom (verified correct)
34973511
3498   ROM_REGION( 0x100000, "oki1", 0 )   /* Samples */
3499   ROM_LOAD( "fb000j.u43",    0x000000, 0x080000, CRC(a7522555) SHA1(ea88d90dda20bc309f98a1924c41551e7708e6af) )   // 2 x $40000
3500   ROM_LOAD( "fb001j_u.101",  0x080000, 0x080000, CRC(07d4e8e2) SHA1(0de911f452ddeb54b0b435b9c1cf5d5881175d44) )   // 2 x $40000
35013512
3502   ROM_REGION( 0x100000, "oki2", 0 )   /* Samples */
3503   ROM_LOAD( "fb002.u44",   0x000000, 0x080000, CRC(05d7c2a9) SHA1(e34d395985caec10139a22daa179bb185df157d6) )   // 2 x $40000
3504   ROM_LOAD( "fb003.u45",   0x080000, 0x080000, CRC(405722e9) SHA1(92e51093d50f74f650ba137f5fc2910e0f85337e) )   // 2 x $40000
3513   ROM_REGION( 0x300000, "samples", 0 )
3514   ROM_LOAD( "fb000j.u43",    0x000000, 0x080000, CRC(a7522555) SHA1(ea88d90dda20bc309f98a1924c41551e7708e6af) )
3515   ROM_LOAD( "fb001j_u.101",  0x080000, 0x080000, CRC(07d4e8e2) SHA1(0de911f452ddeb54b0b435b9c1cf5d5881175d44) )
3516
3517   /* Sound data is copied here during driver init */
3518   ROM_REGION( 0x400000*16, "oki1", 0 )
3519   ROM_FILL(                0x00000, 0x400000*16, 0x00 )
3520
3521   ROM_REGION( 0x200000, "oki2", 0 )
3522   ROM_LOAD( "fb-002.u45",   0x000000, 0x100000, CRC(010acc17) SHA1(2dc0897c7778eacf6bce12ff0adbadb307ea6c17) )
3523   ROM_LOAD( "fb-003.u44",   0x100000, 0x100000, CRC(0aea4ac5) SHA1(8f3b30e505b0ba51c140a0a2c071680d4fa05db9) )
35053524ROM_END
35063525
35073526/***************************************************************************
r5613r5614
36163635
36173636***************************************************************************/
36183637
3638
36193639ROM_START( brapboys ) /* Single PCB, fully populated, no rom sub board */
36203640    ROM_REGION( 0x040000, "maincpu", 0 )         /* 68000 Code */
36213641   ROM_LOAD16_BYTE( "rb-030.u61", 0x000000, 0x020000, CRC(ccbe9a53) SHA1(b96baf0ecbf6550bfaf8e512d9275c53a3928bee) )
r5613r5614
37993819   DRIVER_INIT_CALL(kaneko16);
38003820    //  MCU is a 78K series III type CPU
38013821}
3802
3803static DRIVER_INIT( brapboys )
3822static void expand_shogwarr_samples(running_machine* machine)
38043823{
38053824   /*
38063825        Expand the OKI sample data
r5613r5614
38083827        OKI 1:
38093828        Address space 0x00000-0x2ffff is fixed
38103829        Address space 0x30000-0x3ffff is banked (13 banks)
3830    */
38113831
3812        OKI 2:
3813        Address space 0x00000-0x1ffff is fixed
3814        Address space 0x20000-0x3ffff is banked (15 banks)
3815
3816        The current sound device implementation can't handle
3817        the banking dynamically so we have to expand all the bank
3818        combinations here and use use okim6295_set_bank_base().
3819    */
38203832   int bank;
38213833   UINT8 *src = memory_region(machine, "samples");
38223834   UINT8 *dst1 = memory_region(machine, "oki1");
3823   UINT8 *dst2 = memory_region(machine, "oki2");
38243835
38253836   /* OKI 1 */
38263837   for (bank = 0; bank < 13; ++bank)
r5613r5614
38333844      memcpy(dst, src, 0x30000);
38343845      memcpy(dst + 0x30000, srcn, 0x10000);
38353846   }
3847}
38363848
3849static void expand_brapboys_music(running_machine* machine)
3850{
3851   /*
3852        Expand the OKI sample data
3853
3854        OKI 2:
3855        Address space 0x00000-0x1ffff is fixed
3856        Address space 0x20000-0x3ffff is banked (15 banks)
3857    */
3858
3859   int bank;
3860   UINT8 *src = memory_region(machine, "samples");
3861   UINT8 *dst2 = memory_region(machine, "oki2");
3862
38373863   /* OKI 2 */
38383864   for (bank = 0; bank < 15; ++bank)
38393865   {
r5613r5614
38443870      memcpy(dst, src + 0x100000, 0x20000);
38453871      memcpy(dst + 0x20000, srcn, 0x20000);
38463872   }
3873}
38473874
3875static DRIVER_INIT( shogwarr )
3876{
3877   expand_shogwarr_samples(machine);
38483878   DRIVER_INIT_CALL(calc3);
38493879}
38503880
38513881
3882static DRIVER_INIT( brapboys )
3883{
3884   expand_shogwarr_samples(machine);
3885   // sample banking is different on brap boys for the music, why? GALs / PALs ?
3886   expand_brapboys_music(machine);
3887   DRIVER_INIT_CALL(calc3);
3888}
3889
3890
38523891/***************************************************************************
38533892
38543893
r5613r5614
38783917// some functionality of the protection chip still needs investigating on these, but they seem to be playable
38793918GAME( 1992, brapboys, 0,        shogwarr, brapboys, brapboys,          ROT0,  "Kaneko", "B.Rap Boys (World)",      0 )
38803919GAME( 1992, brapboysj,brapboys, shogwarr, brapboys, brapboys,          ROT0,  "Kaneko", "B.Rap Boys Special (Japan)",      0 )
3920GAME( 1992, shogwarr, 0,        shogwarr, shogwarr, shogwarr,   ROT0,  "Kaneko", "Shogun Warriors (US)",    0 )
3921GAME( 1992, shogwarre,shogwarr, shogwarr, shogwarr, shogwarr,   ROT0,  "Kaneko", "Shogun Warriors (World)", 0 )
3922GAME( 1992, fjbuster, shogwarr, shogwarr, shogwarr, shogwarr,   ROT0,  "Kaneko", "Fujiyama Buster (Japan)", 0 )
38813923
3882/* Non-working games (mainly due to protection) */
3883
3884GAME( 1992, shogwarr, 0,        shogwarr, shogwarr, calc3,   ROT0,  "Kaneko", "Shogun Warriors",         GAME_NOT_WORKING )
3885GAME( 1992, shogwarre,shogwarr, shogwarr, shogwarr, calc3,   ROT0,  "Kaneko", "Shogun Warriors (Euro)",  GAME_NOT_WORKING )
3886GAME( 1992, fjbuster, shogwarr, shogwarr, shogwarr, calc3,   ROT0,  "Kaneko", "Fujiyama Buster (Japan)", GAME_NOT_WORKING )
3887
src/mame/drivers/namcos10.c
r5613r5614
456456ROM_START( mrdrilr2 )
457457   ROM_REGION32_LE( 0x800000, "user1", 0 ) /* main prg */
458458   ROM_LOAD( "dr21vera.1a",  0x000000, 0x800000, CRC(f93532a2) SHA1(8b72f2868978be1f0e0abd11425a3c8b2b0c4e99) )
459
460   ROM_REGION( 0x4000000, "user2", 0 ) /* main prg */
461        ROM_LOAD( "dr21ma1.1d", 0x0000000, 0x1000000, CRC(26dc6f55) SHA1(a9cedf547fa7a4d5850b9b3b867d46e577a035e0) )
462        ROM_LOAD( "dr21ma2.2d", 0x1000000, 0x1000000, CRC(702556ff) SHA1(c95defd5fd6a9b406fc8d8f28ecfab732ef1ff42) )
459463ROM_END
460464
465ROM_START( mrdrlr2a )
466   ROM_REGION32_LE( 0x800000, "user1", 0 ) /* main prg */
467        ROM_LOAD( "dr22vera.1a",  0x000000, 0x800000, CRC(f2633388) SHA1(42e56c9758ee833390003d4b41956f75f5a22760) )
468
469   ROM_REGION( 0x4000000, "user2", 0 ) /* main prg */
470        ROM_LOAD( "dr21ma1.1d", 0x0000000, 0x1000000, CRC(26dc6f55) SHA1(a9cedf547fa7a4d5850b9b3b867d46e577a035e0) )
471        ROM_LOAD( "dr21ma2.2d", 0x1000000, 0x1000000, CRC(702556ff) SHA1(c95defd5fd6a9b406fc8d8f28ecfab732ef1ff42) )
472ROM_END
473
461474ROM_START( gjspace )
462475   ROM_REGION32_LE( 0x400000, "user1", 0 ) /* bios */
463476   ROM_FILL( 0x0000000, 0x400000, 0x55 )
r5613r5614
508521ROM_END
509522
510523GAME( 2000, mrdrilr2,  0,        namcos10, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
524GAME( 2000, mrdrlr2a,  mrdrilr2, namcos10, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR22 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
511525GAME( 2001, gjspace,   0,        namcos10, namcos10, gjspace,  ROT0, "Namco/Metro", "Gekitoride-Jong Space (10011 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
512526GAME( 2001, mrdrilrg,  0,        namcos10, namcos10, mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
513527GAME( 2001, knpuzzle,  0,        namcos10, namcos10, knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/btime.c
r5613r5614
20972097
20982098   memory_install_read8_handler(cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM), 0x0200, 0x0fff, 0, 0, (read8_space_func)SMH_BANK(10));
20992099   memory_set_bankptr(machine, 10, memory_region(machine, "audiocpu") + 0xe200);
2100   audio_nmi_enable_type = AUDIO_ENABLE_DIRECT;
2100   audio_nmi_enable_type = AUDIO_ENABLE_AY8910;
21012101}
21022102
21032103static DRIVER_INIT( sdtennis )
src/mame/drivers/igs017.c
r5613r5614
221221{
222222#ifdef MAME_DEBUG
223223   static int toggle = 0;
224   if (input_code_pressed_once(KEYCODE_T))   toggle = 1-toggle;
224   if (input_code_pressed_once(machine, KEYCODE_T))   toggle = 1-toggle;
225225   if (toggle)   {
226226      static int a = 0, w = 512;
227227      int h = 256;
228228
229      if (input_code_pressed(KEYCODE_O))      w += 1;
230      if (input_code_pressed(KEYCODE_I))      w -= 1;
229      if (input_code_pressed(machine, KEYCODE_O))      w += 1;
230      if (input_code_pressed(machine, KEYCODE_I))      w -= 1;
231231
232      if (input_code_pressed(KEYCODE_U))      w += 8;
233      if (input_code_pressed(KEYCODE_Y))      w -= 8;
232      if (input_code_pressed(machine, KEYCODE_U))      w += 8;
233      if (input_code_pressed(machine, KEYCODE_Y))      w -= 8;
234234
235      if (input_code_pressed(KEYCODE_RIGHT))   a += 1;
236      if (input_code_pressed(KEYCODE_LEFT))   a -= 1;
235      if (input_code_pressed(machine, KEYCODE_RIGHT))   a += 1;
236      if (input_code_pressed(machine, KEYCODE_LEFT))   a -= 1;
237237
238      if (input_code_pressed(KEYCODE_DOWN))   a += w;
239      if (input_code_pressed(KEYCODE_UP))      a -= w;
238      if (input_code_pressed(machine, KEYCODE_DOWN))   a += w;
239      if (input_code_pressed(machine, KEYCODE_UP))      a -= w;
240240
241      if (input_code_pressed(KEYCODE_PGDN))   a += w * h;
242      if (input_code_pressed(KEYCODE_PGUP))   a -= w * h;
241      if (input_code_pressed(machine, KEYCODE_PGDN))   a += w * h;
242      if (input_code_pressed(machine, KEYCODE_PGUP))   a -= w * h;
243243
244244      if (a < 0)      a = 0;
245245      if (a > sprites_gfx_size)   a = sprites_gfx_size;
r5613r5614
264264   int layers_ctrl = -1;
265265
266266#ifdef MAME_DEBUG
267   if (input_code_pressed(KEYCODE_Z))
267   if (input_code_pressed(screen->machine, KEYCODE_Z))
268268   {
269269      int mask = 0;
270      if (input_code_pressed(KEYCODE_Q))   mask |= 1;
271      if (input_code_pressed(KEYCODE_W))   mask |= 2;
272      if (input_code_pressed(KEYCODE_A))   mask |= 4;
270      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 1;
271      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 2;
272      if (input_code_pressed(screen->machine, KEYCODE_A))   mask |= 4;
273273      if (mask != 0) layers_ctrl &= mask;
274274   }
275275#endif
src/mame/drivers/playmark.c
r5613r5614
155155
156156   if ((playmark_oki_control & 0x38) == 0x30) {
157157      data = playmark_snd_command;
158//      logerror("PortB reading %02x from the 68K\n",data);
158//      logerror("PC$%03x PortB reading %02x from the 68K\n",cpu_get_previouspc(space->cpu),data);
159159   }
160160   else if ((playmark_oki_control & 0x38) == 0x28) {
161161      data = (okim6295_r(devtag_get_device(space->machine, "oki"),0) & 0x0f);
162//      logerror("PortB reading %02x from the OKI status port\n",data);
162//      logerror("PC$%03x PortB reading %02x from the OKI status port\n",cpu_get_previouspc(space->cpu),data);
163163   }
164164
165165   return data;
r5613r5614
198198
199199static WRITE8_DEVICE_HANDLER( playmark_snd_control_w )
200200{
201//  const address_space *space = cputag_get_address_space(device->machine, "audiocpu", ADDRESS_SPACE_PROGRAM);
202
201203    /*  This port controls communications to and from the 68K, and the OKI
202204        device.
203205
r5613r5614
215217
216218   if ((data & 0x38) == 0x18)
217219   {
218//      logerror("Writing %02x to OKI1, PortC=%02x, Code=%02x\n",playmark_oki_command,playmark_oki_control,playmark_snd_command);
220//      logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",cpu_get_previouspc(space->cpu),playmark_oki_command,playmark_oki_control,playmark_snd_command);
219221      okim6295_w(device, 0, playmark_oki_command);
220222   }
221223}
r5613r5614
392394   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
393395   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
394396   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
395   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
396   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
397   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
398   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
399   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
400   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
397   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
398//  PORT_DIPSETTING(    0x20, DEF_STR( Easy ) ) /* Seems same as Medium */
399   PORT_DIPSETTING(   0x30, DEF_STR( Medium ) )
400   PORT_DIPSETTING(   0x10, DEF_STR( Hard ) )
401   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
401402   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
402403   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
403404   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
src/mame/drivers/darius.c
r5613r5614
12031203   }
12041204   memory_set_bankptr(machine, 1, RAM);
12051205
1206   sound_global_enable( 1 );   /* mixer enabled */
1206   sound_global_enable( machine, 1 );   /* mixer enabled */
12071207
12081208   for( i = 0; i < DARIUS_VOL_MAX; i++ ){
12091209      darius_vol[i] = 0x00;   /* min volume */
src/mame/drivers/adp.c
r5613r5614
253253   int x,y,b;
254254
255255   b = ((HD63484_reg[0xcc/2] & 0x000f) << 16) + HD63484_reg[0xce/2];
256/*
257    if (input_code_pressed(KEYCODE_M)) b = 0;
258    if (input_code_pressed(KEYCODE_Q)) b += 0x060 * 280 * 1;
259    if (input_code_pressed(KEYCODE_W)) b += 0x060 * 280 * 2;
260    if (input_code_pressed(KEYCODE_E)) b += 0x060 * 280 * 3;
261    if (input_code_pressed(KEYCODE_R)) b += 0x060 * 280 * 4;
262    if (input_code_pressed(KEYCODE_T)) b += 0x060 * 280 * 5;
263    if (input_code_pressed(KEYCODE_Y)) b += 0x060 * 280 * 6;
264    if (input_code_pressed(KEYCODE_U)) b += 0x060 * 280 * 7;
265    if (input_code_pressed(KEYCODE_I)) b += 0x060 * 280 * 8;
266    if (input_code_pressed(KEYCODE_A)) b += 0x060 * 280 * 9;
267    if (input_code_pressed(KEYCODE_S)) b += 0x060 * 280 * 10;
268    if (input_code_pressed(KEYCODE_D)) b += 0x060 * 280 * 11;
269    if (input_code_pressed(KEYCODE_F)) b += 0x060 * 280 * 12;
270    if (input_code_pressed(KEYCODE_G)) b += 0x060 * 280 * 13;
271    if (input_code_pressed(KEYCODE_H)) b += 0x060 * 280 * 14;
272    if (input_code_pressed(KEYCODE_J)) b += 0x060 * 280 * 15;
273    if (input_code_pressed(KEYCODE_K)) b += 0x060 * 280 * 16;
274    if (input_code_pressed(KEYCODE_Z)) b += 0x060 * 280 * 17;
275    if (input_code_pressed(KEYCODE_X)) b += 0x060 * 280 * 18;
276    if (input_code_pressed(KEYCODE_C)) b += 0x060 * 280 * 19;
277    if (input_code_pressed(KEYCODE_V)) b += 0x060 * 280 * 20;
278    if (input_code_pressed(KEYCODE_B)) b += 0x060 * 280 * 21;
279    if (input_code_pressed(KEYCODE_N)) b += 0x060 * 280 * 22;
280*/
256#if 0
257   if (input_code_pressed(screen->machine, KEYCODE_M)) b = 0;
258   if (input_code_pressed(screen->machine, KEYCODE_Q)) b += 0x060 * 280 * 1;
259   if (input_code_pressed(screen->machine, KEYCODE_W)) b += 0x060 * 280 * 2;
260   if (input_code_pressed(screen->machine, KEYCODE_E)) b += 0x060 * 280 * 3;
261   if (input_code_pressed(screen->machine, KEYCODE_R)) b += 0x060 * 280 * 4;
262   if (input_code_pressed(screen->machine, KEYCODE_T)) b += 0x060 * 280 * 5;
263   if (input_code_pressed(screen->machine, KEYCODE_Y)) b += 0x060 * 280 * 6;
264   if (input_code_pressed(screen->machine, KEYCODE_U)) b += 0x060 * 280 * 7;
265   if (input_code_pressed(screen->machine, KEYCODE_I)) b += 0x060 * 280 * 8;
266   if (input_code_pressed(screen->machine, KEYCODE_A)) b += 0x060 * 280 * 9;
267   if (input_code_pressed(screen->machine, KEYCODE_S)) b += 0x060 * 280 * 10;
268   if (input_code_pressed(screen->machine, KEYCODE_D)) b += 0x060 * 280 * 11;
269   if (input_code_pressed(screen->machine, KEYCODE_F)) b += 0x060 * 280 * 12;
270   if (input_code_pressed(screen->machine, KEYCODE_G)) b += 0x060 * 280 * 13;
271   if (input_code_pressed(screen->machine, KEYCODE_H)) b += 0x060 * 280 * 14;
272   if (input_code_pressed(screen->machine, KEYCODE_J)) b += 0x060 * 280 * 15;
273   if (input_code_pressed(screen->machine, KEYCODE_K)) b += 0x060 * 280 * 16;
274   if (input_code_pressed(screen->machine, KEYCODE_Z)) b += 0x060 * 280 * 17;
275   if (input_code_pressed(screen->machine, KEYCODE_X)) b += 0x060 * 280 * 18;
276   if (input_code_pressed(screen->machine, KEYCODE_C)) b += 0x060 * 280 * 19;
277   if (input_code_pressed(screen->machine, KEYCODE_V)) b += 0x060 * 280 * 20;
278   if (input_code_pressed(screen->machine, KEYCODE_B)) b += 0x060 * 280 * 21;
279   if (input_code_pressed(screen->machine, KEYCODE_N)) b += 0x060 * 280 * 22;
280#endif
281281   for (y = 0;y < 280;y++)
282282   {
283283      for (x = 0 ; x < (HD63484_reg[0xca/2] & 0x0fff) * 4 ; x += 4)
r5613r5614
290290         b++;
291291      }
292292   }
293if (!input_code_pressed(KEYCODE_O))
293if (!input_code_pressed(screen->machine, KEYCODE_O))
294294   if ((HD63484_reg[0x06/2] & 0x0300) == 0x0300)
295295   {
296296      int sy = (HD63484_reg[0x94/2] & 0x0fff) - (HD63484_reg[0x88/2] >> 8);
src/mame/drivers/crbaloon.c
r5613r5614
167167   crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE);
168168
169169   /* D1 - SOUND STOP */
170   sound_global_enable((data & 0x02) ? TRUE : FALSE);
170   sound_global_enable(space->machine, (data & 0x02) ? TRUE : FALSE);
171171
172172   /* D2 - unlabeled - music enable */
173173   crbaloon_audio_set_music_enable(discrete, 0, (data & 0x04) ? TRUE : FALSE);
src/mame/drivers/cmmb.c
r5613r5614
262262
263263static INTERRUPT_GEN( cmmb_irq )
264264{
265   //if(input_code_pressed_once(KEYCODE_Z))
265   //if(input_code_pressed_once(device->machine, KEYCODE_Z))
266266   //  cpu_set_input_line(device, 0, HOLD_LINE);
267267}
268268
src/mame/drivers/getrivia.c
r5613r5614
815815   ROM_LOAD( "jokerpoker_icb_9-30-86",    0x10000, 0x2000, CRC(a1473367) SHA1(9b37ccafc02704e8f1d61150326494e86148d84e) )
816816   ROM_LOAD( "blackjack_icb_9-30-86",     0x12000, 0x2000, CRC(82804184) SHA1(2e2e6a80c99c8eb226dc54c1d32d0bf24de300a4) )
817817   ROM_LOAD( "casinoslots_icb_9-30-86",   0x14000, 0x2000, CRC(713c3963) SHA1(a9297c04fc44522ca6891516a2c744712132896a) )
818   ROM_LOAD( "instantbingo_t24_10-07-86", 0x16000, 0x2000, CRC(de87ed0a) SHA1(4a26d93368c1a39dd38aabe450c34203101f0ef7) ) /* Found with this set, is it compatible or an operater swap? */
818   ROM_LOAD( "beatthespread_icb_9-30-86", 0x16000, 0x2000, CRC(93654d2a) SHA1(3aa5a54b91867c03182e93a7f1607545503a33f7) )
819   ROM_LOAD( "instantbingo_t24_10-07-86", 0x18000, 0x2000, CRC(de87ed0a) SHA1(4a26d93368c1a39dd38aabe450c34203101f0ef7) ) /* Found with this set, is it compatible or an operater swap? */
819820ROM_END
820821
821822ROM_START( gepoker2 ) /* v50.02 with control dated 9-30-84 */
src/mame/drivers/hshavoc.c
r5613r5614
300300
301301   }
302302
303   {
304      FILE*FP;
303/* Uncommented until actively worked on
304    {
305        FILE*FP;
305306
306      FP=fopen("hshavoc.dump","wb");
307        FP=fopen("hshavoc.dump","wb");
307308
308      fwrite(src, rom_size/2, 2, FP);
309      fclose(FP);
310   }
309        fwrite(src, rom_size/2, 2, FP);
310        fclose(FP);
311    }
312*/
311313
312314
313
314315   DRIVER_INIT_CALL(genesis);
315316
316317}
src/mame/drivers/speedbal.c
r5613r5614
7878   AM_RANGE(0xe000, 0xe1ff) AM_RAM_WRITE(speedbal_background_videoram_w) AM_BASE(&speedbal_background_videoram)
7979   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(speedbal_foreground_videoram_w) AM_BASE(&speedbal_foreground_videoram)
8080   AM_RANGE(0xf000, 0xf5ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram)
81   AM_RANGE(0xf600, 0xfeff) AM_RAM
81   AM_RANGE(0xf600, 0xfeff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
8282   AM_RANGE(0xff00, 0xffff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
8383ADDRESS_MAP_END
8484
r5613r5614
238238   MDRV_CPU_IO_MAP(sound_cpu_io_map)
239239   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,8)
240240
241   MDRV_NVRAM_HANDLER(generic_1fill)
242
241243   /* video hardware */
242244   MDRV_SCREEN_ADD("screen", RASTER)
243245   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/littlerb.c
r5613r5614
141141
142142static READ16_HANDLER( littlerb_vdp_r )
143143{
144   logerror("%06x littlerb_vdp_r offs %04x mask %04x\n", cpu_get_pc(space->cpu), offset, mem_mask);
145
144146   switch (offset)
145147   {
146148      case 0:
r5613r5614
159161   return -1;
160162}
161163
164int type2_writes = 0;
165UINT32 lasttype2pc = 0;
162166static WRITE16_HANDLER( littlerb_vdp_w )
163167{
168
169   if (offset!=2)
170   {
171      if (type2_writes)
172      {
173         if (type2_writes>2)
174         {
175            logerror("******************************* BIG WRITE OCCURRED BEFORE THIS!!! ****************************\n");
176         }
177
178         logerror("~%06x previously wrote %08x data bytes\n", lasttype2pc, type2_writes*2);
179         type2_writes = 0;
180      }
181
182      logerror("%06x littlerb_vdp_w offs %04x data %04x mask %04x\n", cpu_get_pc(space->cpu), offset, data, mem_mask);
183   }
184   else
185   {
186      if (mem_mask==0xffff)
187      {
188         if (type2_writes==0)
189         {
190            logerror("data write started %06x %04x data %04x mask %04x\n", cpu_get_pc(space->cpu), offset, data, mem_mask);
191         }
192
193         type2_writes++;
194         lasttype2pc = cpu_get_pc(space->cpu);
195      }
196      else
197      {
198         logerror("xxx %06x littlerb_vdp_w offs %04x data %04x mask %04x\n", cpu_get_pc(space->cpu), offset, data, mem_mask);
199      }
200   }
201
202
164203   switch (offset)
165204   {
166205      case 0:
r5613r5614
359398   return 0;
360399}
361400
401static INTERRUPT_GEN( littlerb )
402{
403   logerror("IRQ\n");
404   cpu_set_input_line(device, 4, HOLD_LINE);
405}
406
362407static MACHINE_DRIVER_START( littlerb )
363408   MDRV_CPU_ADD("maincpu", M68000, 12000000)
364409   MDRV_CPU_PROGRAM_MAP(littlerb_main)
365   MDRV_CPU_VBLANK_INT("screen", irq4_line_hold)
410   MDRV_CPU_VBLANK_INT("screen", littlerb)
366411
367412
368413   MDRV_SCREEN_ADD("screen", RASTER)
src/mame/drivers/chihiro.c
r5613r5614
1/* Chihiro Skeleton
2 -- split from Naomi.c
1/*
32
4 Chihiro uses
3Chihiro is an Xbox based arcade motherboard from SEGA
4A Chihiro system consists of network board, media board, base board & Xbox board
55
6custom XBOX motherboard + bios
6The whole system is divided into 2 parts and each part has two boards.
7The upper part contains a media board with a TSOP48 where there is an xbox .xbe loader
8(this is the dashboard you see when you power the Chihiro) and for a network board (100% the same
9as the one in the Triforce v3, same firmware also)
710
11The bottom section consists of an Xbox board with 128MB of RAM and with a different MCPX than
12a retail one and a base board that handles JVS and Video.
13
14Network Board Dump : Ver1305.bin
15Media Board dump   : FPR21042_M29W160ET.bin
16Base Board Dumps   : ic10_g24lc64.bin ic11_24lc024.bin pc20_g24lc64.bin
17Xbox Board Dump    : Not dumped
18
19FPR21042_M29W160ET.bin :
20As in Triforce, it consists of two versions in the same flash, the first MB of the flash has
21an older version as backup, and the second MB has the current version, versions included are:
22SegaBoot Ver.2.00.0 Build:Feb  7 2003 12:28:30
23SegaBoot Ver.2.13.0 Build:Mar  3 2005 17:03:15
24
25ic10_g24lc64.bin: This dump contains the firmware of the Base Board, serial number and REGION of the whole system
26Region is located at Offset 0x00001F10 , 01 means JAP, 02 Means USA, 03 Means EXPORT, if you
27want to change the region of your Chihiro Board, just change this byte.
28pc20_g24lc64.bin: it seems a backup of the base board without region or serial, older version maybe?
29ic11_24lc024.bin: this is the mysterious one, as the previous 2, its on the Base Board, and just contains some
30strings the interesting thing is that it contains the string SBJE and if you go to the system info menu
31on the Chihiro and you press service button 16 times in a row, a message will be displayed: GAME ID SBJE
32
33Thanks to Alex, Mr Mudkips, and Philip Burke for this info.
34
835*/
936
1037#include "driver.h"
src/mame/drivers/wheelfir.c
r5613r5614
292292    int x,y;
293293    static int base = 0;
294294
295    if ( input_code_pressed_once(KEYCODE_E) )
295    if ( input_code_pressed_once(screen->machine, KEYCODE_E) )
296296        base += 512*512;
297297
298    if ( input_code_pressed_once(KEYCODE_Q) )
298    if ( input_code_pressed_once(screen->machine, KEYCODE_Q) )
299299        base -= 512*512;
300300
301301    if (base<0x000000) base = 0x000000;
r5613r5614
306306    copybitmap_trans(bitmap, wheelfir_tmp_bitmap[0], 0, 0, 0, 0, cliprect, 0);
307307    bitmap_fill(wheelfir_tmp_bitmap[0], video_screen_get_visible_area(screen),0);
308308
309    if ( input_code_pressed(KEYCODE_R) )
309    if ( input_code_pressed(screen->machine, KEYCODE_R) )
310310    {
311311        const UINT8 *gfx = memory_region(machine, "gfx1");
312312        for (y=0;y<128;y++)
src/mame/drivers/seta.c
r5613r5614
1919            X1-014                      Sprites?
2020
2121-------------------------------------------------------------------------------
22Ordered by Board        Year + Game                         Licensed To
22Ordered by Board        Year + Game                             Licensed To
2323-------------------------------------------------------------------------------
24P0-029-A (M6100287A)    88 Thundercade / Twin Formation (1) Taito
25?        (M6100326A)    88 Twin Eagle                       Taito
26P0-045-A (M6100429A)    89 DownTown                         Taito / RomStar
27?        (M6100430A)    89 U.S. Classic(2)                  Taito / RomStar
28?                       88 Caliber 50                       Taito / RomStar
29?                       89 Arbalester                       Taito / RomStar
24P0-029-A (M6100287A)    88 Thundercade / Twin Formation (1)     Taito
25?        (M6100326A)    88 Twin Eagle                           Taito
26P0-045-A (M6100429A)    89 DownTown                             Taito / RomStar
27?        (M6100430A)    89 U.S. Classic(2)                      Taito / RomStar
28?                       88 Caliber 50                           Taito / RomStar
29?                       89 Arbalester                           Taito / RomStar
3030P1-036-A + P0-045-A +
31P1-049-A                89 Meta Fox                         Taito / RomStar
32P0-053-1                89 Castle of Dragon/Dragon Unit     Taito / RomStar / Athena
33P0-053-A                91 Strike Gunner S.T.G              Athena / Tecmo
34P0-053-A                92 Quiz Kokology                    Tecmo
35P0-055-B                89 Wit's                            Athena
36P0-055-D                90 Thunder & Lightning              Romstar / Visco
37Promat PCB              94 Wiggie Waggie(5)                 --
38P0-058-C                98 Internation Toote (6)            Coinmaster
39P0-063-A                91 Rezon                            Allumer
40P0-068-B (M6100723A)    92 Block Carnival                   Visco
41P0-072-2 (prototype)    92 Blandia (prototype)              Allumer
42P0-077-A (BP922)        92 Ultraman Club                    Banpresto
43PO-078-A                92 Blandia                          Allumer
44P0-079-A                92 Zing Zing Zip                    Allumer + Tecmo
45P0-079-A                94 Eight Forces                     Tecmo
46PO-080-A (BP923)        92 SD Gundam Neo Battling (3)       Banpresto
47?                       93 Athena no Hatena?                Athena
48?                       93 J.J.Squawkers                    Athena / Able
49?        (93111A)       93 War Of Aero                      Yang Cheng
50P0-081-A                93 Mobile Suit Gundam               Banpresto
51PO-083-A (BP931)        93 Ultra Toukon Densetsu            Banpresto + Tsuburaya Prod.
52PO-092-A                93 Daioh                            Athena
53PO-096-A (BP934KA)      93 Kamen Rider                      Banpresto
54P0-097-A                93 Oishii Puzzle ..                 Sunsoft + Atlus
55bootleg                 9? Triple Fun (4)                   bootleg (Comad?)
56P0-100-A                93 Quiz Kokology 2                  Tecmo
57P0-101-1                94 Pro Mahjong Kiwame               Athena
58PO-102-A                93 Mad Shark                        Allumer
59PO-107-A (prototype?)   94 Orbs (prototype?)                American Sammy
60P0-114-A (SKB-001)      94 Krazy Bowl                       American Sammy
61P0-117-A (DH-01)        95 Extreme Downhill                 Sammy Japan
62P0-117-A?               95 Sokonuke Taisen Game             Sammy Industries
63P0-120-A (BP954KA)      95 Gundhara                         Banpresto
64PO-122-A (SZR-001)      95 Zombie Raid                      American Sammy
65?                       96 Crazy Fight                      Subsino
31P1-049-A                89 Meta Fox                             Taito / RomStar
32P0-053-1                89 Castle of Dragon/Dragon Unit         Taito / RomStar / Athena
33P0-053-A                91 Strike Gunner S.T.G                  Athena / Tecmo
34P0-053-A                92 Quiz Kokology                        Tecmo
35P0-055-B                89 Wit's                                Athena
36P0-055-D                90 Thunder & Lightning                  Romstar / Visco
37Promat PCB              94 Wiggie Waggie(5)                     --
38P0-058-C                98 Internation Toote (6)                Coinmaster
39P0-063-A                91 Rezon                                Allumer
40P0-068-B (M6100723A)    92 Block Carnival                       Visco
41P0-072-2 (prototype)    92 Blandia (prototype)                  Allumer
42P0-077-A (BP922)        92 Ultraman Club                        Banpresto
43PO-078-A                92 Blandia                              Allumer
44P0-079-A                92 Zing Zing Zip                        Allumer + Tecmo
45P0-079-A                94 Eight Forces                         Tecmo
46PO-080-A (BP923)        92 SD Gundam Neo Battling (3)           Banpresto
47?                       93 Athena no Hatena?                    Athena
48?                       93 J.J.Squawkers                        Athena / Able
49?        (93111A)       93 War Of Aero                          Yang Cheng
50P0-081-A                93 Mobile Suit Gundam                   Banpresto
51PO-083-A (BP931)        93 Ultra Toukon Densetsu                Banpresto + Tsuburaya Prod.
52PO-092-A                93 Daioh                                Athena
53PO-096-A (BP934KA)      93 Kamen Rider                          Banpresto
54P0-097-A                93 Oishii Puzzle ..                     Sunsoft + Atlus
55bootleg                 9? Triple Fun (4)                       bootleg (Comad?)
56P0-100-A                93 Quiz Kokology 2                      Tecmo
57P0-101-1                94 Pro Mahjong Kiwame                   Athena
58PO-102-A                93 Mad Shark                            Allumer
59PO-107-A (prototype?)   94 Orbs (prototype?)                    American Sammy
60PO-107-A                93 Kero Kero Keroppi no Issyoni Asobou  Sammy Industries  [added Chack'n, Hau]
61P0-114-A (SKB-001)      94 Krazy Bowl                           American Sammy
62P0-117-A (DH-01)        95 Extreme Downhill                     Sammy Japan
63P0-117-A?               95 Sokonuke Taisen Game                 Sammy Industries
64P0-120-A (BP954KA)      95 Gundhara                             Banpresto
65PO-122-A (SZR-001)      95 Zombie Raid                          American Sammy
66?                       96 Crazy Fight                          Subsino
6667-------------------------------------------------------------------------------
6768(1) YM2203 + YM3812 instead of X1-010
6869(2) wrong colors
r5613r5614
19831984ADDRESS_MAP_END
19841985
19851986/***************************************************************************
1987                  Kero Kero Keroppi no Issyoni Asobou
1988***************************************************************************/
1989
1990static int keroppi_prize_hop;
1991static int keroppi_protection_count;
1992static const UINT16 keroppi_protection_word[] = {
1993   0x0000,
1994   0x0000, 0x0000, 0x0000,
1995   0x2000, 0x2000, 0x2000,
1996   0x2000, 0x2000, 0x2000,
1997   0x0400, 0x0400, 0x0400,
1998   0x0000, 0x0000, 0x0000
1999};
2000
2001
2002static READ16_HANDLER( keroppi_protection_r )
2003{
2004   UINT16 result = keroppi_protection_word[keroppi_protection_count];
2005
2006   keroppi_protection_count++;
2007   if (keroppi_protection_count > 15)
2008      keroppi_protection_count = 15;
2009
2010   return result;
2011}
2012
2013static READ16_HANDLER( keroppi_protection_init_r )
2014{
2015   keroppi_protection_count = 0;
2016
2017   return 0x00;
2018}
2019
2020static READ16_HANDLER( keroppi_coin_r )
2021{
2022   UINT16 result = input_port_read(space->machine, "COINS");
2023
2024   if (keroppi_prize_hop == 2)
2025   {
2026      result &= ~0x0002;      /* prize hopper */
2027      keroppi_prize_hop = 0;
2028   }
2029
2030   return result;
2031}
2032
2033static TIMER_CALLBACK( keroppi_prize_hop_callback )
2034{
2035   keroppi_prize_hop = 2;
2036}
2037
2038static WRITE16_HANDLER( keroppi_prize_w )
2039{
2040   if ((data & 0x0010) && !keroppi_prize_hop)
2041   {
2042      keroppi_prize_hop = 1;
2043      timer_set(space->machine, ATTOTIME_IN_SEC(3), NULL, 0x20, keroppi_prize_hop_callback);      /* 3 seconds */
2044   }
2045}
2046
2047static ADDRESS_MAP_START( keroppi_map, ADDRESS_SPACE_PROGRAM, 16 )
2048   AM_RANGE(0x000000, 0x07ffff) AM_ROM                        // ROM
2049   AM_RANGE(0xf00000, 0xf0ffff) AM_RAM                        // RAM
2050   AM_RANGE(0x100000, 0x100001) AM_READ(keroppi_protection_r)      //
2051   AM_RANGE(0x200000, 0x200001) AM_READ(keroppi_protection_init_r)   //
2052   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
2053   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                  // ?
2054   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
2055   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2056   AM_RANGE(0x500004, 0x500005) AM_READ(keroppi_coin_r)         // Coins
2057   AM_RANGE(0x8000f0, 0x8000f1) AM_RAM                        // NVRAM
2058   AM_RANGE(0x800100, 0x8001ff) AM_RAM                        // NVRAM
2059   AM_RANGE(0x900000, 0x900001) AM_WRITENOP                  // ?
2060   AM_RANGE(0x900002, 0x900003) AM_WRITE(keroppi_prize_w)         //
2061   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1", seta_sound_word_r,seta_sound_word_w)   // Sound
2062   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE(&paletteram16) AM_SIZE(&seta_paletteram_size)   // Palette
2063   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE(&spriteram16_2)      // Sprites Code + X + Attr
2064/**/AM_RANGE(0xd00000, 0xd00001) AM_RAM                        // ? 0x4000
2065/**/AM_RANGE(0xe00000, 0xe00607) AM_RAM AM_BASE(&spriteram16)      // Sprites Y
2066ADDRESS_MAP_END
2067
2068static MACHINE_START( keroppi )
2069{
2070   keroppi_prize_hop = 0;
2071   keroppi_protection_count = 0;
2072}
2073
2074/***************************************************************************
19862075                                Block Carnival
19872076***************************************************************************/
19882077
r5613r5614
58085897INPUT_PORTS_END
58095898
58105899/***************************************************************************
5900                  Kero Kero Keroppi no Issyoni Asobou
5901***************************************************************************/
5902
5903static INPUT_PORTS_START( keroppi )
5904   PORT_START("P1")
5905   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
5906   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
5907   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
5908   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
5909   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
5910   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
5911   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Prize Out") PORT_CODE(KEYCODE_W)
5912   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
5913
5914   PORT_START("P2")
5915   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
5916   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
5917   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(5)
5918   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
5919   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
5920   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
5921   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
5922   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
5923
5924   PORT_START("COINS") //Coins
5925   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
5926   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Prize Hopper") PORT_CODE(KEYCODE_Q)
5927   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
5928   PORT_BIT( 0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
5929   PORT_BIT( 0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN )
5930   PORT_BIT( 0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
5931   PORT_BIT( 0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
5932   PORT_BIT( 0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
5933
5934   PORT_START("DSW") //2 DSWs - $600001 & 3.b
5935   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2,3")
5936   PORT_DIPSETTING(      0x0003, "1" )
5937   PORT_DIPSETTING(      0x0005, "2" )
5938   PORT_DIPSETTING(      0x0001, "3" )
5939   PORT_DIPSETTING(      0x0007, "4" )
5940   PORT_DIPSETTING(      0x0006, "5" )
5941   PORT_DIPSETTING(      0x0002, "6" )
5942   PORT_DIPSETTING(      0x0004, "7" )
5943   PORT_DIPSETTING(      0x0000, "8" )
5944   PORT_DIPNAME( 0x0038, 0x0038, "Game Select" ) PORT_DIPLOCATION("SW2:4,5,6")
5945   PORT_DIPSETTING(      0x0038, "No. 1,2,3" )
5946   PORT_DIPSETTING(      0x0030, "No. 1" )
5947   PORT_DIPSETTING(      0x0028, "No. 2,3" )
5948   PORT_DIPSETTING(      0x0020, "No. 3" )
5949   PORT_DIPSETTING(      0x0018, "No. 1,2" )
5950   PORT_DIPSETTING(      0x0010, "No. 2" )
5951   PORT_DIPSETTING(      0x0008, "No. 1,3" )
5952   PORT_DIPSETTING(      0x0000, "No. 1,2,3" )
5953   PORT_DIPNAME( 0x0040, 0x0040, "Unknown 2-7" ) PORT_DIPLOCATION("SW2:7")
5954   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
5955   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5956   PORT_DIPNAME( 0x0080, 0x0080, "Unknown 2-8" ) PORT_DIPLOCATION("SW2:8")
5957   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
5958   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5959
5960   PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
5961   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
5962   PORT_DIPSETTING(      0x0400, DEF_STR( 4C_1C ) )
5963   PORT_DIPSETTING(      0x0200, DEF_STR( 3C_1C ) )
5964   PORT_DIPSETTING(      0x0600, DEF_STR( 2C_1C ) )
5965   PORT_DIPSETTING(      0x0700, DEF_STR( 1C_1C ) )
5966   PORT_DIPSETTING(      0x0300, DEF_STR( 1C_2C ) )
5967   PORT_DIPSETTING(      0x0500, DEF_STR( 1C_3C ) )
5968   PORT_DIPSETTING(      0x0100, DEF_STR( 1C_4C ) )
5969   PORT_DIPNAME( 0x0800, 0x0800, "Unknown 1-4" ) PORT_DIPLOCATION("SW1:4")
5970   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
5971   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5972   PORT_DIPNAME( 0x1000, 0x1000, "Unknown 1-5" ) PORT_DIPLOCATION("SW1:5")
5973   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
5974   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5975   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:6")
5976   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
5977   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5978   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
5979   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
5980   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5981   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW1:8" )
5982INPUT_PORTS_END
5983
5984/***************************************************************************
58115985                                Crazy Fight
58125986***************************************************************************/
58135987
r5613r5614
73207494
73217495
73227496/***************************************************************************
7497                  Kero Kero Keroppi no Issyoni Asobou
7498***************************************************************************/
7499
7500static MACHINE_DRIVER_START( keroppi )
7501
7502   /* basic machine hardware */
7503   MDRV_CPU_ADD("maincpu", M68000, 14318180/2)   /* 7.143 MHz */
7504   MDRV_CPU_PROGRAM_MAP(keroppi_map)
7505   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7506
7507   MDRV_MACHINE_START(keroppi)
7508
7509   /* video hardware */
7510   MDRV_SCREEN_ADD("screen", RASTER)
7511   MDRV_SCREEN_REFRESH_RATE(60)
7512   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
7513   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
7514   MDRV_SCREEN_SIZE(64*8, 32*8)
7515   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
7516
7517   MDRV_GFXDECODE(orbs)
7518   MDRV_PALETTE_LENGTH(512)   /* sprites only */
7519
7520   MDRV_VIDEO_START(seta_no_layers)
7521   MDRV_VIDEO_UPDATE(seta_no_layers) /* just draw the sprites */
7522
7523   /* sound hardware */
7524   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
7525
7526   MDRV_SOUND_ADD("x1", X1_010, 14318180)   /* 14.318180 MHz */
7527   MDRV_SOUND_CONFIG(seta_sound_intf)
7528   MDRV_SOUND_ROUTE(0, "lspeaker", 1.0)
7529   MDRV_SOUND_ROUTE(1, "rspeaker", 1.0)
7530MACHINE_DRIVER_END
7531
7532
7533/***************************************************************************
73237534                                Krazy Bowl
73247535***************************************************************************/
73257536
r5613r5614
89449155   ROM_LOAD( "orbs.u16",  0x080000, 0x080000, CRC(aecd8373) SHA1(5620bcb281a9ea4920cfe81d163827013289c5bf) )
89459156ROM_END
89469157
9158ROM_START( keroppi )
9159   ROM_REGION( 0x100000, "maincpu", 0 )      /* 68000 Code */
9160   ROM_LOAD16_BYTE( "ft-001-001.u10",  0x000000, 0x080000, CRC(37861e7d) SHA1(4bf75f119b0ef1420c96844224850867fa8e273f) )
9161   ROM_LOAD16_BYTE( "ft-001-002.u9",   0x000001, 0x080000, CRC(f531d4ef) SHA1(75a99695679de083765700c250bd1fdfd8be9981) )
9162
9163   ROM_REGION( 0x200000, "gfx1", 0 )   /* Sprites */
9164   ROM_LOAD( "ft-001-003.u14",  0x000000, 0x080000, CRC(62fb22fb) SHA1(a67cb46152b73a47c2287c4058d0a22fb7064e7e) )
9165   ROM_LOAD( "ft-001-004.u13",  0x080000, 0x080000, CRC(69908c98) SHA1(1af069e9330a33cd2f0e1365e05c72eb23c3244e) )
9166   ROM_LOAD( "ft-001-005.u12",  0x100000, 0x080000, CRC(de6432a8) SHA1(afee9b29e0b3db4815fc29456044532aee03597e) )
9167   ROM_LOAD( "ft-001-006.u11",  0x180000, 0x080000, CRC(9c500eae) SHA1(3448adef04c9ad2e0b39a283e4eb9c9bac7d4967) )
9168
9169   ROM_REGION( 0x100000, "x1", 0 )   /* Samples */
9170   ROM_LOAD( "ft-001-007.u15",  0x000000, 0x080000, CRC(c98dacf0) SHA1(b508433e2383af1e8bd5fda253c9925c48443490) )
9171   ROM_LOAD( "ft-001-008.u16",  0x080000, 0x080000, CRC(b9c4b637) SHA1(82977d10de1048f71525bab5431b031cca510114) )
9172ROM_END
9173
89479174ROM_START( extdwnhl )
89489175   ROM_REGION( 0x100000, "maincpu", 0 )      /* 68000 Code */
89499176   ROM_LOAD16_BYTE( "fw001002.201",  0x000000, 0x080000, CRC(24d21924) SHA1(9914a68a578f884b06305ffcd9aeed7d83df1c7b) )
r5613r5614
95709797GAME( 1994, kiwame,   0,        kiwame,   kiwame,   kiwame,   ROT0,   "Athena",                 "Pro Mahjong Kiwame", 0 )
95719798GAME( 1994, krzybowl, 0,        krzybowl, krzybowl, 0,        ROT270, "American Sammy",         "Krazy Bowl", 0 )
95729799GAME( 1994, orbs,     0,        orbs,     orbs,     0,        ROT0,   "American Sammy",         "Orbs (10/7/94 prototype?)", 0 )
9800GAME( 1993, keroppi,  0,        keroppi,  keroppi,  0,        ROT0,   "Sammy Industries",       "Kero Kero Keroppi no Issyoni Asobou (Japan)", 0 )
95739801GAME( 1995, extdwnhl, 0,        extdwnhl, extdwnhl, 0,        ROT0,   "Sammy Industries Japan", "Extreme Downhill (v1.5)", GAME_IMPERFECT_GRAPHICS )
95749802GAME( 1995, gundhara, 0,        gundhara, gundhara, 0,        ROT270, "Banpresto",              "Gundhara", 0 )
95759803GAME( 1995, sokonuke, 0,        extdwnhl, sokonuke, 0,        ROT0,   "Sammy Industries",       "Sokonuke Taisen Game (Japan)", GAME_IMPERFECT_SOUND )
src/mame/drivers/naomi.c
r5613r5614
12711271
12721272   AM_RANGE(0x00200000, 0x00207fff) AM_RAM                                             // bios uses it (battery backed ram ?)
12731273   AM_RANGE(0x005f6800, 0x005f69ff) AM_READWRITE( dc_sysctrl_r, dc_sysctrl_w )
1274   AM_RANGE(0x005f6c00, 0x005f6cff) AM_READWRITE( dc_maple_r, dc_maple_w )
1274   AM_RANGE(0x005f6c00, 0x005f6cff) AM_READWRITE( naomi_maple_r, naomi_maple_w )
12751275   AM_RANGE(0x005f7000, 0x005f70ff) AM_DEVREADWRITE("rom_board", naomibd_r, naomibd_w)
12761276   AM_RANGE(0x005f7400, 0x005f74ff) AM_READWRITE( dc_g1_ctrl_r, dc_g1_ctrl_w )
12771277   AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE( dc_g2_ctrl_r, dc_g2_ctrl_w )
r5613r5614
12851285
12861286   AM_RANGE(0x0103ff00, 0x0103ffff) AM_READWRITE( naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known
12871287
1288   AM_RANGE(0x03010098, 0x0301009f) AM_RAM   // Naomi 2 BIOS tests this, needs to read back as written
1289
12881290   /* Area 1 */
12891291   AM_RANGE(0x04000000, 0x04ffffff) AM_RAM   AM_BASE( &dc_texture_ram )      // texture memory 64 bit access
12901292   AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_BASE( &dc_framebuffer_ram ) // apparently this actually accesses the same memory as the 64-bit texture memory access, but in a different format, keep it apart for now
r5613r5614
13221324   AM_RANGE(0x00, 0x0f) AM_READWRITE(eeprom_93c46a_r, eeprom_93c46a_w)
13231325ADDRESS_MAP_END
13241326
1327/*
1328 * Atomiswave address map, almost identical to Dreamcast
1329 */
1330
13251331static READ64_HANDLER( aw_flash_r )
13261332{
13271333   return (UINT64)intelflash_read(0, offset*8) | (UINT64)intelflash_read(0, (offset*8)+1)<<8 | (UINT64)intelflash_read(0, (offset*8)+2)<<16 | (UINT64)intelflash_read(0, (offset*8)+3)<<24 |
r5613r5614
13431349   }
13441350
13451351   data >>= (i*8);
1352
13461353   intelflash_write(0, addr, data);
13471354}
13481355
1356INLINE int decode_reg32_64(running_machine *machine, UINT32 offset, UINT64 mem_mask, UINT64 *shift)
1357{
1358   int reg = offset * 2;
13491359
1350/*
1351 * Atomiswave address map, almost identical to Dreamcast
1352 */
1360   *shift = 0;
13531361
1362   // non 32-bit accesses have not yet been seen here, we need to know when they are
1363   if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
1364   {
1365      mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine));
1366//      debugger_break(machine);
1367   }
1368
1369   if (mem_mask == U64(0xffffffff00000000))
1370   {
1371      reg++;
1372      *shift = 32;
1373    }
1374
1375   return reg;
1376}
1377
1378READ64_HANDLER( aw_modem_r )
1379{
1380   int reg;
1381   UINT64 shift;
1382
1383   reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
1384
1385   if (reg == 0x280/4)
1386   {
1387      UINT32 coins = input_port_read(space->machine, "COINS");
1388
1389      if (coins & 0x01)
1390      {
1391         return U64(0xffffffff00000002);   // coin A
1392      }
1393      else if (coins & 0x02)
1394      {
1395         return U64(0xffffffff00000001);   // coin B
1396      }
1397
1398      return U64(0xffffffffffffffff);
1399   }
1400
1401   mame_printf_verbose("MODEM:  Unmapped read %08x\n", 0x600000+reg*4);
1402   return 0;
1403}
1404
1405WRITE64_HANDLER( aw_modem_w )
1406{
1407   int reg;
1408   UINT64 shift;
1409   UINT32 dat;
1410
1411   reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
1412   dat = (UINT32)(data >> shift);
1413   mame_printf_verbose("MODEM: [%08x=%x] write %" I64FMT "x to %x, mask %" I64FMT "x\n", 0x600000+reg*4, dat, data, offset, mem_mask);
1414}
1415
13541416static ADDRESS_MAP_START( aw_map, ADDRESS_SPACE_PROGRAM, 64 )
13551417   /* Area 0 */
13561418   AM_RANGE(0x00000000, 0x0001ffff) AM_READWRITE( aw_flash_r, aw_flash_w )
r5613r5614
13641426   AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE( dc_g2_ctrl_r, dc_g2_ctrl_w )
13651427   AM_RANGE(0x005f7c00, 0x005f7cff) AM_READWRITE( pvr_ctrl_r, pvr_ctrl_w )
13661428   AM_RANGE(0x005f8000, 0x005f9fff) AM_READWRITE( pvr_ta_r, pvr_ta_w )
1367   AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE( dc_modem_r, dc_modem_w )
1429   AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE( aw_modem_r, aw_modem_w )
13681430   AM_RANGE(0x00700000, 0x00707fff) AM_DEVREADWRITE( "aica", dc_aica_reg_r, dc_aica_reg_w )
13691431   AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w )
13701432   AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE( naomi_arm_r, naomi_arm_w )           // sound RAM (8 MB)
r5613r5614
15951657   NAOMI_MAME_DEBUG_DIP
15961658INPUT_PORTS_END
15971659
1660// Atomiswave - inputs are read as standard Dreamcast controllers/lightguns.
1661// Controller bit patterns:
1662//
1663// SHOT3   (1<<0)
1664// SHOT2   (1<<1)
1665// SHOT1   (1<<2)
1666// START   (1<<3)
1667// UP      (1<<4)
1668// DOWN    (1<<5)
1669// LEFT    (1<<6)
1670// RIGHT   (1<<7)
1671// SHOT5   (1<<9)
1672// SHOT4   (1<<10)
1673// SERVICE (1<<13)
1674// TEST    (1<<14)
1675// COIN    (1<<15)
1676
1677static INPUT_PORTS_START( aw )
1678   PORT_START("P1L")
1679   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1680   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1681   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1682   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1683   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
1684   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1685   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1686   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1687   PORT_START("P1H")
1688   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
1689   PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW )
1690   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 )
1691   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1692   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1693   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
1694   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
1695   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
1696
1697   PORT_START("P2L")
1698   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1699   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1700   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1701   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1702   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
1703   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1704   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1705   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1706   PORT_START("P2H")
1707   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
1708   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1709   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
1710   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1711   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1712   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
1713   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
1714   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
1715
1716   PORT_START("P3L")
1717   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1718   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1719   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1720   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1721   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
1722   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1723   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1724   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1725   PORT_START("P3H")
1726   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )
1727   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1728   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )
1729   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1730   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1731   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)
1732   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3)
1733   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(3)
1734
1735   PORT_START("P4L")
1736   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
1737   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
1738   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
1739   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
1740   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
1741   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
1742   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
1743   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
1744   PORT_START("P4H")
1745   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 )
1746   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1747   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE4 )
1748   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1749   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1750   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
1751   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(4)
1752   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(4)
1753
1754   PORT_START("COINS")
1755   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(dc_coin_slots_callback, &dc_coin_counts[0])
1756   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(dc_coin_slots_callback, &dc_coin_counts[1])
1757
1758   NAOMI_MAME_DEBUG_DIP
1759INPUT_PORTS_END
1760
15981761static MACHINE_RESET( naomi )
15991762{
16001763   MACHINE_RESET_CALL(dc);
r5613r5614
17881951// bios for House of the Dead 2
17891952#define HOTD2_BIOS \
17901953   ROM_SYSTEM_BIOS( 0, "bios0", "HOTD2 (Export)" ) \
1791   ROM_LOAD16_WORD_SWAP_BIOS( 0,  "epr-21331.bin", 0x000000, 0x200000, CRC(065f8500) SHA1(49a3881e8d76f952ef5e887200d77b4a415d47fe) ) \
1954   ROM_LOAD16_WORD_SWAP_BIOS( 0,  "epr-21331.ic27", 0x000000, 0x200000, CRC(065f8500) SHA1(49a3881e8d76f952ef5e887200d77b4a415d47fe) ) \
17921955   ROM_SYSTEM_BIOS( 1, "bios1", "HOTD2 (USA)" ) \
1793   ROM_LOAD16_WORD_SWAP_BIOS( 1,  "epr-21330.bin", 0x000000, 0x200000, CRC(9e3bfa1b) SHA1(b539d38c767b0551b8e7956c1ff795de8bbe2fbc) ) \
1956   ROM_LOAD16_WORD_SWAP_BIOS( 1,  "epr-21330.ic27", 0x000000, 0x200000, CRC(9e3bfa1b) SHA1(b539d38c767b0551b8e7956c1ff795de8bbe2fbc) ) \
17941957
17951958#define F355_BIOS \
17961959   ROM_SYSTEM_BIOS( 0, "bios0", "Ferrari F355 (Export)" ) \
r5613r5614
19462109IC10    64M     7C94    8779
19472110IC11    64M     271E    BEF7
19482111IC12    64M     BA24    102F
2112
19492113*/
19502114
19512115ROM_START( cspike )
r5613r5614
19992163   ROM_REGION( 0x200000, "maincpu", 0)
20002164   NAOMI_BIOS
20012165
2002   ROM_REGION( 0x7000000, "user1", ROMREGION_ERASEFF)
2166   ROM_REGION( 0x7800000, "user1", ROMREGION_ERASEFF)
20032167   ROM_LOAD( "epr-23511.ic22", 0x000000, 0x400000, CRC(3dbf8eb2) SHA1(1f7b89ba99e018cc85022fa852d56d4e345e1bd2) )
2004        ROM_LOAD( "mpr-23498.ic1", 0x800000, 0x800000, CRC(ff7918b9) SHA1(5fa548939b83d307d6047931b0af405e20de04f6) )
2005        ROM_LOAD( "mpr-23499.ic2", 0x1000000, 0x800000, CRC(5d2d9439) SHA1(6fd24a3966f04a8175e1b1ec4560de6722b621d1) )
2006        ROM_LOAD( "mpr-23500.ic3", 0x1800000, 0x800000, CRC(bc58de9e) SHA1(8db2dfa4f1e0bbd7f5b3c8050d53533535750399) )
2007        ROM_LOAD( "mpr-23501.ic4", 0x2000000, 0x800000, CRC(f938123c) SHA1(058b35301e3ef81ac903f18f6a034e9b282223c3) )
2008        ROM_LOAD( "mpr-23502.ic5", 0x2800000, 0x800000, CRC(d58cbab2) SHA1(638a3fec531c200a909228477955de82d6352fcc) )
2009        ROM_LOAD( "mpr-23503.ic6", 0x3000000, 0x800000, CRC(66a6a80f) SHA1(f6d413f3631e43b3a5067fefc7252f2122773110) )
2010        ROM_LOAD( "mpr-23504.ic7", 0x3800000, 0x800000, CRC(29c1fe16) SHA1(af96d809f8160d45f061120dfe2df36d6c940cb9) )
2011        ROM_LOAD( "mpr-23505.ic8", 0x4000000, 0x800000, CRC(451816b2) SHA1(38af527ca7987019fa4727d2db715f6bd31f366d) )
2012        ROM_LOAD( "mpr-23506.ic9", 0x4800000, 0x800000, CRC(5031ef58) SHA1(a9cbe1ee05e729519175020d9560954a9253ba5b) )
2013        ROM_LOAD( "mpr-23507.ic10", 0x5000000, 0x800000, CRC(d77b0783) SHA1(2ac6584922754bfe85bff8554ddc83736b095c7a) )
2014        ROM_LOAD( "mpr-23508.ic11", 0x5800000, 0x800000, CRC(4c24c946) SHA1(f088d0f0e2ccf3d657ee68791397e3edaa0c79c0) )
2015        ROM_LOAD( "mpr-23509.ic12", 0x6000000, 0x800000, CRC(38379fc1) SHA1(82e3a12615709e974a6635d25d5f17ef7fe8ac78) )
2016        ROM_LOAD( "mpr-23510.ic13", 0x6800000, 0x800000, CRC(38523873) SHA1(5d25ada6cba8c9bbf5f9e90aa3599e796e4e1727) )
2168        ROM_LOAD( "mpr-23504.ic1", 0x0800000, 0x1000000, CRC(e01a31d2) SHA1(e00e138f6a20175c7aadb6500f6d7541b91def14) )
2169        ROM_LOAD( "mpr-23505.ic2", 0x1800000, 0x1000000, CRC(3a34d5fe) SHA1(f3c5f6fcbaa7004d371923eb412ea1fcf3fa461a) )
2170        ROM_LOAD( "mpr-23506.ic3", 0x2800000, 0x1000000, CRC(9cbab27d) SHA1(f166352355a03c9ccafbc15f926330b3622ec040) )
2171        ROM_LOAD( "mpr-23507.ic4", 0x3800000, 0x1000000, CRC(363c1734) SHA1(16b0485f1aacc8925b3c6d6152680139748e6df8) )
2172        ROM_LOAD( "mpr-23508.ic5", 0x4800000, 0x1000000, CRC(0a3590aa) SHA1(84c0e1853f069b003d09b268caee97e58c4dacb6) )
2173        ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
2174        ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
20172175
20182176   // trojaned protection data (filename is address read from)
20192177   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
r5613r5614
20482206   ROM_REGION( 0x200000, "maincpu", 0)
20492207   NAOMI_BIOS
20502208
2051   ROM_REGION( 0x7000000, "user1", ROMREGION_ERASEFF)
2209   ROM_REGION( 0x7800000, "user1", ROMREGION_ERASEFF)
20522210        ROM_LOAD( "epr23511a.ic22", 0x000000, 0x400000, CRC(fe00650f) SHA1(ca8e9e9178ed2b6598bdea83be1bf0dd7aa509f9) )
2053        ROM_LOAD( "mpr-23498.ic1", 0x800000, 0x800000, CRC(ff7918b9) SHA1(5fa548939b83d307d6047931b0af405e20de04f6) )
2054        ROM_LOAD( "mpr-23499.ic2", 0x1000000, 0x800000, CRC(5d2d9439) SHA1(6fd24a3966f04a8175e1b1ec4560de6722b621d1) )
2055        ROM_LOAD( "mpr-23500.ic3", 0x1800000, 0x800000, CRC(bc58de9e) SHA1(8db2dfa4f1e0bbd7f5b3c8050d53533535750399) )
2056        ROM_LOAD( "mpr-23501.ic4", 0x2000000, 0x800000, CRC(f938123c) SHA1(058b35301e3ef81ac903f18f6a034e9b282223c3) )
2057        ROM_LOAD( "mpr-23502.ic5", 0x2800000, 0x800000, CRC(d58cbab2) SHA1(638a3fec531c200a909228477955de82d6352fcc) )
2058        ROM_LOAD( "mpr-23503.ic6", 0x3000000, 0x800000, CRC(66a6a80f) SHA1(f6d413f3631e43b3a5067fefc7252f2122773110) )
2059        ROM_LOAD( "mpr-23504.ic7", 0x3800000, 0x800000, CRC(29c1fe16) SHA1(af96d809f8160d45f061120dfe2df36d6c940cb9) )
2060        ROM_LOAD( "mpr-23505.ic8", 0x4000000, 0x800000, CRC(451816b2) SHA1(38af527ca7987019fa4727d2db715f6bd31f366d) )
2061        ROM_LOAD( "mpr-23506.ic9", 0x4800000, 0x800000, CRC(5031ef58) SHA1(a9cbe1ee05e729519175020d9560954a9253ba5b) )
2062        ROM_LOAD( "mpr-23507.ic10", 0x5000000, 0x800000, CRC(d77b0783) SHA1(2ac6584922754bfe85bff8554ddc83736b095c7a) )
2063        ROM_LOAD( "mpr-23508.ic11", 0x5800000, 0x800000, CRC(4c24c946) SHA1(f088d0f0e2ccf3d657ee68791397e3edaa0c79c0) )
2064        ROM_LOAD( "mpr-23509.ic12", 0x6000000, 0x800000, CRC(38379fc1) SHA1(82e3a12615709e974a6635d25d5f17ef7fe8ac78) )
2065        ROM_LOAD( "mpr-23510.ic13", 0x6800000, 0x800000, CRC(38523873) SHA1(5d25ada6cba8c9bbf5f9e90aa3599e796e4e1727) )
2211        ROM_LOAD( "mpr-23504.ic1", 0x0800000, 0x1000000, CRC(e01a31d2) SHA1(e00e138f6a20175c7aadb6500f6d7541b91def14) )
2212        ROM_LOAD( "mpr-23505.ic2", 0x1800000, 0x1000000, CRC(3a34d5fe) SHA1(f3c5f6fcbaa7004d371923eb412ea1fcf3fa461a) )
2213        ROM_LOAD( "mpr-23506.ic3", 0x2800000, 0x1000000, CRC(9cbab27d) SHA1(f166352355a03c9ccafbc15f926330b3622ec040) )
2214        ROM_LOAD( "mpr-23507.ic4", 0x3800000, 0x1000000, CRC(363c1734) SHA1(16b0485f1aacc8925b3c6d6152680139748e6df8) )
2215        ROM_LOAD( "mpr-23508.ic5", 0x4800000, 0x1000000, CRC(0a3590aa) SHA1(84c0e1853f069b003d09b268caee97e58c4dacb6) )
2216        ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
2217        ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
20662218
20672219   // trojaned protection data (filename is address read from)
20682220   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
r5613r5614
24172569   ROM_REGION( 0x200000, "maincpu", 0)
24182570   NAOMI_BIOS
24192571
2420   ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF)
2421   ROM_LOAD("epr-22306.ic22", 0x0000000, 0x0400000, CRC(fcac20eb) SHA1(26cec9f615cd18ce7fccfc5e273e42c58dea1995) )
2422   ROM_LOAD("ic1", 0x0800000, 0x0800000, NO_DUMP )
2423   ROM_LOAD("ic2", 0x1000000, 0x0800000, NO_DUMP )
2424   ROM_LOAD("ic3", 0x1800000, 0x0800000, NO_DUMP )
2425   ROM_LOAD("ic4", 0x2000000, 0x0800000, NO_DUMP )
2426   ROM_LOAD("ic5", 0x2800000, 0x0800000, NO_DUMP )
2427   ROM_LOAD("ic6", 0x3000000, 0x0800000, NO_DUMP )
2428   ROM_LOAD("ic7", 0x3800000, 0x0800000, NO_DUMP )
2429   ROM_LOAD("ic8", 0x4000000, 0x0800000, NO_DUMP )
2430   ROM_LOAD("ic9", 0x4800000, 0x0800000, NO_DUMP )
2431   ROM_LOAD("ic10",0x5000000, 0x0800000, NO_DUMP )
2432   ROM_LOAD("ic11",0x5800000, 0x0800000, NO_DUMP )
2433   ROM_LOAD("ic12",0x6000000, 0x0800000, NO_DUMP )
2434   ROM_LOAD("ic13",0x6800000, 0x0800000, NO_DUMP )
2435   ROM_LOAD("ic14",0x7000000, 0x0800000, NO_DUMP )
2436   ROM_LOAD("ic15",0x7800000, 0x0800000, NO_DUMP )
2437   ROM_LOAD("ic16",0x8000000, 0x0800000, NO_DUMP )
2438   ROM_LOAD("ic17",0x8800000, 0x0800000, NO_DUMP )
2439   ROM_LOAD("ic18",0x9000000, 0x0800000, NO_DUMP )
2440   ROM_LOAD("ic19",0x9800000, 0x0800000, NO_DUMP )
2441   ROM_LOAD("ic20",0xa000000, 0x0800000, NO_DUMP )
2442   ROM_LOAD("ic21",0xa800000, 0x0800000, NO_DUMP )
2572   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
2573   ROM_LOAD("epr-22306.ic22",  0x0000000, 0x0400000, CRC(fcac20eb) SHA1(26cec9f615cd18ce7fccfc5e273e42c58dea1995) )
2574        ROM_LOAD( "mpr-22295.ic1",  0x0800000, 0x1000000, CRC(1085001b) SHA1(096ac0ecc7d5324f04514d24eb338de591926a3d) )
2575        ROM_LOAD( "mpr-22296.ic2",  0x1800000, 0x1000000, CRC(f18cb28b) SHA1(e7f253a35e15f62e178a1ff565f8a94102eea057) )
2576        ROM_LOAD( "mpr-22297.ic3",  0x2800000, 0x1000000, CRC(a78a527b) SHA1(7d4e7bd93519377a8676f7ca6f72c4d0de2a0475) )
2577        ROM_LOAD( "mpr-22298.ic4",  0x3800000, 0x1000000, CRC(cd76c7ea) SHA1(2db200c8853d1bc9da31da6c197c6b55e570dc69) )
2578        ROM_LOAD( "mpr-22299.ic5",  0x4800000, 0x1000000, CRC(ffb96da5) SHA1(bfe8f4a455d3eeec0fa9728fc1bb52cebd13b2a8) )
2579        ROM_LOAD( "mpr-22300.ic6",  0x5800000, 0x1000000, CRC(6fb05214) SHA1(9cececc46ac463bc5df3c3f5fb9268d5ced31837) )
2580        ROM_LOAD( "mpr-22301.ic7",  0x6800000, 0x1000000, CRC(52eb076d) SHA1(a79bb286594cc5d196a37a17147ad1770db5cd67) )
2581        ROM_LOAD( "mpr-22302.ic8",  0x7800000, 0x1000000, CRC(86767b0b) SHA1(54ed418cef78506fb824e3d16cadefdb684f2b34) )
2582        ROM_LOAD( "mpr-22303.ic9",  0x8800000, 0x1000000, CRC(73a80bd5) SHA1(d607f1d993af4b78d3609991e47e9540664380fd) )
2583        ROM_LOAD( "mpr-22304.ic10", 0x9800000, 0x1000000, CRC(46c1fb1f) SHA1(6daca76a75df3501f77e473eb065d48804fcc64a) )
2584        ROM_LOAD( "mpr-22305.ic11", 0xa800000, 0x1000000, CRC(027d0e7b) SHA1(e3c874e60cabb6f9ce686696d9055a0c0d5289ae) )
24432585ROM_END
24442586
24452587/*
r5613r5614
25782720   ROM_LOAD("mpr-22140.ic19", 0x9800000, 0x0800000, CRC(4cb54893) SHA1(a99b39cc3c82c3cf90f794bb8c8ba60638a6f921) )
25792721ROM_END
25802722
2723ROM_START( smlg99 )                                                                                                       
2724   ROM_REGION( 0x200000, "maincpu", 0)
2725   NAOMI_BIOS
2726
2727   ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF)
2728        ROM_LOAD( "epr-22059.ic22", 0x0000000, 0x200000, CRC(5784f970) SHA1(e9ec692206a95cc260521154305693f6022190bc) )   
2729        ROM_LOAD( "mpr-22038.ic1",  0x0800000, 0x800000, CRC(0a59fc5b) SHA1(efcbe2f847927fba173d333c889dd7df329d6df6) )
2730        ROM_LOAD( "mpr-22039.ic2",  0x1000000, 0x800000, CRC(4de79b52) SHA1(c63a3ce88db316e882948baf121fa96242010c8d) )
2731        ROM_LOAD( "mpr-22040.ic3",  0x1800000, 0x800000, CRC(b993fd90) SHA1(609de1509f393f884813ca4bcac533e10088ca84) )
2732        ROM_LOAD( "mpr-22041.ic4",  0x2000000, 0x800000, CRC(ddadfabd) SHA1(64531e68b10635415d49c0304a8ba550a3a9cef1) )
2733        ROM_LOAD( "mpr-22042.ic5",  0x2800000, 0x800000, CRC(136c101e) SHA1(a35d8d574b263d672a08963a992a7b507c838b70) )
2734        ROM_LOAD( "mpr-22043.ic6",  0x3000000, 0x800000, CRC(7f15a0a5) SHA1(5c36fa580f7eef448fb32d050078843470fafb31) )
2735        ROM_LOAD( "mpr-22044.ic7",  0x3800000, 0x800000, CRC(94376002) SHA1(8c4b954da69a079d9a73b8f34a9f1a94cceee9cc) )
2736        ROM_LOAD( "mpr-22045.ic8",  0x4000000, 0x800000, CRC(e520e2d9) SHA1(c7a9306b2dafb20baaa8bd6708fb5ece775c37f0) )
2737        ROM_LOAD( "mpr-22046.ic9",  0x4800000, 0x800000, CRC(976edfc8) SHA1(340b701b9e1d256963a8fe056ec975d8cbfec3d8) )
2738        ROM_LOAD( "mpr-22047.ic10", 0x5000000, 0x800000, CRC(32b136de) SHA1(4019e9836174b47135d7e1bbc02c23dd3ab52904) )
2739        ROM_LOAD( "mpr-22048.ic11", 0x5800000, 0x800000, CRC(32a9488a) SHA1(70c11fbcb1e24ed120f74aa455806e7dfbfa75b5) )
2740        ROM_LOAD( "mpr-22049.ic12", 0x6000000, 0x800000, CRC(8295696d) SHA1(5820cac054070aa35a64abc5bf8c6f45fe9be03f) )
2741        ROM_LOAD( "mpr-22050.ic13", 0x6800000, 0x800000, CRC(1cfebe44) SHA1(24415f723cd6c1efaa2513f6b52e076364eb0875) )
2742        ROM_LOAD( "mpr-22051.ic14", 0x7000000, 0x800000, CRC(58b9dbef) SHA1(1021d4dfbd5bcf6e1703ce608560c76d60dac71c) )
2743        ROM_LOAD( "mpr-22052.ic15", 0x7800000, 0x800000, CRC(95b87c1d) SHA1(bf0a89703fea7bd37e4d0fd10c7729d2cfe848d6) )
2744        ROM_LOAD( "mpr-22053.ic16", 0x8000000, 0x800000, CRC(666589a1) SHA1(130477f247661e87bdc4f2370788ca676336f563) )
2745        ROM_LOAD( "mpr-22054.ic17", 0x8800000, 0x800000, CRC(9d8c82e9) SHA1(13ebf9ffac9e1e960fa9662800c5e682284a5cdd) )
2746        ROM_LOAD( "mpr-22055.ic18", 0x9000000, 0x800000, CRC(fa865125) SHA1(04e0d77287f4e29df514875683992ede1e385dbc) )
2747        ROM_LOAD( "mpr-22056.ic19", 0x9800000, 0x800000, CRC(45a23d29) SHA1(2499637a4b389cda7cc9a7aa21014696bd1dafe2) )
2748        ROM_LOAD( "mpr-22057.ic20", 0xa000000, 0x800000, CRC(a056c109) SHA1(637e80c2d605851265430b0fa771a4ad5233be8a) )
2749        ROM_LOAD( "mpr-22058.ic21", 0xa800000, 0x800000, CRC(f16edaa0) SHA1(e093f5594df43c592a9acd45002ecc65035c2435) )
2750ROM_END
2751
25812752/*
25822753
25832754SYSTEMID: NAOMI
r5613r5614
26182789   ROM_LOAD("mpr-21901.ic21",0xa800000, 0x0800000, BAD_DUMP CRC(55dcbd6d) SHA1(9fec353f9e58016090e177f899a799e2e8fc7c9f) ) // returns bad in Naomi test mode
26192790ROM_END
26202791
2792ROM_START( hotd2 )                                                                                                       
2793   ROM_REGION( 0x200000, "maincpu", 0)
2794   HOTD2_BIOS
2795
2796   ROM_REGION( 0xa800000, "user1", ROMREGION_ERASEFF)
2797        ROM_LOAD( "epr-21585.ic22", 0x0000000, 0x200000, CRC(b23d1a0c) SHA1(9e77980d1aa980c879886e53cc76a16d7a9d43a1) )
2798        ROM_LOAD( "mpr-21565.ic1",  0x0800000, 0x800000, CRC(88fb0562) SHA1(185a0eab68d86617cb6325d64c48a2dd4854622b) )
2799        ROM_LOAD( "mpr-21566.ic2",  0x1000000, 0x800000, CRC(5f4dd576) SHA1(5483c3949e587bbcca7e8fc7db9aff4cd2a33f02) )
2800        ROM_LOAD( "mpr-21567.ic3",  0x1800000, 0x800000, CRC(3e62fca4) SHA1(8cdebdebabc88160f458e1e779d9ebb4e6a14523) )
2801        ROM_LOAD( "mpr-21568.ic4",  0x2000000, 0x800000, CRC(6f73a852) SHA1(d5fd4c0800b3a1ea04231018fcaba79184fa1d87) )
2802        ROM_LOAD( "mpr-21569.ic5",  0x2800000, 0x800000, CRC(c7950445) SHA1(4f56768f07703452ef92d183e4ee654ab9711283) )
2803        ROM_LOAD( "mpr-21570.ic6",  0x3000000, 0x800000, CRC(5a812247) SHA1(7636661da0cc9bd5a1a2062f9f3ef65889c86fd5) )
2804        ROM_LOAD( "mpr-21571.ic7",  0x3800000, 0x800000, CRC(17e9414a) SHA1(9f291c4dd9a049eeed88d80867f7fca1d15c6095) )
2805        ROM_LOAD( "mpr-21572.ic8",  0x4000000, 0x800000, CRC(5d2d8134) SHA1(a2941b6afd0302822133d932064d1aad873b1c04) )
2806        ROM_LOAD( "mpr-21573.ic9",  0x4800000, 0x800000, CRC(eacaf26d) SHA1(21e35def0ed998a70cc982f373feb50b7974612a) )
2807        ROM_LOAD( "mpr-21574.ic10", 0x5000000, 0x800000, CRC(1e3686be) SHA1(7ec1b3c9c94882c5fe7b6ba6ffe9220e90824870) )
2808        ROM_LOAD( "mpr-21575.ic11", 0x5800000, 0x800000, CRC(5ada00a2) SHA1(981c65310c89e7a26e2b2c3e57623e78f6ad33d0) )
2809        ROM_LOAD( "mpr-21576.ic12", 0x6000000, 0x800000, CRC(9eff6247) SHA1(9257492fc3e48516897002dd3ff247093af27d87) )
2810        ROM_LOAD( "mpr-21577.ic13", 0x6800000, 0x800000, CRC(8a80b16a) SHA1(ffeb061b31027ac322c14b9050c686b2b844d2e1) )
2811        ROM_LOAD( "mpr-21578.ic14", 0x7000000, 0x800000, CRC(7ae20daf) SHA1(b36d8e490ac477db178b8df08f7997448308d3fd) )
2812        ROM_LOAD( "mpr-21579.ic15", 0x7800000, 0x800000, CRC(fbb8641b) SHA1(6cb44f0a3f80eb68a218bba97b2395961c596b9c) )
2813        ROM_LOAD( "mpr-21580.ic16", 0x8000000, 0x800000, CRC(3881ec23) SHA1(e4b87a6c6fd6a2eeda8e0e5ae7bed01b18386e54) )
2814        ROM_LOAD( "mpr-21581.ic17", 0x8800000, 0x800000, CRC(66bff6e4) SHA1(f87d618231b71b65952fc7ea7ccabdd208622a00) )
2815        ROM_LOAD( "mpr-21582.ic18", 0x9000000, 0x800000, CRC(8cd2f654) SHA1(77eb7061caaf0288aad04ed88c4247d27617f338) )
2816        ROM_LOAD( "mpr-21583.ic19", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
2817        ROM_LOAD( "mpr-21584.ic20", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
2818ROM_END
2819
26212820/*
26222821SYSTEMID: NAOMI
26232822JAP: GIANT GRAM
r5613r5614
26372836
26382837   ROM_REGION( 0x6000000, "user1", ROMREGION_ERASEFF)
26392838   ROM_LOAD("epr-21820.ic22", 0x0000000, 0x0200000, CRC(0a198278) SHA1(0df5fc8b56ddafc66d92cb3923b851a5717b551d) )
2839   ROM_RELOAD( 0x200000, 0x200000 )
2840   ROM_RELOAD( 0x400000, 0x200000 )
2841   ROM_RELOAD( 0x600000, 0x200000 )
26402842   ROM_LOAD("mpr-21821.ic1",  0x0800000, 0x0800000, CRC(ed127b65) SHA1(8b6d03fc733f601a48006d3268faa8983ca69d70) )
26412843   /* IC2 empty */
26422844   ROM_LOAD("mpr-21823.ic3",  0x1800000, 0x0800000, CRC(a304b528) SHA1(32197c74c659de2cc5f72f13c84bacac7b136d36) )
r5613r5614
27192921JAP: GUILTY GEAR X
27202922USA: DISABLE
27212923EXP: DISABLE
2722
27232924*/
27242925
27252926ROM_START( ggx )
r5613r5614
27422943   ROM_LOAD("mpr-23353.ic12", 0x6000000, 0x0800000, CRC(daa0ca24) SHA1(afce14e213e79add7fded838e71bb4447425906a) )
27432944   ROM_LOAD("mpr-23354.ic13", 0x6800000, 0x0800000, CRC(cea127f7) SHA1(11f12472ebfc93eb72b764c780e30afd4812dbe9) )
27442945   ROM_LOAD("mpr-23355.ic14", 0x7000000, 0x0800000, CRC(e809685f) SHA1(dc052b4eb4fdcfdc22c4807316ce34ee7a0d58a6) )
2946
2947   // trojaned protection data
2948   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
2949        ROM_LOAD( "a0100000.bin", 0x000000, 0x010000, CRC(cbe5a37a) SHA1(63f40758ef94d02a53ad860b2bed9c41e20a8263) )
2950        ROM_LOAD( "a010b268.bin", 0x010000, 0x010000, CRC(7f0ba37e) SHA1(2d33703c9ec08800c3fae23991859f713f8c944b) )
2951        ROM_LOAD( "a0115558.bin", 0x020000, 0x010000, CRC(882c945f) SHA1(60bf8fe3dcf079464f660c7c210d2a379b2ef04f) )
2952        ROM_LOAD( "a0120b28.bin", 0x030000, 0x010000, CRC(024952c0) SHA1(98e4ce87b5ac1169b5ab1ba9cc7553069e09cbbe) )
2953        ROM_LOAD( "a012987a.bin", 0x040000, 0x010000, CRC(50ea6621) SHA1(ea4e5e0b9563c5e49794a634c08be8d2e81fb773) )
2954        ROM_LOAD( "a012e320.bin", 0x050000, 0x010000, CRC(e445906e) SHA1(cd585100b78253bdd16f3895fdb37ff1e08690f6) )
2955        ROM_LOAD( "a0133cf6.bin", 0x060000, 0x00f014, CRC(5763d154) SHA1(645b0a10fd196f53ff7f656b8db798c8e753c4ed) )
2956        ROM_LOAD( "a0170000.bin", 0x070000, 0x010000, CRC(e153030a) SHA1(e1738ec558f0e3d5a796e34618c533cfcd6928ed) )
2957        ROM_LOAD( "a017cf18.bin", 0x080000, 0x010000, CRC(def783cf) SHA1(911e6b99f8ce498ddd5048ea655b76cad33f47c0) )
2958        ROM_LOAD( "a018a45a.bin", 0x090000, 0x010000, CRC(408cd99b) SHA1(110f9922cded7ffc5108ed964b82ac39beb6ce6b) )
2959        ROM_LOAD( "a0197852.bin", 0x0a0000, 0x010000, CRC(09d10a60) SHA1(04bfdba2ea9a45cb10a60fe95d7d2e0997012b4f) )
2960        ROM_LOAD( "a01a4916.bin", 0x0b0000, 0x010000, CRC(3895730e) SHA1(b2c0a839e330916e598c8f27f2a4873bbaaddbde) )
2961        ROM_LOAD( "a01b1c3e.bin", 0x0c0000, 0x010000, CRC(eecb6a13) SHA1(0203c54b98aaf203e7d1b3646102efe63c550115) )
2962        ROM_LOAD( "a01bef38.bin", 0x0d0000, 0x010000, CRC(7d9a497c) SHA1(680a49389e7774aa03ebe6fc844dea53b430796f) )
2963        ROM_LOAD( "a01cbb10.bin", 0x0e0000, 0x010000, CRC(69b770bd) SHA1(aac5801d9a8a48ef77e932195cd7c30ae562bc38) )
2964        ROM_LOAD( "a01d7500.bin", 0x0f0000, 0x010000, CRC(a1119fca) SHA1(1acda8f73a5b1fb180985245b8b0eb9453db0cea) )
2965        ROM_LOAD( "a0200000.bin", 0x100000, 0x010000, CRC(21662b41) SHA1(4dab25dcc92d1a7418d308542499bdec6c3b3b2b) )
2966        ROM_LOAD( "a0210004.bin", 0x110000, 0x010000, CRC(07166890) SHA1(529c28bf925243468fc00b0ad5ea57429d4de907) )
2967        ROM_LOAD( "a0220008.bin", 0x120000, 0x008000, CRC(09cd1354) SHA1(83f6b36aec4e7c5aa1b8bc21dc6fabf8f283ed55) )
2968        ROM_LOAD( "a0228000.bin", 0x130000, 0x008000, CRC(628a4917) SHA1(cf36bc2413cb63fb511936ab4b5f11b7c8cbb057) )
27452969ROM_END
27462970
27472971/*
r5613r5614
27652989IC10    64M     6442    18AC
27662990IC11    64M     4F77    EEFE
27672991
2768*/
2992*/                     
27692993
27702994
27712995ROM_START( hmgeo )
r5613r5614
27863010   ROM_LOAD("mpr-23713.ic9", 0x4800000, 0x0800000, CRC(2969bac7) SHA1(5f1cf6ac726c2fe183d66e4022962e44592f9ccd) )
27873011   ROM_LOAD("mpr-23714.ic10",0x5000000, 0x0800000, CRC(da462c44) SHA1(ca450b6c07f939f96eba7b44c45b4e38abd598aa) )
27883012   ROM_LOAD("mpr-23715.ic11",0x5800000, 0x0800000, BAD_DUMP CRC(59dfd3ad) SHA1(bb8f7a1bcf16038b18f4485a6b6d81fa72ca7bd0) )
3013
3014   // trojaned protection data
3015   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3016        ROM_LOAD( "a3075ac0.bin", 0x000000, 0x00ff04, CRC(440dca2a) SHA1(4e261ff309e7e774fa2061de30174b0e4e967c00) )
3017        ROM_LOAD( "a30859c4.bin", 0x010000, 0x00ff04, CRC(c22c76a7) SHA1(76d9e47730e4551e6e1a96eeee937296f1153b8b) )
3018        ROM_LOAD( "a30958c8.bin", 0x020000, 0x00ff04, CRC(8f29ee4d) SHA1(e1ac1ccf85dc338e9d5381dfa8ededc8af8f3e92) )
3019        ROM_LOAD( "a30a57cc.bin", 0x030000, 0x00ff04, CRC(479846c1) SHA1(b063e2f7d521cd8a60b770477c13946679e06dd7) )
3020        ROM_LOAD( "a30b56d0.bin", 0x040000, 0x00ff04, CRC(107f777e) SHA1(002f062a2073dff5f0d4722803aef0a8ffc7a61a) )
3021        ROM_LOAD( "a30c55d4.bin", 0x050000, 0x00ff04, CRC(d73b35c1) SHA1(951cceaf6a53d4fc4b967c3675d3fa98a6874b2a) )
3022        ROM_LOAD( "a30d54d8.bin", 0x060000, 0x00ff04, CRC(969a6957) SHA1(ee6909f832b96ec3e6ae0cec3f18a7983cae89d9) )
3023        ROM_LOAD( "a30e53dc.bin", 0x070000, 0x00ff04, CRC(002f7b41) SHA1(12bb33f1229d74b32ab481f5a2e57332f0def6e7) )
3024        ROM_LOAD( "a30f52e0.bin", 0x080000, 0x00a904, CRC(97e32fdd) SHA1(a40f412e40544a45784b2f8d9d5494b6491efc4a) )
3025        ROM_LOAD( "a30ffbe4.bin", 0x090000, 0x000084, CRC(c4311af6) SHA1(7a53061a1a1a024d72880a9a9c2e6a61d2607a46) )
3026        ROM_LOAD( "a30ffc80.bin", 0x0a0000, 0x00ff04, CRC(b1b5e559) SHA1(2f5963d8aa46d7aeb869769a7052d3006d56d5a4) )
3027        ROM_LOAD( "a310fb84.bin", 0x0b0000, 0x00ff04, CRC(91bdc0b2) SHA1(3f77fe6b67dba605296c3c038265b4e0e7eabd97) )
3028        ROM_LOAD( "a311fa88.bin", 0x0c0000, 0x00ff04, CRC(dc5d1334) SHA1(52287bd3ade05be4511e43a7707de8cc38117316) )
3029        ROM_LOAD( "a312f98c.bin", 0x0d0000, 0x00ff04, CRC(e3d9ea36) SHA1(0860f5ac3086d16132f3d0d27266c644470b4f1e) )
3030        ROM_LOAD( "a313f890.bin", 0x0e0000, 0x00ff04, CRC(8b23c562) SHA1(fcc9d04c150f007dcd4a9a2bbee1e438a81b7c49) )
3031        ROM_LOAD( "a314f794.bin", 0x0f0000, 0x009104, CRC(0c0a9aa2) SHA1(1b9063a18703ce4a03ffe20e3f13e9bae06bdb57) )
3032        ROM_LOAD( "a3158898.bin", 0x100000, 0x0000ac, CRC(e23f61d5) SHA1(80ff570a6846f1af2b87e5888675257728e8e253) )
3033        ROM_LOAD( "a0800f40.bin", 0x110000, 0x000204, CRC(f4935846) SHA1(d7eaa710274080f378afa4fb2e14f3bd406c45fe) )     
3034        ROM_LOAD( "a0801144.bin", 0x120000, 0x000034, CRC(28a62ac0) SHA1(d9bb6baf5feaca655f333e2f0b9b200f44ef1726) )     
3035        ROM_LOAD( "a0801180.bin", 0x130000, 0x00ff04, CRC(4b9e08b7) SHA1(dab208f7af4475210135aeb648e6bed7db7399b9) )
3036        ROM_LOAD( "a0811084.bin", 0x140000, 0x00ff04, CRC(4003bab7) SHA1(0b1df4b9b1d1a1072719b559a71f5ae5811be63c) )
3037        ROM_LOAD( "a0820f88.bin", 0x150000, 0x007e04, CRC(67fb4342) SHA1(8b8c384a1628756a08aa8131095e49756967b5e2) )
3038        ROM_LOAD( "a0828d8c.bin", 0x160000, 0x0000f4, CRC(71c85e2b) SHA1(680b6ee02ea24a502bc42bade23e11e6a7ddc7ad) )
27893039ROM_END
27903040
27913041/*
r5613r5614
28083058IC9     64M     717F    40ED
28093059IC10    64M     1E43    0F1A
28103060
3061byteswaped @ e0158 key b957 read count 400, write 404
3062e055c key 37ca read count 400, write 404
3063
28113064*/
28123065
28133066ROM_START( gwing2 )
r5613r5614
28153068   NAOMI_BIOS
28163069
28173070   ROM_REGION( 0x5800000, "user1", ROMREGION_ERASEFF)
2818   ROM_LOAD("epr-22270.ic22", 0x0000000, 0x0200000,  CRC(876b3c97) SHA1(eb171d4a0521c3bea42b4aae3607faec63e10581) )
2819   ROM_LOAD("ic1", 0x0800000, 0x0800000, NO_DUMP )
2820   ROM_LOAD("ic2", 0x1000000, 0x0800000, NO_DUMP )
2821   ROM_LOAD("ic3", 0x1800000, 0x0800000, NO_DUMP )
2822   ROM_LOAD("ic4", 0x2000000, 0x0800000, NO_DUMP )
2823   ROM_LOAD("ic5", 0x2800000, 0x0800000, NO_DUMP )
2824   ROM_LOAD("ic6", 0x3000000, 0x0800000, NO_DUMP )
2825   ROM_LOAD("ic7", 0x3800000, 0x0800000, NO_DUMP )
2826   ROM_LOAD("ic8", 0x4000000, 0x0800000, NO_DUMP )
2827   ROM_LOAD("ic9", 0x4800000, 0x0800000, NO_DUMP )
2828   ROM_LOAD("ic10",0x5000000, 0x0800000, NO_DUMP )
3071   ROM_LOAD("epr-22270.ic22",0x0000000, 0x0200000,  CRC(876b3c97) SHA1(eb171d4a0521c3bea42b4aae3607faec63e10581) )
3072        ROM_LOAD("mpr-22271.ic1", 0x0800000, 0x1000000, CRC(9a072af5) SHA1(d5edff43d180346ba4d4f214c08f2db290a72def) )
3073        ROM_LOAD("mpr-22272.ic2", 0x1800000, 0x1000000, CRC(1e816ab1) SHA1(6e1fd47a21f5da7d2145caaf68094445f122a239) )
3074        ROM_LOAD("mpr-22273.ic3", 0x2800000, 0x1000000, CRC(cd633dcf) SHA1(f044d93802a4ba29d0e70c597d3fbe65da591335) )
3075        ROM_LOAD("mpr-22274.ic4", 0x3800000, 0x1000000, CRC(f8daaaf3) SHA1(8854d3f8e3d55715ede33ee918b641e251f752b4) )
3076        ROM_LOAD("mpr-22275.ic5", 0x4800000, 0x1000000, CRC(61aa1521) SHA1(7d9f5790e72a9151d128ac7887e236526fdf72a0) )
3077
3078   // trojaned protection data (filename is address read from)
3079   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3080        ROM_LOAD( "a085ddc0.bin", 0x000000, 0x00c960, CRC(77303f1c) SHA1(5dc8799b9ec102540c6e7647eccb69dfc5e6ecfb) )
3081        ROM_LOAD( "a080c6c0.bin", 0x010000, 0x020000, CRC(168e551a) SHA1(03bb8ce4bb233db75a0e07a8b5ad28149b5f126e) )
3082        ROM_LOAD( "a082c6c4.bin", 0x030000, 0x020000, CRC(bd2fcd3a) SHA1(2eefa22472d7caf30a3467c1f7ed8dc72f1665c1) )
3083        ROM_LOAD( "a084c6c8.bin", 0x050000, 0x020000, CRC(c1d28ba0) SHA1(5e497758c3756fe993b481ab2009402a105fbc63) )
3084        ROM_LOAD( "a08c67e0.bin", 0x070000, 0x020000, CRC(ceabcb70) SHA1(bbc97218f32913eefe52b1bb1606bad60d7c2894) )
3085        ROM_LOAD( "a08e67e4.bin", 0x090000, 0x020000, CRC(4bc98e7b) SHA1(5f506d05a05a129bf500f0112e39b722872f1220) )
3086        ROM_LOAD( "a09067e8.bin", 0x0b0000, 0x020000, CRC(4cd8a958) SHA1(d3a96287986ab851acced420c4ff9f4d2035188a) )
3087        ROM_LOAD( "a09267ec.bin", 0x0d0000, 0x020000, CRC(17c1df0d) SHA1(62964224f27c54651518a8622756c253d777629a) )
3088        ROM_LOAD( "a09467f0.bin", 0x0f0000, 0x020000, CRC(99c78505) SHA1(bbb95757bc0be76c680255a0e72d2eacc4ca525e) )
3089        ROM_LOAD( "a09667f4.bin", 0x110000, 0x016360, CRC(bec1fd2f) SHA1(e2e9d47d6d5d35bfa9a432c7f47f95c780b17551) )
3090        ROM_LOAD( "a088acc0.bin", 0x130000, 0x020000, CRC(abb1e0d9) SHA1(a1d5d484faaa806b365069755660ec14c1cecada) )
3091        ROM_LOAD( "a08aacc4.bin", 0x150000, 0x01bb00, CRC(2acc08c8) SHA1(c04276ec940a73e4b8fe140ef9f4bec8c629ecc9) )
3092        ROM_LOAD( "a086a740.bin", 0x170000, 0x020000, CRC(5d90c88c) SHA1(7af4107e1930292d3c64b80cb29d31aae8a565b6) )
3093        ROM_LOAD( "a088a744.bin", 0x190000, 0x000560, CRC(79c8eb0f) SHA1(0216fa128d9851b96f3864446ef71e0ed6f4ccd0) )
3094        ROM_LOAD( "a097cb60.bin", 0x1a0000, 0x010820, CRC(371e88d9) SHA1(04f0167000e96d556227e8abf6e06e0698e61e9f) )
3095   ROM_LOAD( "a0807fa0.bin", 0x1c0000, 0x004700, CRC(4eed5ff3) SHA1(26425baa06959d612b3b7e9f367fbb97258f544e) )
3096        ROM_LOAD( "a0800000.bin", 0x1d0000, 0x006040, CRC(17651005) SHA1(500806ba917133ae604817c6ee2913d10762e290) )
3097        ROM_LOAD( "a0806060.bin", 0x1e0000, 0x001f20, CRC(ff25a8fe) SHA1(e8c0ddf63802e3d35478e1a491dc7162283b2474) )
28293098ROM_END
28303099
28313100/*
r5613r5614
29643233   ROM_LOAD("mpr-22032.ic8", 0x4000000, 0x0800000, CRC(3c48c9ba) SHA1(00be199b23040f8e81db2ec489ba98cbf615652c) )
29653234   ROM_LOAD("mpr-22033.ic9", 0x4800000, 0x0800000, CRC(5fe5586e) SHA1(3ff41ae1f81469597684faadd88e62b5e0634352) )
29663235   ROM_LOAD("mpr-22034.ic10",0x5000000, 0x0800000, CRC(3aa5ce5e) SHA1(f00a906235e4522d6fc2ac771324114346875314) )
3236
3237   // trojaned protection data (filename is address read from)
3238   ROM_REGION( 0x4000, "naomibd_prot", ROMREGION_ERASE00 )
3239        ROM_LOAD( "a0309000.bin", 0x000000, 0x000400, CRC(e4f8b4a2) SHA1(a0d54aa6e1ffd5b1db31002ee4a94943c2157a3e) )
3240        ROM_LOAD( "a0309500.bin", 0x001000, 0x000400, CRC(5d3a9b15) SHA1(30d55a686493bb2f5e7d2c7d7df3dedf2f93dff0) )
3241        ROM_LOAD( "a030a000.bin", 0x002000, 0x000400, CRC(22b88804) SHA1(7b53778ddbf360b364376f0358b0acfb689e8713) )
3242        ROM_LOAD( "a030a500.bin", 0x003000, 0x000400, CRC(6a501389) SHA1(c2c75cd8beed6bb9e3fa39722fa01b35f2e7992d) )
29673243ROM_END
29683244
29693245
r5613r5614
30623338   ROM_REGION( 0x200000, "maincpu", 0)
30633339   NAOMI_BIOS
30643340
3065   ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF)
3341   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
30663342   ROM_LOAD("epr-23548a.ic22", 0x0000000, 0x0400000,  CRC(f4ccf1ec) SHA1(97485b2a4b9452ffeea2501f42d20d718410e716) )
3067   ROM_LOAD("ic1", 0x0800000, 0x0800000, NO_DUMP )
3068   ROM_LOAD("ic2", 0x1000000, 0x0800000, NO_DUMP )
3069   ROM_LOAD("ic3", 0x1800000, 0x0800000, NO_DUMP )
3070   ROM_LOAD("ic4", 0x2000000, 0x0800000, NO_DUMP )
3071   ROM_LOAD("ic5", 0x2800000, 0x0800000, NO_DUMP )
3072   ROM_LOAD("ic6", 0x3000000, 0x0800000, NO_DUMP )
3073   ROM_LOAD("ic7", 0x3800000, 0x0800000, NO_DUMP )
3074   ROM_LOAD("ic8", 0x4000000, 0x0800000, NO_DUMP )
3075   ROM_LOAD("ic9", 0x4800000, 0x0800000, NO_DUMP )
3076   ROM_LOAD("ic10",0x5000000, 0x0800000, NO_DUMP )
3077   ROM_LOAD("ic11",0x5800000, 0x0800000, NO_DUMP )
3078   ROM_LOAD("ic12",0x6000000, 0x0800000, NO_DUMP )
3079   ROM_LOAD("ic13",0x6800000, 0x0800000, NO_DUMP )
3080   ROM_LOAD("ic14",0x7000000, 0x0800000, NO_DUMP )
3081   ROM_LOAD("ic15",0x7800000, 0x0800000, NO_DUMP )
3082   ROM_LOAD("ic16",0x8000000, 0x0800000, NO_DUMP )
3083   ROM_LOAD("ic17",0x8800000, 0x0800000, NO_DUMP )
3084   ROM_LOAD("ic18",0x9000000, 0x0800000, NO_DUMP )
3085   ROM_LOAD("ic19",0x9800000, 0x0800000, NO_DUMP )
3086   ROM_LOAD("ic20",0xa000000, 0x0800000, NO_DUMP )
3087   ROM_LOAD("ic21",0xa800000, 0x0800000, NO_DUMP )
3343        ROM_LOAD( "mpr-23537.ic1",  0x0800000, 0x1000000, CRC(a2462770) SHA1(2d06f2efb686b2c45e5cc0b0776ba5fb1d392951) )
3344        ROM_LOAD( "mpr-23538.ic2",  0x1800000, 0x1000000, CRC(e4480832) SHA1(281700b10bd6b29e4d33b5230d085f9cc102fa01) )
3345        ROM_LOAD( "mpr-23539.ic3",  0x2800000, 0x1000000, CRC(97e3f7f5) SHA1(89ad30782ba148777ce3aad2d41e9dfda2dd0c5c) )
3346        ROM_LOAD( "mpr-23540.ic4",  0x3800000, 0x1000000, CRC(b9e92d21) SHA1(a9b465e83ecfbf47168f83ad4ae8ed4b802345ac) )
3347        ROM_LOAD( "mpr-23541.ic5",  0x4800000, 0x1000000, CRC(95b8a9c6) SHA1(2c9df93d9f599cf01d895a37d03ba0d86b9b3033) )
3348        ROM_LOAD( "mpr-23542.ic6",  0x5800000, 0x1000000, CRC(dfd490f5) SHA1(13fe0a11a75f1a7ebfe40433833241e656bb1511) )
3349        ROM_LOAD( "mpr-23543.ic7",  0x6800000, 0x1000000, CRC(66847ebd) SHA1(853d4fc7e53ac7b19b9ba616f756eb8a8fcd242d) )
3350        ROM_LOAD( "mpr-23544.ic8",  0x7800000, 0x1000000, CRC(d1f5b460) SHA1(f0789630871d728113abacceff21c6328a9fa9fc) )
3351        ROM_LOAD( "mpr-23545.ic9",  0x8800000, 0x1000000, CRC(60bd692f) SHA1(37b508f4a821d832eafff81574e7df3fe1c729f8) )
3352        ROM_LOAD( "mpr-23546.ic10", 0x9800000, 0x1000000, CRC(85db2248) SHA1(37845c269a2e65ee6181a8e7500c2e7dd9b2e343) )
3353        ROM_LOAD( "mpr-23547.ic11", 0xa800000, 0x1000000, CRC(18b369c7) SHA1(b61cb3fda8cc685865684f7afc7dad0b29d93ca5) )
3354
3355   // trojaned protection data (filename is address read from)
3356   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3357        ROM_LOAD( "a0820000.bin", 0x000000, 0x00267e, CRC(15db53ed) SHA1(a28ba1abc77ca559cff2fd34f3499c556ad8674e) )
3358        ROM_LOAD( "a0920000.bin", 0x010000, 0x00c91c, CRC(431436f8) SHA1(0136d6b210689b2023f982300bc8842b5c0914b4) )
3359        ROM_LOAD( "a092c920.bin", 0x020000, 0x00a53c, CRC(43e1a419) SHA1(34020cc7b10a1c5b2860db84d133489bce53d3d4) )
3360        ROM_LOAD( "a0936e60.bin", 0x030000, 0x001a32, CRC(2a998df6) SHA1(c7bed2777b2358bc0f1d7a3c23f3029591eb674d) )
3361        ROM_LOAD( "a3480000.bin", 0x040000, 0x008e9c, CRC(c8939e48) SHA1(a8d26c2b32211a50b8cc49b51c0d2e34416cc715) )
30883362ROM_END
30893363
30903364/*
r5613r5614
31053379IC7 64M 374E    46F6
31063380IC8 64M C529    0501
31073381
3382prot
3383
31083384*/
31093385
31103386ROM_START( pstone )
r5613r5614
31133389
31143390   ROM_REGION( 0x4800000, "user1", ROMREGION_ERASEFF)
31153391   ROM_LOAD("epr-21597.ic22",0x0000000, 0x0200000, CRC(62c7acc0) SHA1(bb61641a7f3650757132cde379447bdc9bd91c78) )
3116   ROM_RELOAD( 0x200000, 0x200000)
3117   ROM_RELOAD( 0x400000, 0x200000)
3118   ROM_RELOAD( 0x600000, 0x200000)
31193392   ROM_LOAD("mpr-21589.ic1", 0x0800000, 0x0800000, CRC(2fa66608) SHA1(144bda75f892a1e4dbd8332439e9e44fad1d0695) )
31203393   ROM_LOAD("mpr-21590.ic2", 0x1000000, 0x0800000, CRC(6341b399) SHA1(d123b6a3eb7c4800950cc5849d748b0edafabc7d) )
31213394   ROM_LOAD("mpr-21591.ic3", 0x1800000, 0x0800000, CRC(7f2d99aa) SHA1(00f9ae67be0d7229c37479b6dc0ed5816035fd98) )
r5613r5614
31653438   ROM_LOAD("mpr-23124.ic7", 0x3800000, 0x0800000, CRC(508c0207) SHA1(e50d97a17cdd6771fbc63a254a4d638e7daa8f57) )
31663439   ROM_LOAD("mpr-23125.ic8", 0x4000000, 0x0800000, CRC(b9938bbc) SHA1(d55d7adecb5a5a4a276a5a17c12808085d980fd9) )
31673440   ROM_LOAD("mpr-23126.ic9", 0x4800000, 0x0800000, CRC(fbb0325b) SHA1(21b965519d7508d84344641d43e8af2c3ca29ba4) )
3441
3442   // trojaned protection data (filename is address read from)
3443   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
31683444ROM_END
31693445
31703446/*
r5613r5614
36463922   ROM_REGION( 0x200000, "maincpu", 0)
36473923   NAOMI_BIOS
36483924
3649   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASEFF)
3925   ROM_REGION( 0x8800000, "user1", ROMREGION_ERASEFF)
36503926   ROM_LOAD("epr-22261.ic22", 0x0000000, 0x0400000, CRC(60e5a6cd) SHA1(d74ee8318e40190231b94030176223da8305c053) )
3651   ROM_LOAD("ic1", 0x0800000, 0x0800000, NO_DUMP )
3652   ROM_LOAD("ic2", 0x1000000, 0x0800000, NO_DUMP )
3653   ROM_LOAD("ic3", 0x1800000, 0x0800000, NO_DUMP )
3654   ROM_LOAD("ic4", 0x2000000, 0x0800000, NO_DUMP )
3655   ROM_LOAD("ic5", 0x2800000, 0x0800000, NO_DUMP )
3656   ROM_LOAD("ic6", 0x3000000, 0x0800000, NO_DUMP )
3657   ROM_LOAD("ic7", 0x3800000, 0x0800000, NO_DUMP )
3658   ROM_LOAD("ic8", 0x4000000, 0x0800000, NO_DUMP )
3659   ROM_LOAD("ic9", 0x4800000, 0x0800000, NO_DUMP )
3660   ROM_LOAD("ic10",0x5000000, 0x0800000, NO_DUMP )
3661   ROM_LOAD("ic11",0x5800000, 0x0800000, NO_DUMP )
3662   ROM_LOAD("ic12",0x6000000, 0x0800000, NO_DUMP )
3663   ROM_LOAD("ic13",0x6800000, 0x0800000, NO_DUMP )
3664   ROM_LOAD("ic14",0x7000000, 0x0800000, NO_DUMP )
3665   ROM_LOAD("ic15",0x7800000, 0x0800000, NO_DUMP )
3927        ROM_LOAD( "mpr-22262.ic1", 0x0800000, 0x1000000, CRC(f18c7920) SHA1(76fb592f62b8a359df19074265b44772ab2ecea0) )
3928        ROM_LOAD( "mpr-22263.ic2", 0x1800000, 0x1000000, CRC(5a397a54) SHA1(4b41b19ab7c49e09eeb5df2e688fdaecf8bb33a9) )
3929        ROM_LOAD( "mpr-22264.ic3", 0x2800000, 0x1000000, CRC(edca701e) SHA1(459b533d862e011f8daa0e4997d69fa7339b0755) )
3930        ROM_LOAD( "mpr-22265.ic4", 0x3800000, 0x1000000, CRC(7dfe71a1) SHA1(f2053544de8a177ab931c4d6a9010dfb6cc92e31) )
3931        ROM_LOAD( "mpr-22266.ic5", 0x4800000, 0x1000000, CRC(3e9ac148) SHA1(05a5725c72bbfc65db47aaa677b95f07aa9a3909) )
3932        ROM_LOAD( "mpr-22267.ic6", 0x5800000, 0x1000000, CRC(67ec1027) SHA1(2432b33983bbc9b07477459adb5ee1a62b6c0ea3) )
3933        ROM_LOAD( "mpr-22268.ic7", 0x6800000, 0x1000000, CRC(536f5eea) SHA1(f1de8624f82595adf75693b604fb026bf3f778ee) )
3934        ROM_LOAD( "mpr-22269.ic8", 0x7800000, 0x1000000, CRC(6c0cf740) SHA1(da10b33a6e54afbe1d7e52801216e7119b0b33b1) )
3935
3936   // trojaned protection data (filename is address read from)
3937   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3938   ROM_LOAD( "a24db210.bin", 0x000000, 0x00005e, CRC(79fc852b) SHA1(58229b71d1a7067dd6ce3a617edc7d8bdd132036) )
36663939ROM_END
36673940
36683941/*
r5613r5614
37364009   ROM_LOAD("mpr-21726.ic19",0x9800000, 0x0800000, CRC(429bf290) SHA1(6733e1bcf100e73ab43273f6feedc187fcaa55d4) )
37374010ROM_END
37384011
4012ROM_START( gunsur2 )
4013   ROM_REGION( 0x200000, "maincpu", 0)
4014   NAOMI_BIOS
4015
4016   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
4017        ROM_LOAD( "bhf1vere.2f",  0x0000000, 0x0800000, CRC(121ea283) SHA1(e4bf2b90fa3d42727b8393ffa2c5a8863914a630) )
4018        ROM_LOAD( "bhf1ma2.4m",   0x2000000, 0x1000000, CRC(8073dec7) SHA1(2d4173ff0de37b95a8cb02e1b572a9cdeb448c24) )
4019ROM_END
4020
37394021/* GD-ROM titles - a PIC supplies a decryption key
37404022
37414023PIC stuff
r5613r5614
38794161/* 0016C */ GAME( 1999, derbyoc,  naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38804162/* 0017C */ GAME( 1999, otrigger, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "OutTrigger (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38814163/* 0019C */ GAME( 1999, dybb99,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Dynamite Baseball '99 (JPN) / World Series '99 (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4164/* 00??C */ GAME( 1999, smlg99,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Super Major League '99", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38824165/* 0020C */ GAME( 1999, samba,    naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Samba De Amigo (JPN)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4166/* 0083C */ GAME( 1999, derbyoc2, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club II (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38834167/* 0021C */ GAME( 2000, virnba,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Virtua NBA (JPN, USA, EXP, KOR, AUS)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38844168/* 0021C */ GAME( 2000, virnbao,  virnba,   naomi,    naomi,    naomi, ROT0, "Sega",            "Virtua NBA (JPN, USA, EXP, KOR, AUS) (original)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38854169/* 0026C */ GAME( 2000, totd,     naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "The Typing of the Dead (JPN, USA, EXP, KOR, AUS)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38864170/* 0027C */ GAME( 2000, smarinef, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Sega Marine Fishing", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38874171/* 0030C */ GAME( 2000, qmegamis, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Quiz Ah Megamisama (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38884172/* 0039C */ GAME( 2000, gram2000, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Giant Gram 2000 (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4173/* 0040C */ GAME( 2000, wwfroyal, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "WWF Royal Rumble (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38894174/* 0041C */ GAME( 2000, slasho,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Slashout (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38904175/* 0044C */ GAME( 2001, csmash,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Cosmic Smash (JPN, USA, EXP, KOR, AUS) (rev. A)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
38914176/* 0044C */ GAME( 2001, csmasho,  csmash,   naomi,    naomi,    naomi, ROT0, "Sega",            "Cosmic Smash (JPN, USA, EXP, KOR, AUS) (original)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
r5613r5614
39004185/* 0005C */ GAME( 1999, spawn,    naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Spawn (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39014186/* 0007C */ GAME( 2000, mvsc2,    naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Marvel vs. Capcom 2 (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39024187/* 0008C */ GAME( 2000, pstone2,  naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Power Stone 2 (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
3903/* 841-0011C */ GAME( 2000, capsnk,   naomi,    naomi,    naomi,    naomi, ROT0, "Capcom / SNK",    "Capcom Vs. SNK Millennium Fight 2000 (000904 JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
3904/* 841-0011C */ GAME( 2000, capsnka,  capsnk,    naomi,    naomi,    naomi, ROT0, "Capcom / SNK",    "Capcom Vs. SNK Millennium Fight 2000 (000804 JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4188/* 0011C */ GAME( 2000, capsnk,   naomi,    naomi,    naomi,    naomi, ROT0, "Capcom / SNK",    "Capcom Vs. SNK Millennium Fight 2000 (000904 JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4189/* 0011C */ GAME( 2000, capsnka,  capsnk,    naomi,    naomi,    naomi, ROT0, "Capcom / SNK",    "Capcom Vs. SNK Millennium Fight 2000 (000804 JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39054190/* 0012C */ GAME( 2000, cspike,   naomi,    naomi,    naomi,    naomi,    ROT0, "Psikyo / Capcom", "Gun Spike (JPN) / Cannon Spike (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39064191/* 0013C */ GAME( 2000, ggx,      naomi,    naomi,    naomi,    naomi,    ROT0, "Arc System Works","Guilty Gear X (JPN)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4192/* 0014C */ GAME( 2000, gwing2,   naomi,    naomi,    naomi,    naomi, ROT0, "Takumi / Capcom", "Giga Wing 2 (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4193/* 0015C */ GAME( 2000, pjustic,  naomi,    naomi,    naomi,    naomi, ROT0, "Capcom",          "Moero Justice Gakuen (JPN) / Project Justice (USA, EXP, KOR, AUS) ", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39074194/* 0016  */ GAME( 2000, deathcox, naomi,    naomi,    naomi,    naomi,    ROT0, "Ecole",           "Death Crimson OX (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39084195/* xxxx  */ GAME( 2001, hmgeo,    naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Heavy Metal Geomatrix (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39094196
3910/* Incomplete Dumps (just the program rom IC22) */
3911/* 840-0083C */ GAME( 1999, derbyoc2, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club II (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
3912/* 841-0014C */ GAME( 2000, gwing2,   naomi,    naomi,    naomi,    naomi, ROT0, "Takumi / Capcom", "Giga Wing 2 (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
3913/* 841-0015C */ GAME( 2000, pjustic,  naomi,    naomi,    naomi,    naomi, ROT0, "Capcom",          "Moero Justice Gakuen (JPN) / Project Justice (USA, EXP, KOR, AUS) ", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
3914/* 840-0040C */ GAME( 2000, wwfroyal, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "WWF Royal Rumble (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4197/* Games with incomplete dumps */
4198/* xxxx  */ GAME( 2001, gunsur2,  naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom / Namco",  "Gun Survivor 2: Bio Hazard Code Veronica", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39154199
39164200/* Games with game specific bios sets */
39174201GAME( 1998, hod2bios, 0,        naomi,    naomi,    0,     ROT0, "Sega",            "Naomi House of the Dead 2 Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
3918/* HOTD2 isn't dumped */
4202GAME( 1999, hotd2,    hod2bios, naomi,    naomi,    0,     ROT0, "Sega",            "House of the Dead 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39194203GAME( 1999, f355bios, 0,        naomi,    naomi,    0,     ROT0, "Sega",            "Naomi Ferrari F355 Challenge Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
39204204GAME( 1999, f355,     f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
39214205
r5613r5614
49085192   NAOMI2_BIOS
49095193
49105194   ROM_REGION( 0xa800000, "user1", ROMREGION_ERASEFF)
4911   ROM_LOAD("epr-23622.ic22", 0x0000000, 0x0400000, CRC(8acafa5b) SHA1(c92bcd40bad6ba8efd1edbfd7e439fb2b3c67fb0) )
4912   ROM_LOAD("ic.1", 0x0800000, 0x0800000, NO_DUMP )
4913   ROM_LOAD("ic.2", 0x1000000, 0x0800000, NO_DUMP )
4914   ROM_LOAD("ic.3", 0x1800000, 0x0800000, NO_DUMP )
4915   ROM_LOAD("ic.4", 0x2000000, 0x0800000, NO_DUMP )
4916   ROM_LOAD("ic.5", 0x2800000, 0x0800000, NO_DUMP )
4917   ROM_LOAD("ic.6", 0x3000000, 0x0800000, NO_DUMP )
4918   ROM_LOAD("ic.7", 0x3800000, 0x0800000, NO_DUMP )
4919   ROM_LOAD("ic.8", 0x4000000, 0x0800000, NO_DUMP )
4920   ROM_LOAD("ic.9", 0x4800000, 0x0800000, NO_DUMP )
4921   ROM_LOAD("ic.10",0x5000000, 0x0800000, NO_DUMP )
4922   ROM_LOAD("ic.11",0x5800000, 0x0800000, NO_DUMP )
4923   ROM_LOAD("ic.12",0x6000000, 0x0800000, NO_DUMP )
4924   ROM_LOAD("ic.13",0x6800000, 0x0800000, NO_DUMP )
4925   ROM_LOAD("ic.14",0x7000000, 0x0800000, NO_DUMP )
4926   ROM_LOAD("ic.15",0x7800000, 0x0800000, NO_DUMP )
4927   ROM_LOAD("ic.16",0x8000000, 0x0800000, NO_DUMP )
4928   ROM_LOAD("ic.17",0x8800000, 0x0800000, NO_DUMP )
4929   ROM_LOAD("ic.18",0x9000000, 0x0800000, NO_DUMP )
4930   ROM_LOAD("ic.19",0x9800000, 0x0800000, NO_DUMP )
4931   ROM_LOAD("ic.20",0xa000000, 0x0800000, NO_DUMP )
5195   ROM_LOAD( "epr-23622.ic22", 0x0000000, 0x0400000, CRC(8acafa5b) SHA1(c92bcd40bad6ba8efd1edbfd7e439fb2b3c67fb0) )
5196        ROM_LOAD( "mpr-23611.ic1",  0x0800000, 0x1000000, CRC(943bc32a) SHA1(11ced99e9dbd7cc93031779e00d4ee1f2dff9086) )
5197        ROM_LOAD( "mpr-23612.ic2",  0x1800000, 0x1000000, CRC(f71d87e5) SHA1(c36d1d07702642db282278f1cf556ed472e930d3) )
5198        ROM_LOAD( "mpr-23613.ic3",  0x2800000, 0x1000000, CRC(689e783e) SHA1(1264c3389610bbf2745b7e6d50f327b1df33b63b) )
5199        ROM_LOAD( "mpr-23614.ic4",  0x3800000, 0x1000000, CRC(e5b8c5e5) SHA1(4b81ecc6375bf731dc3423cf87c2228eb304f2b5) )
5200        ROM_LOAD( "mpr-23615.ic5",  0x4800000, 0x1000000, CRC(95c35866) SHA1(a3dd4cd2c8818a3c5de7aa6c4afc74f872d52b37) )
5201        ROM_LOAD( "mpr-23616.ic6",  0x5800000, 0x1000000, CRC(6288848f) SHA1(a69ddde96d15cee9154ed3e87514286db6bbb622) )
5202        ROM_LOAD( "mpr-23617.ic7",  0x6800000, 0x1000000, CRC(19298892) SHA1(78493587dc49c7c99c5a98f152b17500003316b3) )
5203        ROM_LOAD( "mpr-23618.ic8",  0x7800000, 0x1000000, CRC(67d7b659) SHA1(44e75e16f2740c6e147e101a8714be8c5d9b71f3) )
5204        ROM_LOAD( "mpr-23619.ic9",  0x8800000, 0x1000000, CRC(a5f4f6af) SHA1(bb89d3f0f5bbaf7c40fa43680c7e51ef93f7ed26) )
5205        ROM_LOAD( "mpr-23620.ic10", 0x9800000, 0x1000000, CRC(67aa15a9) SHA1(42c24cbf7069c27430a71509a872cd1c4224aaeb) )
49325206ROM_END
49335207
5208ROM_START( vf4cart )
5209   NAOMI2_BIOS
5210
5211   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
5212        ROM_LOAD( "epr-23785.ic22", 0x0000000, 0x0400000, CRC(9bd98d4b) SHA1(3b0622625317cd6b2736c5b4a23484fb8bf39e4b) )
5213        ROM_LOAD( "mpr-23774.ic1",  0x0800000, 0x1000000, CRC(0fe7b864) SHA1(357ca3a5d96d7ff27e06367e115ddfd00cb260e3) )
5214        ROM_LOAD( "mpr-23775.ic2",  0x1800000, 0x1000000, BAD_DUMP CRC(6c64d9d9) SHA1(d2033ca3ab9838cad39e17b5c1eb079c6d15b758) )
5215        ROM_LOAD( "mpr-23776.ic3",  0x2800000, 0x1000000, CRC(44b8429e) SHA1(0ec6b6156bef1621700791651903a4589f4b5f84) )
5216        ROM_LOAD( "mpr-23777.ic4",  0x3800000, 0x1000000, CRC(78a4264e) SHA1(40d045240173f330ac6f108b132f9a87884922be) )
5217        ROM_LOAD( "mpr-23778.ic5",  0x4800000, 0x1000000, CRC(02dee78b) SHA1(e08ce0fc0b1db2dcef957c2edb6d51db400a38cb) )
5218        ROM_LOAD( "mpr-23779.ic6",  0x5800000, 0x1000000, CRC(6e458eea) SHA1(4c85fcacf4ff46d4a137afcf5906092fd88fe4b1) )
5219        ROM_LOAD( "mpr-23780.ic7",  0x6800000, 0x1000000, CRC(a775a51c) SHA1(b3eae20e5e7d74252368fd902c4e94a6ba6cb154) )
5220        ROM_LOAD( "mpr-23781.ic8",  0x7800000, 0x1000000, BAD_DUMP CRC(689457fa) SHA1(734b6b5f2ba78af24a613aef8d4e739f296413f7) )
5221        ROM_LOAD( "mpr-23782.ic9",  0x8800000, 0x1000000, CRC(4f72e901) SHA1(a1d231c446d2c34e5a7e7145754b2313a2d03fd4) )
5222        ROM_LOAD( "mpr-23783.ic10", 0x9800000, 0x1000000, CRC(c8d4f6f9) SHA1(9e9df605c050b3780d7df34bd5041d30bc084d2d) )
5223        ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, BAD_DUMP CRC(3a7ebe78) SHA1(6f414db03761be0d2f995193df8146f3b82c18a8) )
5224ROM_END                       
5225
5226ROM_START( clubkrte )
5227   NAOMI2_BIOS
5228
5229   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
5230        ROM_LOAD( "epr-23704.ic22", 0x0000000, 0x0400000, CRC(ff700a0d) SHA1(e2db0d2bd7dc88b3a487077e8ce56eb6cfd9b02d) )
5231        ROM_LOAD( "mpr-23693.ic1",  0x0800000, 0x1000000, CRC(28995764) SHA1(a1457f9935dde2e5aaa5ef245c736c0f2f8c74b7) )
5232        ROM_LOAD( "mpr-22694.ic2",  0x1800000, 0x1000000, CRC(37d30111) SHA1(4c07df8cd548cac79d48709e61f692d762471f8f) )
5233        ROM_LOAD( "mpr-22695.ic3",  0x2800000, 0x1000000, BAD_DUMP CRC(9fdeaa70) SHA1(2d01a49b8d8d23f61584bec31d75723cee47dc44) )
5234        ROM_LOAD( "mpr-22696.ic4",  0x3800000, 0x1000000, BAD_DUMP CRC(cb12ae00) SHA1(cf94ae123217071c169aa79c842f0a28abba9713) )
5235        ROM_LOAD( "mpr-22697.ic5",  0x4800000, 0x1000000, CRC(1383c742) SHA1(6efd17632a277a4bb0e47cc912fbc9865a8b14c3) )
5236        ROM_LOAD( "mpr-22698.ic6",  0x5800000, 0x1000000, BAD_DUMP CRC(1701cd3a) SHA1(e217206745ce9dca51733f77eb093b3ef2a10c5e) )
5237        ROM_LOAD( "mpr-22699.ic7",  0x6800000, 0x1000000, BAD_DUMP CRC(e58cfa77) SHA1(27c421c37d7e3df88cb7b2240bfec1ae460001a3) )
5238        ROM_LOAD( "mpr-22700.ic8",  0x7800000, 0x1000000, CRC(db9e5c1d) SHA1(db918c0fa1860f4345806e574d44354aba5fcd54) )
5239        ROM_LOAD( "mpr-22701.ic9",  0x8800000, 0x1000000, BAD_DUMP CRC(66ee25be) SHA1(17804308aa63bf58d2bde0b4b202d2bd0974a981) )
5240        ROM_LOAD( "mpr-22702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
5241        ROM_LOAD( "mpr-22703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
5242ROM_END
5243
49345244/**********************************************
49355245 *
49365246 * Naomi 2 GD-ROM defines
r5613r5614
51645474//Naomi 2 Cart Games
51655475/* Complete Dumps */
51665476GAME( 2001, vstrik3c, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Striker 3 (Cart) (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5167
5168/* Incomplete Dumps (just the program rom IC22) */
51695477GAME( 2001, wldrider, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5478GAME( 2001, vf4cart,  naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Fighter 4 (Cart)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5479GAME( 2002, clubkrte, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Club Kart: European Session", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
51705480
51715481/* GDS-xxxx (Sega first party games) */
51725482GAME( 2001, vstrik3, naomi2,  naomigd,    naomi,    0,  ROT0, "Sega",          "Virtua Striker 3 (GDS-0006)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
r5613r5614
52085518    {4,0,1,2,5,7,3,6}
52095519};
52105520
5211static const atomiswave_key df_key = {
5212    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5213    {9,15,28,7,13,24,2,23,21,1,22,16,18,8,17,31,27,6,30,12,4,20,5,19,0,25,3,29,10,14,11,26},
5214    {5,2,13,11,8,6,12,1,4,3,0,10,14,15,7,9},
5215    {11,6,10,0,12,1,8,14,2,9,13,3,7,4,15,5},
5216    {1,5,6,2,4,7,3,0}
5217};
5218
52195521static const atomiswave_key rm_key = {
52205522    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
52215523    {3,0,14,17,10,15,31,20,13,2,29,28,9,18,25,27,6,19,30,22,7,12,1,16,23,11,24,4,8,26,21,5},
r5613r5614
52485550    {4,0,1,2,5,7,3,6}
52495551};
52505552
5553static const atomiswave_key dolphin_key = {
5554    {8,10,1,3,7,4,11,2,5,15,6,0,12,13,9,14},
5555    {11,8,6,25,2,7,23,28,5,10,21,20,1,26,17,19,14,27,22,30,15,4,9,24,31,3,16,12,0,18,29,13},
5556    {13,5,9,6,4,2,11,10,12,0,8,1,3,14,15,7},
5557    {1,13,11,3,8,7,9,10,12,15,4,14,0,5,6,2},
5558    {3,0,5,6,2,4,1,7}
5559};
5560
5561static const atomiswave_key demofist_key = {
5562    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5563    {9,15,28,7,13,24,2,23,21,1,22,16,18,8,17,31,27,6,30,12,4,20,5,19,0,25,3,29,10,14,11,26},
5564    {5,2,13,11,8,6,12,1,4,3,0,10,14,15,7,9},
5565    {11,6,10,0,12,1,8,14,2,9,13,3,7,4,15,5},
5566    {1,5,6,2,4,7,3,0}
5567};
5568
5569static const atomiswave_key rumblef_key = {
5570    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5571    {11,3,7,1,31,17,16,15,24,18,23,26,4,25,20,10,12,27,29,21,5,8,30,14,19,9,0,2,13,6,22,28},
5572    {7,11,10,3,15,6,14,4,9,5,8,0,1,12,2,13},
5573    {11,1,8,10,9,5,15,14,12,3,0,6,4,7,13,2},
5574    {4,0,1,2,5,7,3,6}
5575};
5576
5577static const atomiswave_key ngbc_key = {
5578    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5579    {17,25,29,27,5,11,10,21,2,8,13,0,30,3,14,16,22,1,7,15,31,18,4,20,9,19,26,24,23,28,12,6},
5580    {15,3,2,11,7,14,6,12,1,13,0,8,9,4,10,5},
5581    {6,12,5,7,4,8,2,3,1,14,13,11,9,10,0,15},
5582    {5,1,0,3,4,6,2,7}
5583};
5584
5585static const atomiswave_key kofnw_key = {
5586    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5587    {22,16,3,24,18,7,29,8,10,30,9,15,13,23,14,0,4,25,1,19,27,11,26,12,31,6,28,2,21,17,20,5},
5588    {8,15,0,6,5,11,1,12,9,14,13,7,3,2,10,4},
5589    {2,15,3,9,5,8,1,7,11,0,4,10,14,13,6,12},
5590    {4,0,3,7,1,2,6,5}
5591};
5592
5593static const atomiswave_key kov7sprt_key = {
5594    {14,1,11,15,7,3,8,13,0,4,2,12,6,10,5,9},
5595    {17,3,31,2,28,10,9,29,6,25,24,8,13,1,19,15,22,0,14,20,16,7,21,4,18,26,27,5,12,23,11,30},
5596    {4,8,11,15,3,14,7,12,1,0,9,5,6,13,2,10},
5597    {14,0,9,11,4,1,7,5,13,6,8,12,2,3,10,15},
5598    {2,1,0,5,4,6,7,3}
5599};
5600
5601static const atomiswave_key ggisuka_key = {
5602    {12,7,11,2,0,5,15,6,1,8,14,4,9,13,3,10},
5603    {14,6,2,4,26,20,21,10,29,23,18,31,1,28,17,15,9,30,24,16,0,13,27,11,22,12,5,7,8,3,19,25},
5604    {5,9,8,1,13,4,12,6,11,7,10,2,3,14,0,15},
5605    {15,5,12,14,13,1,11,10,8,7,4,2,0,3,9,6},
5606    {1,5,4,7,0,2,6,3}
5607};
5608
52515609static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const atomiswave_key* key)
52525610{
52535611    int b0,b1,b2,b3;
r5613r5614
52745632static DRIVER_INIT( atomiswave )
52755633{
52765634   UINT64 *ROM = (UINT64 *)memory_region(machine, "maincpu");
5635#if 0
5636   UINT8 *dcdata = (UINT8 *)memory_region(machine, "user1");
5637   FILE *f;
52775638
5639   f = fopen("aw.bin", "wb");
5640   fwrite(dcdata, 0x8000000, 1, f);
5641   fclose(f);
5642#endif
52785643   // patch out long startup delay
52795644   ROM[0x98e/8] = (ROM[0x98e/8] & U64(0xffffffffffff)) | (UINT64)0x0009<<48;
52805645
r5613r5614
53085673
53095674   for(i=0; i<rom_size/2; i++)
53105675   {
5311      src[i] = atomiswave_decrypt(src[i], i*2, &df_key);
5676      src[i] = atomiswave_decrypt(src[i], i*2, &demofist_key);
53125677   }
53135678
53145679   DRIVER_INIT_CALL(atomiswave);
r5613r5614
53745739   DRIVER_INIT_CALL(atomiswave);
53755740}
53765741
5742static DRIVER_INIT(dolphin)
5743{
5744     int i;
5745   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5746
5747   long rom_size = memory_region_length(machine, "user1");
5748
5749   for(i=0; i<rom_size/2; i++)
5750   {
5751      src[i] = atomiswave_decrypt(src[i], i*2, &dolphin_key);
5752   }
5753
5754   DRIVER_INIT_CALL(atomiswave);
5755}
5756
5757static DRIVER_INIT(rumblef)
5758{
5759     int i;
5760   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5761
5762   long rom_size = memory_region_length(machine, "user1");
5763
5764   for(i=0; i<rom_size/2; i++)
5765   {
5766      src[i] = atomiswave_decrypt(src[i], i*2, &rumblef_key);
5767   }
5768
5769   DRIVER_INIT_CALL(atomiswave);
5770}
5771
5772static DRIVER_INIT(ngbc)
5773{
5774     int i;
5775   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5776
5777   long rom_size = memory_region_length(machine, "user1");
5778
5779   for(i=0; i<rom_size/2; i++)
5780   {
5781      src[i] = atomiswave_decrypt(src[i], i*2, &ngbc_key);
5782   }
5783
5784   DRIVER_INIT_CALL(atomiswave);
5785}
5786
5787static DRIVER_INIT(kofnw)
5788{
5789     int i;
5790   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5791
5792   long rom_size = memory_region_length(machine, "user1");
5793
5794   for(i=0; i<rom_size/2; i++)
5795   {
5796      src[i] = atomiswave_decrypt(src[i], i*2, &kofnw_key);
5797   }
5798
5799   DRIVER_INIT_CALL(atomiswave);
5800}
5801
5802static DRIVER_INIT(kov7sprt)
5803{
5804     int i;
5805   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5806
5807   long rom_size = memory_region_length(machine, "user1");
5808
5809   for(i=0; i<rom_size/2; i++)
5810   {
5811      src[i] = atomiswave_decrypt(src[i], i*2, &kov7sprt_key);
5812   }
5813
5814   DRIVER_INIT_CALL(atomiswave);
5815}
5816
5817static DRIVER_INIT(ggisuka)
5818{
5819     int i;
5820   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5821
5822   long rom_size = memory_region_length(machine, "user1");
5823
5824   for(i=0; i<rom_size/2; i++)
5825   {
5826      src[i] = atomiswave_decrypt(src[i], i*2, &ggisuka_key);
5827   }
5828
5829   DRIVER_INIT_CALL(atomiswave);
5830}
5831
53775832ROM_START( fotns )
53785833   ROM_REGION( 0x200000, "maincpu", 0)
53795834   AW_BIOS
r5613r5614
53895844   ROM_LOAD("ax1907m01.ic17", 0x7000000, 0x1000000,  CRC(9d3a0520) SHA1(78583fd171b34439f77a04a97ebe3c9d1bab61cc) )
53905845ROM_END
53915846
5392ROM_START( demofist )
5393   ROM_REGION( 0x200000, "maincpu", 0)
5394   AW_BIOS
5395
5396   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5397   ROM_LOAD("ax0601p01.ic18", 0x0000000, 0x0800000,  CRC(0efb38ad) SHA1(9400e37efe3e936474d74400ebdf28ad0869b67b) )
5398   ROM_LOAD("ic11", 0x1000000, 0x1000000,  NO_DUMP )
5399   ROM_LOAD("ic12", 0x2000000, 0x1000000,  NO_DUMP )
5400   ROM_LOAD("ic13", 0x3000000, 0x1000000,  NO_DUMP )
5401   ROM_LOAD("ic14", 0x4000000, 0x1000000,  NO_DUMP )
5402   ROM_LOAD("ic15", 0x5000000, 0x1000000,  NO_DUMP )
5403   ROM_LOAD("ic16", 0x6000000, 0x1000000,  NO_DUMP )
5404   ROM_LOAD("ic17", 0x7000000, 0x1000000,  NO_DUMP )
5405ROM_END
5406
54075847ROM_START( rangrmsn )
54085848   ROM_REGION( 0x200000, "maincpu", 0)
54095849   AW_BIOS
r5613r5614
54625902        ROM_LOAD( "flash128.ic4s", 0x400000, 0x1000000, CRC(866ed675) SHA1(2c4c06935b7ab1876e640cede51713b841833567) )
54635903ROM_END
54645904
5905ROM_START( dolphin )
5906   ROM_REGION( 0x200000, "maincpu", 0)
5907   AW_BIOS
5908
5909   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5910   ROM_LOAD( "ax0401p01.ic18", 0x0000000, 0x0800000, CRC(195d6328) SHA1(cf3b5699f81235919dd3b1974d2ecb0376cb4552) )
5911   ROM_LOAD( "ax0401m01.ic11", 0x1000000, 0x1000000, CRC(5e5dca57) SHA1(e0623c84f66cada37d4c9399a7a8fc6866933144) )
5912   ROM_LOAD( "ax0402m01.ic12", 0x2000000, 0x1000000, CRC(77dd4771) SHA1(dcd23b8ddc82eab2f325266ffd7ed3fbc1bcdf71) )
5913   ROM_LOAD( "ax0403m01.ic13", 0x3000000, 0x1000000, CRC(911d0674) SHA1(eec35badcfbfe412b7104a86c2111f5a1b5fb5cd) )
5914   ROM_LOAD( "ax0404m01.ic14", 0x4000000, 0x1000000, CRC(f82a4ca3) SHA1(da686d86e176a9f24874d2916b1932f03a99a52d) )
5915   ROM_LOAD( "ax0405m01.ic15", 0x5000000, 0x1000000, CRC(b88298d7) SHA1(490c3ec471018895b7268ee33498dddaccbbfd5a) )
5916ROM_END                 
5917                 
5918ROM_START( demofist )
5919   ROM_REGION( 0x200000, "maincpu", 0)
5920   AW_BIOS
5921
5922   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5923   ROM_LOAD( "ax0601p01.ic18", 0x0000000, 0x0800000, CRC(0efb38ad) SHA1(9400e37efe3e936474d74400ebdf28ad0869b67b) )
5924   ROM_LOAD( "ax0601m01.ic11", 0x1000000, 0x1000000, CRC(12fda2c7) SHA1(3afbac221ffe249386e4cb50b4edd013d9a40062) )
5925   ROM_LOAD( "ax0602m01.ic12", 0x2000000, 0x1000000, CRC(aea61fdf) SHA1(0a088848bbf7a47df8b44b69bf72ed0d4a1088f8) )
5926   ROM_LOAD( "ax0603m01.ic13", 0x3000000, 0x1000000, CRC(d5879d35) SHA1(977cd3b373c6f94eb21ffb24ff564971d3d633e5) )
5927   ROM_LOAD( "ax0604m01.ic14", 0x4000000, 0x1000000, CRC(a7b09048) SHA1(229fa2332b58fec2a712c3ebd672662f35a9485a) )
5928   ROM_LOAD( "ax0605m01.ic15", 0x5000000, 0x1000000, CRC(18d8437e) SHA1(fe2e189e40a89141335e754268d29d46e3eb3bb8) )
5929   ROM_LOAD( "ax0606m01.ic16", 0x6000000, 0x1000000, CRC(42c81617) SHA1(1cc686af5e3fc56143836e3dcc0067893f82fcf9) )
5930   ROM_LOAD( "ax0607m01.ic17", 0x7000000, 0x1000000, CRC(96e5aa84) SHA1(e9841f550f2ef409d97004542bcadabb6b9e84af) )
5931ROM_END
5932
5933ROM_START( rumblef )
5934   ROM_REGION( 0x200000, "maincpu", 0)
5935   AW_BIOS
5936
5937   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5938   ROM_LOAD( "ax1801p01.ic18", 0x0000000, 0x0800000, CRC(2f7fb163) SHA1(bf819d798d9a3a7bc754e111a3f53b9db6d6042a) )
5939   ROM_LOAD( "ax1801m01.ic11", 0x1000000, 0x1000000, CRC(c38aa61c) SHA1(e2f688a0aa8b0119f5fd3d53c8904e035d43a4b1) )
5940   ROM_LOAD( "ax1802m01.ic12", 0x2000000, 0x1000000, CRC(72e0ebc8) SHA1(e85300a405ea14c4c9d857eb9685c93faaca1d56) )
5941   ROM_LOAD( "ax1803m01.ic13", 0x3000000, 0x1000000, CRC(d0f59d98) SHA1(b854796087e9f76a13a21da8249f7224e451e129) )
5942   ROM_LOAD( "ax1804m01.ic14", 0x4000000, 0x1000000, CRC(15595cba) SHA1(8dd06d1f986cd21a58d20b662b11ed7ba8a6ff7a) )
5943   ROM_LOAD( "ax1805m01.ic15", 0x5000000, 0x1000000, CRC(3d3f8e0d) SHA1(364a0bda890722b9fb72171f96c742b8f3fef23e) )
5944   ROM_LOAD( "ax1806m01.ic16", 0x6000000, 0x1000000, CRC(ac2751bb) SHA1(5070fa12bf109ab87e8f7ea46ac4ae78a73105da) )
5945   ROM_LOAD( "ax1807m01.ic17", 0x7000000, 0x1000000, CRC(3b2fbdb0) SHA1(f9f7e06785d3a07282247aaedd9999aa7c2670b9) )
5946ROM_END
5947
5948ROM_START( ngbc )
5949   ROM_REGION( 0x200000, "maincpu", 0)
5950   AW_BIOS
5951
5952   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5953   ROM_LOAD( "ax3301p01.fmem1", 0x000000, 0x800000, CRC(f7e24e67) SHA1(8eef26d44b294faa509304b1b04f4d801337bc99) )
5954ROM_END
5955
5956ROM_START( kofnw )
5957   ROM_REGION( 0x200000, "maincpu", 0)
5958   AW_BIOS
5959
5960   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5961   ROM_LOAD( "ax2201p01.ic18", 0x0000000, 0x0800000, CRC(27aab918) SHA1(41c5ddd8bd4c91481750606ab44aa115b5fe01d0) )
5962   ROM_LOAD( "ax2201m01.ic11", 0x1000000, 0x1000000, CRC(22ea665b) SHA1(292c92c9ae43eea2d1c27cedfb89c3956b8dea32) )
5963   ROM_LOAD( "ax2202m01.ic12", 0x2000000, 0x1000000, CRC(7fad1bea) SHA1(89f3f88af48973a4685955d86ef97a1487b8e7a8) )
5964   ROM_LOAD( "ax2203m01.ic13", 0x3000000, 0x1000000, CRC(78986ca4) SHA1(5a6c8c12955573f33361d2c6f20f85de35ac7bae) )
5965   ROM_LOAD( "ax2204m01.ic14", 0x4000000, 0x1000000, CRC(6ffbeb04) SHA1(975062cf364589dbdd5c5cb5ca945f76d87fc120) )
5966   ROM_LOAD( "ax2205m01.ic15", 0x5000000, 0x1000000, CRC(2851b791) SHA1(566ef95ea066b7bf548986085670242be217befc) )
5967   ROM_LOAD( "ax2206m01.ic16", 0x6000000, 0x1000000, CRC(e53eb965) SHA1(f50cd53a5859f081d8a278d24a519c9d9b49ab96) )
5968ROM_END
5969
5970ROM_START( kov7sprt )
5971   ROM_REGION( 0x200000, "maincpu", 0)
5972   AW_BIOS
5973
5974   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
5975        ROM_LOAD( "ax1301p01.ic18", 0x0000000, 0x0800000, CRC(6833a334) SHA1(646aaa578e09ad23bc9c7f4fbdfb3c1486916fd3) )
5976        ROM_LOAD( "ax1301m01.ic11", 0x1000000, 0x1000000, CRC(58ae7ca1) SHA1(e91975697b797ea05488ace649cbb9964b4cd500) )
5977        ROM_LOAD( "ax1301m02.ic12", 0x2000000, 0x1000000, CRC(871ea03f) SHA1(6806910832ca271a9240aca8e91279556e5b0cb7) )
5978        ROM_LOAD( "ax1301m03.ic13", 0x3000000, 0x1000000, CRC(abc328bc) SHA1(d9271d4e5abe76d31de0f60a5c106260338d42e9) )
5979        ROM_LOAD( "ax1301m04.ic14", 0x4000000, 0x1000000, CRC(25a176d1) SHA1(6d815bf6acb645fead060733660e24fb0d44282d) )
5980        ROM_LOAD( "ax1301m05.ic15", 0x5000000, 0x1000000, CRC(e6573a93) SHA1(0666e52d0088263f28938e4c8aae201e604ec1f2) )
5981        ROM_LOAD( "ax1301m06.ic16", 0x6000000, 0x1000000, CRC(cb8cacb4) SHA1(5d008e8a934451b9bfa33fedfd492c86d9226ef5) )
5982        ROM_LOAD( "ax1301m07.ic17", 0x7000000, 0x1000000, CRC(0ca92213) SHA1(115c50fa55e6de3439de23e74621695510c6a7ba) )
5983ROM_END
5984
5985ROM_START( ggisuka )
5986   ROM_REGION( 0x200000, "maincpu", 0)
5987   AW_BIOS
5988
5989   ROM_REGION( 0x9000000, "user1", ROMREGION_ERASE)
5990        ROM_LOAD( "ax1201p01.ic18", 0x0000000, 0x0800000, CRC(0a78d52c) SHA1(e9006dc43cd11d5ba49a092a1dff31dc10700c28) )
5991        ROM_LOAD( "ax1202m01.ic11", 0x1000000, 0x1000000, CRC(dfc6fd67) SHA1(f9d35b18a03d22f70feda42d314b0f9dd54eea55) )
5992        ROM_LOAD( "ax1203m01.ic12", 0x2000000, 0x1000000, CRC(bf623df9) SHA1(8b9a8e8100ff6d2ce9a982ab8eb1d542f1c7af03) )
5993        ROM_LOAD( "ax1204m01.ic13", 0x3000000, 0x1000000, CRC(c80c3930) SHA1(5c39fde36e2ebbfe72967d7d0202eb454a8d3bbe) )
5994        ROM_LOAD( "ax1205m01.ic14", 0x4000000, 0x1000000, CRC(e99a269d) SHA1(a52148b82b0338b8bad8b52985302eaf81a4cfde) )
5995        ROM_LOAD( "ax1206m01.ic15", 0x5000000, 0x1000000, CRC(807ab795) SHA1(17c86b1a56333c05b68ff84f83e964d013c1819c) )
5996        ROM_LOAD( "ax1207m01.ic16", 0x6000000, 0x1000000, CRC(6636d1b8) SHA1(9bd8fc114557f6fbe772f85eeb246f7336d4255e) )
5997        ROM_LOAD( "ax1208m01.ic17", 0x7000000, 0x1000000, CRC(38bda476) SHA1(0234a6f5fbaf5e958b3ba0db311dff157f80addc) )
5998        ROM_LOAD( "ax1201m01.ic10", 0x8000000, 0x1000000, CRC(df96ce30) SHA1(25a9f743b1c2b11896d0c7a2dc1c198fc977aaca) )
5999ROM_END
6000
54656001/* Atomiswave */
5466GAME( 2001, awbios,   0,        aw,    naomi,    0,        ROT0, "Sammy",                           "Atomiswave Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
6002GAME( 2001, awbios,   0,        aw,    aw,    0,        ROT0, "Sammy",                           "Atomiswave Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
54676003
5468GAME( 2002, sprtshot, awbios,   aw,    naomi,    sprtshot, ROT0, "Sammy",                           "Sports Shooting USA", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5469GAME( 2003, demofist, awbios,   aw,    naomi,    demofist, ROT0, "Polygon Magic / Dimps",           "Demolish Fist", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5470GAME( 2004, rangrmsn, awbios,   aw,    naomi,    rangrmsn, ROT0, "Sammy",                           "Ranger Mission", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5471GAME( 2005, fotns,    awbios,   aw,    naomi,    fotns,    ROT0, "Arc System Works",                "Fist Of The North Star", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5472GAME( 2005, xtrmhunt, awbios,   aw,    naomi,    xtrmhunt, ROT0, "Sammy",                           "Extreme Hunting", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5473GAME( 2006, xtrmhnt2, awbios,   aw,    naomi,    xtrmhnt2, ROT0, "Sammy",                           "Extreme Hunting 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5474
6004GAME( 2002, sprtshot, awbios,   aw,    aw,    sprtshot, ROT0, "Sammy USA",                       "Sports Shooting USA", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6005GAME( 2003, demofist, awbios,   aw,    aw,    demofist, ROT0, "Polygon Magic / Dimps",           "Demolish Fist", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6006GAME( 2003, dolphin,  awbios,   aw,    aw,    dolphin,  ROT0, "Sammy",                           "Dolphin Blue", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
6007GAME( 2003, ggisuka,  awbios,   aw,    aw,    ggisuka,  ROT0, "Sammy / Arc System Works",        "Guilty Gear Isuka", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6008GAME( 2004, rumblef,  awbios,   aw,    aw,    rumblef,  ROT0, "Sammy / Dimps",                   "The Rumble Fish", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
6009GAME( 2004, rangrmsn, awbios,   aw,    aw,    rangrmsn, ROT0, "Sammy",                           "Ranger Mission", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6010GAME( 2004, kov7sprt, awbios,   aw,    aw,    kov7sprt, ROT0, "Sammy / IGS",           "Knights of Valour - The Seven Spirits", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
6011GAME( 2005, ngbc,     awbios,   aw,    aw,    ngbc,     ROT0, "Sammy / SNK Playmore",            "Neo-Geo Battle Coliseum", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6012GAME( 2005, fotns,    awbios,   aw,    aw,    fotns,    ROT0, "Sega / Arc System Works",         "Fist Of The North Star", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6013GAME( 2005, kofnw,    awbios,   aw,    aw,    kofnw,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters Neowave", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6014GAME( 2005, xtrmhunt, awbios,   aw,    aw,    xtrmhunt, ROT0, "Sammy",                           "Extreme Hunting", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6015GAME( 2006, xtrmhnt2, awbios,   aw,    aw,    xtrmhnt2, ROT0, "Sega",                            "Extreme Hunting 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
src/mame/drivers/meritm.c
r5613r5614
369369
370370static VIDEO_UPDATE( meritm )
371371{
372   if(input_code_pressed_once(KEYCODE_Q))
372   if(input_code_pressed_once(screen->machine, KEYCODE_Q))
373373   {
374374      layer0_enabled^=1;
375375      popmessage("Layer 0 %sabled",layer0_enabled ? "en" : "dis");
376376   }
377   if(input_code_pressed_once(KEYCODE_W))
377   if(input_code_pressed_once(screen->machine, KEYCODE_W))
378378   {
379379      layer1_enabled^=1;
380380      popmessage("Layer 1 %sabled",layer1_enabled ? "en" : "dis");
src/mame/drivers/pokechmp.c
r5613r5614
196196   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
197197INPUT_PORTS_END
198198
199
199/* this makes no sense at all!  it seems impossible to get the colours to align up in the korean flag ingame and everything else is slightly broken too */
200200static const gfx_layout pokechmp_charlayout =
201201{
202202   8,8,   /* 8*8 characters */
r5613r5614
209209};
210210
211211
212/* should be ok.. */
212213static const gfx_layout pokechmp_spritelayout =
213214{
214   16,16,  /* 16*16 sprites */
215   RGN_FRAC(1,8),   /* 1024 sprites */
216   4,
217   { RGN_FRAC(1,8),RGN_FRAC(5,8), RGN_FRAC(3,8),RGN_FRAC(7,8) },
218   { 128+7, 128+6, 128+5, 128+4, 128+3, 128+2, 128+1, 128+0, 7, 6, 5, 4, 3, 2, 1, 0 },
219   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
220   32*8   /* every char takes 8 consecutive bytes */
21516,16,  /* 16*16 sprites */
216RGN_FRAC(1,8),   /* 1024 sprites */
2174,
218{RGN_FRAC(1,8),RGN_FRAC(3,8),RGN_FRAC(5,8),RGN_FRAC(7,8)},
219{ 128+7, 128+6, 128+5, 128+4, 128+3, 128+2, 128+1, 128+0, 7, 6, 5, 4, 3, 2, 1, 0 },
220{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
22132*8    /* every char takes 8 consecutive bytes */
221222};
222223
223224
r5613r5614
290291   ROM_LOAD( "pokechamp_08_27c020.bin",      0xc0000, 0x40000, CRC(e9db54d6) SHA1(ac3b7c06d0f61847bf9bc6147f2f88d712f2b4b3) )
291292
292293   ROM_REGION( 0x40000, "gfx2", 0 )
293   /* the first half of all these roms is identical... for rom 3 both halves match, is the first half unused? 4bpp gfx? */
294   ROM_LOAD( "pokechamp_01_27c512.bin",      0x00000, 0x10000, CRC(338fc412) SHA1(bb8ae99ee6a399a8c67bedb88d0837fd0a4a426c) )
295   ROM_LOAD( "pokechamp_02_27c512.bin",      0x10000, 0x10000, CRC(1ff44545) SHA1(2eee44484accce7b0ba21babf6e8344b234a4e87) )
296   ROM_LOAD( "pokechamp_03_27c512.bin",      0x20000, 0x10000, CRC(99f9884a) SHA1(096d6ce70dc51fb9142e80e1ec45d6d7225481f5) )
297   ROM_LOAD( "pokechamp_04_27c512.bin",      0x30000, 0x10000, CRC(ee6991af) SHA1(8eca3cdfd2eb74257253957a87b245b7f85bd038) )
294   /* the first half of all these roms is identical.  For rom 3 both halves match.  Correct decode is to ignore the first half */
295   ROM_LOAD( "pokechamp_02_27c512.bin",      0x00000, 0x10000, CRC(1ff44545) SHA1(2eee44484accce7b0ba21babf6e8344b234a4e87) )
296   ROM_LOAD( "pokechamp_01_27c512.bin",      0x10000, 0x10000, CRC(338fc412) SHA1(bb8ae99ee6a399a8c67bedb88d0837fd0a4a426c) )
297   ROM_LOAD( "pokechamp_04_27c512.bin",      0x20000, 0x10000, CRC(ee6991af) SHA1(8eca3cdfd2eb74257253957a87b245b7f85bd038) )
298   ROM_LOAD( "pokechamp_03_27c512.bin",      0x30000, 0x10000, CRC(99f9884a) SHA1(096d6ce70dc51fb9142e80e1ec45d6d7225481f5) )
298299
299300   ROM_REGION( 0x80000, "oki", 0 )
300301   ROM_LOAD( "pokechamp_10_27c040.bin",      0x00000, 0x80000, CRC(b54806ed) SHA1(c6e1485c263ebd9102ff1e8c09b4c4ca5f63c3da) )
src/mame/drivers/midas.c
r5613r5614
161161   int layers_ctrl = -1;
162162
163163#if MIDAS_DEBUG
164   if ( input_code_pressed(KEYCODE_Z) )
164   if ( input_code_pressed(screen->machine, KEYCODE_Z) )
165165   {
166166      int msk = 0;
167      if (input_code_pressed(KEYCODE_Q))   msk |= 1 << 0;   // for tmap
168      if (input_code_pressed(KEYCODE_A))   msk |= 1 << 1;   // for sprites
167      if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1 << 0;   // for tmap
168      if (input_code_pressed(screen->machine, KEYCODE_A))   msk |= 1 << 1;   // for sprites
169169      if (msk != 0) layers_ctrl &= msk;
170170   }
171171#endif
src/mame/drivers/galaxi.c
r5613r5614
131131   int layers_ctrl = -1;
132132
133133#ifdef MAME_DEBUG
134   if (input_code_pressed(KEYCODE_R))   // remapped due to inputs changes.
134   if (input_code_pressed(screen->machine, KEYCODE_R))   // remapped due to inputs changes.
135135   {
136136      int msk = 0;
137      if (input_code_pressed(KEYCODE_T))   msk |= 1;
138      if (input_code_pressed(KEYCODE_Y))   msk |= 2;
139      if (input_code_pressed(KEYCODE_U))   msk |= 4;
140      if (input_code_pressed(KEYCODE_I))   msk |= 8;
141      if (input_code_pressed(KEYCODE_O))   msk |= 16;
137      if (input_code_pressed(screen->machine, KEYCODE_T))   msk |= 1;
138      if (input_code_pressed(screen->machine, KEYCODE_Y))   msk |= 2;
139      if (input_code_pressed(screen->machine, KEYCODE_U))   msk |= 4;
140      if (input_code_pressed(screen->machine, KEYCODE_I))   msk |= 8;
141      if (input_code_pressed(screen->machine, KEYCODE_O))   msk |= 16;
142142      if (msk != 0) layers_ctrl &= msk;
143143   }
144144#endif
src/mame/drivers/kchamp.c
r5613r5614
619619   ROM_LOAD( "br25", 0x0200, 0x0100, CRC(ba4a5651) SHA1(77e81bd64ab59a7466d20eabdff4be241e963c52) ) /* blue */
620620ROM_END
621621
622ROM_START( kchampvs2 )
623   ROM_REGION( 0x10000, "maincpu", 0 )
624   ROM_LOAD( "lt.d13", 0x0000, 0x2000, CRC(eef41aa8) SHA1(6d4e8159e9c3cd629337863c0397ff90b4c8d3fa) )
625   ROM_LOAD( "lt.d11", 0x2000, 0x2000, CRC(091f810e) SHA1(283edb08ce106835185a1c2d6b88f7544d75f3b4) )
626   ROM_LOAD( "lt.d10", 0x4000, 0x2000, CRC(d4df2a52) SHA1(60d6cb1cb51c6f80a0f88913d4152ab8bda752d6) )
627   ROM_LOAD( "lt.d8",  0x6000, 0x2000, CRC(3d4ef0da) SHA1(228c8e47bb7123b69746506402edb875a43d7af5) )
628   ROM_LOAD( "lt.d7",  0x8000, 0x2000, CRC(623a467b) SHA1(5f150c67632f8e32769b75aa0615d0eb018afdc4) )
629   ROM_LOAD( "lt.d6",  0xa000, 0x2000, CRC(c3bc6e46) SHA1(a7b9420592905b0df5ff00c392d887f40395179f) )
630   ROM_CONTINUE(       0xe000, 0x2000 )
631
632   ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */
633   ROM_LOAD( "lt.d4", 0x0000, 0x2000, CRC(eaa646eb) SHA1(cbd48f4d5d225b71c2dd0b14f420838561e3f83e) )
634   ROM_LOAD( "lt.d2", 0x2000, 0x2000, CRC(d71031ad) SHA1(b168f4ef4feb4195305404df699acecb731eab02) ) /* adpcm */
635   ROM_LOAD( "lt.d1", 0x4000, 0x2000, CRC(6f811c43) SHA1(1d33ac8129562ab709bd7396b4c2457b6db99277) ) /* adpcm */
636
637   ROM_REGION( 0x08000, "gfx1", 0 )
638   ROM_LOAD( "lt.k1",    0x00000, 0x2000, CRC(4c574ecd) SHA1(86914eef33da73463ba6261eecae75209d24fac1) )
639   ROM_LOAD( "lt.k3",    0x02000, 0x2000, CRC(750b66af) SHA1(c7824994b977d4e846f3ecadfcfc51331f52b6f4) )
640   ROM_LOAD( "lt.k5",    0x04000, 0x2000, CRC(9ad6227c) SHA1(708af5e70927040cf7f2ae6f792344c19099530c) )
641   ROM_LOAD( "lt.k6",    0x06000, 0x2000, CRC(3b6d5de5) SHA1(288fffcbc9369db5c75e7e0d6181612de6f12da3) )
642
643   ROM_REGION( 0x18000, "gfx2", 0 )
644   ROM_LOAD( "lt.a1",    0x00000, 0x2000, CRC(51eda56c) SHA1(31438e115e95c2a684ec65ed2bdb9125e3675226) )
645   ROM_LOAD( "lt.c1",    0x02000, 0x2000, CRC(593264cf) SHA1(866469f37b6c90afc65e53e6589b67ac4b25997e) )
646   ROM_LOAD( "lt.a3",    0x04000, 0x2000, CRC(b4842ea9) SHA1(471475f65edbd292b9162ad50e5cb0c7144845b0) )  /* top, plane0 */ /* sprites */
647   ROM_LOAD( "lt.c3",    0x06000, 0x2000, CRC(8cd166a5) SHA1(4b623c4c0025d75b3ed9746f8b6730bf3e65d85a) )  /* bot, plane0 */ /* sprites */
648   ROM_LOAD( "lt.a5",    0x08000, 0x2000, CRC(4cbd3aa3) SHA1(a9a683dcc4f52b18450659a20434a4d2a7b411d9) )  /* top, plane0 */ /* sprites */
649   ROM_LOAD( "lt.c5",    0x0a000, 0x2000, CRC(6be342a6) SHA1(0b8ac7ef7c6a6464fbc027a9fd17fa7ce1ffd962) )  /* bot, plane0 */ /* sprites */
650   ROM_LOAD( "lt.a7",    0x0c000, 0x2000, CRC(8dcd271a) SHA1(0abeaa46433a59c110815ecf188c7afd6fa387a4) )
651   ROM_LOAD( "lt.c6",    0x0e000, 0x2000, CRC(4ee1dba7) SHA1(717ce9a4e20f6e02adf678b1400af4aaecdbfb40) )
652   ROM_LOAD( "lt.a8",    0x10000, 0x2000, CRC(7346db8a) SHA1(d2b2c1700ae0ff9c614a9981a3da3d69879e9f25) )  /* top, plane1 */ /* sprites */
653   ROM_LOAD( "lt.c8",    0x12000, 0x2000, CRC(b78714fc) SHA1(4df7f15c37d56a9d66d0049aad65b32063e5c29a) )  /* bot, plane1 */ /* sprites */
654   ROM_LOAD( "lt.a10",   0x14000, 0x2000, CRC(b2557102) SHA1(ec4285029fc3ee1ad0adb05f363b234c67f8903d) )  /* top, plane1 */ /* sprites */
655   ROM_LOAD( "lt.c10",   0x16000, 0x2000, CRC(c85aba0e) SHA1(4be21b38623c2a8ae7f1e7397fb002e4cb9e4614) )  /* bot, plane1 */ /* sprites */
656
657   ROM_REGION( 0x0300, "proms", 0 )
658   ROM_LOAD( "lt.k10",  0x0000, 0x0100, CRC(f683c54a) SHA1(92893990456b92f04a2be98b8e9626e97b7a2562) ) /* red */
659   ROM_LOAD( "lt.k9",   0x0100, 0x0100, CRC(3ddbb6c4) SHA1(0eca5594d6812bc79f8b78f83fe003877d20c973) ) /* green */
660   ROM_LOAD( "lt.k8",   0x0200, 0x0100, CRC(ba4a5651) SHA1(77e81bd64ab59a7466d20eabdff4be241e963c52) ) /* blue */
661ROM_END
662
622663ROM_START( karatevs )
623664   ROM_REGION( 0x10000, "maincpu", 0 )   /* 64k for code + 64k for decrypted opcodes */
624665   ROM_LOAD( "br24", 0x0000, 0x2000, CRC(ea9cda49) SHA1(7d753a8d391418d0fe5231eb88b3627f7d3fd99e) )
r5613r5614
661702ROM_END
662703
663704
664
665static DRIVER_INIT( kchampvs )
705static UINT8 *decrypt_code(running_machine *machine)
666706{
667707   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
668708   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000);
r5613r5614
674714   for (A = 0;A < 0x10000;A++)
675715      decrypted[A] = (rom[A] & 0x55) | ((rom[A] & 0x88) >> 2) | ((rom[A] & 0x22) << 2);
676716
717   return decrypted;
718}
719
720
721static DRIVER_INIT( kchampvs )
722{
723   UINT8 *rom = memory_region(machine, "maincpu");
724   UINT8 *decrypted = decrypt_code(machine);
725   int A;
726
677727   /*
678728        Note that the first 4 opcodes that the program
679729        executes aren't encrypted for some obscure reason.
r5613r5614
695745}
696746
697747
748static DRIVER_INIT( kchampvs2 )
749{
750   decrypt_code(machine);
751}
698752
699GAME( 1984, kchamp,   0,      kchamp,   kchamp,   0,        ROT90, "Data East USA", "Karate Champ (US)", 0 )
700GAME( 1984, karatedo, kchamp, kchamp,   kchamp,   0,        ROT90, "Data East Corporation", "Karate Dou (Japan)", 0 )
701GAME( 1984, kchampvs, kchamp, kchampvs, kchampvs, kchampvs, ROT90, "Data East USA", "Karate Champ (US VS version)", 0 )
702GAME( 1984, karatevs, kchamp, kchampvs, kchampvs, kchampvs, ROT90, "Data East Corporation", "Taisen Karate Dou (Japan VS version)", 0 )
703753
754
755GAME( 1984, kchamp,    0,      kchamp,   kchamp,   0,         ROT90, "Data East USA", "Karate Champ (US)", 0 )
756GAME( 1984, karatedo,  kchamp, kchamp,   kchamp,   0,         ROT90, "Data East Corporation", "Karate Dou (Japan)", 0 )
757GAME( 1984, kchampvs,  kchamp, kchampvs, kchampvs, kchampvs,  ROT90, "Data East USA", "Karate Champ (US, VS version set 1)", 0 )
758GAME( 1984, kchampvs2, kchamp, kchampvs, kchampvs, kchampvs2, ROT90, "Data East USA", "Karate Champ (US, VS version set 2)", 0 )
759GAME( 1984, karatevs,  kchamp, kchampvs, kchampvs, kchampvs,  ROT90, "Data East Corporation", "Taisen Karate Dou (Japan VS version)", 0 )
760
src/mame/drivers/lastfght.c
r5613r5614
9595   UINT8 *gfxdata = memory_region( screen->machine, "gfx1" );
9696   UINT8 data;
9797
98   if ( input_code_pressed_once(KEYCODE_ENTER) )   view_roms ^= 1;
98   if ( input_code_pressed_once(screen->machine, KEYCODE_ENTER) )   view_roms ^= 1;
9999   if ( view_roms )
100100   {
101      if ( input_code_pressed_once(KEYCODE_PGDN) )   base += 512 * 256;
102      if ( input_code_pressed_once(KEYCODE_PGUP) )   base -= 512 * 256;
101      if ( input_code_pressed_once(screen->machine, KEYCODE_PGDN) )   base += 512 * 256;
102      if ( input_code_pressed_once(screen->machine, KEYCODE_PGUP) )   base -= 512 * 256;
103103      base %= memory_region_length( screen->machine, "gfx1" );
104104
105105      count = base;
src/mame/drivers/astinvad.c
r5613r5614
267267   if (bits_gone_hi & 0x04) sample_start(samples, 2, SND_BASEHIT, 0);
268268   if (bits_gone_hi & 0x08) sample_start(samples, 3, SND_INVADERHIT, 0);
269269
270   sound_global_enable(data & 0x20);
270   sound_global_enable(device->machine, data & 0x20);
271271   screen_red = data & 0x04;
272272}
273273
r5613r5614
313313   int bits_gone_hi = data & ~sound_state[1];
314314   sound_state[1] = data;
315315
316   sound_global_enable(data & 0x02);
316   sound_global_enable(space->machine, data & 0x02);
317317
318318   if (bits_gone_hi & 0x04) sample_start(samples, 3, SND_INVADERHIT, 0);
319319
src/mame/drivers/djmain.c
r5613r5614
17271727   ROM_LOAD16_BYTE( "993jaa10.27d", 0x100001, 0x80000, CRC(9D113A2D) SHA1(eee94a5f7015c49aa630b8df0c8e9d137d238811) )
17281728
17291729   DISK_REGION( "ide" )         /* IDE HARD DRIVE */
1730   DISK_IMAGE( "993hdda01", 0, SHA1(34a94b499adc3c09a18bc2cb98291591ed4fc757) )
1730   DISK_IMAGE( "993hdda01", 0, SHA1(f5d4df1dd27ce6ee2d0897852342691d55b63bfb) )
17311731   // this image has not been verified
17321732   //  DISK_IMAGE( "993jaa11", 0, MD5(e26eb62d7cf3357585f5066da6063143) )  /* ver 1.00 JA */
17331733
r5613r5614
19171917   ROM_LOAD16_BYTE( "831jaa10.27d", 0x100001, 0x80000, CRC(85173CB6) SHA1(bc4d86bf4654a9a0a58e624f77090854950f3993) )
19181918
19191919   DISK_REGION( "ide" )         /* IDE HARD DRIVE */
1920   DISK_IMAGE( "831jhdda01", 0, SHA1(24734177a517898ad5797ffd6974a45b073efc23) )
1920   DISK_IMAGE( "831jhdda01", 0, SHA1(ef62d5fcc1a36235fc932e6ecef71dc845d1d72d) )
19211921
19221922   ROM_REGION( 0x1000000, "shared", ROMREGION_ERASE00 )      /* K054539 RAM */
19231923ROM_END
src/mame/drivers/segahang.c
r5613r5614
304304   cputag_set_input_line(device->machine, "soundcpu", INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
305305   segaic16_tilemap_set_colscroll(device->machine, 0, ~data & 0x04);
306306   segaic16_tilemap_set_rowscroll(device->machine, 0, ~data & 0x02);
307   sound_global_enable(data & 0x01);
307   sound_global_enable(device->machine, data & 0x01);
308308}
309309
310310
src/mame/drivers/buggychl.c
r5613r5614
127127
128128static WRITE8_HANDLER( sound_enable_w )
129129{
130   sound_global_enable(data & 1);
130   sound_global_enable(space->machine, data & 1);
131131}
132132
133133
src/mame/drivers/gottlieb.c
r5613r5614
614614
615615static void laserdisc_audio_process(const device_config *device, int samplerate, int samples, const INT16 *ch0, const INT16 *ch1)
616616{
617   int logit = LOG_AUDIO_DECODE && input_code_pressed(KEYCODE_L);
617   int logit = LOG_AUDIO_DECODE && input_code_pressed(device->machine, KEYCODE_L);
618618   attotime time_per_sample = ATTOTIME_IN_HZ(samplerate);
619619   attotime curtime = laserdisc_last_time;
620620   int cursamp;
src/mame/drivers/goldnpkr.c
r5613r5614
2020    * Good Luck.                                198?, Unknown.
2121    * Royale (set 1).                           198?, Unknown.
2222    * Royale (set 2).                           198?, Unknown.
23    * Witch Card (german).                      1991, Video Klein.
23    * Witch Card (Video Klein).                 1991, Video Klein.
2424    * Witch Card (spanish, witch game, set 1).  1991, Unknown.
2525    * Witch Card (spanish, witch game, set 2).  1991, Unknown.
2626    * Witch Card (english, no witch game).      1991, Unknown.
27    * Witch Card (german, set 1).               1994, Proma.
28    * Witch Card (german, set 2).               1994, Unknown.
29    * Witch Card (english, witch game, lamps).  1985, PlayMan.
2730    * Super Loco 93 (spanish, set 1).           1993, Unknown.
2831    * Super Loco 93 (spanish, set 2).           1993, Unknown.
2932    * Maverik.                                  198?, Unknown.
r5613r5614
578581    - Added new games: Maverik, Brasil 89 & Poker'91.
579582    - Reworked the sets parent-clone relationship (still in progress).
580583
584
581585    [2008-12-26]
582586
583587    - Correctly setup the MC6845 device for all systems.
r5613r5614
588592      the 50/60 Hz. DIP switch connection patched.
589593
590594
595    [2009-09-05]
596
597    - Added 2 new Witch Card sets.
598    - Reworked inputs for Witch Card (german set 1).
599    - Created new inputs for Witch Card (english, witch game, lamps).
600    - Added and connected lamps for both sets.
601    - Added minimal bet and 50/60 Hz. switches to both sets.
602    - Added DIP switches info for Witch Card (german, set 2).
603
604
591605    TODO:
592606
593607    - Missing PIA connections.
r5613r5614
14841498   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14851499INPUT_PORTS_END
14861500
1501static INPUT_PORTS_START( witchcdd )
1502   /* Multiplexed - 4x5bits */
1503   PORT_INCLUDE( witchcrd )
1504
1505   PORT_MODIFY("IN0-1")
1506   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_IMPULSE(3) PORT_NAME("Manual Collect") PORT_CODE(KEYCODE_Q)
1507   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_W)
1508   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN0-1-6")
1509   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("IN0-1-7")
1510   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("IN0-1-8")
1511
1512   PORT_MODIFY("IN0-2")
1513   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("IN0-2-6")
1514   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("IN0-2-7")
1515   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("IN0-2-8")
1516
1517   PORT_MODIFY("IN0-3")
1518   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_F2)
1519   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("D-31") PORT_CODE(KEYCODE_E)
1520   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("Note In")
1521   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(3) PORT_NAME("Coin In")
1522   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) PORT_NAME("IN0-3-5")
1523   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) PORT_NAME("IN0-3-6")
1524   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) PORT_NAME("IN0-3-7")
1525   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("IN0-3-8") //IPT_UNKNOWN )
1526
1527   PORT_MODIFY("SW1")
1528   /* only bits 4-7 are connected here and were routed to SW1 1-4 */
1529   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
1530   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
1531   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
1532   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
1533   /* even when the following one is forced to OFF,
1534    turned ON behaves like "Jacks and Better" */
1535   PORT_DIPNAME( 0x10, 0x10, "SW 1 (always to OFF)")
1536   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1537   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1538   PORT_DIPNAME( 0x20, 0x00, "50hz/60hz" )
1539   PORT_DIPSETTING(    0x20, "50hz" )
1540   PORT_DIPSETTING(    0x00, "60hz" )
1541   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1542   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1543   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1544   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1545   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1546   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1547
1548   PORT_MODIFY("SW2")
1549   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1550   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1551   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1552   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1553   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1554   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1555   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1556   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1557   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1558   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1559   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1560   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1561   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1562   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1563   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1564   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1565   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1566   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1567   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1568   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1569   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1570   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1571   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1572   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1573INPUT_PORTS_END
1574
1575static INPUT_PORTS_START( witchcde )
1576   /* Multiplexed - 4x5bits */
1577   PORT_INCLUDE( witchcrd )
1578
1579   PORT_MODIFY("IN0-1")
1580   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_IMPULSE(3) PORT_NAME("Manual Collect") PORT_CODE(KEYCODE_Q)
1581   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_W)
1582   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN0-1-6")
1583   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("IN0-1-7")
1584   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("IN0-1-8")
1585
1586   PORT_MODIFY("IN0-2")
1587   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("IN0-2-6")
1588   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("IN0-2-7")
1589   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("IN0-2-8")
1590
1591   PORT_MODIFY("IN0-3")
1592   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_F2)
1593   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("D-31") PORT_CODE(KEYCODE_E)
1594   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("Note In")
1595   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(3) PORT_NAME("Coin In")
1596   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) PORT_NAME("IN0-3-5")
1597   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) PORT_NAME("IN0-3-6")
1598   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) PORT_NAME("IN0-3-7")
1599   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("IN0-3-8") //IPT_UNKNOWN )
1600
1601   PORT_MODIFY("SW1")
1602   /* only bits 4-7 are connected here and were routed to SW1 1-4 */
1603   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
1604   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
1605   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
1606   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
1607   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1608   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1609   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1610   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1611   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1612   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1613   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1614   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1615   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1616   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1617   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1618   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1619
1620/*  DIP Switches (as shown in the epoxy block)
1621
1622    Schalter      1   2   3   4   5   6   7   8
1623    --------------------------------------------
1624    Bet >  10    OFF OFF
1625    Bet >  20    ON  OFF
1626    Bet >  50    OFF ON
1627    Bet > 100    ON  ON
1628    --------------------------------------------
1629    Jolli-Witch          OFF
1630    Witch-Card           ON
1631    --------------------------------------------
1632     6 Taster                ON
1633    12 Taster                OFF
1634    --------------------------------------------
1635    Hohes Paar                   ON
1636    2 Paar                       OFF
1637    --------------------------------------------
1638    1 DM - 1 PKT                     OFF OFF
1639    1 DM - 10 PKT                    OFF ON
1640    --------------------------------------------
1641    RF                                       ON
1642    RF NO                                    OFF
1643    --------------------------------------------
1644*/
1645   PORT_MODIFY("SW2")
1646   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1647   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1648   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1649   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1650   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1651   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1652   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1653   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1654   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1655   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1656   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1657   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1658   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1659   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1660   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1661   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1662   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1663   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1664   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1665   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1666   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1667   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1668   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1669   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1670INPUT_PORTS_END
1671
1672static INPUT_PORTS_START( witchcdf )
1673   /* Multiplexed - 4x5bits */
1674   PORT_INCLUDE( witchcrd )
1675
1676   PORT_MODIFY("IN0-1")
1677   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_IMPULSE(3) PORT_NAME("Manual Collect") PORT_CODE(KEYCODE_Q)
1678   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_W)
1679   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN0-1-6")
1680   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("IN0-1-7")
1681   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("IN0-1-8")
1682
1683   PORT_MODIFY("IN0-2")
1684   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("IN0-2-6")
1685   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("IN0-2-7")
1686   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("IN0-2-8")
1687
1688   PORT_MODIFY("IN0-3")
1689   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_F2)
1690   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("D-31") PORT_CODE(KEYCODE_E)
1691   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("Note In")
1692   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(3) PORT_NAME("Coin In")
1693   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) PORT_NAME("IN0-3-5")
1694   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) PORT_NAME("IN0-3-6")
1695   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) PORT_NAME("IN0-3-7")
1696   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("IN0-3-8") //IPT_UNKNOWN )
1697
1698   PORT_MODIFY("SW1")
1699   /* only bits 4-7 are connected here and were routed to SW1 1-4 */
1700   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
1701   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
1702   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
1703   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
1704   PORT_DIPNAME( 0x10, 0x00, "Minimal Winning Hand" )
1705   PORT_DIPSETTING(    0x10, "Double Pair" )
1706   PORT_DIPSETTING(    0x00, "Jacks or Better" )
1707   PORT_DIPNAME( 0x20, 0x00, "50hz/60hz" )
1708   PORT_DIPSETTING(    0x20, "50hz" )
1709   PORT_DIPSETTING(    0x00, "60hz" )
1710   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1711   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1712   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1713   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1714   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1715   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1716
1717   PORT_MODIFY("SW2")
1718   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1719   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1720   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1721   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1722   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1723   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1724   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1725   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1726   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1727   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1728   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1729   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1730   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1731   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1732   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1733   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1734   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1735   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1736   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1737   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1738   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1739   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1740   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1741   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1742INPUT_PORTS_END
1743
14871744static INPUT_PORTS_START( sloco93 )
14881745   /* Multiplexed - 4x5bits */
14891746   PORT_INCLUDE( witchcda )
r5613r5614
22942551   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
22952552ROM_END
22962553
2297ROM_START( witchcrd )   /* Video Klein original with epoxy block module */
2554/*  Witch Card (Video Klein)
2555    Video Klein original with epoxy block module
2556*/
2557   ROM_START( witchcrd )
22982558   ROM_REGION( 0x10000, "maincpu", 0 )
22992559   ROM_LOAD( "epoxy_27128.bin",   0x4000, 0x4000, CRC(48186272) SHA1(d211bfa89404a292e6d0f0169ed11e1e74a361d9) )   /* epoxy block program ROM */
23002560
r5613r5614
23132573   ROM_LOAD( "epoxy_82s129.bin",   0x0100, 0x0100, CRC(f0c012b1) SHA1(5502977404172e8c5b9fbf305581a406668ad1d9) ) /* original epoxy block PROM */
23142574ROM_END
23152575
2576/*  Witch Card (spanish, set 1)
2577*/
23162578ROM_START( witchcda )
23172579   ROM_REGION( 0x10000, "maincpu", 0 )
23182580   ROM_LOAD( "w_card.256",   0x0000, 0x8000, CRC(63a471f8) SHA1(96a2140e2da0050e7865a6662f707cf024130832) )
r5613r5614
23302592   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
23312593ROM_END
23322594
2595/*  Witch Card (spanish, set 2)
2596*/
23332597ROM_START( witchcdb )
23342598   ROM_REGION( 0x10000, "maincpu", 0 )
23352599   ROM_LOAD( "w_card.128",   0x4000, 0x4000, CRC(11ecac96) SHA1(717709b31f3dfa09be321c14fbf0e95d492ad2f2) )
r5613r5614
23472611   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
23482612ROM_END
23492613
2614/*  Witch Card (english, no witch game)
2615*/
23502616ROM_START( witchcdc )
23512617   ROM_REGION( 0x10000, "maincpu", 0 )
23522618   ROM_LOAD( "wc_sbruj.256",   0x0000, 0x8000, CRC(5689ae41) SHA1(c7a624ec881204137489b147ce66cc9a9900650a) )
r5613r5614
23642630   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
23652631ROM_END
23662632
2367ROM_START( witchcdd )
2633/*  Witch Card (german, set 1)
2634
2635    TV GAME ELEKTRONIK 1994
2636           PROVA
2637    CASINOVERSION WC3050
2638*/
2639   ROM_START( witchcdd )
23682640   ROM_REGION( 0x10000, "maincpu", 0 )
23692641   ROM_LOAD( "12a.bin",   0x0000, 0x8000, CRC(a5c1186a) SHA1(b6c662bf489fbcccc3063ce55c957e630ba96ccb) )
23702642
23712643   ROM_REGION( 0x6000, "gfx1", 0 )
2372   ROM_FILL(            0x0000, 0x4000, 0 ) /* filling the R-G bitplanes */
2644   ROM_FILL(               0x0000, 0x4000, 0 ) /* filling the R-G bitplanes */
23732645   ROM_LOAD( "ce-3-tvg.bin",   0x4000, 0x2000, CRC(54b51497) SHA1(8c3a74377fde8c7c5a6b277a9c1e717e6bdd98f8) )    /* text layer */
23742646
23752647   ROM_REGION( 0x6000, "gfx2", 0 )
r5613r5614
23782650   ROM_COPY( "gfx1",   0x4800, 0x4000, 0x0800 )    /* cards deck gfx, bitplane3. found in the 2nd quarter of the text layer rom */
23792651
23802652   ROM_REGION( 0x0100, "proms", 0 )
2381   ROM_LOAD( "tbp24s10n.7d",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) )
2653   ROM_LOAD( "tbp24s10n.7d",   0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) )
23822654ROM_END
23832655
2656/*  Witch Card (german, set 2)
2657    Epoxy CPU box.
2658
2659    Code jumps into a zero-filled zone.
2660    Addressing seems to be scrambled in some way
2661    maybe through a PLD.
2662*/
2663ROM_START( witchcde )
2664   ROM_REGION( 0x10000, "maincpu", 0 )   /* inside epoxy block with the CPU */
2665   ROM_LOAD( "27c256.bin",   0x0000, 0x8000, CRC(14f05e3b) SHA1(83578f6a82b0974dd0325903926b2fd0d8e5c236) )
2666
2667   ROM_REGION( 0x6000, "gfx1", 0 )
2668   ROM_FILL(               0x0000, 0x4000, 0 ) /* filling the R-G bitplanes */
2669   ROM_LOAD( "iii.5a",   0x4000, 0x2000, CRC(5ea338da) SHA1(5e55e17689541ffb9c23e45f689dda98a79bf789) )    /* text layer */
2670
2671   ROM_REGION( 0x6000, "gfx2", 0 )
2672   ROM_LOAD( "i.2a",   0x0000, 0x2000, CRC(d467f6e2) SHA1(6aaf4cdfb76f5efeeee45635fea120711483648e) )    /* cards deck gfx, bitplane1 */
2673   ROM_LOAD( "ii.4a",   0x2000, 0x2000, CRC(044dfac0) SHA1(721f8f57e05ddcbdb838d12fd3e81a45346ee6db) )    /* cards deck gfx, bitplane2 */
2674   ROM_COPY( "gfx1",   0x5000, 0x4000, 0x1000 )    /* cards deck gfx, bitplane3. found in the 2nd quarter of the text layer rom */
2675
2676   ROM_REGION( 0x0100, "proms", 0 )
2677   ROM_LOAD( "82s129.7d",   0x0000, 0x0100, BAD_DUMP CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) )
2678ROM_END
2679
2680/*  Witch Card (english, witch game, lights)
2681    PCB by PM. Hybrid hardware.
2682
2683    Copyright 1983/84/85
2684    W.BECK ELEKTRONIK
2685*/
2686ROM_START( witchcdf )
2687   ROM_REGION( 0x10000, "maincpu", 0 )
2688   ROM_LOAD( "$25.bin",   0x5000, 0x1000, CRC(afd6cb4a) SHA1(4c769e1c724bada5875e028781086c32967953a1) )
2689   ROM_LOAD( "$26.bin",   0x6000, 0x1000, CRC(ad11960c) SHA1(2b562cfe9401e21c9dcd90307165e2c2d1acfc5b) )
2690   ROM_LOAD( "$27.bin",   0x7000, 0x1000, CRC(e6f9c973) SHA1(f209d13d1565160bc2c05c6c4fce73d14a9a56ab) )
2691
2692   ROM_REGION( 0x3000, "gfx1", 0 )
2693   ROM_FILL(            0x0000, 0x2000, 0 ) /* filling the R-G bitplanes */
2694   ROM_LOAD( "$14.bin",   0x2000, 0x1000, CRC(19b68bec) SHA1(b8ef17ba5545e2f104cd2783e5f1c97c400fcbbc) )    /* text layer */
2695
2696   ROM_REGION( 0x3000, "gfx2", 0 )
2697   ROM_LOAD( "11.bin",   0x0000, 0x1000, CRC(b5a1f5a3) SHA1(a34aaaab5443c6962177a5dd35002bd09d0d2772) )    /* cards deck gfx, bitplane1 */
2698   ROM_LOAD( "12.bin",   0x1000, 0x1000, CRC(40e426af) SHA1(7e7cb30dafc96bcb87a05d3e0ef5c2d426ed6a74) )    /* cards deck gfx, bitplane2 */
2699   ROM_LOAD( "13.bin",   0x2000, 0x1000, CRC(232374f3) SHA1(b75907edbf769b8c46fb1ebdb301c325c556e6c2) )    /* cards deck gfx, bitplane3 */
2700
2701   ROM_REGION( 0x0100, "proms", 0 )
2702   ROM_LOAD( "wc_bprom.bin",   0x0000, 0x0100, BAD_DUMP CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) )
2703ROM_END
2704
23842705ROM_START( sloco93 )
23852706   ROM_REGION( 0x10000, "maincpu", 0 )
23862707   ROM_LOAD( "locoloco.128",   0x4000, 0x4000, CRC(f626a770) SHA1(afbd33b3f65b8a781c716a3d6e5447aa817d856c) )
r5613r5614
29153236GAMEL( 1981, goldnpkb, goldnpkr, goldnpkr, goldnpkr, 0,        ROT0,   "Bonanza Enterprises, Ltd",  "Golden Poker Double Up (Mini Boy)",       0,                layout_goldnpkr )
29163237GAMEL( 1981, pmpoker,  0,        goldnpkr, pmpoker,  0,        ROT0,   "PlayMan",                   "PlayMan Poker (german)",                  0,                layout_pmpoker  )
29173238GAMEL( 198?, pottnpkr, 0,        pottnpkr, pottnpkr, 0,        ROT0,   "bootleg",                   "Jack Potten's Poker (set 1)",             0,                layout_goldnpkr )
2918GAMEL( 198?, potnpkra, pottnpkr, pottnpkr, potnpkra, 0,        ROT0,   "bootleg",                   "Jack Potten's Poker (set 2) (Coinmaster hardware)", 0,      layout_goldnpkr )
3239GAMEL( 198?, potnpkra, pottnpkr, pottnpkr, potnpkra, 0,        ROT0,   "bootleg",                   "Jack Potten's Poker (set 2)",             0,                layout_goldnpkr )
29193240GAMEL( 198?, potnpkrb, pottnpkr, pottnpkr, pottnpkr, 0,        ROT0,   "bootleg",                   "Jack Potten's Poker (set 3)",             0,                layout_goldnpkr )
29203241GAMEL( 198?, potnpkrc, pottnpkr, pottnpkr, potnpkrc, 0,        ROT0,   "bootleg",                   "Jack Potten's Poker (set 4)",             0,                layout_goldnpkr )
29213242GAMEL( 198?, potnpkrd, pottnpkr, pottnpkr, potnpkrc, 0,        ROT0,   "bootleg",                   "Jack Potten's Poker (set 5)",             0,                layout_goldnpkr )
r5613r5614
29273248GAME(  1991, witchcda, witchcrd, witchcrd, witchcda, 0,        ROT0,   "<unknown>",                 "Witch Card (spanish, witch game, set 1)", 0 )
29283249GAME(  1991, witchcdb, witchcrd, witchcrd, witchcda, 0,        ROT0,   "<unknown>",                 "Witch Card (spanish, witch game, set 2)", 0 )
29293250GAME(  1991, witchcdc, witchcrd, witchcrd, witchcdc, 0,        ROT0,   "<unknown>",                 "Witch Card (english, no witch game)",     0 )
2930GAME(  1991, witchcdd, witchcrd, witchcrd, witchcrd, 0,        ROT0,   "<unknown>",                 "Witch Card (german?)",                    0 )
3251GAMEL( 1994, witchcdd, witchcrd, witchcrd, witchcdd, 0,        ROT0,   "Proma",                     "Witch Card (german, set 1)",              0,                layout_goldnpkr )
3252GAME(  1994, witchcde, witchcrd, witchcrd, witchcde, 0,        ROT0,   "<unknown>",                 "Witch Card (german, set 2)",              GAME_NOT_WORKING )
3253GAMEL( 1985, witchcdf, witchcrd, witchcrd, witchcdf, 0,        ROT0,   "PlayMan",                   "Witch Card (english, witch game, lamps)", 0,                layout_goldnpkr )
29313254GAME(  1993, sloco93,  0,        witchcrd, sloco93,  0,        ROT0,   "<unknown>",                 "Super Loco 93 (spanish, set 1)",          0 )
29323255GAME(  1993, sloco93a, sloco93,  witchcrd, sloco93,  0,        ROT0,   "<unknown>",                 "Super Loco 93 (spanish, set 2)",          0 )
29333256GAME(  198?, maverik,  0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                 "Maverik",                                 0 )
src/mame/drivers/thepit.c
r5613r5614
160160
161161static WRITE8_HANDLER( thepit_sound_enable_w )
162162{
163   sound_global_enable(data);
163   sound_global_enable(space->machine, data);
164164}
165165
166166
src/mame/drivers/trvmadns.c
r5613r5614
104104         if(data != old_data)
105105         {
106106            old_data = data;
107            printf("port80 = %02X\n",data);
107            logerror("port80 = %02X\n",data);
108108            //logerror("port80 = %02X\n",data);
109109         }
110110
r5613r5614
134134
135135      //address |= (data & 0x08) ? 0x8000 : 0;
136136
137//      printf("add = %X\n",address);
137//      logerror("add = %X\n",address);
138138
139139      memory_set_bankptr(space->machine, 1, &rom[address]);
140140   }
r5613r5614
166166{
167167/*  static int old = -1;
168168    if(data!=old)
169        printf("w2 = %02X\n",old=data);
169        logerror("w2 = %02X\n",old=data);
170170*/
171171}
172172
r5613r5614
174174{
175175/*  static int old = -1;
176176    if(data!=old)
177        printf("w3 = %02X\n",old=data);
177        logerror("w3 = %02X\n",old=data);
178178*/
179179}
180180
r5613r5614
187187         cputag_set_input_line(space->machine, "maincpu", 0, HOLD_LINE);
188188      }
189189//      else
190//          printf("%x \n", cpu_get_previouspc(space->cpu));
190//          logerror("%x \n", cpu_get_previouspc(space->cpu));
191191
192192   }
193193
src/mame/drivers/bingoc.c
r5613r5614
6161{
6262   static UINT8 x;
6363
64   if(input_code_pressed_once(KEYCODE_Z))
64   if(input_code_pressed_once(space->machine, KEYCODE_Z))
6565      x++;
6666
67   if(input_code_pressed_once(KEYCODE_X))
67   if(input_code_pressed_once(space->machine, KEYCODE_X))
6868      x--;
6969
70   if(input_code_pressed_once(KEYCODE_A))
70   if(input_code_pressed_once(space->machine, KEYCODE_A))
7171      return 0xff;
7272
7373   popmessage("%02x",x);
src/mame/drivers/tutankhm.c
r5613r5614
8383
8484static WRITE8_HANDLER( sound_mute_w )
8585{
86   sound_global_enable(~data & 1);
86   sound_global_enable(space->machine, ~data & 1);
8787}
8888
8989
src/mame/drivers/midyunit.c
r5613r5614
13511351   ROM_LOAD( "u26",  0x6e0000, 0x10000, CRC(cb19f784) SHA1(1e4d85603c940e247fdc45f0366dfb484285e588) )
13521352ROM_END
13531353
1354ROM_START( narc2 )
1355   ROM_REGION( 0x90000, "narc1cpu", 0 )   /* sound CPU */
1356   ROM_LOAD( "narcrev2.u4", 0x50000, 0x10000, CRC(450a591a) SHA1(bbda8061262738e5866f2707f69483a0a51d2910) )
1357   ROM_RELOAD(              0x60000, 0x10000 )
1358   ROM_LOAD( "narcrev2.u5", 0x70000, 0x10000, CRC(e551e5e3) SHA1(c8b4f53dbd4c534abb77d4dc07c4d12653b79894) )
1359   ROM_RELOAD(              0x80000, 0x10000 )
13541360
1361   ROM_REGION( 0x90000, "narc2cpu", 0 )   /* slave sound CPU */
1362   ROM_LOAD( "narcrev2.u35", 0x10000, 0x10000, CRC(81295892) SHA1(159664e5ee03c88d6e940e70e87e2150dc5b8b25) )
1363   ROM_RELOAD(               0x20000, 0x10000 )
1364   ROM_LOAD( "narcrev2.u36", 0x30000, 0x10000, CRC(16cdbb13) SHA1(2dfd961a5d909c1804f4fda34de33ee2664c4bc6) )
1365   ROM_RELOAD(               0x40000, 0x10000 )
1366   ROM_LOAD( "narcrev2.u37", 0x50000, 0x10000, CRC(29dbeffd) SHA1(4cbdc619db34f9c552de1ed3d034f8c079987e03) )
1367   ROM_RELOAD(               0x60000, 0x10000 )
1368   ROM_LOAD( "narcrev2.u38", 0x70000, 0x10000, CRC(09b03b80) SHA1(a45782d29a426fac38299b56af0815e844e35ae4) )
1369   ROM_RELOAD(               0x80000, 0x10000 )
1370
1371   ROM_REGION16_LE( 0x100000, "user1", 0 )   /* 34010 code */
1372   ROM_LOAD16_BYTE( "narcrev2.u78",  0x00000, 0x10000, CRC(150c2dc4) SHA1(c7e3f90f5fed08f2a6951779166cbc6d2dbcd380) )
1373   ROM_RELOAD(                       0x20000, 0x10000 )
1374   ROM_LOAD16_BYTE( "narcrev2.u60",  0x00001, 0x10000, CRC(9720ddea) SHA1(27f0182799f14c1c7c8dc48f7cf4160768b24662) )
1375   ROM_RELOAD(                       0x20001, 0x10000 )
1376   ROM_LOAD16_BYTE( "narcrev2.u77",  0x40000, 0x10000, CRC(75ba4c74) SHA1(8713c22d30107d01612571d3a42aa9edda795fb0) )
1377   ROM_RELOAD(                       0x60000, 0x10000 )
1378   ROM_LOAD16_BYTE( "narcrev2.u59",  0x40001, 0x10000, CRC(f7c6c104) SHA1(1b57a95f2232a9433831b99b689802ef185ff203) )
1379   ROM_RELOAD(                       0x60001, 0x10000 )
1380   ROM_LOAD16_BYTE( "narcrev2.u42",  0x80000, 0x10000, CRC(3db20bb8) SHA1(688844bd573e5d0c5225fccbc12ae91b88b95bd8) )
1381   ROM_RELOAD(                       0xa0000, 0x10000 )
1382   ROM_LOAD16_BYTE( "narcrev2.u24",  0x80001, 0x10000, CRC(91bae451) SHA1(549ad5938ae9ae4e320d0c5f8f30f23f5de2c802) )
1383   ROM_RELOAD(                       0xa0001, 0x10000 )
1384   ROM_LOAD16_BYTE( "narcrev2.u41",  0xc0000, 0x10000, CRC(b0d463e1) SHA1(f6f1a9088aab838f3efe21f71616374ffec35a05) )
1385   ROM_RELOAD(                       0xe0000, 0x10000 )
1386   ROM_LOAD16_BYTE( "narcrev2.u23",  0xc0001, 0x10000, CRC(a9eb4825) SHA1(9c0b98451f1a240a3cb7ed4c1aab6c7c4abd27e6) )
1387   ROM_RELOAD(                       0xe0001, 0x10000 )
1388
1389   ROM_REGION( 0x800000, "gfx1", 0 )
1390   ROM_LOAD( "u94",  0x000000, 0x10000, CRC(ca3194e4) SHA1(d6aa6a09e4353a1dddd502abf85acf48e6e94cef) )
1391   ROM_LOAD( "u93",  0x010000, 0x10000, CRC(0ed7f7f5) SHA1(913d0dc81531adc6a7e6ffabfe681150aa4638a3) )
1392   ROM_LOAD( "u92",  0x020000, 0x10000, CRC(40d2fc66) SHA1(95b8d90e6abe336ad05dc3746d02b38823d2b8cd) )
1393   ROM_LOAD( "u91",  0x030000, 0x10000, CRC(f39325e0) SHA1(c1179825c76ed2934dfeff263a9296c2c1a5abe4) )
1394   ROM_LOAD( "u90",  0x040000, 0x10000, CRC(0132aefa) SHA1(9bf11ebc06f1069ea056427750902c204facbd3d) )
1395   ROM_LOAD( "u89",  0x050000, 0x10000, CRC(f7260c9e) SHA1(5a3fd88c7c0fa01ec2eb6fdef380ccee9d7da3a8) )
1396   ROM_LOAD( "u88",  0x060000, 0x10000, CRC(edc19f42) SHA1(b7121b3df743e5744ae72de2216b679fe71a2049) )
1397   ROM_LOAD( "u87",  0x070000, 0x10000, CRC(d9b42ff9) SHA1(cab05a5f8aadff010fba1107eb2000cc128063ff) )
1398   ROM_LOAD( "u86",  0x080000, 0x10000, CRC(af7daad3) SHA1(e2635a0acd6a238159ef91c1c3c9dfe8de8ae18f) )
1399   ROM_LOAD( "u85",  0x090000, 0x10000, CRC(095fae6b) SHA1(94f1df799142990a559e54cd949d9723481806b1) )
1400   ROM_LOAD( "u84",  0x0a0000, 0x10000, CRC(3fdf2057) SHA1(25ac6263a4eb962d90a305572fb95b75cb9f4138) )
1401   ROM_LOAD( "u83",  0x0b0000, 0x10000, CRC(f2d27c9f) SHA1(de30c7e0191adf62b11b2f2fbdf80687e653de12) )
1402   ROM_LOAD( "u82",  0x0c0000, 0x10000, CRC(962ce47c) SHA1(ea32f7f58a5ec1d941b372db5378d14fd850a2a7) )
1403   ROM_LOAD( "u81",  0x0d0000, 0x10000, CRC(00fe59ec) SHA1(85efd623b9cd75b249e19b2e97440a47718da728) )
1404   ROM_LOAD( "u80",  0x0e0000, 0x10000, CRC(147ba8e9) SHA1(1065b57082e0198025fe6f0bb3548f37c6a715e4) )
1405
1406   ROM_LOAD( "u76",  0x200000, 0x10000, CRC(1cd897f4) SHA1(80414c3718ac6719abcca83f483302fc16fcfef3) )
1407   ROM_LOAD( "u75",  0x210000, 0x10000, CRC(78abfa01) SHA1(1523f537491b901f2d987d4443077b92e24b969d) )
1408   ROM_LOAD( "u74",  0x220000, 0x10000, CRC(66d2a234) SHA1(290b3051fa9d35e24a9d00fcc2b72d2751f3e7f1) )
1409   ROM_LOAD( "u73",  0x230000, 0x10000, CRC(efa5cd4e) SHA1(7aca6058d644a025c6799d55ffa082ba8eb5d76f) )
1410   ROM_LOAD( "u72",  0x240000, 0x10000, CRC(70638eb5) SHA1(fbafb354fca7c3c402be5073fa03060de569f536) )
1411   ROM_LOAD( "u71",  0x250000, 0x10000, CRC(61226883) SHA1(09a366df0603cc0afc8c6c5547ec6ae3a02724b2) )
1412   ROM_LOAD( "u70",  0x260000, 0x10000, CRC(c808849f) SHA1(bd3f69c4641331738e415d6d72fafe0eeeb2e56b) )
1413   ROM_LOAD( "u69",  0x270000, 0x10000, CRC(e7f9c34f) SHA1(f65aed012f1d575a63690222b8c8f2c56bc196c3) )
1414   ROM_LOAD( "u68",  0x280000, 0x10000, CRC(88a634d5) SHA1(9ddf86ca8cd91965348bc311cc722151f831db21) )
1415   ROM_LOAD( "u67",  0x290000, 0x10000, CRC(4ab8b69e) SHA1(4320407c78864edc7876ad3604405414a3e7762d) )
1416   ROM_LOAD( "u66",  0x2a0000, 0x10000, CRC(e1da4b25) SHA1(c81ed1ffc0a4bf64e794a1313559453f9455c312) )
1417   ROM_LOAD( "u65",  0x2b0000, 0x10000, CRC(6df0d125) SHA1(37392cc917e73cfa09970fd24503b45ced399976) )
1418   ROM_LOAD( "u64",  0x2c0000, 0x10000, CRC(abab1b16) SHA1(2913a94e1fcf8df52e29d0fb6e373aa64d23c019) )
1419   ROM_LOAD( "u63",  0x2d0000, 0x10000, CRC(80602f31) SHA1(f1c5c4476dbf80382f33c0776c103cff9bed8346) )
1420   ROM_LOAD( "u62",  0x2e0000, 0x10000, CRC(c2a476d1) SHA1(ffde1784548050d87f1404aaca3689417e6f7a81) )
1421
1422   ROM_LOAD( "u58",  0x400000, 0x10000, CRC(8a7501e3) SHA1(dcd87c464fcb88180cc1c24ec82586440a197a5c) )
1423   ROM_LOAD( "u57",  0x410000, 0x10000, CRC(a504735f) SHA1(2afe58e576eea2e0326c6b42adb621358a270881) )
1424   ROM_LOAD( "u56",  0x420000, 0x10000, CRC(55f8cca7) SHA1(0b0a0d50be4401e4ac4e75d8040f18540f9ddc61) )
1425   ROM_LOAD( "u55",  0x430000, 0x10000, CRC(d3c932c1) SHA1(1a7ffc04e796ba355506bf9037c21aef18fe01a3) )
1426   ROM_LOAD( "u54",  0x440000, 0x10000, CRC(c7f4134b) SHA1(aea523e17f95c27d1f2c1f69884f626d96c8cb3b) )
1427   ROM_LOAD( "u53",  0x450000, 0x10000, CRC(6be4da56) SHA1(35a93a259be04a644ca70df4922f6915274c3932) )
1428   ROM_LOAD( "u52",  0x460000, 0x10000, CRC(1ea36a4a) SHA1(78e5437d46c1ecff5e221bc301925b10f00c5269) )
1429   ROM_LOAD( "u51",  0x470000, 0x10000, CRC(9d4b0324) SHA1(80fb38a9ac81a0383112df680b9755d7cccbd50b) )
1430   ROM_LOAD( "u50",  0x480000, 0x10000, CRC(6f9f0c26) SHA1(be77d99fb37fa31c3824725b28ee74206c584b90) )
1431   ROM_LOAD( "u49",  0x490000, 0x10000, CRC(80386fce) SHA1(f182ed0f1a3753dedc56cb120cb8d10e1556e966) )
1432   ROM_LOAD( "u48",  0x4a0000, 0x10000, CRC(05c16185) SHA1(429910c5b1f1fe47fdec6cfcba765ee9f10749f0) )
1433   ROM_LOAD( "u47",  0x4b0000, 0x10000, CRC(4c0151f1) SHA1(b526066fc594f3ec83bb4866986e3b73cdae3992) )
1434   ROM_LOAD( "u46",  0x4c0000, 0x10000, CRC(5670bfcb) SHA1(b20829b715c6421894c10c02aebb08d22b5109c9) )
1435   ROM_LOAD( "u45",  0x4d0000, 0x10000, CRC(27f10d98) SHA1(b027ade2b4a52977d9c40c9549b9067d37fab41c) )
1436   ROM_LOAD( "u44",  0x4e0000, 0x10000, CRC(93b8eaa4) SHA1(b786f3286c5443cf08e556e9fb030b3444288f3c) )
1437
1438   ROM_LOAD( "u40",  0x600000, 0x10000, CRC(7fcaebc7) SHA1(b951d63c072d693f7dfc7e362a12513eb9bd6bab) )
1439   ROM_LOAD( "u39",  0x610000, 0x10000, CRC(7db5cf52) SHA1(478aefc1126493378d22c857646e2fce221c7d21) )
1440   ROM_LOAD( "u38",  0x620000, 0x10000, CRC(3f9f3ef7) SHA1(5315e8c372bb63d95f814d8eafe0f41e4d95ba1a) )
1441   ROM_LOAD( "u37",  0x630000, 0x10000, CRC(ed81826c) SHA1(afe1c0fc692a802279c1f7f31143d33028d35ce4) )
1442   ROM_LOAD( "u36",  0x640000, 0x10000, CRC(e5d855c0) SHA1(3fa0f765238ad2a27c0c65805bf56ebfbe50bf05) )
1443   ROM_LOAD( "u35",  0x650000, 0x10000, CRC(3a7b1329) SHA1(e8b547a3b8f85cd13e12cfe0bf3949acc1486e6b) )
1444   ROM_LOAD( "u34",  0x660000, 0x10000, CRC(fe982b0e) SHA1(a03e7e348186339fd93ce119f65e8f0ea7b7bb7a) )
1445   ROM_LOAD( "u33",  0x670000, 0x10000, CRC(6bc7eb0f) SHA1(6964ef63d0daf1bc7fa9585567659cfc198b6cc3) )
1446   ROM_LOAD( "u32",  0x680000, 0x10000, CRC(5875a6d3) SHA1(ae64aa786239be39c3c99bbe019bdc91003c1691) )
1447   ROM_LOAD( "u31",  0x690000, 0x10000, CRC(2fa4b8e5) SHA1(8e4e4abd60d20e0ef955ac4b1f300cfd157e50ca) )
1448   ROM_LOAD( "u30",  0x6a0000, 0x10000, CRC(7e4bb8ee) SHA1(7166bd56a569329e01ed0c03579a403d659a4a7b) )
1449   ROM_LOAD( "u29",  0x6b0000, 0x10000, CRC(45136fd9) SHA1(44388e16d02a8c55fed0dbbcd842c941fa4b11b1) )
1450   ROM_LOAD( "u28",  0x6c0000, 0x10000, CRC(d6cdac24) SHA1(d4bbe3a1be89be7d21769bfe476b50c05cd0c357) )
1451   ROM_LOAD( "u27",  0x6d0000, 0x10000, CRC(4d33bbec) SHA1(05a3bd66ff91c824e841ca3943585f6aa383c5c2) )
1452   ROM_LOAD( "u26",  0x6e0000, 0x10000, CRC(cb19f784) SHA1(1e4d85603c940e247fdc45f0366dfb484285e588) )
1453ROM_END
1454
1455
13551456ROM_START( trog )
13561457   ROM_REGION( 0x90000, "cvsdcpu", 0 )   /* sound CPU */
13571458   ROM_LOAD (   "trogu4.bin", 0x10000, 0x10000, CRC(759d0bf4) SHA1(c4c3fa51c43cf7fd241ac1f33d7d220aa9f9edb3) )
r5613r5614
21252226ROM_END
21262227
21272228
2229ROM_START( mkyturbo )
2230   ROM_REGION( 0x50000, "adpcm", 0 )   /* sound CPU */
2231   ROM_LOAD (  "mks-u3.rom", 0x10000, 0x40000, CRC(c615844c) SHA1(5732f9053a5f73b0cc3b0166d7dc4430829d5bc7) )
2232
2233   ROM_REGION( 0x200000, "oki", 0 )   /* ADPCM */
2234   ROM_LOAD ( "mks-u12.rom", 0x00000, 0x40000, CRC(258bd7f9) SHA1(463890b23f17350fb9b8a85897b0777c45bc2d54) )
2235   ROM_RELOAD(               0x40000, 0x40000 )
2236   ROM_LOAD ( "mks-u13.rom", 0x80000, 0x40000, CRC(7b7ec3b6) SHA1(6eec1b90d4a4855f34a7ebfbf93f3358d5627db4) )
2237   ROM_RELOAD(               0xc0000, 0x40000 )
2238
2239   /* A 'NIBBLE BOARD' daughtercard holding a GAL16V8A-2SP, 27C040 EPROM and a 9.8304MHz XTAL plugs into the U89 socket */
2240   ROM_REGION16_LE( 0x100000, "user1", 0 )   /* 34010 code */
2241   ROM_LOAD16_BYTE( "kombo-rom-u105.bin", 0x00000, 0x80000, CRC(80d5618c) SHA1(9bdfddbc70b61c94c1871abac1de153b8b728761) )
2242   ROM_LOAD16_BYTE(  "kombo-rom-u89.bin", 0x00001, 0x80000, CRC(450788e3) SHA1(34e4fa9c2ede66799301c3d1755df25edc432539) )
2243
2244   ROM_REGION( 0x800000, "gfx1", 0 )
2245   ROM_LOAD ( "mkg-u111.rom",  0x000000, 0x80000, CRC(d17096c4) SHA1(01ef390a372c9d94adf138f9543ebb88b89f4c38) )
2246   ROM_LOAD ( "mkg-u112.rom",  0x080000, 0x80000, CRC(993bc2e4) SHA1(7791edbec2b4b8971a3e790346dd7564ecf16d5c) )
2247   ROM_LOAD ( "mkg-u113.rom",  0x100000, 0x80000, CRC(6fb91ede) SHA1(a3735b49f93b08c44fbc97e2b5aad394628fbe90) )
2248   ROM_LOAD ( "mkg-u114.rom",  0x180000, 0x80000, CRC(ed1ff88a) SHA1(6b090b658ee6148af953bd0c9216f37162b6460f) )
2249
2250    ROM_LOAD (  "mkg-u95.rom",  0x200000, 0x80000, CRC(a002a155) SHA1(3cf7909e92bcd428063596fc5b9953e0000d6eca) )
2251    ROM_LOAD (  "mkg-u96.rom",  0x280000, 0x80000, CRC(dcee8492) SHA1(a912b74d3b26ebd1b1613cc631080f83ececeaf8) )
2252   ROM_LOAD (  "mkg-u97.rom",  0x300000, 0x80000, CRC(de88caef) SHA1(a7927b504dc56ca5c9048373977fe5743b0a3f0b) )
2253   ROM_LOAD (  "mkg-u98.rom",  0x380000, 0x80000, CRC(37eb01b4) SHA1(06092460bd137e08d0f8df8560942ed877d40e09) )
2254
2255   ROM_LOAD ( "mkg-u106.rom",  0x400000, 0x80000, CRC(45acaf21) SHA1(5edd36c55f4e5d3c74fb85171728ec0a58284b12) )
2256    ROM_LOAD ( "mkg-u107.rom",  0x480000, 0x80000, CRC(2a6c10a0) SHA1(cc90923c44f2961b945a0fd0f85ecc2ba04af2cb) )
2257     ROM_LOAD ( "mkg-u108.rom",  0x500000, 0x80000, CRC(23308979) SHA1(0b36788624a1cf0d3f4c895be5ba967b8dfcf85e) )
2258    ROM_LOAD ( "mkg-u109.rom",  0x580000, 0x80000, CRC(cafc47bb) SHA1(8610af6e52f7089ff4acd850c53ab8b4119e4445) )
2259ROM_END
2260
2261
21282262ROM_START( mkyawdim )
21292263   ROM_REGION( 0x10000, "audiocpu", 0 )   /* sound CPU */
21302264   ROM_LOAD (  "1.u67", 0x00000, 0x10000, CRC(b58d229e) SHA1(3ed14ef650dfa7f9d460611b19e9233a022cbea6) )
r5613r5614
23352469
23362470GAME( 1988, narc,     0,        zunit,                 narc,     narc,     ROT0, "Williams", "Narc (rev 7.00)", GAME_SUPPORTS_SAVE )
23372471GAME( 1988, narc3,    narc,     zunit,                 narc,     narc,     ROT0, "Williams", "Narc (rev 3.20)", GAME_SUPPORTS_SAVE )
2472GAME( 1988, narc2,    narc,     zunit,                 narc,     narc,     ROT0, "Williams", "Narc (rev 2.00)", GAME_SUPPORTS_SAVE )
23382473
23392474GAME( 1990, trog,     0,        yunit_cvsd_4bit_slow,  trog,     trog,     ROT0, "Midway",   "Trog (rev LA5 03/29/91)", GAME_SUPPORTS_SAVE )
23402475GAME( 1990, trog4,    trog,     yunit_cvsd_4bit_slow,  trog,     trog,     ROT0, "Midway",   "Trog (rev LA4 03/11/91)", GAME_SUPPORTS_SAVE )
r5613r5614
23682503GAME( 1992, mkla2,    mk,       yunit_adpcm_6bit_fast,   mkla2,    mkyunit,  ROT0, "Midway",   "Mortal Kombat (rev 2.0 08/18/92)", GAME_SUPPORTS_SAVE )
23692504GAME( 1992, mkla3,    mk,       yunit_adpcm_6bit_fast,   mkla4,    mkyunit,  ROT0, "Midway",   "Mortal Kombat (rev 3.0 08/31/92)", GAME_SUPPORTS_SAVE )
23702505GAME( 1992, mkla4,    mk,       yunit_adpcm_6bit_fast,   mkla4,    mkyunit,  ROT0, "Midway",   "Mortal Kombat (rev 4.0 09/28/92)", GAME_SUPPORTS_SAVE )
2506GAME( 1992, mkyturbo, mk,       yunit_adpcm_6bit_fast,   mkla4,    mkyturbo, ROT0, "hack",     "Mortal Kombat (Turbo 3.1 09/09/93, hack)", GAME_SUPPORTS_SAVE )
23712507GAME( 1992, mkyawdim, mk,       mkyawdim,                mkla4,    mkyawdim, ROT0, "bootleg",  "Mortal Kombat (Yawdim bootleg)", GAME_SUPPORTS_SAVE )
23722508GAME( 1992, totcarn,  0,        yunit_adpcm_6bit_fast,   totcarn,  totcarn,  ROT0, "Midway",   "Total Carnage (rev LA1 03/10/92)", GAME_SUPPORTS_SAVE )
23732509GAME( 1992, totcarnp, totcarn,  yunit_adpcm_6bit_fast,   totcarn,  totcarn,  ROT0, "Midway",   "Total Carnage (prototype, rev 1.0 01/25/92)", GAME_SUPPORTS_SAVE )
src/mame/drivers/bzone.c
r5613r5614
306306   AM_RANGE(0x1810, 0x1810) AM_DEVREAD("mathbox", mathbox_lo_r)
307307   AM_RANGE(0x1818, 0x1818) AM_DEVREAD("mathbox", mathbox_hi_r)
308308   AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokey_r, pokey_w)
309#if BZONE_DISCRETE
310309   AM_RANGE(0x1840, 0x1840) AM_DEVWRITE("discrete", bzone_sounds_w)
311#else
312   AM_RANGE(0x1840, 0x1840) AM_WRITE(bzone_sounds_w)
313#endif
314310   AM_RANGE(0x1860, 0x187f) AM_DEVWRITE("mathbox", mathbox_go_w)
315311   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("maincpu", 0x2000)
316312   AM_RANGE(0x3000, 0x7fff) AM_ROM
r5613r5614
407403   PORT_DIPSETTING(   0x60, "6 credits/4 coins" )\
408404     PORT_DIPSETTING(   0x80, "6 credits/5 coins" )
409405
406#define BZONEADJ \
407   PORT_START("R11") \
408   PORT_ADJUSTER( 50, "Engine Frequency" )
409
410410static INPUT_PORTS_START( bzone )
411411   BZONEIN0
412412   BZONEDSW0
r5613r5614
422422   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
423423   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
424424
425#if BZONE_DISCRETE
426   PORT_START("R11")
427   PORT_ADJUSTER( 50, "Engine Frequency" )
428#endif
425   BZONEADJ
429426INPUT_PORTS_END
430427
431428
r5613r5614
519516
520517   PORT_START("AN2")   /* analog 2 = shell firing range hack removed, now uses Z */
521518   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE
519
520   BZONEADJ
522521INPUT_PORTS_END
523522
524523
r5613r5614
578577   MDRV_IMPORT_FROM(bzone_base)
579578
580579   /* sound hardware */
581#if BZONE_DISCRETE
582580   MDRV_IMPORT_FROM(bzone_audio)
583#else
584   MDRV_SPEAKER_STANDARD_MONO("mono")
585581
586   MDRV_SOUND_ADD("pokey",  POKEY, MASTER_CLOCK / 8)
587   MDRV_SOUND_CONFIG(bzone_pokey_interface)
588   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
589
590   MDRV_SOUND_ADD("custom", BZONE, 0)
591   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
592#endif
593582MACHINE_DRIVER_END
594583
595584
596static MACHINE_DRIVER_START( bradley )
597585
598   /* basic machine hardware */
599   MDRV_IMPORT_FROM(bzone)
600
601   /* sound hardware */
602   MDRV_SOUND_REPLACE("pokey", POKEY,  BZONE_MASTER_CLOCK / 8)
603   MDRV_SOUND_CONFIG(bzone_pokey_interface)
604   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
605MACHINE_DRIVER_END
606
607
608586static MACHINE_DRIVER_START( redbaron )
609587
610588   /* basic machine hardware */
r5613r5614
842820GAMEL(1980, bzone,    0,     bzone,    bzone,    0,       ROT0, "Atari", "Battle Zone (set 1)", GAME_SUPPORTS_SAVE, layout_bzone )
843821GAMEL(1980, bzone2,   bzone, bzone,    bzone,    0,       ROT0, "Atari", "Battle Zone (set 2)", GAME_SUPPORTS_SAVE, layout_bzone )
844822GAMEL(1980, bzonec,   bzone, bzone,    bzone,    0,       ROT0, "Atari", "Battle Zone (cocktail)", GAME_SUPPORTS_SAVE|GAME_NO_COCKTAIL, layout_bzone )
845GAME( 1980, bradley,  0,     bradley,  bradley,  bradley, ROT0, "Atari", "Bradley Trainer", GAME_SUPPORTS_SAVE )
823GAME( 1980, bradley,  0,     bzone,    bradley,  bradley, ROT0, "Atari", "Bradley Trainer", GAME_SUPPORTS_SAVE )
846824GAMEL(1980, redbaron, 0,     redbaron, redbaron, 0,       ROT0, "Atari", "Red Baron", GAME_SUPPORTS_SAVE, layout_ho88ffff )
src/mame/drivers/midtunit.c
r5613r5614
711711ROM_END
712712
713713
714ROM_START( mkturbo )
714ROM_START( mktturbo )
715715   ROM_REGION( 0x50000, "adpcm", 0 )    /* sound CPU */
716716   ROM_LOAD( "mks-u3.rom", 0x10000, 0x40000, CRC(c615844c) SHA1(5732f9053a5f73b0cc3b0166d7dc4430829d5bc7) )
717717
r5613r5614
721721   ROM_LOAD( "mks-u13.rom", 0x80000, 0x40000, CRC(7b7ec3b6) SHA1(6eec1b90d4a4855f34a7ebfbf93f3358d5627db4) )
722722   ROM_RELOAD(              0xc0000, 0x40000 )
723723
724   /* A 'KOMBO BOARD' daughtercard holding a GAL16V8A-2SP, 27C040 EPROM and a 9.8304MHz XTAL plugs into the UG12 socket */
724   /* A 'NIBBLE BOARD' daughtercard holding a GAL16V8A-2SP, 27C040 EPROM and a 9.8304MHz XTAL plugs into the UG12 socket */
725725   ROM_REGION16_LE( 0x100000, "user1", 0 )   /* 34010 code */
726726   ROM_LOAD16_BYTE( "kombo-rom-uj-12.bin", 0x00000, 0x80000, CRC(7a441f2d) SHA1(3b731bcbd73721ea0cc20157ec5181d25922523c) )
727727   ROM_LOAD16_BYTE( "kombo-rom-ug-12.bin", 0x00001, 0x80000, CRC(45bed5a1) SHA1(dba2c21878925afdcaf61520c18ebefd5e9617db) )
r5613r5614
13121312
13131313GAME( 1992, mk,       0,       tunit_adpcm, mk,       mktunit,  ROT0, "Midway",   "Mortal Kombat (rev 5.0 T-Unit 03/19/93)", GAME_SUPPORTS_SAVE )
13141314GAME( 1992, mkr4,     mk,      tunit_adpcm, mk,       mktunit,  ROT0, "Midway",   "Mortal Kombat (rev 4.0 T-Unit 02/11/93)", GAME_SUPPORTS_SAVE )
1315GAME( 1992, mkturbo,  mk,      tunit_adpcm, mk,       mkturbo,  ROT0, "Midway",   "Mortal Kombat Turbo Ninja (rev 3.1 T-Unit 03/19/93, hack)", GAME_SUPPORTS_SAVE )
1315GAME( 1992, mktturbo,  mk,     tunit_adpcm, mk,       mkturbo,  ROT0, "hack",     "Mortal Kombat (Turbo Ninja T-Unit 03/19/93, hack)", GAME_SUPPORTS_SAVE )
13161316
13171317GAME( 1993, mk2,      0,       tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.1)", GAME_SUPPORTS_SAVE )
13181318GAME( 1993, mk2r32,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.2 (European))", GAME_SUPPORTS_SAVE )
src/mame/drivers/system1.c
r5613r5614
464464static WRITE8_DEVICE_HANDLER( sound_control_w )
465465{
466466   /* bit 0 = MUTE (inverted sense on System 2) */
467   sound_global_enable(~(data ^ mute_xor) & 1);
467   sound_global_enable(device->machine, ~(data ^ mute_xor) & 1);
468468
469469   /* bit 6 = feedback from sound board that read occurrred */
470470
src/mame/drivers/gaiden.c
r5613r5614
139139VIDEO_START( gaiden );
140140VIDEO_START( raiga );
141141VIDEO_START( drgnbowl );
142VIDEO_START( mastninj );
142143
143144VIDEO_UPDATE( gaiden );
144145VIDEO_UPDATE( raiga );
r5613r5614
774775   GFXDECODE_ENTRY( "gfx4", 0, spritelayout,      0x000, 16 + 128 ) /* sprites 8x8 (only colors 0x00-x0f and 0x80-0x8f are used) */
775776GFXDECODE_END
776777
778static const gfx_layout mastninj_tile2layout =
779{
780   16,16,
781   RGN_FRAC(1,1),
782   4,
783   { 24,16,8,0 },
784   { 0,1,2,3,4,5,6,7, 256,257,258,259,260,261,262,263 },
785   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 512+0*32, 512+1*32, 512+2*32, 512+3*32, 512+4*32, 512+5*32, 512+6*32, 512+7*32},
786   32*32
787};
788
789static const gfx_layout mastninj_spritelayout =
790{
791   8,8,   /* tile size */
792   RGN_FRAC(1,4),   /* number of tiles */
793   4,   /* 4 bits per pixel */
794   { RGN_FRAC(0,4),RGN_FRAC(1,4),RGN_FRAC(2,4),RGN_FRAC(3,4) },
795   { 0,1,2,3,4,5,6,7 },
796   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
797   8*8   /* offset to next tile */
798};
799
800static GFXDECODE_START( mastninj )
801   GFXDECODE_ENTRY( "gfx1", 0, tilelayout,        0x000, 16 )   /* tiles 8x8  */
802   GFXDECODE_ENTRY( "gfx2", 0, mastninj_tile2layout,       0x300, 16 )   /* tiles 16x16 */
803   GFXDECODE_ENTRY( "gfx3", 0, mastninj_tile2layout,       0x200, 16 )   /* tiles 16x16 */
804   GFXDECODE_ENTRY( "gfx4", 0, mastninj_spritelayout,      0x100, 16 )   /* sprites 8x8 */
805GFXDECODE_END
806
777807static const gfx_layout drgnbowl_tile2layout =
778808{
779809   16,16,
r5613r5614
914944   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
915945MACHINE_DRIVER_END
916946
947/*
948Master Ninja
949
950CPUs
951
952QTY     Type                position            function
9531x      MC68000P10          68000 main PCB      main
9541x      Z8400HB1            ic36 main PCB       sound
9552x      YM2203C             ic31,ic32 main PCB  sound
9562x      Y3014B              c16,ic17 main PCB   sound
9572x      LM324N              ic2,ic6 main PCB    sound
9581x      TDA2002             ic1 main PCB        sound
959
960Oscillators
9611x      oscillator 20.000 (xl2 main PCB)
9621x      blu resonator 400K (xl1 main PCB)
963
964ROMs
965
966QTY     Type                position            status
9676x      AM27C512            1-6 main PCB        dumped
96832x     AM27C512            8-39 ROMs PCB       dumped
969
970RAMs
971
972QTY     Type                position
9734x      HY6264LP-10         ic25,ic28,ic61,ic62 main PCB
9743x      HY6116ALP-10        ic33,ic123,ic124 main PCB
9751x      HM6148P             ic80 main PCB
9761x      MCM2018AN45         ic81 main PCB
9774x      HM6148P             ic63-66 ROMs PCB
9781x      HY6116ALP-10        ic85 ROMs PCB
979
980PLDs
981
982QTY     Type                position            status
9832x      TIBPAL16L8          ic15,ic54 main PCB  read protected
9841x      GAL16L8             ic42 ROMs PCB       read protected
985
986Others
987
9881x      JAMMA edge connector
9891x      trimmer (volume)
9902x      8x2 switches DIP
991*/
992
993static ADDRESS_MAP_START( mastninj_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
994   AM_RANGE(0x0000, 0xdfff) AM_ROM
995   AM_RANGE(0xf000, 0xf7ff) AM_RAM
996   AM_RANGE(0xc400, 0xc401) AM_DEVWRITE("ym1", ym2203_w)
997   AM_RANGE(0xc800, 0xc801) AM_DEVWRITE("ym2", ym2203_w)
998//  AM_RANGE(0xfc00, 0xfc00) AM_NOP /* ?? */
999//  AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
1000ADDRESS_MAP_END
1001
1002static ADDRESS_MAP_START( mastninj_map, ADDRESS_SPACE_PROGRAM, 16 )
1003   AM_RANGE(0x000000, 0x03ffff) AM_ROM
1004   AM_RANGE(0x060000, 0x063fff) AM_RAM
1005   AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_videoram_w) AM_BASE(&gaiden_videoram)
1006   AM_RANGE(0x072000, 0x073fff) AM_READWRITE(gaiden_videoram2_r, gaiden_videoram2_w) AM_BASE(&gaiden_videoram2)
1007   AM_RANGE(0x074000, 0x075fff) AM_READWRITE(gaiden_videoram3_r, gaiden_videoram3_w) AM_BASE(&gaiden_videoram3)
1008   AM_RANGE(0x076000, 0x077fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
1009   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
1010//  AM_RANGE(0x078800, 0x079fff) AM_RAM
1011   AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM")
1012   AM_RANGE(0x07a002, 0x07a003) AM_READ_PORT("P1_P2")
1013   AM_RANGE(0x07a004, 0x07a005) AM_READ_PORT("DSW")
1014//  AM_RANGE(0x07a104, 0x07a105) AM_WRITE(gaiden_txscrolly_w)
1015//  AM_RANGE(0x07a10c, 0x07a10d) AM_WRITE(gaiden_txscrollx_w)
1016   AM_RANGE(0x07f000, 0x07f001) AM_WRITE(gaiden_bgscrolly_w)
1017   AM_RANGE(0x07f002, 0x07f003) AM_WRITE(gaiden_bgscrollx_w)
1018   AM_RANGE(0x07f004, 0x07f005) AM_WRITE(gaiden_fgscrolly_w)
1019   AM_RANGE(0x07f006, 0x07f007) AM_WRITE(gaiden_fgscrollx_w)
1020   AM_RANGE(0x07a800, 0x07a801) AM_WRITE(watchdog_reset16_w)
1021   AM_RANGE(0x07e000, 0x07e001) AM_WRITE(gaiden_sound_command_w)
1022//  AM_RANGE(0x07a806, 0x07a807) AM_WRITENOP
1023//  AM_RANGE(0x07a808, 0x07a809) AM_WRITE(gaiden_flip_w)
1024ADDRESS_MAP_END
1025
1026static MACHINE_DRIVER_START( mastninj )
1027
1028   /* basic machine hardware */
1029   MDRV_CPU_ADD("maincpu", M68000, 10000000)   /* 10 MHz? */
1030   MDRV_CPU_PROGRAM_MAP(mastninj_map)
1031   MDRV_CPU_VBLANK_INT("screen", irq5_line_hold)
1032
1033   MDRV_CPU_ADD("audiocpu", Z80, 4000000)   /* ?? MHz */
1034   MDRV_CPU_PROGRAM_MAP(mastninj_sound_map)
1035                        /* IRQs are triggered by the YM2203 */
1036
1037   MDRV_MACHINE_RESET(raiga)
1038
1039   /* video hardware */
1040   MDRV_SCREEN_ADD("screen", RASTER)
1041   MDRV_SCREEN_REFRESH_RATE(59.17)   /* verified on pcb */
1042   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
1043   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1044   MDRV_SCREEN_SIZE(32*8, 32*8)
1045   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
1046
1047   MDRV_GFXDECODE(mastninj)
1048   MDRV_PALETTE_LENGTH(4096)
1049
1050   MDRV_VIDEO_START(mastninj)
1051   MDRV_VIDEO_UPDATE(gaiden)
1052
1053   /* sound hardware */
1054   MDRV_SPEAKER_STANDARD_MONO("mono")
1055
1056   MDRV_SOUND_ADD("ym1", YM2203, 4000000) /* ?? MHz */
1057   MDRV_SOUND_CONFIG(ym2203_config)
1058   MDRV_SOUND_ROUTE(0, "mono", 0.15)
1059   MDRV_SOUND_ROUTE(1, "mono", 0.15)
1060   MDRV_SOUND_ROUTE(2, "mono", 0.15)
1061   MDRV_SOUND_ROUTE(3, "mono", 0.60)
1062
1063   MDRV_SOUND_ADD("ym2", YM2203, 4000000) /* ?? MHz */
1064   MDRV_SOUND_ROUTE(0, "mono", 0.15)
1065   MDRV_SOUND_ROUTE(1, "mono", 0.15)
1066   MDRV_SOUND_ROUTE(2, "mono", 0.15)
1067   MDRV_SOUND_ROUTE(3, "mono", 0.60)
1068
1069   /* no OKI on the bootleg */
1070//  MDRV_SOUND_ADD("oki", OKIM6295, 1000000)
1071//  MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
1072//  MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
1073MACHINE_DRIVER_END
1074
9171075/***************************************************************************
9181076
9191077  Game driver(s)
r5613r5614
11281286   ROM_LOAD( "4.4a",     0x0000, 0x20000, CRC(b0e0faf9) SHA1(2275d2ef5eee356ccf80b9e9644d16fc30a4d107) ) /* samples */
11291287ROM_END
11301288
1289ROM_START( mastninj )
1290   ROM_REGION( 0x40000, "maincpu", 0 )
1291   ROM_LOAD16_BYTE( "3.ic27",    0x00000, 0x10000, CRC(41fedeb3) SHA1(7e95f8e5b0c38b578eedbce9afbd10dbb14cdddf) )
1292   ROM_LOAD16_BYTE( "1.ic30",    0x00001, 0x10000, CRC(93b1e3dd) SHA1(325b2f0ef5d92f4d760086de6cb23494d1e6c6e6) )
1293   ROM_LOAD16_BYTE( "4.ic26",    0x20000, 0x10000, CRC(d375c5f6) SHA1(925e84d79f35595a344a417125d74dc46ebec310) ) // 1ST AND 2ND HALF IDENTICAL (but correct?)
1294   ROM_LOAD16_BYTE( "2.ic29",    0x20001, 0x10000, CRC(6b53b8b1) SHA1(68bffc992fecae5e113592a9481c0cee80925135) )
11311295
1296   ROM_REGION( 0x10000, "audiocpu", 0 )
1297   ROM_LOAD( "5.ic35",       0x000000, 0x10000, CRC(ba528424) SHA1(5ab93059e26483a756d80b8c18d9669d2a3416de) )
11321298
1299   ROM_REGION( 0x010000, "gfx1", 0 )
1300   ROM_LOAD( "6.ic120",      0x000000, 0x10000, CRC(847cc552) SHA1(e5e2ed19efcedb52885f9f91a1690c88a6b6261d) )
1301
1302   ROM_REGION( 0x080000, "gfx2", 0 )
1303   ROM_LOAD32_BYTE( "8.ic13",       0x000000, 0x10000, CRC(e3987e0f) SHA1(8805443e56575fc455d21703bd2f9ebef434e262) )
1304   ROM_LOAD32_BYTE( "10.ic11",      0x000001, 0x10000, CRC(5e8afc68) SHA1(ecef113a947b9bda6abbef5f75557cd201e355b3) )
1305   ROM_LOAD32_BYTE( "12.ic9",       0x000002, 0x10000, CRC(2713e9f1) SHA1(87614a79596216d2b710925167f3130d4c2e07c9) )
1306   ROM_LOAD32_BYTE( "14.ic7",       0x000003, 0x10000, CRC(ca59280f) SHA1(d5a1d85f75ea667812708758915f43f01c8c9830) )
1307   ROM_LOAD32_BYTE( "20.ic27",      0x040000, 0x10000, CRC(72e5c1c2) SHA1(0e744407c52a61ed657557978cdfe455fe5e931e) )
1308   ROM_LOAD32_BYTE( "22.ic25",      0x040001, 0x10000, CRC(55affaf8) SHA1(c121a904ba44dc53c8a10b8d56c4c25ab879d8be) )
1309   ROM_LOAD32_BYTE( "24.ic23",      0x040002, 0x10000, CRC(bd76fd53) SHA1(bc2ad054b63573f16c99f82c680f0f6de2ee4683) )
1310   ROM_LOAD32_BYTE( "26.ic21",      0x040003, 0x10000, CRC(f3bfcfd6) SHA1(7d73a2ae00825979b3d09502f52d78f61f3ea1a9) )
1311
1312   ROM_REGION( 0x080000, "gfx3", 0 )
1313   ROM_LOAD32_BYTE( "9.ic12",       0x000000, 0x10000, CRC(ae043a2e) SHA1(3513b21d4ee7f869c9ebda68707845d030b0ecad) )
1314   ROM_LOAD32_BYTE( "11.ic10",      0x000001, 0x10000, CRC(e197fd97) SHA1(1e92139ae6a1c15de629039757c21e32cacc42d6) )
1315   ROM_LOAD32_BYTE( "13.ic8",       0x000002, 0x10000, CRC(0871971c) SHA1(ede9bb5d6d968fc532217b4eb1cd4c0d7ea9a4a1) )
1316   ROM_LOAD32_BYTE( "15.ic6",       0x000003, 0x10000, CRC(6850aea3) SHA1(670820ba2df040ded8739907bfdde4ac97373200) )
1317   ROM_LOAD32_BYTE( "21.ic26",      0x040000, 0x10000, CRC(dd162ce7) SHA1(70ec5a722ea31434be2a4b3104f9c54a48b8ec05) )
1318   ROM_LOAD32_BYTE( "23.ic24",      0x040001, 0x10000, CRC(edd65385) SHA1(3b5c0115ae1972bfe696a22edd2da9e6fb9739f4) )
1319   ROM_LOAD32_BYTE( "25.ic22",      0x040002, 0x10000, CRC(ca691635) SHA1(177f94a17cfaf67c764c2a2dff48475039207fae) )
1320   ROM_LOAD32_BYTE( "27.ic20",      0x040003, 0x10000, CRC(2ae70f42) SHA1(aad89dbd0309a5e3a786aa028995b56859d5b5ff) )
1321
1322   ROM_REGION( 0x100000, "gfx4", 0) /* these will need a further descramble to be in the same format as gaiden, although the sprites on the bootleg look different anyway */
1323   ROM_LOAD( "36.ic50",           0x000000, 0x10000, CRC(3c117e62) SHA1(dee45d6bbe053996e0b3faaba0293a273faf1ffa) )
1324   ROM_LOAD( "37.ic49",           0x010000, 0x10000, CRC(f6d6422d) SHA1(933487b09d3bcff9714fb2469b3d751b38459cfd) )
1325   ROM_LOAD( "38.ic48",           0x020000, 0x10000, CRC(642f06e7) SHA1(5b30b5029884b7eddcad201224a639f94ee27823) )
1326   ROM_LOAD( "39.ic47",           0x030000, 0x10000, CRC(51f00702) SHA1(c2a7819beb37ebf613cb2d65476dcee39f72a781) )
1327   ROM_LOAD( "32.ic34",           0x040000, 0x10000, CRC(940f3dbb) SHA1(4e2f224ed2ec1b8da992bd375d3ab1cf6fbfdd1f) )
1328   ROM_LOAD( "33.ic33",           0x050000, 0x10000, CRC(f6baccb0) SHA1(2244d16127efe67fcf59a59e50eabc54e3081dd1) )
1329   ROM_LOAD( "34.ic32",           0x060000, 0x10000, CRC(bb46ef1b) SHA1(4c8f9e06fa4d7f14206f6180a999b3f32681785a) )
1330   ROM_LOAD( "35.ic31",           0x070000, 0x10000, CRC(c0b6ba3e) SHA1(8849cf5c7777e4b5e52c695bcb6038b3bad4e04c) )
1331   ROM_LOAD( "28.ic19",           0x080000, 0x10000, CRC(012da98d) SHA1(413e1f02e2e3267fb4b893b14f627105789aa1c9) )
1332   ROM_LOAD( "29.ic18",           0x090000, 0x10000, CRC(fa32da96) SHA1(5e240f6f91813bdafacf1d29ea65704f2c4f2ae6) )
1333   ROM_LOAD( "30.ic17",           0x0a0000, 0x10000, CRC(910fccdb) SHA1(99523b53ae0dbf82783ab5a731df3c02984c72fe) )
1334   ROM_LOAD( "31.ic16",           0x0b0000, 0x10000, CRC(d16b593b) SHA1(2895b2eba0f3ad5e209fe8c550dd8cc3c3e08742) )
1335   ROM_LOAD( "16.ic5",            0x0c0000, 0x10000, CRC(216eeef5) SHA1(5167af8cef220a5092add2bf578e8323360132a5) )
1336   ROM_LOAD( "17.ic4",            0x0d0000, 0x10000, CRC(f72f8bfd) SHA1(ccf0aab11987e76c927a73f12e5cd4bb125c1258) )
1337   ROM_LOAD( "18.ic3",            0x0e0000, 0x10000, CRC(6de96087) SHA1(0b9028320cb622dad07cf8bde015428eba7f8a5e) )
1338   ROM_LOAD( "19.ic2",            0x0f0000, 0x10000, CRC(c12c367b) SHA1(9835292f335f1353f7b9bd0bb85124942822646f) )
1339
1340   ROM_REGION( 0x080000, "misc", 0 )
1341   ROM_LOAD( "gal16v8.ic42.bad.dump",    0x000, 0x117, BAD_DUMP CRC(61d6a8d7) SHA1(d3a6331b1fccd374e4f080740094d3832ff98ad9) )
1342   ROM_LOAD( "tibpal16l8.ic15.bad.dump", 0x000, 0x104, BAD_DUMP CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
1343   ROM_LOAD( "tibpal16l8.ic54.bad.dump", 0x000, 0x104, BAD_DUMP CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
1344ROM_END
1345
1346
11331347ROM_START( tknight )
11341348   ROM_REGION( 0x40000, "maincpu", 0 )   /* 2*128k for 68000 code */
11351349   ROM_LOAD16_BYTE( "tkni1.bin",    0x00000, 0x20000, CRC(9121daa8) SHA1(06ba7779602df8fae32e859371d27c0dbb8d3430) )
r5613r5614
13911605   free(buffer);
13921606}
13931607
1608static void descramble_mastninj_gfx(UINT8* src)
1609{
1610   UINT8 *buffer;
1611   int len = 0x80000;
13941612
1613   /*  rearrange gfx */
1614   buffer = alloc_array_or_die(UINT8, len);
1615   {
1616      int i;
1617      for (i = 0;i < len; i++)
1618      {
1619         buffer[i] = src[BITSWAP24(i,
1620         23,22,21,20,
1621         19,18,17,16,
1622         15,5,14,13,12,
1623         11,10,9,8,
1624         7,6,4,
1625         3,2,1,0)];
1626      }
1627      memcpy(src,buffer,len);
1628      free(buffer);
1629   }
1630
1631   buffer = alloc_array_or_die(UINT8, len);
1632   {
1633      int i;
1634      for (i = 0;i < len; i++)
1635      {
1636         buffer[i] = src[BITSWAP24(i,
1637         23,22,21,20,
1638         19,18,17,16,
1639         15,6,14,13,12,
1640         11,10,9,8,
1641         7,5,4,
1642         3,2,1,0)];
1643      }
1644      memcpy(src,buffer,len);
1645      free(buffer);
1646   }
1647}
1648
1649DRIVER_INIT(mastninj)
1650{
1651   // rearrange the graphic roms into a format that MAME can decode
1652   descramble_mastninj_gfx(memory_region(machine,"gfx2"));
1653   descramble_mastninj_gfx(memory_region(machine,"gfx3"));
1654   DRIVER_INIT_CALL(shadoww);
1655}
1656
13951657GAME( 1988, shadoww,  0,        shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Shadow Warriors (World, set 1)", 0 )
13961658GAME( 1988, shadowwa, shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Shadow Warriors (World, set 2)", 0 )
13971659GAME( 1988, gaiden,   shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Ninja Gaiden (US)", 0 )
13981660GAME( 1989, ryukendn, shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Ninja Ryukenden (Japan, set 1)", 0 )
13991661GAME( 1989, ryukendna,shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Ninja Ryukenden (Japan, set 2)", 0 )
1662GAME( 1989, mastninj, shadoww,  mastninj,shadoww,  mastninj, ROT0, "bootleg", "Master Ninja (bootleg of Shadow Warriors / Ninja Gaiden)", GAME_NOT_WORKING ) // sprites need fixing, sound and yscroll too.
14001663GAME( 1989, wildfang, 0,        shadoww, wildfang, wildfang, ROT0, "Tecmo", "Wild Fang / Tecmo Knight", 0 )
14011664GAME( 1989, tknight,  wildfang, shadoww, tknight,  wildfang, ROT0, "Tecmo", "Tecmo Knight", 0 )
14021665GAME( 1991, stratof,  0,        raiga,    raiga,    raiga,    ROT0, "Tecmo", "Raiga - Strato Fighter (US)", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/igspoker.c
r5613r5614
284284static CUSTOM_INPUT( hopper_r )
285285{
286286   if (hopper) return !(video_screen_get_frame_number(field->port->machine->primary_screen)%10);
287   return input_code_pressed(KEYCODE_H);
287   return input_code_pressed(field->port->machine, KEYCODE_H);
288288}
289289
290290static READ8_HANDLER( exp_rom_r )
src/mame/drivers/segaorun.c
r5613r5614
412412                    D7: /MUTE
413413                    D6-D0: unknown
414414                */
415            sound_global_enable(data & 0x80);
415            sound_global_enable(space->machine, data & 0x80);
416416         }
417417         return;
418418
src/mame/drivers/ilpag.c
r5613r5614
174174   int x,y,x_size,y_size;
175175   UINT32 src;
176176
177   printf("blit copy %04x %04x %04x %04x %04x\n", blit_romaddr[0], blit_attr1_ram[0], blit_dst_ram_loword[0], blit_attr2_ram[0], blit_dst_ram_hiword[0] );
178   printf("blit vregs %04x %04x %04x %04x\n",blit_vregs[0/2],blit_vregs[2/2],blit_vregs[4/2],blit_vregs[6/2]);
179   printf("blit transpen %04x %04x %04x %04x %04x %04x %04x %04x\n",blit_transpen[0/2],blit_transpen[2/2],blit_transpen[4/2],blit_transpen[6/2],
177   logerror("blit copy %04x %04x %04x %04x %04x\n", blit_romaddr[0], blit_attr1_ram[0], blit_dst_ram_loword[0], blit_attr2_ram[0], blit_dst_ram_hiword[0] );
178   logerror("blit vregs %04x %04x %04x %04x\n",blit_vregs[0/2],blit_vregs[2/2],blit_vregs[4/2],blit_vregs[6/2]);
179   logerror("blit transpen %04x %04x %04x %04x %04x %04x %04x %04x\n",blit_transpen[0/2],blit_transpen[2/2],blit_transpen[4/2],blit_transpen[6/2],
180180                                                                  blit_transpen[8/2],blit_transpen[10/2],blit_transpen[12/2],blit_transpen[14/2]);
181181
182182   blit_dst_xpos = (blit_dst_ram_loword[0] & 0x00ff)*2;
src/mame/drivers/mazerbla.c
r5613r5614
166166
167167   bitmap_fill(tmpbitmaps[0],NULL,color_base);
168168
169   if (input_code_pressed_once(KEYCODE_1))   /* plane 1 */
169   if (input_code_pressed_once(screen->machine, KEYCODE_1))   /* plane 1 */
170170      planes_enabled[0] ^= 1;
171171
172   if (input_code_pressed_once(KEYCODE_2))   /* plane 2 */
172   if (input_code_pressed_once(screen->machine, KEYCODE_2))   /* plane 2 */
173173      planes_enabled[1] ^= 1;
174174
175   if (input_code_pressed_once(KEYCODE_3))   /* plane 3 */
175   if (input_code_pressed_once(screen->machine, KEYCODE_3))   /* plane 3 */
176176      planes_enabled[2] ^= 1;
177177
178   if (input_code_pressed_once(KEYCODE_4))   /* plane 4 */
178   if (input_code_pressed_once(screen->machine, KEYCODE_4))   /* plane 4 */
179179      planes_enabled[3] ^= 1;
180180
181   if (input_code_pressed_once(KEYCODE_I))   /* show/hide debug info */
181   if (input_code_pressed_once(screen->machine, KEYCODE_I))   /* show/hide debug info */
182182      dbg_info = !dbg_info;
183183
184   if (input_code_pressed_once(KEYCODE_G))   /* enable gfx area handling */
184   if (input_code_pressed_once(screen->machine, KEYCODE_G))   /* enable gfx area handling */
185185      dbg_gfx_e = !dbg_gfx_e;
186186
187   if (input_code_pressed_once(KEYCODE_C))   /* enable color area handling */
187   if (input_code_pressed_once(screen->machine, KEYCODE_C))   /* enable color area handling */
188188      dbg_clr_e = !dbg_clr_e;
189189
190   if (input_code_pressed_once(KEYCODE_V))   /* draw only when vbank==dbg_vbank */
190   if (input_code_pressed_once(screen->machine, KEYCODE_V))   /* draw only when vbank==dbg_vbank */
191191      dbg_vbank ^= 1;
192192
193   if (input_code_pressed_once(KEYCODE_L))   /* showlookup ram */
193   if (input_code_pressed_once(screen->machine, KEYCODE_L))   /* showlookup ram */
194194      dbg_lookup = (dbg_lookup+1)%5;//0,1,2,3, 4-off
195195
196196
src/mame/drivers/itgambl3.c
r5613r5614
6060   const UINT8 *blit_ram = memory_region(screen->machine,"gfx1");
6161   static int test_x = 256,test_y = 256,start_offs;
6262
63   if(input_code_pressed(KEYCODE_Z))
63   if(input_code_pressed(screen->machine, KEYCODE_Z))
6464      test_x++;
6565
66   if(input_code_pressed(KEYCODE_X))
66   if(input_code_pressed(screen->machine, KEYCODE_X))
6767      test_x--;
6868
69   if(input_code_pressed(KEYCODE_A))
69   if(input_code_pressed(screen->machine, KEYCODE_A))
7070      test_y++;
7171
72   if(input_code_pressed(KEYCODE_S))
72   if(input_code_pressed(screen->machine, KEYCODE_S))
7373      test_y--;
7474
75   if(input_code_pressed(KEYCODE_Q))
75   if(input_code_pressed(screen->machine, KEYCODE_Q))
7676      start_offs+=0x200;
7777
78   if(input_code_pressed(KEYCODE_W))
78   if(input_code_pressed(screen->machine, KEYCODE_W))
7979      start_offs-=0x200;
8080
81   if(input_code_pressed(KEYCODE_E))
81   if(input_code_pressed(screen->machine, KEYCODE_E))
8282      start_offs++;
8383
84   if(input_code_pressed(KEYCODE_R))
84   if(input_code_pressed(screen->machine, KEYCODE_R))
8585      start_offs--;
8686
8787   popmessage("%d %d %04x",test_x,test_y,start_offs);
src/mame/drivers/polepos.c
r5613r5614
207207  136014-231 which matches Namco's PP1-27. The bad bit should cause a tiny gfx
208208  glitch, though it's difficult to notice.
209209
210- topracra: Use Service1 to start game
210211
212Todo:
213
214- topracra: Gear is not updated in artwork
215
211216***************************************************************************/
212217
213218#include "driver.h"
r5613r5614
347352}
348353
349354
350static CUSTOM_INPUT( shifted_port_r ) { return input_port_read(field->port->machine, (const char *)param) >> 4; }
355static CUSTOM_INPUT( high_port_r ) { return input_port_read(field->port->machine, (const char *)param) >> 4; }
356static CUSTOM_INPUT( low_port_r ) { return input_port_read(field->port->machine, (const char *)param) & 0x0f; }
351357static CUSTOM_INPUT( auto_start_r ) { return auto_start_mask; }
352358
353359static WRITE8_DEVICE_HANDLER( out_0 )
r5613r5614
553559   PORT_DIPSETTING(   0x00, "4" )
554560
555561   PORT_START("DSWA_HI")
556   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWA")
562   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWA")
557563
558564   PORT_START("DSWB")
559565   PORT_DIPNAME( 0x07, 0x07, "Extended Rank" )
r5613r5614
582588   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
583589
584590   PORT_START("DSWB_HI")
585   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWB")
591   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWB")
586592
587593   PORT_START("BRAKE")
588594   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
r5613r5614
633639   PORT_DIPSETTING(   0x00, "4" )
634640
635641   PORT_START("DSWA_HI")
636   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWA")
642   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWA")
637643
638644   PORT_START("DSWB")
639645   PORT_DIPNAME( 0xe0, 0xe0, "Practice Rank" )
r5613r5614
662668   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
663669
664670   PORT_START("DSWB_HI")
665   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWB")
671   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWB")
666672
667673   PORT_START("BRAKE")
668674   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
r5613r5614
686692   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
687693   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
688694
695   PORT_START("IN0L")
696   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(low_port_r, "IN0")
697
698   PORT_START("IN0H")
699   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "IN0")
700
689701   PORT_START("DSWA")
690702   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
691703   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
r5613r5614
711723   PORT_DIPSETTING(   0x00, "4" )
712724
713725   PORT_START("DSWA_HI")
714   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWA")
726   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWA")
715727
716728   PORT_START("DSWB")
717729   PORT_DIPNAME( 0x07, 0x07, "Extended Rank" )
r5613r5614
740752   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
741753
742754   PORT_START("DSWB_HI")
743   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWB")
755   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWB")
744756
745757   PORT_START("BRAKE")
746758   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
r5613r5614
792804   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
793805
794806   PORT_START("DSWA_HI")
795   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWA")
807   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWA")
796808
797809   PORT_START("DSWB")
798810   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Game_Time ) )
r5613r5614
818830   PORT_DIPSETTING(   0x00, DEF_STR( High ) )
819831
820832   PORT_START("DSWB_HI")
821   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWB")
833   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWB")
822834
823835   PORT_START("BRAKE")
824836   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
src/mame/drivers/scobra.c
r5613r5614
10981098   ROM_LOAD( "strategy.10k", 0x0000, 0x0020, CRC(d95c0318) SHA1(83e5355fdca7b4e1fb5a0e6eeaacfbf9561e2c36) )
10991099ROM_END
11001100
1101ROM_START( strongx )
1102   ROM_REGION( 0x10000, "maincpu", 0 )
1103   ROM_LOAD( "strongx.2d",   0x0000, 0x1000, CRC(c2f7268c) SHA1(2943198d82d4bc7990b327c44bbce7e7eb011886) )
1104   ROM_LOAD( "strongx.2e",   0x1000, 0x1000, CRC(91059422) SHA1(c73b50bc4035bd7268628cf92b21acbafef0456e) )
1105   ROM_LOAD( "2f_3.bin",     0x2000, 0x1000, CRC(849e2504) SHA1(0ec00a5c77e9d81d69f8b847a50f36af2dacc8d0) )
1106   ROM_LOAD( "2h_4.bin",     0x3000, 0x1000, CRC(8a64069b) SHA1(ccc0e0441360e3ed93f2a0dab70c3a66edad969f) )
1107   ROM_LOAD( "2j_5.bin",     0x4000, 0x1000, CRC(78b9b898) SHA1(158e11352d68ed9e4277efbcb7e927e9bdc662f8) )
1108   ROM_LOAD( "2l_6.bin",     0x5000, 0x1000, CRC(20bae414) SHA1(cd3c03d3b6a3abb64cb86cffa733d5494cb226f7) )
11011109
1110   ROM_REGION( 0x10000, "audiocpu", 0 )   /* 64k for sound code */
1111   ROM_LOAD( "s1.bin",       0x0000, 0x1000, CRC(713a5db8) SHA1(8ec41cb93cfd856dc5aecace6238240a5d114ce1) )
1112   ROM_LOAD( "s2.bin",       0x1000, 0x1000, CRC(46079411) SHA1(72bfc39979818309ac5a49654a825f9e4bd0236c) )
1113
1114   ROM_REGION( 0x1000, "gfx1", 0 )
1115   ROM_LOAD( "5f_c2.bin",    0x0000, 0x0800, CRC(7121b679) SHA1(bf76c5b777d1f1468b31524bfe250a1bc4911b09) )
1116   ROM_LOAD( "5h_c1.bin",    0x0800, 0x0800, CRC(d105ad91) SHA1(fd30d001764cf37ae52bab010db27acdc35fece6) )
1117
1118   ROM_REGION( 0x0020, "proms", 0 )
1119   ROM_LOAD( "strategy.6e",  0x0000, 0x0020, CRC(51a629e1) SHA1(f9826202c91a4a3deb8d815cbaa107b29dce5835) )
1120
1121   ROM_REGION( 0x0020, "user1", 0 )
1122   ROM_LOAD( "strategy.10k", 0x0000, 0x0020, CRC(d95c0318) SHA1(83e5355fdca7b4e1fb5a0e6eeaacfbf9561e2c36) )   /* background color map */
1123ROM_END
1124
11021125ROM_START( darkplnt )
11031126   ROM_REGION( 0x10000, "maincpu", 0 )
11041127   ROM_LOAD( "drkplt2c.dat", 0x0000, 0x1000, CRC(5a0ca559) SHA1(cf77bda30bb08633d274c22734a8f186520ddf7d) )
r5613r5614
13531376
13541377GAME( 1981, stratgyx, 0,        stratgyx, stratgyx, stratgyx,     ROT0,   "Konami", "Strategy X", GAME_SUPPORTS_SAVE )
13551378GAME( 1981, stratgys, stratgyx, stratgyx, stratgyx, stratgyx,     ROT0,   "[Konami] (Stern license)", "Strategy X (Stern)", GAME_SUPPORTS_SAVE )
1379GAME( 1982, strongx,  stratgyx, stratgyx, stratgyx, stratgyx,     ROT0,     "bootleg", "Strong X", GAME_SUPPORTS_SAVE )
13561380GAME( 1982, darkplnt, 0,        darkplnt, darkplnt, darkplnt,     ROT180, "Stern", "Dark Planet", GAME_SUPPORTS_SAVE )
13571381GAME( 1982, tazmani2, tazmania, type2,    tazmania, tazmani2,     ROT90,  "Stern", "Tazz-Mania (set 2)", GAME_SUPPORTS_SAVE )
13581382GAME( 1983, anteatg,  anteater, anteatg,  anteatg,  scramble_ppi, ROT90,  "TV-Tuning (F.E.G. license)", "Ameisenbaer (German)", GAME_SUPPORTS_SAVE )
src/mame/drivers/kickgoal.c
r5613r5614
341341         okim6295_w(adpcm,0,0x81);
342342      }
343343   }
344   if ( input_code_pressed_once(KEYCODE_PGUP) )
344   if ( input_code_pressed_once(device->machine, KEYCODE_PGUP) )
345345   {
346346      if (m6295_key_delay >= (0x60 * oki_time_base))
347347      {
r5613r5614
357357      else
358358         m6295_key_delay += (0x01 * oki_time_base);
359359   }
360   else if ( input_code_pressed_once(KEYCODE_PGDN) )
360   else if ( input_code_pressed_once(device->machine, KEYCODE_PGDN) )
361361   {
362362      if (m6295_key_delay >= (0x60 * oki_time_base))
363363      {
r5613r5614
373373      else
374374         m6295_key_delay += (0x01 * oki_time_base);
375375   }
376   else if ( input_code_pressed_once(KEYCODE_INSERT) )
376   else if ( input_code_pressed_once(device->machine, KEYCODE_INSERT) )
377377   {
378378      if (m6295_key_delay >= (0x60 * oki_time_base))
379379      {
r5613r5614
392392      else
393393         m6295_key_delay += (0x01 * oki_time_base);
394394   }
395   else if ( input_code_pressed_once(KEYCODE_DEL) )
395   else if ( input_code_pressed_once(device->machine, KEYCODE_DEL) )
396396   {
397397      if (m6295_key_delay >= (0x60 * oki_time_base))
398398      {
r5613r5614
411411      else
412412         m6295_key_delay += (0x01 * oki_time_base);
413413   }
414   else if ( input_code_pressed_once(KEYCODE_Z) )
414   else if ( input_code_pressed_once(device->machine, KEYCODE_Z) )
415415   {
416416      if (m6295_key_delay >= (0x80 * oki_time_base))
417417      {
src/mame/drivers/galaxian.c
r5613r5614
221221  - kingbalj : full Dip Switches and Inputs
222222  - frogg    : fix read/writes at/to unmapped/wrong memory
223223  - scprpng  : fix read/writes at/to unmapped/wrong memory
224  - scorpion : check whether konami filters are used
225  - explorer : check whether konami filters are used
224226
225227***************************************************************************/
226228
r5613r5614
371373      cputag_set_input_line(device->machine, "audiocpu", 0, HOLD_LINE);
372374
373375   /* bit 4 is sound disable */
374   sound_global_enable(~data & 0x10);
376   sound_global_enable(device->machine, ~data & 0x10);
375377}
376378
377379
r5613r5614
743745   /* the decoding here is very simplistic, and you can address both simultaneously */
744746   UINT8 result = 0xff;
745747   if (offset & 0x08) result &= ay8910_r(devtag_get_device(space->machine, "8910.2"), 0);
746   if (offset & 0x20) result &= ay8910_r(devtag_get_device(space->machine, "8910.0"), 0);
747   if (offset & 0x80) result &= ay8910_r(devtag_get_device(space->machine, "8910.1"), 0);
748   if (offset & 0x20) result &= ay8910_r(devtag_get_device(space->machine, "8910.1"), 0);
749   if (offset & 0x80) result &= ay8910_r(devtag_get_device(space->machine, "8910.0"), 0);
748750   return result;
749751}
750752
r5613r5614
754756   /* the decoding here is very simplistic, and you can address all six simultaneously */
755757   if (offset & 0x04) ay8910_address_w(devtag_get_device(space->machine, "8910.2"), 0, data);
756758   if (offset & 0x08) ay8910_data_w(devtag_get_device(space->machine, "8910.2"), 0, data);
757   if (offset & 0x10) ay8910_address_w(devtag_get_device(space->machine, "8910.0"), 0, data);
758   if (offset & 0x20) ay8910_data_w(devtag_get_device(space->machine, "8910.0"), 0, data);
759   if (offset & 0x40) ay8910_address_w(devtag_get_device(space->machine, "8910.1"), 0, data);
760   if (offset & 0x80) ay8910_data_w(devtag_get_device(space->machine, "8910.1"), 0, data);
759   if (offset & 0x10) ay8910_address_w(devtag_get_device(space->machine, "8910.1"), 0, data);
760   if (offset & 0x20) ay8910_data_w(devtag_get_device(space->machine, "8910.1"), 0, data);
761   if (offset & 0x40) ay8910_address_w(devtag_get_device(space->machine, "8910.0"), 0, data);
762   if (offset & 0x80) ay8910_data_w(devtag_get_device(space->machine, "8910.0"), 0, data);
761763}
762764
763765
r5613r5614
16181620{
16191621   AY8910_LEGACY_OUTPUT,
16201622   AY8910_DEFAULT_LOADS,
1621   DEVCB_HANDLER(konami_sound_timer_r),
1623   DEVCB_HANDLER(explorer_sound_latch_r),
16221624   DEVCB_NULL,
16231625   DEVCB_NULL,
16241626   DEVCB_NULL
r5613r5614
16281630{
16291631   AY8910_LEGACY_OUTPUT,
16301632   AY8910_DEFAULT_LOADS,
1631   DEVCB_HANDLER(explorer_sound_latch_r),
1633   DEVCB_HANDLER(konami_sound_timer_r),
16321634   DEVCB_NULL,
16331635   DEVCB_NULL,
16341636   DEVCB_NULL
src/mame/drivers/calomega.c
r5613r5614
106106   -----+--------------------------+--------+---------+----------+---------+----------+---------+---------------+------+------+-------
107107    VER |  NAME                    | SYSTEM | PROGRAM | CHAR GEN | CG P/N  | CLR PROM | CP P/N  | GAME TYPE     | DUMP | STAT | ADDED
108108   -----+--------------------------+--------+---------+----------+---------+----------+---------+---------------+------+------+-------
109 *  7.4 | Gaming Poker (w. export) |  903   | AUG/81  | PKCG     | 6300010 | POKCLR   | 6600020 | Gaming        | Yes  | OK   | Yes
109110    7.6 | Poker                    |  903   | AUG/81  | PKCG     | 6300010 | POKCLR   | 6600020 | Amusement     | Yes  | OK   | Yes
110111 *  7.9 | Arcade Poker             |  903   | AUG/81  | PKCG     | 6300010 | POKCLR   | 6600020 | Amusement     | Yes  | BD   | Yes
111112 *  8.0 | Arcade Black Jack        |  903   | SEP/81  | CPKCG    | 6300010 | POKCLR   | 6600020 | Amusement?    | Yes  | BD   | Yes
r5613r5614
450451    --------------
451452
452453
454    [2009-09-03]
455
456    - Added Game 7.4 (Gaming Poker, W.Export).
457    - Added Game 7.4 proper inputs. Game is now playable with full sound.
458    - Updated games list and technical notes.
459
460
453461    [2008-12-26]
454462
455463    - Correctly setup the MC6845 device for all systems.
r5613r5614
11471155   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11481156INPUT_PORTS_END
11491157
1158static INPUT_PORTS_START( comg074 )
1159   PORT_START("IN0-0")
1160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)   /* credits */
1161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Collect") PORT_CODE(KEYCODE_Q)
1162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )
1163   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )  PORT_NAME("Deal / Draw")
1164   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_NAME("Cancel Discards")
1165   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER )   PORT_CODE(KEYCODE_1_PAD) PORT_NAME("IN0-0-6")
1166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1168
1169   PORT_START("IN0-1")
1170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hand Pay") PORT_CODE(KEYCODE_W)
1171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("IN0-1-2")
1172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_DOOR ) PORT_NAME("Door Open")
1173   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Mode")   /* in some games you need to open the door first */
1174   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER )   PORT_CODE(KEYCODE_3_PAD) PORT_NAME("IN0-1-5")
1175   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN0-1-6")
1176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1178
1179   PORT_START("IN0-2")
1180   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Discard 1")
1181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Discard 2")
1182   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Discard 3")
1183   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Discard 4")
1184   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Discard 5")
1185   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small")
1186   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1187   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1188
1189   PORT_START("IN0-3")
1190   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("IN0-3-1")
1191   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
1192   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE )
1193   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big")
1194   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("IN0-3-5")
1195   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("IN0-3-6")
1196   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1197   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1198
1199/*  SW1-5 should be wired to PIA0 portA, bit 6.
1200    SW1-6 should be wired to H-POL.
1201    SW1-7 should be wired to V-POL.
1202*/
1203   PORT_START("SW1")   /* settings (PIA1), SW2 in schematics */
1204   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* L6 */
1205   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* L7 */
1206   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* L8 */
1207   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* L9 */
1208   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1209   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1210   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1211   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1212   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1213   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1214   PORT_DIPNAME( 0xC0, 0x80, "Maximum Bet")
1215   PORT_DIPSETTING(    0x00, "5" )
1216   PORT_DIPSETTING(    0x40, "10" )
1217   PORT_DIPSETTING(    0x80, "40" )
1218   PORT_DIPSETTING(    0xC0, "80" )
1219
1220   PORT_START("SW2")   /* baud (serial 6850-4024), SW1 in schematics */
1221   PORT_DIPNAME( 0x3f, 0x08, "Baud Rate" )         PORT_DIPLOCATION("SW1:1,2,3,4,5,6")
1222   PORT_DIPSETTING(    0x01, "300" )
1223   PORT_DIPSETTING(    0x02, "600" )
1224   PORT_DIPSETTING(    0x04, "1200" )
1225   PORT_DIPSETTING(    0x08, "2400" )
1226   PORT_DIPSETTING(    0x10, "4800" )
1227   PORT_DIPSETTING(    0x20, "9600" )
1228   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )   PORT_DIPLOCATION("SW1:7")
1229   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1230   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1231   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )   PORT_DIPLOCATION("SW1:8")
1232   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1233   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1234
1235   PORT_START("SW3")   /* unknown (ay8912), SW3 in schematics */
1236   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:1")
1237   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1238   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1239   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:2")
1240   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1241   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1242   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:3")
1243   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1244   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1245   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:4")
1246   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1247   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1248   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:5")
1249   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1250   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1251   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:6")
1252   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1253   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1254   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:7")
1255   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1256   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1257   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW3:8")
1258   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1259   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1260INPUT_PORTS_END
1261
11501262static INPUT_PORTS_START( comg076 )
11511263   PORT_START("IN0-0")
11521264   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)   /* credits */
r5613r5614
20022114
20032115*/
20042116
2117ROM_START( comg074 )   /* Cal Omega v7.4 (Gaming Poker) */
2118   ROM_REGION( 0x10000, "maincpu", 0 )
2119   ROM_LOAD( "1800.u5",   0x1800, 0x0800, CRC(69759432) SHA1(d64646476b4f67088bf5996ffc272d2571e62c53) )   /* Seems to be from v6.5. Unused. */
2120   ROM_LOAD( "2000.u6",   0x2000, 0x0800, CRC(bd9044f6) SHA1(9ebfc8379fe79a84982a0176a6b26267580272de) )
2121   ROM_LOAD( "2800.u7",   0x2800, 0x0800, CRC(d1d2e111) SHA1(2e5b6fbaf04539851d0f0674f0fd86e9be90c0fd) )
2122   ROM_LOAD( "3000.u8",   0x3000, 0x0800, CRC(cac4af01) SHA1(aed2986575b8d5539581515d818cb5bb9054c7c9) )
2123   ROM_LOAD( "3800.u9",   0x3800, 0x0800, CRC(6d32c533) SHA1(286cd511dc42e4e98c0e5fee2c7b265a4db949cf) )
2124
2125   ROM_REGION( 0x0800, "gfx1", 0 )
2126   ROM_LOAD( "poker_cg0.u67",   0x0000, 0x0800, CRC(b626ad89) SHA1(551b75f4559d11a4f8f56e38982114a21c77d4e7) )
2127
2128   ROM_REGION( 0x1800, "gfx2", 0 )
2129   ROM_LOAD( "poker_cgc.u70",   0x0000, 0x0800, CRC(f2f94661) SHA1(f37f7c0dff680fd02897dae64e13e297d0fdb3e7) )
2130   ROM_LOAD( "poker_cgb.u69",   0x0800, 0x0800, CRC(6bbb1e2d) SHA1(51ee282219bf84218886ad11a24bc6a8e7337527) )
2131   ROM_LOAD( "poker_cga.u68",   0x1000, 0x0800, CRC(6e3e9b1d) SHA1(14eb8d14ce16719a6ad7d13db01e47c8f05955f0) )
2132
2133   ROM_REGION( 0x400, "proms", 0 )   /* from other set */
2134   ROM_LOAD( "pokclr.u28",   0x0000, 0x0100, BAD_DUMP CRC(a8191ef7) SHA1(d6f777980179ab091e2713ee815d46bf9c0ac486) )
2135   ROM_RELOAD(            0x0100, 0x0100 )
2136   ROM_RELOAD(            0x0200, 0x0100 )
2137   ROM_RELOAD(            0x0300, 0x0100 )
2138ROM_END
2139
20052140ROM_START( comg076 )   /* Cal Omega v7.6 (Arcade Poker) */
20062141   ROM_REGION( 0x10000, "maincpu", 0 )
20072142   ROM_FILL(            0x1800, 0x0800, 0xff )   /* empty socket */
r5613r5614
29783113*************************/
29793114
29803115/*    YEAR  NAME      PARENT    MACHINE   INPUT     INIT      ROT    COMPANY                                  FULLNAME                                        FLAGS   */
3116GAME( 1981, comg074,  0,        sys903,   comg074,  standard, ROT0, "Cal Omega Inc.",                        "Cal Omega - Game 7.4 (Gaming Poker, W.Export)", 0 )
29813117GAME( 1981, comg076,  0,        sys903,   comg076,  standard, ROT0, "Cal Omega Inc.",                        "Cal Omega - Game 7.6 (Arcade Poker)",           0 )
29823118GAME( 1981, comg079,  0,        sys903,   comg076,  standard, ROT0, "Cal Omega Inc.",                        "Cal Omega - Game 7.9 (Arcade Poker)",           GAME_NOT_WORKING )   /* bad dump */
29833119GAME( 1981, comg080,  0,        sys903,   stand903, standard, ROT0, "Cal Omega Inc.",                        "Cal Omega - Game 8.0 (Arcade Black Jack)",      GAME_NOT_WORKING )   /* bad dump */
src/mame/drivers/raiden2.c
r5613r5614
175175//  static int ytlim = 1;
176176//  static int xtlim = 1;
177177
178//  if ( input_code_pressed_once(KEYCODE_Q) ) ytlim--;
179//  if ( input_code_pressed_once(KEYCODE_W) ) ytlim++;
178//  if ( input_code_pressed_once(machine, KEYCODE_Q) ) ytlim--;
179//  if ( input_code_pressed_once(machine, KEYCODE_W) ) ytlim++;
180180
181//  if ( input_code_pressed_once(KEYCODE_A) ) xtlim--;
182//  if ( input_code_pressed_once(KEYCODE_S) ) xtlim++;
181//  if ( input_code_pressed_once(machine, KEYCODE_A) ) xtlim--;
182//  if ( input_code_pressed_once(machine, KEYCODE_S) ) xtlim++;
183183
184184
185185   /*00 ???? ????  (colour / priority?)
r5613r5614
454454      int mod = 0;
455455      tick = 0;
456456
457      if(input_code_pressed(KEYCODE_R)) {
457      if(input_code_pressed(screen->machine, KEYCODE_R)) {
458458         mod = 1;
459459         bg_bank++;
460460         if(bg_bank == 8)
461461            bg_bank = 0;
462462      }
463      if(input_code_pressed(KEYCODE_T)) {
463      if(input_code_pressed(screen->machine, KEYCODE_T)) {
464464         mod = 1;
465465         if(bg_bank == 0)
466466            bg_bank = 8;
467467         bg_bank--;
468468      }
469      if(input_code_pressed(KEYCODE_Y)) {
469      if(input_code_pressed(screen->machine, KEYCODE_Y)) {
470470         mod = 1;
471471         mid_bank++;
472472         if(mid_bank == 8)
473473            mid_bank = 0;
474474      }
475      if(input_code_pressed(KEYCODE_U)) {
475      if(input_code_pressed(screen->machine, KEYCODE_U)) {
476476         mod = 1;
477477         if(mid_bank == 0)
478478            mid_bank = 8;
479479         mid_bank--;
480480      }
481      if(input_code_pressed(KEYCODE_O)) {
481      if(input_code_pressed(screen->machine, KEYCODE_O)) {
482482         mod = 1;
483483         fg_bank++;
484484         if(fg_bank == 8)
485485            fg_bank = 0;
486486      }
487      if(input_code_pressed(KEYCODE_I)) {
487      if(input_code_pressed(screen->machine, KEYCODE_I)) {
488488         mod = 1;
489489         if(fg_bank == 0)
490490            fg_bank = 8;
491491         fg_bank--;
492492      }
493493
494      if(input_code_pressed(KEYCODE_D)) {
494      if(input_code_pressed(screen->machine, KEYCODE_D)) {
495495         mod = 1;
496496         bg_col++;
497497         if(bg_col == 8)
498498            bg_col = 0;
499499      }
500      if(input_code_pressed(KEYCODE_F)) {
500      if(input_code_pressed(screen->machine, KEYCODE_F)) {
501501         mod = 1;
502502         if(bg_col == 0)
503503            bg_col = 8;
504504         bg_col--;
505505      }
506      if(input_code_pressed(KEYCODE_G)) {
506      if(input_code_pressed(screen->machine, KEYCODE_G)) {
507507         mod = 1;
508508         mid_col++;
509509         if(mid_col == 8)
510510            mid_col = 0;
511511      }
512      if(input_code_pressed(KEYCODE_H)) {
512      if(input_code_pressed(screen->machine, KEYCODE_H)) {
513513         mod = 1;
514514         if(mid_col == 0)
515515            mid_col = 8;
516516         mid_col--;
517517      }
518      if(input_code_pressed(KEYCODE_J)) {
518      if(input_code_pressed(screen->machine, KEYCODE_J)) {
519519         mod = 1;
520520         fg_col++;
521521         if(fg_col == 8)
522522            fg_col = 0;
523523      }
524      if(input_code_pressed(KEYCODE_K)) {
524      if(input_code_pressed(screen->machine, KEYCODE_K)) {
525525         mod = 1;
526526         if(fg_col == 0)
527527            fg_col = 8;
528528         fg_col--;
529529      }
530      if(mod || input_code_pressed(KEYCODE_L)) {
530      if(mod || input_code_pressed(screen->machine, KEYCODE_L)) {
531531         popmessage("b:%x.%x m:%x.%x f:%x.%x %d%d%d", bg_bank, bg_col, mid_bank, mid_col, fg_bank, fg_col, info_1, info_2, info_3);
532532         tilemap_mark_all_tiles_dirty(background_layer);
533533         tilemap_mark_all_tiles_dirty(midground_layer);
r5613r5614
539539
540540   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
541541
542   if (!input_code_pressed(KEYCODE_Q))
542   if (!input_code_pressed(screen->machine, KEYCODE_Q))
543543      tilemap_draw(bitmap, cliprect, background_layer, 0, 0);
544   if (!input_code_pressed(KEYCODE_W))
544   if (!input_code_pressed(screen->machine, KEYCODE_W))
545545      tilemap_draw(bitmap, cliprect, midground_layer, 0, 0);
546   if (!input_code_pressed(KEYCODE_E))
546   if (!input_code_pressed(screen->machine, KEYCODE_E))
547547      tilemap_draw(bitmap, cliprect, foreground_layer, 0, 0);
548548
549549   draw_sprites(screen->machine, bitmap, cliprect, 0);
550550
551   if (!input_code_pressed(KEYCODE_A))
551   if (!input_code_pressed(screen->machine, KEYCODE_A))
552552      tilemap_draw(bitmap, cliprect, text_layer, 0, 0);
553553
554554   return 0;
r5613r5614
20022002{
20032003   mcu_prog[mcu_prog_offs*2+1] = data;
20042004
2005   {
2006      FILE *fp;
2007      fp=fopen("rdx_v33.dmp", "w+b");
2008      if (fp)
2009      {
2010         fwrite(mcu_prog, 0x400, 2, fp);
2011         fclose(fp);
2012      }
2013   }
2005/* Uncommented until actively worked on
2006    {
2007        FILE *fp;
2008        fp=fopen("rdx_v33.dmp", "w+b");
2009        if (fp)
2010        {
2011            fwrite(mcu_prog, 0x400, 2, fp);
2012            fclose(fp);
2013        }
2014    }
2015*/
20142016}
20152017
20162018static WRITE16_HANDLER( mcu_prog_offs_w )
src/mame/drivers/igs009.c
r5613r5614
228228   int layers_ctrl = video_enable ? -1 : 0;
229229
230230#ifdef MAME_DEBUG
231   if (input_code_pressed(KEYCODE_Z))
231   if (input_code_pressed(screen->machine, KEYCODE_Z))
232232   {
233233      int mask = 0;
234      if (input_code_pressed(KEYCODE_Q))   mask |= 1;
235      if (input_code_pressed(KEYCODE_W))   mask |= 2;
236      if (input_code_pressed(KEYCODE_A))   mask |= 4;
234      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 1;
235      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 2;
236      if (input_code_pressed(screen->machine, KEYCODE_A))   mask |= 4;
237237      if (mask != 0) layers_ctrl &= mask;
238238   }
239239#endif
src/mame/drivers/psikyo.c
r5613r5614
8080VIDEO_START( psikyo );
8181VIDEO_EOF( psikyo );
8282VIDEO_UPDATE( psikyo );
83VIDEO_START( sngkace );
8384
8485extern void psikyo_switch_banks( int tmap, int bank );
8586
r5613r5614
12051206   MDRV_GFXDECODE(psikyo)
12061207   MDRV_PALETTE_LENGTH(0x1000)
12071208
1208   MDRV_VIDEO_START(psikyo)
1209   MDRV_VIDEO_START(sngkace)
12091210   MDRV_VIDEO_EOF(psikyo)
12101211   MDRV_VIDEO_UPDATE(psikyo)
12111212
r5613r5614
14311432   memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, psikyo_soundlatch_w);
14321433
14331434   psikyo_ka302c_banking = 0; // SH201B doesn't have any gfx banking
1434   psikyo_switch_banks(0, 0); // sngkace / samuraia don't use banking
1435   psikyo_switch_banks(1, 1); // They share "gfx2" to save memory on other boards
14361435
14371436   /* Enable other regions */
14381437#if 0
src/mame/drivers/cb2001.c
r5613r5614
175175};
176176
177177static GFXDECODE_START( cb2001 )
178   GFXDECODE_ENTRY( "gfx", 0, cb2001_layout,   0x0, 2  )
179   GFXDECODE_ENTRY( "gfx", 0, cb2001_layout32, 0x0, 2  )
178   GFXDECODE_ENTRY( "gfx", 0, cb2001_layout,   0x0, 32  )
179   GFXDECODE_ENTRY( "gfx", 0, cb2001_layout32, 0x0, 32 )
180180GFXDECODE_END
181181
182static PALETTE_INIT(cb2001)
183{
184   int i;
185   for (i = 0; i < 0x200; i++)
186   {
187      int r,g,b;
188
189      UINT8*proms = memory_region(machine, "proms");
190      UINT16 dat;
191
192      dat = (proms[0x000+i] << 8) | proms[0x200+i];
193
194
195      b = ((dat >> 1) & 0x1f)<<3;
196      r = ((dat >> 6 )& 0x1f)<<3;
197      g = ((dat >> 11 ) & 0x1f)<<3;
198
199      palette_set_color(machine, i, MAKE_RGB(r, g, b));
200   }
201}
202
203
182204static const nec_config cb2001_config = { cb2001_decryption_table, };
183205static MACHINE_DRIVER_START( cb2001 )
184206   MDRV_CPU_ADD("maincpu", V30, 20000000) // CPU91A-011-0016JK004; encrypted cpu like nec v25/35 used in some irem game
r5613r5614
189211
190212   MDRV_GFXDECODE(cb2001)
191213
214   MDRV_PALETTE_INIT( cb2001 )
215
192216   MDRV_SCREEN_ADD("screen", RASTER)
193217   MDRV_SCREEN_REFRESH_RATE(60)
194218   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
r5613r5614
210234   ROM_REGION( 0x080000, "gfx", 0 )
211235   ROM_LOAD( "c0111.12a", 0x000000, 0x80000, CRC(342b760e) SHA1(bc168bec384ccacd73543f604e3ab5b2b8f4f441) )
212236
213   ROM_REGION( 0x200, "user1", 0 ) // ?
214   ROM_LOAD( "am27s29.9b", 0x000, 0x200, CRC(6c90f6a2) SHA1(f3f592954000d189ded0ed8c6c4444ace0b616a4) )
215   ROM_REGION( 0x200, "user2", 0 ) // ?
216   ROM_LOAD( "am27s29.11b", 0x000, 0x200, CRC(e5aa3ec7) SHA1(675711dd6788b3d0c37573b49b6297cbcd8c8209) )
237   ROM_REGION( 0x400, "proms", 0 ) // ?
238   ROM_LOAD( "am27s29.9b",  0x000, 0x200, CRC(6c90f6a2) SHA1(f3f592954000d189ded0ed8c6c4444ace0b616a4) )
239   ROM_LOAD( "am27s29.11b", 0x200, 0x200, CRC(e5aa3ec7) SHA1(675711dd6788b3d0c37573b49b6297cbcd8c8209) )
217240ROM_END
218241
219242ROM_START( scherrym )
r5613r5614
223246   ROM_REGION( 0x080000, "gfx", 0 )
224247   ROM_LOAD( "12a.bin", 0x000000, 0x80000,NO_DUMP ) // missing on PCB
225248
226   // assumed to be the same
227   ROM_REGION( 0x200, "user1", 0 ) // ?
228   ROM_LOAD( "am27s29.9b", 0x000, 0x200, CRC(6c90f6a2) SHA1(f3f592954000d189ded0ed8c6c4444ace0b616a4) )
229   ROM_REGION( 0x200, "user2", 0 ) // ?
230   ROM_LOAD( "am27s29.11b", 0x000, 0x200, CRC(e5aa3ec7) SHA1(675711dd6788b3d0c37573b49b6297cbcd8c8209) )
249   ROM_REGION( 0x400, "proms", 0 )
250   ROM_LOAD( "n82s135-1.bin", 0x000, 0x100, CRC(66ed363f) SHA1(65bd37842c441c2e712844b07c0cfe37ef16d0ef) )
251   ROM_LOAD( "n82s135-2.bin", 0x200, 0x100, CRC(a19821db) SHA1(62dda90dd67dfbc0b96f161f1f2b7a46a5805eae) )
231252ROM_END
232253
233254GAME( 2001, cb2001,    0,      cb2001,      cb2001,   0, ROT0,  "Dyna", "Cherry Bonus 2001", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/tmaster.c
r5613r5614
298298   int layers_ctrl = -1;
299299
300300#ifdef MAME_DEBUG
301   if (input_code_pressed(KEYCODE_Z))
301   if (input_code_pressed(screen->machine, KEYCODE_Z))
302302   {
303303      int mask = 0;
304      if (input_code_pressed(KEYCODE_Q))   mask |= 1;
305      if (input_code_pressed(KEYCODE_W))   mask |= 2;
304      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 1;
305      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 2;
306306      if (mask != 0) layers_ctrl &= mask;
307307   }
308308#endif
r5613r5614
541541#define GALGAMES_EEPROM_CART3 "eeprom_cart3"
542542#define GALGAMES_EEPROM_CART4 "eeprom_cart4"
543543
544const char const *galgames_eeprom_names[5] = { GALGAMES_EEPROM_BIOS, GALGAMES_EEPROM_CART1, GALGAMES_EEPROM_CART2, GALGAMES_EEPROM_CART3, GALGAMES_EEPROM_CART4 };
544const char *galgames_eeprom_names[5] = { GALGAMES_EEPROM_BIOS, GALGAMES_EEPROM_CART1, GALGAMES_EEPROM_CART2, GALGAMES_EEPROM_CART3, GALGAMES_EEPROM_CART4 };
545545
546546static READ16_HANDLER( galgames_eeprom_r )
547547{
src/mame/drivers/galaxold.c
r5613r5614
426426static ADDRESS_MAP_START( mooncrst_map, ADDRESS_SPACE_PROGRAM, 8 )
427427   AM_RANGE(0x0000, 0x5fff) AM_ROM
428428   AM_RANGE(0x8000, 0x87ff) AM_RAM
429   AM_RANGE(0x9000, 0x93ff) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram)
429   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram)
430430   AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r)
431431   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram)
432432   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size)
src/mame/drivers/circusc.c
r5613r5614
138138
139139      /* CS5 */
140140      case 3:
141         device = devtag_get_device(space->machine, "fltdisc");
142         discrete_sound_w(device, NODE_03, data);
141         device = devtag_get_device(space->machine, "dac");
142         dac_w(device, 0, data);
143143         break;
144144
145145      /* CS6 */
r5613r5614
324324
325325   DISCRETE_INPUTX_STREAM(NODE_01, 0, 1.0, 0)
326326   DISCRETE_INPUTX_STREAM(NODE_02, 1, 1.0, 0)
327   DISCRETE_INPUTX_DATA(NODE_03, 255, 0, 0) //DAC
327   DISCRETE_INPUTX_STREAM(NODE_03, 1, 2.0, 0) // DAC 0..32767, multiply by 2
328328
329329   DISCRETE_INPUT_DATA(NODE_05)
330330   DISCRETE_INPUT_DATA(NODE_06)
r5613r5614
378378   MDRV_SOUND_ADD("sn2", SN76496, 14318180/8)
379379   MDRV_SOUND_ROUTE_EX(0, "fltdisc", 1.0, 1)
380380
381   MDRV_SOUND_ADD("dac", DAC, 0)
382   MDRV_SOUND_ROUTE_EX(0, "fltdisc", 1.0, 2)
383
381384   MDRV_SOUND_ADD("fltdisc", DISCRETE, 0)
382385
383386   MDRV_SOUND_CONFIG_DISCRETE(circusc)
src/mame/drivers/firebeat.c
r5613r5614
508508   if (tick >= 5)
509509   {
510510      tick = 0;
511      if (input_code_pressed(KEYCODE_0))
511      if (input_code_pressed(screen->machine, KEYCODE_0))
512512      {
513513         layer++;
514514         if (layer > 2)
r5613r5614
518518      }
519519
520520      /*
521        if (input_code_pressed_once(KEYCODE_9))
521        if (input_code_pressed_once(screen->machine, KEYCODE_9))
522522        {
523523            FILE *file = fopen("vram0.bin", "wb");
524524            int i;
src/mame/drivers/ghosteo.c
r5613r5614
388388static int b=0;
389389static VIDEO_UPDATE( bballoon )
390390{
391   if(input_code_pressed_once(KEYCODE_Q))
391   if(input_code_pressed_once(screen->machine, KEYCODE_Q))
392392   {
393393      irq_en ^= 1;
394394      printf("en = %d\n",irq_en);
395395   }
396396
397   if(input_code_pressed(KEYCODE_W))
397   if(input_code_pressed(screen->machine, KEYCODE_W))
398398   {
399399
400400      printf("b = %d\n",++b);
401401   }
402402
403   if(input_code_pressed(KEYCODE_E))
403   if(input_code_pressed(screen->machine, KEYCODE_E))
404404   {
405405
406406      printf("b = %d\n",--b);
src/mame/drivers/dunhuang.c
r5613r5614
117117   int layers_ctrl = -1;
118118
119119#if DUNHUANG_DEBUG
120if (input_code_pressed(KEYCODE_Z))
120if (input_code_pressed(screen->machine, KEYCODE_Z))
121121{
122122   int msk = 0;
123   if (input_code_pressed(KEYCODE_Q))   msk |= 1;
124   if (input_code_pressed(KEYCODE_W))   msk |= 2;
123   if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
124   if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
125125   if (msk != 0) layers_ctrl &= msk;
126126}
127127#endif
src/mame/drivers/jackie.c
r5613r5614
311311static CUSTOM_INPUT( hopper_r )
312312{
313313   if (hopper) return !(video_screen_get_frame_number(field->port->machine->primary_screen)%10);
314   return input_code_pressed(KEYCODE_H);
314   return input_code_pressed(field->port->machine, KEYCODE_H);
315315}
316316
317317static INPUT_PORTS_START( jackie )
src/mame/drivers/warriorb.c
r5613r5614
710710   banknum = -1;
711711
712712   /**** mixer control enable ****/
713   sound_global_enable( 1 );   /* mixer enabled */
713   sound_global_enable( machine, 1 );   /* mixer enabled */
714714}
715715
716716
src/mame/drivers/igs_blit.c
r5613r5614
107107   UINT16 *pri_ram;
108108
109109#ifdef MAME_DEBUG
110   if (input_code_pressed(KEYCODE_Z))
110   if (input_code_pressed(screen->machine, KEYCODE_Z))
111111   {
112112      int mask = 0;
113      if (input_code_pressed(KEYCODE_Q))   mask |= 0x01;
114      if (input_code_pressed(KEYCODE_W))   mask |= 0x02;
115      if (input_code_pressed(KEYCODE_E))   mask |= 0x04;
116      if (input_code_pressed(KEYCODE_R))   mask |= 0x08;
117      if (input_code_pressed(KEYCODE_A))   mask |= 0x10;
118      if (input_code_pressed(KEYCODE_S))   mask |= 0x20;
119      if (input_code_pressed(KEYCODE_D))   mask |= 0x40;
120      if (input_code_pressed(KEYCODE_F))   mask |= 0x80;
113      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 0x01;
114      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 0x02;
115      if (input_code_pressed(screen->machine, KEYCODE_E))   mask |= 0x04;
116      if (input_code_pressed(screen->machine, KEYCODE_R))   mask |= 0x08;
117      if (input_code_pressed(screen->machine, KEYCODE_A))   mask |= 0x10;
118      if (input_code_pressed(screen->machine, KEYCODE_S))   mask |= 0x20;
119      if (input_code_pressed(screen->machine, KEYCODE_D))   mask |= 0x40;
120      if (input_code_pressed(screen->machine, KEYCODE_F))   mask |= 0x80;
121121      if (mask)   layer_enable &= mask;
122122   }
123123#endif
r5613r5614
327327
328328   #ifdef MAME_DEBUG
329329#if 1
330   if (input_code_pressed(KEYCODE_Z))
330   if (input_code_pressed(space->machine, KEYCODE_Z))
331331   {   char buf[20];
332332      sprintf(buf, "%02X%02X",blitter.depth,blitter.flags&0xff);
333333//      ui_draw_text(buf, blitter.x, blitter.y);    // crashes mame!
src/mame/drivers/blackt96.c
r5613r5614
42422008-07
4343Added Dip Locations based on Service Mode
4444
45
46Is this based on some Seta / Taito HW design, the sprite-tilemaps look familiar
47
4548*/
4649
4750#include "driver.h"
r5613r5614
5760static UINT16* blackt96_tilemapram;
5861static UINT16* blackt96_tilemapram2;
5962
60static VIDEO_UPDATE( blackt96 )
63static void draw_strip(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int stripnum, int xbase, int ybase, int bg)
6164{
62   int y,x;
65   const gfx_element *gfxspr = machine->gfx[1];
66   const gfx_element *gfxbg = machine->gfx[0];
67
68   int base = stripnum;
6369   int count = 0;
64   int base;
65   const gfx_element *gfx = screen->machine->gfx[2];
66   const gfx_element *gfxbg = screen->machine->gfx[0];
67   const gfx_element *gfxspr = screen->machine->gfx[1];
70   int y;
6871
69   count = 0;
70   for (x=0;x<64;x++)
72   for (y=0;y<32;y++)
7173   {
72      for (y=0;y<32;y++)
73      {
74         UINT16 tile = (blackt96_tilemapram2[count*2 + (0x2000/2)+1]);
75         drawgfx_opaque(bitmap,cliprect,gfxbg,tile,6,0,0,x*16,y*16);
76         count++;
77      }
78   }
74      UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x3fff);
75      UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
76      UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x00ff);
7977
80   /* the sprite are arranged in tilemaps.. I don't know how this works yet */
81   count = 0;
82   base = 0x1000;
83   for (x=0;x<32;x++)
84   {
85      for (y=0;y<32;y++)
78      if (tile&0x2000)
8679      {
87         UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff);
88         UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
89         UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10;
90
91         drawgfx_transpen(bitmap,cliprect,gfxspr,tile,colour,flipx,0,x*16,y*16,0);
92         count++;
80         if (bg) drawgfx_transpen(bitmap,cliprect,gfxbg,tile&0x1fff,colour>>4,flipx,0,xbase,ybase+y*16,0);
9381      }
94   }
95   count = 0;
96   base = 0x1800;
97   for (x=0;x<32;x++)
98   {
99      for (y=0;y<32;y++)
82      else
10083      {
101         UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff);
102         UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
103         UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10;
104
105         drawgfx_transpen(bitmap,cliprect,gfxspr,tile,colour,flipx,0,x*16,y*16,0);
106         count++;
84         if (!bg) drawgfx_transpen(bitmap,cliprect,gfxspr,tile&0x1fff,colour,flipx,0,xbase,ybase+y*16,0);
10785      }
108   }
109   count = 0;
110   base = 0x3000;
111   for (x=0;x<32;x++)
112   {
113      for (y=0;y<32;y++)
114      {
115         UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff);
116         UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
117         UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10;
11886
119         drawgfx_transpen(bitmap,cliprect,gfxspr,tile,colour,flipx,0,x*16,y*16,0);
120         count++;
121      }
87      count++;
12288   }
123   count = 0;
124   base = 0x3800;
125   for (x=0;x<32;x++)
126   {
127      for (y=0;y<32;y++)
128      {
129         UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff);
130         UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
131         UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10;
13289
133         drawgfx_transpen(bitmap,cliprect,gfxspr,tile,colour,flipx,0,x*16,y*16,0);
134         count++;
135      }
136   }
137   base = 0x4000;
138   for (x=0;x<32;x++)
139   {
140      for (y=0;y<32;y++)
141      {
142         UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff);
143         UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
144         UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10;
90}
14591
146         drawgfx_transpen(bitmap,cliprect,gfxspr,tile,colour,flipx,0,x*16,y*16,0);
147         count++;
148      }
149   }
150   base = 0x4800;
151   for (x=0;x<32;x++)
92static void draw_main(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bg)
93{
94
95   int x;
96
97
98   for (x=(0x1000/2)-2;x>=0;x-=2)
15299   {
153      for (y=0;y<32;y++)
154      {
155         UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff);
156         UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000);
157         UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10;
100      int xx;
101      int yy;
102      int s = 0;
158103
159         drawgfx_transpen(bitmap,cliprect,gfxspr,tile,colour,flipx,0,x*16,y*16,0);
160         count++;
161      }
104      xx=  ((blackt96_tilemapram2[x+0]&0x001f)<<4) | (blackt96_tilemapram2[x+1]&0xf000)>>12;
105      yy = ((blackt96_tilemapram2[x+1]&0x1ff));
106
107      if (xx&0x100) xx-=0x200;
108      yy = 0x1ff-yy;
109      if (yy&0x100) yy-=0x200;
110
111      s = x*2;
112      s &=0xfff;
113      s += (x&7)*0x800;
114
115
116      draw_strip(machine,bitmap,cliprect,s,xx,yy,bg);
162117   }
163118
119}
120
121static VIDEO_UPDATE( blackt96 )
122{
123   int count;
124   int x,y;
125   const gfx_element *gfx = screen->machine->gfx[2];
126
127   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
128
129   draw_main(screen->machine,bitmap,cliprect,1);
130   draw_main(screen->machine,bitmap,cliprect,0);
131
164132   /* Text Layer */
165133   count = 0;
166134   for (x=0;x<64;x++)
r5613r5614
168136      for (y=0;y<32;y++)
169137      {
170138         UINT16 tile = (blackt96_tilemapram[count*2]&0x7ff)+0x800; // +0xc00 for korean text
171         drawgfx_transpen(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8,0);
139         drawgfx_transpen(bitmap,cliprect,gfx,tile,0,0,0,x*8,-16+y*8,0);
172140         count++;
173141      }
174
175142   }
176143
177
178
179
180144   return 0;
181145}
182146
r5613r5614
203167   AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2")
204168
205169   AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE(&blackt96_tilemapram) // text tilemap
206   AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE(&blackt96_tilemapram2)// sprite list?
170   AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE(&blackt96_tilemapram2)// sprite list + sprite tilemaps
207171   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE(&paletteram16)
208172   AM_RANGE(0xc00000, 0xc03fff) AM_RAM // main ram
209173
r5613r5614
443407   16,16,
444408   RGN_FRAC(1,1),
445409   4,
446   { 0,16,8, 24 },
410   { 0,24,8, 16 },
447411   { 519, 515, 518, 514,  517,513,  516,512, 7,3,6,2,5,1,4,0 },
448412   { 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 },
449413   32*32
r5613r5614
463427};
464428
465429static GFXDECODE_START( blackt96 )
466   GFXDECODE_ENTRY( "gfx1", 0, blackt96_layout,   0x0, 0x10  )
430   GFXDECODE_ENTRY( "gfx1", 0, blackt96_layout,    0x0, 0x10  )
467431   GFXDECODE_ENTRY( "gfx2", 0, blackt962_layout,   0x0, 0x80  )
468432   GFXDECODE_ENTRY( "gfx3", 0, blackt963_layout,   0x0, 0x80  )
469433GFXDECODE_END
r5613r5614
486450   MDRV_SCREEN_REFRESH_RATE(60)
487451   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
488452   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
489   MDRV_SCREEN_SIZE(64*16, 64*8)
453   MDRV_SCREEN_SIZE(256, 256)
490454//  MDRV_SCREEN_VISIBLE_AREA(0*8, 16*32-1, 0*8, 16*32-1)
491   MDRV_SCREEN_VISIBLE_AREA(0*8, 8*32-1, 2*8, 8*30-1)
455   MDRV_SCREEN_VISIBLE_AREA(0*8, 256-1, 0*8, 208-1)
492456
493457   MDRV_PALETTE_LENGTH(0x800)
494458
src/mame/drivers/spoker.c
r5613r5614
8484static CUSTOM_INPUT( hopper_r )
8585{
8686   if (hopper) return !(video_screen_get_frame_number(field->port->machine->primary_screen)%10);
87   return input_code_pressed(KEYCODE_H);
87   return input_code_pressed(field->port->machine, KEYCODE_H);
8888}
8989
9090static UINT8 out[3];
src/mame/drivers/funworld.c
r5613r5614
27322732   ROM_LOAD( "u11_tms27c256.bin",0x0000, 0x8000, CRC(d6834c3a) SHA1(4b071b9826c086439b9763393b23c671261b3788) )
27332733   ROM_LOAD( "u4_nmc27c256.bin", 0x8000, 0x8000, CRC(41f7a0b3) SHA1(9aff2b8832d2a4f868daa9849a0bfe5e44f88fc0) )
27342734
2735   ROM_REGION( 0x0200, "proms", 0 )   /* not present in the set */
2736   ROM_LOAD( "n82s147.bin",      0x0000, 0x0200, CRC(8bc86f48) SHA1(4c677ab9314a1f571e35104b22659e6811aeb194) )
2735   ROM_REGION( 0x0200, "proms", 0 )
2736   ROM_LOAD( "n82s147a.bin",     0x0000, 0x0200, CRC(8bc86f48) SHA1(4c677ab9314a1f571e35104b22659e6811aeb194) )
27372737
27382738   ROM_REGION( 0x0200, "plds", 0 )   /* correct PAL dump */
27392739   ROM_LOAD( "palce16v8h_1.bin", 0x0000, 0x0117, CRC(c89d2f52) SHA1(f9d52d9c42ef95b7b85bbf6d09888ebdeac11fd3) )
r5613r5614
27652765
27662766ROM_START( magicrd2 )   /* Impera */
27672767   ROM_REGION( 0x18000, "maincpu", 0 )
2768    ROM_LOAD( "magicard.004", 0x0000, 0x8000,  CRC(f6e948b8) SHA1(7d5983015a508ab135ccbf69b7f3c526c229e3ef) ) /* only last 16kbyte visible? */
2768   ROM_LOAD( "magicard.004", 0x0000, 0x8000,  CRC(f6e948b8) SHA1(7d5983015a508ab135ccbf69b7f3c526c229e3ef) ) /* only last 16kbyte visible? */
27692769   ROM_LOAD( "magicard.01",  0x8000, 0x10000, CRC(c94767d4) SHA1(171ac946bdf2575f9e4a31e534a8e641597af519) ) /* 1st and 2nd half identical */
27702770
27712771   ROM_REGION( 0x10000, "gfx1", 0 )
r5613r5614
27812781
27822782ROM_START( magicd2a )   /* for green TAB or Impera boards */
27832783   ROM_REGION( 0x10000, "maincpu", 0 )
2784    ROM_LOAD( "mc2prgv1.bin", 0x8000, 0x8000,  CRC(7f759b70) SHA1(23a1a6e8eda57c4a90c51a970302f9a7bf590083) )
2784   ROM_LOAD( "mc2prgv1.bin", 0x8000, 0x8000,  CRC(7f759b70) SHA1(23a1a6e8eda57c4a90c51a970302f9a7bf590083) )
27852785//    ROM_LOAD( "mc2prgv2.bin", 0x8000, 0x8000,  CRC(b0ed6b40) SHA1(7167e67608f1b0b1cd956c838dacc1310861cb4a) )
27862786
27872787   ROM_REGION( 0x10000, "gfx1", 0 )
r5613r5614
27982798ROM_START( magicd2b )   /* for blue TAB board (encrypted)*/
27992799   ROM_REGION( 0x10000, "maincpu", 0 )
28002800//    ROM_LOAD( "mc2prgv1.bin", 0x8000, 0x8000,  CRC(7f759b70) SHA1(23a1a6e8eda57c4a90c51a970302f9a7bf590083) )
2801    ROM_LOAD( "mc2prgv2.bin", 0x8000, 0x8000,  CRC(b0ed6b40) SHA1(7167e67608f1b0b1cd956c838dacc1310861cb4a) )
2801   ROM_LOAD( "mc2prgv2.bin", 0x8000, 0x8000,  CRC(b0ed6b40) SHA1(7167e67608f1b0b1cd956c838dacc1310861cb4a) )
28022802
28032803   ROM_REGION( 0x10000, "gfx1", 0 )
28042804   ROM_LOAD( "mc2gr1b.bin",  0x0000, 0x8000, CRC(ce2629a7) SHA1(84767ed5da8dcee44a210255537e10372bcc264b) )
r5613r5614
28772877    Seems to be a Big Deal clone.
28782878*/
28792879   ROM_REGION( 0x18000, "maincpu", 0 )
2880    ROM_LOAD( "ic41.bin",   0x8000,  0x8000, CRC(d36188b3) SHA1(3fb848fabbbde9fbb70875b3dfef62bfb3a8cbcb) ) /* only last 16kbyte visible? */
2880   ROM_LOAD( "ic41.bin",   0x8000,  0x8000, CRC(d36188b3) SHA1(3fb848fabbbde9fbb70875b3dfef62bfb3a8cbcb) ) /* only last 16kbyte visible? */
28812881   ROM_LOAD( "ic37.bin",   0x10000, 0x8000, CRC(8e0d70c4) SHA1(018f92631acbe98e5826a41698f0e07b4b46cd71) ) /* 1st and 2nd half identical */
28822882   ROM_COPY( "maincpu",   0x10000, 0xc000, 0x4000 ) /* rgn, srcoffset, offset, length */
28832883
r5613r5614
32043204GAME( 1991, royalcrd, 0,        royalcrd, royalcrd, 0,        ROT0, "TAB-Austria",     "Royal Card (austrian, set 1)",                    0 )
32053205GAME( 1991, royalcdb, royalcrd, royalcrd, royalcrd, 0,        ROT0, "TAB-Austria",     "Royal Card (austrian, set 2)",                    0 )
32063206GAME( 1991, royalcdc, royalcrd, royalcrd, royalcrd, 0,        ROT0, "Evona Electronic","Royal Card (slovak, encrypted)",                  GAME_WRONG_COLORS | GAME_NOT_WORKING )
3207GAME( 1993, royalcdp, royalcrd, cuoreuno, royalcrd, 0,        ROT0, "Digital Dreams",  "Royal Card v2.0 Professional",                    GAME_WRONG_COLORS | GAME_NOT_WORKING )
3207GAME( 1993, royalcdp, royalcrd, cuoreuno, royalcrd, 0,        ROT0, "Digital Dreams",  "Royal Card v2.0 Professional",                    GAME_NOT_WORKING )
32083208GAME( 1991, lluck3x3, royalcrd, cuoreuno, royalcrd, 0,        ROT0, "TAB-Austria",     "Lucky Lady (3x3 deal)",                           0 )
32093209GAME( 1991, lluck4x1, royalcrd, royalcrd, royalcrd, 0,        ROT0, "TAB-Austria",     "Lucky Lady (4x1 aces)",                           0 )
32103210GAME( 1996, magicrd2, 0,        magicrd2, magicrd2, 0,        ROT0, "Impera",          "Magic Card II (bulgarian)",                       GAME_IMPERFECT_SOUND )
src/mame/drivers/pntnpuzl.c
r5613r5614
196196   static int xxx=0x18f;
197197   static int yyy=512;
198198   static int sss=0xa8;
199/*
200    if ( input_code_pressed_once(KEYCODE_Q) )
201    {
202        xxx--;
203        mame_printf_debug("xxx %04x\n",xxx);
204    }
205199
206    if ( input_code_pressed_once(KEYCODE_W) )
207    {
208        xxx++;
209        mame_printf_debug("xxx %04x\n",xxx);
210    }
200#if 0
201   if ( input_code_pressed_once(screen->machine, KEYCODE_Q) )
202   {
203      xxx--;
204      mame_printf_debug("xxx %04x\n",xxx);
205   }
211206
212    if ( input_code_pressed_once(KEYCODE_A) )
213    {
214        yyy--;
215        mame_printf_debug("yyy %04x\n",yyy);
216    }
207   if ( input_code_pressed_once(screen->machine, KEYCODE_W) )
208   {
209      xxx++;
210      mame_printf_debug("xxx %04x\n",xxx);
211   }
217212
218    if ( input_code_pressed_once(KEYCODE_S) )
219    {
220        yyy++;
221        mame_printf_debug("yyy %04x\n",yyy);
222    }
213   if ( input_code_pressed_once(screen->machine, KEYCODE_A) )
214   {
215      yyy--;
216      mame_printf_debug("yyy %04x\n",yyy);
217   }
223218
224    if ( input_code_pressed_once(KEYCODE_Z) )
225    {
226        sss--;
227        mame_printf_debug("sss %04x\n",sss);
228    }
219   if ( input_code_pressed_once(screen->machine, KEYCODE_S) )
220   {
221      yyy++;
222      mame_printf_debug("yyy %04x\n",yyy);
223   }
229224
230    if ( input_code_pressed_once(KEYCODE_X) )
231    {
232        sss++;
233        mame_printf_debug("sss %04x\n",sss);
234    }
235*/
225   if ( input_code_pressed_once(screen->machine, KEYCODE_Z) )
226   {
227      sss--;
228      mame_printf_debug("sss %04x\n",sss);
229   }
236230
231   if ( input_code_pressed_once(screen->machine, KEYCODE_X) )
232   {
233      sss++;
234      mame_printf_debug("sss %04x\n",sss);
235   }
236#endif
237237
238
238239   count=sss;
239240
240241   for(y=0;y<yyy;y++)
src/mame/drivers/uapce.c
r5613r5614
3838   UINT8 diff = data ^ jamma_if_control_latch;
3939   jamma_if_control_latch = data;
4040
41   sound_global_enable( (data >> 7) & 1 );
41   sound_global_enable( space->machine, (data >> 7) & 1 );
4242
4343   if ( diff & 0x40 )
4444   {
src/mame/drivers/darkhors.c
r5613r5614
160160   int layers_ctrl = -1;
161161
162162#if DARKHORS_DEBUG
163   if (input_code_pressed(KEYCODE_Z))
163   if (input_code_pressed(screen->machine, KEYCODE_Z))
164164   {
165165      int mask = 0;
166      if (input_code_pressed(KEYCODE_Q))   mask |= 1;
167      if (input_code_pressed(KEYCODE_W))   mask |= 2;
168      if (input_code_pressed(KEYCODE_A))   mask |= 4;
166      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 1;
167      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 2;
168      if (input_code_pressed(screen->machine, KEYCODE_A))   mask |= 4;
169169      if (mask != 0) layers_ctrl &= mask;
170170   }
171171#endif
src/mame/drivers/bishjan.c
r5613r5614
236236   int y;
237237
238238#ifdef MAME_DEBUG
239   if (input_code_pressed(KEYCODE_Z))
239   if (input_code_pressed(screen->machine, KEYCODE_Z))
240240   {
241241      int msk = 0;
242      if (input_code_pressed(KEYCODE_Q))   msk |= 1;
243      if (input_code_pressed(KEYCODE_W))   msk |= 2;
242      if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
243      if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
244244      if (msk != 0) layers_ctrl &= msk;
245245   }
246246#endif
src/mame/drivers/quizpun2.c
r5613r5614
9090   int layers_ctrl = -1;
9191
9292#ifdef MAME_DEBUG
93   if (input_code_pressed(KEYCODE_Z))
93   if (input_code_pressed(screen->machine, KEYCODE_Z))
9494   {
9595      int msk = 0;
96      if (input_code_pressed(KEYCODE_Q))   msk |= 1;
97      if (input_code_pressed(KEYCODE_W))   msk |= 2;
96      if (input_code_pressed(screen->machine, KEYCODE_Q))   msk |= 1;
97      if (input_code_pressed(screen->machine, KEYCODE_W))   msk |= 2;
9898      if (msk != 0) layers_ctrl &= msk;
9999   }
100100#endif
src/mame/drivers/ninjaw.c
r5613r5614
10061006static MACHINE_RESET( ninjaw )
10071007{
10081008  /**** mixer control enable ****/
1009  sound_global_enable( 1 );   /* mixer enabled */
1009  sound_global_enable( machine, 1 );   /* mixer enabled */
10101010}
10111011
10121012
src/mame/drivers/srmp6.c
r5613r5614
162162
163163#if 0
164164   /* debug */
165   if(input_code_pressed_once(KEYCODE_Q))
165   if(input_code_pressed_once(screen->machine, KEYCODE_Q))
166166   {
167167      ++xixi;
168168      printf("%x\n",xixi);
169169   }
170170
171   if(input_code_pressed_once(KEYCODE_W))
171   if(input_code_pressed_once(screen->machine, KEYCODE_W))
172172   {
173173      --xixi;
174174      printf("%x\n",xixi);
r5613r5614
259259
260260   memcpy(sprram_old, sprram, 0x80000);
261261
262   if(input_code_pressed_once(KEYCODE_Q))
262   if(input_code_pressed_once(screen->machine, KEYCODE_Q))
263263   {
264264      FILE *p=fopen("tileram.bin","wb");
265265      fwrite(tileram,1,0x100000*16,p);
src/mame/drivers/hvyunit.c
r5613r5614
124124{
125125   static UINT8 res;
126126
127   if(input_code_pressed_once(KEYCODE_Z))
127   if(input_code_pressed_once(space->machine, KEYCODE_Z))
128128      test_mcu++;
129129
130   if(input_code_pressed_once(KEYCODE_X))
130   if(input_code_pressed_once(space->machine, KEYCODE_X))
131131      test_mcu--;
132132
133133   if(mcu_ram.access_ram_r)
src/mame/drivers/nmk16.c
r5613r5614
335335   AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
336336ADDRESS_MAP_END
337337
338static ADDRESS_MAP_START( vandykeb_map, ADDRESS_SPACE_PROGRAM, 16 )
339   AM_RANGE(0x000000, 0x03ffff) AM_ROM
340   AM_RANGE(0x080000, 0x080001) AM_READ_PORT("IN0")
341   AM_RANGE(0x080002, 0x080003) AM_READ_PORT("IN1")
342   AM_RANGE(0x080008, 0x080009) AM_READ_PORT("DSW1")
343   AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("DSW2")
344   AM_RANGE(0x08000e, 0x08000f) AM_READ(NMK004_r)
345   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   /* IRQ enable? */
346   AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
347   AM_RANGE(0x080010, 0x08001d) AM_WRITE(vandykeb_scroll_w) /* 10, 12, 1a, 1c */
348   AM_RANGE(0x08001e, 0x08001f) AM_WRITE(NMK004_w)
349   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
350   AM_RANGE(0x08c000, 0x08c007) AM_WRITENOP   /* just in case... */
351   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(&nmk_bgvideoram0)
352   AM_RANGE(0x094000, 0x097fff) AM_RAM /* what is this? */
353   AM_RANGE(0x09d000, 0x09d7ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
354   AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
355ADDRESS_MAP_END
356
338357static ADDRESS_MAP_START( manybloc_map, ADDRESS_SPACE_PROGRAM, 16 )
339358   AM_RANGE(0x000000, 0x03ffff) AM_ROM
340359   AM_RANGE(0x080000, 0x080001) AM_READ_PORT("IN0")
r5613r5614
11881207   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
11891208INPUT_PORTS_END
11901209
1210static INPUT_PORTS_START( vandykeb )
1211   PORT_INCLUDE( vandyke )
1212
1213   PORT_MODIFY("IN0")
1214   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* Tested on boot */
1215INPUT_PORTS_END
1216
11911217static INPUT_PORTS_START( blkheart )
11921218   PORT_START("IN0")
11931219   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r5613r5614
37713797
37723798   /* basic machine hardware */
37733799   MDRV_CPU_ADD("maincpu", M68000, 10000000) /* 10 MHz ? */
3774   MDRV_CPU_PROGRAM_MAP(vandyke_map)
3800   MDRV_CPU_PROGRAM_MAP(vandykeb_map)
37753801   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
37763802   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
37773803
r5613r5614
51295155
51305156   ROM_REGION( 0x080000, "gfx2", 0 )
51315157   ROM_LOAD( "4.bin",      0x000000, 0x040000, CRC(4ba4138d) SHA1(56f9c9422085eaf74ddec8977663a33c122b7e8b) )   /* 16x16 tiles */
5132   ROM_LOAD( "5.bin",      0x000000, 0x040000, CRC(9a1ac697) SHA1(a8200b10606edf4578c7e2f53a0046bb1209a041) )   /* 16x16 tiles */
5158   ROM_LOAD( "5.bin",      0x040000, 0x040000, CRC(9a1ac697) SHA1(a8200b10606edf4578c7e2f53a0046bb1209a041) )   /* 16x16 tiles */
51335159
51345160   ROM_REGION( 0x200000, "gfx3", 0 )
51355161   ROM_LOAD16_BYTE( "13.bin",   0x000000, 0x040000, CRC(bb561871) SHA1(33dcaf956112181eed531320d3ececb90b17a599) )   /* Sprites */
5162   ROM_LOAD16_BYTE( "17.bin",   0x000001, 0x040000, CRC(346e3b66) SHA1(34df7167ed4048e1f236e7d8fa6dcdffb0965c71) )   /* Sprites */
51365163   ROM_LOAD16_BYTE( "12.bin",   0x080000, 0x040000, CRC(cdef9b17) SHA1(ec024a21685b87c82dc574cd050118d856a3cf57) )   /* Sprites */
5137   ROM_LOAD16_BYTE( "17.bin",   0x000001, 0x040000, CRC(346e3b66) SHA1(34df7167ed4048e1f236e7d8fa6dcdffb0965c71) )   /* Sprites */
51385164   ROM_LOAD16_BYTE( "16.bin",   0x080001, 0x040000, CRC(beda678c) SHA1(3dfb8763241a97b9d65113c6eb99b52ec5245cd6) )   /* Sprites */
51395165   ROM_LOAD16_BYTE( "11.bin",   0x100000, 0x020000, CRC(823185d9) SHA1(eaf0f3ab0921d894eb1d09d5b2e9d5b785928804) )   /* Sprites */
5166   ROM_LOAD16_BYTE( "15.bin",   0x100001, 0x020000, CRC(149f3247) SHA1(5f515cb10468da048c89b543807280bd3e39e45a) )   /* Sprites */
51405167   ROM_LOAD16_BYTE( "10.bin",   0x140000, 0x020000, CRC(388b1abc) SHA1(9d1c43070130672a5e1a41807d796c944b0676ae) )   /* Sprites */
5141   ROM_LOAD16_BYTE( "15.bin",   0x100001, 0x020000, CRC(149f3247) SHA1(5f515cb10468da048c89b543807280bd3e39e45a) )   /* Sprites */
51425168   ROM_LOAD16_BYTE( "14.bin",   0x140001, 0x020000, CRC(32eeba37) SHA1(0d0218e864ed647bd33bbe379f0ef76ccefbd06c) )   /* Sprites */
51435169
51445170   ROM_REGION( 0x0a0000, "oki1", 0 )   /* OKIM6295 samples */
r5613r5614
71007126GAME( 1990, vandyke,    0,       vandyke,  vandyke, 0,        ROT270, "UPL",                          "Vandyke (Japan)",  GAME_IMPERFECT_SOUND )
71017127GAME( 1990, vandykejal, vandyke, vandyke,  vandyke, 0,        ROT270, "UPL (Jaleco license)",         "Vandyke (Jaleco, Set 1)",  GAME_IMPERFECT_SOUND )
71027128GAME( 1990, vandykejal2,vandyke, vandyke,  vandyke, 0,        ROT270, "UPL (Jaleco license)",         "Vandyke (Jaleco, Set 2)",  GAME_IMPERFECT_SOUND )
7103GAME( 1990, vandykeb,  vandyke, vandykeb, vandyke, vandykeb, ROT270, "[UPL] (bootleg)",              "Vandyke (bootleg with PIC16c57)",  GAME_NOT_WORKING )
7129GAME( 1990, vandykeb,  vandyke, vandykeb, vandykeb, vandykeb, ROT270, "[UPL] (bootleg)",              "Vandyke (bootleg with PIC16c57)",  GAME_NO_SOUND )
71047130
71057131GAME( 1991, blkheart, 0,        blkheart,  blkheart, 0,       ROT0,   "UPL",                          "Black Heart", GAME_IMPERFECT_SOUND  )
71067132GAME( 1991, blkheartj,blkheart, blkheart,  blkheart, 0,       ROT0,   "UPL",                          "Black Heart (Japan)", GAME_IMPERFECT_SOUND )
src/mame/drivers/m10.c
r5613r5614
239239      state->flip = ~data & 0x10;
240240
241241   if (!(input_port_read(space->machine, "CAB") & 0x02))
242      sound_global_enable(~data & 0x80);
242      sound_global_enable(space->machine, ~data & 0x80);
243243
244244   /* sound command in lower 4 bytes */
245245   switch (data & 0x07)
r5613r5614
315315      state->flip = ~data & 0x10;
316316
317317   if (!(input_port_read(space->machine, "CAB") & 0x02))
318      sound_global_enable(~data & 0x80);
318      sound_global_enable(space->machine, ~data & 0x80);
319319}
320320
321321/*
r5613r5614
344344   if (input_port_read(space->machine, "CAB") & 0x01)
345345      state->flip = ~data & 0x04;
346346   if (!(input_port_read(space->machine, "CAB") & 0x02))
347      sound_global_enable(~data & 0x08);
347      sound_global_enable(space->machine, ~data & 0x08);
348348}
349349
350350
src/tools/unidasm.c
r5613r5614
5353   UINT8               norawbytes;
5454   UINT8               lower;
5555   UINT8               upper;
56   int                  mode;
5657   const dasm_table_entry *dasm;
5758};
5859
r5613r5614
173174CPU_DISASSEMBLE( z180 );
174175CPU_DISASSEMBLE( z8000 );
175176CPU_DISASSEMBLE( z80 );
177CPU_DISASSEMBLE( z8 );
176178
177179
178180static const dasm_table_entry dasm_table[] =
r5613r5614
295297   { "z180",       _8bit,  0, CPU_DISASSEMBLE_NAME(z180) },
296298//  { "z8000",      _16be,  0, CPU_DISASSEMBLE_NAME(z8000) },
297299   { "z80",      _8bit,  0, CPU_DISASSEMBLE_NAME(z80) },
300   { "z8",         _8bit,  0, CPU_DISASSEMBLE_NAME(z8) },
298301};
299302
300303
r5613r5614
327330{
328331   int pending_base = FALSE;
329332   int pending_arch = FALSE;
333   int pending_mode = FALSE;
330334   int curarch;
331335   int numrows;
332336   int arg;
r5613r5614
341345      // is it a switch?
342346      if (curarg[0] == '-')
343347      {
344         if (pending_base || pending_arch)
348         if (pending_base || pending_arch || pending_mode)
345349            goto usage;
346350
347         if (tolower(curarg[1]) == 'a')
351         if (tolower((UINT8)curarg[1]) == 'a')
348352            pending_arch = TRUE;
349         else if (tolower(curarg[1]) == 'b')
353         else if (tolower((UINT8)curarg[1]) == 'b')
350354            pending_base = TRUE;
351         else if (tolower(curarg[1]) == 'l')
355         else if (tolower((UINT8)curarg[1]) == 'l')
352356            opts->lower = TRUE;
353         else if (tolower(curarg[1]) == 'n')
357         else if (tolower((UINT8)curarg[1]) == 'm')
358            pending_mode = TRUE;
359         else if (tolower((UINT8)curarg[1]) == 'n')
354360            opts->norawbytes = TRUE;
355         else if (tolower(curarg[1]) == 'u')
361         else if (tolower((UINT8)curarg[1]) == 'u')
356362            opts->upper = TRUE;
357363         else
358364            goto usage;
r5613r5614
361367      // base PC
362368      else if (pending_base)
363369      {
370         int result;
364371         if (curarg[0] == '0' && curarg[1] == 'x')
365            sscanf(&curarg[2], "%x", &opts->basepc);
372            result = sscanf(&curarg[2], "%x", &opts->basepc);
366373         else if (curarg[0] == '$')
367            sscanf(&curarg[1], "%x", &opts->basepc);
374            result = sscanf(&curarg[1], "%x", &opts->basepc);
368375         else
369            sscanf(&curarg[0], "%x", &opts->basepc);
376            result = sscanf(&curarg[0], "%x", &opts->basepc);
377         if (result != 1)
378            goto usage;
370379         pending_base = FALSE;
371380      }
372381
382      // mode
383      else if (pending_mode)
384      {
385         if (sscanf(curarg, "%d", &opts->mode) != 1)
386            goto usage;
387         pending_mode = FALSE;
388      }
389
373390      // architecture
374391      else if (pending_arch)
375392      {
r5613r5614
391408         goto usage;
392409   }
393410
411   // if we have a dangling option, error
412   if (pending_base || pending_arch || pending_mode)
413      goto usage;
414
394415   // if no file or no architecture, fail
395416   if (opts->filename == NULL || opts->dasm == NULL)
396417      goto usage;
397418   return 0;
398419
399420usage:
400   printf("Usage: %s <filename> -arch <architecture> [-basepc <pc>] [-norawbytes] [-upper] [-lower]\n", argv[0]);
421   printf("Usage: %s <filename> -arch <architecture> [-basepc <pc>] [-mode <n>] [-norawbytes] [-upper] [-lower]\n", argv[0]);
401422   printf("\n");
402423   printf("Supported architectures:");
403424   numrows = (ARRAY_LENGTH(dasm_table) + 6) / 7;
r5613r5614
461482      int numchunks;
462483
463484      // disassemble
464      pcdelta = (*opts.dasm->func)(NULL, buffer, curpc, oprom, oprom) & DASMFLAG_LENGTHMASK;
485      pcdelta = (*opts.dasm->func)(NULL, buffer, curpc, oprom, oprom, opts.mode) & DASMFLAG_LENGTHMASK;
465486      if (opts.dasm->pcshift < 0)
466487         numbytes = pcdelta << -opts.dasm->pcshift;
467488      else
r5613r5614
497518      if (opts.lower)
498519      {
499520         for (p = buffer; *p != 0; p++)
500            *p = tolower(*p);
501      } else if (opts.upper)
521            *p = tolower((UINT8)*p);
522      }
523      else if (opts.upper)
502524      {
503525         for (p = buffer; *p != 0; p++)
504            *p = toupper(*p);
526            *p = toupper((UINT8)*p);
505527      }
506528      printf("%s\n", buffer);
507529
r5613r5614
526548
527549      // advance
528550      curpc += pcdelta;
529      curbyte += numbytes;
530551   }
531552
532553   return 0;
src/osd/osdmini/minitime.c
r5613r5614
3434
3535
3636//============================================================
37//  osd_profiling_ticks
37//  get_profile_ticks
3838//============================================================
3939
40osd_ticks_t osd_profiling_ticks(void)
40osd_ticks_t get_profile_ticks(void)
4141{
4242   // on x86 platforms, we should return the value of RDTSC here
4343   // generically, we fall back to clock(), which hopefully is
src/osd/osdcore.h
r5613r5614
352352-----------------------------------------------------------------------------*/
353353osd_ticks_t osd_ticks(void);
354354
355
356355/*-----------------------------------------------------------------------------
357356    osd_ticks_per_second: return the number of ticks per second
358357
r5613r5614
367366-----------------------------------------------------------------------------*/
368367osd_ticks_t osd_ticks_per_second(void);
369368
370
371369/*-----------------------------------------------------------------------------
372    osd_profiling_ticks: return the current running "profiling" tick counter
373
374    Parameters:
375
376        None
377
378    Return value:
379
380        an osd_ticks_t value which represents the current "profiling" tick
381        counter
382
383    Notes:
384
385        The profiling tick counter may or may not be different from the
386        regular tick counter. However, the profiling counter has differing
387        requirements. First, it must be as fast as possible, so as not to
388        perturb profiling measurements in a significant way. Second, it
389        should be a high resolution as possible to provide accurate short-
390        term measurements (1us resolution or better is ideal). Third, it
391        is not necessary to calibrate the timing (hence the lack of an
392        osd_profiling_ticks_per_second call).
393
394        On x86 system, this generally maps to an RDTSC instruction.
395-----------------------------------------------------------------------------*/
396osd_ticks_t osd_profiling_ticks(void);
397
398
399/*-----------------------------------------------------------------------------
400370    osd_sleep: sleep for the specified time interval
401371
402372    Parameters:
src/osd/windows/wintime.c
r5613r5614
7777
7878
7979//============================================================
80//  osd_profiling_ticks
81//============================================================
82
83#ifdef _MSC_VER
84
85#ifdef PTR64
86
87osd_ticks_t osd_profiling_ticks(void)
88{
89   return __rdtsc();
90}
91
92#else
93
94osd_ticks_t osd_profiling_ticks(void)
95{
96   INT64 result;
97   INT64 *presult = &result;
98
99   __asm {
100      __asm _emit 0Fh __asm _emit 031h   // rdtsc
101      mov ebx, presult
102      mov [ebx],eax
103      mov [ebx+4],edx
104   }
105
106   return result;
107}
108
109#endif
110
111#else
112
113osd_ticks_t osd_profiling_ticks(void)
114{
115   INT64 result;
116
117   // use RDTSC
118   __asm__ __volatile__ (
119      "rdtsc"
120      : "=A" (result)
121   );
122
123   return result;
124}
125
126#endif
127
128
129//============================================================
13080//  osd_sleep
13181//============================================================
13282
src/osd/windows/input.c
r5613r5614
538538      winwindow_process_events_periodic(machine);
539539
540540      // track if mouse/lightgun is enabled, for mouse hiding purposes
541      mouse_enabled = input_device_class_enabled(DEVICE_CLASS_MOUSE);
542      lightgun_enabled = input_device_class_enabled(DEVICE_CLASS_LIGHTGUN);
541      mouse_enabled = input_device_class_enabled(machine, DEVICE_CLASS_MOUSE);
542      lightgun_enabled = input_device_class_enabled(machine, DEVICE_CLASS_LIGHTGUN);
543543   }
544544
545545   // poll all of the devices
src/osd/windows/winwork.c
r5613r5614
4444
4545#if KEEP_STATISTICS
4646#define add_to_stat(v,x)      do { interlocked_add((v), (x)); } while (0)
47#define begin_timing(v)         do { (v) -= osd_profiling_ticks(); } while (0)
48#define end_timing(v)         do { (v) += osd_profiling_ticks(); } while (0)
47#define begin_timing(v)         do { (v) -= get_profile_ticks(); } while (0)
48#define end_timing(v)         do { (v) += get_profile_ticks(); } while (0)
4949#else
5050#define add_to_stat(v,x)      do { } while (0)
5151#define begin_timing(v)         do { } while (0)
src/osd/windows/eivcx86.h
r5613r5614
460460}
461461#endif
462462
463
464
465/***************************************************************************
466    INLINE TIMING FUNCTIONS
467***************************************************************************/
468
469/*-------------------------------------------------
470    get_profile_ticks - return a tick counter
471    from the processor that can be used for
472    profiling. It does not need to run at any
473    particular rate.
474-------------------------------------------------*/
475
476#define get_profile_ticks _get_profile_ticks
477
478#ifdef PTR64
479
480INLINE osd_ticks_t _get_profile_ticks(void)
481{
482   return __rdtsc();
483}
484
485#else
486
487INLINE osd_ticks_t _get_profile_ticks(void)
488{
489   INT64 result;
490   INT64 *presult = &result;
491
492   __asm {
493      __asm _emit 0Fh __asm _emit 031h   // rdtsc
494      mov ebx, presult
495      mov [ebx],eax
496      mov [ebx+4],edx
497   }
498
499   return result;
500}
501
502#endif
503
463504#endif /* __EIVCX86__ */
src/osd/winui/mui_opts.c
r5613r5614
708708   const char *seq_string;
709709
710710   seq_string = options_get_string(opts, name);
711   input_seq_from_tokens(seq_string, &seq);
711   input_seq_from_tokens(NULL, seq_string, &seq);   // HACK
712712   return &seq;
713713}
714714
src/emu/debug/debugcpu.c
r5613r5614
391391
392392   /* check for disassembler override */
393393   if (info->dasm_override != NULL)
394      result = (*info->dasm_override)(device, buffer, pc, oprom, opram);
394      result = (*info->dasm_override)(device, buffer, pc, oprom, opram, 0);
395395
396396   /* if we have a disassembler, run it */
397397   if (result == 0 && info->disassemble != NULL)
398      result = (*info->disassemble)(device, buffer, pc, oprom, opram);
398      result = (*info->disassemble)(device, buffer, pc, oprom, opram, 0);
399399
400400   /* if we still have nothing, output vanilla bytes */
401401   if (result == 0)
r5613r5614
669669      debugger_refresh_display(device->machine);
670670
671671      /* wait for the debugger; during this time, disable sound output */
672      sound_mute(TRUE);
672      sound_mute(device->machine, TRUE);
673673      while (global->execution_state == EXECUTION_STATE_STOPPED)
674674      {
675675         /* flush any pending updates before waiting again */
r5613r5614
694694         if (mame_is_scheduled_event_pending(device->machine))
695695            global->execution_state = EXECUTION_STATE_RUNNING;
696696      }
697      sound_mute(FALSE);
697      sound_mute(device->machine, FALSE);
698698
699699      /* remember the last visible CPU in the debugger */
700700      global->visiblecpu = device;
r5613r5614
15311531
15321532
15331533/*-------------------------------------------------
1534    debug_read_memory - return 1,2,4 or 8 bytes
1535    from the specified memory space
1536-------------------------------------------------*/
1537
1538UINT64 debug_read_memory(const address_space *space, offs_t address, int size, int apply_translation)
1539{
1540   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
1541   switch (size)
1542   {
1543      case 1:      result = debug_read_byte(space, address, apply_translation);   break;
1544      case 2:      result = debug_read_word(space, address, apply_translation);   break;
1545      case 4:      result = debug_read_dword(space, address, apply_translation);   break;
1546      case 8:      result = debug_read_qword(space, address, apply_translation);   break;
1547   }
1548   return result;
1549}
1550
1551
1552/*-------------------------------------------------
15341553    debug_write_byte - write a byte to the
15351554    specified memory space
15361555-------------------------------------------------*/
r5613r5614
17271746
17281747
17291748/*-------------------------------------------------
1749    debug_write_memory - write 1,2,4 or 8 bytes
1750    to the specified memory space
1751-------------------------------------------------*/
1752
1753void debug_write_memory(const address_space *space, offs_t address, UINT64 data, int size, int apply_translation)
1754{
1755   switch (size)
1756   {
1757      case 1:      debug_write_byte(space, address, data, apply_translation);   break;
1758      case 2:      debug_write_word(space, address, data, apply_translation);   break;
1759      case 4:      debug_write_dword(space, address, data, apply_translation);   break;
1760      case 8:      debug_write_qword(space, address, data, apply_translation);   break;
1761   }
1762}
1763
1764
1765/*-------------------------------------------------
17301766    debug_read_opcode - read 1,2,4 or 8 bytes at
17311767    the given offset from opcode space
17321768-------------------------------------------------*/
r5613r5614
24712507   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
24722508
24732509   if (space != NULL)
2474   {
2475      /* adjust the address into a byte address */
2476      address = memory_address_to_byte(space, address);
2477
2478      /* switch contexts and do the read */
2479      switch (size)
2480      {
2481         case 1:      result = debug_read_byte(space, address, TRUE);      break;
2482         case 2:      result = debug_read_word(space, address, TRUE);      break;
2483         case 4:      result = debug_read_dword(space, address, TRUE);   break;
2484         case 8:      result = debug_read_qword(space, address, TRUE);   break;
2485      }
2486   }
2510      result = debug_read_memory(space, memory_address_to_byte(space, address), size, TRUE);
24872511   return result;
24882512}
24892513
r5613r5614
26772701static void expression_write_address_space(const address_space *space, offs_t address, int size, UINT64 data)
26782702{
26792703   if (space != NULL)
2680   {
2681      /* adjust the address into a byte address */
2682      address = memory_address_to_byte(space, address);
2683
2684      /* switch contexts and do the write */
2685      switch (size)
2686      {
2687         case 1:      debug_write_byte(space, address, data, TRUE);   break;
2688         case 2:      debug_write_word(space, address, data, TRUE);   break;
2689         case 4:      debug_write_dword(space, address, data, TRUE);   break;
2690         case 8:      debug_write_qword(space, address, data, TRUE);   break;
2691      }
2692   }
2704      debug_write_memory(space, memory_address_to_byte(space, address), data, size, TRUE);
26932705}
26942706
26952707
src/emu/debug/debugcpu.h
r5613r5614
336336/* return a qword from the the specified memory space */
337337UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_translation);
338338
339/* return 1,2,4 or 8 bytes from the specified memory space */
340UINT64 debug_read_memory(const address_space *space, offs_t address, int size, int apply_translation);
341
339342/* write a byte to the specified memory space */
340343void debug_write_byte(const address_space *space, offs_t address, UINT8 data, int apply_translation);
341344
r5613r5614
348351/* write a qword to the specified memory space */
349352void debug_write_qword(const address_space *space, offs_t address, UINT64 data, int apply_translation);
350353
354/* write 1,2,4 or 8 bytes to the specified memory space */
355void debug_write_memory(const address_space *space, offs_t address, UINT64 data, int size, int apply_translation);
356
351357/* read 1,2,4 or 8 bytes at the given offset from opcode space */
352358UINT64 debug_read_opcode(const address_space *space, offs_t offset, int size, int arg);
353359
src/emu/debug/debugcmd.c
r5613r5614
4141   UINT32      size;
4242};
4343
44typedef struct _cheat_map cheat_map;
45struct _cheat_map
46{
47   UINT64      offset;
48   UINT64      first_value;
49   UINT64      previous_value;
50   UINT8      state:1;
51   UINT8      undo:7;
52};
4453
54typedef struct _cheat_system cheat_system;
55struct _cheat_system
56{
57   char         cpu;
58   UINT64         length;
59   UINT8         width;
60   cheat_map *      cheatmap;
61   UINT8         undo;
62   UINT8         signed_cheat;
63};
4564
65
4666/***************************************************************************
4767    GLOBAL VARIABLES
4868***************************************************************************/
4969
5070static global_entry global_array[MAX_GLOBALS];
71static cheat_system cheat;
5172
5273
5374
r5613r5614
96117static void execute_hotspot(running_machine *machine, int ref, int params, const char **param);
97118static void execute_save(running_machine *machine, int ref, int params, const char **param);
98119static void execute_dump(running_machine *machine, int ref, int params, const char **param);
120static void execute_cheatinit(running_machine *machine, int ref, int params, const char **param);
121static void execute_cheatnext(running_machine *machine, int ref, int params, const char **param);
122static void execute_cheatlist(running_machine *machine, int ref, int params, const char **param);
123static void execute_cheatundo(running_machine *machine, int ref, int params, const char **param);
99124static void execute_dasm(running_machine *machine, int ref, int params, const char **param);
100125static void execute_find(running_machine *machine, int ref, int params, const char **param);
101126static void execute_trace(running_machine *machine, int ref, int params, const char **param);
r5613r5614
113138
114139
115140/***************************************************************************
141    INLINE FUNCTIONS
142***************************************************************************/
143
144/*-------------------------------------------------
145    cheat_address_is_valid - return TRUE if the
146    given address is valid for cheating
147-------------------------------------------------*/
148
149INLINE int cheat_address_is_valid(const address_space *space, offs_t address)
150{
151   return debug_cpu_translate(space, TRANSLATE_READ, &address) && (memory_get_write_ptr(space, address) != NULL);
152}
153
154
155/*-------------------------------------------------
156    cheat_sign_extend - sign-extend a value to
157    the current cheat width, if signed
158-------------------------------------------------*/
159
160INLINE UINT64 cheat_sign_extend(const cheat_system *cheatsys, UINT64 value)
161{
162   if (cheatsys->signed_cheat)
163   {
164      switch (cheatsys->width)
165      {
166         case 1:   value = (INT8)value;   break;
167         case 2:   value = (INT16)value;   break;
168         case 4:   value = (INT32)value;   break;
169      }
170   }
171   return value;
172}
173
174
175/*-------------------------------------------------
176    cheat_read_extended - read a value from memory
177    in the given address space, sign-extending
178    if necessary
179-------------------------------------------------*/
180
181INLINE UINT64 cheat_read_extended(const cheat_system *cheatsys, const address_space *space, offs_t address)
182{
183   return cheat_sign_extend(cheatsys, debug_read_memory(space, address, cheatsys->width, TRUE));
184}
185
186
187
188/***************************************************************************
116189    INITIALIZATION
117190***************************************************************************/
118191
r5613r5614
215288   debug_console_register_command(machine, "dumpd",     CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 6, execute_dump);
216289   debug_console_register_command(machine, "dumpi",     CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 6, execute_dump);
217290
291   debug_console_register_command(machine, "cheatinit", CMDFLAG_NONE, 0, 0, 4, execute_cheatinit);
292   debug_console_register_command(machine, "ci",        CMDFLAG_NONE, 0, 0, 4, execute_cheatinit);
293
294   debug_console_register_command(machine, "cheatrange",CMDFLAG_NONE, 1, 2, 2, execute_cheatinit);
295   debug_console_register_command(machine, "cr",        CMDFLAG_NONE, 1, 2, 2, execute_cheatinit);
296
297   debug_console_register_command(machine, "cheatnext", CMDFLAG_NONE, 0, 1, 2, execute_cheatnext);
298   debug_console_register_command(machine, "cn",        CMDFLAG_NONE, 0, 1, 2, execute_cheatnext);
299   debug_console_register_command(machine, "cheatnextf",CMDFLAG_NONE, 1, 1, 2, execute_cheatnext);
300   debug_console_register_command(machine, "cnf",       CMDFLAG_NONE, 1, 1, 2, execute_cheatnext);
301
302   debug_console_register_command(machine, "cheatlist", CMDFLAG_NONE, 0, 0, 1, execute_cheatlist);
303   debug_console_register_command(machine, "cl",        CMDFLAG_NONE, 0, 0, 1, execute_cheatlist);
304
305   debug_console_register_command(machine, "cheatundo", CMDFLAG_NONE, 0, 0, 0, execute_cheatundo);
306   debug_console_register_command(machine, "cu",        CMDFLAG_NONE, 0, 0, 0, execute_cheatundo);
307
218308   debug_console_register_command(machine, "f",         CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find);
219309   debug_console_register_command(machine, "find",      CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find);
220310   debug_console_register_command(machine, "fd",        CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_DATA, 3, MAX_COMMAND_PARAMS, execute_find);
r5613r5614
273363   /* turn off all traces */
274364   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
275365      debug_cpu_trace(cpu, NULL, 0, NULL);
366
367   if (cheat.length)
368      free(cheat.cheatmap);
276369}
277370
278371
r5613r5614
16561749
16571750
16581751/*-------------------------------------------------
1752   execute_cheatinit - initialize the cheat system
1753-------------------------------------------------*/
1754
1755static void execute_cheatinit(running_machine *machine, int ref, int params, const char *param[])
1756{
1757   UINT64 offset, endoffset, length = 0, real_length = 0;
1758   const address_space *space;
1759   UINT32 active_cheat = 0;
1760   UINT64 curaddr;
1761
1762   /* validate parameters */
1763   if (!debug_command_parameter_cpu_space(machine, (params > 3) ? param[3] : NULL, ADDRESS_SPACE_PROGRAM, &space))
1764      return;
1765
1766   if (ref == 0)
1767   {
1768      if (params > 0)
1769      {
1770         if (!strcmp(param[0], "sb"))
1771         {
1772            cheat.width = 1;
1773            cheat.signed_cheat = TRUE;
1774         }
1775         else if (!strcmp(param[0], "sw"))
1776         {
1777            cheat.width = 2;
1778            cheat.signed_cheat = TRUE;
1779         }
1780         else if (!strcmp(param[0], "sd"))
1781         {
1782            cheat.width = 4;
1783            cheat.signed_cheat = TRUE;
1784         }
1785         else if (!strcmp(param[0], "sq"))
1786         {
1787            cheat.width = 8;
1788            cheat.signed_cheat = TRUE;
1789         }
1790         else if (!strcmp(param[0], "ub"))
1791         {
1792            cheat.width = 1;
1793            cheat.signed_cheat = FALSE;
1794         }
1795         else if (!strcmp(param[0], "uw"))
1796         {
1797            cheat.width = 2;
1798            cheat.signed_cheat = FALSE;
1799         }
1800         else if (!strcmp(param[0], "ud"))
1801         {
1802            cheat.width = 4;
1803            cheat.signed_cheat = FALSE;
1804         }
1805         else if (!strcmp(param[0], "uq"))
1806         {
1807            cheat.width = 8;
1808            cheat.signed_cheat = FALSE;
1809         }
1810         else
1811         {
1812            debug_console_printf(machine, "Invalid type: expected ub, uw, ud, uq, sb, sw, sd or sq\n");
1813            return;
1814         }
1815      }
1816      else
1817      {
1818         cheat.width = 1;
1819         cheat.signed_cheat = FALSE;
1820      }
1821   }
1822
1823   if (params > 1)
1824   {
1825      if (!debug_command_parameter_number(machine, param[(ref == 0) ? 1 : 0], &offset))
1826         return;
1827      if (!debug_command_parameter_number(machine, param[(ref == 0) ? 2 : 1], &length))
1828         return;
1829   }
1830   else
1831   {
1832      /* initialize entire memory  */
1833      offset = 0;
1834      length = space->bytemask + 1;
1835   }
1836
1837   endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;
1838   offset = memory_address_to_byte(space, offset) & space->bytemask;
1839
1840   /* counts the writable bytes in the area */
1841   for (curaddr = offset; curaddr <= endoffset; curaddr += cheat.width)
1842      if (cheat_address_is_valid(space, curaddr))
1843         real_length++;
1844
1845   if (real_length == 0)
1846   {
1847      debug_console_printf(machine, "No writable bytes found in this area\n");
1848      return;
1849   }
1850
1851   if (ref == 0)
1852   {
1853      /* initialize new cheat system */
1854      if (cheat.cheatmap != NULL)
1855         free(cheat.cheatmap);
1856      cheat.cheatmap = malloc(real_length * sizeof(cheat_map));
1857      if (cheat.cheatmap == NULL)
1858      {
1859         debug_console_printf(machine, "Unable of allocate the necessary memory\n");
1860         return;
1861      }
1862
1863      cheat.length = real_length;
1864      cheat.undo = 0;
1865      cheat.cpu = (params > 3) ? *param[3] : '0';
1866   }
1867   else
1868   {
1869      /* add range to cheat system */
1870      cheat_map * cheatmap_bak = cheat.cheatmap;
1871
1872      if (cheat.cpu == 0)
1873      {
1874         debug_console_printf(machine, "Use cheatinit before cheatrange\n");
1875         return;
1876      }
1877
1878      if (!debug_command_parameter_cpu_space(machine, &cheat.cpu, ADDRESS_SPACE_PROGRAM, &space))
1879         return;
1880
1881      cheat.cheatmap = realloc(cheat.cheatmap, (cheat.length + real_length) * sizeof(cheat_map));
1882      if (cheat.cheatmap == NULL)
1883      {
1884         cheat.cheatmap = cheatmap_bak;
1885         debug_console_printf(machine, "Unable of allocate the necessary memory\n");
1886         return;
1887      }
1888
1889      active_cheat = cheat.length;
1890      cheat.length += real_length;
1891   }
1892
1893   /* initialize cheatmap in the selected space */
1894   for (curaddr = offset; curaddr <= endoffset; curaddr += cheat.width)
1895      if (cheat_address_is_valid(space, curaddr))
1896      {
1897         cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&cheat, space, curaddr);
1898         cheat.cheatmap[active_cheat].first_value = cheat.cheatmap[active_cheat].previous_value;
1899         cheat.cheatmap[active_cheat].offset = curaddr;
1900         cheat.cheatmap[active_cheat].state = 1;
1901         cheat.cheatmap[active_cheat].undo = 0;
1902         active_cheat++;
1903      }
1904
1905   debug_console_printf(machine, "%u cheat initialized\n", active_cheat);
1906}
1907
1908
1909/*-------------------------------------------------
1910    execute_cheatnext - execute the search
1911-------------------------------------------------*/
1912
1913static void execute_cheatnext(running_machine *machine, int ref, int params, const char *param[])
1914{
1915   const address_space *space;
1916   UINT64 cheatindex;
1917   UINT32 active_cheat = 0;
1918   UINT8 condition;
1919   UINT64 comp_value = 0;
1920
1921   enum
1922   {
1923      CHEAT_ALL = 0,
1924      CHEAT_EQUAL,
1925      CHEAT_NOTEQUAL,
1926      CHEAT_EQUALTO,
1927      CHEAT_NOTEQUALTO,
1928      CHEAT_DECREASE,
1929      CHEAT_INCREASE,
1930      CHEAT_DECREASEOF,
1931      CHEAT_INCREASEOF,
1932      CHEAT_SMALLEROF,
1933      CHEAT_GREATEROF
1934   };
1935
1936   if (cheat.cpu == 0)
1937   {
1938      debug_console_printf(machine, "Use cheatinit before cheatnext\n");
1939      return;
1940   }
1941
1942   if (!debug_command_parameter_cpu_space(machine, &cheat.cpu, ADDRESS_SPACE_PROGRAM, &space))
1943      return;
1944
1945   if (params > 1 && !debug_command_parameter_number(machine, param[1], &comp_value))
1946      return;
1947   comp_value = cheat_sign_extend(&cheat, comp_value);
1948
1949   /* decode contidion */
1950   if (!strcmp(param[0], "all"))
1951      condition = CHEAT_ALL;
1952   else if (!strcmp(param[0], "equal") || !strcmp(param[0], "eq"))
1953      condition = (params > 1) ? CHEAT_EQUALTO : CHEAT_EQUAL;
1954   else if (!strcmp(param[0], "notequal") || !strcmp(param[0], "ne"))
1955      condition = (params > 1) ? CHEAT_NOTEQUALTO : CHEAT_NOTEQUAL;
1956   else if (!strcmp(param[0], "decrease") || !strcmp(param[0], "de") || !strcmp(param[0], "-"))
1957      condition = (params > 1) ? CHEAT_DECREASEOF : CHEAT_DECREASE;
1958   else if (!strcmp(param[0], "increase") || !strcmp(param[0], "in") || !strcmp(param[0], "+"))
1959      condition = (params > 1) ? CHEAT_INCREASEOF : CHEAT_INCREASE;
1960   else if (!strcmp(param[0], "smallerof") || !strcmp(param[0], "lt") || !strcmp(param[0], "<"))
1961      condition = CHEAT_SMALLEROF;
1962   else if (!strcmp(param[0], "greaterof") || !strcmp(param[0], "gt") || !strcmp(param[0], ">"))
1963      condition = CHEAT_GREATEROF;
1964   else
1965   {
1966      debug_console_printf(machine, "Invalid condition type\n");
1967      return;
1968   }
1969
1970   cheat.undo++;
1971
1972   /* execute the search */
1973   for (cheatindex = 0; cheatindex < cheat.length; cheatindex += 1)
1974      if (cheat.cheatmap[cheatindex].state == 1)
1975      {
1976         UINT64 cheat_value = cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset);
1977         UINT64 comp_byte = (ref == 0) ? cheat.cheatmap[cheatindex].previous_value : cheat.cheatmap[cheatindex].first_value;
1978         UINT8 disable_byte = FALSE;
1979
1980         switch (condition)
1981         {
1982            case CHEAT_ALL:
1983               break;
1984
1985            case CHEAT_EQUAL:
1986               disable_byte = (cheat_value != comp_byte);
1987               break;
1988
1989            case CHEAT_NOTEQUAL:
1990               disable_byte = (cheat_value == comp_byte);
1991               break;
1992
1993            case CHEAT_EQUALTO:
1994               disable_byte = (cheat_value != comp_value);
1995               break;
1996
1997            case CHEAT_NOTEQUALTO:
1998               disable_byte = (cheat_value == comp_value);
1999               break;
2000
2001            case CHEAT_DECREASE:
2002               if (cheat.signed_cheat)
2003                  disable_byte = ((INT64)cheat_value >= (INT64)comp_byte);
2004               else
2005                  disable_byte = ((UINT64)cheat_value >= (UINT64)comp_byte);
2006               break;
2007
2008            case CHEAT_INCREASE:
2009               if (cheat.signed_cheat)
2010                  disable_byte = ((INT64)cheat_value <= (INT64)comp_byte);
2011               else
2012                  disable_byte = ((UINT64)cheat_value <= (UINT64)comp_byte);
2013               break;
2014
2015            case CHEAT_DECREASEOF:
2016               disable_byte = (cheat_value != comp_byte - comp_value);
2017               break;
2018
2019            case CHEAT_INCREASEOF:
2020               disable_byte = (cheat_value != comp_byte + comp_value);
2021               break;
2022
2023            case CHEAT_SMALLEROF:
2024               if (cheat.signed_cheat)
2025                  disable_byte = ((INT64)cheat_value >= (INT64)comp_value);
2026               else
2027                  disable_byte = ((UINT64)cheat_value >= (UINT64)comp_value);
2028               break;
2029
2030            case CHEAT_GREATEROF:
2031               if (cheat.signed_cheat)
2032                  disable_byte = ((INT64)cheat_value <= (INT64)comp_value);
2033               else
2034                  disable_byte = ((UINT64)cheat_value <= (UINT64)comp_value);
2035               break;
2036         }
2037
2038         if (disable_byte)
2039         {
2040            cheat.cheatmap[cheatindex].state = 0;
2041            cheat.cheatmap[cheatindex].undo = cheat.undo;
2042         }
2043         else
2044            active_cheat++;
2045
2046         /* update previous value */
2047         cheat.cheatmap[cheatindex].previous_value = cheat_value;
2048      }
2049
2050   if (active_cheat <= 5)
2051      execute_cheatlist(machine, 0, 0, NULL);
2052
2053   debug_console_printf(machine, "%u cheats found\n", active_cheat);
2054}
2055
2056
2057/*-------------------------------------------------
2058    execute_cheatlist - show a list of active cheat
2059-------------------------------------------------*/
2060
2061static void execute_cheatlist(running_machine *machine, int ref, int params, const char *param[])
2062{
2063   char spaceletter, sizeletter;
2064   const address_space *space;
2065   UINT32 active_cheat = 0;
2066   UINT64 cheatindex;
2067   UINT64 sizemask;
2068   FILE *f = NULL;
2069
2070   if (!debug_command_parameter_cpu_space(machine, &cheat.cpu, ADDRESS_SPACE_PROGRAM, &space))
2071      return;
2072
2073   if (params > 0)
2074      f = fopen(param[0], "w");
2075
2076   switch (space->spacenum)
2077   {
2078      default:
2079      case ADDRESS_SPACE_PROGRAM:   spaceletter = 'p';   break;
2080      case ADDRESS_SPACE_DATA:   spaceletter = 'd';   break;
2081      case ADDRESS_SPACE_IO:      spaceletter = 'i';   break;
2082   }
2083
2084   switch (cheat.width)
2085   {
2086      default:
2087      case 1:                  sizeletter = 'b';   sizemask = 0xff;               break;
2088      case 2:                  sizeletter = 'w';   sizemask = 0xffff;               break;
2089      case 4:                  sizeletter = 'd';   sizemask = 0xffffffff;            break;
2090      case 8:                  sizeletter = 'q';   sizemask = U64(0xffffffffffffffff);   break;
2091   }
2092
2093   /* write the cheat list */
2094   for (cheatindex = 0; cheatindex < cheat.length; cheatindex += 1)
2095   {
2096      if (cheat.cheatmap[cheatindex].state == 1)
2097      {
2098         UINT64 value = cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset) & sizemask;
2099         offs_t address = memory_byte_to_address(space, cheat.cheatmap[cheatindex].offset);
2100
2101         if (params > 0)
2102         {
2103            active_cheat++;
2104            fprintf(f, "  <cheat desc=\"Possibility %d : %0*X (%0*" I64FMT "X)\">\n", active_cheat, space->logaddrchars, address, cheat.width * 2, value);
2105            fprintf(f, "    <script state=\"run\">\n");
2106            fprintf(f, "      <action>maincpu.%c%c@%0*X=%0*" I64FMT "X</action>\n", spaceletter, sizeletter, space->logaddrchars, address, cheat.width * 2, cheat.cheatmap[cheatindex].first_value & sizemask);
2107            fprintf(f, "    </script>\n");
2108            fprintf(f, "  </cheat>\n\n");
2109         }
2110         else
2111            debug_console_printf(machine, "Address=%0*X Start=%0*" I64FMT "X Current=%0*" I64FMT "X\n", space->logaddrchars, address, cheat.width * 2, cheat.cheatmap[cheatindex].first_value & sizemask, cheat.width * 2, value);
2112      }
2113   }
2114   if (params > 0)
2115      fclose(f);
2116}
2117
2118
2119/*-------------------------------------------------
2120    execute_cheatundo - undo the last search
2121-------------------------------------------------*/
2122
2123static void execute_cheatundo(running_machine *machine, int ref, int params, const char *param[])
2124{
2125   UINT64 cheatindex;
2126   UINT32 undo_count = 0;
2127
2128   if (cheat.undo > 0)
2129   {
2130      for (cheatindex = 0; cheatindex < cheat.length; cheatindex += 1)
2131      {
2132         if (cheat.cheatmap[cheatindex].undo == cheat.undo)
2133         {
2134            cheat.cheatmap[cheatindex].state = 1;
2135            cheat.cheatmap[cheatindex].undo = 0;
2136            undo_count++;
2137         }
2138      }
2139
2140      cheat.undo--;
2141      debug_console_printf(machine, "%u cheat reactivated\n", undo_count);
2142   }
2143   else
2144      debug_console_printf(machine, "Maximum undo reached\n");
2145}
2146
2147
2148/*-------------------------------------------------
16592149    execute_find - execute the find command
16602150-------------------------------------------------*/
16612151
src/emu/debug/debughlp.c
r5613r5614
6969      "  Watchpoints\n"
7070      "  Expressions\n"
7171      "  Comments\n"
72      "  Cheats\n"
7273   },
7374   {
7475      "general",
r5613r5614
204205      "\n"
205206   },
206207   {
208      "cheats",
209      "\n"
210      "Cheat Commands\n"
211      "Type help <command> for further details on each command\n"
212      "\n"
213      "  cheatinit [<address>,<length>[,<cpu>]] -- initialize the cheat search to the selected memory area\n"
214      "  cheatrange <address>,<length> -- add to the cheat search the selected memory area\n"
215      "  cheatnext <condition>[,<comparisonvalue>] -- continue cheat search comparing with the the last value\n"
216      "  cheatnextf <condition>[,<comparisonvalue>] -- continue cheat search comparing with the the first value\n"
217      "  cheatlist [<filename>] -- show the list of cheat search matches or save them to <filename>\n"
218      "  cheatundo [<wpnum>] -- undo the last cheat search (state only)\n"
219   },
220   {
207221      "do",
208222      "\n"
209223      "  do <expression>\n"
r5613r5614
10291043      "comdelete 10\n"
10301044      "  Deletes the comment at code address 0x10 (using the current memory bank settings)\n"
10311045      "\n"
1046   },
1047   {
1048      "cheatinit",
1049      "\n"
1050      "  cheatinit [<type>,[<address>,<length>[,<cpu>]]]\n"
1051      "\n"
1052      "The cheatinit command initializes the cheat search to the selected memory area.\n"
1053      "If no parameter is specified the cheat search is initialized to all changeable memory of the main cpu.\n"
1054      "Possible <type>:\n"
1055      "  ub\n"
1056      "   8 bit unsigned int\n"
1057      "  uw\n"
1058      "   16 bit unsigned int\n"
1059      "  ud\n"
1060      "   32 bit unsigned int\n"
1061      "  uq\n"
1062      "   64 bit unsigned int\n"
1063      "  sb\n"
1064      "   8 bit signed int\n"
1065      "  sw\n"
1066      "   16 bit signed int\n"
1067      "  sd\n"
1068      "   32 bit signed int\n"
1069      "  sq\n"
1070      "   64 bit signed int\n"
1071      "\n"
1072      "Examples:\n"
1073      "\n"
1074      "cheatinit ub,0x1000,0x10\n"
1075      "  Initialize the cheat search from 0x1000 to 0x1010 of the first CPU.\n"
1076      "\n"
1077      "cheatinit sw,0x2000,0x1000,1\n"
1078      "  Initialize the cheat search with width of 2 byte in signed mode from 0x2000 to 0x3000 of the second CPU.\n"
1079   },
1080   {
1081      "cheatrange",
1082      "\n"
1083      "  cheatrange <address>,<length>\n"
1084      "\n"
1085      "The cheatrange command adds the selected memory area to the cheat search.\n"
1086      "Before using cheatrange it is necessary to initialize the cheat search with cheatinit.\n"
1087      "\n"
1088      "Examples:\n"
1089      "\n"
1090      "cheatrange 0x1000,0x10\n"
1091      "  Add the bytes from 0x1000 to 0x1010 to the cheat search.\n"
1092   },
1093   {
1094      "cheatnext",
1095      "\n"
1096      "  cheatnext <condition>[,<comparisonvalue>]\n"
1097      "\n"
1098      "The cheatnext command will make comparisons with the last search matches.\n"
1099      "Possible <condition>:\n"
1100      "  all\n"
1101      "   no <comparisonvalue> needed.\n"
1102      "   use to update the last value without changing the current matches.\n"
1103      "  equal [eq]\n"
1104      "   without <comparisonvalue> search for all bytes that are equal to the last search.\n"
1105      "   with <comparisonvalue> search for all bytes that are equal to the <comparisonvalue>.\n"
1106      "  notequal [ne]\n"
1107      "   without <comparisonvalue> search for all bytes that are not equal to the last search.\n"
1108      "   with <comparisonvalue> search for all bytes that are not equal to the <comparisonvalue>.\n"
1109      "  decrease [de, +]\n"
1110      "   without <comparisonvalue> search for all bytes that have decreased since the last search.\n"
1111      "   with <comparisonvalue> search for all bytes that have decreased by the <comparisonvalue> since the last search.\n"
1112      "  increase [in, -]\n"
1113      "   without <comparisonvalue> search for all bytes that have increased since the last search.\n"
1114      "   with <comparisonvalue> search for all bytes that have increased by the <comparisonvalue> since the last search.\n"
1115      "  smallerof [lt]\n"
1116      "   without <comparisonvalue> this condition is invalid\n"
1117      "   with <comparisonvalue> search for all bytes that are smaller than the <comparisonvalue>.\n"
1118      "  greaterof [gt]\n"
1119      "   without <comparisonvalue> this condition is invalid\n"
1120      "   with <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.\n"
1121      "\n"
1122      "Examples:\n"
1123      "\n"
1124      "cheatnext increase\n"
1125      "  search for all bytes that have increased since the last search.\n"
1126      "\n"
1127      "cheatnext decrease, 1\n"
1128      "  search for all bytes that have decreased by 1 since the last search.\n"
1129   },
1130   {
1131      "cheatnextf",
1132      "\n"
1133      "  cheatnextf <condition>[,<comparisonvalue>]\n"
1134      "\n"
1135      "The cheatnextf command will make comparisons with the initial search.\n"
1136      "Possible <condition>:\n"
1137      "  all\n"
1138      "   no <comparisonvalue> needed.\n"
1139      "   use to update the last value without changing the current matches.\n"
1140      "  equal [eq]\n"
1141      "   without <comparisonvalue> search for all bytes that are equal to the initial search.\n"
1142      "   with <comparisonvalue> search for all bytes that are equal to the <comparisonvalue>.\n"
1143      "  notequal [ne]\n"
1144      "   without <comparisonvalue> search for all bytes that are not equal to the initial search.\n"
1145      "   with <comparisonvalue> search for all bytes that are not equal to the <comparisonvalue>.\n"
1146      "  decrease [de, +]\n"
1147      "   without <comparisonvalue> search for all bytes that have decreased since the initial search.\n"
1148      "   with <comparisonvalue> search for all bytes that have decreased by the <comparisonvalue> since the initial search.\n"
1149      "  increase [in, -]\n"
1150      "   without <comparisonvalue> search for all bytes that have increased since the initial search.\n"
1151      "   with <comparisonvalue> search for all bytes that have increased by the <comparisonvalue> since the initial search.\n"
1152      "  smallerof [lt]\n"
1153      "   without <comparisonvalue> this condition is invalid.\n"
1154      "   with <comparisonvalue> search for all bytes that are smaller than the <comparisonvalue>.\n"
1155      "  greaterof [gt]\n"
1156      "   without <comparisonvalue> this condition is invalid.\n"
1157      "   with <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.\n"
1158      "\n"
1159      "Examples:\n"
1160      "\n"
1161      "cheatnextf increase\n"
1162      "  search for all bytes that have increased since the initial search.\n"
1163      "\n"
1164      "cheatnextf decrease, 1\n"
1165      "  search for all bytes that have decreased by 1 since the initial search.\n"
1166   },
1167   {
1168      "cheatlist",
1169      "\n"
1170      "  cheatlist [<filename>]\n"
1171      "\n"
1172      "Without <filename> show the list of matches in the debug console.\n"
1173      "With <filename> save the list of matches in basic xml format to <filename>.\n"
1174      "\n"
1175      "Examples:\n"
1176      "\n"
1177      "cheatlist\n"
1178      "  Show the current matches in the debug console.\n"
1179      "cheatlist cheat.txt\n"
1180      "  Save the current matches to cheat.txt.\n"
1181   },
1182   {
1183      "  cheatundo\n"
1184      "\n"
1185      "Undo the results of the last search.\n"
1186      "The undo command has no effect on the last value.\n"
1187      "\n"
1188      "Examples:\n"
1189      "\n"
1190      "cheatundo\n"
1191      "  Undo the last search (state only).\n"
10321192   }
10331193};
10341194
src/emu/cpu/tms34010/34010gfx.c
r5613r5614
1111
1212
1313#define LOG_GFX_OPS 0
14#define LOGGFX(x) do { if (LOG_GFX_OPS && input_code_pressed(KEYCODE_L)) logerror x; } while (0)
14#define LOGGFX(x) do { if (LOG_GFX_OPS && input_code_pressed(tms->device->machine, KEYCODE_L)) logerror x; } while (0)
1515
1616
1717/* Graphics Instructions */
src/emu/cpu/cpu.mak
r5613r5614
15041504
15051505
15061506#-------------------------------------------------
1507# Zilog Z8
1508#-------------------------------------------------
1509
1510ifneq ($(filter Z8,$(CPUS)),)
1511OBJDIRS += $(CPUOBJ)/z8
1512CPUOBJS += $(CPUOBJ)/z8/z8.o
1513DASMOBJS += $(CPUOBJ)/z8/z8dasm.o
1514endif
1515
1516$(CPUOBJ)/z8/z8.o:   $(CPUSRC)/z8/z8.c \
1517               $(CPUSRC)/z8/z8ops.c \
1518               $(CPUSRC)/z8/z8.h
1519
1520
1521
1522#-------------------------------------------------
15231507# Zilog Z80
15241508#-------------------------------------------------
15251509
r5613r5614
15941578
15951579
15961580#-------------------------------------------------
1581# Zilog Z8
1582#-------------------------------------------------
1583
1584ifneq ($(filter Z8,$(CPUS)),)
1585OBJDIRS += $(CPUOBJ)/z8
1586CPUOBJS += $(CPUOBJ)/z8/z8.o
1587DASMOBJS += $(CPUOBJ)/z8/z8dasm.o
1588endif
1589
1590$(CPUOBJ)/z8/z8.o:   $(CPUSRC)/z8/z8.c \
1591               $(CPUSRC)/z8/z8ops.c \
1592               $(CPUSRC)/z8/z8.h
1593
1594
1595
1596#-------------------------------------------------
15971597# Argonaut SuperFX
15981598#-------------------------------------------------
15991599
src/emu/cpu/m37710/m37710op.h
r5613r5614
7777{
7878   address = ADDRESS_37710(address);
7979   if (address & 1)
80      return m37710_read_8(address) | m37710_read_8(address+1)<<8;
80      return m37710_read_8(address) | m37710_read_8((address)+1)<<8;
8181   else
8282      return m37710_read_16(address);
8383}
r5613r5614
22532253         CLK(CLK_OP + CLK_RMW8 + CLK_W_##MODE);                     \
22542254         DST    = EA_##MODE(cpustate);                                 \
22552255         REG_IM = read_8_##MODE(DST);                           \
2256         REG_IM2 = read_8_NORM(REG_PC);   \
2256         REG_IM2 = read_8_NORM(REG_PB | REG_PC);   \
22572257         REG_PC++;         \
22582258         write_8_##MODE(DST, REG_IM & ~REG_IM2);
22592259#else
r5613r5614
22612261         CLK(CLK_OP + CLK_RMW16 + CLK_W_##MODE);                     \
22622262         DST    = EA_##MODE(cpustate);                                 \
22632263         REG_IM = read_16_##MODE(DST);                           \
2264         REG_IM2 = read_16_NORM(REG_PC);   \
2264         REG_IM2 = read_16_NORM(REG_PB | REG_PC);   \
22652265         REG_PC+=2;         \
22662266         write_16_##MODE(DST, REG_IM & ~REG_IM2);
22672267#endif
r5613r5614
22732273         CLK(CLK_OP + CLK_RMW8 + CLK_W_##MODE);                     \
22742274         DST    = EA_##MODE(cpustate);                                 \
22752275         REG_IM = read_8_##MODE(DST);                           \
2276         REG_IM2 = read_8_NORM(REG_PC);   \
2276         REG_IM2 = read_8_NORM(REG_PB | REG_PC);   \
22772277         REG_PC++;         \
22782278         write_8_##MODE(DST, REG_IM | REG_IM2);
22792279#else
r5613r5614
22812281         CLK(CLK_OP + CLK_RMW16 + CLK_W_##MODE);                     \
22822282         DST    = EA_##MODE(cpustate);                                 \
22832283         REG_IM = read_16_##MODE(DST);                           \
2284         REG_IM2 = read_16_NORM(REG_PC);   \
2284         REG_IM2 = read_16_NORM(REG_PB | REG_PC);   \
22852285         REG_PC+=2;         \
22862286         write_16_##MODE(DST, REG_IM | REG_IM2);
22872287#endif
src/emu/cpu/sharc/sharcops.c
r5613r5614
27482748static void sharcop_unimplemented(SHARC_REGS *cpustate)
27492749{
27502750   char dasm[1000];
2751   CPU_DISASSEMBLE_NAME(sharc)(NULL, dasm, cpustate->pc, NULL, NULL);
2751   CPU_DISASSEMBLE_NAME(sharc)(NULL, dasm, cpustate->pc, NULL, NULL, 0);
27522752   mame_printf_debug("SHARC: %08X: %s\n", cpustate->pc, dasm);
27532753   fatalerror("SHARC: Unimplemented opcode %04X%08X at %08X", (UINT16)(cpustate->opcode >> 32), (UINT32)(cpustate->opcode), cpustate->pc);
27542754}
src/emu/cpu/tms57002/tms57002.c
r5613r5614
11041104   opr[1] = opcode >> 8;
11051105   opr[2] = opcode >> 16;
11061106
1107   CPU_DISASSEMBLE_NAME(tms57002)(0, buf, s->pc, opr, opr);
1107   CPU_DISASSEMBLE_NAME(tms57002)(0, buf, s->pc, opr, opr, 0);
11081108   popmessage("tms57002: %s - Contact Mamedev", buf);
11091109}
11101110
src/emu/cpu/i386/i386op16.c
r5613r5614
120120   if( modrm >= 0xc0 ) {
121121      src = LOAD_REG16(modrm);
122122      dst = LOAD_RM16(modrm);
123      src = ADD16(cpustate,src, cpustate->CF);
124      dst = ADD16(cpustate,dst, src);
123      dst = ADC16(cpustate, dst, src, cpustate->CF);
125124      STORE_RM16(modrm, dst);
126125      CYCLES(cpustate,CYCLES_ALU_REG_REG);
127126   } else {
128127      UINT32 ea = GetEA(cpustate,modrm);
129128      src = LOAD_REG16(modrm);
130129      dst = READ16(cpustate,ea);
131      src = ADD16(cpustate,src, cpustate->CF);
132      dst = ADD16(cpustate,dst, src);
130      dst = ADC16(cpustate, dst, src, cpustate->CF);
133131      WRITE16(cpustate,ea, dst);
134132      CYCLES(cpustate,CYCLES_ALU_REG_MEM);
135133   }
r5613r5614
142140   if( modrm >= 0xc0 ) {
143141      src = LOAD_RM16(modrm);
144142      dst = LOAD_REG16(modrm);
145      src = ADD16(cpustate,src, cpustate->CF);
146      dst = ADD16(cpustate,dst, src);
143      dst = ADC16(cpustate, dst, src, cpustate->CF);
147144      STORE_REG16(modrm, dst);
148145      CYCLES(cpustate,CYCLES_ALU_REG_REG);
149146   } else {
150147      UINT32 ea = GetEA(cpustate,modrm);
151148      src = READ16(cpustate,ea);
152149      dst = LOAD_REG16(modrm);
153      src = ADD16(cpustate,src, cpustate->CF);
154      dst = ADD16(cpustate,dst, src);
150      dst = ADC16(cpustate, dst, src, cpustate->CF);
155151      STORE_REG16(modrm, dst);
156152      CYCLES(cpustate,CYCLES_ALU_MEM_REG);
157153   }
r5613r5614
162158   UINT16 src, dst;
163159   src = FETCH16(cpustate);
164160   dst = REG16(AX);
165   src = ADD16(cpustate,src, cpustate->CF);
166   dst = ADD16(cpustate,dst, src);
161   dst = ADC16(cpustate, dst, src, cpustate->CF);
167162   REG16(AX) = dst;
168163   CYCLES(cpustate,CYCLES_ALU_IMM_ACC);
169164}
r5613r5614
17291724   UINT16 src, dst;
17301725   UINT8 modrm = FETCH(cpustate);
17311726   if( modrm >= 0xc0 ) {
1732      src = LOAD_REG16(modrm) + cpustate->CF;
1727      src = LOAD_REG16(modrm);
17331728      dst = LOAD_RM16(modrm);
1734      dst = SUB16(cpustate,dst, src);
1729      dst = SBB16(cpustate, dst, src, cpustate->CF);
17351730      STORE_RM16(modrm, dst);
17361731      CYCLES(cpustate,CYCLES_ALU_REG_REG);
17371732   } else {
17381733      UINT32 ea = GetEA(cpustate,modrm);
1739      src = LOAD_REG16(modrm) + cpustate->CF;
1734      src = LOAD_REG16(modrm);
17401735      dst = READ16(cpustate,ea);
1741      dst = SUB16(cpustate,dst, src);
1736      dst = SBB16(cpustate, dst, src, cpustate->CF);
17421737      WRITE16(cpustate,ea, dst);
17431738      CYCLES(cpustate,CYCLES_ALU_REG_MEM);
17441739   }
r5613r5614
17491744   UINT16 src, dst;
17501745   UINT8 modrm = FETCH(cpustate);
17511746   if( modrm >= 0xc0 ) {
1752      src = LOAD_RM16(modrm) + cpustate->CF;
1747      src = LOAD_RM16(modrm);
17531748      dst = LOAD_REG16(modrm);
1754      dst = SUB16(cpustate,dst, src);
1749      dst = SBB16(cpustate, dst, src, cpustate->CF);
17551750      STORE_REG16(modrm, dst);
17561751      CYCLES(cpustate,CYCLES_ALU_REG_REG);
17571752   } else {
17581753      UINT32 ea = GetEA(cpustate,modrm);
1759      src = READ16(cpustate,ea) + cpustate->CF;
1754      src = READ16(cpustate,ea);
17601755      dst = LOAD_REG16(modrm);
1761      dst = SUB16(cpustate,dst, src);
1756      dst = SBB16(cpustate, dst, src, cpustate->CF);
17621757      STORE_REG16(modrm, dst);
17631758      CYCLES(cpustate,CYCLES_ALU_MEM_REG);
17641759   }
r5613r5614
17671762static void I386OP(sbb_ax_i16)(i386_state *cpustate)      // Opcode 0x1d
17681763{
17691764   UINT16 src, dst;
1770   src = FETCH16(cpustate) + cpustate->CF;
1765   src = FETCH16(cpustate);
17711766   dst = REG16(AX);
1772   dst = SUB16(cpustate,dst, src);
1767   dst = SBB16(cpustate, dst, src, cpustate->CF);
17731768   REG16(AX) = dst;
17741769   CYCLES(cpustate,CYCLES_ALU_IMM_ACC);
17751770}
r5613r5614
22102205         if( modrm >= 0xc0 ) {
22112206            dst = LOAD_RM16(modrm);
22122207            src = FETCH16(cpustate);
2213            src = ADD16(cpustate,src, cpustate->CF);
2214            dst = ADD16(cpustate,dst, src);
2208            dst = ADC16(cpustate, dst, src, cpustate->CF);
22152209            STORE_RM16(modrm, dst);
22162210            CYCLES(cpustate,CYCLES_ALU_REG_REG);
22172211         } else {
22182212            ea = GetEA(cpustate,modrm);
22192213            dst = READ16(cpustate,ea);
22202214            src = FETCH16(cpustate);
2221            src = ADD16(cpustate,src, cpustate->CF);
2222            dst = ADD16(cpustate,dst, src);
2215            dst = ADC16(cpustate, dst, src, cpustate->CF);
22232216            WRITE16(cpustate,ea, dst);
22242217            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
22252218         }
r5613r5614
22272220      case 3:      // SBB Rm16, i16
22282221         if( modrm >= 0xc0 ) {
22292222            dst = LOAD_RM16(modrm);
2230            src = FETCH16(cpustate) + cpustate->CF;
2231            dst = SUB16(cpustate,dst, src);
2223            src = FETCH16(cpustate);
2224            dst = SBB16(cpustate, dst, src, cpustate->CF);
22322225            STORE_RM16(modrm, dst);
22332226            CYCLES(cpustate,CYCLES_ALU_REG_REG);
22342227         } else {
22352228            ea = GetEA(cpustate,modrm);
22362229            dst = READ16(cpustate,ea);
2237            src = FETCH16(cpustate) + cpustate->CF;
2238            dst = SUB16(cpustate,dst, src);
2230            src = FETCH16(cpustate);
2231            dst = SBB16(cpustate, dst, src, cpustate->CF);
22392232            WRITE16(cpustate,ea, dst);
22402233            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
22412234         }
r5613r5614
23492342         if( modrm >= 0xc0 ) {
23502343            dst = LOAD_RM16(modrm);
23512344            src = (UINT16)(INT16)(INT8)FETCH(cpustate);
2352            src = ADD16(cpustate,src, cpustate->CF);
2353            dst = ADD16(cpustate,dst, src);
2345            dst = ADC16(cpustate, dst, src, cpustate->CF);
23542346            STORE_RM16(modrm, dst);
23552347            CYCLES(cpustate,CYCLES_ALU_REG_REG);
23562348         } else {
23572349            ea = GetEA(cpustate,modrm);
23582350            dst = READ16(cpustate,ea);
23592351            src = (UINT16)(INT16)(INT8)FETCH(cpustate);
2360            src = ADD16(cpustate,src, cpustate->CF);
2361            dst = ADD16(cpustate,dst, src);
2352            dst = ADC16(cpustate, dst, src, cpustate->CF);
23622353            WRITE16(cpustate,ea, dst);
23632354            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
23642355         }
r5613r5614
23662357      case 3:      // SBB Rm16, i16
23672358         if( modrm >= 0xc0 ) {
23682359            dst = LOAD_RM16(modrm);
2369            src = ((UINT16)(INT16)(INT8)FETCH(cpustate)) + cpustate->CF;
2370            dst = SUB16(cpustate,dst, src);
2360            src = ((UINT16)(INT16)(INT8)FETCH(cpustate));
2361            dst = SBB16(cpustate, dst, src, cpustate->CF);
23712362            STORE_RM16(modrm, dst);
23722363            CYCLES(cpustate,CYCLES_ALU_REG_REG);
23732364         } else {
23742365            ea = GetEA(cpustate,modrm);
23752366            dst = READ16(cpustate,ea);
2376            src = ((UINT16)(INT16)(INT8)FETCH(cpustate)) + cpustate->CF;
2377            dst = SUB16(cpustate,dst, src);
2367            src = ((UINT16)(INT16)(INT8)FETCH(cpustate));
2368            dst = SBB16(cpustate, dst, src, cpustate->CF);
23782369            WRITE16(cpustate,ea, dst);
23792370            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
23802371         }
src/emu/cpu/i386/i386priv.h
r5613r5614
691691   return res;
692692}
693693
694INLINE UINT8 SUB8(i386_state *cpustate,UINT8 dst, UINT8 src)
694#define SUB8(cpu, dst, src) SBB8(cpu, dst, src, 0)
695INLINE UINT8 SBB8(i386_state *cpustate,UINT8 dst, UINT8 src, UINT8 b)
695696{
696   UINT16 res = (UINT16)dst - (UINT16)src;
697   UINT16 res = (UINT16)dst - (UINT16)src - (UINT8)b;
697698   SetCF8(res);
698699   SetOF_Sub8(res,src,dst);
699700   SetAF(res,src,dst);
700701   SetSZPF8(res);
701702   return (UINT8)res;
702703}
703INLINE UINT16 SUB16(i386_state *cpustate,UINT16 dst, UINT16 src)
704
705#define SUB16(cpu, dst, src) SBB16(cpu, dst, src, 0)
706INLINE UINT16 SBB16(i386_state *cpustate,UINT16 dst, UINT16 src, UINT16 b)
704707{
705   UINT32 res = (UINT32)dst - (UINT32)src;
708   UINT32 res = (UINT32)dst - (UINT32)src - (UINT32)b;
706709   SetCF16(res);
707710   SetOF_Sub16(res,src,dst);
708711   SetAF(res,src,dst);
709712   SetSZPF16(res);
710713   return (UINT16)res;
711714}
712INLINE UINT32 SUB32(i386_state *cpustate,UINT32 dst, UINT32 src)
715
716#define SUB32(cpu, dst, src) SBB32(cpu, dst, src, 0)
717INLINE UINT32 SBB32(i386_state *cpustate,UINT32 dst, UINT32 src, UINT32 b)
713718{
714   UINT64 res = (UINT64)dst - (UINT64)src;
719   UINT64 res = (UINT64)dst - (UINT64)src - (UINT64) b;
715720   SetCF32(res);
716721   SetOF_Sub32(res,src,dst);
717722   SetAF(res,src,dst);
r5613r5614
719724   return (UINT32)res;
720725}
721726
722INLINE UINT8 ADD8(i386_state *cpustate,UINT8 dst, UINT8 src)
727#define ADD8(cpu, dst, src) ADC8(cpu, dst, src, 0)
728INLINE UINT8 ADC8(i386_state *cpustate,UINT8 dst, UINT8 src, UINT8 c)
723729{
724   UINT16 res = (UINT16)dst + (UINT16)src;
730   UINT16 res = (UINT16)dst + (UINT16)src + (UINT16)c;
725731   SetCF8(res);
726732   SetOF_Add8(res,src,dst);
727733   SetAF(res,src,dst);
728734   SetSZPF8(res);
729735   return (UINT8)res;
730736}
731INLINE UINT16 ADD16(i386_state *cpustate,UINT16 dst, UINT16 src)
737
738#define ADD16(cpu, dst, src) ADC16(cpu, dst, src, 0)
739INLINE UINT16 ADC16(i386_state *cpustate,UINT16 dst, UINT16 src, UINT8 c)
732740{
733   UINT32 res = (UINT32)dst + (UINT32)src;
741   UINT32 res = (UINT32)dst + (UINT32)src + (UINT32)c;
734742   SetCF16(res);
735743   SetOF_Add16(res,src,dst);
736744   SetAF(res,src,dst);
737745   SetSZPF16(res);
738746   return (UINT16)res;
739747}
740INLINE UINT32 ADD32(i386_state *cpustate,UINT32 dst, UINT32 src)
748
749#define ADD32(cpu, dst, src) ADC32(cpu, dst, src, 0)
750INLINE UINT32 ADC32(i386_state *cpustate,UINT32 dst, UINT32 src, UINT32 c)
741751{
742   UINT64 res = (UINT64)dst + (UINT64)src;
752   UINT64 res = (UINT64)dst + (UINT64)src + (UINT64) c;
743753   SetCF32(res);
744754   SetOF_Add32(res,src,dst);
745755   SetAF(res,src,dst);
src/emu/cpu/i386/i386ops.c
r5613r5614
121121   if( modrm >= 0xc0 ) {
122122      src = LOAD_REG8(modrm);
123123      dst = LOAD_RM8(modrm);
124      src = ADD8(cpustate,src, cpustate->CF);
125      dst = ADD8(cpustate,dst, src);
124      dst = ADC8(cpustate, dst, src, cpustate->CF);
126125      STORE_RM8(modrm, dst);
127126      CYCLES(cpustate,CYCLES_ALU_REG_REG);
128127   } else {
129128      UINT32 ea = GetEA(cpustate,modrm);
130129      src = LOAD_REG8(modrm);
131130      dst = READ8(cpustate,ea);
132      src = ADD8(cpustate,src, cpustate->CF);
133      dst = ADD8(cpustate,dst, src);
131      dst = ADC8(cpustate, dst, src, cpustate->CF);
134132      WRITE8(cpustate,ea, dst);
135133      CYCLES(cpustate,CYCLES_ALU_REG_MEM);
136134   }
r5613r5614
143141   if( modrm >= 0xc0 ) {
144142      src = LOAD_RM8(modrm);
145143      dst = LOAD_REG8(modrm);
146      src = ADD8(cpustate,src, cpustate->CF);
147      dst = ADD8(cpustate,dst, src);
144      dst = ADC8(cpustate, dst, src, cpustate->CF);
148145      STORE_REG8(modrm, dst);
149146      CYCLES(cpustate,CYCLES_ALU_REG_REG);
150147   } else {
151148      UINT32 ea = GetEA(cpustate,modrm);
152149      src = READ8(cpustate,ea);
153150      dst = LOAD_REG8(modrm);
154      src = ADD8(cpustate,src, cpustate->CF);
155      dst = ADD8(cpustate,dst, src);
151      dst = ADC8(cpustate, dst, src, cpustate->CF);
156152      STORE_REG8(modrm, dst);
157153      CYCLES(cpustate,CYCLES_ALU_MEM_REG);
158154   }
r5613r5614
163159   UINT8 src, dst;
164160   src = FETCH(cpustate);
165161   dst = REG8(AL);
166   src = ADD8(cpustate,src, cpustate->CF);
167   dst = ADD8(cpustate,dst, src);
162   dst = ADC8(cpustate, dst, src, cpustate->CF);
168163   REG8(AL) = dst;
169164   CYCLES(cpustate,CYCLES_ALU_IMM_ACC);
170165}
r5613r5614
11411136   UINT8 src, dst;
11421137   UINT8 modrm = FETCH(cpustate);
11431138   if( modrm >= 0xc0 ) {
1144      src = LOAD_REG8(modrm) + cpustate->CF;
1139      src = LOAD_REG8(modrm);
11451140      dst = LOAD_RM8(modrm);
1146      dst = SUB8(cpustate,dst, src);
1141      dst = SBB8(cpustate, dst, src, cpustate->CF);
11471142      STORE_RM8(modrm, dst);
11481143      CYCLES(cpustate,CYCLES_ALU_REG_REG);
11491144   } else {
11501145      UINT32 ea = GetEA(cpustate,modrm);
1151      src = LOAD_REG8(modrm) + cpustate->CF;
1146      src = LOAD_REG8(modrm);
11521147      dst = READ8(cpustate,ea);
1153      dst = SUB8(cpustate,dst, src);
1148      dst = SBB8(cpustate, dst, src, cpustate->CF);
11541149      WRITE8(cpustate,ea, dst);
11551150      CYCLES(cpustate,CYCLES_ALU_REG_MEM);
11561151   }
r5613r5614
11611156   UINT8 src, dst;
11621157   UINT8 modrm = FETCH(cpustate);
11631158   if( modrm >= 0xc0 ) {
1164      src = LOAD_RM8(modrm) + cpustate->CF;
1159      src = LOAD_RM8(modrm);
11651160      dst = LOAD_REG8(modrm);
1166      dst = SUB8(cpustate,dst, src);
1161      dst = SBB8(cpustate, dst, src, cpustate->CF);
11671162      STORE_REG8(modrm, dst);
11681163      CYCLES(cpustate,CYCLES_ALU_REG_REG);
11691164   } else {
11701165      UINT32 ea = GetEA(cpustate,modrm);
1171      src = READ8(cpustate,ea) + cpustate->CF;
1166      src = READ8(cpustate,ea);
11721167      dst = LOAD_REG8(modrm);
1173      dst = SUB8(cpustate,dst, src);
1168      dst = SBB8(cpustate, dst, src, cpustate->CF);
11741169      STORE_REG8(modrm, dst);
11751170      CYCLES(cpustate,CYCLES_ALU_MEM_REG);
11761171   }
r5613r5614
11791174static void I386OP(sbb_al_i8)(i386_state *cpustate)         // Opcode 0x1c
11801175{
11811176   UINT8 src, dst;
1182   src = FETCH(cpustate) + cpustate->CF;
1177   src = FETCH(cpustate);
11831178   dst = REG8(AL);
1184   dst = SUB8(cpustate,dst, src);
1179   dst = SBB8(cpustate, dst, src, cpustate->CF);
11851180   REG8(EAX) = dst;
11861181   CYCLES(cpustate,CYCLES_ALU_IMM_ACC);
11871182}
r5613r5614
17071702         if( modrm >= 0xc0 ) {
17081703            dst = LOAD_RM8(modrm);
17091704            src = FETCH(cpustate);
1710            src = ADD8(cpustate,src, cpustate->CF);
1711            dst = ADD8(cpustate,dst, src);
1705            dst = ADC8(cpustate, dst, src, cpustate->CF);
17121706            STORE_RM8(modrm, dst);
17131707            CYCLES(cpustate,CYCLES_ALU_REG_REG);
17141708         } else {
17151709            ea = GetEA(cpustate,modrm);
17161710            dst = READ8(cpustate,ea);
17171711            src = FETCH(cpustate);
1718            src = ADD8(cpustate,src, cpustate->CF);
1719            dst = ADD8(cpustate,dst, src);
1712            dst = ADC8(cpustate, dst, src, cpustate->CF);
17201713            WRITE8(cpustate,ea, dst);
17211714            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
17221715         }
r5613r5614
17241717      case 3:      // SBB Rm8, i8
17251718         if( modrm >= 0xc0 ) {
17261719            dst = LOAD_RM8(modrm);
1727            src = FETCH(cpustate) + cpustate->CF;
1728            dst = SUB8(cpustate,dst, src);
1720            src = FETCH(cpustate);
1721            dst = SBB8(cpustate, dst, src, cpustate->CF);
17291722            STORE_RM8(modrm, dst);
17301723            CYCLES(cpustate,CYCLES_ALU_REG_REG);
17311724         } else {
17321725            ea = GetEA(cpustate,modrm);
17331726            dst = READ8(cpustate,ea);
1734            src = FETCH(cpustate) + cpustate->CF;
1735            dst = SUB8(cpustate,dst, src);
1727            src = FETCH(cpustate);
1728            dst = SBB8(cpustate, dst, src, cpustate->CF);
17361729            WRITE8(cpustate,ea, dst);
17371730            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
17381731         }
src/emu/cpu/i386/i386op32.c
r5613r5614
122122   if( modrm >= 0xc0 ) {
123123      src = LOAD_REG32(modrm);
124124      dst = LOAD_RM32(modrm);
125      src = ADD32(cpustate,src, cpustate->CF);
126      dst = ADD32(cpustate,dst, src);
125      dst = ADC32(cpustate, dst, src, cpustate->CF);
127126      STORE_RM32(modrm, dst);
128127      CYCLES(cpustate,CYCLES_ALU_REG_REG);
129128   } else {
130129      UINT32 ea = GetEA(cpustate,modrm);
131130      src = LOAD_REG32(modrm);
132131      dst = READ32(cpustate,ea);
133      src = ADD32(cpustate,src, cpustate->CF);
134      dst = ADD32(cpustate,dst, src);
132      dst = ADC32(cpustate, dst, src, cpustate->CF);
135133      WRITE32(cpustate,ea, dst);
136134      CYCLES(cpustate,CYCLES_ALU_REG_MEM);
137135   }
r5613r5614
144142   if( modrm >= 0xc0 ) {
145143      src = LOAD_RM32(modrm);
146144      dst = LOAD_REG32(modrm);
147      src = ADD32(cpustate,src, cpustate->CF);
148      dst = ADD32(cpustate,dst, src);
145      dst = ADC32(cpustate, dst, src, cpustate->CF);
149146      STORE_REG32(modrm, dst);
150147      CYCLES(cpustate,CYCLES_ALU_REG_REG);
151148   } else {
152149      UINT32 ea = GetEA(cpustate,modrm);
153150      src = READ32(cpustate,ea);
154151      dst = LOAD_REG32(modrm);
155      src = ADD32(cpustate,src, cpustate->CF);
156      dst = ADD32(cpustate,dst, src);
152      dst = ADC32(cpustate, dst, src, cpustate->CF);
157153      STORE_REG32(modrm, dst);
158154      CYCLES(cpustate,CYCLES_ALU_MEM_REG);
159155   }
r5613r5614
164160   UINT32 src, dst;
165161   src = FETCH32(cpustate);
166162   dst = REG32(EAX);
167   src = ADD32(cpustate,src, cpustate->CF);
168   dst = ADD32(cpustate,dst, src);
163   dst = ADC32(cpustate, dst, src, cpustate->CF);
169164   REG32(EAX) = dst;
170165   CYCLES(cpustate,CYCLES_ALU_IMM_ACC);
171166}
r5613r5614
10261021static void I386OP(loop32)(i386_state *cpustate)         // Opcode 0xe2
10271022{
10281023   INT8 disp = FETCH(cpustate);
1029   REG32(ECX)--;
1030   if( REG32(ECX) != 0 ) {
1024   INT32 reg = (cpustate->address_size)?--REG32(ECX):--REG16(CX);
1025   if( reg != 0 ) {
10311026      cpustate->eip += disp;
10321027      CHANGE_PC(cpustate,cpustate->eip);
10331028   }
r5613r5614
10371032static void I386OP(loopne32)(i386_state *cpustate)         // Opcode 0xe0
10381033{
10391034   INT8 disp = FETCH(cpustate);
1040   REG32(ECX)--;
1041   if( REG32(ECX) != 0 && cpustate->ZF == 0 ) {
1035   INT32 reg = (cpustate->address_size)?--REG32(ECX):--REG16(CX);
1036   if( reg != 0 && cpustate->ZF == 0 ) {
10421037      cpustate->eip += disp;
10431038      CHANGE_PC(cpustate,cpustate->eip);
10441039   }
r5613r5614
10481043static void I386OP(loopz32)(i386_state *cpustate)         // Opcode 0xe1
10491044{
10501045   INT8 disp = FETCH(cpustate);
1051   REG32(ECX)--;
1052   if( REG32(ECX) != 0 && cpustate->ZF != 0 ) {
1046   INT32 reg = (cpustate->address_size)?--REG32(ECX):--REG16(CX);
1047   if( reg != 0 && cpustate->ZF != 0 ) {
10531048      cpustate->eip += disp;
10541049      CHANGE_PC(cpustate,cpustate->eip);
10551050   }
r5613r5614
15961591   UINT32 src, dst;
15971592   UINT8 modrm = FETCH(cpustate);
15981593   if( modrm >= 0xc0 ) {
1599      src = LOAD_REG32(modrm) + cpustate->CF;
1594      src = LOAD_REG32(modrm);
16001595      dst = LOAD_RM32(modrm);
1601      dst = SUB32(cpustate,dst, src);
1596      dst = SBB32(cpustate, dst, src, cpustate->CF);
16021597      STORE_RM32(modrm, dst);
16031598      CYCLES(cpustate,CYCLES_ALU_REG_REG);
16041599   } else {
16051600      UINT32 ea = GetEA(cpustate,modrm);
1606      src = LOAD_REG32(modrm) + cpustate->CF;
1601      src = LOAD_REG32(modrm);
16071602      dst = READ32(cpustate,ea);
1608      dst = SUB32(cpustate,dst, src);
1603      dst = SBB32(cpustate, dst, src, cpustate->CF);
16091604      WRITE32(cpustate,ea, dst);
16101605      CYCLES(cpustate,CYCLES_ALU_REG_MEM);
16111606   }
r5613r5614
16161611   UINT32 src, dst;
16171612   UINT8 modrm = FETCH(cpustate);
16181613   if( modrm >= 0xc0 ) {
1619      src = LOAD_RM32(modrm) + cpustate->CF;
1614      src = LOAD_RM32(modrm);
16201615      dst = LOAD_REG32(modrm);
1621      dst = SUB32(cpustate,dst, src);
1616      dst = SBB32(cpustate, dst, src, cpustate->CF);
16221617      STORE_REG32(modrm, dst);
16231618      CYCLES(cpustate,CYCLES_ALU_REG_REG);
16241619   } else {
16251620      UINT32 ea = GetEA(cpustate,modrm);
1626      src = READ32(cpustate,ea) + cpustate->CF;
1621      src = READ32(cpustate,ea);
16271622      dst = LOAD_REG32(modrm);
1628      dst = SUB32(cpustate,dst, src);
1623      dst = SBB32(cpustate, dst, src, cpustate->CF);
16291624      STORE_REG32(modrm, dst);
16301625      CYCLES(cpustate,CYCLES_ALU_MEM_REG);
16311626   }
r5613r5614
16341629static void I386OP(sbb_eax_i32)(i386_state *cpustate)      // Opcode 0x1d
16351630{
16361631   UINT32 src, dst;
1637   src = FETCH32(cpustate) + cpustate->CF;
1632   src = FETCH32(cpustate);
16381633   dst = REG32(EAX);
1639   dst = SUB32(cpustate,dst, src);
1634   dst = SBB32(cpustate, dst, src, cpustate->CF);
16401635   REG32(EAX) = dst;
16411636   CYCLES(cpustate,CYCLES_ALU_IMM_ACC);
16421637}
r5613r5614
20592054         if( modrm >= 0xc0 ) {
20602055            dst = LOAD_RM32(modrm);
20612056            src = FETCH32(cpustate);
2062            src = ADD32(cpustate,src, cpustate->CF);
2063            dst = ADD32(cpustate,dst, src);
2057            dst = ADC32(cpustate, dst, src, cpustate->CF);
20642058            STORE_RM32(modrm, dst);
20652059            CYCLES(cpustate,CYCLES_ALU_REG_REG);
20662060         } else {
20672061            ea = GetEA(cpustate,modrm);
20682062            dst = READ32(cpustate,ea);
20692063            src = FETCH32(cpustate);
2070            src = ADD32(cpustate,src, cpustate->CF);
2071            dst = ADD32(cpustate,dst, src);
2064            dst = ADC32(cpustate, dst, src, cpustate->CF);
20722065            WRITE32(cpustate,ea, dst);
20732066            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
20742067         }
r5613r5614
20762069      case 3:      // SBB Rm32, i32
20772070         if( modrm >= 0xc0 ) {
20782071            dst = LOAD_RM32(modrm);
2079            src = FETCH32(cpustate) + cpustate->CF;
2080            dst = SUB32(cpustate,dst, src);
2072            src = FETCH32(cpustate);
2073            dst = SBB32(cpustate, dst, src, cpustate->CF);
20812074            STORE_RM32(modrm, dst);
20822075            CYCLES(cpustate,CYCLES_ALU_REG_REG);
20832076         } else {
20842077            ea = GetEA(cpustate,modrm);
20852078            dst = READ32(cpustate,ea);
2086            src = FETCH32(cpustate) + cpustate->CF;
2087            dst = SUB32(cpustate,dst, src);
2079            src = FETCH32(cpustate);
2080            dst = SBB32(cpustate, dst, src, cpustate->CF);
20882081            WRITE32(cpustate,ea, dst);
20892082            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
20902083         }
r5613r5614
21982191         if( modrm >= 0xc0 ) {
21992192            dst = LOAD_RM32(modrm);
22002193            src = (UINT32)(INT32)(INT8)FETCH(cpustate);
2201            src = ADD32(cpustate,src, cpustate->CF);
2202            dst = ADD32(cpustate,dst, src);
2194            dst = ADC32(cpustate, dst, src, cpustate->CF);
22032195            STORE_RM32(modrm, dst);
22042196            CYCLES(cpustate,CYCLES_ALU_REG_REG);
22052197         } else {
22062198            ea = GetEA(cpustate,modrm);
22072199            dst = READ32(cpustate,ea);
22082200            src = (UINT32)(INT32)(INT8)FETCH(cpustate);
2209            src = ADD32(cpustate,src, cpustate->CF);
2210            dst = ADD32(cpustate,dst, src);
2201            dst = ADC32(cpustate, dst, src, cpustate->CF);
22112202            WRITE32(cpustate,ea, dst);
22122203            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
22132204         }
r5613r5614
22152206      case 3:      // SBB Rm32, i32
22162207         if( modrm >= 0xc0 ) {
22172208            dst = LOAD_RM32(modrm);
2218            src = ((UINT32)(INT32)(INT8)FETCH(cpustate)) + cpustate->CF;
2219            dst = SUB32(cpustate,dst, src);
2209            src = ((UINT32)(INT32)(INT8)FETCH(cpustate));
2210            dst = SBB32(cpustate, dst, src, cpustate->CF);
22202211            STORE_RM32(modrm, dst);
22212212            CYCLES(cpustate,CYCLES_ALU_REG_REG);
22222213         } else {
22232214            ea = GetEA(cpustate,modrm);
22242215            dst = READ32(cpustate,ea);
2225            src = ((UINT32)(INT32)(INT8)FETCH(cpustate)) + cpustate->CF;
2226            dst = SUB32(cpustate,dst, src);
2216            src = ((UINT32)(INT32)(INT8)FETCH(cpustate));
2217            dst = SBB32(cpustate, dst, src, cpustate->CF);
22272218            WRITE32(cpustate,ea, dst);
22282219            CYCLES(cpustate,CYCLES_ALU_REG_MEM);
22292220         }
src/emu/cpu/mc68hc11/mc68hc11.h
r5613r5614
55
66#include "cpuintrf.h"
77
8offs_t hc11_disasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
8CPU_DISASSEMBLE( hc11 );
99
1010CPU_GET_INFO( mc68hc11 );
1111#define CPU_MC68HC11 CPU_GET_INFO_NAME( mc68hc11 )
src/emu/cpu/mc68hc11/hc11dasm.c
r5613r5614
12831283   return flags;
12841284}
12851285
1286offs_t hc11_disasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
1286CPU_DISASSEMBLE( hc11 )
12871287{
12881288   UINT32 flags = 0;
12891289   UINT8 opcode;
src/emu/cpu/mc68hc11/mc68hc11.c
r5613r5614
582582      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(hc11);               break;
583583      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hc11);         break;
584584      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
585      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = hc11_disasm;      break;
585      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hc11);      break;
586586      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
587587
588588      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/mips/mips3dsm.c
r5613r5614
88
99#include "cpuintrf.h"
1010
11#define USE_ABI_REG_NAMES (1)
1112
13#if USE_ABI_REG_NAMES
1214static const char *const reg[32] =
1315{
1416   "$0",   "$at",   "$v0",   "$v1",   "$a0",   "$a1",   "$a2",   "$a3",
r5613r5614
1618   "$s0",   "$s1",   "$s2",   "$s3",   "$s4",   "$s5",   "$s6",   "$s7",
1719   "$t8",   "$t9",   "$k0",   "$k1",  "$gp",   "$sp",   "$fp",   "$ra"
1820};
21#else
22static const char *const reg[32] =
23{
24   "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
25   "r8",   "r9",   "r10",   "r11",   "r12",   "r13",   "r14",   "r15",
26   "r16",   "r17",   "r18",   "r19",   "r20",   "r21",   "r22",   "r23",
27   "r24",   "r25",   "r26",   "r27",   "r28",   "r29",   "r30",   "r31"
28};
29#endif
1930
2031
32
2133static const char *const cpreg[4][32] =
2234{
2335   {
src/emu/cpu/mips/mips3com.c
r5613r5614
1616***************************************************************************/
1717
1818#define PRINTF_TLB            (0)
19#define USE_ABI_REG_NAMES      (1)
1920
2021
21
2222/***************************************************************************
2323    FUNCTION PROTOTYPES
2424***************************************************************************/
r5613r5614
558558      case CPUINFO_STR_REGISTER + MIPS3_WIRED:      sprintf(info->s, "Wired:%08X", (UINT32)mips->cpr[0][COP0_Wired]); break;
559559      case CPUINFO_STR_REGISTER + MIPS3_BADVADDR:      sprintf(info->s, "BadVAddr:%08X", (UINT32)mips->cpr[0][COP0_BadVAddr]); break;
560560
561#if USE_ABI_REG_NAMES
561562      case CPUINFO_STR_REGISTER + MIPS3_R0:         sprintf(info->s, "$zero: %08X%08X", (UINT32)(mips->r[0] >> 32), (UINT32)mips->r[0]); break;
562563      case CPUINFO_STR_REGISTER + MIPS3_R1:         sprintf(info->s, "  $at: %08X%08X", (UINT32)(mips->r[1] >> 32), (UINT32)mips->r[1]); break;
563564      case CPUINFO_STR_REGISTER + MIPS3_R2:         sprintf(info->s, "  $v0: %08X%08X", (UINT32)(mips->r[2] >> 32), (UINT32)mips->r[2]); break;
r5613r5614
590591      case CPUINFO_STR_REGISTER + MIPS3_R29:         sprintf(info->s, "  $sp:%08X%08X", (UINT32)(mips->r[29] >> 32), (UINT32)mips->r[29]); break;
591592      case CPUINFO_STR_REGISTER + MIPS3_R30:         sprintf(info->s, "  $fp:%08X%08X", (UINT32)(mips->r[30] >> 32), (UINT32)mips->r[30]); break;
592593      case CPUINFO_STR_REGISTER + MIPS3_R31:         sprintf(info->s, "  $ra:%08X%08X", (UINT32)(mips->r[31] >> 32), (UINT32)mips->r[31]); break;
594#else
595      case CPUINFO_STR_REGISTER + MIPS3_R0:         sprintf(info->s, " R0: %08X%08X", (UINT32)(mips->r[0] >> 32), (UINT32)mips->r[0]); break;
596      case CPUINFO_STR_REGISTER + MIPS3_R1:         sprintf(info->s, " R1: %08X%08X", (UINT32)(mips->r[1] >> 32), (UINT32)mips->r[1]); break;
597      case CPUINFO_STR_REGISTER + MIPS3_R2:         sprintf(info->s, " R2: %08X%08X", (UINT32)(mips->r[2] >> 32), (UINT32)mips->r[2]); break;
598      case CPUINFO_STR_REGISTER + MIPS3_R3:         sprintf(info->s, " R3: %08X%08X", (UINT32)(mips->r[3] >> 32), (UINT32)mips->r[3]); break;
599      case CPUINFO_STR_REGISTER + MIPS3_R4:         sprintf(info->s, " R4: %08X%08X", (UINT32)(mips->r[4] >> 32), (UINT32)mips->r[4]); break;
600      case CPUINFO_STR_REGISTER + MIPS3_R5:         sprintf(info->s, " R5: %08X%08X", (UINT32)(mips->r[5] >> 32), (UINT32)mips->r[5]); break;
601      case CPUINFO_STR_REGISTER + MIPS3_R6:         sprintf(info->s, " R6: %08X%08X", (UINT32)(mips->r[6] >> 32), (UINT32)mips->r[6]); break;
602      case CPUINFO_STR_REGISTER + MIPS3_R7:         sprintf(info->s, " R7: %08X%08X", (UINT32)(mips->r[7] >> 32), (UINT32)mips->r[7]); break;
603      case CPUINFO_STR_REGISTER + MIPS3_R8:         sprintf(info->s, " R8: %08X%08X", (UINT32)(mips->r[8] >> 32), (UINT32)mips->r[8]); break;
604      case CPUINFO_STR_REGISTER + MIPS3_R9:         sprintf(info->s, " R9: %08X%08X", (UINT32)(mips->r[9] >> 32), (UINT32)mips->r[9]); break;
605      case CPUINFO_STR_REGISTER + MIPS3_R10:         sprintf(info->s, "R10: %08X%08X", (UINT32)(mips->r[10] >> 32), (UINT32)mips->r[10]); break;
606      case CPUINFO_STR_REGISTER + MIPS3_R11:         sprintf(info->s, "R11: %08X%08X", (UINT32)(mips->r[11] >> 32), (UINT32)mips->r[11]); break;
607      case CPUINFO_STR_REGISTER + MIPS3_R12:         sprintf(info->s, "R12: %08X%08X", (UINT32)(mips->r[12] >> 32), (UINT32)mips->r[12]); break;
608      case CPUINFO_STR_REGISTER + MIPS3_R13:         sprintf(info->s, "R13: %08X%08X", (UINT32)(mips->r[13] >> 32), (UINT32)mips->r[13]); break;
609      case CPUINFO_STR_REGISTER + MIPS3_R14:         sprintf(info->s, "R14: %08X%08X", (UINT32)(mips->r[14] >> 32), (UINT32)mips->r[14]); break;
610      case CPUINFO_STR_REGISTER + MIPS3_R15:         sprintf(info->s, "R15: %08X%08X", (UINT32)(mips->r[15] >> 32), (UINT32)mips->r[15]); break;
611      case CPUINFO_STR_REGISTER + MIPS3_R16:         sprintf(info->s, "R16: %08X%08X", (UINT32)(mips->r[16] >> 32), (UINT32)mips->r[16]); break;
612      case CPUINFO_STR_REGISTER + MIPS3_R17:         sprintf(info->s, "R17: %08X%08X", (UINT32)(mips->r[17] >> 32), (UINT32)mips->r[17]); break;
613      case CPUINFO_STR_REGISTER + MIPS3_R18:         sprintf(info->s, "R18: %08X%08X", (UINT32)(mips->r[18] >> 32), (UINT32)mips->r[18]); break;
614      case CPUINFO_STR_REGISTER + MIPS3_R19:         sprintf(info->s, "R19: %08X%08X", (UINT32)(mips->r[19] >> 32), (UINT32)mips->r[19]); break;
615      case CPUINFO_STR_REGISTER + MIPS3_R20:         sprintf(info->s, "R20: %08X%08X", (UINT32)(mips->r[20] >> 32), (UINT32)mips->r[20]); break;
616      case CPUINFO_STR_REGISTER + MIPS3_R21:         sprintf(info->s, "R21: %08X%08X", (UINT32)(mips->r[21] >> 32), (UINT32)mips->r[21]); break;
617      case CPUINFO_STR_REGISTER + MIPS3_R22:         sprintf(info->s, "R22: %08X%08X", (UINT32)(mips->r[22] >> 32), (UINT32)mips->r[22]); break;
618      case CPUINFO_STR_REGISTER + MIPS3_R23:         sprintf(info->s, "R23: %08X%08X", (UINT32)(mips->r[23] >> 32), (UINT32)mips->r[23]); break;
619      case CPUINFO_STR_REGISTER + MIPS3_R24:         sprintf(info->s, "R24: %08X%08X", (UINT32)(mips->r[24] >> 32), (UINT32)mips->r[24]); break;
620      case CPUINFO_STR_REGISTER + MIPS3_R25:         sprintf(info->s, "R25: %08X%08X", (UINT32)(mips->r[25] >> 32), (UINT32)mips->r[25]); break;
621      case CPUINFO_STR_REGISTER + MIPS3_R26:         sprintf(info->s, "R26: %08X%08X", (UINT32)(mips->r[26] >> 32), (UINT32)mips->r[26]); break;
622      case CPUINFO_STR_REGISTER + MIPS3_R27:         sprintf(info->s, "R27: %08X%08X", (UINT32)(mips->r[27] >> 32), (UINT32)mips->r[27]); break;
623      case CPUINFO_STR_REGISTER + MIPS3_R28:         sprintf(info->s, "R28: %08X%08X", (UINT32)(mips->r[28] >> 32), (UINT32)mips->r[28]); break;
624      case CPUINFO_STR_REGISTER + MIPS3_R29:         sprintf(info->s, "R29: %08X%08X", (UINT32)(mips->r[29] >> 32), (UINT32)mips->r[29]); break;
625      case CPUINFO_STR_REGISTER + MIPS3_R30:         sprintf(info->s, "R30: %08X%08X", (UINT32)(mips->r[30] >> 32), (UINT32)mips->r[30]); break;
626      case CPUINFO_STR_REGISTER + MIPS3_R31:         sprintf(info->s, "R31: %08X%08X", (UINT32)(mips->r[31] >> 32), (UINT32)mips->r[31]); break;
627#endif
593628      case CPUINFO_STR_REGISTER + MIPS3_HI:         sprintf(info->s, "HI: %08X%08X", (UINT32)(mips->r[REG_HI] >> 32), (UINT32)mips->r[REG_HI]); break;
594629      case CPUINFO_STR_REGISTER + MIPS3_LO:         sprintf(info->s, "LO: %08X%08X", (UINT32)(mips->r[REG_LO] >> 32), (UINT32)mips->r[REG_LO]); break;
595630
src/emu/cpu/z8/z8.c
r5613r5614
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - strobed I/O
15   - interrupts
16   - expose register file to disassembler
17   - decimal adjust instruction
18   - timer Tin/Tout modes
19   - serial
20   - instruction pipeline
14    - strobed I/O
15    - interrupts
16    - expose register file to disassembler
17    - decimal adjust instruction
18    - timer Tin/Tout modes
19    - serial
20    - instruction pipeline
2121
2222*/
2323
r5613r5614
107107
108108#define Z8_P3M_P2_ACTIVE_PULLUPS   0x01   /* not supported */
109109#define Z8_P3M_P0_STROBED         0x04   /* not supported */
110#define Z8_P3M_P1_MODE_MASK         0x18
111//#define Z8_P3M_ 0x00
112//#define Z8_P3M_ 0x08
113//#define Z8_P3M_ 0x10
114#define Z8_P3M_P1_STROBED         0x18   /* not supported */
110#define Z8_P3M_P33_P34_MASK         0x18
111#define Z8_P3M_P33_P34_INPUT_OUTPUT   0x00
112#define Z8_P3M_P33_P34_INPUT_DM      0x08   /* not supported */
113#define Z8_P3M_P33_P34_INPUT_DM_2   0x10   /* not supported */
114#define Z8_P3M_P33_P34_DAV1_RDY1   0x18   /* not supported */
115115#define Z8_P3M_P2_STROBED         0x20   /* not supported */
116116#define Z8_P3M_P3_SERIAL         0x40   /* not supported */
117117#define Z8_P3M_PARITY            0x80   /* not supported */
r5613r5614
241241   assert(device != NULL);
242242   assert(device->token != NULL);
243243   assert(device->type == CPU);
244   assert((cpu_get_type(device) == CPU_Z8601) ||
244   assert((cpu_get_type(device) == CPU_Z8601) ||
245245      (cpu_get_type(device) == CPU_UB8830D) ||
246246      (cpu_get_type(device) == CPU_Z8611));
247247   return (z8_state *)device->token;
r5613r5614
294294      default: /* AD0..AD7 */         data = 0xff;                        break;
295295      }
296296
297      if ((P3M & Z8_P3M_P1_MODE_MASK) != Z8_P3M_P1_STROBED)
297      if ((P3M & Z8_P3M_P33_P34_MASK) != Z8_P3M_P33_P34_DAV1_RDY1)
298298      {
299299         if (mask) cpustate->input[offset] = memory_read_byte_8be(cpustate->io, offset);
300300      }
r5613r5614
341341   case Z8_REGISTER_IPR:
342342      /* write only */
343343      break;
344   
344
345345   default:
346346      data = cpustate->r[offset];
347347      break;
r5613r5614
382382
383383   case Z8_REGISTER_P3:
384384      cpustate->output[offset] = data;
385     
385
386386      // TODO: special port 3 modes
387387      if (!(P3M & 0x7c))
388388      {
r5613r5614
394394
395395   case Z8_REGISTER_SIO:
396396      break;
397   
397
398398   case Z8_REGISTER_TMR:
399399      if (data & Z8_TMR_LOAD_T0)
400      {   
400      {
401401         cpustate->t0 = T0;
402402         timer_adjust_periodic(cpustate->t0_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cpustate->clock / 2 / 4 / ((PRE0 >> 2) + 1)));
403403      }
r5613r5614
405405      timer_enable(cpustate->t0_timer, data & Z8_TMR_ENABLE_T0);
406406
407407      if (data & Z8_TMR_LOAD_T1)
408      {   
408      {
409409         cpustate->t1 = T1;
410410         timer_adjust_periodic(cpustate->t1_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cpustate->clock / 2 / 4 / ((PRE1 >> 2) + 1)));
411411      }
r5613r5614
597597
598598static const z8_opcode_map Z8601_OPCODE_MAP[] =
599599{
600   { dec_R1, 6, 5 },   { dec_IR1, 6, 5 },   { add_r1_r2, 10, 5 },   { add_r1_Ir2, 10, 5 },   { add_R2_R1, 10, 5 },   { add_IR2_R1, 10, 5 },   { add_R1_IM, 10, 5 },   { add_IR1_IM, 10, 5 },
601   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
600   { dec_R1, 6, 5 },   { dec_IR1, 6, 5 },   { add_r1_r2, 10, 5 },   { add_r1_Ir2, 10, 5 },   { add_R2_R1, 10, 5 },   { add_IR2_R1, 10, 5 },   { add_R1_IM, 10, 5 },   { add_IR1_IM, 10, 5 },
601   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
602602
603   { rlc_R1, 6, 5 },   { rlc_IR1, 6, 5 },   { adc_r1_r2, 6, 5 },   { adc_r1_Ir2, 6, 5 },   { adc_R2_R1, 10, 5 },   { adc_IR2_R1, 10, 5 },   { adc_R1_IM, 10, 5 },   { adc_IR1_IM, 10, 5 },
604   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
603   { rlc_R1, 6, 5 },   { rlc_IR1, 6, 5 },   { adc_r1_r2, 6, 5 },   { adc_r1_Ir2, 6, 5 },   { adc_R2_R1, 10, 5 },   { adc_IR2_R1, 10, 5 },   { adc_R1_IM, 10, 5 },   { adc_IR1_IM, 10, 5 },
604   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
605605
606   { inc_R1, 6, 5 },   { inc_IR1, 6, 5 },   { sub_r1_r2, 6, 5 },   { sub_r1_Ir2, 6, 5 },   { sub_R2_R1, 10, 5 },   { sub_IR2_R1, 10, 5 },   { sub_R1_IM, 10, 5 },   { sub_IR1_IM, 10, 5 },
607   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
606   { inc_R1, 6, 5 },   { inc_IR1, 6, 5 },   { sub_r1_r2, 6, 5 },   { sub_r1_Ir2, 6, 5 },   { sub_R2_R1, 10, 5 },   { sub_IR2_R1, 10, 5 },   { sub_R1_IM, 10, 5 },   { sub_IR1_IM, 10, 5 },
607   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
608608
609   { jp_IRR1, 8, 0 },   { srp_IM, 6, 1 },   { sbc_r1_r2, 6, 5 },   { sbc_r1_Ir2, 6, 5 },   { sbc_R2_R1, 10, 5 },   { sbc_IR2_R1, 10, 5 },   { sbc_R1_IM, 10, 5 },   { sbc_IR1_IM, 10, 5 },
610   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
609   { jp_IRR1, 8, 0 },   { srp_IM, 6, 1 },   { sbc_r1_r2, 6, 5 },   { sbc_r1_Ir2, 6, 5 },   { sbc_R2_R1, 10, 5 },   { sbc_IR2_R1, 10, 5 },   { sbc_R1_IM, 10, 5 },   { sbc_IR1_IM, 10, 5 },
610   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
611611
612   { da_R1, 8, 5 },   { da_IR1, 8, 5 },   { or_r1_r2, 6, 5 },      { or_r1_Ir2, 6, 5 },   { or_R2_R1, 10, 5 },   { or_IR2_R1, 10, 5 },   { or_R1_IM, 10, 5 },   { or_IR1_IM, 10, 5 },
613   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
612   { da_R1, 8, 5 },   { da_IR1, 8, 5 },   { or_r1_r2, 6, 5 },      { or_r1_Ir2, 6, 5 },   { or_R2_R1, 10, 5 },   { or_IR2_R1, 10, 5 },   { or_R1_IM, 10, 5 },   { or_IR1_IM, 10, 5 },
613   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
614614
615   { pop_R1, 10, 5 },   { pop_IR1, 10, 5 },   { and_r1_r2, 6, 5 },   { and_r1_Ir2, 6, 5 },   { and_R2_R1, 10, 5 },   { and_IR2_R1, 10, 5 },   { and_R1_IM, 10, 5 },   { and_IR1_IM, 10, 5 },
616   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
615   { pop_R1, 10, 5 },   { pop_IR1, 10, 5 },   { and_r1_r2, 6, 5 },   { and_r1_Ir2, 6, 5 },   { and_R2_R1, 10, 5 },   { and_IR2_R1, 10, 5 },   { and_R1_IM, 10, 5 },   { and_IR1_IM, 10, 5 },
616   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
617617
618   { com_R1, 6, 5 },   { com_IR1, 6, 5 },   { tcm_r1_r2, 6, 5 },   { tcm_r1_Ir2, 6, 5 },   { tcm_R2_R1, 10, 5 },   { tcm_IR2_R1, 10, 5 },   { tcm_R1_IM, 10, 5 },   { tcm_IR1_IM, 10, 5 },
619   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
618   { com_R1, 6, 5 },   { com_IR1, 6, 5 },   { tcm_r1_r2, 6, 5 },   { tcm_r1_Ir2, 6, 5 },   { tcm_R2_R1, 10, 5 },   { tcm_IR2_R1, 10, 5 },   { tcm_R1_IM, 10, 5 },   { tcm_IR1_IM, 10, 5 },
619   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
620620
621   { push_R2, 10, 1 },   { push_IR2, 12, 1 },{ tm_r1_r2, 6, 5 },      { tm_r1_Ir2, 6, 5 },   { tm_R2_R1, 10, 5 },   { tm_IR2_R1, 10, 5 },   { tm_R1_IM, 10, 5 },   { tm_IR1_IM, 10, 5 },
622   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
621   { push_R2, 10, 1 },   { push_IR2, 12, 1 },{ tm_r1_r2, 6, 5 },      { tm_r1_Ir2, 6, 5 },   { tm_R2_R1, 10, 5 },   { tm_IR2_R1, 10, 5 },   { tm_R1_IM, 10, 5 },   { tm_IR1_IM, 10, 5 },
622   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { illegal, 0, 0 },
623623
624   { decw_RR1, 10, 5 },{ decw_IR1, 10, 5 },{ lde_r1_Irr2, 12, 0 },   { ldei_Ir1_Irr2, 18, 0 },{ illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },     
625   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { di, 6, 1 },
624   { decw_RR1, 10, 5 },{ decw_IR1, 10, 5 },{ lde_r1_Irr2, 12, 0 },   { ldei_Ir1_Irr2, 18, 0 },{ illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },
625   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { di, 6, 1 },
626626
627   { rl_R1, 6, 5 },   { rl_IR1, 6, 5 },   { lde_r2_Irr1, 12, 0 },   { ldei_Ir2_Irr1, 18, 0 },{ illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },   
628   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { ei, 6, 1 },
627   { rl_R1, 6, 5 },   { rl_IR1, 6, 5 },   { lde_r2_Irr1, 12, 0 },   { ldei_Ir2_Irr1, 18, 0 },{ illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },
628   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { ei, 6, 1 },
629629
630   { incw_RR1, 10, 5 },{ incw_IR1, 10, 5 },{ cp_r1_r2, 6, 5 },      { cp_r1_Ir2, 6, 5 },   { cp_R2_R1, 10, 5 },   { cp_IR2_R1, 10, 5 },   { cp_R1_IM, 10, 5 },   { cp_IR1_IM, 10, 5 },
631   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { ret, 14, 0 },
630   { incw_RR1, 10, 5 },{ incw_IR1, 10, 5 },{ cp_r1_r2, 6, 5 },      { cp_r1_Ir2, 6, 5 },   { cp_R2_R1, 10, 5 },   { cp_IR2_R1, 10, 5 },   { cp_R1_IM, 10, 5 },   { cp_IR1_IM, 10, 5 },
631   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { ret, 14, 0 },
632632
633   { clr_R1, 6, 5 },   { clr_IR1, 6, 5 },   { xor_r1_r2, 6, 5 },   { xor_r1_Ir2, 6, 5 },   { xor_R2_R1, 10, 5 },   { xor_IR2_R1, 10, 5 },   { xor_R1_IM, 10, 5 },   { xor_IR1_IM, 10, 5 },
634   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { iret, 16, 0 },
633   { clr_R1, 6, 5 },   { clr_IR1, 6, 5 },   { xor_r1_r2, 6, 5 },   { xor_r1_Ir2, 6, 5 },   { xor_R2_R1, 10, 5 },   { xor_IR2_R1, 10, 5 },   { xor_R1_IM, 10, 5 },   { xor_IR1_IM, 10, 5 },
634   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { iret, 16, 0 },
635635
636   { rrc_R1, 6, 5 },   { rrc_IR1, 6, 5 },   { ldc_r1_Irr2, 12, 0 },   { ldci_Ir1_Irr2, 18, 0 },{ illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },      { ld_r1_x_R2, 10, 5 },
637   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { rcf, 6, 5 },
636   { rrc_R1, 6, 5 },   { rrc_IR1, 6, 5 },   { ldc_r1_Irr2, 12, 0 },   { ldci_Ir1_Irr2, 18, 0 },{ illegal, 0, 0 },      { illegal, 0, 0 },      { illegal, 0, 0 },      { ld_r1_x_R2, 10, 5 },
637   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { rcf, 6, 5 },
638638
639   { sra_R1, 6, 5 },   { sra_IR1, 6, 5 },   { ldc_r2_Irr1, 12, 0 },   { ldci_Ir2_Irr1, 18, 0 },{ call_IRR1, 20, 0 },   { illegal, 0, 0 },      { call_DA, 20, 0 },      { ld_r2_x_R1, 10, 5 },
640   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { scf, 6, 5 },
639   { sra_R1, 6, 5 },   { sra_IR1, 6, 5 },   { ldc_r2_Irr1, 12, 0 },   { ldci_Ir2_Irr1, 18, 0 },{ call_IRR1, 20, 0 },   { illegal, 0, 0 },      { call_DA, 20, 0 },      { ld_r2_x_R1, 10, 5 },
640   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { scf, 6, 5 },
641641
642   { rr_R1, 6, 5 },   { rr_IR1, 6, 5 },   { illegal, 0, 0 },      { ld_r1_Ir2, 6, 5 },   { ld_R2_R1, 10, 5 },   { ld_IR2_R1, 10, 5 },   { ld_R1_IM, 10, 5 },   { ld_IR1_IM, 10, 5 },
643   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { ccf, 6, 5 },
642   { rr_R1, 6, 5 },   { rr_IR1, 6, 5 },   { illegal, 0, 0 },      { ld_r1_Ir2, 6, 5 },   { ld_R2_R1, 10, 5 },   { ld_IR2_R1, 10, 5 },   { ld_R1_IM, 10, 5 },   { ld_IR1_IM, 10, 5 },
643   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { ccf, 6, 5 },
644644
645645   { swap_R1, 8, 5 },   { swap_IR1, 8, 5 },   { illegal, 0, 0 },      { ld_Ir1_r2, 6, 5 },   { illegal, 0, 0 },      { ld_R2_IR1, 10, 5 },   { illegal, 0, 0 },      { illegal, 0, 0 },
646   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { nop, 6, 0 },
646   { ld_r1_R2, 6, 5 }, { ld_r2_R1, 6, 5 }, { djnz_r1_RA, 10, 5 },   { jr_cc_RA, 10, 0 },   { ld_r1_IM, 6, 5 },      { jp_cc_DA, 10, 0 },   { inc_r1, 6, 5 },      { nop, 6, 0 },
647647};
648648
649649/***************************************************************************
r5613r5614
728728      int cycles;
729729
730730      debugger_instruction_hook(device, cpustate->pc);
731     
731
732732      /* TODO: sample interrupts */
733     
733      cpustate->input[3] = memory_read_byte_8be(cpustate->io, 3);
734
734735      /* fetch opcode */
735736      opcode = fetch(cpustate);
736737      cycles = Z8601_OPCODE_MAP[opcode].execution_cycles;
737738
738739      /* execute instruction */
739740      (*(Z8601_OPCODE_MAP[opcode].function))(cpustate, opcode, &cycles);
740     
741
741742      cpustate->icount -= cycles;
742743   }
743744   while (cpustate->icount > 0);
r5613r5614
792793         cpustate->r[Z8_REGISTER_SPH] = cpustate->fake_sp >> 8;
793794         cpustate->r[Z8_REGISTER_SPL] = cpustate->fake_sp & 0xff;
794795         break;
795   
796
796797      case Z8_R0: case Z8_R1: case Z8_R2: case Z8_R3: case Z8_R4: case Z8_R5: case Z8_R6: case Z8_R7: case Z8_R8: case Z8_R9: case Z8_R10: case Z8_R11: case Z8_R12: case Z8_R13: case Z8_R14: case Z8_R15:
797798         cpustate->r[cpustate->r[Z8_REGISTER_RP] + (entry->index - Z8_R0)] = cpustate->fake_r[entry->index - Z8_R0];
798799         break;
src/emu/cpu/z8/z8ops.c
r5613r5614
148148
149149   UINT16 address = register_pair_read(cpustate, src);
150150   UINT8 data = memory_decrypted_read_byte(cpustate->program, address);
151   
151
152152   register_write(cpustate, dst, data);
153153}
154154
r5613r5614
173173
174174   UINT16 address = register_pair_read(cpustate, src);
175175   UINT8 data = memory_decrypted_read_byte(cpustate->program, address);
176   
176
177177   register_write(cpustate, real_dst, data);
178   
178
179179   register_write(cpustate, dst, real_dst + 1);
180180   register_pair_write(cpustate, src, address + 1);
181181}
r5613r5614
191191   UINT8 data = register_read(cpustate, real_src);
192192
193193   memory_write_byte(cpustate->program, address, data);
194   
194
195195   register_pair_write(cpustate, dst, address + 1);
196196   register_write(cpustate, src, real_src + 1);
197197}
r5613r5614
208208static void pop(z8_state *cpustate, UINT8 dst)
209209{
210210   /* dst <- @SP
211      SP <- SP + 1 */
211       SP <- SP + 1 */
212212   register_write(cpustate, dst, stack_pop_byte(cpustate));
213213}
214214
r5613r5614
218218static void push(z8_state *cpustate, UINT8 src)
219219{
220220   /* SP <- SP - 1
221      @SP <- src */
221       @SP <- src */
222222   stack_push_byte(cpustate, read(src));
223223}
224224
r5613r5614
495495
496496INSTRUCTION( djnz_r1_RA )
497497{
498   INT8 ra = (INT8)fetch(cpustate);
498   INT8 ra = (INT8)fetch(cpustate);
499499
500500   /* r <- r - 1 */
501501   int r = get_working_register(cpustate, opcode >> 4);
r5613r5614
513513INSTRUCTION( iret )
514514{
515515   /* FLAGS <- @SP
516      SP <- SP + 1 */
516       SP <- SP + 1 */
517517   register_write(cpustate, Z8_REGISTER_FLAGS, stack_pop_byte(cpustate));
518518
519519   /* PC <- @SP
520      SP <- SP + 2 */
520       SP <- SP + 2 */
521521   cpustate->pc = stack_pop_word(cpustate);
522   
522
523523   /* IMR (7) <- 1 */
524524   cpustate->r[Z8_REGISTER_IMR] |= Z8_IMR_ENABLE;
525525}
r5613r5614
527527INSTRUCTION( ret )
528528{
529529   /* PC <- @SP
530      SP <- SP + 2 */
530       SP <- SP + 2 */
531531   cpustate->pc = stack_pop_word(cpustate);
532532}
533533
r5613r5614
562562   case CC_NZ:      truth = !flag(Z); break;
563563   case CC_NC:      truth = !flag(C); break;
564564   }
565   
565
566566   return truth;
567567}
568568
569569INSTRUCTION( jp_cc_DA )
570570{
571   UINT16 dst = (fetch(cpustate) << 8) | fetch(cpustate);
572   
571   UINT16 dst = (fetch(cpustate) << 8) | fetch(cpustate);
572
573573   /* if cc is true, then PC <- dst */
574574   if (check_condition_code(cpustate, opcode >> 4))
575575   {
r5613r5614
581581INSTRUCTION( jr_cc_RA )
582582{
583583   INT8 ra = (INT8)fetch(cpustate);
584   UINT16 dst = cpustate->pc + ra;
584   UINT16 dst = cpustate->pc + ra;
585585
586586   /* if cc is true, then PC <- dst */
587587   if (check_condition_code(cpustate, opcode >> 4))
r5613r5614
599599{
600600   /* NOT(dst) AND src */
601601   UINT8 data = (register_read(cpustate, dst) ^ 0xff) & src;
602   
602
603603   set_flag_z(data == 0);
604604   set_flag_s(data & 0x80);
605605   set_flag_v(0);
r5613r5614
616616{
617617   /* dst AND src */
618618   UINT8 data = register_read(cpustate, dst) & src;
619   
619
620620   set_flag_z(data == 0);
621621   set_flag_s(data & 0x80);
622622   set_flag_v(0);
r5613r5614
727727
728728   set_flag_z(data == 0);
729729   set_flag_s(data & 0x80);
730//   set_flag_v(0); undefined
730//  set_flag_v(0); undefined
731731}
732732
733733INSTRUCTION( swap_R1 )         { mode_R1(swap) }
src/emu/cpu/z8/z8.h
r5613r5614
1818{
1919   Z8_PC, Z8_SP, Z8_RP, Z8_T0, Z8_T1,
2020
21   Z8_R0, Z8_R1, Z8_R2, Z8_R3, Z8_R4, Z8_R5, Z8_R6, Z8_R7, Z8_R8, Z8_R9, Z8_R10, Z8_R11, Z8_R12, Z8_R13, Z8_R14, Z8_R15,
21   Z8_R0, Z8_R1, Z8_R2, Z8_R3, Z8_R4, Z8_R5, Z8_R6, Z8_R7, Z8_R8, Z8_R9, Z8_R10, Z8_R11, Z8_R12, Z8_R13, Z8_R14, Z8_R15,
2222
2323   Z8_GENPC = REG_GENPC,
2424   Z8_GENSP = REG_GENSP
src/emu/cpu/z8/z8dasm.c
r5613r5614
99static const char* REGISTER_NAME[256] =
1010{
1111   "P0", "P1", "P2", "P3", "", "", "", "", "", "", "", "", "", "", "", "",
12   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
13   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
14   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
15   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
16   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
17   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
18   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
19   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
20   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
21   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
22   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
23   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
24   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
25   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
12   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
13   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
14   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
15   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
16   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
17   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
18   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
19   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
20   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
21   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
22   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
23   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
24   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
25   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
2626   "SIO", "TMR", "T1", "PRE1", "T0", "PRE0", "P2M", "P3M", "P01M", "IPR", "IRQ", "IMR", "FLAGS", "RP", "SPH", "SPL"
2727};
2828
2929static const char* CONDITION_CODE[16] =
3030{
31   "F", "LT", "LE", "ULE", "OV", "MI", "Z", "C",
32   "", "GE", "GT", "UGT", "NOV", "PL", "NZ", "NC"
31   "F", "LT", "LE", "ULE", "OV", "MI", "Z", "C",
32   "", "GE", "GT", "UGT", "NOV", "PL", "NZ", "NC"
3333};
3434
3535/***************************************************************************
r5613r5614
9090
9191   switch (pc)
9292   {
93   case 0x0000:
93   case 0x0000:
9494   case 0x0002:
9595   case 0x0004:
9696   case 0x0006:
r5613r5614
235235         case 0x7d:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
236236         case 0x7e:      mnemonic("INC"); arg_r(OPH);                     break;
237237         case 0x7f:      illegal; /* mnemonic("HALT"); */                  break;
238         
238
239239         case 0x80:      mnemonic("DECW"); arg_RR(*oprom++);                  break;
240240         case 0x81:      mnemonic("DECW"); arg_IR(B0); bytes(2);               break;
241241         case 0x82:      mnemonic("LDE"); arg_r(B0H); arg_Irr(B0L); bytes(2);   break;
r5613r5614
252252         case 0x8d:      mnemonic("JP"); arg_DA; bytes(3);                  break;
253253         case 0x8e:      mnemonic("INC"); arg_r(OPH);                     break;
254254         case 0x8f:      mnemonic("DI");                                 break;
255         
255
256256         case 0x90:      mnemonic("RL"); arg_R(B0); bytes(2);               break;
257257         case 0x91:      mnemonic("RL"); arg_IR(B0); bytes(2);               break;
258258         case 0x92:      mnemonic("LDE"); arg_r(B0L); arg_Irr(B0H); bytes(2);   break;
r5613r5614
269269         case 0x9d:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
270270         case 0x9e:      mnemonic("INC"); arg_r(OPH);                     break;
271271         case 0x9f:      mnemonic("EI");                                 break;
272         
272
273273         case 0xa0:      mnemonic("INCW"); arg_RR(B0); bytes(2);               break;
274274         case 0xa1:      mnemonic("INCW"); arg_IR(B0); bytes(2);               break;
275275         case 0xa2:      mnemonic("CP"); arg_r(B0H); arg_r(B0L); bytes(2);      break;
r5613r5614
286286         case 0xad:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
287287         case 0xae:      mnemonic("INC"); arg_r(OPH);                     break;
288288         case 0xaf:      mnemonic("RET"); step_out;                        break;
289         
289
290290         case 0xb0:      mnemonic("CLR"); arg_R(B0); bytes(2);               break;
291291         case 0xb1:      mnemonic("XOR"); arg_IR(B0); bytes(2);               break;
292292         case 0xb2:      mnemonic("XOR"); arg_r(B0H); arg_r(B0L); bytes(2);      break;
r5613r5614
303303         case 0xbd:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
304304         case 0xbe:      mnemonic("INC"); arg_r(OPH);                     break;
305305         case 0xbf:      mnemonic("IRET"); step_out;                        break;
306         
306
307307         case 0xc0:      mnemonic("RRC"); arg_R(B0); bytes(2);               break;
308308         case 0xc1:      mnemonic("RRC"); arg_IR(B0); bytes(2);               break;
309309         case 0xc2:      mnemonic("LDC"); arg_r(B0H); arg_Irr(B0L); bytes(2);   break;
r5613r5614
320320         case 0xcd:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
321321         case 0xce:      mnemonic("INC"); arg_r(OPH);                     break;
322322         case 0xcf:      mnemonic("RCF");                              break;
323         
323
324324         case 0xd0:      mnemonic("SRA"); arg_R(B0); bytes(2);               break;
325325         case 0xd1:      mnemonic("SRA"); arg_IR(B0); bytes(2);               break;
326326         case 0xd2:      mnemonic("LDC"); arg_Irr(B0L); arg_r(B0H); bytes(2);   break;
r5613r5614
337337         case 0xdd:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
338338         case 0xde:      mnemonic("INC"); arg_r(OPH);                     break;
339339         case 0xdf:      mnemonic("SCF");                              break;
340         
340
341341         case 0xe0:      mnemonic("RR"); arg_R(B0); bytes(2);               break;
342342         case 0xe1:      mnemonic("RR"); arg_IR(B0); bytes(2);               break;
343343         case 0xe2:      illegal;                                    break;
r5613r5614
354354         case 0xed:      mnemonic("JP"); arg_cc; arg_DA; bytes(3);            break;
355355         case 0xee:      mnemonic("INC"); arg_r(OPH);                     break;
356356         case 0xef:      mnemonic("CCF");                              break;
357         
357
358358         case 0xf0:      mnemonic("SWAP"); arg_R(B0); bytes(2);               break;
359359         case 0xf1:      mnemonic("SWAP"); arg_IR(B0); bytes(2);               break;
360360         case 0xf2:      illegal;                                    break;
src/emu/cpu/pic16c5x/pic16c5x.c
r5613r5614
3131 *   - The Prescaler rate was incorrectly being zeroed, instead of the      *
3232 *     actual Prescaler counter in the CLRWDT and SLEEP instructions.       *
3333 *   - Added masking to the FSR register. Upper unused bits are always 1.   *
34 *  TLP (27-Aug-2009) Ver 1.13                                              *
35 *   - Indirect addressing was not taking into account special purpose      *
36 *     memory mapped locations.                                             *
37 *   - 'iorlw' instruction was saving the result to memory instead of       *
38 *     the W register.                                                      *
39 *   - 'tris' instruction no longer modifies Port-C on PIC models that      *
40 *     do not have Port-C implemented.                                      *
3441 *                                                                          *
3542 *                                                                          *
3643 *  **** Notes: ****                                                        *
r5613r5614
5663
5764
5865
59#define M_RDRAM(A)      (((A) < 8) ? cpustate->internalram[A] : PIC16C5x_RAM_RDMEM(A))
60#define M_WRTRAM(A,V)   do { if ((A) < 8) cpustate->internalram[A] = (V); else PIC16C5x_RAM_WRMEM(A,V); } while (0)
61#define M_RDOP(A)      PIC16C5x_RDOP(A)
62#define M_RDOP_ARG(A)   PIC16C5x_RDOP_ARG(A)
63#define P_IN(A)         PIC16C5x_In(A)
64#define P_OUT(A,V)      PIC16C5x_Out(A,V)
65#define S_T0_IN         PIC16C5x_T0_In
66#define ADDR_MASK      0x7ff
6766
68
69
70
7167typedef struct _pic16c5x_state pic16c5x_state;
7268struct _pic16c5x_state
7369{
r5613r5614
8581   UINT16   STACK[2];
8682   UINT16   prescaler;   /* Note: this is really an 8-bit register */
8783   PAIR   opcode;
88   UINT8   internalram[8];
84   UINT8   *internalram;
8985
9086   int      icount;
9187   int      reset_vector;
r5613r5614
117113   return (pic16c5x_state *)device->token;
118114}
119115
116
120117/* opcode table entry */
121118typedef struct _pic16c5x_opcode pic16c5x_opcode;
122119struct _pic16c5x_opcode
r5613r5614
124121   UINT8   cycles;
125122   void    (*function)(pic16c5x_state *);
126123};
127/* opcode table entry (Opcode 00? has sub-opcodes) */
128typedef struct _pic16c5x_opcode_00x pic16c5x_opcode_00x;
129struct _pic16c5x_opcode_00x
130{
131   UINT8   cycles;
132   void    (*function)(pic16c5x_state *);
133};
134124
135125
126INLINE void update_internalram_ptr(pic16c5x_state *cpustate)
127{
128   cpustate->internalram = (UINT8 *)memory_get_write_ptr(cpustate->data, 0x00);
129}
136130
137/****************************************************************************
138 *  Read the state of the T0 Clock input signal
139 */
140131
141#define PIC16C5x_T0_In (memory_read_byte_8le(cpustate->io, PIC16C5x_T0))
142132
143133
144/****************************************************************************
145 *  Input a word from given I/O port
146 */
147
148#define PIC16C5x_In(Port) ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
149
150
151/****************************************************************************
152 *  Output a word to given I/O port
153 */
154
134#define PIC16C5x_RDOP(A)         (memory_decrypted_read_word(cpustate->program, (A)<<1))
135#define PIC16C5x_RAM_RDMEM(A)    ((UINT8)memory_read_byte_8le(cpustate->data, A))
136#define PIC16C5x_RAM_WRMEM(A,V)  (memory_write_byte_8le(cpustate->data, A,V))
137#define PIC16C5x_In(Port)        ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
155138#define PIC16C5x_Out(Port,Value) (memory_write_byte_8le(cpustate->io, (Port),Value))
139/************  Read the state of the T0 Clock input signal  ************/
140#define PIC16C5x_T0_In           (memory_read_byte_8le(cpustate->io, PIC16C5x_T0))
156141
142#define M_RDRAM(A)      (((A) < 8) ? cpustate->internalram[A] : PIC16C5x_RAM_RDMEM(A))
143#define M_WRTRAM(A,V)   do { if ((A) < 8) cpustate->internalram[A] = (V); else PIC16C5x_RAM_WRMEM(A,V); } while (0)
144#define M_RDOP(A)      PIC16C5x_RDOP(A)
145#define P_IN(A)         PIC16C5x_In(A)
146#define P_OUT(A,V)      PIC16C5x_Out(A,V)
147#define S_T0_IN         PIC16C5x_T0_In
148#define ADDR_MASK      0x7ff
157149
158150
159/****************************************************************************
160 *  Read a word from given RAM memory location
161 */
162151
163#define PIC16C5x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(cpustate->data, A))
164
165
166/****************************************************************************
167 *  Write a word to given RAM memory location
168 */
169
170#define PIC16C5x_RAM_WRMEM(A,V) (memory_write_byte_8le(cpustate->data, A,V))
171
172
173
174/****************************************************************************
175 *  PIC16C5X_RDOP() is identical to PIC16C5X_RDMEM() except it is used for
176 *  reading opcodes. In case of system with memory mapped I/O, this function
177 *  can be used to greatly speed up emulation
178 */
179
180#define PIC16C5x_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
181
182
183/****************************************************************************
184 *  PIC16C5X_RDOP_ARG() is identical to PIC16C5X_RDOP() except it is used
185 *  for reading opcode arguments. This difference can be used to support systems
186 *  that use different encoding mechanisms for opcodes and opcode arguments
187 */
188
189#define PIC16C5x_RDOP_ARG(A) (memory_raw_read_word(cpustate->program, (A)<<1))
190
191
192152#define TMR0   internalram[1]
193153#define PCL      internalram[2]
194154#define STATUS   internalram[3]
r5613r5614
205165
206166
207167/********  The following is the Status Flag register definition.  *********/
208         /* | 7 | 6 | 5 |  4 |  3 | 2 | 1 | 0 | */
168         /* | 7 | 6 | 5 |  4 |  3 | 2 | 1 | 0 | */
209169         /* |    PA     | TO | PD | Z | DC | C | */
210170#define PA_REG      0xe0   /* PA   Program Page Preselect - bit 8 is unused here */
211171#define TO_FLAG      0x10   /* TO   Time Out flag (WatchDog) */
r5613r5614
251211 *  Shortcuts
252212 ************************************************************************/
253213
214#define CLR(flagreg, flag) ( flagreg &= (UINT8)(~flag) )
215#define SET(flagreg, flag) ( flagreg |=  flag )
216
217
254218/* Easy bit position selectors */
255219#define POS    ((cpustate->opcode.b.l >> 5) & 7)
256220static const unsigned int bit_clr[8] = { 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f };
257221static const unsigned int bit_set[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
258222
259223
260INLINE void CLR(pic16c5x_state *cpustate, UINT16 flag) { cpustate->STATUS &= ~flag; }
261INLINE void SET(pic16c5x_state *cpustate, UINT16 flag) { cpustate->STATUS |=  flag; }
262224
263
264
265225INLINE void CALCULATE_Z_FLAG(pic16c5x_state *cpustate)
266226{
267   if (cpustate->ALU == 0) SET(cpustate, Z_FLAG);
268   else CLR(cpustate, Z_FLAG);
227   if (cpustate->ALU == 0) SET(cpustate->STATUS, Z_FLAG);
228   else CLR(cpustate->STATUS, Z_FLAG);
269229}
270230
271231INLINE void CALCULATE_ADD_CARRY(pic16c5x_state *cpustate)
272232{
273233   if ((UINT8)(cpustate->old_data) > (UINT8)(cpustate->ALU)) {
274      SET(cpustate, C_FLAG);
234      SET(cpustate->STATUS, C_FLAG);
275235   }
276236   else {
277      CLR(cpustate, C_FLAG);
237      CLR(cpustate->STATUS, C_FLAG);
278238   }
279239}
280240
281241INLINE void CALCULATE_ADD_DIGITCARRY(pic16c5x_state *cpustate)
282242{
283243   if (((UINT8)(cpustate->old_data) & 0x0f) > ((UINT8)(cpustate->ALU) & 0x0f)) {
284      SET(cpustate, DC_FLAG);
244      SET(cpustate->STATUS, DC_FLAG);
285245   }
286246   else {
287      CLR(cpustate, DC_FLAG);
247      CLR(cpustate->STATUS, DC_FLAG);
288248   }
289249}
290250
291251INLINE void CALCULATE_SUB_CARRY(pic16c5x_state *cpustate)
292252{
293253   if ((UINT8)(cpustate->old_data) < (UINT8)(cpustate->ALU)) {
294      CLR(cpustate, C_FLAG);
254      CLR(cpustate->STATUS, C_FLAG);
295255   }
296256   else {
297      SET(cpustate, C_FLAG);
257      SET(cpustate->STATUS, C_FLAG);
298258   }
299259}
300260
301261INLINE void CALCULATE_SUB_DIGITCARRY(pic16c5x_state *cpustate)
302262{
303263   if (((UINT8)(cpustate->old_data) & 0x0f) < ((UINT8)(cpustate->ALU) & 0x0f)) {
304      CLR(cpustate, DC_FLAG);
264      CLR(cpustate->STATUS, DC_FLAG);
305265   }
306266   else {
307      SET(cpustate, DC_FLAG);
267      SET(cpustate->STATUS, DC_FLAG);
308268   }
309269}
310270
r5613r5614
323283}
324284
325285
286
326287INLINE UINT8 GET_REGFILE(pic16c5x_state *cpustate, offs_t addr)   /* Read from internal memory */
327288{
328289   UINT8 data;
329290
330   if ((cpustate->picmodel == 0x16C57) || (cpustate->picmodel == 0x16C58))
331   {
332      addr |= (cpustate->FSR & 0x60);      /* FSR used for banking */
291   if (addr == 0) {                  /* Indirect addressing  */
292      addr = (cpustate->FSR & cpustate->picRAMmask);
333293   }
294
295   if ((cpustate->picmodel == 0x16C57) || (cpustate->picmodel == 0x16C58)) {
296      addr |= (cpustate->FSR & 0x60);      /* FSR bits 6-5 are used for banking in direct mode */
297   }
298
334299   if ((addr & 0x10) == 0) addr &= 0x0f;
335300
336301   switch(addr)
337302   {
338      case 00:   addr = (cpustate->FSR & cpustate->picRAMmask);
339               if (addr == 0) { data = 0; break; }
340               if ((addr & 0x10) == 0) addr &= 0x0f;
341               data = M_RDRAM(addr);         /* Indirect address */
303      case 00:   /* Not an actual register, so return 0 */
304               data = 0;
342305               break;
343      case 04:   data = (cpustate->FSR | (~cpustate->picRAMmask)); break;
306      case 04:   data = (cpustate->FSR | (UINT8)(~cpustate->picRAMmask));
307               break;
344308      case 05:   data = P_IN(0);
345309               data &= cpustate->TRISA;
346               data |= (~cpustate->TRISA & cpustate->PORTA);
347               data &= 0xf;      /* 4-bit port (only lower 4 bits used) */
310               data |= ((UINT8)(~cpustate->TRISA) & cpustate->PORTA);
311               data &= 0x0f;      /* 4-bit port (only lower 4 bits used) */
348312               break;
349313      case 06:   data = P_IN(1);
350314               data &= cpustate->TRISB;
351               data |= (~cpustate->TRISB & cpustate->PORTB);
315               data |= ((UINT8)(~cpustate->TRISB) & cpustate->PORTB);
352316               break;
353317      case 07:   if ((cpustate->picmodel == 0x16C55) || (cpustate->picmodel == 0x16C57)) {
354318                  data = P_IN(2);
355319                  data &= cpustate->TRISC;
356                  data |= (~cpustate->TRISC & cpustate->PORTC);
320                  data |= ((UINT8)(~cpustate->TRISC) & cpustate->PORTC);
357321               }
358               else {      /* PIC16C54, PIC16C56, PIC16C58 */
322               else {            /* PIC16C54, PIC16C56, PIC16C58 */
359323                  data = M_RDRAM(addr);
360324               }
361325               break;
362      default:   data = M_RDRAM(addr); break;
326      default:   data = M_RDRAM(addr);
327               break;
363328   }
364
365329   return data;
366330}
367331
368332INLINE void STORE_REGFILE(pic16c5x_state *cpustate, offs_t addr, UINT8 data)   /* Write to internal memory */
369333{
370   if ((cpustate->picmodel == 0x16C57) || (cpustate->picmodel == 0x16C58))
371   {
372      addr |= (cpustate->FSR & 0x60);
334   if (addr == 0) {                  /* Indirect addressing  */
335      addr = (cpustate->FSR & cpustate->picRAMmask);
373336   }
337
338   if ((cpustate->picmodel == 0x16C57) || (cpustate->picmodel == 0x16C58)) {
339      addr |= (cpustate->FSR & 0x60);      /* FSR bits 6-5 are used for banking in direct mode */
340   }
341
374342   if ((addr & 0x10) == 0) addr &= 0x0f;
375343
376344   switch(addr)
377345   {
378      case 00:   addr = (cpustate->FSR & cpustate->picRAMmask);
379               if (addr == 0) break;
380               if ((addr & 0x10) == 0) addr &= 0x0f;
381               M_WRTRAM(addr, data); break;   /* Indirect address */
346      case 00:   /* Not an actual register, nothing to save */
347               break;
382348      case 01:   cpustate->delay_timer = 2;      /* Timer starts after next two instructions */
383349               if (PSA == 0) cpustate->prescaler = 0;   /* Must clear the Prescaler */
384               cpustate->TMR0 = data; break;
350               cpustate->TMR0 = data;
351               break;
385352      case 02:   cpustate->PCL = data;
386               cpustate->PC = ((cpustate->STATUS & PA_REG) << 4) | data; break;
387      case 03:   cpustate->STATUS &= ~PA_REG; cpustate->STATUS |= (data & PA_REG); break;
388      case 04:   cpustate->FSR = (data | (~cpustate->picRAMmask)); break;
389      case 05:   data &= 0xf;      /* 4-bit port (only lower 4 bits used) */
390               P_OUT(0,data & (~cpustate->TRISA)); cpustate->PORTA = data; break;
391      case 06:   P_OUT(1,data & (~cpustate->TRISB)); cpustate->PORTB = data; break;
353               cpustate->PC = ((cpustate->STATUS & PA_REG) << 4) | data;
354               break;
355      case 03:   cpustate->STATUS &= (UINT8)(~PA_REG); cpustate->STATUS |= (data & PA_REG);
356               break;
357      case 04:   cpustate->FSR = (data | (UINT8)(~cpustate->picRAMmask));
358               break;
359      case 05:   data &= 0x0f;      /* 4-bit port (only lower 4 bits used) */
360               P_OUT(0,data & (UINT8)(~cpustate->TRISA)); cpustate->PORTA = data;
361               break;
362      case 06:   P_OUT(1,data & (UINT8)(~cpustate->TRISB)); cpustate->PORTB = data;
363               break;
392364      case 07:   if ((cpustate->picmodel == 0x16C55) || (cpustate->picmodel == 0x16C57)) {
393                  P_OUT(2,data & (~cpustate->TRISC));
365                  P_OUT(2,data & (UINT8)(~cpustate->TRISC));
394366                  cpustate->PORTC = data;
395367               }
396368               else {      /* PIC16C54, PIC16C56, PIC16C58 */
397369                  M_WRTRAM(addr, data);
398370               }
399371               break;
400      default:   M_WRTRAM(addr, data); break;
372      default:   M_WRTRAM(addr, data);
373               break;
401374   }
402375}
403376
r5613r5614
498471static void clrw(pic16c5x_state *cpustate)
499472{
500473   cpustate->W = 0;
501   SET(cpustate, Z_FLAG);
474   SET(cpustate->STATUS, Z_FLAG);
502475}
503476
504477static void clrf(pic16c5x_state *cpustate)
505478{
506479   STORE_REGFILE(cpustate, ADDR, 0);
507   SET(cpustate, Z_FLAG);
480   SET(cpustate->STATUS, Z_FLAG);
508481}
509482
510483static void clrwdt(pic16c5x_state *cpustate)
511484{
512485   cpustate->WDT = 0;
513486   if (PSA) cpustate->prescaler = 0;
514   SET(cpustate, TO_FLAG);
515   SET(cpustate, PD_FLAG);
487   SET(cpustate->STATUS, TO_FLAG);
488   SET(cpustate->STATUS, PD_FLAG);
516489}
517490
518491static void comf(pic16c5x_state *cpustate)
519492{
520   cpustate->ALU = ~(GET_REGFILE(cpustate, ADDR));
493   cpustate->ALU = (UINT8)(~(GET_REGFILE(cpustate, ADDR)));
521494   STORE_RESULT(cpustate, ADDR, cpustate->ALU);
522495   CALCULATE_Z_FLAG(cpustate);
523496}
r5613r5614
570543static void iorlw(pic16c5x_state *cpustate)
571544{
572545   cpustate->ALU = cpustate->opcode.b.l | cpustate->W;
573   STORE_RESULT(cpustate, ADDR, cpustate->ALU);
546   cpustate->W = cpustate->ALU;
574547   CALCULATE_Z_FLAG(cpustate);
575548}
576549
r5613r5614
605578
606579static void option(pic16c5x_state *cpustate)
607580{
608   cpustate->OPTION = cpustate->W & 0x3f;
581   cpustate->OPTION = cpustate->W & (T0CS_FLAG | T0SE_FLAG | PSA_FLAG | PS_REG);
609582}
610583
611584static void retlw(pic16c5x_state *cpustate)
r5613r5614
620593   cpustate->ALU = GET_REGFILE(cpustate, ADDR);
621594   cpustate->ALU <<= 1;
622595   if (cpustate->STATUS & C_FLAG) cpustate->ALU |= 1;
623   if (GET_REGFILE(cpustate, ADDR) & 0x80) SET(cpustate, C_FLAG);
624   else CLR(cpustate, C_FLAG);
596   if (GET_REGFILE(cpustate, ADDR) & 0x80) SET(cpustate->STATUS, C_FLAG);
597   else CLR(cpustate->STATUS, C_FLAG);
625598   STORE_RESULT(cpustate, ADDR, cpustate->ALU);
626599}
627600
r5613r5614
630603   cpustate->ALU = GET_REGFILE(cpustate, ADDR);
631604   cpustate->ALU >>= 1;
632605   if (cpustate->STATUS & C_FLAG) cpustate->ALU |= 0x80;
633   if (GET_REGFILE(cpustate, ADDR) & 1) SET(cpustate, C_FLAG);
634   else CLR(cpustate, C_FLAG);
606   if (GET_REGFILE(cpustate, ADDR) & 1) SET(cpustate->STATUS, C_FLAG);
607   else CLR(cpustate->STATUS, C_FLAG);
635608   STORE_RESULT(cpustate, ADDR, cpustate->ALU);
636609}
637610
r5613r5614
639612{
640613   if (WDTE) cpustate->WDT = 0;
641614   if (PSA) cpustate->prescaler = 0;
642   SET(cpustate, TO_FLAG);
643   CLR(cpustate, PD_FLAG);
615   SET(cpustate->STATUS, TO_FLAG);
616   CLR(cpustate->STATUS, PD_FLAG);
644617}
645618
646619static void subwf(pic16c5x_state *cpustate)
r5613r5614
664637{
665638   switch(cpustate->opcode.b.l & 0x7)
666639   {
667      case 05:   if (cpustate->TRISA == cpustate->W) break;
668               else cpustate->TRISA = cpustate->W; P_OUT(0,cpustate->PORTA & (~cpustate->TRISA) & 0xf); break;
669      case 06:   if (cpustate->TRISB == cpustate->W) break;
670               else cpustate->TRISB = cpustate->W; P_OUT(1,cpustate->PORTB & (~cpustate->TRISB)); break;
671      case 07:   if (cpustate->TRISC == cpustate->W) break;
672               else cpustate->TRISC = cpustate->W; P_OUT(2,cpustate->PORTC & (~cpustate->TRISC)); break;
640      case 05:   if   (cpustate->TRISA == cpustate->W) break;
641               else { cpustate->TRISA = cpustate->W | 0xf0; P_OUT(0,cpustate->PORTA & (UINT8)(~cpustate->TRISA) & 0x0f); break; }
642      case 06:   if   (cpustate->TRISB == cpustate->W) break;
643               else { cpustate->TRISB = cpustate->W; P_OUT(1,cpustate->PORTB & (UINT8)(~cpustate->TRISB)); break; }
644      case 07:   if ((cpustate->picmodel == 0x16C55) || (cpustate->picmodel == 0x16C57)) {
645                  if   (cpustate->TRISC == cpustate->W) break;
646                  else { cpustate->TRISC = cpustate->W; P_OUT(2,cpustate->PORTC & (UINT8)(~cpustate->TRISC)); break; }
647               }
648               else {
649                  illegal(cpustate); break;
650               }
673651      default:   illegal(cpustate); break;
674652   }
675653}
r5613r5614
697675
698676static const pic16c5x_opcode opcode_main[256]=
699677{
700/*00*/  {1, nop,   },{0, illegal   },{1, movwf      },{1, movwf      },{1, clrw      },{0, illegal   },{1, clrf      },{1, clrf      },
678/*00*/  {1, nop      },{0, illegal   },{1, movwf      },{1, movwf      },{1, clrw      },{0, illegal   },{1, clrf      },{1, clrf      },
701679/*08*/  {1, subwf   },{1, subwf      },{1, subwf      },{1, subwf      },{1, decf      },{1, decf      },{1, decf      },{1, decf      },
702680/*10*/  {1, iorwf   },{1, iorwf      },{1, iorwf      },{1, iorwf      },{1, andwf      },{1, andwf      },{1, andwf      },{1, andwf      },
703681/*18*/  {1, xorwf   },{1, xorwf      },{1, xorwf      },{1, xorwf      },{1, addwf      },{1, addwf      },{1, addwf      },{1, addwf      },
r5613r5614
732710};
733711
734712
735static const pic16c5x_opcode_00x opcode_00x[16]=
713static const pic16c5x_opcode opcode_00x[16]=
736714{
737715/*00*/  {1, nop      },{0, illegal   },{1, option   },{1, sleepic   },{1, clrwdt   },{1, tris      },{1, tris      },{1, tris      },
738716/*08*/  {0, illegal   },{0, illegal   },{0, illegal   },{0, illegal   },{0, illegal   },{0, illegal   },{0, illegal   },{0, illegal   }
r5613r5614
748726{
749727   pic16c5x_state *cpustate = get_safe_token(device);
750728
729   cpustate->device = device;
730   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
731   cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
732   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
733
734   /* ensure the internal ram pointers are set before get_info is called */
735   update_internalram_ptr(cpustate);
736
751737   state_save_register_device_item(device, 0, cpustate->W);
752738   state_save_register_device_item(device, 0, cpustate->ALU);
753739   state_save_register_device_item(device, 0, cpustate->OPTION);
r5613r5614
779765   state_save_register_device_item(device, 0, cpustate->icount);
780766   state_save_register_device_item(device, 0, cpustate->temp_config);
781767   state_save_register_device_item(device, 0, cpustate->inst_cycles);
782
783
784   cpustate->device = device;
785   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
786   cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
787   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
788768}
789769
790770
r5613r5614
799779   cpustate->TRISA  = 0xff;
800780   cpustate->TRISB  = 0xff;
801781   cpustate->TRISC  = 0xff;
802   cpustate->OPTION = 0x3f;
782   cpustate->OPTION = (T0CS_FLAG | T0SE_FLAG | PSA_FLAG | PS_REG);
803783   cpustate->PCL    = 0xff;
804   cpustate->FSR   |= (~cpustate->picRAMmask);
784   cpustate->FSR   |= (UINT8)(~cpustate->picRAMmask);
805785   cpustate->PORTA &= 0x0f;
806786   cpustate->prescaler = 0;
807787   cpustate->delay_timer = 0;
r5613r5614
811791
812792static void pic16c5x_soft_reset(pic16c5x_state *cpustate)
813793{
814   cpustate->STATUS &= 0x1f;
794   SET(cpustate->STATUS, (TO_FLAG | PD_FLAG | Z_FLAG | DC_FLAG | C_FLAG));
815795   pic16c5x_reset_regs(cpustate);
816796}
817797
r5613r5614
863843            cpustate->prescaler++;
864844            if (cpustate->prescaler >= (1 << PS)) {   /* Prescale values from 1 to 128 */
865845               cpustate->prescaler = 0;
866               CLR(cpustate, TO_FLAG);
846               CLR(cpustate->STATUS, TO_FLAG);
867847               pic16c5x_soft_reset(cpustate);
868848            }
869849         }
870850         else {
871            CLR(cpustate, TO_FLAG);
851            CLR(cpustate->STATUS, TO_FLAG);
872852            pic16c5x_soft_reset(cpustate);
873853         }
874854      }
r5613r5614
903883{
904884   pic16c5x_state *cpustate = get_safe_token(device);
905885   int T0_in;
886
887   update_internalram_ptr(cpustate);
888
906889   cpustate->icount = cycles;
907890
908891   do
r5613r5614
988971      case CPUINFO_INT_SP:
989972      case CPUINFO_INT_REGISTER + PIC16C5x_STK1:      cpustate->STACK[1] = info->i;               break;
990973      case CPUINFO_INT_REGISTER + PIC16C5x_STK0:      cpustate->STACK[0] = info->i;               break;
991      case CPUINFO_INT_REGISTER + PIC16C5x_W:          cpustate->W      = info->i;                  break;
974      case CPUINFO_INT_REGISTER + PIC16C5x_W:         cpustate->W      = info->i;                  break;
992975      case CPUINFO_INT_REGISTER + PIC16C5x_ALU:      cpustate->ALU    = info->i;                  break;
993976      case CPUINFO_INT_REGISTER + PIC16C5x_STR:      cpustate->STATUS = info->i;                  break;
994      case CPUINFO_INT_REGISTER + PIC16C5x_OPT:      cpustate->OPTION = info->i;                  break;
977      case CPUINFO_INT_REGISTER + PIC16C5x_OPT:      cpustate->OPTION = info->i & (T0CS_FLAG | T0SE_FLAG | PSA_FLAG | PS_REG);   break;
995978      case CPUINFO_INT_REGISTER + PIC16C5x_TMR0:      cpustate->TMR0   = info->i;                  break;
996979      case CPUINFO_INT_REGISTER + PIC16C5x_WDT:      cpustate->WDT    = info->i;                  break;
997980      case CPUINFO_INT_REGISTER + PIC16C5x_PSCL:      cpustate->prescaler = info->i;               break;
998      case CPUINFO_INT_REGISTER + PIC16C5x_PRTA:      cpustate->PORTA  = info->i;                  break;
981      case CPUINFO_INT_REGISTER + PIC16C5x_PRTA:      cpustate->PORTA  = info->i & 0x0f;            break;
999982      case CPUINFO_INT_REGISTER + PIC16C5x_PRTB:      cpustate->PORTB  = info->i;                  break;
1000983      case CPUINFO_INT_REGISTER + PIC16C5x_PRTC:      cpustate->PORTC  = info->i;                  break;
1001      case CPUINFO_INT_REGISTER + PIC16C5x_FSR:      cpustate->FSR    = (info->i & cpustate->picRAMmask);   break;
984      case CPUINFO_INT_REGISTER + PIC16C5x_FSR:      cpustate->FSR    = ((info->i & cpustate->picRAMmask) | (UINT8)(~cpustate->picRAMmask));   break;
1002985   }
1003986}
1004987
r5613r5614
1015998   switch (state)
1016999   {
10171000      /* --- the following bits of info are returned as 64-bit signed integers --- */
1018      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(pic16c5x_state);      break;
1019      case CPUINFO_INT_INPUT_LINES:               info->i = 0;                     break;
1020      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
1021      case DEVINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;         break;
1022      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                     break;
1023      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                     break;
1024      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 2;                     break;
1025      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 2;                     break;
1026      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
1027      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
1001      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(pic16c5x_state);   break;
1002      case CPUINFO_INT_INPUT_LINES:               info->i = 1;                  break;
1003      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                  break;
1004      case DEVINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;      break;
1005      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                  break;
1006      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                  break;
1007      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 2;                  break;
1008      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 2;                  break;
1009      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                  break;
1010      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                  break;
10281011
1029      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
1030      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 9;               break;
1031      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
1032      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
1033      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 5;               break;
1034      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1035      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1036      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 5;               break;
1037      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
1012      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 16;                  break;
1013      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:         info->i = 9;                  break;
1014      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:         info->i = -1;                  break;
1015      case CPUINFO_INT_DATABUS_WIDTH_DATA:         info->i = 8;                  break;
1016      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:         info->i = 5;                  break;
1017      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:         info->i = 0;                  break;
1018      case CPUINFO_INT_DATABUS_WIDTH_IO:            info->i = 8;                  break;
1019      case CPUINFO_INT_ADDRBUS_WIDTH_IO:            info->i = 5;                  break;
1020      case CPUINFO_INT_ADDRBUS_SHIFT_IO:            info->i = 0;                  break;
10381021
10391022      case CPUINFO_INT_PREVIOUSPC:               info->i = cpustate->PREVPC;                  break;
10401023
r5613r5614
10441027      case CPUINFO_INT_SP:
10451028      case CPUINFO_INT_REGISTER + PIC16C5x_STK1:      info->i = cpustate->STACK[1];               break;
10461029      case CPUINFO_INT_REGISTER + PIC16C5x_STK0:      info->i = cpustate->STACK[0];               break;
1047      case CPUINFO_INT_REGISTER + PIC16C5x_W:         info->i = cpustate->W;                     break;
1048      case CPUINFO_INT_REGISTER + PIC16C5x_ALU:       info->i = cpustate->ALU;                  break;
1049      case CPUINFO_INT_REGISTER + PIC16C5x_STR:       info->i = cpustate->STATUS;                  break;
1050      case CPUINFO_INT_REGISTER + PIC16C5x_OPT:       info->i = cpustate->OPTION;                  break;
1030      case CPUINFO_INT_REGISTER + PIC16C5x_W:         info->i = cpustate->W;                     break;
1031      case CPUINFO_INT_REGISTER + PIC16C5x_ALU:      info->i = cpustate->ALU;                  break;
1032      case CPUINFO_INT_REGISTER + PIC16C5x_STR:      info->i = cpustate->STATUS;                  break;
1033      case CPUINFO_INT_REGISTER + PIC16C5x_OPT:      info->i = cpustate->OPTION;                  break;
10511034      case CPUINFO_INT_REGISTER + PIC16C5x_TMR0:      info->i = cpustate->TMR0;                  break;
1052      case CPUINFO_INT_REGISTER + PIC16C5x_WDT:       info->i = cpustate->WDT;                  break;
1035      case CPUINFO_INT_REGISTER + PIC16C5x_WDT:      info->i = cpustate->WDT;                  break;
10531036      case CPUINFO_INT_REGISTER + PIC16C5x_PSCL:      info->i = cpustate->prescaler;               break;
10541037      case CPUINFO_INT_REGISTER + PIC16C5x_PRTA:      info->i = cpustate->PORTA;                  break;
10551038      case CPUINFO_INT_REGISTER + PIC16C5x_PRTB:      info->i = cpustate->PORTB;                  break;
10561039      case CPUINFO_INT_REGISTER + PIC16C5x_PRTC:      info->i = cpustate->PORTC;                  break;
1057      case CPUINFO_INT_REGISTER + PIC16C5x_FSR:       info->i = (cpustate->FSR & cpustate->picRAMmask);   break;
1040      case CPUINFO_INT_REGISTER + PIC16C5x_FSR:      info->i = ((cpustate->FSR & cpustate->picRAMmask) | (UINT8)(~cpustate->picRAMmask));   break;
10581041
10591042      /* --- the following bits of info are returned as pointers to data or functions --- */
10601043      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(pic16c5x);   break;
r5613r5614
10631046      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(pic16c5x);         break;
10641047      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(pic16c5x);      break;
10651048      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1066      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(pic16c5x);      break;
1049      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(pic16c5x);   break;
10671050      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
10681051
10691052      /* --- the following bits of info are returned as NULL-terminated strings --- */
1070      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C5x");         break;
1071      case DEVINFO_STR_FAMILY:               strcpy(info->s, "Microchip");         break;
1072      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.12");            break;
1073      case DEVINFO_STR_SOURCE_FILE:                  strcpy(info->s, __FILE__);            break;
1074      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright Tony La Porta"); break;
1053      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C5x");               break;
1054      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Microchip");               break;
1055      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.13");                  break;
1056      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                  break;
1057      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Tony La Porta");      break;
10751058
10761059      case CPUINFO_STR_FLAGS:
10771060         sprintf(info->s, "%01x%c%c%c%c%c %c%c%c%03x",
r5613r5614
10881071            cpustate->OPTION & 0x08 ? (1<<(cpustate->OPTION&7)) : (2<<(cpustate->OPTION&7)) );
10891072         break;
10901073
1091      case CPUINFO_STR_REGISTER + PIC16C5x_PC:         sprintf(info->s, "PC:%03X",   cpustate->PC); break;
1092      case CPUINFO_STR_REGISTER + PIC16C5x_W:          sprintf(info->s, "W:%02X",    cpustate->W); break;
1093      case CPUINFO_STR_REGISTER + PIC16C5x_ALU:        sprintf(info->s, "ALU:%02X",  cpustate->ALU); break;
1094      case CPUINFO_STR_REGISTER + PIC16C5x_STR:        sprintf(info->s, "STR:%02X",  cpustate->STATUS); break;
1095      case CPUINFO_STR_REGISTER + PIC16C5x_TMR0:       sprintf(info->s, "TMR:%02X",  cpustate->TMR0); break;
1096      case CPUINFO_STR_REGISTER + PIC16C5x_WDT:        sprintf(info->s, "WDT:%04X",  cpustate->WDT); break;
1097      case CPUINFO_STR_REGISTER + PIC16C5x_OPT:        sprintf(info->s, "OPT:%02X",  cpustate->OPTION); break;
1098      case CPUINFO_STR_REGISTER + PIC16C5x_STK0:       sprintf(info->s, "STK0:%03X", cpustate->STACK[0]); break;
1099      case CPUINFO_STR_REGISTER + PIC16C5x_STK1:       sprintf(info->s, "STK1:%03X", cpustate->STACK[1]); break;
1100      case CPUINFO_STR_REGISTER + PIC16C5x_PRTA:       sprintf(info->s, "PRTA:%01X", ((cpustate->PORTA) & 0xf)); break;
1101      case CPUINFO_STR_REGISTER + PIC16C5x_PRTB:       sprintf(info->s, "PRTB:%02X", cpustate->PORTB); break;
1102      case CPUINFO_STR_REGISTER + PIC16C5x_PRTC:       sprintf(info->s, "PRTC:%02X", cpustate->PORTC); break;
1103      case CPUINFO_STR_REGISTER + PIC16C5x_TRSA:       sprintf(info->s, "TRSA:%01X", ((cpustate->TRISA) & 0xf)); break;
1104      case CPUINFO_STR_REGISTER + PIC16C5x_TRSB:       sprintf(info->s, "TRSB:%02X", cpustate->TRISB); break;
1105      case CPUINFO_STR_REGISTER + PIC16C5x_TRSC:       sprintf(info->s, "TRSC:%02X", cpustate->TRISC); break;
1106      case CPUINFO_STR_REGISTER + PIC16C5x_FSR:        sprintf(info->s, "FSR:%02X",  ((cpustate->FSR) & cpustate->picRAMmask)); break;
1107      case CPUINFO_STR_REGISTER + PIC16C5x_PSCL:       sprintf(info->s, "PSCL:%c%02X", ((cpustate->OPTION & 0x08) ? 'W':'T'), cpustate->prescaler); break;
1074      case CPUINFO_STR_REGISTER + PIC16C5x_PC:      sprintf(info->s, "PC:%03X",   cpustate->PC);            break;
1075      case CPUINFO_STR_REGISTER + PIC16C5x_W:         sprintf(info->s, "W:%02X",    cpustate->W);               break;
1076      case CPUINFO_STR_REGISTER + PIC16C5x_ALU:      sprintf(info->s, "ALU:%02X",  cpustate->ALU);            break;
1077      case CPUINFO_STR_REGISTER + PIC16C5x_STR:      sprintf(info->s, "STR:%02X",  cpustate->STATUS);         break;
1078      case CPUINFO_STR_REGISTER + PIC16C5x_TMR0:      sprintf(info->s, "TMR:%02X",  cpustate->TMR0);            break;
1079      case CPUINFO_STR_REGISTER + PIC16C5x_WDT:      sprintf(info->s, "WDT:%04X",  cpustate->WDT);            break;
1080      case CPUINFO_STR_REGISTER + PIC16C5x_OPT:      sprintf(info->s, "OPT:%02X",  cpustate->OPTION);         break;
1081      case CPUINFO_STR_REGISTER + PIC16C5x_STK0:      sprintf(info->s, "STK0:%03X", cpustate->STACK[0]);         break;
1082      case CPUINFO_STR_REGISTER + PIC16C5x_STK1:      sprintf(info->s, "STK1:%03X", cpustate->STACK[1]);         break;
1083      case CPUINFO_STR_REGISTER + PIC16C5x_PRTA:      sprintf(info->s, "PRTA:%01X", ((cpustate->PORTA) & 0x0f));   break;
1084      case CPUINFO_STR_REGISTER + PIC16C5x_PRTB:      sprintf(info->s, "PRTB:%02X", cpustate->PORTB);            break;
1085      case CPUINFO_STR_REGISTER + PIC16C5x_PRTC:      sprintf(info->s, "PRTC:%02X", cpustate->PORTC);            break;
1086      case CPUINFO_STR_REGISTER + PIC16C5x_TRSA:      sprintf(info->s, "TRSA:%01X", ((cpustate->TRISA) & 0x0f));   break;
1087      case CPUINFO_STR_REGISTER + PIC16C5x_TRSB:      sprintf(info->s, "TRSB:%02X", cpustate->TRISB);            break;
1088      case CPUINFO_STR_REGISTER + PIC16C5x_TRSC:      sprintf(info->s, "TRSC:%02X", cpustate->TRISC);            break;
1089      case CPUINFO_STR_REGISTER + PIC16C5x_FSR:      sprintf(info->s, "FSR:%02X",  ((cpustate->FSR) & cpustate->picRAMmask) | (UINT8)(~cpustate->picRAMmask));   break;
1090      case CPUINFO_STR_REGISTER + PIC16C5x_PSCL:      sprintf(info->s, "PSCL:%c%02X", ((cpustate->OPTION & 0x08) ? 'W':'T'), cpustate->prescaler);   break;
11081091   }
11091092}
11101093
r5613r5614
11191102ADDRESS_MAP_END
11201103
11211104static ADDRESS_MAP_START( pic16c54_ram, ADDRESS_SPACE_DATA, 8 )
1122   AM_RANGE(0x00, 0x1f) AM_RAM
1105   AM_RANGE(0x00, 0x07) AM_RAM
1106   AM_RANGE(0x08, 0x0f) AM_RAM
1107   AM_RANGE(0x10, 0x1f) AM_RAM
11231108ADDRESS_MAP_END
11241109
11251110
r5613r5614
11311116{
11321117   pic16c5x_state *cpustate = get_safe_token(device);
11331118
1119   update_internalram_ptr(cpustate);
1120
11341121   cpustate->picmodel = 0x16C54;
11351122   cpustate->picRAMmask = 0x1f;
11361123   cpustate->reset_vector = 0x1ff;
11371124   pic16c5x_reset_regs(cpustate);
1138   cpustate->STATUS = 0x00;
1139   SET(cpustate, TO_FLAG);
1140   SET(cpustate, PD_FLAG);
1125   CLR(cpustate->STATUS, PA_REG);
1126   SET(cpustate->STATUS, (TO_FLAG | PD_FLAG));
11411127}
11421128
11431129
r5613r5614
11491135{
11501136   switch (state)
11511137   {
1138      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:         info->i = 9;                     break;
1139      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:         info->i = 5;                     break;
1140
11521141      /* --- the following bits of info are returned as pointers to data or functions --- */
1153      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c54);         break;
1154      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c54_rom); break;
1155      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c54_ram); break;
1142      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c54);               break;
1143      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c54_rom);   break;
1144      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c54_ram);   break;
11561145
11571146      /* --- the following bits of info are returned as NULL-terminated strings --- */
11581147      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C54");         break;
r5613r5614
11711160ADDRESS_MAP_END
11721161
11731162static ADDRESS_MAP_START( pic16c55_ram, ADDRESS_SPACE_DATA, 8 )
1174   AM_RANGE(0x00, 0x1f) AM_RAM
1163   AM_RANGE(0x00, 0x07) AM_RAM
1164   AM_RANGE(0x08, 0x0f) AM_RAM
1165   AM_RANGE(0x10, 0x1f) AM_RAM
11751166ADDRESS_MAP_END
11761167
11771168
r5613r5614
11831174{
11841175   pic16c5x_state *cpustate = get_safe_token(device);
11851176
1177   update_internalram_ptr(cpustate);
1178
11861179   cpustate->picmodel = 0x16C55;
11871180   cpustate->picRAMmask = 0x1f;
11881181   cpustate->reset_vector = 0x1ff;
11891182   pic16c5x_reset_regs(cpustate);
1190   cpustate->STATUS = 0x00;
1191   SET(cpustate, TO_FLAG);
1192   SET(cpustate, PD_FLAG);
1183   CLR(cpustate->STATUS, PA_REG);
1184   SET(cpustate->STATUS, (TO_FLAG | PD_FLAG));
11931185}
11941186
11951187
r5613r5614
12011193{
12021194   switch (state)
12031195   {
1196      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:         info->i = 9;                     break;
1197      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:         info->i = 5;                     break;
1198
12041199      /* --- the following bits of info are returned as pointers to data or functions --- */
1205      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c55);         break;
1206      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c55_rom); break;
1207      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c55_ram); break;
1200      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c55);               break;
1201      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c55_rom);   break;
1202      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c55_ram);   break;
12081203
12091204      /* --- the following bits of info are returned as NULL-terminated strings --- */
12101205      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C55");         break;
r5613r5614
12231218ADDRESS_MAP_END
12241219
12251220static ADDRESS_MAP_START( pic16c56_ram, ADDRESS_SPACE_DATA, 8 )
1226   AM_RANGE(0x00, 0x1f) AM_RAM
1221   AM_RANGE(0x00, 0x07) AM_RAM
1222   AM_RANGE(0x08, 0x0f) AM_RAM
1223   AM_RANGE(0x10, 0x1f) AM_RAM
12271224ADDRESS_MAP_END
12281225
12291226
r5613r5614
12351232{
12361233   pic16c5x_state *cpustate = get_safe_token(device);
12371234
1235   update_internalram_ptr(cpustate);
1236
12381237   cpustate->picmodel = 0x16C56;
12391238   cpustate->picRAMmask = 0x1f;
12401239   cpustate->reset_vector = 0x3ff;
12411240   pic16c5x_reset_regs(cpustate);
1242   cpustate->STATUS = 0x00;
1243   SET(cpustate, TO_FLAG);
1244   SET(cpustate, PD_FLAG);
1241   CLR(cpustate->STATUS, PA_REG);
1242   SET(cpustate->STATUS, (TO_FLAG | PD_FLAG));
12451243}
12461244
12471245
r5613r5614
12531251{
12541252   switch (state)
12551253   {
1254      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:         info->i = 10;                     break;
1255      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:         info->i = 5;                     break;
1256
12561257      /* --- the following bits of info are returned as pointers to data or functions --- */
1257      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c56);         break;
1258      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c56_rom); break;
1259      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c56_ram); break;
1258      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c56);               break;
1259      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c56_rom);   break;
1260      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c56_ram);   break;
12601261
1261      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
1262
12631262      /* --- the following bits of info are returned as NULL-terminated strings --- */
12641263      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C56");         break;
12651264
r5613r5614
12771276ADDRESS_MAP_END
12781277
12791278static ADDRESS_MAP_START( pic16c57_ram, ADDRESS_SPACE_DATA, 8 )
1280   AM_RANGE(0x00, 0x1f) AM_RAM
1279   AM_RANGE(0x00, 0x07) AM_RAM AM_MIRROR(0x60)
1280   AM_RANGE(0x08, 0x0f) AM_RAM AM_MIRROR(0x60)
1281   AM_RANGE(0x10, 0x1f) AM_RAM
12811282   AM_RANGE(0x30, 0x3f) AM_RAM
12821283   AM_RANGE(0x50, 0x5f) AM_RAM
12831284   AM_RANGE(0x70, 0x7f) AM_RAM
r5613r5614
12921293{
12931294   pic16c5x_state *cpustate = get_safe_token(device);
12941295
1296   update_internalram_ptr(cpustate);
1297
12951298   cpustate->picmodel = 0x16C57;
12961299   cpustate->picRAMmask = 0x7f;
12971300   cpustate->reset_vector = 0x7ff;
12981301   pic16c5x_reset_regs(cpustate);
1299   cpustate->STATUS = 0x00;
1300   SET(cpustate, TO_FLAG);
1301   SET(cpustate, PD_FLAG);
1302   CLR(cpustate->STATUS, PA_REG);
1303   SET(cpustate->STATUS, (TO_FLAG | PD_FLAG));
13021304}
13031305
13041306
r5613r5614
13101312{
13111313   switch (state)
13121314   {
1315      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;                           break;
1316      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;                           break;
13131317      /* --- the following bits of info are returned as pointers to data or functions --- */
1314      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c57);         break;
1315      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c57_rom); break;
1316      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c57_ram); break;
1318      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c57);               break;
1319      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c57_rom);   break;
1320      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c57_ram);   break;
13171321
1318      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
1319      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
1320
13211322      /* --- the following bits of info are returned as NULL-terminated strings --- */
13221323      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C57");         break;
13231324
r5613r5614
13351336ADDRESS_MAP_END
13361337
13371338static ADDRESS_MAP_START( pic16c58_ram, ADDRESS_SPACE_DATA, 8 )
1338   AM_RANGE(0x00, 0x1f) AM_RAM
1339   AM_RANGE(0x00, 0x07) AM_RAM AM_MIRROR(0x60)
1340   AM_RANGE(0x08, 0x0f) AM_RAM AM_MIRROR(0x60)
1341   AM_RANGE(0x10, 0x1f) AM_RAM
13391342   AM_RANGE(0x30, 0x3f) AM_RAM
13401343   AM_RANGE(0x50, 0x5f) AM_RAM
13411344   AM_RANGE(0x70, 0x7f) AM_RAM
r5613r5614
13501353{
13511354   pic16c5x_state *cpustate = get_safe_token(device);
13521355
1356   update_internalram_ptr(cpustate);
1357
13531358   cpustate->picmodel = 0x16C58;
13541359   cpustate->picRAMmask = 0x7f;
13551360   cpustate->reset_vector = 0x7ff;
13561361   pic16c5x_reset_regs(cpustate);
1357   cpustate->STATUS = 0x00;
1358   SET(cpustate, TO_FLAG);
1359   SET(cpustate, PD_FLAG);
1362   CLR(cpustate->STATUS, PA_REG);
1363   SET(cpustate->STATUS, (TO_FLAG | PD_FLAG));
13601364}
13611365
13621366
r5613r5614
13681372{
13691373   switch (state)
13701374   {
1375      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;                        break;
1376      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;                        break;
13711377      /* --- the following bits of info are returned as pointers to data or functions --- */
1372      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c58);         break;
1373      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c58_rom); break;
1374      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c58_ram); break;
1378      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c58);               break;
1379      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c58_rom);   break;
1380      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c58_ram);   break;
13751381
1376      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
1377      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
1378
13791382      /* --- the following bits of info are returned as NULL-terminated strings --- */
13801383      case DEVINFO_STR_NAME:                     strcpy(info->s, "PIC16C58");         break;
13811384
src/emu/uigfx.c
r5613r5614
994994
995995   /* handle navigation (up,down,left,right) */
996996   step = 8;
997   if (input_code_pressed(KEYCODE_LSHIFT)) step = 1;
998   if (input_code_pressed(KEYCODE_LCONTROL)) step = 64;
997   if (input_code_pressed(machine, KEYCODE_LSHIFT)) step = 1;
998   if (input_code_pressed(machine, KEYCODE_LCONTROL)) step = 64;
999999   if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
10001000      state->tilemap.yoffs -= step;
10011001   if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
src/emu/video/v9938.c
r5613r5614
13941394have to test.
13951395*/
13961396
1397static void v9938_interrupt_start_vblank (void)
1397static void v9938_interrupt_start_vblank (running_machine *machine)
13981398   {
13991399#if 0
1400   if (input_code_pressed (KEYCODE_D) )
1400   if (input_code_pressed (machine, KEYCODE_D) )
14011401      {
14021402      FILE *fp;
14031403      int i;
r5613r5614
14921492   /* check for start of vblank */
14931493   if ((pal && (vdp->scanline == 310)) ||
14941494      (!pal && (vdp->scanline == 259)))
1495      v9938_interrupt_start_vblank ();
1495      v9938_interrupt_start_vblank (machine);
14961496
14971497   /* render the current line */
14981498   if ((vdp->scanline >= scanline_start) && (vdp->scanline < (212 + 28 + scanline_start)))
src/emu/video/voodoo.c
r5613r5614
379379   }
380380
381381   /* debugging! */
382   if (input_code_pressed(KEYCODE_L))
382   if (input_code_pressed(device->machine, KEYCODE_L))
383383      drawbuf = v->fbi.backbuf;
384384
385385   /* copy from the current front buffer */
r5613r5614
393393      }
394394
395395   /* update stats display */
396   statskey = (input_code_pressed(KEYCODE_BACKSLASH) != 0);
396   statskey = (input_code_pressed(device->machine, KEYCODE_BACKSLASH) != 0);
397397   if (statskey && statskey != v->stats.lastkey)
398398      v->stats.display = !v->stats.display;
399399   v->stats.lastkey = statskey;
r5613r5614
403403      popmessage(v->stats.buffer, 0, 0);
404404
405405   /* update render override */
406   v->stats.render_override = input_code_pressed(KEYCODE_ENTER);
406   v->stats.render_override = input_code_pressed(device->machine, KEYCODE_ENTER);
407407   if (DEBUG_DEPTH && v->stats.render_override)
408408   {
409409      for (y = cliprect->min_y; y <= cliprect->max_y; y++)
src/emu/video/poly.c
r5613r5614
421421
422422   /* remember the start time if we're logging */
423423   if (LOG_WAITS)
424      time = osd_profiling_ticks();
424      time = get_profile_ticks();
425425
426426   /* wait for all pending work items to complete */
427427   if (poly->queue != NULL)
r5613r5614
438438   /* log any long waits */
439439   if (LOG_WAITS)
440440   {
441      time = osd_profiling_ticks() - time;
441      time = get_profile_ticks() - time;
442442      if (time > LOG_WAIT_THRESHOLD)
443443         logerror("Poly:Waited %d cycles for %s\n", (int)time, debug_reason);
444444   }
src/emu/eigccx86.h
r5613r5614
644644   return result - 1;
645645}
646646
647
648
649/***************************************************************************
650    INLINE TIMING FUNCTIONS
651***************************************************************************/
652
653/*-------------------------------------------------
654    get_profile_ticks - return a tick counter
655    from the processor that can be used for
656    profiling. It does not need to run at any
657    particular rate.
658-------------------------------------------------*/
659
660#define get_profile_ticks _get_profile_ticks
661INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
662{
663    UINT64 result;
664    __asm__ __volatile__ (
665            "rdtsc"
666            : "=A" (result)
667    );
668    return (INT64) (result & U64(0x7fffffffffffffff));
669}
670
647671#endif /* __EIGCCX86__ */
src/emu/uiinput.c
r5613r5614
104104   /* update the state of all the UI keys */
105105   for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
106106   {
107      int pressed = input_seq_pressed(input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
107      int pressed = input_seq_pressed(machine, input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
108108      if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
109109         uidata->seqpressed[code] = pressed;
110110   }
src/emu/uimenu.c
r5613r5614
278278static void menu_input_specific_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate);
279279static void menu_input_common(running_machine *machine, ui_menu *menu, void *parameter, void *state);
280280static int CLIB_DECL menu_input_compare_items(const void *i1, const void *i2);
281static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate);
281static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate);
282282static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, void *parameter, void *state);
283283static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, void *parameter, void *state);
284284static void menu_settings_categories(running_machine *machine, ui_menu *menu, void *parameter, void *state);
r5613r5614
16291629      }
16301630
16311631   /* sort and populate the menu in a standard fashion */
1632   menu_input_populate_and_sort(menu, itemlist, menustate);
1632   menu_input_populate_and_sort(machine, menu, itemlist, menustate);
16331633   astring_free(tempstring);
16341634}
16351635
r5613r5614
17091709      }
17101710
17111711   /* sort and populate the menu in a standard fashion */
1712   menu_input_populate_and_sort(menu, itemlist, menustate);
1712   menu_input_populate_and_sort(machine, menu, itemlist, menustate);
17131713   astring_free(tempstring);
17141714}
17151715
r5613r5614
17581758      }
17591759
17601760      /* poll again; if finished, update the sequence */
1761      if (input_seq_poll(&newseq))
1761      if (input_seq_poll(machine, &newseq))
17621762      {
17631763         menustate->pollingitem = NULL;
17641764         menustate->record_next = TRUE;
r5613r5614
17781778            menustate->pollingitem = item;
17791779            menustate->last_sortorder = item->sortorder;
17801780            menustate->starting_seq = item->seq;
1781            input_seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
1781            input_seq_poll_start(machine, (item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
17821782            invalidate = TRUE;
17831783            break;
17841784
r5613r5614
18541854    menu from them
18551855-------------------------------------------------*/
18561856
1857static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate)
1857static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate)
18581858{
18591859   const char *nameformat[INPUT_TYPE_TOTAL] = { 0 };
18601860   input_item_data **itemarray, *item;
r5613r5614
19001900      /* otherwise, generate the sequence name and invert it if different from the default */
19011901      else
19021902      {
1903         input_seq_name(subtext, &item->seq);
1903         input_seq_name(machine, subtext, &item->seq);
19041904         flags |= input_seq_cmp(&item->seq, item->defseq) ? MENU_FLAG_INVERT : 0;
19051905      }
19061906
r5613r5614
22252225
22262226         /* left decrements */
22272227         case IPT_UI_LEFT:
2228            newval -= input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
2228            newval -= input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
22292229            break;
22302230
22312231         /* right increments */
22322232         case IPT_UI_RIGHT:
2233            newval += input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
2233            newval += input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
22342234            break;
22352235      }
22362236
r5613r5614
24942494   {
24952495      int changed = FALSE;
24962496
2497      /* handle reset all */
2498      if ((FPTR)event->itemref == 1 && event->iptkey == IPT_UI_SELECT)
2497      /* clear cheat comment on any movement or keypress */
2498      popmessage(NULL);
2499
2500      /* handle reset all + reset all cheats for reload all option */
2501      if ((FPTR)event->itemref < 3 && event->iptkey == IPT_UI_SELECT)
24992502      {
25002503         void *curcheat;
25012504         for (curcheat = cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL);
r5613r5614
25062509         }
25072510      }
25082511
2512
25092513      /* handle individual cheats */
2510      else if ((FPTR)event->itemref > 1)
2514      else if ((FPTR)event->itemref > 2)
25112515      {
25122516         switch (event->iptkey)
25132517         {
r5613r5614
25302534            case IPT_UI_RIGHT:
25312535               changed = cheat_select_next_state(machine, event->itemref);
25322536               break;
2537
2538            /* bring up display comment if one exists */
2539            case IPT_UI_DISPLAY_COMMENT:
2540            case IPT_UI_UP:
2541            case IPT_UI_DOWN:
2542               if (cheat_get_comment(event->itemref) != NULL)
2543                  popmessage("Cheat Comment:\n%s", astring_c(cheat_get_comment(event->itemref)));
2544               break;
25332545         }
25342546      }
25352547
2548      /* handle reload all  */
2549      if ((FPTR)event->itemref == 2 && event->iptkey == IPT_UI_SELECT)
2550      {
2551         /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */
2552         cheat_reload(machine);
2553
2554         /* display the reloaded cheats */
2555         ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
2556         popmessage("All cheats reloaded");
2557      }
2558
25362559      /* if things changed, update */
25372560      if (changed)
25382561         ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
r5613r5614
25632586
25642587   /* add a reset all option */
25652588   ui_menu_item_append(menu, "Reset All", NULL, 0, (void *)1);
2589
2590   /* add a reload all cheats option */
2591   ui_menu_item_append(menu, "Reload All", NULL, 0, (void *)2);
25662592}
25672593
25682594
r5613r5614
27162742
27172743            /* decrease value */
27182744            case IPT_UI_LEFT:
2719               if (input_code_pressed(KEYCODE_LALT) || input_code_pressed(KEYCODE_RALT))
2745               if (input_code_pressed(machine, KEYCODE_LALT) || input_code_pressed(machine, KEYCODE_RALT))
27202746                  increment = -1;
2721               else if (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT))
2747               else if (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))
27222748                  increment = (slider->incval > 10) ? -(slider->incval / 10) : -1;
2723               else if (input_code_pressed(KEYCODE_LCONTROL) || input_code_pressed(KEYCODE_RCONTROL))
2749               else if (input_code_pressed(machine, KEYCODE_LCONTROL) || input_code_pressed(machine, KEYCODE_RCONTROL))
27242750                  increment = -slider->incval * 10;
27252751               else
27262752                  increment = -slider->incval;
r5613r5614
27282754
27292755            /* increase value */
27302756            case IPT_UI_RIGHT:
2731               if (input_code_pressed(KEYCODE_LALT) || input_code_pressed(KEYCODE_RALT))
2757               if (input_code_pressed(machine, KEYCODE_LALT) || input_code_pressed(machine, KEYCODE_RALT))
27322758                  increment = 1;
2733               else if (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT))
2759               else if (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))
27342760                  increment = (slider->incval > 10) ? (slider->incval / 10) : 1;
2735               else if (input_code_pressed(KEYCODE_LCONTROL) || input_code_pressed(KEYCODE_RCONTROL))
2761               else if (input_code_pressed(machine, KEYCODE_LCONTROL) || input_code_pressed(machine, KEYCODE_RCONTROL))
27362762                  increment = slider->incval * 10;
27372763               else
27382764                  increment = slider->incval;
r5613r5614
30953121
30963122         /* left decrements */
30973123         case IPT_UI_LEFT:
3098            newval -= input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
3124            newval -= input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
30993125            break;
31003126
31013127         /* right increments */
31023128         case IPT_UI_RIGHT:
3103            newval += input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
3129            newval += input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
31043130            break;
31053131      }
31063132
src/emu/eminline.h
r5613r5614
430430}
431431#endif
432432
433
434
435/***************************************************************************
436    INLINE TIMING FUNCTIONS
437***************************************************************************/
438
439/*-------------------------------------------------
440    get_profile_ticks - return a tick counter
441    from the processor that can be used for
442    profiling. It does not need to run at any
443    particular rate.
444-------------------------------------------------*/
445
446#ifndef get_profile_ticks
447INLINE INT64 get_profile_ticks(void)
448{
449   return osd_ticks();
450}
451#endif
452
433453#endif /* __EMINLINE__ */
src/emu/inptport.c
r5613r5614
449449static void frame_update_callback(running_machine *machine);
450450static void frame_update(running_machine *machine);
451451static void frame_update_digital_joysticks(running_machine *machine);
452static void frame_update_analog_field(analog_field_state *analog);
452static void frame_update_analog_field(running_machine *machine, analog_field_state *analog);
453453static int frame_get_digital_field_state(const input_field_config *field, int mouse_down);
454454
455455/* port configuration helpers */
r5613r5614
478478
479479/* settings save */
480480static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode);
481static void save_sequence(xml_data_node *parentnode, int type, int porttype, const input_seq *seq);
481static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq);
482482static int save_this_input_field_type(int type);
483483static void save_default_inputs(running_machine *machine, xml_data_node *parentnode);
484484static void save_game_inputs(running_machine *machine, xml_data_node *parentnode);
r5613r5614
11741174
11751175int input_type_pressed(running_machine *machine, int type, int player)
11761176{
1177   return input_seq_pressed(input_type_seq(machine, type, player, SEQ_TYPE_STANDARD));
1177   return input_seq_pressed(machine, input_type_seq(machine, type, player, SEQ_TYPE_STANDARD));
11781178}
11791179
11801180
r5613r5614
13211321                  value *= field->crossscale;
13221322               value += field->crossoffset;
13231323
1324               /* apply custom mapping if necessary */
1325               if (field->crossmapper != NULL)
1326                  value = (*field->crossmapper)(field, value);
1327
13241328               /* handle X axis */
13251329               if (field->crossaxis == CROSSHAIR_AXIS_X)
13261330               {
r5613r5614
16461650         for (field = port->fieldlist; field != NULL; field = field->next)
16471651            if (field->state->joystick != NULL && field->way == 4)
16481652            {
1649               input_device_set_joystick_map(-1, (field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky);
1653               input_device_set_joystick_map(machine, -1, (field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky);
16501654               break;
16511655            }
16521656}
r5613r5614
16951699      mame_printf_error("Invalid %s value %s; reverting to keyboard\n", option, stemp);
16961700
16971701   /* only scan the list if we haven't already enabled this class of control */
1698   if (!input_device_class_enabled(autoenable))
1702   if (!input_device_class_enabled(portlist->machine, autoenable))
16991703      for (port = portlist; port != NULL; port = port->next)
17001704         for (field = port->fieldlist; field != NULL; field = field->next)
17011705
r5613r5614
17051709               (type3 != 0 && field->type == type3))
17061710            {
17071711               mame_printf_verbose("Input: Autoenabling %s due to presence of a %s\n", autostring, ananame);
1708               input_device_class_enable(autoenable, TRUE);
1712               input_device_class_enable(portlist->machine, autoenable, TRUE);
17091713               break;
17101714            }
17111715}
r5613r5614
19881992
19891993            /* handle analog inputs */
19901994            else if (field->state->analog != NULL)
1991               frame_update_analog_field(field->state->analog);
1995               frame_update_analog_field(machine, field->state->analog);
19921996
19931997            /* handle non-analog types, but only when the UI isn't visible */
19941998            else if (!ui_visible && frame_get_digital_field_state(field, field == mouse_field))
r5613r5614
20502054            joystick->current = 0;
20512055
20522056            /* read all the associated ports */
2053            if (joystick->field[JOYDIR_UP] != NULL && input_seq_pressed(input_field_seq(joystick->field[JOYDIR_UP], SEQ_TYPE_STANDARD)))
2057            if (joystick->field[JOYDIR_UP] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_UP], SEQ_TYPE_STANDARD)))
20542058               joystick->current |= JOYDIR_UP_BIT;
2055            if (joystick->field[JOYDIR_DOWN] != NULL && input_seq_pressed(input_field_seq(joystick->field[JOYDIR_DOWN], SEQ_TYPE_STANDARD)))
2059            if (joystick->field[JOYDIR_DOWN] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_DOWN], SEQ_TYPE_STANDARD)))
20562060               joystick->current |= JOYDIR_DOWN_BIT;
2057            if (joystick->field[JOYDIR_LEFT] != NULL && input_seq_pressed(input_field_seq(joystick->field[JOYDIR_LEFT], SEQ_TYPE_STANDARD)))
2061            if (joystick->field[JOYDIR_LEFT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_LEFT], SEQ_TYPE_STANDARD)))
20582062               joystick->current |= JOYDIR_LEFT_BIT;
2059            if (joystick->field[JOYDIR_RIGHT] != NULL && input_seq_pressed(input_field_seq(joystick->field[JOYDIR_RIGHT], SEQ_TYPE_STANDARD)))
2063            if (joystick->field[JOYDIR_RIGHT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_RIGHT], SEQ_TYPE_STANDARD)))
20602064               joystick->current |= JOYDIR_RIGHT_BIT;
20612065
20622066            /* lock out opposing directions (left + right or up + down) */
r5613r5614
21172121    internals of a single analog field
21182122-------------------------------------------------*/
21192123
2120static void frame_update_analog_field(analog_field_state *analog)
2124static void frame_update_analog_field(running_machine *machine, analog_field_state *analog)
21212125{
21222126   input_item_class itemclass;
21232127   int keypressed = FALSE;
r5613r5614
21292133   analog->previous = analog->accum = apply_analog_min_max(analog, analog->accum);
21302134
21312135   /* get the new raw analog value and its type */
2132   rawvalue = input_seq_axis_value(input_field_seq(analog->field, SEQ_TYPE_STANDARD), &itemclass);
2136   rawvalue = input_seq_axis_value(machine, input_field_seq(analog->field, SEQ_TYPE_STANDARD), &itemclass);
21332137
21342138   /* if we got an absolute input, it overrides everything else */
21352139   if (itemclass == ITEM_CLASS_ABSOLUTE)
r5613r5614
21872191
21882192   /* if the decrement code sequence is pressed, add the key delta to */
21892193   /* the accumulated delta; also note that the last input was a digital one */
2190   if (input_seq_pressed(input_field_seq(analog->field, SEQ_TYPE_DECREMENT)))
2194   if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_DECREMENT)))
21912195   {
21922196      keypressed = TRUE;
21932197      if (analog->delta != 0)
r5613r5614
21992203   }
22002204
22012205   /* same for the increment code sequence */
2202   if (input_seq_pressed(input_field_seq(analog->field, SEQ_TYPE_INCREMENT)))
2206   if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_INCREMENT)))
22032207   {
22042208      keypressed = TRUE;
22052209      if (analog->delta)
r5613r5614
22632267
22642268static int frame_get_digital_field_state(const input_field_config *field, int mouse_down)
22652269{
2266   int curstate = mouse_down || input_seq_pressed(input_field_seq(field, SEQ_TYPE_STANDARD));
2270   int curstate = mouse_down || input_seq_pressed(field->port->machine, input_field_seq(field, SEQ_TYPE_STANDARD));
22672271   int changed = FALSE;
22682272
22692273   /* if the state changed, look for switch down/switch up */
r5613r5614
27132717            curfield->crossoffset *= 1.0f / 65536.0f;
27142718            break;
27152719
2720         /* crosshair mapper callback */
2721         case INPUT_TOKEN_CROSSHAIR_MAPPER:
2722            if (curfield == NULL)
2723            {
2724               error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CROSSHAIR_MAPPER encountered with no active field\n");
2725               TOKEN_SKIP_PTR(ipt);
2726               break;
2727            }
2728            curfield->crossmapper = TOKEN_GET_PTR(ipt, crossmapptr);
2729            break;
2730
27162731         /* analog decrement sequence */
27172732         case INPUT_TOKEN_CODE_DEC:
27182733            TOKEN_UNGET_UINT32(ipt);
r5613r5614
34033418         {
34043419            if (strcmp(seqnode->value, "NONE") == 0)
34053420               input_seq_set_0(&newseq[seqtype]);
3406            else if (input_seq_from_tokens(seqnode->value, &tempseq) != 0)
3421            else if (input_seq_from_tokens(machine, seqnode->value, &tempseq) != 0)
34073422               newseq[seqtype] = tempseq;
34083423         }
34093424      }
r5613r5614
34593474      count = 0;
34603475      for (remapnode = xml_get_sibling(parentnode->child, "remap"); remapnode != NULL; remapnode = xml_get_sibling(remapnode->next, "remap"))
34613476      {
3462         input_code origcode = input_code_from_token(xml_get_attribute_string(remapnode, "origcode", ""));
3463         input_code newcode = input_code_from_token(xml_get_attribute_string(remapnode, "newcode", ""));
3477         input_code origcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "origcode", ""));
3478         input_code newcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "newcode", ""));
34643479         if (origcode != INPUT_CODE_INVALID && newcode != INPUT_CODE_INVALID)
34653480         {
34663481            oldtable[count] = origcode;
r5613r5614
36093624    sequence
36103625-------------------------------------------------*/
36113626
3612static void save_sequence(xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
3627static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
36133628{
36143629   astring *seqstring = astring_alloc();
36153630   xml_data_node *seqnode;
r5613r5614
36183633   if (input_seq_get_1(seq) == SEQCODE_END)
36193634      astring_cpyc(seqstring, "NONE");
36203635   else
3621      input_seq_to_tokens(seqstring, seq);
3636      input_seq_to_tokens(machine, seqstring, seq);
36223637
36233638   /* add the new node */
36243639   seqnode = xml_add_child(parentnode, "newseq", astring_c(seqstring));
r5613r5614
36843699               /* add only the sequences that have changed from the defaults */
36853700               for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
36863701                  if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
3687                     save_sequence(portnode, seqtype, typestate->typedesc.type, &typestate->seq[seqtype]);
3702                     save_sequence(machine, portnode, seqtype, typestate->typedesc.type, &typestate->seq[seqtype]);
36883703            }
36893704         }
36903705      }
r5613r5614
37453760                  /* add sequences if changed */
37463761                  for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
37473762                     if (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0)
3748                        save_sequence(portnode, seqtype, field->type, &field->state->seq[seqtype]);
3763                        save_sequence(machine, portnode, seqtype, field->type, &field->state->seq[seqtype]);
37493764
37503765                  /* write out non-analog changes */
37513766                  if (field->state->analog == NULL)
src/emu/mame.c
r5613r5614
335335         /* load the configuration settings and NVRAM */
336336         settingsloaded = config_load_settings(machine);
337337         nvram_load(machine);
338         sound_mute(FALSE);
338         sound_mute(machine, FALSE);
339339
340340         /* display the startup screens */
341341         ui_display_startup_screens(machine, firstrun, !settingsloaded);
r5613r5614
377377         end_resource_tracking();
378378
379379         /* save the NVRAM and configuration */
380         sound_mute(TRUE);
380         sound_mute(machine, TRUE);
381381         nvram_save(machine);
382382         config_save_settings(machine);
383383      }
src/emu/inpttype.h
r5613r5614
595595   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_PAGE_DOWN,        "UI Page Down",           SEQ_DEF_1(KEYCODE_PGDN) )
596596   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_SELECT,           "UI Select",              SEQ_DEF_3(KEYCODE_ENTER, SEQCODE_OR, INDEXED(JOYCODE_BUTTON1, 0)) )
597597   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_CANCEL,           "UI Cancel",              SEQ_DEF_1(KEYCODE_ESC) )
598   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_DISPLAY_COMMENT,  "UI Display Comment",     SEQ_DEF_1(KEYCODE_SPACE) )
598599   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_CLEAR,            "UI Clear",               SEQ_DEF_1(KEYCODE_DEL) )
599600   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_ZOOM_IN,          "UI Zoom In",             SEQ_DEF_1(KEYCODE_EQUALS) )
600601   INPUT_PORT_DIGITAL_TYPE( 0, UI,      UI_ZOOM_OUT,         "UI Zoom Out",            SEQ_DEF_1(KEYCODE_MINUS) )
src/emu/eigccppc.h
r5613r5614
470470   return result;
471471}
472472
473
474
475/***************************************************************************
476    INLINE TIMING FUNCTIONS
477***************************************************************************/
478
479/*-------------------------------------------------
480    get_profile_ticks - return a tick counter
481    from the processor that can be used for
482    profiling. It does not need to run at any
483    particular rate.
484-------------------------------------------------*/
485
486#define get_profile_ticks _get_profile_ticks
487INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
488{
489   // fix me - should use the time base
490   return osd_ticks();
491}
492
473493#endif /* __EIGCCPPC__ */
src/emu/machine/6526cia.c
r5613r5614
745745         data = timer->mode;
746746         break;
747747   }
748
749748   return data;
750749}
751750
r5613r5614
937936      default:   DEVICE_GET_INFO_CALL(cia6526r1);   break;
938937   }
939938}
939
src/emu/machine/68681.c
r5613r5614
111111static void duart68681_update_interrupts(duart68681_state *duart68681)
112112{
113113   /* update SR state and update interrupt ISR state for the following bits:
114   SRn: bits 7-4: handled elsewhere.
115   SRn: bit 3 (TxEMTn) (we can assume since we're not actually emulating the delay/timing of sending bits, that as long as TxRDYn is set, TxEMTn is also set since the transmit byte has 'already happened', therefore TxEMTn is always 1 assuming tx is enabled on channel n and the MSR2n mode is 0 or 2; in mode 1 it is explicitly zeroed, and mode 3 is undefined)
116   SRn: bit 2 (TxRDYn) (we COULD assume since we're not emulating delay and timing output, that as long as tx is enabled on channel n, TxRDY is 1 for channel n and the MSR2n mode is 0 or 2; in mode 1 it is explicitly zeroed, and mode 3 is undefined; however, tx_ready is already nicely handled for us elsewhere, so we can use that instead for now, though we may need to retool that code as well)
117   SRn: bit 1 (FFULLn) (this bit we actually emulate; if the recieve fifo for channel n is full, this bit is 1, otherwise it is 0. the recieve fifo should be three words long.)
118   SRn: bit 0 (RxRDYn) (this bit we also emulate; the bit is always asserted if the recieve fifo is not empty)
119   ISR: bit 7: Input Port change; this should be handled elsewhere, on the input port handler
120   ISR: bit 6: Delta Break B; this should be handled elsewhere, on the data recieve handler
121   ISR: bit 5: RxRDYB/FFULLB: this is handled here; depending on whether MSR1B bit 6 is 0 or 1, this bit holds the state of SRB bit 0 or bit 1 respectively
122   ISR: bit 4: TxRDYB: this is handled here; it mirrors SRB bit 2
123   ISR: bit 3: Counter ready; this should be handled by the timer generator
124   ISR: bit 2: Delta Break A; this should be handled elsewhere, on the data recieve handler
125   ISR: bit 1: RxRDYA/FFULLA: this is handled here; depending on whether MSR1A bit 6 is 0 or 1, this bit holds the state of SRA bit 0 or bit 1 respectively
126   ISR: bit 0: TxRDYA: this is handled here; it mirrors SRA bit 2
127   */
114    SRn: bits 7-4: handled elsewhere.
115    SRn: bit 3 (TxEMTn) (we can assume since we're not actually emulating the delay/timing of sending bits, that as long as TxRDYn is set, TxEMTn is also set since the transmit byte has 'already happened', therefore TxEMTn is always 1 assuming tx is enabled on channel n and the MSR2n mode is 0 or 2; in mode 1 it is explicitly zeroed, and mode 3 is undefined)
116    SRn: bit 2 (TxRDYn) (we COULD assume since we're not emulating delay and timing output, that as long as tx is enabled on channel n, TxRDY is 1 for channel n and the MSR2n mode is 0 or 2; in mode 1 it is explicitly zeroed, and mode 3 is undefined; however, tx_ready is already nicely handled for us elsewhere, so we can use that instead for now, though we may need to retool that code as well)
117    SRn: bit 1 (FFULLn) (this bit we actually emulate; if the recieve fifo for channel n is full, this bit is 1, otherwise it is 0. the recieve fifo should be three words long.)
118    SRn: bit 0 (RxRDYn) (this bit we also emulate; the bit is always asserted if the recieve fifo is not empty)
119    ISR: bit 7: Input Port change; this should be handled elsewhere, on the input port handler
120    ISR: bit 6: Delta Break B; this should be handled elsewhere, on the data recieve handler
121    ISR: bit 5: RxRDYB/FFULLB: this is handled here; depending on whether MSR1B bit 6 is 0 or 1, this bit holds the state of SRB bit 0 or bit 1 respectively
122    ISR: bit 4: TxRDYB: this is handled here; it mirrors SRB bit 2
123    ISR: bit 3: Counter ready; this should be handled by the timer generator
124    ISR: bit 2: Delta Break A; this should be handled elsewhere, on the data recieve handler
125    ISR: bit 1: RxRDYA/FFULLA: this is handled here; depending on whether MSR1A bit 6 is 0 or 1, this bit holds the state of SRA bit 0 or bit 1 respectively
126    ISR: bit 0: TxRDYA: this is handled here; it mirrors SRA bit 2
127    */
128128   UINT8 ch = 0;
129129   //logerror("DEBUG: 68681 int check: upon func call, SRA is %02X, SRB is %02X, ISR is %02X\n", duart68681->channel[0].SR, duart68681->channel[1].SR, duart68681->ISR);
130130   for (ch = 0; ch < 2; ch++)
r5613r5614
156156      // Handle the TxEMT and TxRDY bits based on mode
157157      switch( duart68681->channel[ch].MR2&0xC0) // what mode are we in?
158158         {
159         case 0x00: // normal mode
159         case 0x00: // normal mode
160160            if ( duart68681->channel[ch].tx_enabled )
161161            {
162162               duart68681->channel[ch].SR |= STATUS_TRANSMITTER_EMPTY;
r5613r5614
498498         else
499499            {
500500               r = 0xff;
501               /*
502                    if (input_code_pressed(KEYCODE_1)) r ^= 0x0001;
503                    if (input_code_pressed(KEYCODE_2)) r ^= 0x0002;
504                    if (input_code_pressed(KEYCODE_3)) r ^= 0x0004;
505                    if (input_code_pressed(KEYCODE_4)) r ^= 0x0008;
506                    if (input_code_pressed(KEYCODE_5)) r ^= 0x0010;
507                    if (input_code_pressed(KEYCODE_6)) r ^= 0x0020;
508                    if (input_code_pressed(KEYCODE_7)) r ^= 0x0040;
509                    if (input_code_pressed(KEYCODE_8)) r ^= 0x0080;
510                    */
501#if 0
502               if (input_code_pressed(device->machine, KEYCODE_1)) r ^= 0x0001;
503               if (input_code_pressed(device->machine, KEYCODE_2)) r ^= 0x0002;
504               if (input_code_pressed(device->machine, KEYCODE_3)) r ^= 0x0004;
505               if (input_code_pressed(device->machine, KEYCODE_4)) r ^= 0x0008;
506               if (input_code_pressed(device->machine, KEYCODE_5)) r ^= 0x0010;
507               if (input_code_pressed(device->machine, KEYCODE_6)) r ^= 0x0020;
508               if (input_code_pressed(device->machine, KEYCODE_7)) r ^= 0x0040;
509               if (input_code_pressed(device->machine, KEYCODE_8)) r ^= 0x0080;
510#endif
511511            }
512512         break;
513513      case 0x0e: /* Start counter command */
src/emu/inptport.h
r5613r5614
319319   IPT_UI_PAGE_DOWN,
320320   IPT_UI_SELECT,
321321   IPT_UI_CANCEL,
322   IPT_UI_DISPLAY_COMMENT,
322323   IPT_UI_CLEAR,
323324   IPT_UI_ZOOM_IN,
324325   IPT_UI_ZOOM_OUT,
r5613r5614
398399   INPUT_TOKEN_KEYDELTA,
399400   INPUT_TOKEN_CENTERDELTA,
400401   INPUT_TOKEN_CROSSHAIR,
402   INPUT_TOKEN_CROSSHAIR_MAPPER,
401403   INPUT_TOKEN_FULL_TURN_COUNT,
402404   INPUT_TOKEN_POSITIONS,
403405   INPUT_TOKEN_WRAPS,
r5613r5614
568570/* input port changed callback function */
569571typedef void (*input_field_changed_func)(const input_field_config *field, void *param, UINT32 oldval, UINT32 newval);
570572
573/* crosshair mapping function */
574typedef float (*input_field_crossmap_func)(const input_field_config *field, float linear_value);
571575
576
572577/* this type is used to encode input port definitions */
573578typedef union _input_port_token input_port_token;
574579union _input_port_token
r5613r5614
577582   const input_port_token *   tokenptr;
578583   input_field_custom_func    customptr;
579584   input_field_changed_func    changedptr;
585   input_field_crossmap_func    crossmapptr;
580586};
581587
582588
r5613r5614
646652   float                  crossscale;      /* crosshair scale */
647653   float                  crossoffset;   /* crosshair offset */
648654   float                  crossaltaxis;   /* crosshair alternate axis value */
655   input_field_crossmap_func    crossmapper;   /* crosshair mapping function */
649656   UINT16                  full_turn_count;/* number of optical counts for 1 full turn of the original control */
650657   const input_port_value *   remap_table;   /* pointer to an array that remaps the port value */
651658
r5613r5614
725732/* macro for port changed callback functions (PORT_CHANGED) */
726733#define INPUT_CHANGED(name)   void name(const input_field_config *field, void *param, UINT32 oldval, UINT32 newval)
727734
735/* macro for port changed callback functions (PORT_CROSSHAIR_MAPPER) */
736#define CROSSHAIR_MAPPER(name)   float name(const input_field_config *field, float linear_value)
737
728738/* macro for wrapping a default string */
729739#define DEF_STR(str_num) ((const char *)INPUT_STRING_##str_num)
730740
r5613r5614
847857   TOKEN_UINT32_PACK3(INPUT_TOKEN_CROSSHAIR, 8, CROSSHAIR_AXIS_##axis, 4, (INT32)((altaxis) * 65536.0f), 20), \
848858   TOKEN_UINT64_PACK2((INT32)((scale) * 65536.0f), 32, (INT32)((offset) * 65536.0f), 32),
849859
860#define PORT_CROSSHAIR_MAPPER(_callback) \
861   TOKEN_UINT32_PACK1(INPUT_TOKEN_CROSSHAIR_MAPPER, 8), \
862   TOKEN_PTR(crossmapptr, _callback),
863
850864/* how many optical counts for 1 full turn of the control */
851865#define PORT_FULL_TURN_COUNT(_count) \
852866   TOKEN_UINT32_PACK2(INPUT_TOKEN_FULL_TURN_COUNT, 8, _count, 24),
src/emu/mame.h
r5613r5614
134134typedef struct _streams_private streams_private;
135135typedef struct _devices_private devices_private;
136136typedef struct _romload_private romload_private;
137typedef struct _sound_private sound_private;
138typedef struct _input_private input_private;
137139typedef struct _input_port_private input_port_private;
138140typedef struct _ui_input_private ui_input_private;
139141typedef struct _cheat_private cheat_private;
r5613r5614
184186   streams_private *      streams_data;      /* internal data from streams.c */
185187   devices_private *      devices_data;      /* internal data from devices.c */
186188   romload_private *      romload_data;      /* internal data from romload.c */
189   sound_private *         sound_data;         /* internal data from sound.c */
190   input_private *         input_data;         /* internal data from input.c */
187191   input_port_private *   input_port_data;   /* internal data from inptport.c */
188192   ui_input_private *      ui_input_data;      /* internal data from uiinput.c */
189193   cheat_private *         cheat_data;         /* internal data from cheat.c */
src/emu/cpuintrf.h
r5613r5614
161161      CPUINFO_FCT_EXIT,                           /* R/O: void (*exit)(const device_config *device) */
162162      CPUINFO_FCT_EXECUTE,                        /* R/O: int (*execute)(const device_config *device, int cycles) */
163163      CPUINFO_FCT_BURN,                           /* R/O: void (*burn)(const device_config *device, int cycles) */
164      CPUINFO_FCT_DISASSEMBLE,                     /* R/O: offs_t (*disassemble)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) */
164      CPUINFO_FCT_DISASSEMBLE,                     /* R/O: offs_t (*disassemble)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) */
165165      CPUINFO_FCT_TRANSLATE,                        /* R/O: int (*translate)(const device_config *device, int space, int intention, offs_t *address) */
166166      CPUINFO_FCT_READ,                           /* R/O: int (*read)(const device_config *device, int space, UINT32 offset, int size, UINT64 *value) */
167167      CPUINFO_FCT_WRITE,                           /* R/O: int (*write)(const device_config *device, int space, UINT32 offset, int size, UINT64 value) */
r5613r5614
286286#define CPU_DEBUG_INIT_CALL(name)      CPU_DEBUG_INIT_NAME(name)(device)
287287
288288#define CPU_DISASSEMBLE_NAME(name)      cpu_disassemble_##name
289#define CPU_DISASSEMBLE(name)         offs_t CPU_DISASSEMBLE_NAME(name)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
290#define CPU_DISASSEMBLE_CALL(name)      CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram)
289#define CPU_DISASSEMBLE(name)         offs_t CPU_DISASSEMBLE_NAME(name)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options)
290#define CPU_DISASSEMBLE_CALL(name)      CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram, options)
291291
292292#define CPU_VALIDITY_CHECK_NAME(name)   cpu_validity_check_##name
293293#define CPU_VALIDITY_CHECK(name)      int CPU_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const void *config)
r5613r5614
379379typedef int   (*cpu_write_func)(const device_config *device, int space, UINT32 offset, int size, UINT64 value);
380380typedef int   (*cpu_readop_func)(const device_config *device, UINT32 offset, int size, UINT64 *value);
381381typedef void (*cpu_debug_init_func)(const device_config *device);
382typedef offs_t (*cpu_disassemble_func)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
382typedef offs_t (*cpu_disassemble_func)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
383383typedef int (*cpu_validity_check_func)(const game_driver *driver, const void *config);
384384typedef void (*cpu_state_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry);
385385typedef void (*cpu_string_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *string);
src/emu/sound/disc_sys.c
r0r5614
1/************************************************************************
2 *
3 *  MAME - Discrete sound system emulation library
4 *
5 *  Written by Keith Wilkins (mame@esplexo.co.uk)
6 *
7 *  (c) K.Wilkins 2000
8 *  (c) D.Renaud 2003-2004
9 *
10 ************************************************************************
11 *
12 * DSO_OUTPUT            - Output node
13 * DSO_TASK              - Task node
14 *
15 * Task and list routines
16 *
17 ************************************************************************/
18
19struct dso_csvlog_context
20{
21   FILE *csv_file;
22   INT64 sample_num;
23   char name[32];
24};
25
26struct dso_wavelog_context
27{
28   wav_file *wav_file;
29   char name[32];
30};
31
32
33/*************************************
34 *
35 *  Task node (main task execution)
36 *
37 *************************************/
38
39static DISCRETE_START( dso_task )
40{
41   discrete_task_context *task =  (discrete_task_context *) node->context;
42   int inputnum;
43   const linked_list_entry *node_entry;
44   const linked_list_entry *step_entry;
45
46   /* Determine, which nodes in the task are referenced in the main task
47     * and add them to the list of nodes to be buffered for further processing
48     */
49   for (node_entry = task->list; node_entry != NULL; node_entry = node_entry->next)
50   {
51      node_description *node = (node_description *) node_entry->ptr;
52      int found = 0;
53
54      for (step_entry = node->info->step_list; step_entry != NULL; step_entry = step_entry->next)
55      {
56         node_description *snode = (node_description *) step_entry->ptr;
57
58         /* loop over all active inputs */
59         for (inputnum = 0; inputnum < snode->active_inputs; inputnum++)
60         {
61            int inputnode = snode->block->input_node[inputnum];
62            if IS_VALUE_A_NODE(inputnode)
63            {
64               if (NODE_DEFAULT_NODE(node->block->node) == NODE_DEFAULT_NODE(inputnode))
65               {
66                  int i;
67                  found = 0;
68                  for (i = 0; i < task->numbuffered; i++)
69                     if (task->nodes[i]->block->node == inputnode)
70                        found = 1;
71                  if (!found)
72                  {
73                     if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS)
74                        fatalerror("dso_task_start - Number of maximum buffered nodes exceeded");
75
76                     discrete_log(node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_BLOCKINDEX(snode));
77                     task->node_buf[task->numbuffered] = auto_alloc_array(node->info->device->machine, double, 2048);
78                     task->dest[task->numbuffered] = (double **) &snode->input[inputnum];
79                     task->nodes[task->numbuffered] = discrete_find_node(node->info, inputnode);
80                     task->numbuffered++;
81                  }
82               }
83            }
84         }
85      }
86   }
87}
88
89static DISCRETE_STEP( dso_task )
90{
91   discrete_task_context *task =  (discrete_task_context *) node->context;
92   int i;
93
94   for (i = 0; i < task->numbuffered; i++)
95      *(task->ptr[i]++) = **task->dest[i]; //DISCRETE_INPUT(i);
96}
97
98static DISCRETE_RESET( dso_task )
99{
100   /* nothing to do - just avoid being stepped */
101}
102
103static DISCRETE_STEP( dso_output )
104{
105   stream_sample_t **output = (stream_sample_t **) &node->context;
106   double val;
107
108   /* Add gain to the output and put into the buffers */
109   /* Clipping will be handled by the main sound system */
110   val = DISCRETE_INPUT(0) * DISCRETE_INPUT(1);
111   **output = val;
112   (*output)++;
113}
114
115static DISCRETE_RESET( dso_output )
116{
117   /* nothing to do - just avoid being stepped */
118}
119
120static DISCRETE_START( dso_csvlog )
121{
122   struct dso_csvlog_context *context = (struct dso_csvlog_context *) node->context;
123   int log_num, node_num;
124
125   log_num = node_module_index(node);
126   context->sample_num = 0;
127
128   sprintf(context->name, "discrete%s_%d.csv", node->info->device->tag, log_num);
129   context->csv_file = fopen(context->name, "w");
130   /* Output some header info */
131   fprintf(context->csv_file, "\"MAME Discrete System Node Log\"\n");
132   fprintf(context->csv_file, "\"Log Version\", 1.0\n");
133   fprintf(context->csv_file, "\"Sample Rate\", %d\n", node->info->sample_rate);
134   fprintf(context->csv_file, "\n");
135   fprintf(context->csv_file, "\"Sample\"");
136   for (node_num = 0; node_num < node->active_inputs; node_num++)
137   {
138      fprintf(context->csv_file, ", \"NODE_%2d\"", NODE_INDEX(node->block->input_node[node_num]));
139   }
140   fprintf(context->csv_file, "\n");
141}
142
143static DISCRETE_STOP( dso_csvlog )
144{
145   struct dso_csvlog_context *context = (struct dso_csvlog_context *) node->context;
146
147   /* close any csv files */
148   if (context->csv_file)
149      fclose(context->csv_file);
150}
151
152static DISCRETE_STEP( dso_csvlog )
153{
154   struct dso_csvlog_context *context = (struct dso_csvlog_context *) node->context;
155   int nodenum;
156
157   /* Dump any csv logs */
158   fprintf(context->csv_file, "%" I64FMT "d", ++context->sample_num);
159   for (nodenum = 0; nodenum < node->active_inputs; nodenum++)
160   {
161      fprintf(context->csv_file, ", %f", *node->input[nodenum]);
162   }
163   fprintf(context->csv_file, "\n");
164}
165
166static DISCRETE_START( dso_wavelog )
167{
168   struct dso_wavelog_context *context = (struct dso_wavelog_context *) node->context;
169   int log_num;
170
171   log_num = node_module_index(node);
172   sprintf(context->name, "discrete%s_%d.wav", node->info->device->tag, log_num);
173   context->wav_file = wav_open(context->name, node->info->sample_rate, node->active_inputs/2);
174}
175
176static DISCRETE_STOP( dso_wavelog )
177{
178   struct dso_wavelog_context *context = (struct dso_wavelog_context *) node->context;
179
180   /* close any wave files */
181   if (context->wav_file)
182      wav_close(context->wav_file);
183}
184
185static DISCRETE_STEP( dso_wavelog )
186{
187   struct dso_wavelog_context *context = (struct dso_wavelog_context *) node->context;
188   double val;
189   INT16 wave_data_l, wave_data_r;
190
191   /* Dump any wave logs */
192   /* get nodes to be logged and apply gain, then clip to 16 bit */
193   val = DISCRETE_INPUT(0) * DISCRETE_INPUT(1);
194   val = (val < -32768) ? -32768 : (val > 32767) ? 32767 : val;
195   wave_data_l = (INT16)val;
196   if (node->active_inputs == 2)
197   {
198      /* DISCRETE_WAVELOG1 */
199      wav_add_data_16(context->wav_file, &wave_data_l, 1);
200   }
201   else
202   {
203      /* DISCRETE_WAVELOG2 */
204      val = DISCRETE_INPUT(2) * DISCRETE_INPUT(3);
205      val = (val < -32768) ? -32768 : (val > 32767) ? 32767 : val;
206      wave_data_r = (INT16)val;
207
208      wav_add_data_16lr(context->wav_file, &wave_data_l, &wave_data_r, 1);
209   }
210}
src/emu/sound/k054539.c
r5613r5614
388388      double gc_f0;
389389      int gc_i, gc_j, gc_k, gc_l;
390390
391      if (input_code_pressed_once(KEYCODE_DEL_PAD))
391      if (input_code_pressed_once(device->machine, KEYCODE_DEL_PAD))
392392      {
393393         gc_active ^= 1;
394394         if (!gc_active) popmessage(NULL);
r5613r5614
396396
397397      if (gc_active)
398398      {
399         if (input_code_pressed_once(KEYCODE_0_PAD)) gc_chip ^= 1;
399         if (input_code_pressed_once(device->machine, KEYCODE_0_PAD)) gc_chip ^= 1;
400400
401401         gc_i = gc_pos[gc_chip];
402402         gc_j = 0;
403         if (input_code_pressed_once(KEYCODE_4_PAD)) { gc_i--; gc_j = 1; }
404         if (input_code_pressed_once(KEYCODE_6_PAD)) { gc_i++; gc_j = 1; }
403         if (input_code_pressed_once(device->machine, KEYCODE_4_PAD)) { gc_i--; gc_j = 1; }
404         if (input_code_pressed_once(device->machine, KEYCODE_6_PAD)) { gc_i++; gc_j = 1; }
405405         if (gc_j) { gc_i &= 7; gc_pos[gc_chip] = gc_i; }
406406
407         if (input_code_pressed_once(KEYCODE_5_PAD))
407         if (input_code_pressed_once(device->machine, KEYCODE_5_PAD))
408408            info->k054539_gain[gc_i] = 1.0;
409409         else
410410         {
411411            gc_fptr = &info->k054539_gain[gc_i];
412412            gc_f0 = *gc_fptr;
413413            gc_j = 0;
414            if (input_code_pressed_once(KEYCODE_2_PAD)) { gc_f0 -= 0.1; gc_j = 1; }
415            if (input_code_pressed_once(KEYCODE_8_PAD)) { gc_f0 += 0.1; gc_j = 1; }
414            if (input_code_pressed_once(device->machine, KEYCODE_2_PAD)) { gc_f0 -= 0.1; gc_j = 1; }
415            if (input_code_pressed_once(device->machine, KEYCODE_8_PAD)) { gc_f0 += 0.1; gc_j = 1; }
416416            if (gc_j) { if (gc_f0 < 0) gc_f0 = 0; *gc_fptr = gc_f0; }
417417         }
418418
src/emu/sound/disc_inp.c
r5613r5614
4040   UINT8      is_stream;
4141   UINT8      is_buffered;
4242   UINT32      stream_in_number;
43   UINT32      stream_out_number;
43   /* the buffer stream */
44   sound_stream *buffer_stream;
4445};
4546
4647INLINE discrete_info *get_safe_token(const device_config *device)
r5613r5614
9394      switch (node->module->type)
9495      {
9596         case DSS_INPUT_DATA:
97         case DSS_INPUT_BUFFER:
9698            new_data = data;
9799            break;
98100         case DSS_INPUT_LOGIC:
r5613r5614
106108
107109      if (context->data != new_data)
108110      {
109         /* Bring the system up to now */
110         stream_update(info->discrete_stream);
111         if (context->is_buffered)
112         {
113            /* Bring the system up to now */
114            stream_update(context->buffer_stream);
111115
112         context->data = new_data;
116            context->data = new_data;
117         }
118         else
119         {
120            /* Bring the system up to now */
121            stream_update(info->discrete_stream);
113122
114         /* Update the node output here so we don't have to do it each step */
115         node->output[0] = new_data * context->gain + context->offset;
123            context->data = new_data;
124
125            /* Update the node output here so we don't have to do it each step */
126            node->output[0] = new_data * context->gain + context->offset;
127         }
116128      }
117129   }
118130   else
r5613r5614
171183   {
172184      context->port = input_port_by_tag(node->info->device->machine->portconfig, (const char *)node->custom);
173185      if (context->port == NULL)
174         fatalerror("DISCRETE_ADJUSTMENT_TAG - NODE_%d has invalid tag", node->node-NODE_00);
186         fatalerror("DISCRETE_ADJUSTMENT_TAG - NODE_%d has invalid tag", NODE_BLOCKINDEX(node));
175187   }
176188   else
177189      context->port = input_port_by_index(node->info->device->machine->portconfig, DSS_ADJUSTMENT__PORT);
r5613r5614
294306{
295307   struct dss_input_context *context = (struct dss_input_context *)node->context;
296308
309   context->ptr = NULL;
310   //context->data = 0;
311}
312
313static DISCRETE_START(dss_input_stream)
314{
315   struct dss_input_context *context = (struct dss_input_context *)node->context;
316
297317   assert(DSS_INPUT_STREAM__STREAM < linked_list_count(node->info->input_list));
298   context->is_buffered = FALSE;
318
299319   context->is_stream = TRUE;
320   /* Stream out number is set during start */
300321   context->stream_in_number = DSS_INPUT_STREAM__STREAM;
301322   context->gain = DSS_INPUT_STREAM__GAIN;
302323   context->offset = DSS_INPUT_STREAM__OFFSET;
303324   context->ptr = NULL;
325   //context->data = 0;
326
327   if (node->block->type == DSS_INPUT_BUFFER)
328   {
329      context->is_buffered = TRUE;
330      context->buffer_stream = stream_create(node->info->device, 0, 1, node->info->sample_rate, (void *) node, buffer_stream_update);
331
332      stream_set_input(node->info->discrete_stream, context->stream_in_number,
333         context->buffer_stream, 0, 1.0);
334   }
335   else
336   {
337      context->is_buffered = FALSE;
338      context->buffer_stream = NULL;
339   }
304340}
src/emu/sound/disc_mth.c
r5613r5614
411411   if (info->cFilter)
412412   {
413413      /* Setup filter constants */
414      context->exponent = RC_CHARGE_EXP(context->r_total * info->cFilter);
414      context->exponent = RC_CHARGE_EXP(node, context->r_total * info->cFilter);
415415   }
416416}
417417
r5613r5614
491491      if(DST_DIVIDE__DIV == 0)
492492      {
493493         node->output[0 ]= DBL_MAX;   /* Max out but don't break */
494         discrete_log(node->info, "dst_divider_step() - Divide by Zero attempted in NODE_%02d.\n",NODE_INDEX(node->node));
494         discrete_log(node->info, "dst_divider_step() - Divide by Zero attempted in NODE_%02d.\n",NODE_BLOCKINDEX(node));
495495      }
496496      else
497497      {
r5613r5614
11381138                     /* Re-calculate exponent if resistor is a node and has changed value */
11391139                     if (*context->r_node[bit] != context->r_last[bit])
11401140                     {
1141                        context->exponent_rc[bit] =  RC_CHARGE_EXP(rTemp2 * info->c[bit]);
1141                        context->exponent_rc[bit] =  RC_CHARGE_EXP(node, rTemp2 * info->c[bit]);
11421142                        context->r_last[bit] = *context->r_node[bit];
11431143                     }
11441144                  }
r5613r5614
11941194         if (r_node_bit_flag != 0)
11951195         {
11961196            /* Re-calculate exponent if resistor nodes are used */
1197            context->exponent_c_f =  RC_CHARGE_EXP(r_total * info->cF);
1197            context->exponent_c_f =  RC_CHARGE_EXP(node, r_total * info->cF);
11981198         }
11991199         context->v_cap_f += (v - v_ref - context->v_cap_f) * context->exponent_c_f;
12001200         v = context->v_cap_f;
r5613r5614
12881288               break;
12891289         }
12901290         /* Setup filter constants */
1291         context->exponent_rc[bit] = RC_CHARGE_EXP(rTemp * info->c[bit]);
1291         context->exponent_rc[bit] = RC_CHARGE_EXP(node, rTemp * info->c[bit]);
12921292      }
12931293   }
12941294
r5613r5614
13031303   if (info->cF != 0)
13041304   {
13051305      /* Setup filter constants */
1306      context->exponent_c_f = RC_CHARGE_EXP(((info->type == DISC_MIXER_IS_OP_AMP) ? info->rF : (1.0 / context->r_total)) * info->cF);
1306      context->exponent_c_f = RC_CHARGE_EXP(node, ((info->type == DISC_MIXER_IS_OP_AMP) ? info->rF : (1.0 / context->r_total)) * info->cF);
13071307   }
13081308
13091309   context->v_cap_amp      = 0;
r5613r5614
13131313      /* Setup filter constants */
13141314      /* We will use 100k ohms as an average final stage impedance. */
13151315      /* Your amp/speaker system will have more effect on incorrect filtering then any value used here. */
1316      context->exponent_c_amp = RC_CHARGE_EXP(RES_K(100) * info->cAmp);
1316      context->exponent_c_amp = RC_CHARGE_EXP(node, RES_K(100) * info->cAmp);
13171317   }
13181318
13191319   if (context->type == DISC_MIXER_IS_OP_AMP_WITH_RI) context->gain = info->rF / info->rI;
r5613r5614
13541354      else
13551355      {
13561356         /* Bad address.  We will leave the output alone. */
1357         discrete_log(node->info, "NODE_%02d - Address = %d. Out of bounds\n", node->node-NODE_00, addr);
1357         discrete_log(node->info, "NODE_%02d - Address = %d. Out of bounds\n", NODE_BLOCKINDEX(node), addr);
13581358      }
13591359   }
13601360   else
r5613r5614
16411641
16421642/************************************************************************
16431643 *
1644 * DST_TRANSFORM - Programmable math module with enable function
1644 * DST_TRANSFORM - Programmable math module
16451645 *
1646 * input[0]    - Enable input value
1647 * input[1]    - Channel0 input value
1648 * input[2]    - Channel1 input value
1649 * input[3]    - Channel2 input value
1650 * input[4]    - Channel3 input value
1651 * input[5]    - Channel4 input value
1646 * input[0]    - Channel0 input value
1647 * input[1]    - Channel1 input value
1648 * input[2]    - Channel2 input value
1649 * input[3]    - Channel3 input value
1650 * input[4]    - Channel4 input value
16521651 *
16531652 ************************************************************************/
16541653#define DST_TRANSFORM__IN0      DISCRETE_INPUT(0)
r5613r5614
16811680   int      trans_stack_ptr = 0;
16821681
16831682   const char *fPTR = (const char *)node->custom;
1684   node->output[0]  = 0;
16851683
16861684   top = HUGE_VAL;
16871685
r5613r5614
17621760            top = (int)number1 ^ (int)top;
17631761            break;
17641762         default:
1765            discrete_log(node->info, "dst_transform_step - Invalid function type/variable passed");
1766            node->output[0] = 0;
1763            discrete_log(node->info, "dst_transform_step - Invalid function type/variable passed: %s",(const char *)node->custom);
1764            /* that is enough to fatalerror */
1765            fatalerror("dst_transform_step - Invalid function type/variable passed: %s", (const char *)node->custom);
17671766            break;
17681767      }
17691768   }
r5613r5614
18651864      if (context->has_r4)
18661865      {
18671866         /* exponential charge */
1868         context->exponent = RC_CHARGE_EXP(info->r4 * info->c);
1867         context->exponent = RC_CHARGE_EXP(node, info->r4 * info->c);
18691868      }
18701869      else
18711870         /* linear charge */
r5613r5614
19361935   const  discrete_op_amp_1sht_info *info    = (const  discrete_op_amp_1sht_info *)node->custom;
19371936   struct dst_op_amp_1sht_context   *context = (struct dst_op_amp_1sht_context *)node->context;
19381937
1939   context->exponent1c = RC_CHARGE_EXP(RES_2_PARALLEL(info->r3, info->r4) * info->c1);
1940   context->exponent1d = RC_CHARGE_EXP(info->r4 * info->c1);
1941   context->exponent2  = RC_CHARGE_EXP(info->r2 * info->c2);
1938   context->exponent1c = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r3, info->r4) * info->c1);
1939   context->exponent1d = RC_CHARGE_EXP(node, info->r4 * info->c1);
1940   context->exponent2  = RC_CHARGE_EXP(node, info->r2 * info->c2);
19421941   context->i_fixed  = (info->vP - OP_AMP_NORTON_VBE) / info->r1;
19431942   context->v_cap1   = context->v_cap2 = 0;
19441943   context->v_max    = info->vP - OP_AMP_NORTON_VBE;
r5613r5614
20632062   context->v_cap1 = 0;
20642063   /* Charge rate thru r5 */
20652064   /* There can be a different charge rates depending on function F3. */
2066   context->exponent_c[0] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r5, info->r6) * info->c1);
2067   context->exponent_c[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r5, context->r67) * info->c1);
2065   context->exponent_c[0] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r5, info->r6) * info->c1);
2066   context->exponent_c[1] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r5, context->r67) * info->c1);
20682067   /* Discharge rate thru r6 + r7 */
2069   context->exponent_d[1] = RC_CHARGE_EXP(context->r67 * info->c1);
2068   context->exponent_d[1] = RC_CHARGE_EXP(node, context->r67 * info->c1);
20702069   /* Discharge rate thru r6 */
20712070   if (info->r6 != 0)
20722071   {
2073      context->exponent_d[0] = RC_CHARGE_EXP(info->r6 * info->c1);
2072      context->exponent_d[0] = RC_CHARGE_EXP(node, info->r6 * info->c1);
20742073   }
20752074   context->v_cap2       = 0;
20762075   context->v_trig2      = (info->v2 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r8, info->r9);
2077   context->exponent2[0] = RC_CHARGE_EXP(info->r9 * info->c2);
2078   context->exponent2[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r8, info->r9) * info->c2);
2076   context->exponent2[0] = RC_CHARGE_EXP(node, info->r9 * info->c2);
2077   context->exponent2[1] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r8, info->r9) * info->c2);
20792078   context->v_cap3  = 0;
20802079   context->v_trig3 = (info->v3 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r10, info->r11);
2081   context->exponent3[0] = RC_CHARGE_EXP(info->r11 * info->c3);
2082   context->exponent3[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r10, info->r11) * info->c3);
2080   context->exponent3[0] = RC_CHARGE_EXP(node, info->r11 * info->c3);
2081   context->exponent3[1] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r10, info->r11) * info->c3);
20832082
20842083   DISCRETE_STEP_CALL(dst_tvca_op_amp);
20852084}
src/emu/sound/ay8910.c
r5613r5614
876876
877877   if (r > 15) return 0;
878878
879   /* FIXME: calling stream_update here makes gyruss sound awfull.
880     *        For the time being, no idea why this is the case */
881   /* update the output buffer before returning the register */
879   /* There are no state dependent register in the AY8910! */
882880   /* stream_update(psg->channel); */
883881
884882   switch (r)
src/emu/sound/discrete.c
r5613r5614
6060
6161/*************************************
6262 *
63 *  Structures
64 *
65 *************************************/
66
67typedef struct _task_info task_info;
68struct _task_info
69{
70   discrete_task_context *context;
71   int samples;
72};
73
74
75/*************************************
76 *
6377 *  Prototypes
6478 *
6579 *************************************/
6680
6781static void init_nodes(discrete_info *info, linked_list_entry *block_list, const device_config *device);
6882static void find_input_nodes(discrete_info *info);
69static void setup_disc_logs(discrete_info *info);
7083static node_description *discrete_find_node(const discrete_info *info, int node);
7184static DEVICE_RESET( discrete );
7285static STREAM_UPDATE( discrete_stream_update );
86static STREAM_UPDATE( buffer_stream_update );
7387
7488
7589/*************************************
r5613r5614
95109   }
96110}
97111
98typedef struct _task_info task_info;
112/*************************************
113 *
114 *  INLINEs
115 *
116 *************************************/
99117
100struct _task_info
118INLINE int node_module_index(const node_description *node)
101119{
102   discrete_task_context *context;
103   int samples;
104};
105
106INLINE void step_nodes_in_list(linked_list_entry **list)
107{
108120   linked_list_entry *entry;
109   for (entry = *list; entry != NULL; entry = entry->next)
121   int index = 0;
122
123   for (entry = node->info->node_list; entry != NULL; entry = entry->next)
110124   {
111      node_description *node = (node_description *) entry->ptr;
125      node_description *n = (node_description *) entry->ptr;
112126
113      /* Now step the node */
114      if (DISCRETE_PROFILING)
115         node->run_time -= osd_profiling_ticks();
116
117      (*node->module->step)(node);
118      //bigselect(info->device, node);
119
120      if (DISCRETE_PROFILING)
121         node->run_time += osd_profiling_ticks();
127      if (n == node)
128         return index;
129      if (n->module->type == node->module->type)
130         index++;
122131   }
132   return -1;
123133}
124134
125static void *task_callback(void *param, int threadid)
135INLINE void linked_list_add(const discrete_info *info, linked_list_entry ***list_tail_ptr, const void *ptr)
126136{
127   task_info *ti = (task_info *) param;
128   int samples, i;
129
130   /* set up task buffers */
131   for (i = 0; i < ti->context->numbuffered; i++)
132      ti->context->ptr[i] = &ti->context->node_buf[i][0];
133   
134   samples = ti->samples;
135   while (samples-- > 0)
136   {
137      step_nodes_in_list(&ti->context->list);
138   }
139   /* reset ptr */
140   for (i = 0; i < ti->context->numbuffered; i++)
141      ti->context->ptr[i] = &ti->context->node_buf[i][0];
142
143   free(param);
144   return NULL;
145}
146
147static DISCRETE_STEP( dso_task )
148{
149   discrete_task_context *ctx =  (discrete_task_context *) node->context;
150   int i;
151   
152   for (i = 0; i < ctx->numbuffered; i++)
153      *(ctx->ptr[i]++) = (double) DISCRETE_INPUT(i);
154}
155
156static DISCRETE_RESET( dso_task )
157{
158   /* nothing to do - just avoid being stepped */
159}
160
161static DISCRETE_STEP( dso_output )
162{
163   stream_sample_t **output = (stream_sample_t **) &node->context;
164   double val;
165
166   /* Add gain to the output and put into the buffers */
167   /* Clipping will be handled by the main sound system */
168   val = DISCRETE_INPUT(0) * DISCRETE_INPUT(1);
169   **output = val;
170   (*output)++;
171}
172
173static DISCRETE_RESET( dso_output )
174{
175   /* nothing to do - just avoid being stepped */
176}
177
178
179/*************************************
180 *
181 *  Add an entry to a list
182 *
183 *************************************/
184
185static void linked_list_add(discrete_info *info, linked_list_entry ***list_tail_ptr, void *ptr)
186{
187137   **list_tail_ptr = auto_alloc(info->device->machine, linked_list_entry);
188138   (**list_tail_ptr)->ptr = ptr;
189139   (**list_tail_ptr)->next = NULL;
190140   *list_tail_ptr = &((**list_tail_ptr)->next);
191141}
192142
193/*************************************
194 *
195 *  Count entries in a list
196 *
197 *************************************/
198
199static int linked_list_count(linked_list_entry *list)
143INLINE int linked_list_count(const linked_list_entry *list)
200144{
201145   int cnt = 0;
202   linked_list_entry *entry;
146   const linked_list_entry *entry;
203147
204148   for (entry = list; entry != NULL; entry = entry->next)
205149      cnt++;
206150
207151   return cnt;
208152}
209
210
211153/*************************************
212154 *
213155 *  Included simulation objects
214156 *
215157 *************************************/
216158
159#include "disc_sys.c"      /* discrete core modules and support functions */
217160#include "disc_wav.c"      /* Wave sources   - SINE/SQUARE/NOISE/etc */
218161#include "disc_mth.c"      /* Math Devices   - ADD/GAIN/etc */
219162#include "disc_inp.c"      /* Input Devices  - INPUT/CONST/etc */
r5613r5614
230173
231174static const discrete_module module_list[] =
232175{
233   { DSO_OUTPUT      ,"DSO_OUTPUT"      , 0 ,0                                      ,dso_output_reset      ,dso_output_step      },
234   { DSO_CSVLOG      ,"DSO_CSVLOG"      , 0 ,0                                      ,NULL                  ,NULL                 },
235   { DSO_WAVELOG     ,"DSO_WAVELOG"     , 0 ,0                                      ,NULL                  ,NULL                 },
236   { DSO_IMPORT      ,"DSO_IMPORT"      , 0 ,0                                      ,NULL                  ,NULL                 },
176   { DSO_OUTPUT      ,"DSO_OUTPUT"      , 0 ,0                                      ,dso_output_reset      ,dso_output_step      ,NULL                  ,NULL                 },
177   { DSO_CSVLOG      ,"DSO_CSVLOG"      , 0 ,sizeof(struct dso_csvlog_context)      ,NULL                  ,dso_csvlog_step      ,dso_csvlog_start      ,dso_csvlog_stop      },
178   { DSO_WAVELOG     ,"DSO_WAVELOG"     , 0 ,sizeof(struct dso_wavelog_context)     ,NULL                  ,dso_wavelog_step     ,dso_wavelog_start     ,dso_wavelog_stop     },
179   { DSO_IMPORT      ,"DSO_IMPORT"      , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
237180
238181   /* parallel modules */
239   { DSO_TASK_START  ,"DSO_TASK_START"  , 0 ,0                                      ,NULL                  ,NULL                 },
240   { DSO_TASK_END    ,"DSO_TASK_END"    , 0 ,0                                      ,dso_task_reset        ,dso_task_step        },
241   { DSO_TASK_SYNC   ,"DSO_TASK_SYNC"   , 0 ,0                                      ,NULL                  ,NULL                 },
182   { DSO_TASK_START  ,"DSO_TASK_START"  , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
183   { DSO_TASK_END    ,"DSO_TASK_END"    , 0 ,0                                      ,dso_task_reset        ,dso_task_step        ,dso_task_start        ,NULL                 },
184   { DSO_TASK_SYNC   ,"DSO_TASK_SYNC"   , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
242185
243186   /* nop */
244   { DSS_NOP         ,"DSS_NOP"         , 0 ,0                                      ,NULL                  ,NULL                 },
187   { DSS_NOP         ,"DSS_NOP"         , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
245188
246189   /* from disc_inp.c */
247   { DSS_ADJUSTMENT  ,"DSS_ADJUSTMENT"  , 1 ,sizeof(struct dss_adjustment_context)  ,dss_adjustment_reset  ,dss_adjustment_step  },
248   { DSS_CONSTANT    ,"DSS_CONSTANT"    , 1 ,0                                      ,dss_constant_reset    ,NULL                 },
249   { DSS_INPUT_DATA  ,"DSS_INPUT_DATA"  , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,NULL                 },
250   { DSS_INPUT_LOGIC ,"DSS_INPUT_LOGIC" , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,NULL                 },
251   { DSS_INPUT_NOT   ,"DSS_INPUT_NOT"   , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,NULL                 },
252   { DSS_INPUT_PULSE ,"DSS_INPUT_PULSE" , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,dss_input_pulse_step },
253   { DSS_INPUT_STREAM,"DSS_INPUT_STREAM", 1 ,sizeof(struct dss_input_context)       ,dss_input_stream_reset,dss_input_stream_step},
190   { DSS_ADJUSTMENT  ,"DSS_ADJUSTMENT"  , 1 ,sizeof(struct dss_adjustment_context)  ,dss_adjustment_reset  ,dss_adjustment_step  ,NULL                  ,NULL                 },
191   { DSS_CONSTANT    ,"DSS_CONSTANT"    , 1 ,0                                      ,dss_constant_reset    ,NULL                 ,NULL                  ,NULL                 },
192   { DSS_INPUT_DATA  ,"DSS_INPUT_DATA"  , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,NULL                 ,NULL                  ,NULL                 },
193   { DSS_INPUT_LOGIC ,"DSS_INPUT_LOGIC" , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,NULL                 ,NULL                  ,NULL                 },
194   { DSS_INPUT_NOT   ,"DSS_INPUT_NOT"   , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,NULL                 ,NULL                  ,NULL                 },
195   { DSS_INPUT_PULSE ,"DSS_INPUT_PULSE" , 1 ,sizeof(struct dss_input_context)       ,dss_input_reset       ,dss_input_pulse_step ,NULL                  ,NULL                 },
196   { DSS_INPUT_STREAM,"DSS_INPUT_STREAM", 1 ,sizeof(struct dss_input_context)       ,dss_input_stream_reset,dss_input_stream_step,dss_input_stream_start,NULL                 },
197   { DSS_INPUT_BUFFER,"DSS_INPUT_BUFFER", 1 ,sizeof(struct dss_input_context)       ,dss_input_stream_reset,dss_input_stream_step,dss_input_stream_start,NULL                 },
254198
255199   /* from disc_wav.c */
256200   /* Generic modules */
257   { DSS_COUNTER     ,"DSS_COUNTER"     , 1 ,sizeof(struct dss_counter_context)     ,dss_counter_reset     ,dss_counter_step     },
258   { DSS_LFSR_NOISE  ,"DSS_LFSR_NOISE"  , 2 ,sizeof(struct dss_lfsr_context)        ,dss_lfsr_reset        ,dss_lfsr_step        },
259   { DSS_NOISE       ,"DSS_NOISE"       , 1 ,sizeof(struct dss_noise_context)       ,dss_noise_reset       ,dss_noise_step       },
260   { DSS_NOTE        ,"DSS_NOTE"        , 1 ,sizeof(struct dss_note_context)        ,dss_note_reset        ,dss_note_step        },
261   { DSS_SAWTOOTHWAVE,"DSS_SAWTOOTHWAVE", 1 ,sizeof(struct dss_sawtoothwave_context),dss_sawtoothwave_reset,dss_sawtoothwave_step},
262   { DSS_SINEWAVE    ,"DSS_SINEWAVE"    , 1 ,sizeof(struct dss_sinewave_context)    ,dss_sinewave_reset    ,dss_sinewave_step    },
263   { DSS_SQUAREWAVE  ,"DSS_SQUAREWAVE"  , 1 ,sizeof(struct dss_squarewave_context)  ,dss_squarewave_reset  ,dss_squarewave_step  },
264   { DSS_SQUAREWFIX  ,"DSS_SQUAREWFIX"  , 1 ,sizeof(struct dss_squarewfix_context)  ,dss_squarewfix_reset  ,dss_squarewfix_step  },
265   { DSS_SQUAREWAVE2 ,"DSS_SQUAREWAVE2" , 1 ,sizeof(struct dss_squarewave_context)  ,dss_squarewave2_reset ,dss_squarewave2_step },
266   { DSS_TRIANGLEWAVE,"DSS_TRIANGLEWAVE", 1 ,sizeof(struct dss_trianglewave_context),dss_trianglewave_reset,dss_trianglewave_step},
201   { DSS_COUNTER     ,"DSS_COUNTER"     , 1 ,sizeof(struct dss_counter_context)     ,dss_counter_reset     ,dss_counter_step     ,NULL                  ,NULL                 },
202   { DSS_LFSR_NOISE  ,"DSS_LFSR_NOISE"  , 2 ,sizeof(struct dss_lfsr_context)        ,dss_lfsr_reset        ,dss_lfsr_step        ,NULL                  ,NULL                 },
203   { DSS_NOISE       ,"DSS_NOISE"       , 1 ,sizeof(struct dss_noise_context)       ,dss_noise_reset       ,dss_noise_step       ,NULL                  ,NULL                 },
204   { DSS_NOTE        ,"DSS_NOTE"        , 1 ,sizeof(struct dss_note_context)        ,dss_note_reset        ,dss_note_step        ,NULL                  ,NULL                 },
205   { DSS_SAWTOOTHWAVE,"DSS_SAWTOOTHWAVE", 1 ,sizeof(struct dss_sawtoothwave_context),dss_sawtoothwave_reset,dss_sawtoothwave_step,NULL                  ,NULL                 },
206   { DSS_SINEWAVE    ,"DSS_SINEWAVE"    , 1 ,sizeof(struct dss_sinewave_context)    ,dss_sinewave_reset    ,dss_sinewave_step    ,NULL                  ,NULL                 },
207   { DSS_SQUAREWAVE  ,"DSS_SQUAREWAVE"  , 1 ,sizeof(struct dss_squarewave_context)  ,dss_squarewave_reset  ,dss_squarewave_step  ,NULL                  ,NULL                 },
208   { DSS_SQUAREWFIX  ,"DSS_SQUAREWFIX"  , 1 ,sizeof(struct dss_squarewfix_context)  ,dss_squarewfix_reset  ,dss_squarewfix_step  ,NULL                  ,NULL                 },
209   { DSS_SQUAREWAVE2 ,"DSS_SQUAREWAVE2" , 1 ,sizeof(struct dss_squarewave_context)  ,dss_squarewave2_reset ,dss_squarewave2_step ,NULL                  ,NULL                 },
210   { DSS_TRIANGLEWAVE,"DSS_TRIANGLEWAVE", 1 ,sizeof(struct dss_trianglewave_context),dss_trianglewave_reset,dss_trianglewave_step,NULL                  ,NULL                 },
267211   /* Component specific modules */
268   { DSS_INVERTER_OSC ,"DSS_INVERTER_OSC" , 1 ,sizeof(struct dss_inverter_osc_context) ,dss_inverter_osc_reset ,dss_inverter_osc_step },
269   { DSS_OP_AMP_OSC  ,"DSS_OP_AMP_OSC"  , 1 ,sizeof(struct dss_op_amp_osc_context)  ,dss_op_amp_osc_reset  ,dss_op_amp_osc_step  },
270   { DSS_SCHMITT_OSC ,"DSS_SCHMITT_OSC" , 1 ,sizeof(struct dss_schmitt_osc_context) ,dss_schmitt_osc_reset ,dss_schmitt_osc_step },
212   { DSS_INVERTER_OSC ,"DSS_INVERTER_OSC" , 1 ,sizeof(struct dss_inverter_osc_context) ,dss_inverter_osc_reset ,dss_inverter_osc_step ,NULL                  ,NULL                 },
213   { DSS_OP_AMP_OSC  ,"DSS_OP_AMP_OSC"  , 1 ,sizeof(struct dss_op_amp_osc_context)  ,dss_op_amp_osc_reset  ,dss_op_amp_osc_step  ,NULL                  ,NULL                 },
214   { DSS_SCHMITT_OSC ,"DSS_SCHMITT_OSC" , 1 ,sizeof(struct dss_schmitt_osc_context) ,dss_schmitt_osc_reset ,dss_schmitt_osc_step ,NULL                  ,NULL                 },
271215   /* Not yet implemented */
272   { DSS_ADSR        ,"DSS_ADSR"        , 1 ,sizeof(struct dss_adsr_context)        ,dss_adsrenv_reset     ,dss_adsrenv_step     },
216   { DSS_ADSR        ,"DSS_ADSR"        , 1 ,sizeof(struct dss_adsr_context)        ,dss_adsrenv_reset     ,dss_adsrenv_step     ,NULL                  ,NULL                 },
273217
274218   /* from disc_mth.c */
275219   /* Generic modules */
276   { DST_ADDER       ,"DST_ADDER"       , 1 ,0                                      ,NULL                  ,dst_adder_step       },
277   { DST_CLAMP       ,"DST_CLAMP"       , 1 ,0                                      ,NULL                  ,dst_clamp_step       },
278   { DST_DIVIDE      ,"DST_DIVIDE"      , 1 ,0                                      ,NULL                  ,dst_divide_step      },
279   { DST_GAIN        ,"DST_GAIN"        , 1 ,0                                      ,NULL                  ,dst_gain_step        },
280   { DST_LOGIC_INV   ,"DST_LOGIC_INV"   , 1 ,0                                      ,NULL                  ,dst_logic_inv_step   },
281   { DST_GAIN        ,"DST_GAIN"        , 1 ,0                                      ,NULL                  ,dst_gain_step        },
282   { DST_BITS_DECODE ,"DST_BITS_DECODE" , 8 ,sizeof(struct dst_bits_decode_context) ,dst_bits_decode_reset ,dst_bits_decode_step },
283   { DST_LOGIC_AND   ,"DST_LOGIC_AND"   , 1 ,0                                      ,NULL                  ,dst_logic_and_step   },
284   { DST_LOGIC_NAND  ,"DST_LOGIC_NAND"  , 1 ,0                                      ,NULL                  ,dst_logic_nand_step  },
285   { DST_LOGIC_OR    ,"DST_LOGIC_OR"    , 1 ,0                                      ,NULL                  ,dst_logic_or_step    },
286   { DST_LOGIC_NOR   ,"DST_LOGIC_NOR"   , 1 ,0                                      ,NULL                  ,dst_logic_nor_step   },
287   { DST_LOGIC_XOR   ,"DST_LOGIC_XOR"   , 1 ,0                                      ,NULL                  ,dst_logic_xor_step   },
288   { DST_LOGIC_NXOR  ,"DST_LOGIC_NXOR"  , 1 ,0                                      ,NULL                  ,dst_logic_nxor_step  },
289   { DST_LOGIC_DFF   ,"DST_LOGIC_DFF"   , 1 ,sizeof(struct dst_flipflop_context)    ,dst_logic_ff_reset    ,dst_logic_dff_step   },
290   { DST_LOGIC_JKFF  ,"DST_LOGIC_JKFF"  , 1 ,sizeof(struct dst_flipflop_context)    ,dst_logic_ff_reset    ,dst_logic_jkff_step  },
291   { DST_LOOKUP_TABLE,"DST_LOOKUP_TABLE", 1 ,0                                      ,NULL                  ,dst_lookup_table_step},
292   { DST_MULTIPLEX   ,"DST_MULTIPLEX"   , 1 ,sizeof(struct dst_size_context)        ,dst_multiplex_reset   ,dst_multiplex_step   },
293   { DST_ONESHOT     ,"DST_ONESHOT"     , 1 ,sizeof(struct dst_oneshot_context)     ,dst_oneshot_reset     ,dst_oneshot_step     },
294   { DST_RAMP        ,"DST_RAMP"        , 1 ,sizeof(struct dss_ramp_context)        ,dst_ramp_reset        ,dst_ramp_step        },
295   { DST_SAMPHOLD    ,"DST_SAMPHOLD"    , 1 ,sizeof(struct dst_samphold_context)    ,dst_samphold_reset    ,dst_samphold_step    },
296   { DST_SWITCH      ,"DST_SWITCH"      , 1 ,0                                      ,NULL                  ,dst_switch_step      },
297   { DST_ASWITCH     ,"DST_ASWITCH"     , 1 ,0                                      ,NULL                  ,dst_aswitch_step     },
298   { DST_TRANSFORM   ,"DST_TRANSFORM"   , 1 ,0                                      ,NULL                  ,dst_transform_step   },
220   { DST_ADDER       ,"DST_ADDER"       , 1 ,0                                      ,NULL                  ,dst_adder_step       ,NULL                  ,NULL                 },
221   { DST_CLAMP       ,"DST_CLAMP"       , 1 ,0                                      ,NULL                  ,dst_clamp_step       ,NULL                  ,NULL                 },
222   { DST_DIVIDE      ,"DST_DIVIDE"      , 1 ,0                                      ,NULL                  ,dst_divide_step      ,NULL                  ,NULL                 },
223   { DST_GAIN        ,"DST_GAIN"        , 1 ,0                                      ,NULL                  ,dst_gain_step        ,NULL                  ,NULL                 },
224   { DST_LOGIC_INV   ,"DST_LOGIC_INV"   , 1 ,0                                      ,NULL                  ,dst_logic_inv_step   ,NULL                  ,NULL                 },
225   { DST_GAIN        ,"DST_GAIN"        , 1 ,0                                      ,NULL                  ,dst_gain_step        ,NULL                  ,NULL                 },
226   { DST_BITS_DECODE ,"DST_BITS_DECODE" , 8 ,sizeof(struct dst_bits_decode_context) ,dst_bits_decode_reset ,dst_bits_decode_step ,NULL                  ,NULL                 },
227   { DST_LOGIC_AND   ,"DST_LOGIC_AND"   , 1 ,0                                      ,NULL                  ,dst_logic_and_step   ,NULL                  ,NULL                 },
228   { DST_LOGIC_NAND  ,"DST_LOGIC_NAND"  , 1 ,0                                      ,NULL                  ,dst_logic_nand_step  ,NULL                  ,NULL                 },
229   { DST_LOGIC_OR    ,"DST_LOGIC_OR"    , 1 ,0                                      ,NULL                  ,dst_logic_or_step    ,NULL                  ,NULL                 },
230   { DST_LOGIC_NOR   ,"DST_LOGIC_NOR"   , 1 ,0                                      ,NULL                  ,dst_logic_nor_step   ,NULL                  ,NULL                 },
231   { DST_LOGIC_XOR   ,"DST_LOGIC_XOR"   , 1 ,0                                      ,NULL                  ,dst_logic_xor_step   ,NULL                  ,NULL                 },
232   { DST_LOGIC_NXOR  ,"DST_LOGIC_NXOR"  , 1 ,0                                      ,NULL                  ,dst_logic_nxor_step  ,NULL                  ,NULL                 },
233   { DST_LOGIC_DFF   ,"DST_LOGIC_DFF"   , 1 ,sizeof(struct dst_flipflop_context)    ,dst_logic_ff_reset    ,dst_logic_dff_step   ,NULL                  ,NULL                 },
234   { DST_LOGIC_JKFF  ,"DST_LOGIC_JKFF"  , 1 ,sizeof(struct dst_flipflop_context)    ,dst_logic_ff_reset    ,dst_logic_jkff_step  ,NULL                  ,NULL                 },
235   { DST_LOOKUP_TABLE,"DST_LOOKUP_TABLE", 1 ,0                                      ,NULL                  ,dst_lookup_table_step,NULL                  ,NULL                 },
236   { DST_MULTIPLEX   ,"DST_MULTIPLEX"   , 1 ,sizeof(struct dst_size_context)        ,dst_multiplex_reset   ,dst_multiplex_step   ,NULL                  ,NULL                 },
237   { DST_ONESHOT     ,"DST_ONESHOT"     , 1 ,sizeof(struct dst_oneshot_context)     ,dst_oneshot_reset     ,dst_oneshot_step     ,NULL                  ,NULL                 },
238   { DST_RAMP        ,"DST_RAMP"        , 1 ,sizeof(struct dss_ramp_context)        ,dst_ramp_reset        ,dst_ramp_step        ,NULL                  ,NULL                 },
239   { DST_SAMPHOLD    ,"DST_SAMPHOLD"    , 1 ,sizeof(struct dst_samphold_context)    ,dst_samphold_reset    ,dst_samphold_step    ,NULL                  ,NULL                 },
240   { DST_SWITCH      ,"DST_SWITCH"      , 1 ,0                                      ,NULL                  ,dst_switch_step      ,NULL                  ,NULL                 },
241   { DST_ASWITCH     ,"DST_ASWITCH"     , 1 ,0                                      ,NULL                  ,dst_aswitch_step     ,NULL                  ,NULL                 },
242   { DST_TRANSFORM   ,"DST_TRANSFORM"   , 1 ,0                                      ,NULL                  ,dst_transform_step   ,NULL                  ,NULL                 },
299243   /* Component specific */
300   { DST_COMP_ADDER  ,"DST_COMP_ADDER"  , 1 ,sizeof(struct dst_comp_adder_context)  ,dst_comp_adder_reset  ,dst_comp_adder_step  },
301   { DST_DAC_R1      ,"DST_DAC_R1"      , 1 ,sizeof(struct dst_dac_r1_context)      ,dst_dac_r1_reset      ,dst_dac_r1_step      },
302   { DST_DIODE_MIX   ,"DST_DIODE_MIX"   , 1 ,sizeof(struct dst_diode_mix__context)  ,dst_diode_mix_reset   ,dst_diode_mix_step   },
303   { DST_INTEGRATE   ,"DST_INTEGRATE"   , 1 ,sizeof(struct dst_integrate_context)   ,dst_integrate_reset   ,dst_integrate_step   },
304   { DST_MIXER       ,"DST_MIXER"       , 1 ,sizeof(struct dst_mixer_context)       ,dst_mixer_reset       ,dst_mixer_step       },
305   { DST_OP_AMP      ,"DST_OP_AMP"      , 1 ,sizeof(struct dst_op_amp_context)      ,dst_op_amp_reset      ,dst_op_amp_step      },
306   { DST_OP_AMP_1SHT ,"DST_OP_AMP_1SHT" , 1 ,sizeof(struct dst_op_amp_1sht_context) ,dst_op_amp_1sht_reset ,dst_op_amp_1sht_step },
307   { DST_TVCA_OP_AMP ,"DST_TVCA_OP_AMP" , 1 ,sizeof(struct dst_tvca_op_amp_context) ,dst_tvca_op_amp_reset ,dst_tvca_op_amp_step },
308   { DST_VCA         ,"DST_VCA"         , 1 ,0                                      ,NULL                  ,NULL                 },
244   { DST_COMP_ADDER  ,"DST_COMP_ADDER"  , 1 ,sizeof(struct dst_comp_adder_context)  ,dst_comp_adder_reset  ,dst_comp_adder_step  ,NULL                  ,NULL                 },
245   { DST_DAC_R1      ,"DST_DAC_R1"      , 1 ,sizeof(struct dst_dac_r1_context)      ,dst_dac_r1_reset      ,dst_dac_r1_step      ,NULL                  ,NULL                 },
246   { DST_DIODE_MIX   ,"DST_DIODE_MIX"   , 1 ,sizeof(struct dst_diode_mix__context)  ,dst_diode_mix_reset   ,dst_diode_mix_step   ,NULL                  ,NULL                 },
247   { DST_INTEGRATE   ,"DST_INTEGRATE"   , 1 ,sizeof(struct dst_integrate_context)   ,dst_integrate_reset   ,dst_integrate_step   ,NULL                  ,NULL                 },
248   { DST_MIXER       ,"DST_MIXER"       , 1 ,sizeof(struct dst_mixer_context)       ,dst_mixer_reset       ,dst_mixer_step       ,NULL                  ,NULL                 },
249   { DST_OP_AMP      ,"DST_OP_AMP"      , 1 ,sizeof(struct dst_op_amp_context)      ,dst_op_amp_reset      ,dst_op_amp_step      ,NULL                  ,NULL                 },
250   { DST_OP_AMP_1SHT ,"DST_OP_AMP_1SHT" , 1 ,sizeof(struct dst_op_amp_1sht_context) ,dst_op_amp_1sht_reset ,dst_op_amp_1sht_step ,NULL                  ,NULL                 },
251   { DST_TVCA_OP_AMP ,"DST_TVCA_OP_AMP" , 1 ,sizeof(struct dst_tvca_op_amp_context) ,dst_tvca_op_amp_reset ,dst_tvca_op_amp_step ,NULL                  ,NULL                 },
252   { DST_VCA         ,"DST_VCA"         , 1 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
309253
310254   /* from disc_flt.c */
311255   /* Generic modules */
312   { DST_FILTER1     ,"DST_FILTER1"     , 1 ,sizeof(struct dss_filter1_context)     ,dst_filter1_reset     ,dst_filter1_step     },
313   { DST_FILTER2     ,"DST_FILTER2"     , 1 ,sizeof(struct dss_filter2_context)     ,dst_filter2_reset     ,dst_filter2_step     },
256   { DST_FILTER1     ,"DST_FILTER1"     , 1 ,sizeof(struct dss_filter1_context)     ,dst_filter1_reset     ,dst_filter1_step     ,NULL                  ,NULL                 },
257   { DST_FILTER2     ,"DST_FILTER2"     , 1 ,sizeof(struct dss_filter2_context)     ,dst_filter2_reset     ,dst_filter2_step     ,NULL                  ,NULL                 },
314258   /* Component specific modules */
315   { DST_SALLEN_KEY  ,"DST_SALLEN_KEY"  , 1 ,sizeof(struct dss_filter2_context)     ,dst_sallen_key_reset  ,dst_sallen_key_step  },
316   { DST_CRFILTER    ,"DST_CRFILTER"    , 1 ,sizeof(struct dst_rcfilter_context)    ,dst_crfilter_reset    ,dst_crfilter_step    },
317   { DST_OP_AMP_FILT ,"DST_OP_AMP_FILT" , 1 ,sizeof(struct dst_op_amp_filt_context) ,dst_op_amp_filt_reset ,dst_op_amp_filt_step },
318   { DST_RCDISC      ,"DST_RCDISC"      , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc_reset      ,dst_rcdisc_step      },
319   { DST_RCDISC2     ,"DST_RCDISC2"     , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc2_reset     ,dst_rcdisc2_step     },
320   { DST_RCDISC3     ,"DST_RCDISC3"     , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc3_reset     ,dst_rcdisc3_step     },
321   { DST_RCDISC4     ,"DST_RCDISC4"     , 1 ,sizeof(struct dst_rcdisc4_context)     ,dst_rcdisc4_reset     ,dst_rcdisc4_step     },
322   { DST_RCDISC5     ,"DST_RCDISC5"     , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc5_reset     ,dst_rcdisc5_step     },
323   { DST_RCINTEGRATE ,"DST_RCINTEGRATE" , 1 ,sizeof(struct dst_rcintegrate_context) ,dst_rcintegrate_reset ,dst_rcintegrate_step },
324   { DST_RCDISC_MOD  ,"DST_RCDISC_MOD"  , 1 ,sizeof(struct dst_rcdisc_mod_context)  ,dst_rcdisc_mod_reset  ,dst_rcdisc_mod_step  },
325   { DST_RCFILTER    ,"DST_RCFILTER"    , 1 ,sizeof(struct dst_rcfilter_context)    ,dst_rcfilter_reset    ,dst_rcfilter_step    },
326   { DST_RCFILTER_SW ,"DST_RCFILTER_SW" , 1 ,sizeof(struct dst_rcfilter_sw_context) ,dst_rcfilter_sw_reset ,dst_rcfilter_sw_step },
259   { DST_SALLEN_KEY  ,"DST_SALLEN_KEY"  , 1 ,sizeof(struct dss_filter2_context)     ,dst_sallen_key_reset  ,dst_sallen_key_step  ,NULL                  ,NULL                 },
260   { DST_CRFILTER    ,"DST_CRFILTER"    , 1 ,sizeof(struct dst_rcfilter_context)    ,dst_crfilter_reset    ,dst_crfilter_step    ,NULL                  ,NULL                 },
261   { DST_OP_AMP_FILT ,"DST_OP_AMP_FILT" , 1 ,sizeof(struct dst_op_amp_filt_context) ,dst_op_amp_filt_reset ,dst_op_amp_filt_step ,NULL                  ,NULL                 },
262   { DST_RCDISC      ,"DST_RCDISC"      , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc_reset      ,dst_rcdisc_step      ,NULL                  ,NULL                 },
263   { DST_RCDISC2     ,"DST_RCDISC2"     , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc2_reset     ,dst_rcdisc2_step     ,NULL                  ,NULL                 },
264   { DST_RCDISC3     ,"DST_RCDISC3"     , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc3_reset     ,dst_rcdisc3_step     ,NULL                  ,NULL                 },
265   { DST_RCDISC4     ,"DST_RCDISC4"     , 1 ,sizeof(struct dst_rcdisc4_context)     ,dst_rcdisc4_reset     ,dst_rcdisc4_step     ,NULL                  ,NULL                 },
266   { DST_RCDISC5     ,"DST_RCDISC5"     , 1 ,sizeof(struct dst_rcdisc_context)      ,dst_rcdisc5_reset     ,dst_rcdisc5_step     ,NULL                  ,NULL                 },
267   { DST_RCINTEGRATE ,"DST_RCINTEGRATE" , 1 ,sizeof(struct dst_rcintegrate_context) ,dst_rcintegrate_reset ,dst_rcintegrate_step ,NULL                  ,NULL                 },
268   { DST_RCDISC_MOD  ,"DST_RCDISC_MOD"  , 1 ,sizeof(struct dst_rcdisc_mod_context)  ,dst_rcdisc_mod_reset  ,dst_rcdisc_mod_step  ,NULL                  ,NULL                 },
269   { DST_RCFILTER    ,"DST_RCFILTER"    , 1 ,sizeof(struct dst_rcfilter_context)    ,dst_rcfilter_reset    ,dst_rcfilter_step    ,NULL                  ,NULL                 },
270   { DST_RCFILTER_SW ,"DST_RCFILTER_SW" , 1 ,sizeof(struct dst_rcfilter_sw_context) ,dst_rcfilter_sw_reset ,dst_rcfilter_sw_step ,NULL                  ,NULL                 },
327271   /* For testing - seem to be buggered.  Use versions not ending in N. */
328   { DST_RCFILTERN   ,"DST_RCFILTERN"   , 1 ,sizeof(struct dss_filter1_context)     ,dst_rcfilterN_reset   ,dst_filter1_step     },
329   { DST_RCDISCN     ,"DST_RCDISCN"     , 1 ,sizeof(struct dss_filter1_context)     ,dst_rcdiscN_reset     ,dst_rcdiscN_step     },
330   { DST_RCDISC2N    ,"DST_RCDISC2N"    , 1 ,sizeof(struct dss_rcdisc2_context)     ,dst_rcdisc2N_reset    ,dst_rcdisc2N_step    },
272   { DST_RCFILTERN   ,"DST_RCFILTERN"   , 1 ,sizeof(struct dss_filter1_context)     ,dst_rcfilterN_reset   ,dst_filter1_step     ,NULL                  ,NULL                 },
273   { DST_RCDISCN     ,"DST_RCDISCN"     , 1 ,sizeof(struct dss_filter1_context)     ,dst_rcdiscN_reset     ,dst_rcdiscN_step     ,NULL                  ,NULL                 },
274   { DST_RCDISC2N    ,"DST_RCDISC2N"    , 1 ,sizeof(struct dss_rcdisc2_context)     ,dst_rcdisc2N_reset    ,dst_rcdisc2N_step    ,NULL                  ,NULL                 },
331275
332276   /* from disc_dev.c */
333277   /* generic modules */
334   { DST_CUSTOM      ,"DST_CUSTOM"      , 1 ,0                                      ,NULL                  ,NULL                 },
278   { DST_CUSTOM      ,"DST_CUSTOM"      , 1 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
335279   /* Component specific modules */
336   { DSD_555_ASTBL   ,"DSD_555_ASTBL"   , 1 ,sizeof(struct dsd_555_astbl_context)   ,dsd_555_astbl_reset   ,dsd_555_astbl_step   },
337   { DSD_555_MSTBL   ,"DSD_555_MSTBL"   , 1 ,sizeof(struct dsd_555_mstbl_context)   ,dsd_555_mstbl_reset   ,dsd_555_mstbl_step   },
338   { DSD_555_CC      ,"DSD_555_CC"      , 1 ,sizeof(struct dsd_555_cc_context)      ,dsd_555_cc_reset      ,dsd_555_cc_step      },
339   { DSD_555_VCO1    ,"DSD_555_VCO1"    , 1 ,sizeof(struct dsd_555_vco1_context)    ,dsd_555_vco1_reset    ,dsd_555_vco1_step    },
340   { DSD_566         ,"DSD_566"         , 1 ,sizeof(struct dsd_566_context)         ,dsd_566_reset         ,dsd_566_step         },
341   { DSD_LS624       ,"DSD_LS624"       , 1 ,sizeof(struct dsd_ls624_context)       ,dsd_ls624_reset       ,dsd_ls624_step       },
280   { DSD_555_ASTBL   ,"DSD_555_ASTBL"   , 1 ,sizeof(struct dsd_555_astbl_context)   ,dsd_555_astbl_reset   ,dsd_555_astbl_step   ,NULL                  ,NULL                 },
281   { DSD_555_MSTBL   ,"DSD_555_MSTBL"   , 1 ,sizeof(struct dsd_555_mstbl_context)   ,dsd_555_mstbl_reset   ,dsd_555_mstbl_step   ,NULL                  ,NULL                 },
282   { DSD_555_CC      ,"DSD_555_CC"      , 1 ,sizeof(struct dsd_555_cc_context)      ,dsd_555_cc_reset      ,dsd_555_cc_step      ,NULL                  ,NULL                 },
283   { DSD_555_VCO1    ,"DSD_555_VCO1"    , 1 ,sizeof(struct dsd_555_vco1_context)    ,dsd_555_vco1_reset    ,dsd_555_vco1_step    ,NULL                  ,NULL                 },
284   { DSD_566         ,"DSD_566"         , 1 ,sizeof(struct dsd_566_context)         ,dsd_566_reset         ,dsd_566_step         ,NULL                  ,NULL                 },
285   { DSD_LS624       ,"DSD_LS624"       , 1 ,sizeof(struct dsd_ls624_context)       ,dsd_ls624_reset       ,dsd_ls624_step       ,NULL                  ,NULL                 },
342286   /* must be the last one */
343   { DSS_NULL        ,"DSS_NULL"        , 0 ,0                                      ,NULL                  ,NULL                 }
287   { DSS_NULL        ,"DSS_NULL"        , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 }
344288};
345289
290INLINE void step_nodes_in_list(const linked_list_entry *list)
291{
292   const linked_list_entry *entry;
293
294   if (DISCRETE_PROFILING)
295   {
296      osd_ticks_t last = get_profile_ticks();
297
298      for (entry = list; entry != NULL; entry = entry->next)
299      {
300         node_description *node = (node_description *) entry->ptr;
301
302         node->run_time -= last;
303         (*node->module->step)(node);
304         last = get_profile_ticks();
305         node->run_time += last;
306      }
307   }
308   else
309   {
310      for (entry = list; entry != NULL; entry = entry->next)
311      {
312         node_description *node = (node_description *) entry->ptr;
313
314         /* Now step the node */
315         (*node->module->step)(node);
316      }
317   }
318}
319
346320/*************************************
347321 *
348322 *  Find a given node
r5613r5614
361335 *
362336 *************************************/
363337
364static void discrete_build_list(discrete_info *info, discrete_sound_block *intf, linked_list_entry ***current)
338static void discrete_build_list(discrete_info *info, const discrete_sound_block *intf, linked_list_entry ***current)
365339{
366340   int node_count = 0;
367341
r5613r5614
434408 *
435409 *************************************/
436410
437static void discrete_sanity_check(discrete_info *info)
411static void discrete_sanity_check(const discrete_info *info)
438412{
439413   linked_list_entry *entry;
440414   int node_count = 0;
r5613r5614
475449static DEVICE_START( discrete )
476450{
477451   linked_list_entry **intf;
452   linked_list_entry *entry;
478453   discrete_sound_block *intf_start = (discrete_sound_block *)device->static_config;
479454   discrete_info *info = get_safe_token(device);
480455   char name[32];
r5613r5614
490465   info->neg_sample_time = - info->sample_time;
491466
492467   info->total_samples = 0;
468   info->total_stream_updates = 0;
493469
494470   /* create the logfile */
495471   sprintf(name, "discrete%s.log", device->tag);
r5613r5614
519495   /* now go back and find pointers to all input nodes */
520496   find_input_nodes(info);
521497
522   /* then set up the output nodes */
523498   /* initialize the stream(s) */
524499   info->discrete_stream = stream_create(device,linked_list_count(info->input_list), linked_list_count(info->output_list), info->sample_rate, info, discrete_stream_update);
525500
r5613r5614
527502
528503   info->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
529504
530   setup_disc_logs(info);
505   /* Process nodes which have a start func */
506
507   for (entry = info->node_list; entry != NULL; entry = entry->next)
508   {
509      node_description *node = (node_description *) entry->ptr;
510
511      if (node->module->start)
512         (*node->module->start)(node);
513   }
514
531515}
532516
533517
r5613r5614
538522 *
539523 *************************************/
540524
525static UINT64 list_run_time(const linked_list_entry *list)
526{
527   const linked_list_entry *entry;
528   UINT64 total = 0;
529
530   for (entry = list; entry != NULL; entry = entry->next)
531   {
532      node_description *node = (node_description *) entry->ptr;
533
534      total += node->run_time;
535   }
536   return total;
537}
538
539static void display_profiling(const discrete_info *info)
540{
541   int count;
542   UINT64 total;
543   UINT64 tresh;
544   double tt;
545   linked_list_entry *entry;
546
547   /* calculate total time */
548   total = list_run_time(info->node_list);
549   count = linked_list_count(info->node_list);
550   /* print statistics */
551   printf("Total Samples  : %16" I64FMT "d\n", info->total_samples);
552   tresh = total / count;
553   printf("Treshold (mean): %16" I64FMT "d\n", tresh / info->total_samples );
554   for (entry = info->node_list; entry != NULL; entry = entry->next)
555   {
556      node_description *node = (node_description *) entry->ptr;
557
558      if (node->run_time > tresh)
559         printf("%3d: %20s %8.2f %10.2f\n", NODE_BLOCKINDEX(node), node->module->name, (float) node->run_time / (float) total * 100.0, ((float) node->run_time) / (float) info->total_samples);
560   }
561
562   /* Task information */
563   for (entry = info->task_list; entry != 0; entry = entry->next)
564   {
565      discrete_task_context *task = (discrete_task_context *) entry->ptr;
566      tt =  list_run_time(task->list);
567
568      printf("Task: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples);
569   }
570   tt =  list_run_time(info->step_list);
571
572   printf("Main: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples);
573
574   printf("Average samples/stream_update: %8.2f\n", (double) info->total_samples / (double) info->total_stream_updates);
575}
576
541577static DEVICE_STOP( discrete )
542578{
543579   discrete_info *info = get_safe_token(device);
544   int log_num;
580   linked_list_entry *entry;
545581
546582   osd_work_queue_free(info->queue);
547583
548584   if (DISCRETE_PROFILING)
549585   {
550      int count = 0;
551      linked_list_entry *entry;
552      osd_ticks_t total = 0;
553      osd_ticks_t tresh;
586      display_profiling(info);
587   }
554588
555      /* calculate total time */
556      for (entry = info->step_list; entry != NULL; entry = entry->next)
557      {
558         node_description *node = (node_description *) entry->ptr;
589   /* Process nodes which have a stop func */
559590
560         /* Now step the node */
561         total += node->run_time;
562         count++;
563      }
564      /* print statistics */
565      printf("Total Samples: %d\n", info->total_samples);
566      tresh = total / count;
567      for (entry = info->step_list; entry != NULL; entry = entry->next)
568      {
569         node_description *node = (node_description *) entry->ptr;
591   for (entry = info->node_list; entry != NULL; entry = entry->next)
592   {
593      node_description *node = (node_description *) entry->ptr;
570594
571         if (node->run_time > tresh)
572            printf("%3d: %20s %8.2f %10d\n", NODE_INDEX(node->node), node->module->name, (float) node->run_time / (float) total * 100.0, ((int) node->run_time) / info->total_samples);
573      }
595      if (node->module->stop)
596         (*node->module->stop)(node);
574597   }
575598
576   /* close any csv files */
577   for (log_num = 0; log_num < info->num_csvlogs; log_num++)
578      if (info->disc_csv_file[log_num])
579         fclose(info->disc_csv_file[log_num]);
580
581   /* close any wave files */
582   for (log_num = 0; log_num < info->num_wavelogs; log_num++)
583      if (info->disc_wav_file[log_num])
584         wav_close(info->disc_wav_file[log_num]);
585
586599   if (DISCRETE_DEBUGLOG)
587600   {
588601      /* close the debug log */
r5613r5614
622635   }
623636}
624637
625/* This was a try which unfortunately did not provide
626 * any improvement. Left here for reference
627 */
628#if 0
629INLINE void bigselect(const device_config *device, node_description *node)
630{
631   switch (node->module.type)
632   {
633   case  DSS_ADJUSTMENT  :      dss_adjustment_step(device, node); break;
634   case  DSS_INPUT_PULSE :      dss_input_pulse_step(device, node); break;
635   case  DSS_INPUT_STREAM:      dss_input_stream_step(device, node); break;
636   case  DSS_COUNTER     :      dss_counter_step(device, node); break;
637   case  DSS_LFSR_NOISE  :      dss_lfsr_step(device, node); break;
638   case  DSS_NOISE       :      dss_noise_step(device, node); break;
639   case  DSS_NOTE        :      dss_note_step(device, node); break;
640   case  DSS_SAWTOOTHWAVE:      dss_sawtoothwave_step(device, node); break;
641   case  DSS_SINEWAVE    :      dss_sinewave_step(device, node); break;
642   case  DSS_SQUAREWAVE  :      dss_squarewave_step(device, node); break;
643   case  DSS_SQUAREWFIX  :      dss_squarewfix_step(device, node); break;
644   case  DSS_SQUAREWAVE2 :      dss_squarewave2_step(device, node); break;
645   case  DSS_TRIANGLEWAVE:      dss_trianglewave_step(device, node); break;
646   case  DSS_INVERTER_OSC :   dss_inverter_osc_step(device, node); break;
647   case  DSS_OP_AMP_OSC  :      dss_op_amp_osc_step(device, node); break;
648   case  DSS_SCHMITT_OSC :      dss_schmitt_osc_step(device, node); break;
649   case  DSS_ADSR        :      dss_adsrenv_step(device, node); break;
650   case  DST_ADDER       :      dst_adder_step(device, node); break;
651   case  DST_CLAMP       :      dst_clamp_step(device, node); break;
652   case  DST_DIVIDE      :      dst_divide_step(device, node); break;
653   case  DST_GAIN        :      dst_gain_step(device, node); break;
654   case  DST_LOGIC_INV   :      dst_logic_inv_step(device, node); break;
655   case  DST_LOGIC_AND   :      dst_logic_and_step(device, node); break;
656   case  DST_LOGIC_NAND  :      dst_logic_nand_step(device, node); break;
657   case  DST_LOGIC_OR    :      dst_logic_or_step(device, node); break;
658   case  DST_LOGIC_NOR   :      dst_logic_nor_step(device, node); break;
659   case  DST_LOGIC_XOR   :      dst_logic_xor_step(device, node); break;
660   case  DST_LOGIC_NXOR  :      dst_logic_nxor_step(device, node); break;
661   case  DST_LOGIC_DFF   :      dst_logic_dff_step(device, node); break;
662   case  DST_LOGIC_JKFF  :      dst_logic_jkff_step(device, node); break;
663   case  DST_LOOKUP_TABLE:      dst_lookup_table_step(device, node); break;
664   case  DST_MULTIPLEX   :      dst_multiplex_step(device, node); break;
665   case  DST_ONESHOT     :      dst_oneshot_step(device, node); break;
666   case  DST_RAMP        :      dst_ramp_step(device, node); break;
667   case  DST_SAMPHOLD    :      dst_samphold_step(device, node); break;
668   case  DST_SWITCH      :      dst_switch_step(device, node); break;
669   case  DST_ASWITCH     :      dst_aswitch_step(device, node); break;
670   case  DST_TRANSFORM   :      dst_transform_step(device, node); break;
671   case  DST_COMP_ADDER  :      dst_comp_adder_step(device, node); break;
672   case  DST_DAC_R1      :      dst_dac_r1_step(device, node); break;
673   case  DST_DIODE_MIX   :      dst_diode_mix_step(device, node); break;
674   case  DST_INTEGRATE   :      dst_integrate_step(device, node); break;
675   case  DST_MIXER       :      dst_mixer_step(device, node); break;
676   case  DST_OP_AMP      :      dst_op_amp_step(device, node); break;
677   case  DST_OP_AMP_1SHT :      dst_op_amp_1sht_step(device, node); break;
678   case  DST_TVCA_OP_AMP :      dst_tvca_op_amp_step(device, node); break;
679   case  DST_FILTER1     :      dst_filter1_step(device, node); break;
680   case  DST_FILTER2     :      dst_filter2_step(device, node); break;
681   case  DST_SALLEN_KEY  :      dst_sallen_key_step(device, node); break;
682   case  DST_CRFILTER    :      dst_crfilter_step(device, node); break;
683   case  DST_OP_AMP_FILT :      dst_op_amp_filt_step(device, node); break;
684   case  DST_RCDISC      :      dst_rcdisc_step(device, node); break;
685   case  DST_RCDISC2     :      dst_rcdisc2_step(device, node); break;
686   case  DST_RCDISC3     :      dst_rcdisc3_step(device, node); break;
687   case  DST_RCDISC4     :      dst_rcdisc4_step(device, node); break;
688   case  DST_RCDISC5     :      dst_rcdisc5_step(device, node); break;
689   case  DST_RCINTEGRATE :      dst_rcintegrate_step(device, node); break;
690   case  DST_RCDISC_MOD  :      dst_rcdisc_mod_step(device, node); break;
691   case  DST_RCFILTER    :      dst_rcfilter_step(device, node); break;
692   case  DST_RCFILTER_SW :      dst_rcfilter_sw_step(device, node); break;
693   case  DST_RCFILTERN   :      dst_filter1_step(device, node); break;
694   case  DST_RCDISCN     :      dst_rcdiscN_step(device, node); break;
695   case  DST_RCDISC2N    :      dst_rcdisc2N_step(device, node); break;
696   case  DSD_555_ASTBL   :      dsd_555_astbl_step(device, node); break;
697   case  DSD_555_MSTBL   :      dsd_555_mstbl_step(device, node); break;
698   case  DSD_555_CC      :      dsd_555_cc_step(device, node); break;
699   case  DSD_555_VCO1    :      dsd_555_vco1_step(device, node); break;
700   case  DSD_566         :      dsd_566_step(device, node); break;
701   case  DSD_LS624       :      dsd_ls624_step(device, node); break;
702   }
703}
704#endif
705638/*************************************
706639 *
707640 *  Stream update functions
708641 *
709642 *************************************/
710643
711INLINE void discrete_stream_update_csv(discrete_info *info)
644static void *task_callback(void *param, int threadid)
712645{
713   int nodenum, outputnum;
646   task_info *ti = (task_info *) param;
647   int samples, i;
714648
715   /* Dump any csv logs */
716   for (outputnum = 0; outputnum < info->num_csvlogs; outputnum++)
717   {
718      fprintf(info->disc_csv_file[outputnum], "%" I64FMT "d", ++info->sample_num);
719      for (nodenum = 0; nodenum < info->csvlog_node[outputnum]->active_inputs; nodenum++)
720      {
721         fprintf(info->disc_csv_file[outputnum], ", %f", *info->csvlog_node[outputnum]->input[nodenum]);
722      }
723      fprintf(info->disc_csv_file[outputnum], "\n");
724   }
725}
649   /* set up task buffers */
650   for (i = 0; i < ti->context->numbuffered; i++)
651      ti->context->ptr[i] = &ti->context->node_buf[i][0];
726652
727INLINE void discrete_stream_update_wave(discrete_info *info)
728{
729   int outputnum;
730   double val;
731   INT16 wave_data_l, wave_data_r;
732
733   /* Dump any wave logs */
734   for (outputnum = 0; outputnum < info->num_wavelogs; outputnum++)
653   samples = ti->samples;
654   while (samples-- > 0)
735655   {
736      /* get nodes to be logged and apply gain, then clip to 16 bit */
737      val = (*info->wavelog_node[outputnum]->input[0]) * (*info->wavelog_node[outputnum]->input[1]);
738      val = (val < -32768) ? -32768 : (val > 32767) ? 32767 : val;
739      wave_data_l = (INT16)val;
740      if (info->wavelog_node[outputnum]->active_inputs == 2)
741      {
742         /* DISCRETE_WAVELOG1 */
743         wav_add_data_16(info->disc_wav_file[outputnum], &wave_data_l, 1);
744      }
745      else
746      {
747         /* DISCRETE_WAVELOG2 */
748         val = (*info->wavelog_node[outputnum]->input[2]) * (*info->wavelog_node[outputnum]->input[3]);
749         val = (val < -32768) ? -32768 : (val > 32767) ? 32767 : val;
750         wave_data_r = (INT16)val;
751
752         wav_add_data_16lr(info->disc_wav_file[outputnum], &wave_data_l, &wave_data_r, 1);
753      }
656      step_nodes_in_list(ti->context->list);
754657   }
658   /* reset ptr */
659   for (i = 0; i < ti->context->numbuffered; i++)
660      ti->context->ptr[i] = &ti->context->node_buf[i][0];
661
662   free(param);
663   return NULL;
755664}
756665
757666INLINE void discrete_stream_update_nodes(discrete_info *info)
r5613r5614
766675   {
767676      discrete_task_context *task = (discrete_task_context *) entry->ptr;
768677      int i;
769     
770      for (i = 0; i < task->numbuffered; i++)
678
679      for (i = task->numbuffered - 1; i >= 0 ; i--)
771680         **task->dest[i] = *task->ptr[i]++;
772681   }
773682
774683   /* loop over all nodes */
775   step_nodes_in_list(&info->step_list);
684   step_nodes_in_list(info->step_list);
776685}
777686
687static STREAM_UPDATE( buffer_stream_update )
688{
689   node_description *node = (node_description *) param;
690   struct dss_input_context *context = (struct dss_input_context *)node->context;
691   stream_sample_t *ptr = outputs[0];
692   int data = context->data;
693   int samplenum = samples;
694
695   while (samplenum-- > 0)
696     *(ptr++) = data;
697}
698
699
778700static STREAM_UPDATE( discrete_stream_update )
779701{
780702   discrete_info *info = (discrete_info *)param;
r5613r5614
797719      context->ptr = (void *) inputs[context->stream_in_number];
798720   }
799721
722   /* Queue tasks */
800723   for (entry = info->task_list; entry != 0; entry = entry->next)
801724   {
802725      task_info *ti = malloc(sizeof(task_info));
r5613r5614
811734   /* and wait for them */
812735   osd_work_queue_wait(info->queue, osd_ticks_per_second()*10);
813736
814   if ((info->num_csvlogs == 0) && (info->num_wavelogs == 0))
815   {
816      /* Now we must do samples iterations of the node list, one output for each step */
817      for (samplenum = 0; samplenum < samples; samplenum++)
818         discrete_stream_update_nodes(info);
819   }
820   else
821   {
822      /* Now we must do samples iterations of the node list, one output for each step */
823      for (samplenum = 0; samplenum < samples; samplenum++)
824      {
825         discrete_stream_update_nodes(info);
826         discrete_stream_update_csv(info);
827         discrete_stream_update_wave(info);
737   /* Now we must do samples iterations of the node list, one output for each step */
738   for (samplenum = 0; samplenum < samples; samplenum++)
739      discrete_stream_update_nodes(info);
828740
829      }
830   }
741   if (DISCRETE_PROFILING)
742      info->total_stream_updates++;
831743
832744}
833745
r5613r5614
842754
843755static void init_nodes(discrete_info *info, linked_list_entry *block_list, const device_config *device)
844756{
845   linked_list_entry   **cur_task_node = NULL;
757   linked_list_entry   **task_node_list_ptr = NULL;
846758   linked_list_entry   *entry;
759   linked_list_entry   *task_node_list = NULL;
847760   discrete_task_context *task = NULL;
848761   /* list tail pointers */
849   linked_list_entry   **step_list = &info->step_list;
850   linked_list_entry   **node_list = &info->node_list;
851   linked_list_entry   **task_list = &info->task_list;
852   linked_list_entry   **output_list = &info->output_list;
853   linked_list_entry   **input_list = &info->input_list;
762   linked_list_entry   **step_list_ptr = &info->step_list;
763   linked_list_entry   **node_list_ptr = &info->node_list;
764   linked_list_entry   **task_list_ptr = &info->task_list;
765   linked_list_entry   **output_list_ptr = &info->output_list;
766   linked_list_entry   **input_list_ptr = &info->input_list;
854767
855768   /* loop over all nodes */
856769   for (entry = block_list; entry != NULL; entry = entry->next)
857770   {
858771      discrete_sound_block *block = (discrete_sound_block *) entry->ptr;
859772      node_description *node = auto_alloc_clear(info->device->machine, node_description);
860      int inputnum, modulenum;
773      int modulenum;
861774
862775      /* find the requested module */
863776      for (modulenum = 0; module_list[modulenum].type != DSS_NULL; modulenum++)
r5613r5614
869782      /* static inits */
870783      node->context = NULL;
871784      node->info = info;
872      node->node = block->node;
873785      node->module = &module_list[modulenum];
874786      node->output[0] = 0.0;
875787      node->block = block;
876788      node->custom = block->custom;
877789      node->active_inputs = block->active_inputs;
790      node->run_time = 0;
878791
792      /* setup module if custom */
793      if (block->type == DST_CUSTOM)
794      {
795         const discrete_custom_info *custom = (const discrete_custom_info *)node->custom;
796         node->module = &custom->module;
797         node->custom = custom->custom;
798      }
799
800      /* allocate memory if necessary */
801      if (node->module->contextsize)
802         node->context = auto_alloc_array_clear(device->machine, UINT8, node->module->contextsize);
803
879804      /* keep track of special nodes */
880805      if (block->node == NODE_SPECIAL)
881806      {
r5613r5614
883808         {
884809            /* Output Node */
885810            case DSO_OUTPUT:
886               linked_list_add(info, &output_list, node);
811               linked_list_add(info, &output_list_ptr, node);
887812               break;
888813
889814            /* CSVlog Node for debugging */
890815            case DSO_CSVLOG:
891               if (info->num_csvlogs == DISCRETE_MAX_CSVLOGS)
892                  fatalerror("init_nodes() - There can not be more then %d discrete CSV logs.", DISCRETE_MAX_WAVELOGS);
893               info->csvlog_node[info->num_csvlogs++] = node;
894816               break;
895817
896818            /* Wavelog Node for debugging */
897819            case DSO_WAVELOG:
898               if (info->num_wavelogs == DISCRETE_MAX_WAVELOGS)
899                  fatalerror("init_nodes() - There can not be more then %d discrete wave logs.", DISCRETE_MAX_WAVELOGS);
900               info->wavelog_node[info->num_wavelogs++] = node;
901820               break;
902821
903822            /* Task processing */
904823            case DSO_TASK_START:
905               if (cur_task_node != NULL)
824               if (task_node_list_ptr != NULL)
906825                  fatalerror("init_nodes() - Nested DISCRETE_START_TASK.");
907               task = auto_alloc_clear(info->device->machine, discrete_task_context);
908               linked_list_add(info, &task_list, task);
909               cur_task_node = &task->list;
826               task_node_list = NULL;
827               task_node_list_ptr = &task_node_list;
910828               break;
911829
912830            case DSO_TASK_END:
913               if (cur_task_node == NULL)
831               if (task_node_list_ptr == NULL)
914832                  fatalerror("init_nodes() - NO DISCRETE_START_TASK.");
915               task->numbuffered = node->active_inputs;
916               {
917                  int i;
918                  for (i = 0; i < task->numbuffered; i++)
919                     task->dest[i] = (double **) &node->input[i];
920               }
833               task = auto_alloc_clear(info->device->machine, discrete_task_context);
834               task->numbuffered = 0;
835               task->list = task_node_list;
836               linked_list_add(info, &task_list_ptr, task);
921837               node->context = task;
922838               task = NULL;
839               task_node_list = NULL;
923840               break;
924841
925842            default:
r5613r5614
935852         info->indexed_node[NODE_INDEX(block->node)] = node;
936853      }
937854
938      for (inputnum = 0; inputnum < DISCRETE_MAX_INPUTS; inputnum++)
855      /* if we are an stream input node, track that */
856      if (block->type == DSS_INPUT_STREAM)
939857      {
940         node->input[inputnum] = &(block->initial[inputnum]);
858         linked_list_add(info, &input_list_ptr, node);
941859      }
942
943      /* setup module if custom */
944      if (block->type == DST_CUSTOM)
860      else if (block->type == DSS_INPUT_BUFFER)
945861      {
946         const discrete_custom_info *custom = (const discrete_custom_info *)node->custom;
947         node->module = &custom->module;
948         node->custom = custom->custom;
862         linked_list_add(info, &input_list_ptr, node);
949863      }
950864
951      /* allocate memory if necessary */
952      if (node->module->contextsize)
953         node->context = auto_alloc_array_clear(device->machine, UINT8, node->module->contextsize);
954
955      /* if we are an stream input node, track that */
956      if (block->type == DSS_INPUT_STREAM)
957      {
958         linked_list_add(info, &input_list, node);
959      }
960
961865      /* add to node list */
962      linked_list_add(info, &node_list, node);
866      linked_list_add(info, &node_list_ptr, node);
963867
964868      /* our running order just follows the order specified */
965869      /* does the node step ? */
966870      if (node->module->step != NULL)
967871      {
968872         /* do we belong to a task? */
969         if (cur_task_node == NULL)
970            linked_list_add(info, &step_list, node);
873         if (task_node_list_ptr == NULL)
874            linked_list_add(info, &step_list_ptr, node);
971875         else
972            linked_list_add(info, &cur_task_node, node);
876            linked_list_add(info, &task_node_list_ptr, node);
973877      }
974878
975879      if (block->type == DSO_TASK_END)
976880      {
977         cur_task_node = NULL;
881         task_node_list_ptr = NULL;
978882      }
979883
980884      /* and register save state */
981      if (node->node != NODE_SPECIAL)
982         state_save_register_device_item_array(device, node->node, node->output);
885      if (node->block->node != NODE_SPECIAL)
886         state_save_register_device_item_array(device, node->block->node, node->output);
983887   }
984888
985889   /* if no outputs, give an error */
r5613r5614
988892}
989893
990894
991
992895/*************************************
993896 *
994897 *  Find and attach all input nodes
r5613r5614
1016919         {
1017920            node_description *node_ref = info->indexed_node[NODE_INDEX(inputnode)];
1018921            if (!node_ref)
1019               fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", NODE_INDEX(node->node), NODE_INDEX(inputnode));
922               fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", NODE_BLOCKINDEX(node), NODE_INDEX(inputnode));
1020923
1021924            if (NODE_CHILD_NODE_NUM(inputnode) >= node_ref->module->num_output)
1022               fatalerror("discrete_start - NODE_%02d referenced non existent output %d on node NODE_%02d", NODE_INDEX(node->node), NODE_CHILD_NODE_NUM(inputnode), NODE_INDEX(inputnode));
925               fatalerror("discrete_start - NODE_%02d referenced non existent output %d on node NODE_%02d", NODE_BLOCKINDEX(node), NODE_CHILD_NODE_NUM(inputnode), NODE_INDEX(inputnode));
1023926
1024927            node->input[inputnum] = &(node_ref->output[NODE_CHILD_NODE_NUM(inputnode)]);   /* Link referenced node out to input */
1025928            node->input_is_node |= 1 << inputnum;         /* Bit flag if input is node */
r5613r5614
1029932            /* warn if trying to use a node for an input that can only be static */
1030933            if IS_VALUE_A_NODE(block->initial[inputnum])
1031934            {
1032               discrete_log(info, "Warning - discrete_start - NODE_%02d trying to use a node on static input %d",  NODE_INDEX(node->node), inputnum);
935               discrete_log(info, "Warning - discrete_start - NODE_%02d trying to use a node on static input %d",  NODE_BLOCKINDEX(node), inputnum);
1033936               /* also report it in the error log so it is not missed */
1034               logerror("Warning - discrete_start - NODE_%02d trying to use a node on static input %d",  NODE_INDEX(node->node), inputnum);
937               logerror("Warning - discrete_start - NODE_%02d trying to use a node on static input %d",  NODE_BLOCKINDEX(node), inputnum);
1035938            }
939            else
940            {
941               node->input[inputnum] = &(block->initial[inputnum]);
942            }
1036943         }
1037944      }
1038   }
1039}
1040
1041
1042/*************************************
1043 *
1044 *  Set up the logs
1045 *
1046 *************************************/
1047
1048static void setup_disc_logs(discrete_info *info)
1049{
1050   int log_num, node_num;
1051   char name[32];
1052
1053   for (log_num = 0; log_num < info->num_csvlogs; log_num++)
1054   {
1055      sprintf(name, "discrete%s_%d.csv", info->device->tag, log_num);
1056      info->disc_csv_file[log_num] = fopen(name, "w");
1057      /* Output some header info */
1058      fprintf(info->disc_csv_file[log_num], "\"MAME Discrete System Node Log\"\n");
1059      fprintf(info->disc_csv_file[log_num], "\"Log Version\", 1.0\n");
1060      fprintf(info->disc_csv_file[log_num], "\"Sample Rate\", %d\n", info->sample_rate);
1061      fprintf(info->disc_csv_file[log_num], "\n");
1062      fprintf(info->disc_csv_file[log_num], "\"Sample\"");
1063      for (node_num = 0; node_num < info->csvlog_node[log_num]->active_inputs; node_num++)
945      for (inputnum = node->active_inputs; inputnum < DISCRETE_MAX_INPUTS; inputnum++)
1064946      {
1065         fprintf(info->disc_csv_file[log_num], ", \"NODE_%2d\"", NODE_INDEX(info->csvlog_node[log_num]->block->input_node[node_num]));
947         //FIXME: Check that no nodes follow !
948         node->input[inputnum] = &(block->initial[inputnum]);
1066949      }
1067      fprintf(info->disc_csv_file[log_num], "\n");
1068950   }
1069
1070   for (log_num = 0; log_num < info->num_wavelogs; log_num++)
1071   {
1072      sprintf(name, "discrete%s_%d.wav", info->device->tag, log_num);
1073      info->disc_wav_file[log_num] = wav_open(name, info->sample_rate, info->wavelog_node[log_num]->active_inputs/2);
1074   }
1075951}
1076952
1077
1078
1079953/**************************************************************************
1080954 * Generic get_info
1081955 **************************************************************************/
src/emu/sound/discrete.h
r5613r5614
33383338 *************************************/
33393339
33403340/* calculate charge exponent using discrete sample time */
3341#define RC_CHARGE_EXP(rc)            (1.0 - exp(node->info->neg_sample_time / (rc)))
3341#define RC_CHARGE_EXP(_node, rc)            (1.0 - exp((_node)->info->neg_sample_time / (rc)))
33423342/* calculate charge exponent using given sample time */
33433343#define RC_CHARGE_EXP_DT(rc, dt)      (1.0 - exp(-(dt) / (rc)))
33443344#define RC_CHARGE_NEG_EXP_DT(rc, dt)   (1.0 - exp((dt) / (rc)))
33453345
33463346/* calculate discharge exponent using discrete sample time */
3347#define RC_DISCHARGE_EXP(rc)         (exp(node->info->neg_sample_time / (rc)))
3347#define RC_DISCHARGE_EXP(_node, rc)         (exp((_node)->info->neg_sample_time / (rc)))
33483348/* calculate discharge exponent using given sample time */
33493349#define RC_DISCHARGE_EXP_DT(rc, dt)      (exp(-(dt) / (rc)))
33503350#define RC_DISCHARGE_NEG_EXP_DT(rc, dt)   (exp((dt) / (rc)))
r5613r5614
33573357
33583358#define DISCRETE_STEP_NAME( _func )  _func ## _step
33593359#define DISCRETE_RESET_NAME( _func ) _func ## _reset
3360#define DISCRETE_START_NAME( _func ) _func ## _start
3361#define DISCRETE_STOP_NAME( _func )  _func ## _stop
33603362
3361#define DISCRETE_STEP(_func) void DISCRETE_STEP_NAME(_func) (node_description *node)
3362#define DISCRETE_RESET(_func) void DISCRETE_RESET_NAME(_func) (node_description *node)
3363#define DISCRETE_FUNC(_func) void _func (node_description *node)
33633364
3365#define DISCRETE_STEP(_func) DISCRETE_FUNC(DISCRETE_STEP_NAME(_func))
3366#define DISCRETE_RESET(_func) DISCRETE_FUNC(DISCRETE_RESET_NAME(_func))
3367#define DISCRETE_START(_func) DISCRETE_FUNC(DISCRETE_START_NAME(_func))
3368#define DISCRETE_STOP(_func) DISCRETE_FUNC(DISCRETE_STOP_NAME(_func))
3369
33643370#define DISCRETE_STEP_CALL(_func) DISCRETE_STEP_NAME(_func) (node)
33653371#define DISCRETE_RESET_CALL(_func) DISCRETE_RESET_NAME(_func) (node)
3372#define DISCRETE_START_CALL(_func) DISCRETE_START_NAME(_func) (node)
3373#define DISCRETE_STOP_CALL(_func) DISCRETE_STOP_NAME(_func) (node)
33663374
33673375#define DISCRETE_CUSTOM_MODULE(_basename, _context_type) \
33683376   { DST_CUSTOM, "CUSTOM", 1, sizeof(_context_type), DISCRETE_RESET_NAME(_basename), DISCRETE_STEP_NAME(_basename) }
r5613r5614
33773385
33783386#define DISCRETE_MAX_NODES            300
33793387#define DISCRETE_MAX_INPUTS            10
3380#define DISCRETE_MAX_WAVELOGS         10
3381#define DISCRETE_MAX_CSVLOGS         10
33823388#define DISCRETE_MAX_OUTPUTS          8
3389#define DISCRETE_MAX_TASK_OUTPUTS       8
33833390
33843391
33853392/*************************************
r5613r5614
36163623   const char *   name;
36173624   int            num_output;            /* Total number of output nodes, i.e. Master node + 1 */
36183625   size_t         contextsize;
3619   void (*reset)(node_description *node);   /* Called to reset a node after creation or system reset */
3620   void (*step)(node_description *node);   /* Called to execute one time delta of output update */
3626   DISCRETE_FUNC((*reset));               /* Called to reset a node after creation or system reset */
3627   DISCRETE_FUNC((*step));               /* Called to execute one time delta of output update */
3628   DISCRETE_FUNC((*start));            /* Called to execute at device start */
3629   DISCRETE_FUNC((*stop));               /* Called to execute at device stop */
36213630};
36223631
36233632
r5613r5614
36293638
36303639struct _node_description
36313640{
3632   int            node;                        /* The node's index number in the node list */
36333641   double         output[DISCRETE_MAX_OUTPUTS];      /* The node's last output value */
36343642
36353643   int            active_inputs;                  /* Number of active inputs on this node type */
r5613r5614
36603668typedef struct _linked_list_entry   linked_list_entry;
36613669struct _linked_list_entry
36623670{
3663   void *ptr;
3671   const void *ptr;
36643672   linked_list_entry *next;
36653673};
36663674
36673675typedef struct _discrete_task_context discrete_task_context;
36683676struct _discrete_task_context
36693677{
3670   linked_list_entry *list;
3678   const linked_list_entry *list;
36713679
3672   int numbuffered;
3673   double *ptr[5];
3674   double node_buf[5][2048];
3675   double **dest[5];
3680   int             numbuffered;
3681   double             *ptr[DISCRETE_MAX_TASK_OUTPUTS];
3682   double             *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
3683   node_description   *nodes[DISCRETE_MAX_TASK_OUTPUTS];
3684   double             **dest[DISCRETE_MAX_TASK_OUTPUTS];
3685
36763686};
36773687
36783688struct _discrete_info
r5613r5614
37083718   /* the output stream */
37093719   sound_stream *discrete_stream;
37103720
3711   /* debugging statics */
3721   /* debugging statistics */
37123722   FILE *disclogfile;
37133723
3714   /* csvlog tracking */
3715   int num_csvlogs;
3716   FILE *disc_csv_file[DISCRETE_MAX_CSVLOGS];
3717   node_description *csvlog_node[DISCRETE_MAX_CSVLOGS];
3718   INT64 sample_num;
3719
3720   /* wavelog tracking */
3721   int num_wavelogs;
3722   wav_file *disc_wav_file[DISCRETE_MAX_WAVELOGS];
3723   node_description *wavelog_node[DISCRETE_MAX_WAVELOGS];
3724
37253724   /* parallel tasks */
3726
37273725   osd_work_queue *queue;
37283726
37293727   /* profiling */
3730   int total_samples;
3728   UINT64 total_samples;
3729   UINT64 total_stream_updates;
37313730};
37323731
37333732
r5613r5614
40804079#error "DISCRETE_MAX_OUTPUTS != 8"
40814080#endif
40824081
4082#define NODE_BLOCKINDEX(_node)   NODE_INDEX((_node)->block->node)
4083
40834084#define NODE_RELATIVE(_x, _y) (NODE(NODE_INDEX(_x) + (_y)))
40844085
40854086#define NODE_NC  NODE_00
r5613r5614
41174118   DSS_INPUT_NOT,      /* Input node */
41184119   DSS_INPUT_PULSE,   /* Input node, single pulsed version */
41194120   DSS_INPUT_STREAM,   /* Stream Input */
4121   DSS_INPUT_BUFFER,   /* Buffer Input node, for high freq inputs like DAC */
41204122
41214123   /* from disc_wav.c */
41224124   /* generic modules */
r5613r5614
42564258#define DISCRETE_INPUT_NOT(NODE)                                        { NODE, DSS_INPUT_NOT   , 3, { NODE_NC,NODE_NC,NODE_NC }, { 1,0,0 }, NULL, "DISCRETE_INPUT_NOT" },
42574259#define DISCRETE_INPUTX_NOT(NODE,GAIN,OFFSET,INIT)                      { NODE, DSS_INPUT_NOT   , 3, { NODE_NC,NODE_NC,NODE_NC }, { GAIN,OFFSET,INIT }, NULL, "DISCRETE_INPUTX_NOT" },
42584260#define DISCRETE_INPUT_PULSE(NODE,INIT)                                 { NODE, DSS_INPUT_PULSE , 3, { NODE_NC,NODE_NC,NODE_NC }, { 1,0,INIT }, NULL, "DISCRETE_INPUT_PULSE" },
4261
42594262#define DISCRETE_INPUT_STREAM(NODE, NUM)                                { NODE, DSS_INPUT_STREAM, 3, { NUM,NODE_NC,NODE_NC }, { NUM,1,0 }, NULL, "DISCRETE_INPUT_STREAM" },
42604263#define DISCRETE_INPUTX_STREAM(NODE, NUM, GAIN,OFFSET)                  { NODE, DSS_INPUT_STREAM, 3, { NUM,NODE_NC,NODE_NC }, { NUM,GAIN,OFFSET }, NULL, "DISCRETE_INPUTX_STREAM" },
42614264
4265#define DISCRETE_INPUT_BUFFER(NODE, NUM)                               { NODE, DSS_INPUT_BUFFER, 3, { NUM,NODE_NC,NODE_NC }, { NUM,1,0 }, NULL, "DISCRETE_INPUT_BUFFER" },
4266
42624267/* from disc_wav.c */
42634268/* generic modules */
42644269#define DISCRETE_COUNTER(NODE,ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE)     { NODE, DSS_COUNTER     , 7, { ENAB,RESET,CLK,NODE_NC,DIR,INIT0,NODE_NC }, { ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE }, NULL, "DISCRETE_COUNTER" },
r5613r5614
44114416
44124417/* parallel tasks */
44134418
4414#define DISCRETE_TASK_START()                                           { NODE_SPECIAL, DSO_TASK_START, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
4415#define DISCRETE_TASK_END(BNODE1)                                       { NODE_SPECIAL, DSO_TASK_END , 1, { BNODE1 }, { BNODE1 }, NULL, "DISCRETE_TASK_END" },
4416#define DISCRETE_TASK_END2(BNODE1,BNODE2)                               { NODE_SPECIAL, DSO_TASK_END , 2, { BNODE1,BNODE2 }, { BNODE1,BNODE2 }, NULL, "DISCRETE_TASK_END2" },
4417#define DISCRETE_TASK_END3(BNODE1,BNODE2,BNODE3)                        { NODE_SPECIAL, DSO_TASK_END , 3, { BNODE1,BNODE2,BNODE3 }, { BNODE1,BNODE2,BNODE3 }, NULL, "DISCRETE_TASK_END3" },
4418#define DISCRETE_TASK_END4(BNODE1,BNODE2,BNODE3,BNODE4)                 { NODE_SPECIAL, DSO_TASK_END , 4, { BNODE1,BNODE2,BNODE3,BNODE4 }, { BNODE1,BNODE2,BNODE3,BNODE4 }, NULL, "DISCRETE_TASK_END4" },
4419#define DISCRETE_TASK_END5(BNODE1,BNODE2,BNODE3,BNODE4,BNODE5)          { NODE_SPECIAL, DSO_TASK_END , 5, { BNODE1,BNODE2,BNODE3,BNODE4,BNODE5 }, { BNODE1,BNODE2,BNODE3,BNODE4,BNODE5 }, NULL, "DISCRETE_TASK_END5" },
4419#define DISCRETE_TASK_START()                                           { NODE_SPECIAL, DSO_TASK_START,0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
4420#define DISCRETE_TASK_END()                                             { NODE_SPECIAL, DSO_TASK_END , 1, { 0 }, { 0 }, NULL, "DISCRETE_TASK_END" },
44204421//#define DISCRETE_TASK_SYNC()                                          { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" },
44214422
44224423/* output */
src/emu/sound/disc_dev.c
r5613r5614
255255         context->t_rc_bleed  = DSD_555_ASTBL_T_RC_BLEED;
256256         context->t_rc_charge = DSD_555_ASTBL_T_RC_CHARGE;
257257         context->t_rc_discharge = DSD_555_ASTBL_T_RC_DISCHARGE;
258         context->exp_bleed  = RC_CHARGE_EXP(context->t_rc_bleed);
259         context->exp_charge = RC_CHARGE_EXP(context->t_rc_charge);
260         context->exp_discharge = RC_CHARGE_EXP(context->t_rc_discharge);
258         context->exp_bleed  = RC_CHARGE_EXP(node, context->t_rc_bleed);
259         context->exp_charge = RC_CHARGE_EXP(node, context->t_rc_charge);
260         context->exp_discharge = RC_CHARGE_EXP(node, context->t_rc_discharge);
261261         context->last_r1 = DSD_555_ASTBL__R1;
262262         context->last_r2 = DSD_555_ASTBL__R2;
263263         context->last_c  = DSD_555_ASTBL__C;
r5613r5614
418418   else
419419   {
420420      context->t_rc_bleed  = DSD_555_ASTBL_T_RC_BLEED;
421      context->exp_bleed   = RC_CHARGE_EXP(context->t_rc_bleed);
421      context->exp_bleed   = RC_CHARGE_EXP(node, context->t_rc_bleed);
422422      context->t_rc_charge = DSD_555_ASTBL_T_RC_CHARGE;
423      context->exp_charge  = RC_CHARGE_EXP(context->t_rc_charge);
423      context->exp_charge  = RC_CHARGE_EXP(node, context->t_rc_charge);
424424      context->t_rc_discharge = DSD_555_ASTBL_T_RC_DISCHARGE;
425      context->exp_discharge  = RC_CHARGE_EXP(context->t_rc_discharge);
425      context->exp_discharge  = RC_CHARGE_EXP(node, context->t_rc_discharge);
426426   }
427427
428428   context->output_is_ac = info->options & DISC_555_OUT_AC;
r5613r5614
506506         else
507507         {
508508            /* Charging */
509            v_cap_next = v_cap + ((info->v_pos - v_cap) * RC_CHARGE_EXP(DSD_555_MSTBL__R * DSD_555_MSTBL__C));
509            v_cap_next = v_cap + ((info->v_pos - v_cap) * RC_CHARGE_EXP(node, DSD_555_MSTBL__R * DSD_555_MSTBL__C));
510510
511511            /* Has it charged past upper limit? */
512512            /* If trigger is still enabled, then we keep charging,
r5613r5614
548548   context->output_type = info->options & DISC_555_OUT_MASK;
549549   if ((context->output_type == DISC_555_OUT_COUNT_F) || (context->output_type == DISC_555_OUT_COUNT_R))
550550   {
551      discrete_log(node->info, "Invalid Output type in NODE_%d.\n", node->node - NODE_00);
551      discrete_log(node->info, "Invalid Output type in NODE_%d.\n", NODE_BLOCKINDEX(node));
552552      context->output_type = DISC_555_OUT_SQW;
553553   }
554554
r5613r5614
994994            break;
995995      }
996996
997      context->exp_bleed  = RC_CHARGE_EXP(DSD_555_CC_T_RC_BLEED);
997      context->exp_bleed  = RC_CHARGE_EXP(node, DSD_555_CC_T_RC_BLEED);
998998      context->t_rc_discharge_01 = DSD_555_CC_T_RC_DISCHARGE_01;
999      context->exp_discharge_01  = RC_CHARGE_EXP(context->t_rc_discharge_01);
999      context->exp_discharge_01  = RC_CHARGE_EXP(node, context->t_rc_discharge_01);
10001000      context->t_rc_discharge_no_i = DSD_555_CC_T_RC_DISCHARGE_NO_I;
1001      context->exp_discharge_no_i  = RC_CHARGE_EXP(context->t_rc_discharge_no_i);
1001      context->exp_discharge_no_i  = RC_CHARGE_EXP(node, context->t_rc_discharge_no_i);
10021002      context->t_rc_charge = DSD_555_CC_T_RC_CHARGE;
1003      context->exp_charge  = RC_CHARGE_EXP(context->t_rc_charge);
1003      context->exp_charge  = RC_CHARGE_EXP(node, context->t_rc_charge);
10041004      context->t_rc_discharge = DSD_555_CC_T_RC_DISCHARGE;
1005      context->exp_discharge  = RC_CHARGE_EXP(context->t_rc_discharge);
1005      context->exp_discharge  = RC_CHARGE_EXP(node, context->t_rc_discharge);
10061006   }
10071007
10081008   /* Step to set the output */
r5613r5614
15221522   context->error = 0;
15231523   if (info->v_neg >= info->v_pos)
15241524   {
1525      logerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", node->node - NODE_00);
1525      logerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", NODE_BLOCKINDEX(node));
15261526      context->error = 1;
15271527      return;
15281528   }
src/emu/sound/disc_wav.c
r5613r5614
500500   context->out_lfsr_reg = (lfsr_desc->flags & DISC_LFSR_FLAG_OUTPUT_SR_SN1) ? 1 : 0;
501501
502502   if ((lfsr_desc->clock_type < DISC_CLK_ON_F_EDGE) || (lfsr_desc->clock_type > DISC_CLK_IS_FREQ))
503      discrete_log(node->info, "Invalid clock type passed in NODE_%d\n", NODE_INDEX(node->node));
503      discrete_log(node->info, "Invalid clock type passed in NODE_%d\n", NODE_BLOCKINDEX(node));
504504
505505   context->last = (DSS_COUNTER__CLOCK != 0);
506506   if (lfsr_desc->clock_type == DISC_CLK_IS_FREQ) context->t_clock = 1.0 / DSS_LFSR_NOISE__CLOCK;
r5613r5614
12071207     * So use this for the RC charge constant. */
12081208   rSource     = 1.0 / ((1.0 / info->rIn) + (1.0 / info->rFeedback));
12091209   context->rc = rSource * info->c;
1210   context->exponent = RC_CHARGE_EXP(context->rc);
1210   context->exponent = RC_CHARGE_EXP(node, context->rc);
12111211
12121212   /* Cap is at 0V on power up.  Causing output to be high. */
12131213   context->v_cap = 0;
r5613r5614
15081508#define DSS_INVERTER_OSC__C         DISCRETE_INPUT(4)
15091509#define DSS_INVERTER_OSC__R2      DISCRETE_INPUT(5)
15101510
1511INLINE double dss_inverter_tftab(node_description *node, double x)
1511INLINE double dss_inverter_tftab(const node_description *node, double x)
15121512{
15131513   const  discrete_inverter_osc_desc *info    = (const  discrete_inverter_osc_desc *)node->custom;
15141514   struct dss_inverter_osc_context   *context = (struct dss_inverter_osc_context *)node->context;
r5613r5614
15201520      return info->vB;
15211521}
15221522
1523INLINE double dss_inverter_tf(node_description *node, double x)
1523INLINE double dss_inverter_tf(const node_description *node, double x)
15241524{
15251525   const  discrete_inverter_osc_desc *info    = (const  discrete_inverter_osc_desc *)node->custom;
15261526   struct dss_inverter_osc_context   *context = (struct dss_inverter_osc_context *)node->context;
r5613r5614
15691569         vG2 = dss_inverter_tf(node,vG3);
15701570         break;
15711571      default:
1572         fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", node->node - NODE_00);
1572         fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", NODE_BLOCKINDEX(node));
15731573   }
15741574   switch (info->options & DISC_OSC_INVERTER_TYPE_MASK)
15751575   {
r5613r5614
16281628         diff = diff - diff * exp(-node->info->sample_time/(context->c * rMix));
16291629         break;
16301630      default:
1631         fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", node->node - NODE_00);
1631         fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", NODE_BLOCKINDEX(node));
16321632   }
16331633   context->v_cap   += diff;
16341634   context->v_g2_old = vG2;
src/emu/sound/sound.mak
r5613r5614
7878$(SOUNDOBJ)/discrete.o:   $(SOUNDSRC)/discrete.c \
7979                  $(SOUNDSRC)/discrete.h \
8080                  $(SOUNDSRC)/disc_dev.c \
81                  $(SOUNDSRC)/disc_sys.c \
8182                  $(SOUNDSRC)/disc_flt.c \
8283                  $(SOUNDSRC)/disc_inp.c \
8384                  $(SOUNDSRC)/disc_mth.c \
src/emu/sound/disc_flt.c
r5613r5614
107107   double  exp0;    /* fast case bit 0 */
108108   double  exp1;    /* fast case bit 1 */
109109   double  factor; /* fast case */
110   double  f1[16];
111   double  f2[16];
110112};
111113
112114struct dst_rcintegrate_context
r5613r5614
160162{
161163   struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
162164
163   context->exponent = RC_CHARGE_EXP(DST_CRFILTER__R * DST_CRFILTER__C);
165   context->exponent = RC_CHARGE_EXP(node, DST_CRFILTER__R * DST_CRFILTER__C);
164166   context->vCap   = 0;
165167   node->output[0] = DST_CRFILTER__IN;
166168}
r5613r5614
489491   {
490492      case DISC_OP_AMP_FILTER_IS_LOW_PASS_1:
491493      case DISC_OP_AMP_FILTER_IS_LOW_PASS_1M:
492         context->exponentC1 = RC_CHARGE_EXP(info->rF * info->c1);
494         context->exponentC1 = RC_CHARGE_EXP(node, info->rF * info->c1);
493495         context->exponentC2 =  0;
494496         break;
495497      case DISC_OP_AMP_FILTER_IS_HIGH_PASS_1:
496         context->exponentC1 = RC_CHARGE_EXP(context->rTotal * info->c1);
498         context->exponentC1 = RC_CHARGE_EXP(node, context->rTotal * info->c1);
497499         context->exponentC2 =  0;
498500         break;
499501      case DISC_OP_AMP_FILTER_IS_BAND_PASS_1:
500         context->exponentC1 = RC_CHARGE_EXP(info->rF * info->c1);
501         context->exponentC2 = RC_CHARGE_EXP(context->rTotal * info->c2);
502         context->exponentC1 = RC_CHARGE_EXP(node, info->rF * info->c1);
503         context->exponentC2 = RC_CHARGE_EXP(node, context->rTotal * info->c2);
502504         break;
503505      case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M | DISC_OP_AMP_IS_NORTON:
504506         context->rTotal = 1.0 / (1.0 / info->r1 + 1.0 / info->r2);
r5613r5614
523525         break;
524526      }
525527      case DISC_OP_AMP_FILTER_IS_BAND_PASS_0 | DISC_OP_AMP_IS_NORTON:
526         context->exponentC1 = RC_CHARGE_EXP(RES_2_PARALLEL(info->r1, info->r2 + info->r3 + info->r4) * info->c1);
527         context->exponentC2 = RC_CHARGE_EXP(RES_2_PARALLEL(info->r1 + info->r2, info->r3 + info->r4) * info->c2);
528         context->exponentC3 = RC_CHARGE_EXP((info->r1 + info->r2 + info->r3 + info->r4) * info->c3);
528         context->exponentC1 = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r1, info->r2 + info->r3 + info->r4) * info->c1);
529         context->exponentC2 = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r1 + info->r2, info->r3 + info->r4) * info->c2);
530         context->exponentC3 = RC_CHARGE_EXP(node, (info->r1 + info->r2 + info->r3 + info->r4) * info->c3);
529531         break;
530532      case DISC_OP_AMP_FILTER_IS_HIGH_PASS_0 | DISC_OP_AMP_IS_NORTON:
531         context->exponentC1 = RC_CHARGE_EXP(info->r1 * info->c1);
533         context->exponentC1 = RC_CHARGE_EXP(node, info->r1 * info->c1);
532534         break;
533535   }
534536
r5613r5614
639641
640642   context->state = 0;
641643   context->t = 0;
642   context->exponent0 = RC_DISCHARGE_EXP(DST_RCDISC2__R0 * DST_RCDISC2__C);
643   context->exponent1 = RC_DISCHARGE_EXP(DST_RCDISC2__R1 * DST_RCDISC2__C);
644   context->exponent0 = RC_DISCHARGE_EXP(node, DST_RCDISC2__R0 * DST_RCDISC2__C);
645   context->exponent1 = RC_DISCHARGE_EXP(node, DST_RCDISC2__R1 * DST_RCDISC2__C);
644646}
645647
646648/************************************************************************
r5613r5614
661663#define DST_RCDISC3__R1      DISCRETE_INPUT(2)
662664#define DST_RCDISC3__R2      DISCRETE_INPUT(3)
663665#define DST_RCDISC3__C      DISCRETE_INPUT(4)
664#define DST_RCDISC3__DJV   DISCRETE_INPUT(6)
666#define DST_RCDISC3__DJV   DISCRETE_INPUT(5)
665667
666668static DISCRETE_STEP(dst_rcdisc3)
667669{
r5613r5614
676678      diff = DST_RCDISC3__IN - node->output[0];
677679      if (context->v_diode > 0)
678680      {
679         if( diff > 0 )
681         if (diff > 0)
680682         {
681            diff = diff - (diff * context->exponent0);
682         } else if( diff < 0)
683            diff = diff * context->exponent0;
684         }
685         else if (diff < -context->v_diode)
683686         {
684            if(diff < -context->v_diode)
685               diff = diff - (diff * context->exponent1);
686            else
687               diff = diff - (diff * context->exponent0);
687            diff = diff * context->exponent1;
688688         }
689         else
690         {
691            diff = diff * context->exponent0;
692         }
689693      }
690694      else
691695      {
692         if( diff < 0 )
696         if (diff < 0)
693697         {
694            diff = diff - (diff * context->exponent0);
695         } else if( diff > 0)
698            diff = diff * context->exponent0;
699         }
700         else if (diff > -context->v_diode)
696701         {
697            if(diff > -context->v_diode)
698               diff = diff - (diff * context->exponent1);
699            else
700               diff = diff - (diff * context->exponent0);
702            diff = diff * context->exponent1;
701703         }
704         else
705         {
706            diff = diff * context->exponent0;
707         }
702708      }
703709      node->output[0] += diff;
704710   }
r5613r5614
717723   context->state = 0;
718724   context->t = 0;
719725   context->v_diode = DST_RCDISC3__DJV;
720   context->exponent0 = RC_CHARGE_EXP(DST_RCDISC3__R1 * DST_RCDISC3__C);
721   context->exponent1 = RC_CHARGE_EXP(RES_2_PARALLEL(DST_RCDISC3__R1, DST_RCDISC3__R2) * DST_RCDISC3__C);
726   context->exponent0 = RC_CHARGE_EXP(node, DST_RCDISC3__R1 * DST_RCDISC3__C);
727   context->exponent1 = RC_CHARGE_EXP(node, RES_2_PARALLEL(DST_RCDISC3__R1, DST_RCDISC3__R2) * DST_RCDISC3__C);
722728}
723729
724730
r5613r5614
780786   /* some error checking. */
781787   if (DST_RCDISC4__R1 <= 0 || DST_RCDISC4__R2 <= 0 || DST_RCDISC4__C1 <= 0 || (DST_RCDISC4__R3 <= 0 &&  context->type == 1))
782788   {
783      discrete_log(node->info, "Invalid component values in NODE_%d.\n", node->node - NODE_00);
789      discrete_log(node->info, "Invalid component values in NODE_%d.\n", NODE_BLOCKINDEX(node));
784790      return;
785791   }
786792   if (DST_RCDISC4__VP < 3)
787793   {
788      discrete_log(node->info, "vP must be >= 3V in NODE_%d.\n", node->node - NODE_00);
794      discrete_log(node->info, "vP must be >= 3V in NODE_%d.\n", NODE_BLOCKINDEX(node));
789795      return;
790796   }
791797   if (DST_RCDISC4__TYPE < 1 || DST_RCDISC4__TYPE > 3)
792798   {
793      discrete_log(node->info, "Invalid circuit type in NODE_%d.\n", node->node - NODE_00);
799      discrete_log(node->info, "Invalid circuit type in NODE_%d.\n", NODE_BLOCKINDEX(node));
794800      return;
795801   }
796802
r5613r5614
814820         i  = v / rT;
815821         context->v[1] = i * r + .5;
816822         rT = RES_2_PARALLEL(DST_RCDISC4__R2, r);
817         context->exp[1] = RC_CHARGE_EXP(rT * DST_RCDISC4__C1);
823         context->exp[1] = RC_CHARGE_EXP(node, rT * DST_RCDISC4__C1);
818824
819825         /* When the input is 0, R1 is out of circuit. */
820826         rT = DST_RCDISC4__R2 + DST_RCDISC4__R3;
821827         i  = v / rT;
822828         context->v[0] = i * DST_RCDISC4__R3 + .5;
823829         rT = RES_2_PARALLEL(DST_RCDISC4__R2, DST_RCDISC4__R3);
824         context->exp[0] = RC_CHARGE_EXP(rT * DST_RCDISC4__C1);
830         context->exp[0] = RC_CHARGE_EXP(node, rT * DST_RCDISC4__C1);
825831         break;
826832
827833      case 3:
r5613r5614
832838         r = 500.0 + DST_RCDISC4__R1;
833839         context->v[1] = RES_VOLTAGE_DIVIDER(r, DST_RCDISC4__R2) * (5.0 - 0.5);
834840         rT = RES_2_PARALLEL(r, DST_RCDISC4__R2);
835         context->exp[1] = RC_CHARGE_EXP(rT * DST_RCDISC4__C1);
841         context->exp[1] = RC_CHARGE_EXP(node, rT * DST_RCDISC4__C1);
836842
837843         /* When the input is 0, R1 is out of circuit. */
838844         context->v[0] = 0;
839         context->exp[0] = RC_CHARGE_EXP(DST_RCDISC4__R2 * DST_RCDISC4__C1);
845         context->exp[0] = RC_CHARGE_EXP(node, DST_RCDISC4__R2 * DST_RCDISC4__C1);
840846         break;
841847   }
842848}
r5613r5614
896902   context->state = 0;
897903   context->t = 0;
898904   context->v_cap = 0;
899   context->exponent0 = RC_CHARGE_EXP(DST_RCDISC5__R * DST_RCDISC5__C);
905   context->exponent0 = RC_CHARGE_EXP(node, DST_RCDISC5__R * DST_RCDISC5__C);
900906}
901907
902908
r5613r5614
969975   /* DST_RCDISC_MOD__IN1 <= 0.5 */
970976   rc[0] = DST_RCDISC_MOD__R1 + DST_RCDISC_MOD__R2;
971977   if (rc[0] < 1) rc[0] = 1;
972   context->exp_low[0]  = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * rc[0]);
978   context->exp_low[0]  = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * rc[0]);
973979   context->gain[0]     = RES_VOLTAGE_DIVIDER(rc[0], DST_RCDISC_MOD__R4);
974980   /* DST_RCDISC_MOD__IN1 > 0.5 */
975981   rc[1] = DST_RCDISC_MOD__R2;
976982   if (rc[1] < 1) rc[1] = 1;
977   context->exp_low[1]  = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * rc[1]);
983   context->exp_low[1]  = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * rc[1]);
978984   context->gain[1]     = RES_VOLTAGE_DIVIDER(rc[1], DST_RCDISC_MOD__R4);
979985   /* DST_RCDISC_MOD__IN2 <= 0.6 */
980986   rc2[0] = DST_RCDISC_MOD__R4;
981987   /* DST_RCDISC_MOD__IN2 > 0.6 */
982988   rc2[1] = RES_2_PARALLEL(DST_RCDISC_MOD__R3, DST_RCDISC_MOD__R4);
983989   /* DST_RCDISC_MOD__IN1 <= 0.5 && DST_RCDISC_MOD__IN2 <= 0.6 */
984   context->exp_high[0] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[0] + rc2[0]));
990   context->exp_high[0] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[0] + rc2[0]));
985991   context->vd_gain[0]  = RES_VOLTAGE_DIVIDER(rc[0], rc2[0]);
986992   /* DST_RCDISC_MOD__IN1 > 0.5  && DST_RCDISC_MOD__IN2 <= 0.6 */
987   context->exp_high[1] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[1] + rc2[0]));
993   context->exp_high[1] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[1] + rc2[0]));
988994   context->vd_gain[1]  = RES_VOLTAGE_DIVIDER(rc[1], rc2[0]);
989995   /* DST_RCDISC_MOD__IN1 <= 0.5 && DST_RCDISC_MOD__IN2 > 0.6 */
990   context->exp_high[2] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[0] + rc2[1]));
996   context->exp_high[2] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[0] + rc2[1]));
991997   context->vd_gain[2]  = RES_VOLTAGE_DIVIDER(rc[0], rc2[1]);
992998   /* DST_RCDISC_MOD__IN1 > 0.5  && DST_RCDISC_MOD__IN2 > 0.6 */
993   context->exp_high[3] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[1] + rc2[1]));
999   context->exp_high[3] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[1] + rc2[1]));
9941000   context->vd_gain[3]  = RES_VOLTAGE_DIVIDER(rc[1], rc2[1]);
9951001
9961002   context->v_cap  = 0;
r5613r5614
10371043{
10381044   struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
10391045
1040   context->exponent = RC_CHARGE_EXP(DST_RCFILTER__R * DST_RCFILTER__C);
1046   context->exponent = RC_CHARGE_EXP(node, DST_RCFILTER__R * DST_RCFILTER__C);
10411047   context->vCap   = 0;
10421048   node->output[0] = 0;
10431049}
r5613r5614
10591065#define DST_RCFILTER_SW__R         DISCRETE_INPUT(3)
10601066#define DST_RCFILTER_SW__C(x)      DISCRETE_INPUT(4+x)
10611067
1062#define CD4066_ON_RES  270
1063#define DST_RCFILTER_SW_ITERATIONS   (10)
1068/* 74HC4066 : 15
1069 * 74VHC4066 : 15
1070 * UTC4066 : 270 @ 5VCC, 80 @ 15VCC
1071 * CD4066BC : 270 (Fairchild)
1072 *
1073 * The choice below makes scramble sound about "right". For future error reports,
1074 * we need the exact type of switch and at which voltage (5, 12?) it is operated.
1075 */
1076#define CD4066_ON_RES (40)
10641077
10651078// FIXME: This needs optimization !
10661079static DISCRETE_STEP(dst_rcfilter_sw)
10671080{
10681081   struct dst_rcfilter_sw_context *context = (struct dst_rcfilter_sw_context *)node->context;
10691082
1070   int i,j ;
1083   int i;
10711084   int bits = (int)DST_RCFILTER_SW__SWITCH;
1072   double us = 0, rs = 0;
1073   double vd;
1074   double rt;
1085   double us = 0;
10751086
10761087   if (DST_RCFILTER_SW__ENABLE)
10771088   {
r5613r5614
10881099         context->vCap[1] += (DST_RCFILTER_SW__VIN - context->vCap[1]) * context->exp1;
10891100         node->output[0] = context->vCap[1] + (DST_RCFILTER_SW__VIN - context->vCap[1]) * context->factor;
10901101         break;
1091      case 3:
1092         rs = 2 * DST_RCFILTER_SW__R;
1093         vd = RES_VOLTAGE_DIVIDER(rs, CD4066_ON_RES) * DST_RCFILTER_SW__VIN;
1094         rt = DST_RCFILTER_SW__R / (CD4066_ON_RES + rs);
1095
1096         for (j = 0; j < DST_RCFILTER_SW_ITERATIONS; j++)
1097         {
1098            node->output[0] = vd + rt  * (context->vCap[0] + context->vCap[1]);
1099            context->vCap[0] += (node->output[0] - context->vCap[0]) * context->exp[0];
1100            context->vCap[1] += (node->output[0] - context->vCap[1]) * context->exp[1];
1101         }
1102         break;
11031102      default:
1104         rs = 0;
1105
11061103         for (i = 0; i < 4; i++)
11071104         {
11081105            if (( bits & (1 << i)) != 0)
1109            {
1110               rs += DST_RCFILTER_SW__R;
1111            }
1106               us += context->vCap[i];
11121107         }
1113
1114         vd = RES_VOLTAGE_DIVIDER(rs, CD4066_ON_RES) * DST_RCFILTER_SW__VIN;
1115         rt = DST_RCFILTER_SW__R / (CD4066_ON_RES + rs);
1116
1117         for (j = 0; j < DST_RCFILTER_SW_ITERATIONS; j++)
1108         node->output[0] = context->f1[bits] * DST_RCFILTER_SW__VIN + context->f2[bits]  * us;
1109         for (i = 0; i < 4; i++)
11181110         {
1119            us = 0;
1120            for (i = 0; i < 4; i++)
1121            {
1122               if (( bits & (1 << i)) != 0)
1123               {
1124                  us += context->vCap[i];
1125               }
1126            }
1127            node->output[0] = vd + rt  * us;
1128            for (i = 0; i < 4; i++)
1129            {
1130               if (( bits & (1 << i)) != 0)
1131               {
1132                  context->vCap[i] += (node->output[0] - context->vCap[i]) * context->exp[i];
1133               }
1134            }
1111            if (( bits & (1 << i)) != 0)
1112               context->vCap[i] += (node->output[0] - context->vCap[i]) * context->exp[i];
11351113         }
11361114      }
11371115   }
r5613r5614
11451123{
11461124   struct dst_rcfilter_sw_context *context = (struct dst_rcfilter_sw_context *)node->context;
11471125
1148   int i;
1126   int i, bits;
11491127
11501128   for (i = 0; i < 4; i++)
11511129   {
11521130      context->vCap[i] = 0;
1153      context->exp[i] = RC_CHARGE_EXP(((double) DST_RCFILTER_SW_ITERATIONS) * CD4066_ON_RES * DST_RCFILTER_SW__C(i));
1131      context->exp[i] = RC_CHARGE_EXP(node, CD4066_ON_RES * DST_RCFILTER_SW__C(i));
11541132   }
1133
1134   for (bits=0; bits < 15; bits++)
1135   {
1136      double rs = 0;
1137
1138      for (i = 0; i < 4; i++)
1139      {
1140         if (( bits & (1 << i)) != 0)
1141            rs += DST_RCFILTER_SW__R;
1142      }
1143      context->f1[bits] = RES_VOLTAGE_DIVIDER(rs, CD4066_ON_RES);
1144      context->f2[bits] = DST_RCFILTER_SW__R / (CD4066_ON_RES + rs);
1145   }
1146
1147
11551148   /* fast cases */
1156   context->exp0 = RC_CHARGE_EXP((CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(0));
1157   context->exp1 = RC_CHARGE_EXP((CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(1));
1149   context->exp0 = RC_CHARGE_EXP(node, (CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(0));
1150   context->exp1 = RC_CHARGE_EXP(node, (CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(1));
11581151   context->factor = RES_VOLTAGE_DIVIDER(DST_RCFILTER_SW__R, CD4066_ON_RES);
1152
11591153   node->output[0] = 0;
11601154}
11611155
src/emu/sound/sn76477.c
r5613r5614
19951995#if TEST_MODE
19961996   static int recursing = 0;   /* we need to prevent recursion since enable_w calls stream_update */
19971997
1998   if (input_code_pressed_once(KEYCODE_SPACE) && !recursing)
1998   if (input_code_pressed_once(device->machine, KEYCODE_SPACE) && !recursing)
19991999   {
20002000      recursing = 1;
20012001
2002      sound_global_enable(1);
2002      sound_global_enable(device->machine, 1);
20032003      SN76477_test_enable_w(sn, !sn->enable);
20042004   }
20052005
src/emu/inputseq.c
r5613r5614
133133    sequence of switch inputs is "pressed"
134134-------------------------------------------------*/
135135
136int input_seq_pressed(const input_seq *seq)
136int input_seq_pressed(running_machine *machine, const input_seq *seq)
137137{
138138   int result = FALSE;
139139   int invert = FALSE;
r5613r5614
167167      {
168168         /* if this is the first in the sequence, result is set equal */
169169         if (first)
170            result = input_code_pressed(code) ^ invert;
170            result = input_code_pressed(machine, code) ^ invert;
171171
172172         /* further values are ANDed */
173173         else if (result)
174            result &= input_code_pressed(code) ^ invert;
174            result &= input_code_pressed(machine, code) ^ invert;
175175
176176         /* no longer first, and clear the invert flag */
177177         first = invert = FALSE;
r5613r5614
188188    axis defined in an input sequence
189189-------------------------------------------------*/
190190
191INT32 input_seq_axis_value(const input_seq *seq, input_item_class *itemclass_ptr)
191INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input_item_class *itemclass_ptr)
192192{
193193   input_item_class itemclasszero = ITEM_CLASS_ABSOLUTE;
194194   input_item_class itemclass = ITEM_CLASS_INVALID;
r5613r5614
227227         {
228228            /* AND against previous digital codes */
229229            if (enable)
230               enable &= input_code_pressed(code) ^ invert;
230               enable &= input_code_pressed(machine, code) ^ invert;
231231         }
232232
233233         /* non-switch codes are analog values */
234234         else
235235         {
236            INT32 value = input_code_value(code);
236            INT32 value = input_code_value(machine, code);
237237
238238            /* if we got a 0 value, don't do anything except remember the first type */
239239            if (value == 0)
r5613r5614
279279    new sequence of the given itemclass
280280-------------------------------------------------*/
281281
282void input_seq_poll_start(input_item_class itemclass, const input_seq *startseq)
282void input_seq_poll_start(running_machine *machine, input_item_class itemclass, const input_seq *startseq)
283283{
284284   input_code dummycode;
285285
r5613r5614
300300      input_seq_append(&record_seq, SEQCODE_OR);
301301
302302   /* flush out any goobers */
303   dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(TRUE) : input_code_poll_axes(TRUE);
303   dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, TRUE) : input_code_poll_axes(machine, TRUE);
304304   while (dummycode != INPUT_CODE_INVALID)
305      dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(FALSE) : input_code_poll_axes(FALSE);
305      dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, FALSE) : input_code_poll_axes(machine, FALSE);
306306}
307307
308308
r5613r5614
310310    input_seq_poll - continue polling
311311-------------------------------------------------*/
312312
313int input_seq_poll(input_seq *finalseq)
313int input_seq_poll(running_machine *machine, input_seq *finalseq)
314314{
315315   input_code lastcode = input_seq_get_last(&record_seq);
316316   int has_or = FALSE;
r5613r5614
319319   /* switch case: see if we have a new code to process */
320320   if (record_class == ITEM_CLASS_SWITCH)
321321   {
322      newcode = input_code_poll_switches(FALSE);
322      newcode = input_code_poll_switches(machine, FALSE);
323323      if (newcode != INPUT_CODE_INVALID)
324324      {
325325         /* if code is duplicate, toggle the NOT state on the code */
r5613r5614
345345         lastcode = input_seq_get_last_but_one(&record_seq);
346346         has_or = TRUE;
347347      }
348      newcode = input_code_poll_axes(FALSE);
348      newcode = input_code_poll_axes(machine, FALSE);
349349
350350      /* if the last code doesn't match absolute/relative of this code, ignore the new one */
351351      if ((INPUT_CODE_ITEMCLASS(lastcode) == ITEM_CLASS_ABSOLUTE && INPUT_CODE_ITEMCLASS(newcode) != ITEM_CLASS_ABSOLUTE) ||
r5613r5614
407407    of a sequence
408408-------------------------------------------------*/
409409
410astring *input_seq_name(astring *string, const input_seq *seq)
410astring *input_seq_name(running_machine *machine, astring *string, const input_seq *seq)
411411{
412412   astring *codestr = astring_alloc();
413413   int codenum, copycodenum;
r5613r5614
419419      input_code code = seq->code[codenum];
420420
421421      /* if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs */
422      if (!INPUT_CODE_IS_INTERNAL(code) && astring_len(input_code_name(codestr, code)) == 0)
422      if (!INPUT_CODE_IS_INTERNAL(code) && astring_len(input_code_name(machine, codestr, code)) == 0)
423423      {
424424         while (copycodenum > 0 && INPUT_CODE_IS_INTERNAL(seqcopy.code[copycodenum - 1]))
425425            copycodenum--;
r5613r5614
456456
457457      /* otherwise, assume it is an input code and ask the input system to generate it */
458458      else
459         astring_cat(string, input_code_name(codestr, code));
459         astring_cat(string, input_code_name(machine, codestr, code));
460460   }
461461
462462   astring_free(codestr);
r5613r5614
469469    form of a sequence
470470-------------------------------------------------*/
471471
472astring *input_seq_to_tokens(astring *string, const input_seq *seq)
472astring *input_seq_to_tokens(running_machine *machine, astring *string, const input_seq *seq)
473473{
474474   astring *codestr = astring_alloc();
475475   int codenum;
r5613r5614
496496
497497      /* otherwise, assume it is an input code and ask the input system to generate it */
498498      else
499         astring_cat(string, input_code_to_token(codestr, code));
499         astring_cat(string, input_code_to_token(machine, codestr, code));
500500   }
501501
502502   astring_free(codestr);
r5613r5614
509509    form of a sequence
510510-------------------------------------------------*/
511511
512int input_seq_from_tokens(const char *string, input_seq *seq)
512int input_seq_from_tokens(running_machine *machine, const char *string, input_seq *seq)
513513{
514514   char *strcopy = alloc_array_or_die(char, strlen(string) + 1);
515515   char *str = strcopy;
r5613r5614
551551      else if (strcmp(str, "DEFAULT") == 0)
552552         code = SEQCODE_DEFAULT;
553553      else
554         code = input_code_from_token(str);
554         code = input_code_from_token(machine, str);
555555
556556      /* translate and add to the sequence */
557557      input_seq_append(seq, code);
src/emu/inputseq.h
r5613r5614
6969/* ----- state queries ----- */
7070
7171/* return TRUE if the given switch sequence has been pressed */
72int input_seq_pressed(const input_seq *seq);
72int input_seq_pressed(running_machine *machine, const input_seq *seq);
7373
7474/* return the value of an axis sequence */
75INT32 input_seq_axis_value(const input_seq *seq, input_item_class *itemclass_ptr);
75INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input_item_class *itemclass_ptr);
7676
7777
7878
7979/* ----- sequence polling ----- */
8080
8181/* begin polling for a new sequence of the given itemclass */
82void input_seq_poll_start(input_item_class itemclass, const input_seq *startseq);
82void input_seq_poll_start(running_machine *machine, input_item_class itemclass, const input_seq *startseq);
8383
8484/* continue polling for a sequence */
85int input_seq_poll(input_seq *finalseq);
85int input_seq_poll(running_machine *machine, input_seq *finalseq);
8686
8787
8888
8989/* ----- strings and tokenization ----- */
9090
9191/* generate the friendly name of an input sequence */
92astring *input_seq_name(astring *string, const input_seq *seq);
92astring *input_seq_name(running_machine *machine, astring *string, const input_seq *seq);
9393
9494/* convert an input sequence to tokens, returning the length */
95astring *input_seq_to_tokens(astring *string, const input_seq *seq);
95astring *input_seq_to_tokens(running_machine *machine, astring *string, const input_seq *seq);
9696
9797/* convert a set of tokens back to an input sequence */
98int input_seq_from_tokens(const char *string, input_seq *seq);
98int input_seq_from_tokens(running_machine *machine, const char *string, input_seq *seq);
9999
100100
101101
src/emu/ui.c
r5613r5614
298298      }
299299
300300      /* clear the input memory */
301      input_code_poll_switches(TRUE);
302      while (input_code_poll_switches(FALSE) != INPUT_CODE_INVALID) ;
301      input_code_poll_switches(machine, TRUE);
302      while (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID) ;
303303
304304      /* loop while we have a handler */
305305      while (ui_handler_callback != handler_ingame && !mame_is_scheduled_event_pending(machine) && !ui_menu_is_force_game_select())
r5613r5614
11041104   ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
11051105
11061106   /* an 'O' or left joystick kicks us to the next state */
1107   if (state == 0 && (input_code_pressed_once(KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
1107   if (state == 0 && (input_code_pressed_once(machine, KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
11081108      state++;
11091109
11101110   /* a 'K' or right joystick exits the state */
1111   else if (state == 1 && (input_code_pressed_once(KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
1111   else if (state == 1 && (input_code_pressed_once(machine, KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
11121112      state = UI_HANDLER_CANCEL;
11131113
11141114   /* if the user cancels, exit out completely */
r5613r5614
11411141   }
11421142
11431143   /* if any key is pressed, just exit */
1144   else if (input_code_poll_switches(FALSE) != INPUT_CODE_INVALID)
1144   else if (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID)
11451145      state = UI_HANDLER_CANCEL;
11461146
11471147   return state;
r5613r5614
12341234   if (ui_input_pressed(machine, IPT_UI_PAUSE))
12351235   {
12361236      /* with a shift key, it is single step */
1237      if (is_paused && (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT)))
1237      if (is_paused && (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT)))
12381238      {
12391239         single_step = TRUE;
12401240         mame_pause(machine, FALSE);
r5613r5614
13461346
13471347   /* check for A-Z or 0-9 */
13481348   for (code = KEYCODE_A; code <= (input_code)KEYCODE_Z; code++)
1349      if (input_code_pressed_once(code))
1349      if (input_code_pressed_once(machine, code))
13501350         file = code - KEYCODE_A + 'a';
13511351   if (file == 0)
13521352      for (code = KEYCODE_0; code <= (input_code)KEYCODE_9; code++)
1353         if (input_code_pressed_once(code))
1353         if (input_code_pressed_once(machine, code))
13541354            file = code - KEYCODE_0 + '0';
13551355   if (file == 0)
13561356      for (code = KEYCODE_0_PAD; code <= (input_code)KEYCODE_9_PAD; code++)
1357         if (input_code_pressed_once(code))
1357         if (input_code_pressed_once(machine, code))
13581358            file = code - KEYCODE_0_PAD + '0';
13591359   if (file == 0)
13601360      return state;
r5613r5614
15831583static INT32 slider_volume(running_machine *machine, void *arg, astring *string, INT32 newval)
15841584{
15851585   if (newval != SLIDER_NOCHANGE)
1586      sound_set_attenuation(newval);
1586      sound_set_attenuation(machine, newval);
15871587   if (string != NULL)
1588      astring_printf(string, "%3ddB", sound_get_attenuation());
1589   return sound_get_attenuation();
1588      astring_printf(string, "%3ddB", sound_get_attenuation(machine));
1589   return sound_get_attenuation(machine);
15901590}
15911591
15921592
src/emu/crsshair.c
r5613r5614
333333{
334334   int player;
335335
336   /* only animate once per frame, when vblank_state is 1 */
337   if (!vblank_state)
338      return;
339
336340   /* increment animation counter */
337   global.animation_counter += 0x04;
341   global.animation_counter += 0x08;
338342
339343   /* compute a fade factor from the current animation value */
340344   if (global.animation_counter < 0x80)
r5613r5614
362366         else
363367         {
364368            /* see if the player has been motionless for time specified */
365            /* note that the animate() routine is called twice per frame */
366369            /* slightly confusing formula, but the effect is: */
367370            /* auto_time = 0 makes the crosshair barely visible while moved */
368371            /* every increment in auto_time is about .2s at 60Hz */
369            if (global.time[player] > global.auto_time * 24 + 4)
372            if (global.time[player] > global.auto_time * 12 + 2)
370373               /* time exceeded so turn crosshair invisible */
371374               global.visible[player] = FALSE;
372375
src/emu/profiler.c
r5613r5614
4848void _profiler_mark_start(int type)
4949{
5050   profiler_data *data = &global_profiler.data[global_profiler.dataindex];
51   osd_ticks_t curticks = osd_profiling_ticks();
51   osd_ticks_t curticks = get_profile_ticks();
5252   profiler_filo_entry *entry;
5353   int index;
5454
r5613r5614
8585void _profiler_mark_end(void)
8686{
8787   profiler_data *data = &global_profiler.data[global_profiler.dataindex];
88   osd_ticks_t curticks = osd_profiling_ticks();
88   osd_ticks_t curticks = get_profile_ticks();
8989
9090   /* we're ending an existing bucket, update the time */
9191   if (global_profiler.filoindex > 0)
src/emu/sound.c
r5613r5614
8080#endif
8181};
8282
83struct _sound_private
84{
85   emu_timer *update_timer;
8386
87   int totalsnd;
8488
85/***************************************************************************
86    GLOBAL VARIABLES
87***************************************************************************/
89   UINT32 finalmix_leftover;
90   INT16 *finalmix;
91   INT32 *leftmix;
92   INT32 *rightmix;
8893
89static emu_timer *sound_update_timer;
94   int muted;
95   int attenuation;
96   int enabled;
97   int nosound_mode;
9098
91static int totalsnd;
99   wav_file *wavfile;
100};
92101
93static INT16 *finalmix;
94static UINT32 finalmix_leftover;
95static INT32 *leftmix, *rightmix;
96102
97static int sound_muted;
98static int sound_attenuation;
99static int global_sound_enabled;
100static int nosound_mode;
101103
102static wav_file *wavfile;
103
104
105
106104/***************************************************************************
107105    FUNCTION PROTOTYPES
108106***************************************************************************/
r5613r5614
191189
192190void sound_init(running_machine *machine)
193191{
192   sound_private *global;
194193   const char *filename;
195194
195   machine->sound_data = global = auto_alloc_clear(machine, sound_private);
196
196197   /* handle -nosound */
197   nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
198   if (nosound_mode)
198   global->nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
199   if (global->nosound_mode)
199200      machine->sample_rate = 11025;
200201
201202   /* count the speakers */
202203   VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config)));
203204
204205   /* allocate memory for mix buffers */
205   leftmix = auto_alloc_array(machine, INT32, machine->sample_rate);
206   rightmix = auto_alloc_array(machine, INT32, machine->sample_rate);
207   finalmix = auto_alloc_array(machine, INT16, machine->sample_rate);
206   global->leftmix = auto_alloc_array(machine, INT32, machine->sample_rate);
207   global->rightmix = auto_alloc_array(machine, INT32, machine->sample_rate);
208   global->finalmix = auto_alloc_array(machine, INT16, machine->sample_rate);
208209
209210   /* allocate a global timer for sound timing */
210   sound_update_timer = timer_alloc(machine, sound_update, NULL);
211   timer_adjust_periodic(sound_update_timer, STREAMS_UPDATE_FREQUENCY, 0, STREAMS_UPDATE_FREQUENCY);
211   global->update_timer = timer_alloc(machine, sound_update, NULL);
212   timer_adjust_periodic(global->update_timer, STREAMS_UPDATE_FREQUENCY, 0, STREAMS_UPDATE_FREQUENCY);
212213
213214   /* finally, do all the routing */
214215   VPRINTF(("route_sound\n"));
r5613r5614
217218   /* open the output WAV file if specified */
218219   filename = options_get_string(mame_options(), OPTION_WAVWRITE);
219220   if (filename[0] != 0)
220      wavfile = wav_open(filename, machine->sample_rate, 2);
221      global->wavfile = wav_open(filename, machine->sample_rate, 2);
221222
222223   /* enable sound by default */
223   global_sound_enabled = TRUE;
224   sound_muted = FALSE;
225   sound_set_attenuation(options_get_int(mame_options(), OPTION_VOLUME));
224   global->enabled = TRUE;
225   global->muted = FALSE;
226   sound_set_attenuation(machine, options_get_int(mame_options(), OPTION_VOLUME));
226227
227228   /* register callbacks */
228229   config_register(machine, "mixer", sound_load, sound_save);
r5613r5614
238239
239240static void sound_exit(running_machine *machine)
240241{
242   sound_private *global = machine->sound_data;
243
241244   /* close any open WAV file */
242   if (wavfile != NULL)
243      wav_close(wavfile);
245   if (global->wavfile != NULL)
246      wav_close(global->wavfile);
247   global->wavfile = NULL;
244248
245249   /* reset variables */
246   totalsnd = 0;
250   global->totalsnd = 0;
247251}
248252
249253
r5613r5614
541545
542546static void sound_pause(running_machine *machine, int pause)
543547{
548   sound_private *global = machine->sound_data;
549
544550   if (pause)
545      sound_muted |= 0x02;
551      global->muted |= 0x02;
546552   else
547      sound_muted &= ~0x02;
548   osd_set_mastervolume(sound_muted ? -32 : sound_attenuation);
553      global->muted &= ~0x02;
554   osd_set_mastervolume(global->muted ? -32 : global->attenuation);
549555}
550556
551557
552558/*-------------------------------------------------
553    sound_pause - pause sound output
559    sound_mute - mute sound output
554560-------------------------------------------------*/
555561
556void sound_mute(int mute)
562void sound_mute(running_machine *machine, int mute)
557563{
564   sound_private *global = machine->sound_data;
565
558566   if (mute)
559      sound_muted |= 0x01;
567      global->muted |= 0x01;
560568   else
561      sound_muted &= ~0x01;
562   osd_set_mastervolume(sound_muted ? -32 : sound_attenuation);
569      global->muted &= ~0x01;
570   osd_set_mastervolume(global->muted ? -32 : global->attenuation);
563571}
564572
565573
r5613r5614
567575    sound_set_attenuation - set the global volume
568576-------------------------------------------------*/
569577
570void sound_set_attenuation(int attenuation)
578void sound_set_attenuation(running_machine *machine, int attenuation)
571579{
572   sound_attenuation = attenuation;
573   osd_set_mastervolume(sound_muted ? -32 : sound_attenuation);
580   sound_private *global = machine->sound_data;
581   global->attenuation = attenuation;
582   osd_set_mastervolume(global->muted ? -32 : global->attenuation);
574583}
575584
576585
r5613r5614
579588    volume
580589-------------------------------------------------*/
581590
582int sound_get_attenuation(void)
591int sound_get_attenuation(running_machine *machine)
583592{
584   return sound_attenuation;
593   sound_private *global = machine->sound_data;
594   return global->attenuation;
585595}
586596
587597
r5613r5614
590600    globally
591601-------------------------------------------------*/
592602
593void sound_global_enable(int enable)
603void sound_global_enable(running_machine *machine, int enable)
594604{
595   global_sound_enabled = enable;
605   sound_private *global = machine->sound_data;
606   global->enabled = enable;
596607}
597608
598609
r5613r5614
684695   const device_config *curspeak;
685696   int samples_this_update = 0;
686697   int sample;
698   sound_private *global = machine->sound_data;
699   INT16 *finalmix;
700   INT32 *leftmix, *rightmix;
687701
688702   VPRINTF(("sound_update\n"));
689703
690704   profiler_mark_start(PROFILER_SOUND);
691705
706   leftmix = global->leftmix;
707   rightmix = global->rightmix;
708   finalmix = global->finalmix;
709
692710   /* force all the speaker streams to generate the proper number of samples */
693711   for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak))
694712   {
r5613r5614
729747#endif
730748
731749         /* mix if sound is enabled */
732         if (global_sound_enabled && !nosound_mode)
750         if (global->enabled && !global->nosound_mode)
733751         {
734752            /* if the speaker is centered, send to both left and right */
735753            if (spk->speaker->x == 0)
r5613r5614
755773   /* now downmix the final result */
756774   finalmix_step = video_get_speed_factor();
757775   finalmix_offset = 0;
758   for (sample = finalmix_leftover; sample < samples_this_update * 100; sample += finalmix_step)
776   for (sample = global->finalmix_leftover; sample < samples_this_update * 100; sample += finalmix_step)
759777   {
760778      int sampindex = sample / 100;
761779      INT32 samp;
r5613r5614
776794         samp = 32767;
777795      finalmix[finalmix_offset++] = samp;
778796   }
779   finalmix_leftover = sample - samples_this_update * 100;
797   global->finalmix_leftover = sample - samples_this_update * 100;
780798
781799   /* play the result */
782800   if (finalmix_offset > 0)
783801   {
784802      osd_update_audio_stream(machine, finalmix, finalmix_offset / 2);
785803      video_avi_add_sound(machine, finalmix, finalmix_offset / 2);
786      if (wavfile != NULL)
787         wav_add_data_16(wavfile, finalmix, finalmix_offset);
804      if (global->wavfile != NULL)
805         wav_add_data_16(global->wavfile, finalmix, finalmix_offset);
788806   }
789807
790808   /* update the streamer */
src/emu/sound.h
r5613r5614
156156
157157
158158/* global sound controls */
159void sound_mute(int mute);
160void sound_set_attenuation(int attenuation);
161int sound_get_attenuation(void);
162void sound_global_enable(int enable);
159void sound_mute(running_machine *machine, int mute);
160void sound_set_attenuation(running_machine *machine, int attenuation);
161int sound_get_attenuation(running_machine *machine);
162void sound_global_enable(running_machine *machine, int enable);
163163
164164/* user gain controls on speaker inputs for mixing */
165165int sound_get_user_gain_count(running_machine *machine);
src/emu/input.c
r5613r5614
115115};
116116
117117
118struct _input_private
119{
120   /* array of devices for each class */
121   input_device_list    device_list[DEVICE_CLASS_MAXIMUM];
122   input_code         code_pressed_memory[MAX_PRESSED_SWITCHES];
118123
124   /* device configuration */
125   UINT8            steadykey_enabled;
126   UINT8            lightgun_reload_button;
127   const char *      joystick_map_default;
128   INT32            joystick_deadzone;
129   INT32             joystick_saturation;
130};
131
132
119133/***************************************************************************
120134    TOKEN/STRING TABLES
121135***************************************************************************/
r5613r5614
392406    GLOBAL VARIABLES
393407***************************************************************************/
394408
395/* array of devices for each class */
396static input_device_list    device_list[DEVICE_CLASS_MAXIMUM];
397static input_code         code_pressed_memory[MAX_PRESSED_SWITCHES];
398
399/* device configuration */
400static UINT8            steadykey_enabled;
401static UINT8            lightgun_reload_button;
402static const char *         joystick_map_default;
403static INT32            joystick_deadzone;
404static INT32             joystick_saturation;
405
406409/* standard joystick mappings */
407410const char         joystick_map_8way[] = "7778...4445";
408411const char         joystick_map_4way_sticky[] = "s8.4s8.44s8.4445";
r5613r5614
415418***************************************************************************/
416419
417420static void input_frame(running_machine *machine);
418static input_device_item *input_code_item(input_code code);
419static INT32 convert_absolute_value(input_code code, input_device_item *item);
421static input_device_item *input_code_item(running_machine *machine, input_code code);
422static INT32 convert_absolute_value(running_machine *machine, input_code code, input_device_item *item);
420423static INT32 convert_relative_value(input_code code, input_device_item *item);
421static INT32 convert_switch_value(input_code code, input_device_item *item);
422static INT32 apply_deadzone_and_saturation(input_code code, INT32 result);
424static INT32 convert_switch_value(running_machine *machine, input_code code, input_device_item *item);
425static INT32 apply_deadzone_and_saturation(running_machine *machine, input_code code, INT32 result);
423426static int joystick_map_parse(const char *mapstring, joystick_map *map);
424427static void joystick_map_print(const char *header, const char *origstring, const joystick_map *map);
425static void input_code_reset_axes(void);
426static int input_code_check_axis(input_device_item *item, input_code code);
428static void input_code_reset_axes(running_machine *machine);
429static int input_code_check_axis(running_machine *machine, input_device_item *item, input_code code);
427430
428431
429432
r5613r5614
436439    a pointer to the associated device
437440-------------------------------------------------*/
438441
439INLINE input_device *input_code_device(input_code code)
442INLINE input_device *input_code_device(running_machine *machine, input_code code)
440443{
441444   /* if the class is valid... */
442445   input_device_class devclass = INPUT_CODE_DEVCLASS(code);
443446   if (devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM)
444447   {
448      input_device_list *device_list = machine->input_data->device_list;
449
445450      /* ...and the index is valid for that class, return a pointer to the device */
446451      int devindex = INPUT_CODE_DEVINDEX(code);
447452      if (devindex < device_list[devclass].count)
r5613r5614
462467{
463468   int devindex = device->devindex;
464469
465   assert(devindex < device_list[device->devclass].count);
470   assert(devindex < device->machine->input_data->device_list[device->devclass].count);
466471   assert(itemid < ITEM_ID_ABSOLUTE_MAXIMUM);
467472   assert(device->item[itemid] != NULL);
468473
r5613r5614
496501    of an input item
497502-------------------------------------------------*/
498503
499INLINE void input_item_update_value(input_device_item *item)
504INLINE void input_item_update_value(running_machine *machine, input_device_item *item)
500505{
506   input_device_list *device_list = machine->input_data->device_list;
507
501508   item->current = (*item->getstate)(device_list[item->devclass].list[item->devindex].internal, item->internal);
502509}
503510
r5613r5614
507514    of memory for pressed switches
508515-------------------------------------------------*/
509516
510INLINE void code_pressed_memory_reset(void)
517INLINE void code_pressed_memory_reset(running_machine *machine)
511518{
519   input_code *code_pressed_memory = machine->input_data->code_pressed_memory;
512520   int memnum;
521
513522   for (memnum = 0; memnum < MAX_PRESSED_SWITCHES; memnum++)
514523      code_pressed_memory[memnum] = INPUT_CODE_INVALID;
515524}
r5613r5614
561570void input_init(running_machine *machine)
562571{
563572   joystick_map map;
573   input_private *state;
574   input_device_list *device_list;
564575
576   /* allocate private memory */
577   machine->input_data = state = auto_alloc_clear(machine, input_private);
578   device_list = state->device_list;
579
565580   /* reset the device lists */
566581   memset(device_list, 0, sizeof(device_list));
567582
568583   /* reset code memory */
569   code_pressed_memory_reset();
584   code_pressed_memory_reset(machine);
570585
571586   /* request a per-frame callback for bookkeeping */
572587   add_frame_callback(machine, input_frame);
r5613r5614
584599   device_list[DEVICE_CLASS_JOYSTICK].multi = TRUE;
585600
586601   /* read other input options */
587   steadykey_enabled = options_get_bool(mame_options(), OPTION_STEADYKEY);
588   lightgun_reload_button = options_get_bool(mame_options(), OPTION_OFFSCREEN_RELOAD);
589   joystick_deadzone = (INT32)(options_get_float(mame_options(), OPTION_JOYSTICK_DEADZONE) * INPUT_ABSOLUTE_MAX);
590   joystick_saturation = (INT32)(options_get_float(mame_options(), OPTION_JOYSTICK_SATURATION) * INPUT_ABSOLUTE_MAX);
602   state->steadykey_enabled = options_get_bool(mame_options(), OPTION_STEADYKEY);
603   state->lightgun_reload_button = options_get_bool(mame_options(), OPTION_OFFSCREEN_RELOAD);
604   state->joystick_deadzone = (INT32)(options_get_float(mame_options(), OPTION_JOYSTICK_DEADZONE) * INPUT_ABSOLUTE_MAX);
605   state->joystick_saturation = (INT32)(options_get_float(mame_options(), OPTION_JOYSTICK_SATURATION) * INPUT_ABSOLUTE_MAX);
591606
592607   /* get the default joystick map */
593   joystick_map_default = options_get_string(mame_options(), OPTION_JOYSTICK_MAP);
594   if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0)
595      joystick_map_default = joystick_map_8way;
596   if (!joystick_map_parse(joystick_map_default, &map))
597      mame_printf_error("Invalid joystick map: %s\n", joystick_map_default);
598   else if (joystick_map_default != joystick_map_8way)
599      joystick_map_print("Input: Default joystick map", joystick_map_default, &map);
608   state->joystick_map_default = options_get_string(mame_options(), OPTION_JOYSTICK_MAP);
609   if (state->joystick_map_default[0] == 0 || strcmp(state->joystick_map_default, "auto") == 0)
610      state->joystick_map_default = joystick_map_8way;
611   if (!joystick_map_parse(state->joystick_map_default, &map))
612      mame_printf_error("Invalid joystick map: %s\n", state->joystick_map_default);
613   else if (state->joystick_map_default != joystick_map_8way)
614      joystick_map_print("Input: Default joystick map", state->joystick_map_default, &map);
600615}
601616
602617
r5613r5614
605620    a device class
606621-------------------------------------------------*/
607622
608void input_device_class_enable(input_device_class devclass, UINT8 enable)
623void input_device_class_enable(running_machine *machine, input_device_class devclass, UINT8 enable)
609624{
625   input_device_list *device_list = machine->input_data->device_list;
626
610627   assert(devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM);
611628   device_list[devclass].enabled = enable;
612629}
r5613r5614
617634    enabled?
618635-------------------------------------------------*/
619636
620UINT8 input_device_class_enabled(input_device_class devclass)
637UINT8 input_device_class_enabled(running_machine *machine, input_device_class devclass)
621638{
639   input_device_list *device_list = machine->input_data->device_list;
640
622641   assert(devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM);
623642   return device_list[devclass].enabled;
624643}
r5613r5614
629648    joystick map for a device
630649-------------------------------------------------*/
631650
632int input_device_set_joystick_map(int devindex, const char *mapstring)
651int input_device_set_joystick_map(running_machine *machine, int devindex, const char *mapstring)
633652{
653   input_device_list *device_list = machine->input_data->device_list;
634654   int startindex = devindex;
635655   int stopindex = devindex;
636656   joystick_map map;
r5613r5614
666686
667687static void input_frame(running_machine *machine)
668688{
689   input_private *state = machine->input_data;
690
669691   /* if steadykey is enabled, do processing here */
670   if (steadykey_enabled)
692   if (state->steadykey_enabled)
671693   {
694      input_device_list *device_list = state->device_list;
672695      int devnum;
673696
674697      /* iterate over keyboards */
r5613r5614
684707            input_device_item *item = device->item[itemid];
685708            if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH)
686709            {
687               input_item_update_value(item);
710               input_item_update_value(machine, item);
688711               if ((item->current ^ item->oldkey) & 1)
689712               {
690713                  changed = TRUE;
r5613r5614
723746
724747input_device *input_device_add(running_machine *machine, input_device_class devclass, const char *name, void *internal)
725748{
726   input_device_list *devlist = &device_list[devclass];
749   input_private *state = machine->input_data;
750   input_device_list *devlist = &state->device_list[devclass];
727751   input_device *device;
728752
729753   assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call input_device_add at init time!");
r5613r5614
745769   /* default to 8-way map for joysticks */
746770   if (devclass == DEVICE_CLASS_JOYSTICK)
747771   {
748      joystick_map_parse(joystick_map_default, &device->joymap);
772      joystick_map_parse(state->joystick_map_default, &device->joymap);
749773      device->lastmap = JOYSTICK_MAP_NEUTRAL;
750774   }
751775
r5613r5614
821845    given input code
822846-------------------------------------------------*/
823847
824INT32 input_code_value(input_code code)
848INT32 input_code_value(running_machine *machine, input_code code)
825849{
850   input_device_list *device_list = machine->input_data->device_list;
826851   input_device_class devclass = INPUT_CODE_DEVCLASS(code);
827852   int startindex = INPUT_CODE_DEVINDEX(code);
828853   int stopindex = startindex;
r5613r5614
852877   for (curindex = startindex; curindex <= stopindex; curindex++)
853878   {
854879      /* lookup the item for the appropriate index */
855      input_device_item *item = input_code_item(INPUT_CODE_SET_DEVINDEX(code, curindex));
880      input_device_item *item = input_code_item(machine, INPUT_CODE_SET_DEVINDEX(code, curindex));
856881      if (item == NULL)
857882         continue;
858883
859884      /* update the value of this item */
860      input_item_update_value(item);
885      input_item_update_value(machine, item);
861886
862887      /* process items according to their native type */
863888      switch (item->itemclass)
864889      {
865890         case ITEM_CLASS_ABSOLUTE:
866            result = convert_absolute_value(code, item);
891            result = convert_absolute_value(machine, code, item);
867892            break;
868893
869894         case ITEM_CLASS_RELATIVE:
r5613r5614
871896            break;
872897
873898         case ITEM_CLASS_SWITCH:
874            result |= convert_switch_value(code, item);
899            result |= convert_switch_value(machine, code, item);
875900            break;
876901
877902         default:
r5613r5614
890915    given input code has been pressed
891916-------------------------------------------------*/
892917
893int input_code_pressed(input_code code)
918int input_code_pressed(running_machine *machine, input_code code)
894919{
895   return (input_code_value(code) != 0);
920   return (input_code_value(machine, code) != 0);
896921}
897922
898923
r5613r5614
902927    on since the last call
903928-------------------------------------------------*/
904929
905int input_code_pressed_once(input_code code)
930int input_code_pressed_once(running_machine *machine, input_code code)
906931{
907   int curvalue = input_code_pressed(code);
932   input_code *code_pressed_memory = machine->input_data->code_pressed_memory;
933   int curvalue = input_code_pressed(machine, code);
908934   int memnum, empty = -1;
909935
910936   /* look for the code in the memory */
r5613r5614
943969    an input_item_id to an input_code
944970-------------------------------------------------*/
945971
946input_code input_code_from_input_item_id(input_item_id itemid)
972input_code input_code_from_input_item_id(running_machine *machine, input_item_id itemid)
947973{
974   input_device_list *device_list = machine->input_data->device_list;
948975   input_device_class devclass;
949976
950977   /* iterate over device classes and devices */
r5613r5614
969996    input_code_poll_switches - poll for any input
970997-------------------------------------------------*/
971998
972input_code input_code_poll_switches(int reset)
999input_code input_code_poll_switches(running_machine *machine, int reset)
9731000{
1001   input_device_list *device_list = machine->input_data->device_list;
9741002   input_device_class devclass;
9751003
9761004   /* if resetting memory, do it now */
9771005   if (reset)
9781006   {
979      code_pressed_memory_reset();
980      input_code_reset_axes();
1007      code_pressed_memory_reset(machine);
1008      input_code_reset_axes(machine);
9811009   }
9821010
9831011   /* iterate over device classes and devices */
r5613r5614
10031031               /* if the item is natively a switch, poll it */
10041032               if (item->itemclass == ITEM_CLASS_SWITCH)
10051033               {
1006                  if (input_code_pressed_once(code))
1034                  if (input_code_pressed_once(machine, code))
10071035                     return code;
10081036                  else
10091037                      continue;
10101038               }
10111039
10121040               /* skip if there is not enough axis movement */
1013               if (!input_code_check_axis(item, code))
1041               if (!input_code_check_axis(machine, item, code))
10141042                  continue;
10151043
10161044               /* otherwise, poll axes digitally */
r5613r5614
10201048               if (devclass == DEVICE_CLASS_JOYSTICK && INPUT_CODE_ITEMID(code) == ITEM_ID_XAXIS)
10211049               {
10221050                  code = INPUT_CODE_SET_MODIFIER(code, ITEM_MODIFIER_LEFT);
1023                  if (input_code_pressed_once(code))
1051                  if (input_code_pressed_once(machine, code))
10241052                     return code;
10251053                  code = INPUT_CODE_SET_MODIFIER(code, ITEM_MODIFIER_RIGHT);
1026                  if (input_code_pressed_once(code))
1054                  if (input_code_pressed_once(machine, code))
10271055                     return code;
10281056               }
10291057
r5613r5614
10311059               else if (devclass == DEVICE_CLASS_JOYSTICK && INPUT_CODE_ITEMID(code) == ITEM_ID_YAXIS)
10321060               {
10331061                  code = INPUT_CODE_SET_MODIFIER(code, ITEM_MODIFIER_UP);
1034                  if (input_code_pressed_once(code))
1062                  if (input_code_pressed_once(machine, code))
10351063                     return code;
10361064                  code = INPUT_CODE_SET_MODIFIER(code, ITEM_MODIFIER_DOWN);
1037                  if (input_code_pressed_once(code))
1065                  if (input_code_pressed_once(machine, code))
10381066                     return code;
10391067               }
10401068
r5613r5614
10421070               else
10431071               {
10441072                  code = INPUT_CODE_SET_MODIFIER(code, ITEM_MODIFIER_POS);
1045                  if (input_code_pressed_once(code))
1073                  if (input_code_pressed_once(machine, code))
10461074                     return code;
10471075                  code = INPUT_CODE_SET_MODIFIER(code, ITEM_MODIFIER_NEG);
1048                  if (input_code_pressed_once(code))
1076                  if (input_code_pressed_once(machine, code))
10491077                     return code;
10501078               }
10511079            }
r5613r5614
10631091    any keyboard-specific input
10641092-------------------------------------------------*/
10651093
1066input_code input_code_poll_keyboard_switches(int reset)
1094input_code input_code_poll_keyboard_switches(running_machine *machine, int reset)
10671095{
1068   input_device_list *devlist = &device_list[DEVICE_CLASS_KEYBOARD];
1096   input_device_list *devlist = &machine->input_data->device_list[DEVICE_CLASS_KEYBOARD];
10691097   int devnum;
10701098
10711099   /* if resetting memory, do it now */
10721100   if (reset)
1073      code_pressed_memory_reset();
1101      code_pressed_memory_reset(machine);
10741102
10751103   /* iterate over devices within each class */
10761104   for (devnum = 0; devnum < devlist->count; devnum++)
r5613r5614
10851113         if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH)
10861114         {
10871115            input_code code = device_item_to_code(device, itemid);
1088            if (input_code_pressed_once(code))
1116            if (input_code_pressed_once(machine, code))
10891117               return code;
10901118         }
10911119      }
r5613r5614
11011129    move far enough
11021130-------------------------------------------------*/
11031131
1104static int input_code_check_axis(input_device_item *item, input_code code)
1132static int input_code_check_axis(running_machine *machine, input_device_item *item, input_code code)
11051133{
11061134   INT32 curval, diff;
11071135
11081136   /* poll the current value */
1109   curval = input_code_value(code);
1137   curval = input_code_value(machine, code);
11101138
11111139   /* if we've already reported this one, don't bother */
11121140   if (item->memory == INVALID_AXIS_VALUE)
r5613r5614
11461174    input_code_reset_axes - reset axes memory
11471175-------------------------------------------------*/
11481176
1149static void input_code_reset_axes(void)
1177static void input_code_reset_axes(running_machine *machine)
11501178{
1179   input_device_list *device_list = machine->input_data->device_list;
11511180   input_device_class devclass;
11521181
11531182   /* iterate over device classes and devices */
r5613r5614
11751204                  continue;
11761205
11771206               /* poll the current value and reset the memory */
1178               item->memory = input_code_value(code);
1207               item->memory = input_code_value(machine, code);
11791208            }
11801209         }
11811210      }
r5613r5614
11871216    input_code_poll_axes - poll for any input
11881217-------------------------------------------------*/
11891218
1190input_code input_code_poll_axes(int reset)
1219input_code input_code_poll_axes(running_machine *machine, int reset)
11911220{
1221   input_device_list *device_list = machine->input_data->device_list;
11921222   input_device_class devclass;
11931223
11941224   /* if resetting memory, do it now */
11951225   if (reset)
1196      input_code_reset_axes();
1226      input_code_reset_axes(machine);
11971227
11981228   /* iterate over device classes and devices */
11991229   for (devclass = DEVICE_CLASS_FIRST_VALID; devclass < DEVICE_CLASS_MAXIMUM; devclass++)
r5613r5614
12201250                  continue;
12211251
12221252               /* check if there is enough axis movement */
1223               if (input_code_check_axis(item, code))
1253               if (input_code_check_axis(machine, item, code))
12241254                  return code;
12251255            }
12261256         }
r5613r5614
12421272    a friendly name
12431273-------------------------------------------------*/
12441274
1245astring *input_code_name(astring *string, input_code code)
1275astring *input_code_name(running_machine *machine, astring *string, input_code code)
12461276{
1247   input_device_item *item = input_code_item(code);
1277   input_device_list *device_list = machine->input_data->device_list;
1278   input_device_item *item = input_code_item(machine, code);
12481279   const char *devclass;
12491280   const char *devcode;
12501281   const char *modifier;
r5613r5614
13011332    a given code
13021333-------------------------------------------------*/
13031334
1304astring *input_code_to_token(astring *string, input_code code)
1335astring *input_code_to_token(running_machine *machine, astring *string, input_code code)
13051336{
1306   input_device_item *item = input_code_item(code);
1337   input_device_item *item = input_code_item(machine, code);
13071338   const char *devclass;
13081339   const char *devcode;
13091340   const char *itemclass;
r5613r5614
13531384    code from a token
13541385-------------------------------------------------*/
13551386
1356input_code input_code_from_token(const char *_token)
1387input_code input_code_from_token(running_machine *machine, const char *_token)
13571388{
13581389   UINT32 devclass, itemid, devindex, modifier, standard;
13591390   UINT32 itemclass = ITEM_CLASS_INVALID;
r5613r5614
14021433   else
14031434   {
14041435      input_device *device;
1436      input_device_list *device_list = machine->input_data->device_list;
14051437
14061438      /* if this is an invalid device, we have nothing to look up */
14071439      if (devindex >= device_list[devclass].count)
r5613r5614
14731505    from the code
14741506-------------------------------------------------*/
14751507
1476static input_device_item *input_code_item(input_code code)
1508static input_device_item *input_code_item(running_machine *machine, input_code code)
14771509{
1478   input_device *device = input_code_device(code);
1510   input_device *device = input_code_device(machine, code);
14791511   input_item_id itemid;
14801512
14811513   /* if no device, we fail */
r5613r5614
14971529    value into the class specified by code
14981530-------------------------------------------------*/
14991531
1500static INT32 convert_absolute_value(input_code code, input_device_item *item)
1532static INT32 convert_absolute_value(running_machine *machine, input_code code, input_device_item *item)
15011533{
1534   input_private *state = machine->input_data;
1535
15021536   /* make sure values are valid */
15031537   assert(item->current >= INPUT_ABSOLUTE_MIN && item->current <= INPUT_ABSOLUTE_MAX);
15041538
r5613r5614
15101544   else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
15111545   {
15121546      input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
1513      INT32 result = apply_deadzone_and_saturation(code, item->current);
1547      INT32 result = apply_deadzone_and_saturation(machine, code, item->current);
15141548
15151549      /* if we're doing a lightgun reload hack, override the value */
1516      if (lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
1550      if (state->lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
15171551      {
1518         input_device_item *button2_item = device_list[item->devclass].list[item->devindex].item[ITEM_ID_BUTTON2];
1552         input_device_item *button2_item = state->device_list[item->devclass].list[item->devindex].item[ITEM_ID_BUTTON2];
15191553         if (button2_item != NULL)
15201554         {
15211555            /* if it is pressed, return (min,max) */
1522            input_item_update_value(button2_item);
1556            input_item_update_value(machine, button2_item);
15231557            if (button2_item->current)
15241558               result = (INPUT_CODE_ITEMID(code) == ITEM_ID_XAXIS) ? INPUT_ABSOLUTE_MIN : INPUT_ABSOLUTE_MAX;
15251559         }
r5613r5614
15441578      /* left/right/up/down: if this is a joystick, fetch the paired X/Y axis values and convert */
15451579      if (modifier >= ITEM_MODIFIER_LEFT && modifier <= ITEM_MODIFIER_DOWN && item->devclass == DEVICE_CLASS_JOYSTICK)
15461580      {
1547         input_device *device = &device_list[item->devclass].list[item->devindex];
1581         input_device *device = &state->device_list[item->devclass].list[item->devindex];
15481582         input_device_item *xaxis_item = device->item[ITEM_ID_XAXIS];
15491583         input_device_item *yaxis_item = device->item[ITEM_ID_YAXIS];
15501584         if (xaxis_item != NULL && yaxis_item != NULL)
r5613r5614
15541588
15551589            /* determine which item we didn't update, and update it */
15561590            assert(item == xaxis_item || item == yaxis_item);
1557            input_item_update_value((item == xaxis_item) ? yaxis_item : xaxis_item);
1591            input_item_update_value(machine, (item == xaxis_item) ? yaxis_item : xaxis_item);
15581592
15591593            /* now map the X and Y axes to a 9x9 grid */
15601594            xaxisval = ((xaxis_item->current - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1);
r5613r5614
15741608
15751609      /* positive/negative: TRUE if past the deadzone in either direction */
15761610      if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN)
1577         return (apply_deadzone_and_saturation(code, item->current) > 0);
1611         return (apply_deadzone_and_saturation(machine, code, item->current) > 0);
15781612      else if (modifier == ITEM_MODIFIER_NEG || modifier == ITEM_MODIFIER_LEFT || modifier == ITEM_MODIFIER_UP)
1579         return (apply_deadzone_and_saturation(code, item->current) < 0);
1613         return (apply_deadzone_and_saturation(machine, code, item->current) < 0);
15801614   }
15811615
15821616   return 0;
r5613r5614
16191653    value into the class specified by code
16201654-------------------------------------------------*/
16211655
1622static INT32 convert_switch_value(input_code code, input_device_item *item)
1656static INT32 convert_switch_value(running_machine *machine, input_code code, input_device_item *item)
16231657{
1658   input_private *state = machine->input_data;
1659
16241660   /* only a switch is supported */
16251661   if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
16261662   {
16271663      /* if we're doing a lightgun reload hack, button 1 and 2 operate differently */
1628      if (lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
1664      if (state->lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
16291665      {
16301666         /* button 1 is pressed if either button 1 or 2 are active */
16311667         if (INPUT_CODE_ITEMID(code) == ITEM_ID_BUTTON1)
16321668         {
1633            input_device_item *button2_item = device_list[item->devclass].list[item->devindex].item[ITEM_ID_BUTTON2];
1669            input_device_item *button2_item = state->device_list[item->devclass].list[item->devindex].item[ITEM_ID_BUTTON2];
16341670            if (button2_item != NULL)
16351671            {
1636               input_item_update_value(button2_item);
1672               input_item_update_value(machine, button2_item);
16371673               return item->current | button2_item->current;
16381674            }
16391675         }
r5613r5614
16441680      }
16451681
16461682      /* steadykey for keyboards */
1647      if (steadykey_enabled && item->devclass == DEVICE_CLASS_KEYBOARD)
1683      if (state->steadykey_enabled && item->devclass == DEVICE_CLASS_KEYBOARD)
16481684         return item->steadykey;
16491685
16501686      /* everything else is just the current value as-is */
r5613r5614
16611697    absolute value
16621698-------------------------------------------------*/
16631699
1664static INT32 apply_deadzone_and_saturation(input_code code, INT32 result)
1700static INT32 apply_deadzone_and_saturation(running_machine *machine, input_code code, INT32 result)
16651701{
1702   input_private *state = machine->input_data;
16661703   int negative = FALSE;
16671704
16681705   /* ignore if not a joystick */
r5613r5614
16771714   }
16781715
16791716   /* if in the deadzone, return 0 */
1680   if (result < joystick_deadzone)
1717   if (result < state->joystick_deadzone)
16811718      result = 0;
16821719
16831720   /* if saturated, return the max */
1684   else if (result > joystick_saturation)
1721   else if (result > state->joystick_saturation)
16851722      result = INPUT_ABSOLUTE_MAX;
16861723
16871724   /* otherwise, scale */
16881725   else
1689      result = (INT64)(result - joystick_deadzone) * (INT64)INPUT_ABSOLUTE_MAX / (INT64)(joystick_saturation - joystick_deadzone);
1726      result = (INT64)(result - state->joystick_deadzone) * (INT64)INPUT_ABSOLUTE_MAX / (INT64)(state->joystick_saturation - state->joystick_deadzone);
16901727
16911728   /* apply sign and return */
16921729   return negative ? -result : result;
src/emu/input.h
r5613r5614
584584void input_init(running_machine *machine);
585585
586586/* enable or disable a device class */
587void input_device_class_enable(input_device_class devclass, UINT8 enable);
587void input_device_class_enable(running_machine *machine, input_device_class devclass, UINT8 enable);
588588
589589/* is a device class enabled? */
590UINT8 input_device_class_enabled(input_device_class devclass);
590UINT8 input_device_class_enabled(running_machine *machine, input_device_class devclass);
591591
592592/* configure default joystick maps */
593int input_device_set_joystick_map(int devindex, const char *mapstring);
593int input_device_set_joystick_map(running_machine *machine, int devindex, const char *mapstring);
594594
595595
596596/* ----- OSD configuration and access ----- */
r5613r5614
606606/* ----- state queries ----- */
607607
608608/* return the value of a particular input code */
609INT32 input_code_value(input_code code);
609INT32 input_code_value(running_machine *machine, input_code code);
610610
611611/* return TRUE if the given input code has been pressed */
612INT32 input_code_pressed(input_code code);
612INT32 input_code_pressed(running_machine *machine, input_code code);
613613
614614/* same as above, but returns TRUE only on the first call after an off->on transition */
615INT32 input_code_pressed_once(input_code code);
615INT32 input_code_pressed_once(running_machine *machine, input_code code);
616616
617617/* translates an input_item_id to an input_code */
618input_code input_code_from_input_item_id(input_item_id itemid);
618input_code input_code_from_input_item_id(running_machine *machine, input_item_id itemid);
619619
620620/* poll for any switch input, optionally resetting internal memory */
621input_code input_code_poll_switches(int reset);
621input_code input_code_poll_switches(running_machine *machine, int reset);
622622
623623/* poll for any keyboard switch input, optionally resetting internal memory */
624input_code input_code_poll_keyboard_switches(int reset);
624input_code input_code_poll_keyboard_switches(running_machine *machine, int reset);
625625
626626/* poll for any axis input, optionally resetting internal memory */
627input_code input_code_poll_axes(int reset);
627input_code input_code_poll_axes(running_machine *machine, int reset);
628628
629629
630630
631631/* ----- strings and tokenization ----- */
632632
633633/* generate the friendly name of an input code, returning the length (buffer can be NULL) */
634astring *input_code_name(astring *buffer, input_code code);
634astring *input_code_name(running_machine *machine, astring *buffer, input_code code);
635635
636636/* convert an input code to a token, returning the length (buffer can be NULL) */
637astring *input_code_to_token(astring *buffer, input_code code);
637astring *input_code_to_token(running_machine *machine, astring *buffer, input_code code);
638638
639639/* convert a token back to an input code */
640input_code input_code_from_token(const char *_token);
640input_code input_code_from_token(running_machine *machine, const char *_token);
641641
642642
643643#endif   /* __INPUT_H__ */
src/emu/fileio.c
r5613r5614
3838    TYPE DEFINITIONS
3939***************************************************************************/
4040
41typedef struct _path_iterator path_iterator;
42struct _path_iterator
43{
44   const char *   base;
45   const char *   cur;
46   int            index;
47};
48
49
4150/* typedef struct _mame_file mame_file -- declared in fileio.h */
4251struct _mame_file
4352{
r5613r5614
4655#endif
4756   astring *      filename;                  /* full filename */
4857   core_file *      file;                     /* core file pointer */
58   path_iterator    iterator;                  /* iterator for paths */
4959   UINT32         openflags;                  /* flags we used for the open */
5060   char         hash[HASH_BUF_SIZE];         /* hash data for the file */
5161   zip_file *      zipfile;                  /* ZIP file pointer */
r5613r5614
5464};
5565
5666
57typedef struct _path_iterator path_iterator;
58struct _path_iterator
59{
60   const char *   base;
61   const char *   cur;
62   int            index;
63};
64
65
6667/* typedef struct _mame_path mame_path -- declared in fileio.h */
6768struct _mame_path
6869{
r5613r5614
8283static void fileio_exit(running_machine *machine);
8384
8485/* file open/close */
85static file_error fopen_internal(core_options *opts, const char *searchpath, const char *filename, UINT32 crc, UINT32 flags, mame_file **file);
86static file_error fopen_internal(core_options *opts, path_iterator *iterator, const char *filename, UINT32 crc, UINT32 flags, mame_file **file);
8687static file_error fopen_attempt_zipped(astring *fullname, UINT32 crc, UINT32 openflags, mame_file *file);
8788
8889/* path iteration */
r5613r5614
134135
135136file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, mame_file **file)
136137{
137   return fopen_internal(mame_options(), searchpath, filename, 0, openflags, file);
138   path_iterator iterator;
139   path_iterator_init(&iterator, mame_options(), searchpath);
140   return fopen_internal(mame_options(), &iterator, filename, 0, openflags, file);
138141}
139142
140143
r5613r5614
145148
146149file_error mame_fopen_crc(const char *searchpath, const char *filename, UINT32 crc, UINT32 openflags, mame_file **file)
147150{
151   path_iterator iterator;
152   path_iterator_init(&iterator, mame_options(), searchpath);
148153   return mame_fopen_crc_options(mame_options(), searchpath, filename, crc, openflags, file);
149154}
150155
r5613r5614
156161
157162file_error mame_fopen_options(core_options *opts, const char *searchpath, const char *filename, UINT32 openflags, mame_file **file)
158163{
159   return fopen_internal(opts, searchpath, filename, 0, openflags, file);
164   path_iterator iterator;
165   path_iterator_init(&iterator, opts, searchpath);
166   return fopen_internal(opts, &iterator, filename, 0, openflags, file);
160167}
161168
162169
r5613r5614
167174
168175file_error mame_fopen_crc_options(core_options *opts, const char *searchpath, const char *filename, UINT32 crc, UINT32 openflags, mame_file **file)
169176{
170   return fopen_internal(opts, searchpath, filename, crc, openflags | OPEN_FLAG_HAS_CRC, file);
177   path_iterator iterator;
178   path_iterator_init(&iterator, opts, searchpath);
179   return fopen_internal(opts, &iterator, filename, crc, openflags | OPEN_FLAG_HAS_CRC, file);
171180}
172181
173182
r5613r5614
212221    fopen_internal - open a file
213222-------------------------------------------------*/
214223
215static file_error fopen_internal(core_options *opts, const char *searchpath, const char *filename, UINT32 crc, UINT32 openflags, mame_file **file)
224static file_error fopen_internal(core_options *opts, path_iterator *iterator, const char *filename, UINT32 crc, UINT32 openflags, mame_file **file)
216225{
217226   file_error filerr = FILERR_NOT_FOUND;
218   path_iterator iterator;
219227
220228   /* can either have a hash or open for write, but not both */
221229   if ((openflags & OPEN_FLAG_HAS_CRC) && (openflags & OPEN_FLAG_WRITE))
r5613r5614
233241   (*file)->debug_cookie = DEBUG_COOKIE;
234242#endif
235243
236   /* if the path is absolute, null out the search path */
237   if (searchpath != NULL && osd_is_absolute_path(searchpath))
238      searchpath = NULL;
239
240   /* determine the maximum length of a composed filename, plus some extra space for .zip extensions */
241   path_iterator_init(&iterator, opts, searchpath);
242
243244   /* loop over paths */
244245   (*file)->filename = astring_alloc();
245   while (path_iterator_get_next(&iterator, (*file)->filename))
246   while (path_iterator_get_next(iterator, (*file)->filename))
246247   {
247248      /* compute the full pathname */
248249      if (astring_len((*file)->filename) > 0)
r5613r5614
263264      }
264265   }
265266
267   /* if we succeeded, save the iterator */
268   if (filerr == FILERR_NONE)
269      (*file)->iterator = *iterator;
270
266271   /* handle errors and return */
267   if (filerr != FILERR_NONE)
272   else
268273   {
269274      mame_fclose(*file);
270275      *file = NULL;
r5613r5614
389394
390395
391396/*-------------------------------------------------
397    mame_fclose_and_open_next - close an open
398    file, and open the next entry in the original
399    searchpath
400-------------------------------------------------*/
401
402file_error mame_fclose_and_open_next(mame_file **file, const char *filename, UINT32 openflags)
403{
404   path_iterator iterator = (*file)->iterator;
405   mame_fclose(*file);
406   *file = NULL;
407   return fopen_internal(mame_options(), &iterator, filename, 0, openflags, file);
408}
409
410
411/*-------------------------------------------------
392412    mame_fcompress - enable/disable streaming file
393413    compression via zlib; level is 0 to disable
394414    compression, or up to 9 for max compression
r5613r5614
803823{
804824   /* reset the structure */
805825   memset(iterator, 0, sizeof(*iterator));
806   iterator->base = (searchpath != NULL) ? options_get_string(opts, searchpath) : "";
826   iterator->base = (searchpath != NULL && !osd_is_absolute_path(searchpath)) ? options_get_string(opts, searchpath) : "";
807827   iterator->cur = iterator->base;
808828}
809829
src/emu/fileio.h
r5613r5614
9999/* close an open file */
100100void mame_fclose(mame_file *file);
101101
102/* close an open file, and open the next entry in the original searchpath*/
103file_error mame_fclose_and_open_next(mame_file **file, const char *filename, UINT32 openflags);
104
102105/* enable/disable streaming file compression via zlib; level is 0 to disable compression, or up to 9 for max compression */
103106file_error mame_fcompress(mame_file *file, int compress);
104107
src/emu/cheat.c
r5613r5614
7777#include "xmlfile.h"
7878#include "ui.h"
7979#include "uimenu.h"
80#include "cheat.h"
8081#include "debug/debugcpu.h"
8182#include "debug/express.h"
8283
r5613r5614
9293    CONSTANTS
9394***************************************************************************/
9495
96/* turn this on to enable removing duplicate cheats; not sure if we should */
97#define REMOVE_DUPLICATE_CHEATS   0
98
9599#define CHEAT_VERSION         1
96100
97101#define DEFAULT_TEMP_VARIABLES   10
r5613r5614
378382   cheatinfo = auto_alloc_clear(machine, cheat_private);
379383   machine->cheat_data = cheatinfo;
380384
385   /* load the cheats */
386   cheat_reload(machine);
387
388   /* we rely on the debugger expression callbacks; if the debugger isn't
389       enabled, we must jumpstart them manually */
390   if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0)
391      debug_cpu_init(machine);
392}
393
394
395/*-------------------------------------------------
396    cheat_reload - re-initialize the cheat engine,
397    and reload the cheat file(s)
398-------------------------------------------------*/
399
400void cheat_reload(running_machine *machine)
401{
402   cheat_private *cheatinfo = machine->cheat_data;
403
404   /* free everything */
405   cheat_exit(machine);
406
407   /* reset our memory */
408   memset(cheatinfo, 0, sizeof(*cheatinfo));
409
381410   /* load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml )
382411       and MAME will load gamename.xml */
383412   #ifdef MESS
r5613r5614
394423   /* temporary: save the file back out as output.xml for comparison */
395424   if (cheatinfo->cheatlist != NULL)
396425      cheat_list_save("output", cheatinfo->cheatlist);
397
398   /* we rely on the debugger expression callbacks; if the debugger isn't
399       enabled, we must jumpstart them manually */
400   if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0)
401      debug_cpu_init(machine);
402426}
403427
404428
r5613r5614
791815}
792816
793817
818/*-------------------------------------------------
819    cheat_get_comment - called by the UI system
820    to help render displayable comments
821-------------------------------------------------*/
794822
823astring *cheat_get_comment(void *entry)
824{
825   cheat_entry *cheat = (cheat_entry *)entry;
826   return cheat->comment;
827}
828
829
830
795831/***************************************************************************
796832    CHEAT EXECUTION
797833***************************************************************************/
r5613r5614
926962
927963static cheat_entry *cheat_list_load(running_machine *machine, const char *filename)
928964{
929   xml_data_node *rootnode, *mamecheatnode, *cheatnode;
965   xml_data_node *rootnode = NULL;
930966   cheat_entry *cheatlist = NULL;
931   cheat_entry **cheattailptr;
932   xml_parse_options options;
933   xml_parse_error error;
934   mame_file *cheatfile;
967   cheat_entry **cheattailptr = &cheatlist;
968   mame_file *cheatfile = NULL;
935969   file_error filerr;
936970   astring *fname;
937   int version;
938971
939972   /* open the file with the proper name */
940973   fname = astring_assemble_2(astring_alloc(), filename, ".xml");
941974   filerr = mame_fopen(SEARCHPATH_CHEAT, astring_c(fname), OPEN_FLAG_READ, &cheatfile);
942   astring_free(fname);
943975
944   /* if that failed, return nothing */
945   if (filerr != FILERR_NONE)
946      return NULL;
976   /* loop over all instrances of the files found in our search paths */
977   while (filerr == FILERR_NONE)
978   {
979      xml_data_node *mamecheatnode, *cheatnode;
980      xml_parse_options options;
981      xml_parse_error error;
982      cheat_entry *scannode;
983      int version;
947984
948   /* read the XML file into internal data structures */
949   memset(&options, 0, sizeof(options));
950   options.error = &error;
951   rootnode = xml_file_read(mame_core_file(cheatfile), &options);
952   mame_fclose(cheatfile);
985      mame_printf_verbose("Loading cheats file from %s\n", mame_file_full_name(cheatfile));
953986
954   /* if unable to parse the file, just bail */
955   if (rootnode == NULL)
956   {
957      mame_printf_error("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);
958      return NULL;
959   }
987      /* read the XML file into internal data structures */
988      memset(&options, 0, sizeof(options));
989      options.error = &error;
990      rootnode = xml_file_read(mame_core_file(cheatfile), &options);
960991
961   /* find the layout node */
962   mamecheatnode = xml_get_sibling(rootnode->child, "mamecheat");
963   if (mamecheatnode == NULL)
964   {
965      mame_printf_error("%s.xml: missing mamecheatnode node", filename);
966      goto error;
967   }
992      /* if unable to parse the file, just bail */
993      if (rootnode == NULL)
994      {
995         mame_printf_error("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);
996         goto error;
997      }
968998
969   /* validate the config data version */
970   version = xml_get_attribute_int(mamecheatnode, "version", 0);
971   if (version != CHEAT_VERSION)
972   {
973      mame_printf_error("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);
974      goto error;
975   }
999      /* find the layout node */
1000      mamecheatnode = xml_get_sibling(rootnode->child, "mamecheat");
1001      if (mamecheatnode == NULL)
1002      {
1003         mame_printf_error("%s.xml: missing mamecheatnode node", filename);
1004         goto error;
1005      }
9761006
977   /* parse all the elements */
978   cheatlist = NULL;
979   cheattailptr = &cheatlist;
980   for (cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
981   {
982      /* load this entry */
983      cheat_entry *curcheat = cheat_entry_load(machine, filename, cheatnode);
984      if (curcheat == NULL)
1007      /* validate the config data version */
1008      version = xml_get_attribute_int(mamecheatnode, "version", 0);
1009      if (version != CHEAT_VERSION)
1010      {
1011         mame_printf_error("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);
9851012         goto error;
1013      }
9861014
987      /* add to the end of the list */
988      *cheattailptr = curcheat;
989      cheattailptr = &curcheat->next;
1015      /* parse all the elements */
1016      for (cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
1017      {
1018         /* load this entry */
1019         cheat_entry *curcheat = cheat_entry_load(machine, filename, cheatnode);
1020         if (curcheat == NULL)
1021            goto error;
1022
1023         /* make sure we're not a duplicate */
1024         scannode = NULL;
1025         if (REMOVE_DUPLICATE_CHEATS)
1026            for (scannode = cheatlist; scannode != NULL; scannode = scannode->next)
1027               if (astring_cmp(scannode->description, curcheat->description) == 0)
1028               {
1029                  mame_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", astring_c(curcheat->description), mame_file_full_name(cheatfile));
1030                  break;
1031               }
1032
1033         /* add to the end of the list */
1034         if (scannode == NULL)
1035         {
1036            *cheattailptr = curcheat;
1037            cheattailptr = &curcheat->next;
1038         }
1039      }
1040
1041      /* free the file and loop for the next one */
1042      xml_file_free(rootnode);
1043
1044      /* open the next file in sequence */
1045      filerr = mame_fclose_and_open_next(&cheatfile, astring_c(fname), OPEN_FLAG_READ);
9901046   }
9911047
992   /* free the file and exit */
993   xml_file_free(rootnode);
1048   /* release memory and return the cheat list */
1049   astring_free(fname);
9941050   return cheatlist;
9951051
9961052error:
9971053   cheat_list_free(cheatlist);
9981054   xml_file_free(rootnode);
1055   if (cheatfile != NULL)
1056      mame_fclose(cheatfile);
1057   astring_free(fname);
9991058   return NULL;
10001059}
10011060
src/emu/validity.c
r5613r5614
16481648
16491649   init_resource_tracking();
16501650   begin_resource_tracking();
1651   osd_profiling_ticks();
1651   get_profile_ticks();
16521652
16531653   /* prepare by pre-scanning all the drivers and adding their info to hash tables */
1654   prep -= osd_profiling_ticks();
1654   prep -= get_profile_ticks();
16551655   quark_tables_create(&tables);
1656   prep += osd_profiling_ticks();
1656   prep += get_profile_ticks();
16571657
16581658   /* iterate over all drivers */
16591659   for (drivnum = 0; drivers[drivnum]; drivnum++)
r5613r5614
16701670      memset(&rgninfo, 0, sizeof(rgninfo));
16711671
16721672      /* expand the machine driver */
1673      expansion -= osd_profiling_ticks();
1673      expansion -= get_profile_ticks();
16741674      config = machine_config_alloc(driver->machine_config);
1675      expansion += osd_profiling_ticks();
1675      expansion += get_profile_ticks();
16761676
16771677      /* validate the driver entry */
1678      driver_checks -= osd_profiling_ticks();
1678      driver_checks -= get_profile_ticks();
16791679      error = validate_driver(drivnum, config, &tables) || error;
1680      driver_checks += osd_profiling_ticks();
1680      driver_checks += get_profile_ticks();
16811681
16821682      /* validate the ROM information */
1683      rom_checks -= osd_profiling_ticks();
1683      rom_checks -= get_profile_ticks();
16841684      error = validate_roms(drivnum, config, &rgninfo) || error;
1685      rom_checks += osd_profiling_ticks();
1685      rom_checks += get_profile_ticks();
16861686
16871687      /* validate input ports */
1688      input_checks -= osd_profiling_ticks();
1688      input_checks -= get_profile_ticks();
16891689      error = validate_inputs(drivnum, config, tables.defstr, &portlist) || error;
1690      input_checks += osd_profiling_ticks();
1690      input_checks += get_profile_ticks();
16911691
16921692      /* validate the CPU information */
1693      cpu_checks -= osd_profiling_ticks();
1693      cpu_checks -= get_profile_ticks();
16941694      error = validate_cpu(drivnum, config) || error;
1695      cpu_checks += osd_profiling_ticks();
1695      cpu_checks += get_profile_ticks();
16961696
16971697      /* validate the display */
1698      display_checks -= osd_profiling_ticks();
1698      display_checks -= get_profile_ticks();
16991699      error = validate_display(drivnum, config) || error;
1700      display_checks += osd_profiling_ticks();
1700      display_checks += get_profile_ticks();
17011701
17021702      /* validate the graphics decoding */
1703      gfx_checks -= osd_profiling_ticks();
1703      gfx_checks -= get_profile_ticks();
17041704      error = validate_gfx(drivnum, config, &rgninfo) || error;
1705      gfx_checks += osd_profiling_ticks();
1705      gfx_checks += get_profile_ticks();
17061706
17071707      /* validate sounds and speakers */
1708      sound_checks -= osd_profiling_ticks();
1708      sound_checks -= get_profile_ticks();
17091709      error = validate_sound(drivnum, config) || error;
1710      sound_checks += osd_profiling_ticks();
1710      sound_checks += get_profile_ticks();
17111711
17121712      /* validate devices */
1713      device_checks -= osd_profiling_ticks();
1713      device_checks -= get_profile_ticks();
17141714      error = validate_devices(drivnum, config, portlist, &rgninfo) || error;
1715      device_checks += osd_profiling_ticks();
1715      device_checks += get_profile_ticks();
17161716
17171717      for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo.entries); rgnnum++)
17181718         if (rgninfo.entries[rgnnum].tag != NULL)
r5613r5614
17231723   }
17241724
17251725#ifdef MESS
1726   mess_checks -= osd_profiling_ticks();
1726   mess_checks -= get_profile_ticks();
17271727   if (mess_validitychecks())
17281728      error = TRUE;
1729   mess_checks += osd_profiling_ticks();
1729   mess_checks += get_profile_ticks();
17301730#endif /* MESS */
17311731
17321732#if (REPORT_TIMES)
src/emu/cheat.h
r5613r5614
2828/* initialize the cheat system, loading any cheat files */
2929void cheat_init(running_machine *machine);
3030
31/* re-initialize the cheat system, reloading any cheat files */
32void cheat_reload(running_machine *machine);
3133
3234
35
3336/* ----- cheat UI helpers ----- */
3437
3538/* render any text overlays */
r5613r5614
5053/* select the next menu state */
5154int cheat_select_next_state(running_machine *machine, void *entry);
5255
56/* return the displayable comment of the current cheat */
57astring *cheat_get_comment(void *entry);
5358
59
5460#endif   /* __CHEAT_H__ */
src/mess/uimess.c
r5613r5614
125125   {
126126      /* identify this keycode */
127127      itemid = non_char_keys[i];
128      code = input_code_from_input_item_id(itemid);
128      code = input_code_from_input_item_id(machine, itemid);
129129
130130      /* ...and determine if it is pressed */
131      pressed = input_code_pressed(code);
131      pressed = input_code_pressed(machine, code);
132132
133133      /* figure out whey we are in the key_down map */
134134      key_down_ptr = &machine->ui_mess_data->non_char_keys_down[i / 8];
src/mess/machine/dgn_beta.c
r5613r5614
8888
8989
9090/* Debugging commands and handlers. */
91static offs_t dgnbeta_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
91static CPU_DISASSEMBLE(dgnbeta_dasm_override);
9292static void execute_beta_dat_log(running_machine *machine, int ref, int params, const char *param[]);
9393static void execute_beta_key_dump(running_machine *machine, int ref, int params, const char *param[]);
9494
r5613r5614
11201120{
11211121   dgnbeta_init_video(machine);
11221122
1123   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), dgnbeta_dasm_override);
1123   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), CPU_DISASSEMBLE_NAME(dgnbeta_dasm_override));
11241124
11251125   add_reset_callback(machine, dgnbeta_reset);
11261126   dgnbeta_reset(machine);
r5613r5614
12901290};
12911291
12921292
1293static offs_t dgnbeta_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
1293static CPU_DISASSEMBLE(dgnbeta_dasm_override)
12941294{
12951295   unsigned call;
12961296   unsigned result = 0;
src/mess/machine/coco.c
r5613r5614
207207
208208#define GIME_TYPE_1987   0
209209
210static offs_t coco_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
210static CPU_DISASSEMBLE(coco_dasm_override);
211211
212212
213213/* ----------------------------------------------------------------------- */
r5613r5614
28932893   /* setup printer output callback */
28942894   printer_out = init->printer_out_;
28952895
2896   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), coco_dasm_override);
2896   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), CPU_DISASSEMBLE_NAME(coco_dasm_override));
28972897
28982898   state_save_register_global(machine, mux_sel1);
28992899   state_save_register_global(machine, mux_sel2);
r5613r5614
32173217};
32183218
32193219
3220static offs_t coco_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
3220static CPU_DISASSEMBLE(coco_dasm_override)
32213221{
32223222   unsigned call;
32233223   unsigned result = 0;
32243224
3225   /* check for SWI2 instruction */
32253226   if ((oprom[0] == 0x10) && (oprom[1] == 0x3F))
32263227   {
32273228      call = oprom[2];
src/mess/machine/mac.c
r5613r5614
130130static WRITE8_DEVICE_HANDLER(mac_via2_out_b);
131131static void mac_via_irq(const device_config *device, int state);
132132static void mac_via2_irq(const device_config *device, int state);
133static offs_t mac_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
133static CPU_DISASSEMBLE(mac_dasm_override);
134134
135135const via6522_interface mac_via6522_intf =
136136{
r5613r5614
19691969
19701970   inquiry_timeout = timer_alloc(machine, inquiry_timeout_func, NULL);
19711971
1972   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), mac_dasm_override);
1972   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), CPU_DISASSEMBLE_NAME(mac_dasm_override));
19731973
19741974   /* save state stuff */
19751975   state_save_register_global(machine, mac_overlay);
r5613r5614
29252925
29262926
29272927
2928static offs_t mac_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
2928static CPU_DISASSEMBLE(mac_dasm_override)
29292929{
29302930   UINT16 opcode;
29312931   unsigned result = 0;
src/mess/inputx.c
r5613r5614
406406   given code; used for logging and debugging
407407-------------------------------------------------*/
408408
409static const char *code_point_string(unicode_char ch)
409static const char *code_point_string(running_machine *machine, unicode_char ch)
410410{
411411   static char buf[16];
412412   const char *result = buf;
r5613r5614
430430         {
431431            /* try to obtain a codename with input_code_name(); this can result in an empty string */
432432            astring *astr = astring_alloc();
433            input_code_name(astr, (input_code) ch - UCHAR_MAMEKEY_BEGIN);
433            input_code_name(machine, astr, (input_code) ch - UCHAR_MAMEKEY_BEGIN);
434434            snprintf(buf, ARRAY_LENGTH(buf), "%s", astring_c(astr));
435435            astring_free(astr);
436436         }
r5613r5614
472472   sets up natural keyboard input mapping
473473-------------------------------------------------*/
474474
475static int scan_keys(const input_port_config *portconfig, mess_input_code *codes, input_port_config_c *ports, input_field_config_c *shift_ports, int keys, int shift)
475static int scan_keys(running_machine *machine, const input_port_config *portconfig, mess_input_code *codes, input_port_config_c *ports, input_field_config_c *shift_ports, int keys, int shift)
476476{
477477   int code_count = 0;
478478   const input_port_config *port;
r5613r5614
494494               if ((code >= UCHAR_SHIFT_BEGIN) && (code <= UCHAR_SHIFT_END))
495495               {
496496                  shift_ports[keys] = field;
497                  code_count += scan_keys(portconfig,
497                  code_count += scan_keys(machine,
498                     portconfig,
498499                     codes ? &codes[code_count] : NULL,
499500                     ports,
500501                     shift_ports,
r5613r5614
516517                  code_count++;
517518
518519                  if (LOG_INPUTX)
519                     logerror("inputx: code=%i (%s) port=%p field->name='%s'\n", (int) code, code_point_string(code), port, field->name);
520                     logerror("inputx: code=%i (%s) port=%p field->name='%s'\n", (int) code, code_point_string(machine, code), port, field->name);
520521               }
521522            }
522523         }
r5613r5614
541542   int code_count;
542543
543544   /* first count the number of codes */
544   code_count = scan_keys(portconfig, NULL, ports, fields, 0, 0);
545   code_count = scan_keys(machine, portconfig, NULL, ports, fields, 0, 0);
545546   if (code_count > 0)
546547   {
547548      /* allocate the codes */
548549      codes = auto_alloc_array_clear(machine, mess_input_code, code_count + 1);
549550   
550551      /* and populate them */
551      scan_keys(portconfig, codes, ports, fields, 0, 0);
552      scan_keys(machine, portconfig, codes, ports, fields, 0, 0);
552553   }
553554   return codes;
554555}
r5613r5614
856857            if (LOG_INPUTX)
857858            {
858859               code = find_code(ch);
859               logerror("inputx_postn(): code=%i (%s) field->name='%s'\n", (int) ch, code_point_string(ch), (code && code->field[0]) ? code->field[0]->name : "<null>");
860               logerror("inputx_postn(): code=%i (%s) field->name='%s'\n", (int) ch, code_point_string(machine, ch), (code && code->field[0]) ? code->field[0]->name : "<null>");
860861            }
861862
862863            if (can_post_key_directly(ch))
r5613r5614
15541555         /* describe the character code */
15551556         pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%08X (%s) ",
15561557            code->ch,
1557            code_point_string(code->ch));
1558            code_point_string(machine, code->ch));
15581559
15591560         /* pad with spaces */
15601561         while(pos < left_column_width)
src/mess/osd/windows/dialog.c
r5613r5614
10711071
10721072   // retrieve the seq name
10731073   seqstring = astring_alloc();
1074   input_seq_name(seqstring, stuff->code);
1074   input_seq_name(Machine, seqstring, stuff->code);
10751075
10761076   // change the text - avoid calls to SetWindowText() if we can
10771077   win_get_window_text_utf8(editwnd, buffer, ARRAY_LENGTH(buffer));
r5613r5614
11321132   win_window_list = &fake_window_info;
11331133
11341134   // start the polling
1135   input_seq_poll_start(stuff->is_analog ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, NULL);
1135   input_seq_poll_start(Machine, stuff->is_analog ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, NULL);
11361136
11371137   while(stuff->poll_state == SEQSELECT_STATE_POLLING)
11381138   {
11391139      // poll
1140      /*ret = */input_seq_poll(stuff->code);
1140      /*ret = */input_seq_poll(Machine, stuff->code);
11411141      seqselect_settext(editwnd);
11421142   }
11431143
src/mess/drivers/palm.c
r5613r5614
1616#include "debugger.h"
1717
1818
19static offs_t palm_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
19static CPU_DISASSEMBLE(palm_dasm_override);
2020
2121static UINT8 port_f_latch;
2222static UINT16 spim_data;
r5613r5614
137137
138138static DRIVER_INIT( palm )
139139{
140    debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), palm_dasm_override);
140    debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), CPU_DISASSEMBLE_NAME(palm_dasm_override));
141141}
142142
143143static const mc68328_interface palm_dragonball_iface =
r5613r5614
16391639    return NULL;
16401640}
16411641
1642static offs_t palm_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
1642static CPU_DISASSEMBLE(palm_dasm_override)
16431643{
16441644    UINT16 opcode;
16451645    unsigned result = 0;
docs/messnew.txt
r5613r5614
7777
7878Source Changes:
7979----------------
80- The core is based on MAME 0.133u4.  This incorporates all features of the
80- The core is based on MAME 0.133u5.  This incorporates all features of the
8181  update to this core.  [MAME team]
8282
8383

Previous 15994 Revisions Next


© 1998-2018 The MESS Team