Previous 15994 Revisions Next

r5956 Sunday 4th October, 2009 at 12:04:16 UTC by Nathan Woods
Updated to MAME 0.134u2 core
[docs]messnew.txt
[src/emu]devtempl.h drawgfx.h driver.h inptport.h input.c mame.c mconfig.h memory.c memory.h profiler.c profiler.h ui.c ui.h uigfx.c uimenu.c
[src/emu/cpu/arm]arm.h armdasm.c
[src/emu/cpu/arm7]arm7core.h arm7dasm.c
[src/emu/cpu/dsp56k]dsp56k.c dsp56ops.c dsp56pcu.c
[src/emu/cpu/h83002]h8_16.c h8_8.c
[src/emu/cpu/i960]i960.c i960dis.c i960dis.h
[src/emu/cpu/m68000]m68000.h m68k_in.c m68kcpu.c m68kcpu.h m68kdasm.c m68kmake.c
[src/emu/cpu/sh2]sh2.h sh2comn.c sh2comn.h sh2dasm.c
[src/emu/cpu/sh4]sh4.h sh4dasm.c
[src/emu/cpu/v60]v60.h v60d.c
[src/emu/cpu/z180]z180.h z180ops.h
[src/emu/debug]debugcmd.c debugcon.c debugcon.h debugcpu.c express.c express.h
[src/emu/machine]laserdsc.h
[src/emu/sound]disc_dev.c disc_inp.c disc_mth.c disc_sys.c disc_wav.c discrete.c discrete.h tms5220.c
[src/mame]mame.mak mamedriv.c tiny.c
[src/mame/audio]dkong.c firetrk.c galaxian.c m79amb.c madalien.c mario.c mw8080bw.c polepos.c redbaron.c scramble.c skyraid.c snes.c snk6502.c sprint8.c* starshp1.c taito_en.c taito_en.h tank8.c
[src/mame/drivers]39in1.c aristmk5.c asuka.c bublbobl.c cloud9.c cps1.c galaxold.c galdrvr.c galpanic.c gottlieb.c jangou.c konamim2.c ksys573.c kyugo.c leland.c lucky74.c megadriv.c megadriv.h megaplay.c megatech.c midtunit.c mpu4.c mpu4drvr.c multfish.c mw8080bw.c namcoic.c namcona1.c namconb1.c namcos22.c naomi.c othello.c* photon2.c plygonet.c rallyx.c segae.c segag80r.c segamsys.c* segamsys.h* seicross.c seta.c sfbonus.c skyraid.c snk.c snowbros.c sprint8.c suprnova.c targeth.c timeplt.c twin16.c twinkle.c warpwarp.c zaccaria.c zaxxon.c
[src/mame/includes]archimds.h balsente.h bublbobl.h bzone.h cloud9.h cps1.h dkong.h galaxold.h kaneko16.h kyugo.h mcr.h mw8080bw.h namcoic.h namcona1.h namconb1.h namcos2.h namcos22.h segas24.h snes.h snk.h sprint8.h system16.h taito_f2.h
[src/mame/machine]archimds.c balsente.c bublbobl.c cx4data.c cx4fn.c cx4oam.c cx4ops.c galaxold.c namcos2.c scramble.c segas24.c snescx4.c snescx4.h snesdsp3.c snesdsp4.c snesdsp4.h snesst10.c system16.c
[src/mame/video]cps1.c dkong.c galaxold.c galpani2.c genesis.c lucky74.c mcr3.c plygonet.c segasyse.c system16.c taito_f2.c
[src/mess]filemngr.c
[src/mess/devices]cassette.c
[src/mess/drivers]a310.c oric.c
[src/osd/windows]vconv.c
[src/tools]srcclean.c

src/mame/audio/galaxian.c
r5955r5956
268268   /* Pitch */
269269   DISCRETE_INPUT_DATA(GAL_INP_PITCH)
270270
271   DISCRETE_TASK_START(0)
272
273       /************************************************/
274      /* NOISE                                        */
275      /************************************************/
276
277       /* since only a sample of the LFSR is latched @V2 we let the lfsr
278         * run at a lower speed
279         */
280       DISCRETE_LFSR_NOISE(NODE_150, 1, 1, RNG_RATE/100, 1.0, 0, 0.5, &galaxian_lfsr)
281      DISCRETE_SQUAREWFIX(NODE_151,1,60*264/2,1.0,50,0.5,0)  /* 2V signal */
282      DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,NODE_151,NODE_150)
283   DISCRETE_TASK_END()
284
271285   /* Group Background and pitch */
272   DISCRETE_TASK_START()
286   DISCRETE_TASK_START(1)
273287
274288      /************************************************/
275289      /* Background                                   */
r5955r5956
280294      // Next is mult/add opamp circuit
281295      DISCRETE_MULTADD(NODE_110, NODE_105, GAL_R33/RES_3_PARALLEL(GAL_R31,GAL_R32,GAL_R33),
282296            -5.0*GAL_R33/GAL_R31)
283      DISCRETE_CLAMP(NODE_111,1,NODE_110,0.0,5.0,0.0)
297      DISCRETE_CLAMP(NODE_111,NODE_110,0.0,5.0)
284298      // The three 555
285299      DISCRETE_555_ASTABLE_CV(NODE_115, GAL_INP_FS1, GAL_R22, GAL_R23, GAL_C17, NODE_111, &galaxian_555_vco_desc)
286300      DISCRETE_555_ASTABLE_CV(NODE_116, GAL_INP_FS2, GAL_R25, GAL_R26, GAL_C18, NODE_111, &galaxian_555_vco_desc)
r5955r5956
310324    /* End of this task */
311325    DISCRETE_TASK_END()
312326
313    /* Group Hit and Fire */
327    DISCRETE_TASK_START(1)
314328
315    DISCRETE_TASK_START()
316
317329       /************************************************/
318330      /* HIT                                          */
319331      /************************************************/
320332
321       /* NOISE */
322       /* since only a sample of the LFSR is latched @V2 we let the lfsr
323         * run at a lower speed
324         */
325       DISCRETE_LFSR_NOISE(NODE_150, 1, 1, RNG_RATE/100, 1.0, 0, 0.5, &galaxian_lfsr)
326      DISCRETE_SQUAREWFIX(NODE_151,1,60*264/2,1.0,50,0.5,0)  /* 2V signal */
327      DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,NODE_151,NODE_150)
328
329
330333      /* Not 100% correct - switching causes high impedance input for node_157
331334         * this is not emulated */
332335      DISCRETE_RCDISC5(NODE_155, NODE_152, GAL_INP_HIT, (GAL_R35 + GAL_R36), GAL_C21)
333336      DISCRETE_OP_AMP_FILTER(NODE_157, 1, NODE_155, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &galaxian_bandpass_desc)
337   DISCRETE_TASK_END()
334338
339   DISCRETE_TASK_START(1)
335340      /************************************************/
336341      /* FIRE                                         */
337342      /************************************************/
r5955r5956
361366   /* FINAL MIX                                    */
362367   /************************************************/
363368
364   DISCRETE_MIXER5(NODE_279, 1, NODE_SUB(133,0), NODE_SUB(133,2), NODE_SUB(133,2), NODE_SUB(133,3), NODE_120, &galaxian_mixerpre_desc)
365   DISCRETE_MIXER3(NODE_280, 1, NODE_279, NODE_157, NODE_182, &galaxian_mixer_desc)
366   DISCRETE_OUTPUT(NODE_280, 32767.0/5.0*5)
369   DISCRETE_TASK_START(2)
370      DISCRETE_MIXER5(NODE_279, 1, NODE_SUB(133,0), NODE_SUB(133,2), NODE_SUB(133,2), NODE_SUB(133,3), NODE_120, &galaxian_mixerpre_desc)
371      DISCRETE_MIXER3(NODE_280, 1, NODE_279, NODE_157, NODE_182, &galaxian_mixer_desc)
372      DISCRETE_OUTPUT(NODE_280, 32767.0/5.0*5)
373   DISCRETE_TASK_END()
367374
368375DISCRETE_SOUND_END
369376
src/mame/audio/taito_en.c
r5955r5956
1717
1818enum { TIMER_SINGLESHOT, TIMER_PULSE };
1919
20READ16_HANDLER(f3_68000_share_r)
20static READ16_HANDLER(f3_68000_share_r)
2121{
2222   if ((offset&3)==0) return (f3_shared_ram[offset/4]&0xff000000)>>16;
2323   if ((offset&3)==1) return (f3_shared_ram[offset/4]&0x00ff0000)>>8;
r5955r5956
2525   return (f3_shared_ram[offset/4]&0x000000ff)<<8;
2626}
2727
28WRITE16_HANDLER(f3_68000_share_w)
28static WRITE16_HANDLER(f3_68000_share_w)
2929{
3030   if ((offset&3)==0) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0x00ffffff)|((data&0xff00)<<16);
3131   else if ((offset&3)==1) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xff00ffff)|((data&0xff00)<<8);
r5955r5956
3333   else f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xffffff00)|((data&0xff00)>>8);
3434}
3535
36WRITE16_HANDLER( f3_es5505_bank_w )
36static WRITE16_HANDLER( f3_es5505_bank_w )
3737{
3838   UINT32 max_banks_this_game=(memory_region_length(space->machine, "ensoniq.0")/0x200000)-1;
3939
r5955r5956
5050   es5505_voice_bank_w(devtag_get_device(space->machine, "ensoniq"),offset,data<<20);
5151}
5252
53WRITE16_HANDLER( f3_volume_w )
53static WRITE16_HANDLER( f3_volume_w )
5454{
5555   static UINT16 channel[8],last_l,last_r;
5656   static int latch;
r5955r5956
8484   timer_68681 = timer_alloc(machine, taito_en_timer_callback, NULL);
8585}
8686
87READ16_HANDLER(f3_68681_r)
87static READ16_HANDLER(f3_68681_r)
8888{
8989   if (offset == 0x05)
9090   {
r5955r5956
106106   return 0xff;
107107}
108108
109WRITE16_HANDLER(f3_68681_w)
109static WRITE16_HANDLER(f3_68681_w)
110110{
111111   switch (offset) {
112112      case 0x04: /* ACR */
r5955r5956
166166   }
167167}
168168
169READ16_HANDLER(es5510_dsp_r)
169static READ16_HANDLER(es5510_dsp_r)
170170{
171171//  logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(space->cpu),offset,es5510_dsp_ram[offset]);
172172//  if (es_tmp) return es5510_dsp_ram[offset];
r5955r5956
190190   return es5510_dsp_ram[offset];
191191}
192192
193WRITE16_HANDLER(es5510_dsp_w)
193static WRITE16_HANDLER(es5510_dsp_w)
194194{
195195   UINT8 *snd_mem = (UINT8 *)memory_region(space->machine, "ensoniq.0");
196196
src/mame/audio/firetrk.c
r5955r5956
6868}
6969
7070
71#define FIRETRUCK_HSYNC   15750.0
71#define FIRETRUCK_HSYNC   15750.0      /* not checked */
7272#define FIRETRUCK_1V   FIRETRUCK_HSYNC/2
7373#define FIRETRUCK_2V   FIRETRUCK_1V/2
7474#define FIRETRUCK_8V   FIRETRUCK_1V/8
src/mame/audio/taito_en.h
r5955r5956
11#include "cpu/m68000/m68000.h"
22#include "sound/es5506.h"
33
4READ16_HANDLER(f3_68000_share_r);
5WRITE16_HANDLER(f3_68000_share_w);
6READ16_HANDLER(f3_68681_r);
7WRITE16_HANDLER(f3_68681_w);
8READ16_HANDLER(es5510_dsp_r);
9WRITE16_HANDLER(es5510_dsp_w);
10WRITE16_HANDLER(f3_volume_w);
11WRITE16_HANDLER(f3_es5505_bank_w);
124void f3_68681_reset(running_machine *machine);
135
146void taito_f3_soundsystem_reset(running_machine *machine);
src/mame/audio/scramble.c
r5955r5956
9494   TTL7474_update(device->machine, 2);
9595}
9696
97#ifdef UNUSED_FUNCTION
9798WRITE8_HANDLER( froggrmc_sh_irqtrigger_w )
9899{
99100   /* the complement of bit 0 is connected to the flip-flop's clock */
100101   TTL7474_clock_w(2, ~data & 0x01);
101102   TTL7474_update(space->machine, 2);
102103}
104#endif
103105
104106static IRQ_CALLBACK(scramble_sh_irq_callback)
105107{
src/mame/audio/starshp1.c
r5955r5956
113113   {0}, {0}, 0, 0, 0, 0, 0, 1
114114};
115115
116static const discrete_566_desc starshp1_566_a9 =
117{
118   DISC_566_OUT_TRIANGLE,
119   5,         /* B+ */
120   -10,      /* B- */
121   NODE_41      /* charge voltage */
122};
123
124116static const discrete_mixer_desc starshp1_555_b10_mix_r =
125117{
126118   DISC_MIXER_IS_RESISTOR,
r5955r5956
252244                  STARSHP1_MOTOR_SPEED,      /* IC A9, pin 5 */
253245                  RES_2_PARALLEL(STARSHP1_R54, STARSHP1_R55),
254246                  STARSHP1_C34,
255                  &starshp1_566_a9)
247                  5, -10, NODE_41,         /* VPOS,VNEG,VCHARGE */
248                  DISC_566_OUT_TRIANGLE)
256249   DISCRETE_MULTIPLY(   STARSHP1_MOTOR_SND,
257250                  NODE_42,
258251                  STARSHP1_MOLVL_GAIN)
src/mame/audio/m79amb.c
r5955r5956
111111#define M79AMB_C41      CAP_U(0.1)
112112#define M79AMB_C42      CAP_U(15)
113113
114static const discrete_566_desc m79amb_566_desc = {DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE, 12, 0, DEFAULT_566_CHARGE};
115114
116115static const discrete_mixer_desc m79amb_final_mix =
117116{
r5955r5956
230229   DISCRETE_TRANSFORM4(NODE_51, 12.0 / M79AMB_R36, NODE_50, M79AMB_R37, RES_3_PARALLEL(M79AMB_R36, M79AMB_R35, M79AMB_R37), "012/+3*")
231230   DISCRETE_566(NODE_52,               /* IC U3, pin 4 */
232231            NODE_51,               /* IC U3, pin 5 */
233            M79AMB_R39, M79AMB_C21, &m79amb_566_desc)
232            M79AMB_R39, M79AMB_C21,
233            12, 0, 12,               /* VPOS,VNEG,VCHARGE */
234            DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE)
234235   DISCRETE_CRFILTER(NODE_53,
235236            M79AMB_MC_CONTROL_EN,      /* Q13 */
236237            NODE_52, M79AMB_R41 + M79AMB_R42 + M79AMB_R43, M79AMB_C22)
r5955r5956
241242     ************************************************/
242243   DISCRETE_566(NODE_60,                  /* IC U4, pin 4 */
243244            12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R44, M79AMB_R45),      /* IC U5, pin 5 */
244            M79AMB_R46, M79AMB_C25, &m79amb_566_desc)
245            M79AMB_R46, M79AMB_C25,
246            12, 0, 12,               /* VPOS,VNEG,VCHARGE */
247            DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE)
245248   DISCRETE_ONOFF(NODE_61,
246249            M79AMB_TANK_TRUCK_JEEP_EN,      /* Q16, Q17 */
247250              NODE_60)
r5955r5956
266269   DISCRETE_TRANSFORM3(NODE_71, 12, NODE_70, RES_VOLTAGE_DIVIDER(M79AMB_R51, M79AMB_R52), "01-2*1+")
267270   DISCRETE_566(NODE_72,               /* IC U5, pin 4 */
268271            NODE_71,               /* IC U5, pin 5 */
269            M79AMB_R54, M79AMB_C30, &m79amb_566_desc)
272            M79AMB_R54, M79AMB_C30,
273            12, 0, 12,               /* VPOS,VNEG,VCHARGE */
274            DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE)
270275   DISCRETE_CRFILTER(NODE_73,
271276            M79AMB_WHISTLE_A_EN,      /* Q16, Q17 */
272277            NODE_72, M79AMB_R57 + M79AMB_R58 + M79AMB_R59, M79AMB_C31)
r5955r5956
285290   DISCRETE_TRANSFORM3(NODE_81, 12, NODE_80, RES_VOLTAGE_DIVIDER(M79AMB_R61, M79AMB_R62), "01-2*1+")
286291   DISCRETE_566(NODE_82,               /* IC U5, pin 4 */
287292            NODE_81,               /* IC U5, pin 5 */
288            M79AMB_R64, M79AMB_C34, &m79amb_566_desc)
293            M79AMB_R64, M79AMB_C34,
294            12, 0, 12,               /* VPOS,VNEG,VCHARGE */
295            DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE)
289296   DISCRETE_CRFILTER(NODE_83,
290297            M79AMB_WHISTLE_B_EN,      /* Q19, Q20*/
291298            NODE_82, M79AMB_R67 + M79AMB_R68 + M79AMB_R69, M79AMB_C35)
src/mame/audio/snes.c
r5955r5956
189189    int                 v           /* Voice to process envelope for*/
190190    );
191191
192static STREAM_UPDATE( snes_sh_update );
193
192194/* Privately shared functions (for internal library use only) */
193195
194196/***** DSP_Reset *****/
r5955r5956
11791181}
11801182
11811183
1182STREAM_UPDATE( snes_sh_update )
1184static STREAM_UPDATE( snes_sh_update )
11831185{
11841186   int i;
11851187   short mix[2];
src/mame/audio/redbaron.c
r5955r5956
5555    rb_input_select = data & 1;
5656}
5757
58#ifdef UNUSED_FUNCTION
5859WRITE8_DEVICE_HANDLER( redbaron_pokey_w )
5960{
6061    if( latch & 0x20 )
6162        pokey_w(device, offset, data);
6263}
64#endif
6365
6466static STREAM_UPDATE( redbaron_sound_update )
6567{
src/mame/audio/snk6502.c
r5955r5956
361361   /* This is not the perfect way to discharge, but it is good enough for now */
362362   /* it does not take into acount that there is no discharge when noise is low */
363363   DISCRETE_RCDISC2(NODE_10, FANTASY_BOMB_EN, 0, RES_K(10) + RES_K(33), DEFAULT_TTL_V_LOGIC_1 - 0.5, RES_K(1), CAP_U(1))
364   DISCRETE_CLAMP(FANTASY_NOISE_LOGIC, 1, FANTASY_NOISE_STREAM_IN, 0, 1, 0)
364   DISCRETE_CLAMP(FANTASY_NOISE_LOGIC, FANTASY_NOISE_STREAM_IN, 0, 1)
365365   DISCRETE_SWITCH(NODE_11, 1, FANTASY_NOISE_LOGIC, 0, NODE_10)
366366
367367   DISCRETE_OP_AMP_FILTER(NODE_20, 1, NODE_11, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &fantasy_filter)
src/mame/audio/dkong.c
r5955r5956
361361   DISCRETE_INPUT_NOT(DS_DISCHARGE_INV)
362362   //DISCRETE_INPUT_DATA(DS_DAC)
363363
364   /* Mixing - DAC */
365   DISCRETE_ADJUSTMENT_TAG(DS_ADJ_DAC, 0, 1, DISC_LINADJ, "VR2")
366
367364   /************************************************/
368365   /* Stomp                                        */
369366   /************************************************/
370367   /* Noise */
371   DISCRETE_TASK_START()
368   DISCRETE_TASK_START(1)
372369   DISCRETE_LFSR_NOISE(NODE_11, 1, 1, CLOCK_2VF, 1.0, 0, 0.5, &dkong_lfsr)
373370   DISCRETE_COUNTER(NODE_12, 1, 0, NODE_11, 7, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE)   /* LS161, IC 3J */
374371   DISCRETE_TRANSFORM3(NODE_13,NODE_12,3,DK_SUP_V,"01>2*")
r5955r5956
391388   /************************************************/
392389   /*  tt */
393390   /* 4049B Inverter Oscillator build from 3 inverters */
394   DISCRETE_TASK_START()
391   DISCRETE_TASK_START(1)
395392   DISCRETE_INVERTER_OSC(NODE_25,1,0,DK_R38,DK_R39,DK_C26,0,&dkong_inverter_osc_desc_jump)
396393
397394#if DK_USE_CUSTOM
r5955r5956
423420   /************************************************/
424421   /* Walk                                         */
425422   /************************************************/
426   DISCRETE_TASK_START()
423   DISCRETE_TASK_START(1)
427424   DISCRETE_INVERTER_OSC(NODE_51,1,0,DK_R47,DK_R48,DK_C30,0,&dkong_inverter_osc_desc_walk)
428425
429426#if DK_USE_CUSTOM
r5955r5956
450447   /* DAC                                          */
451448   /************************************************/
452449
453   DISCRETE_TASK_START()
450   DISCRETE_TASK_START(1)
454451   /* Buffer DAC first to input stream 0 */
455452   DISCRETE_INPUT_BUFFER(DS_DAC, 0)
456453   //DISCRETE_INPUT_DATA(DS_DAC)
r5955r5956
480477   /* Amplifier                                    */
481478   /************************************************/
482479
480   DISCRETE_TASK_START(2)
481   /* Mixing - DAC */
482   DISCRETE_ADJUSTMENT_TAG(DS_ADJ_DAC, 0, 1, DISC_LINADJ, "VR2")
483
483484   DISCRETE_MIXER4(NODE_288, 1, DS_OUT_SOUND0, DS_OUT_SOUND1, DS_OUT_DAC, DS_OUT_SOUND2, &dkong_mixer_desc)
484485
485486   /* Amplifier: internal amplifier */
r5955r5956
497498   //DISCRETE_CSVLOG2(NODE_296, NODE_288)
498499   //DISCRETE_WAVELOG1(NODE_296, 32767.0/5.0 * 3.41)
499500#endif
501   DISCRETE_TASK_END()
500502
501503DISCRETE_SOUND_END
502504
r5955r5956
876878   /* SOUND0 / SOUND7                              */
877879   /************************************************/
878880
879DISCRETE_TASK_START()
881DISCRETE_TASK_START(1)
880882   DISCRETE_LOGIC_INVERT(DS_SOUND7,DS_SOUND7_INV)
881883   DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT)
882884
r5955r5956
909911   /* SOUND1                                       */
910912   /************************************************/
911913
912DISCRETE_TASK_START()
914DISCRETE_TASK_START(1)
913915   DISCRETE_LS123(NODE_10, DS_SOUND1_INV, JR_R9, JR_C15)
914916   DISCRETE_TRANSFORM2(NODE_11,NODE_104,TTL_HIGH,"0!1*")
915917   DISCRETE_LOGIC_INVERT(NODE_12,NODE_10)
r5955r5956
927929   /* SOUND2                                       */
928930   /************************************************/
929931
930DISCRETE_TASK_START()
932DISCRETE_TASK_START(1)
931933   DISCRETE_74LS624(NODE_20, 0, 0.98*DK_SUP_V, JR_C20, DISC_LS624_OUT_COUNT_F)
932934   DISCRETE_LFSR_NOISE(NODE_21, 1, 1, NODE_20, 1.0, 0, 0.5, &dkongjr_lfsr)
933935   DISCRETE_LS123_INV(NODE_25, DS_SOUND2_INV, JR_R17, JR_C27)
r5955r5956
943945   /* SOUND9                                       */
944946   /************************************************/
945947
946DISCRETE_TASK_START()
948DISCRETE_TASK_START(1)
947949   DISCRETE_LOGIC_INVERT(DS_SOUND9,DS_SOUND9_INV)
948950   DISCRETE_RCFILTER(NODE_90, 1, DS_SOUND9_INV, JR_R14, JR_C26)
949951   DISCRETE_MULTIPLY(NODE_91, NODE_90, TTL_HIGH)
r5955r5956
956958   /* DAC                                          */
957959   /************************************************/
958960
959DISCRETE_TASK_START()
961DISCRETE_TASK_START(1)
960962   DISCRETE_INPUT_BUFFER(DS_DAC, 0)
961963   /* Signal decay circuit Q7, R20, C32 */
962964   DISCRETE_RCDISC(NODE_170, DS_DISCHARGE_INV, 1, JR_R20, JR_C32)
r5955r5956
978980   /* Amplifier                                    */
979981   /************************************************/
980982
983DISCRETE_TASK_START(2)
981984   DISCRETE_MIXER5(NODE_288, 1, DS_OUT_SOUND9, DS_OUT_SOUND0, DS_OUT_SOUND2, DS_OUT_SOUND1, DS_OUT_DAC, &dkongjr_mixer_desc)
982985
983986   /* Amplifier: internal amplifier
r5955r5956
985988     */
986989   DISCRETE_CRFILTER(NODE_295,1,NODE_288, 1000, JR_C13)
987990   DISCRETE_OUTPUT(NODE_295, 32767.0/5.0 * 10)
991DISCRETE_TASK_END()
988992
989993DISCRETE_SOUND_END
990994
src/mame/audio/skyraid.c
r5955r5956
2828#define SKYRAID_R12      RES_K(1)
2929#define SKYRAID_R13      RES_K(10)
3030#define SKYRAID_R14      RES_K(100)
31#define SKYRAID_R16      RES_M(10)
31#define SKYRAID_R16      RES_K(10)
3232#define SKYRAID_R18      RES_K(10)
3333#define SKYRAID_R19      RES_K(10)
3434#define SKYRAID_R20      RES_K(47)
r5955r5956
8686   0, 12, -5,   /* vRef, vP, vN */
8787};
8888
89static const discrete_566_desc skyraid_566_desc =
90{
91   DISC_566_OUT_LOGIC,
92    5,               /* v_pos */
93   -5,               /* v_neg */
94    5               /* v_charge */
95};
96
9789static const discrete_dac_r1_ladder skyraid_plane_dac =
9890{
9991   2, {SKYRAID_R28, SKYRAID_R27},
r5955r5956
343335      DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &skyraid_explosion_filter)   /* TYPE,INFO */
344336   /* IC E10, pin 14 gain and clipping */
345337   DISCRETE_GAIN(NODE_23, NODE_22, SKYRAID_R119 / SKYRAID_R121 + 1)
346   DISCRETE_CLAMP(SKYRAID_EXPLOSION_SND, 1, NODE_23, -5, 12.0 - 1.5, 0)
338   DISCRETE_CLAMP(SKYRAID_EXPLOSION_SND, NODE_23, -5, 12.0 - 1.5)
347339
348340   /************************************************
349341     * Jet, Plane sound
r5955r5956
354346      RES_2_PARALLEL(SKYRAID_R25, SKYRAID_R24), SKYRAID_C49)
355347   DISCRETE_566(NODE_31,               /* IC J6, pin 3 */
356348      NODE_30,                     /* VMOD */
357      SKYRAID_R18, SKYRAID_C48, &skyraid_566_desc)
349      SKYRAID_R18, SKYRAID_C48,
350      5, -5, 5,                     /* VPOS,VNEG,VCHARGE */
351      DISC_566_OUT_COUNT_R)
358352   DISCRETE_LOGIC_SHIFT(NODE_32,         /* IC H7, J7 output */
359353      SKYRAID_NOISE,                  /* IC H7, J7 pins 1 & 2 */
360354      1, NODE_31, 16,                  /* RESET, CLK, SIZE */
361      DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_ON_R_EDGE)
355      DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_BY_COUNT)
362356   /* move bits together for ease of use */
363357   DISCRETE_TRANSFORM4(NODE_33, NODE_32, 1, 1 << 14, 2, "01&02/3&|")
364358   DISCRETE_DAC_R1(SKYRAID_PLANE_SND,
r5955r5956
373367   DISCRETE_CUSTOM5(NODE_40, SKYRAID_MISSILE_EN, SKYRAID_R12, SKYRAID_R14, SKYRAID_R13, SKYRAID_C44, &skyraid_missle_custom_charge)
374368   DISCRETE_566(NODE_41,               /* IC K6, pin 3 */
375369      NODE_40,                     /* VMOD */
376      SKYRAID_R16, SKYRAID_C45, &skyraid_566_desc)
370      SKYRAID_R16, SKYRAID_C45,
371      5, -5, SKYRAID_MISSLE_CHARGE_PLUS,   /* VPOS,VNEG,VCHARGE */
372      DISC_566_OUT_COUNT_R)
377373   DISCRETE_LOGIC_SHIFT(NODE_42,         /* IC K7, L7 output */
378374      SKYRAID_NOISE,                  /* IC K7, L7 pins 1 & 2 */
379375      1, NODE_41, 16,                  /* RESET, CLK, SIZE */
380      DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_ON_R_EDGE)
376      DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_BY_COUNT)
381377   DISCRETE_BIT_DECODE(SKYRAID_MSL_A_SND, NODE_42, 0, DEFAULT_TTL_V_LOGIC_1)   /* IC K7, pin 3 */
382378   DISCRETE_BIT_DECODE(SKYRAID_MSL_B_SND, NODE_42, 15, DEFAULT_TTL_V_LOGIC_1)   /* IC L7, pin 13 */
383379
r5955r5956
401397      SKYRAID_C93)
402398   /* IC E10, pin 1 gain and clipping */
403399   DISCRETE_GAIN(NODE_94, NODE_93, - SKYRAID_R118 / (SKYRAID_R122 + RES_5_PARALLEL(SKYRAID_R120, SKYRAID_R32, SKYRAID_R29, SKYRAID_R30, SKYRAID_R31)))
404   DISCRETE_CLAMP(NODE_95, 1, NODE_94, -5, 12.0 - 1.5, 0)
405   DISCRETE_OUTPUT(NODE_95, 32700.0/12)
400   DISCRETE_CLAMP(NODE_95, NODE_94, -5, 12.0 - 1.5)
401   DISCRETE_OUTPUT(NODE_95, 32700.0/8)
406402DISCRETE_SOUND_END
407403
408404
src/mame/audio/sprint8.c
r0r5956
1/************************************************************************
2 * sprint8 Sound System Analog emulation
3 * Sept 2009, Derrick Renaud
4 ************************************************************************/
5
6#include "driver.h"
7#include "sprint8.h"
8
9
10/* Discrete Sound Input Nodes */
11#define SPRINT8_CRASH_EN         NODE_01
12#define SPRINT8_SCREECH_EN         NODE_02
13#define SPRINT8_ATTRACT_EN         NODE_03
14#define SPRINT8_MOTOR1_EN         NODE_04
15#define SPRINT8_MOTOR2_EN         NODE_05
16#define SPRINT8_MOTOR3_EN         NODE_06
17#define SPRINT8_MOTOR4_EN         NODE_07
18#define SPRINT8_MOTOR5_EN         NODE_08
19#define SPRINT8_MOTOR6_EN         NODE_09
20#define SPRINT8_MOTOR7_EN         NODE_10
21#define SPRINT8_MOTOR8_EN         NODE_11
22
23/* Discrete Sound Output Nodes */
24#define SPRINT8_NOISE            NODE_12
25#define SPRINT8_MOTOR1_SND         NODE_13
26#define SPRINT8_MOTOR2_SND         NODE_14
27#define SPRINT8_MOTOR3_SND         NODE_15
28#define SPRINT8_MOTOR4_SND         NODE_16
29#define SPRINT8_MOTOR5_SND         NODE_17
30#define SPRINT8_MOTOR6_SND         NODE_18
31#define SPRINT8_MOTOR7_SND         NODE_19
32#define SPRINT8_MOTOR8_SND         NODE_20
33#define SPRINT8_CRASH_SCREECH_SND   NODE_21
34#define SPRINT8_AUDIO_1_2         NODE_22
35#define SPRINT8_AUDIO_3_7         NODE_23
36#define SPRINT8_AUDIO_5_6         NODE_24
37#define SPRINT8_AUDIO_4_8         NODE_25
38
39/* Adjusters */
40#define SPRINT8_R132_POT         NODE_29
41
42
43/* Parts List - Resistors */
44#define SPRINT8_R1      RES_K(47)
45#define SPRINT8_R3      RES_K(47)
46#define SPRINT8_R4      RES_K(47)
47#define SPRINT8_R19      RES_K(1)
48#define SPRINT8_R20      RES_K(1)
49#define SPRINT8_R27      RES_K(18)
50#define SPRINT8_R28      820
51#define SPRINT8_R29      RES_K(330)
52#define SPRINT8_R39      RES_K(120)
53#define SPRINT8_R40      RES_K(22)
54#define SPRINT8_R41      RES_K(150)
55#define SPRINT8_R89      RES_K(22)
56#define SPRINT8_R91      RES_K(47)
57#define SPRINT8_R93      RES_K(2.2)
58#define SPRINT8_R96      RES_K(47)
59#define SPRINT8_R97      RES_K(2.2)
60#define SPRINT8_R99      RES_K(27)
61#define SPRINT8_R100   RES_K(1)
62#define SPRINT8_R101   RES_K(2.2)
63#define SPRINT8_R132   RES_K(100)
64#define SPRINT8_R145   RES_K(3.3)
65#define SPRINT8_R146   RES_K(7.5)
66#define SPRINT8_R147   100
67#define SPRINT8_R148   RES_K(1)
68#define SPRINT8_R149   RES_K(22)
69
70/* Parts List - Capacitors */
71#define SPRINT8_C8      CAP_U(.01)
72#define SPRINT8_C17      CAP_U(.001)
73#define SPRINT8_C18      CAP_U(.047)
74#define SPRINT8_C19      CAP_U(.047)
75#define SPRINT8_C26      CAP_U(100)
76#define SPRINT8_C27      CAP_U(.22)
77#define SPRINT8_C28      CAP_U(.1)
78#define SPRINT8_C59      CAP_U(.1)
79#define SPRINT8_C63      CAP_U(.1)
80#define SPRINT8_C64      CAP_U(.1)
81#define SPRINT8_C89      CAP_U(.1)
82#define SPRINT8_C90      CAP_U(.1)
83
84#define SPRINT8_HSYNC   15750.0      /* not checked */
85#define SPRINT8_1V   SPRINT8_HSYNC/2
86#define SPRINT8_2V   SPRINT8_1V/2
87
88
89static const discrete_lfsr_desc sprint8_lfsr =
90{
91   DISC_CLK_IS_FREQ,
92   16,               /* Bit Length */
93   0,               /* Reset Value */
94   10,               /* Use Bit 10 as XOR input 0 */
95   15,               /* Use Bit 15 as XOR input 1 */
96   DISC_LFSR_XNOR,      /* Feedback stage1 is XNOR */
97   DISC_LFSR_OR,      /* Feedback stage2 is just stage 1 output OR with external feed */
98   DISC_LFSR_REPLACE,   /* Feedback stage3 replaces the shifted register contents */
99   0x000001,         /* Everything is shifted into the first bit only */
100   DISC_LFSR_FLAG_RESET_TYPE_L,   /* Output is not inverted */
101   12               /* Output bit */
102};
103
104static const discrete_555_desc sprint8_crash_555a_desc =
105{
106   DISC_555_OUT_ENERGY,
107   5, DEFAULT_555_VALUES
108};
109
110static const discrete_integrate_info sprint8_crash_integrate =
111{
112   DISC_INTEGRATE_OP_AMP_1,
113   SPRINT8_R99, SPRINT8_R97, SPRINT8_R96, SPRINT8_C59,      /*r1, r2, r3, c, */
114   5, 5,                     /* v1, vP*/
115   0, 0, 0                     /* no functions */
116};
117
118static const discrete_555_desc sprint8_motor_555a_desc =
119{
120   DISC_555_OUT_COUNT_F_X,
121   5, DEFAULT_555_VALUES
122};
123
124static const discrete_555_desc sprint8_motor_555m_desc =
125{
126   DISC_555_OUT_ENERGY | DISC_555_TRIGGER_IS_COUNT,
127   5, DEFAULT_555_VALUES
128};
129
130static const discrete_op_amp_filt_info sprint8_motor_filter =
131{
132   SPRINT8_R27, 0, SPRINT8_R28 + RES_2_PARALLEL(SPRINT8_R19, SPRINT8_R20), 0, SPRINT8_R29,   /* r1, r2, r3, r4, rF, */
133   SPRINT8_C18, SPRINT8_C19, 0,                            /* c1, c2, c3, */
134   5.0 * RES_VOLTAGE_DIVIDER(SPRINT8_R19, SPRINT8_R20), 5, 0      /* vRef, vP, vN */
135};
136
137static const discrete_mixer_desc sprint8_crash_screech_mixer =
138{
139   DISC_MIXER_IS_RESISTOR,
140   {SPRINT8_R149, SPRINT8_R91},
141   {0, NODE_80},                  /* R93 switched in/out of circuit */
142   {0}, 0, 0, SPRINT8_C64, 0, 0, 1      /* c, rI, rF, cF, cAmp, vRef, gain */
143};
144
145static const discrete_mixer_desc sprint8_mixer =
146{
147   DISC_MIXER_IS_RESISTOR,
148   {SPRINT8_R1 + SPRINT8_R100, SPRINT8_R3, SPRINT8_R4},
149   {0}, {0}, 0, 0, 0, SPRINT8_C8, 0, 1      /* r_nodes, c, rI, rF, cF, cAmp, vRef, gain */
150};
151
152
153/************************************************
154 * Car Motor
155 ************************************************/
156/* The first (astable) 555 generates a quick falling pulse that triggers the second (monostable) 555.
157 * This pulse is passed through C17 and pulled up with R40.  This pulse is too fast to emulate so
158 * we will just tell the monostable it was triggered once and ignore C17/R40.
159 */
160#define SPRINT8_MOTOR_CIRCUIT(_car)                                                            \
161DISCRETE_RCFILTER(NODE_RELATIVE(NODE_30, _car - 1), 1, NODE_RELATIVE(SPRINT8_MOTOR1_EN, _car - 1), SPRINT8_R89, SPRINT8_C26)    \
162DISCRETE_ADDER2(NODE_RELATIVE(NODE_40, _car - 1), 1, NODE_RELATIVE(NODE_30, _car - 1), 0.7)   /* add Q21 shift */             \
163DISCRETE_555_ASTABLE_CV(NODE_RELATIVE(NODE_50, _car - 1), 1, SPRINT8_R39, 0, SPRINT8_C27, NODE_RELATIVE(NODE_40, _car - 1), &sprint8_motor_555a_desc) \
164DISCRETE_555_MSTABLE(NODE_RELATIVE(NODE_60, _car - 1), 1, NODE_RELATIVE(NODE_50, _car - 1), SPRINT8_R41, SPRINT8_C28, &sprint8_motor_555m_desc)       \
165DISCRETE_OP_AMP_FILTER(NODE_RELATIVE(SPRINT8_MOTOR1_SND, _car - 1), 1, NODE_RELATIVE(NODE_60, _car - 1), 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &sprint8_motor_filter)
166
167
168DISCRETE_SOUND_START( sprint8 )
169   /************************************************
170     * Input register mapping
171     ************************************************/
172   DISCRETE_INPUT_LOGIC(SPRINT8_CRASH_EN)
173   DISCRETE_INPUT_NOT  (SPRINT8_SCREECH_EN)
174   DISCRETE_INPUT_NOT  (SPRINT8_ATTRACT_EN)
175   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR1_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
176   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR2_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
177   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR3_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
178   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR4_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
179   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR5_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
180   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR6_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
181   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR7_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
182   DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR8_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0)
183
184   DISCRETE_TASK_START(0)
185   DISCRETE_ADJUSTMENT_TAG(SPRINT8_R132_POT, 0, SPRINT8_R132, DISC_LINADJ, "R132")
186
187   /************************************************
188     * Noise Generator, Crash, Screech
189     ************************************************/
190   /* Address line A2 is used to XOR the feedback bits.
191     * This can not easily be implemented, so I just set the
192     * feedback as XNOR. */
193   DISCRETE_LFSR_NOISE(SPRINT8_NOISE,         /* IC F7, pin 13 */
194      1,                              /* ENAB */
195      SPRINT8_ATTRACT_EN,                  /* RESET */
196      SPRINT8_2V, 1, 0, 0.5, &sprint8_lfsr)   /* CLK,AMPL,FEED,BIAS,LFSRTB */
197
198   DISCRETE_TASK_END()
199
200   DISCRETE_TASK_START(1)
201   DISCRETE_GAIN(NODE_70, SPRINT8_NOISE, DEFAULT_TTL_V_LOGIC_1 * RES_VOLTAGE_DIVIDER(SPRINT8_R148, SPRINT8_R147))
202   DISCRETE_CRFILTER_VREF(NODE_71,
203      1,                              /* ENAB */
204      NODE_70,                        /* IN0 */
205      RES_2_PARALLEL(SPRINT8_R148, SPRINT8_R147) + RES_2_PARALLEL(RES_K(5), RES_K(10)),
206      SPRINT8_C90,
207      5.0 * RES_VOLTAGE_DIVIDER(RES_K(5), RES_K(10)))      /* ref to 555 CV pin */
208   DISCRETE_555_ASTABLE_CV(NODE_72,
209      SPRINT8_SCREECH_EN,                  /* RESET */
210      SPRINT8_R145, SPRINT8_R146, SPRINT8_C89,
211      NODE_71,                        /* CTRLV */
212      &sprint8_crash_555a_desc)
213   DISCRETE_INTEGRATE(NODE_73, SPRINT8_CRASH_EN, 0, &sprint8_crash_integrate)
214
215   DISCRETE_SWITCH(NODE_80,
216      1,                              /* ENAB */
217      SPRINT8_NOISE,                     /* SWITCH */
218      SPRINT8_R93, 1)                     /* INP0,INP1*/
219   DISCRETE_SWITCH(NODE_74,               /* effect of Q20 */
220      1,                              /* ENAB */
221      SPRINT8_NOISE,                     /* SWITCH */
222      NODE_73, 0)                        /* INP0,INP1*/
223   DISCRETE_MIXER2(NODE_75,
224      1,                              /* ENAB */
225      NODE_72,
226      NODE_74,
227      &sprint8_crash_screech_mixer)
228
229   DISCRETE_CRFILTER_VREF(NODE_76,
230      1,                              /* ENAB */
231      NODE_75,                        /* IN0 */
232      SPRINT8_R93 + SPRINT8_R91, SPRINT8_C63,
233      5)                              /* VREF */
234   /* IC E5, pin 14 gain.  Does not simulate minor DC offset caused by R93. */
235   DISCRETE_TRANSFORM5(NODE_77, NODE_76, 5, SPRINT8_R132_POT, SPRINT8_R101, 1, "01-23/4+*1+")
236   DISCRETE_CLAMP(SPRINT8_CRASH_SCREECH_SND, NODE_77, 0, 15.0 - 1.5)
237   DISCRETE_TASK_END()
238
239   /************************************************
240     * Car Motor
241     ************************************************/
242   DISCRETE_TASK_START(1)
243   SPRINT8_MOTOR_CIRCUIT(1)
244   SPRINT8_MOTOR_CIRCUIT(2)
245   DISCRETE_TASK_END()
246
247   DISCRETE_TASK_START(1)
248   SPRINT8_MOTOR_CIRCUIT(3)
249   SPRINT8_MOTOR_CIRCUIT(7)
250   DISCRETE_TASK_END()
251
252   DISCRETE_TASK_START(1)
253   SPRINT8_MOTOR_CIRCUIT(5)
254   SPRINT8_MOTOR_CIRCUIT(6)
255   DISCRETE_TASK_END()
256
257   DISCRETE_TASK_START(1)
258   SPRINT8_MOTOR_CIRCUIT(4)
259   SPRINT8_MOTOR_CIRCUIT(8)
260   DISCRETE_TASK_END()
261
262   /************************************************
263     * Final Mix
264     ************************************************/
265   DISCRETE_TASK_START(2)
266   DISCRETE_MIXER3(SPRINT8_AUDIO_1_2,
267      SPRINT8_ATTRACT_EN,            /* ENAB */
268      SPRINT8_CRASH_SCREECH_SND,
269      SPRINT8_MOTOR1_SND,
270      SPRINT8_MOTOR2_SND,
271      &sprint8_mixer)
272   DISCRETE_MIXER3(SPRINT8_AUDIO_3_7,
273      SPRINT8_ATTRACT_EN,            /* ENAB */
274      SPRINT8_CRASH_SCREECH_SND,
275      SPRINT8_MOTOR3_SND,
276      SPRINT8_MOTOR7_SND,
277      &sprint8_mixer)
278   DISCRETE_MIXER3(SPRINT8_AUDIO_5_6,
279      SPRINT8_ATTRACT_EN,            /* ENAB */
280      SPRINT8_CRASH_SCREECH_SND,
281      SPRINT8_MOTOR5_SND,
282      SPRINT8_MOTOR6_SND,
283      &sprint8_mixer)
284   DISCRETE_MIXER3(SPRINT8_AUDIO_4_8,
285      SPRINT8_ATTRACT_EN,            /* ENAB */
286      SPRINT8_CRASH_SCREECH_SND,
287      SPRINT8_MOTOR4_SND,
288      SPRINT8_MOTOR8_SND,
289      &sprint8_mixer)
290   DISCRETE_OUTPUT(SPRINT8_AUDIO_1_2, 65500.0/8)
291   DISCRETE_OUTPUT(SPRINT8_AUDIO_3_7, 65500.0/8)
292   DISCRETE_OUTPUT(SPRINT8_AUDIO_5_6, 65500.0/8)
293   DISCRETE_OUTPUT(SPRINT8_AUDIO_4_8, 65500.0/8)
294   DISCRETE_TASK_END()
295DISCRETE_SOUND_END
296
297
298WRITE8_DEVICE_HANDLER( sprint8_crash_w )
299{
300   discrete_sound_w(device, SPRINT8_CRASH_EN, data & 0x01);
301}
302
303WRITE8_DEVICE_HANDLER( sprint8_screech_w )
304{
305   discrete_sound_w(device, SPRINT8_SCREECH_EN, data & 0x01);
306}
307
308WRITE8_DEVICE_HANDLER( sprint8_attract_w )
309{
310   discrete_sound_w(device, SPRINT8_ATTRACT_EN, data & 0x01);
311}
312
313WRITE8_DEVICE_HANDLER( sprint8_motor_w )
314{
315   discrete_sound_w(device, NODE_RELATIVE(SPRINT8_MOTOR1_EN, offset & 0x07), data & 0x01);
316}
src/mame/audio/madalien.c
r5955r5956
187187   DISCRETE_TRANSFORM3(NODE_32, MADALIEN_8910_PSG_A, NODE_30, -RES_K(10)/RES_K(3.3), "01-2*1+")
188188   // pin 1
189189   DISCRETE_SWITCH(NODE_33, 1, MADALIEN_8910_PORTA_3, NODE_31, NODE_32)
190   DISCRETE_CLAMP(NODE_34, 1, NODE_33, -5, 5.0-1.5, 0)
190   DISCRETE_CLAMP(NODE_34, NODE_33, -5, 5.0-1.5)
191191
192192   // bottom op-amp
193193   DISCRETE_ONOFF(NODE_40, MADALIEN_8910_PORTA_6, MADALIEN_8910_PSG_B)
r5955r5956
230230     ************************************************/
231231   DISCRETE_CRFILTER(NODE_60, 1, MADALIEN_8910_PORTB_7, RES_K(100), CAP_U(4.7))
232232   // 2 diodes clamp it positive.
233   DISCRETE_CLAMP(NODE_62, 1, NODE_60, 0, 12, 0)
233   DISCRETE_CLAMP(NODE_62, NODE_60, 0, 12)
234234   // the 0.047uF cap to ground just removes real world spikes.
235235   // it does not have to be simulated.
236236   DISCRETE_MIXER2(NODE_64, 1, NODE_62, 5, &madalien_555_1c_cv)
src/mame/audio/mario.c
r5955r5956
1616/* FIXME: Capacitor aging - only in for calibration now        */
1717/* Adjustments are needed to bring this close to recordings    */
1818
19#define CAP_AGE(c, f)   ((c) * (f))
20
2119/* FIXME: Awaiting verification. VCO range inputs are shown    */
2220/* as connected to +5V on schematics. This does not match      */
2321/* recordings                                                  */
r5955r5956
132130#define DISCRETE_LS123_INV(_N, _T, _R, _C) \
133131   DISCRETE_ONESHOTR(_N, 0, _T, TTL_HIGH, (0.25 * (_R) * (_C) * (1.0+700./(_R))), DISC_ONESHOT_RETRIG | DISC_ONESHOT_REDGE | DISC_OUT_ACTIVE_LOW)
134132
133/* speed optimization */
134/* pow(10, x) = exp(ln(10)*x) */
135#define pow10(x) exp(2.30258509299404568401*(x))
136
135137/* The following formula was derived from figures 2 and 3 in LS624 datasheet. Coefficients
136138 * where calculated using least square approximation.
137139 * This approach gives a bit better results compared to the first approach.
138140 */
139#define LS624_F(_C, _VI, _VR)   pow(10, -0.912029404 * log10(_C) + 0.243264328 * (_VI) \
140                - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925)
141//#define LS624_F(_C, _VI, _VR) pow10( -0.912029404 * log10(_C) + 0.243264328 * (_VI)
142//                - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925)
143#define LS624_F(_in, _num)   pow10(context->k1_##_num + 0.243264328 * (_in) + context->k2_##_num * (_in))
141144
142145/************************************************************************
143146 *
r5955r5956
184187   double   remain1;
185188   double  remain2;
186189   double  vc3;
190   double  r1_c3;
191   double   k1_1;
192   double   k2_1;
193   double   k1_2;
194   double   k2_2;
195   double   exponent_c3;
196   double   dt_in1_at_0;
197   double   dt_in2_at_0;
187198};
188199
189200static DISCRETE_STEP( mario_custom_run )
190201{
191202   struct mario_custom_run_context *context = (struct mario_custom_run_context *)node->context;
192203
193   double   t1   = 0.5 / LS624_F(MARIO_CUSTOM_C1, MARIO_CUSTOM_IN1, RUN_VCO_VOLTAGE);
194   double   t2   = 0.5 / LS624_F(MARIO_CUSTOM_C2, MARIO_CUSTOM_IN2, RUN_VCO_VOLTAGE);
195204   double  sample_t = node->info->sample_time;
196   double  vn, t;
205   double  vn, exponent, t = 0;
206   int      update_exponent = 0;
207   double   t1, t2;
197208
198   //if (MARIO_CUSTOM_VOUT)
199   //  printf("%f %f %f %f\n", MARIO_CUSTOM_IN1, MARIO_CUSTOM_IN2, 0.5 / t1, 0.5 / t2);
209   if (MARIO_CUSTOM_IN1 > 0.001)
210      t1   = 0.5 / LS624_F(MARIO_CUSTOM_IN1, 1);
211   else
212      /* close enough to 0, so we can speed things up by no longer call pow() */
213      t1 = context->dt_in1_at_0;
214
215   if (MARIO_CUSTOM_IN2 > 0.001)
216      t2   = 0.5 / LS624_F(MARIO_CUSTOM_IN2, 2);
217   else
218      t2 = context->dt_in2_at_0;
219
200220   while (sample_t > 0.0f)
201221   {
202222      /* state before time advance */
r5955r5956
207227         if (context->remain1 < sample_t)
208228         {
209229            t = context->remain1;
230            update_exponent = 1;
210231            context->state1 ^= 1;
211232            sample_t -= context->remain1;
212233            context->remain2 -= context->remain1;
r5955r5956
214235         }
215236         else
216237         {
217            t = sample_t;
218238            context->remain1 -= sample_t;
219239            context->remain2 -= sample_t;
220240            sample_t = 0.0f;
r5955r5956
225245         if (context->remain2 < sample_t)
226246         {
227247            t = context->remain2;
248            update_exponent = 1;
228249            context->state2 ^= 1;
229250            sample_t -= context->remain2;
230251            context->remain1 -= context->remain2;
r5955r5956
232253         }
233254         else
234255         {
235            t = sample_t;
236256            context->remain1 -= sample_t;
237257            context->remain2 -= sample_t;
238258            sample_t = 0.0f;
239259         }
240260      }
241261
242      context->vc3 += (vn - context->vc3) * (1.0 - exp(- t / (MARIO_CUSTOM_R1 * MARIO_CUSTOM_C3)));
262      if (update_exponent)
263         exponent = RC_CHARGE_EXP_DT(context->r1_c3, t);
264      else
265         exponent = context->exponent_c3;
266      context->vc3 += (vn - context->vc3) * exponent;
243267   }
244268   node->output[0] = context->vc3;
245269}
r5955r5956
253277   context->state1 = 0;
254278   context->state2 = 0;
255279   context->vc3 = 0;
280   context->r1_c3 = MARIO_CUSTOM_R1 * MARIO_CUSTOM_C3;
256281   node->output[0] = 0;
282
283   /* precalculate some parts of the formulas for speed */
284   context->k1_1 = -0.912029404 * log10(MARIO_CUSTOM_C1) -0.091695877 * (RUN_VCO_VOLTAGE) - 3.207072925;
285   context->k2_1 = -0.014110946 * (RUN_VCO_VOLTAGE);
286   context->k1_2 = -0.912029404 * log10(MARIO_CUSTOM_C2) -0.091695877 * (RUN_VCO_VOLTAGE) - 3.207072925;
287   context->k2_2 = -0.014110946 * (RUN_VCO_VOLTAGE);
288   context->exponent_c3 = RC_CHARGE_EXP(context->r1_c3);
289
290   context->dt_in1_at_0 = 0.5 / LS624_F(0, 1);
291   context->dt_in2_at_0 = 0.5 / LS624_F(0, 2);
257292}
258293
259294static const discrete_custom_info mario_custom_run_info =
r5955r5956
269304   /************************************************/
270305
271306   /* DISCRETE_INPUT_DATA */
272    DISCRETE_INPUT_PULSE(DS_SOUND0_INV, 1)
273    DISCRETE_INPUT_PULSE(DS_SOUND1_INV, 1)
274307    DISCRETE_INPUT_NOT(DS_SOUND7_INV)
275    DISCRETE_INPUT_DATA(DS_DAC)
276308
277309   /************************************************/
278310   /* SOUND0                                       */
279311   /************************************************/
280312
281   DISCRETE_LS123(NODE_10, DS_SOUND0_INV, MR_R17, CAP_AGE(MR_C14, 0.7))
282   DISCRETE_RCFILTER(NODE_11, 1, NODE_10, MR_R6, CAP_AGE(MR_C3, 0.5) )
313    DISCRETE_TASK_START(1)
314    DISCRETE_INPUT_PULSE(DS_SOUND0_INV, 1)
315   DISCRETE_LS123(NODE_10, DS_SOUND0_INV, MR_R17, MR_C14)
316   DISCRETE_RCFILTER(NODE_11, 1, NODE_10, MR_R6, MR_C3 )
283317   DISCRETE_CUSTOM7(NODE_12, NODE_10, NODE_11, NODE_11, MR_C6, MR_C17,
284318         MR_MIXER_RPAR, MR_C31, &mario_custom_run_info)
285319   DISCRETE_MULTIPLY(DS_OUT_SOUND0, NODE_12, MR_MIXER_RPAR / MR_R20)
320   DISCRETE_TASK_END()
286321
287322   /************************************************/
288323   /* SOUND1                                       */
289324   /************************************************/
290325
291   DISCRETE_LS123(NODE_20, DS_SOUND1_INV, MR_R18, CAP_AGE(MR_C15, 0.7))
292   DISCRETE_RCFILTER(NODE_21, 1, NODE_20, MR_R7, CAP_AGE(MR_C4, 0.5) )
326   DISCRETE_TASK_START(1)
327   DISCRETE_INPUT_PULSE(DS_SOUND1_INV, 1)
328   DISCRETE_LS123(NODE_20, DS_SOUND1_INV, MR_R18, MR_C15)
329   DISCRETE_RCFILTER(NODE_21, 1, NODE_20, MR_R7, MR_C4 )
293330   DISCRETE_CUSTOM7(NODE_22, NODE_20, NODE_21, NODE_21, MR_C5, MR_C16,
294331      MR_MIXER_RPAR, MR_C31, &mario_custom_run_info)
295332   DISCRETE_MULTIPLY(DS_OUT_SOUND1, NODE_22, MR_MIXER_RPAR / MR_R19)
333   DISCRETE_TASK_END()
296334
297335   /************************************************/
298336   /* SOUND7                                       */
299337   /************************************************/
300338
339   DISCRETE_TASK_START(1)
301340   DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT)
302341
303342   DISCRETE_BIT_DECODE(NODE_102, NODE_100, 3, 1)    //LS157 2B
304343   DISCRETE_BIT_DECODE(NODE_104, NODE_100, 11, TTL_HIGH) //LS157 3B
305344
306   DISCRETE_LS123(NODE_110, DS_SOUND7_INV, MR_R61, CAP_AGE(MR_C41, 0.6))
345   DISCRETE_LS123(NODE_110, DS_SOUND7_INV, MR_R61, MR_C41)
307346   DISCRETE_TRANSFORM2(NODE_111, NODE_110, TTL_HIGH, "0!1*")
308347   DISCRETE_RCFILTER(NODE_112, 1, NODE_111, MR_R65, MR_C44)
309   DISCRETE_74LS624(NODE_113, NODE_112, VSS, MR_C40, DISC_LS624_OUT_LOGIC)
348   DISCRETE_74LS624(NODE_113, NODE_112, RUN_VCO_VOLTAGE /*VSS*/, MR_C40, DISC_LS624_OUT_LOGIC)
310349
311350   DISCRETE_LOGIC_XOR(NODE_115, NODE_102, NODE_113)
312351
313352   DISCRETE_RCFILTER(NODE_117, 1, NODE_104, MR_R64, MR_C43)
314   DISCRETE_74LS624(NODE_118, NODE_117, VSS, MR_C39, DISC_LS624_OUT_COUNT_F)
353   DISCRETE_74LS624(NODE_118, NODE_117, RUN_VCO_VOLTAGE /*VSS*/, MR_C39, DISC_LS624_OUT_COUNT_F)
315354
316355   DISCRETE_LOGIC_AND(NODE_120, NODE_115, NODE_110)
317356   DISCRETE_MULTIPLY(NODE_121, NODE_120, TTL_HIGH * MR_MIXER_RPAR / MR_R41)
318357   DISCRETE_RCFILTER(DS_OUT_SOUND7, 1, NODE_121, MR_MIXER_RPAR, MR_C31)
358   DISCRETE_TASK_END()
319359
320360   /************************************************/
321361   /* DAC                                          */
r5955r5956
325365     * is a filter circuit. Simulation in LTSPICE shows, that the following is equivalent:
326366     */
327367
368   DISCRETE_TASK_START(1)
369   DISCRETE_INPUT_BUFFER(DS_DAC, 0)
328370   DISCRETE_MULTIPLY(NODE_170, DS_DAC, TTL_HIGH/256.0)
329371   DISCRETE_RCFILTER(NODE_171, 1, NODE_170, RES_K(750), CAP_P(200))
330372
331373   DISCRETE_MULTIPLY(NODE_172, NODE_171, MR_MIXER_RPAR / MR_R40)
332374   DISCRETE_RCFILTER(DS_OUT_DAC, 1, NODE_172, MR_MIXER_RPAR, MR_C31)
375   DISCRETE_TASK_END()
333376
334377
335378   /************************************************/
336379   /* MIXER                                        */
337380   /************************************************/
338381
382   DISCRETE_TASK_START(2)
339383   DISCRETE_ADDER4(NODE_295, 1, DS_OUT_SOUND0, DS_OUT_SOUND1, DS_OUT_SOUND7, DS_OUT_DAC)
340384
341385   /* Amplifier: internal amplifier
r5955r5956
347391   DISCRETE_OUTPUT(NODE_297, 32767.0/5.0 * 10)
348392   //DISCRETE_WAVELOG1(DS_OUT_SOUND0, 32767/5.0)
349393   //DISCRETE_WAVELOG2(NODE_296, 32767/5.0 * 2, DS_SOUND7_INV, 10000)
394   DISCRETE_TASK_END()
350395
351396DISCRETE_SOUND_END
352397
src/mame/audio/polepos.c
r5955r5956
336336               0.5         /* overall filter GAIN */)
337337   /* clamp to the maximum of the op-amp shifted by vRef */
338338   DISCRETE_CLAMP(POLEPOS_CHANL4_SND,
339               1,         /* ENAB */
340339               NODE_54,   /* IN0 */
341340               0,         /* MIN */
342               5.0 - OP_AMP_VP_RAIL_OFFSET - POLEPOS_VREF,   /* MAX */
343               0.0 - POLEPOS_VREF         /* disabled CLAMP value */)
341               5.0 - OP_AMP_VP_RAIL_OFFSET - POLEPOS_VREF)   /* MAX */
344342
345343   /************************************************
346344     * Output
src/mame/audio/tank8.c
r5955r5956
252252            1.0 + 100.0/22,      // max gain of E5 = 1 + r132/r101
253253            DISC_LINADJ, "CRASH")
254254   DISCRETE_MULTIPLY(NODE_129, NODE_127, NODE_128 )
255   DISCRETE_CLAMP(TANK8_CRASHEXPL, 1, NODE_129, -(12.0 - OP_AMP_VP_RAIL_OFFSET)/2, (12.0 - OP_AMP_VP_RAIL_OFFSET)/2, 0)
255   DISCRETE_CLAMP(TANK8_CRASHEXPL, NODE_129, -(12.0 - OP_AMP_VP_RAIL_OFFSET)/2, (12.0 - OP_AMP_VP_RAIL_OFFSET)/2)
256256
257257   /************************************************/
258258   /* Combine all 10 sound sources.                */
src/mame/audio/mw8080bw.c
r5955r5956
6464      DISCRETE_OP_AMP_TRIG_VCA(MIDWAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, MIDWAY_TONE_EN, 0, 12, 0, &discrete_op_amp_tvca_info)
6565
6666
67/* most common values based on clowns schematic */
68static const discrete_op_amp_tvca_info midway_music_tvca_info =
69{
70   RES_M(3.3),            /* r502 */
71   RES_K(10) + RES_K(680),   /* r505 + r506 */
72   0,
73   RES_K(680),            /* r503 */
74   RES_K(10),            /* r500 */
75   0,
76   RES_K(680),            /* r501 */
77   0,
78   0,
79   0,
80   0,
81   CAP_U(.001),         /* c500 */
82   0,
83   0,
84   12,         /* v1 */
85   0,         /* v2 */
86   0,         /* v3 */
87   12,         /* vP */
88   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
89   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
90   DISC_OP_AMP_TRIGGER_FUNCTION_TRG1,
91   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
92   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
93   DISC_OP_AMP_TRIGGER_FUNCTION_NONE
94};
95
96
6797WRITE8_DEVICE_HANDLER( midway_tone_generator_lo_w )
6898{
6999   discrete_sound_w(device, MIDWAY_TONE_EN, (data >> 0) & 0x01);
r5955r5956
9741004   DISCRETE_FILTER2(NODE_23,
9751005               1,                     /* ENAB */
9761006               NODE_21,               /* INP0 */
977               35,                  /* FREQ */
1007               35,                     /* FREQ */
9781008               1.0 / 8,               /* DAMP */
9791009               DISC_FILTER_BANDPASS)
9801010   DISCRETE_GAIN(NODE_24,
9811011               NODE_23,               /* IN0 */
9821012               15)                     /* GAIN */
9831013   DISCRETE_CLAMP(CHECKMAT_BOOM_SND,         /* IC Q2/3, pin 10 */
984               1,                     /* ENAB */
9851014               NODE_24,               /* IN0 */
9861015               0 - 6,                  /* MIN */
987               12.0 - OP_AMP_NORTON_VBE -6,/* MAX */
988               0)                     /* CLAMP */
1016               12.0 - OP_AMP_NORTON_VBE -6)/* MAX */
9891017
9901018   /************************************************
9911019     * Tone generator
r5955r5956
10891117#define DESERTGU_MUSIC_ADJ               NODE_15
10901118
10911119
1092static const discrete_op_amp_tvca_info desertgu_tone_music_info =
1093{
1094   RES_M(3.3),               /* r502 */
1095   RES_K(10) + RES_K(680),      /* r505 + r506 */
1096   0,
1097   RES_K(680),               /* r503 */
1098   RES_K(10),               /* r500 */
1099   0,
1100   RES_K(680),               /* r501 */
1101   0,
1102   0,
1103   0,
1104   0,
1105   CAP_U(.001),            /* c500 */
1106   0, 0,
1107   12,         /* v1 */
1108   0,         /* v2 */
1109   0,         /* v3 */
1110   12,         /* vP */
1111   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
1112   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1113   DISC_OP_AMP_TRIGGER_FUNCTION_TRG1,
1114   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1115   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1116   DISC_OP_AMP_TRIGGER_FUNCTION_NONE
1117};
1118
1119
11201120static const discrete_op_amp_tvca_info desertgu_rifle_shot_tvca_info =
11211121{
11221122   RES_M(2.7),
r5955r5956
12271227   /************************************************
12281228     * Tone generator
12291229     ************************************************/
1230   MIDWAY_TONE_GENERATOR(desertgu_tone_music_info)
1230   MIDWAY_TONE_GENERATOR(midway_music_tvca_info)
12311231
12321232   /************************************************
12331233     * Rifle shot sound
r5955r5956
13591359};
13601360
13611361
1362static const discrete_op_amp_tvca_info dplay_music_tvca_info =
1363{
1364   RES_M(3.3),
1365   RES_K(10) + RES_K(680),
1366   0,
1367   RES_K(680),
1368   RES_K(10),
1369   0,
1370   RES_K(680),
1371   0,
1372   0,
1373   0,
1374   0,
1375   CAP_U(.001),
1376   0,
1377   0,
1378   12,         /* v1 */
1379   0,         /* v2 */
1380   0,         /* v3 */
1381   12,         /* vP */
1382   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
1383   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1384   DISC_OP_AMP_TRIGGER_FUNCTION_TRG1,
1385   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1386   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1387   DISC_OP_AMP_TRIGGER_FUNCTION_NONE
1388};
1389
1390
13911362static const discrete_integrate_info dplay_siren_integrate_info =
13921363{
13931364   DISC_INTEGRATE_OP_AMP_1 | DISC_OP_AMP_IS_NORTON,
r5955r5956
15221493   /************************************************
15231494     * Music and Tone Generator
15241495     ************************************************/
1525   MIDWAY_TONE_GENERATOR(dplay_music_tvca_info)
1496   MIDWAY_TONE_GENERATOR(midway_music_tvca_info)
15261497
1527   DISCRETE_OP_AMP_TRIG_VCA(DPLAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, DPLAY_TONE_ON_EN, 0, 12, 0, &dplay_music_tvca_info)
1498   DISCRETE_OP_AMP_TRIG_VCA(DPLAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, DPLAY_TONE_ON_EN, 0, 12, 0, &midway_music_tvca_info)
15281499
15291500   /************************************************
15301501     * Siren
r5955r5956
18111782#define CLOWNS_SB_MISS_SND         NODE_09
18121783
18131784/* nodes - adjusters */
1814#define CLOWNS_MUSIC_ADJ         NODE_11
1785#define CLOWNS_R507_POT            NODE_11
18151786
18161787
1817static const discrete_op_amp_tvca_info clowns_music_tvca_info =
1818{
1819   RES_M(3.3),            /* r502 */
1820   RES_K(10) + RES_K(680),   /* r505 + r506 */
1821   0,
1822   RES_K(680),            /* r503 */
1823   RES_K(10),            /* r500 */
1824   0,
1825   RES_K(680),            /* r501 */
1826   0,
1827   0,
1828   0,
1829   0,
1830   CAP_U(.001),         /* c500 */
1831   0,
1832   0,
1833   12,         /* v1 */
1834   0,         /* v2 */
1835   0,         /* v3 */
1836   12,         /* vP */
1837   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
1838   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1839   DISC_OP_AMP_TRIGGER_FUNCTION_TRG1,
1840   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1841   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
1842   DISC_OP_AMP_TRIGGER_FUNCTION_NONE
1843};
1844
1845
18461788static const discrete_op_amp_tvca_info clowns_pop_tvca_info =
18471789{
18481790   RES_M(2.7),      /* r304 */
r5955r5956
19241866   { 0,
19251867     0,
19261868     0,
1927     CLOWNS_MUSIC_ADJ },
1869     CLOWNS_R507_POT },
19281870   { 0,
19291871     CAP_U(0.022),
19301872     0,
r5955r5956
19521894   /* The low value of the pot is set to 7000.  A real 1M pot will never go to 0 anyways. */
19531895   /* This will give the control more apparent volume range. */
19541896   /* The music way overpowers the rest of the sounds anyways. */
1955   DISCRETE_ADJUSTMENT_TAG(CLOWNS_MUSIC_ADJ, RES_M(1), 7000, DISC_LOGADJ, "MUSIC_ADJ")
1897   DISCRETE_ADJUSTMENT_TAG(CLOWNS_R507_POT, RES_M(1), 7000, DISC_LOGADJ, "R507")
19561898
19571899   /************************************************
19581900     * Tone generator
19591901     ************************************************/
1960   MIDWAY_TONE_GENERATOR(clowns_music_tvca_info)
1902   MIDWAY_TONE_GENERATOR(midway_music_tvca_info)
19611903
19621904   /************************************************
19631905     * Balloon hit sounds
r5955r5956
20622004 *
20632005 *  Space Walk
20642006 *
2007 *  Discrete sound emulation: Oct 2009, D.R.
2008 *
20652009 *************************************/
20662010
2011 /* Discrete Sound Input Nodes */
2012#define SPACWALK_TARGET_HIT_BOTTOM_EN      NODE_01
2013#define SPACWALK_TARGET_HIT_MIDDLE_EN      NODE_02
2014#define SPACWALK_TARGET_HIT_TOP_EN         NODE_03
2015#define SPACWALK_SPRINGBOARD_HIT1_EN      NODE_04
2016#define SPACWALK_SPRINGBOARD_HIT2_EN      NODE_05
2017#define SPACWALK_SPRINGBOARD_MISS_EN      NODE_06
2018#define SPACWALK_SPACE_SHIP_EN            NODE_07
2019
2020/* Discrete Sound Output Nodes */
2021#define SPACWALK_NOISE                  NODE_10
2022#define SPACWALK_TARGET_HIT_SND            NODE_11
2023#define SPACWALK_SPRINGBOARD_HIT1_SND      NODE_12
2024#define SPACWALK_SPRINGBOARD_HIT2_SND      NODE_13
2025#define SPACWALK_SPRINGBOARD_MISS_SND      NODE_14
2026#define SPACWALK_SPACE_SHIP_SND            NODE_15
2027
2028/* Adjusters */
2029#define SPACWALK_R507_POT         NODE_19
2030
2031/* Parts List - Resistors */
2032#define SPACWALK_R200      RES_K(820)
2033#define SPACWALK_R201      RES_K(150)
2034#define SPACWALK_R202      RES_M(1)
2035#define SPACWALK_R203      RES_K(82)
2036#define SPACWALK_R204      RES_K(240)
2037#define SPACWALK_R205      RES_K(220)
2038#define SPACWALK_R206      RES_K(120)
2039#define SPACWALK_R207      RES_M(1)
2040#define SPACWALK_R208      RES_K(300)
2041#define SPACWALK_R210      RES_K(56)
2042#define SPACWALK_R211      RES_K(100)
2043#define SPACWALK_R213      RES_K(300)
2044#define SPACWALK_R214      RES_K(27)
2045#define SPACWALK_R215      RES_K(51)
2046#define SPACWALK_R216      RES_K(30)
2047#define SPACWALK_R300      RES_K(270)
2048#define SPACWALK_R301      RES_K(300)
2049#define SPACWALK_R302      RES_K(330)
2050#define SPACWALK_R303      RES_K(680)
2051#define SPACWALK_R304      RES_M(1)
2052#define SPACWALK_R305      RES_K(3680)
2053#define SPACWALK_R307      RES_K(20)
2054#define SPACWALK_R308      RES_K(20)   /* not labeled but it's beside R307 */
2055#define SPACWALK_R419      RES_K(2.7)
2056#define SPACWALK_R420      RES_K(20)
2057#define SPACWALK_R421      RES_K(11)
2058#define SPACWALK_R422      RES_K(75)
2059#define SPACWALK_R507      RES_M(1)
2060#define SPACWALK_RJ3      RES_K(1)
2061
2062/* Parts List - Capacitors */
2063#define SPACWALK_C200      CAP_U(0.0022)
2064#define SPACWALK_C201      CAP_U(3.3)
2065#define SPACWALK_C203      CAP_U(0.0033)
2066#define SPACWALK_C204      CAP_U(0.0033)
2067#define SPACWALK_C300      CAP_U(2.2)
2068#define SPACWALK_C301      CAP_U(2.2)
2069#define SPACWALK_C302      CAP_U(2.2)
2070#define SPACWALK_C303      CAP_U(0.0047)
2071#define SPACWALK_C304      CAP_U(0.0047)   /* not labeled but it's beside C303 */
2072#define SPACWALK_C602      CAP_U(1)
2073
2074
2075static const discrete_op_amp_tvca_info spacwalk_hit_tvca_info =
2076{
2077   SPACWALK_R304,   SPACWALK_R303, 0, SPACWALK_R305,   /* r1, r2, r3, r4 */
2078   SPACWALK_RJ3, 0, SPACWALK_R300,                  /* r5, r6, r7 */
2079   SPACWALK_RJ3, SPACWALK_R301,                  /* r8, r9 */
2080   SPACWALK_RJ3, SPACWALK_R302,                  /* r10, r11 */
2081   SPACWALK_C300, SPACWALK_C301, SPACWALK_C302,      /* c1, c2, c3 */
2082   5, 5, 5, 12,                              /* v1, v2, v3, vP */
2083   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2084   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2085   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
2086   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2087   DISC_OP_AMP_TRIGGER_FUNCTION_TRG1,
2088   DISC_OP_AMP_TRIGGER_FUNCTION_TRG2
2089};
2090
2091static const discrete_op_amp_osc_info spacwalk_sb_hit_vco =
2092{
2093   DISC_OP_AMP_OSCILLATOR_VCO_3 | DISC_OP_AMP_IS_NORTON,
2094   RES_K(330 + 150 + 30), SPACWALK_R203, SPACWALK_R201, SPACWALK_R204,   /* r1, r2, r3, r4 */
2095   SPACWALK_R202, 0, SPACWALK_R200, 0,                           /* r5, r6, r7, r8*/
2096   SPACWALK_C200, 12                                        /* c, vP*/
2097};
2098
2099static const discrete_op_amp_tvca_info spacwalk_sb_hit_tvca_info =
2100{
2101   SPACWALK_R207,   SPACWALK_R205, 0, SPACWALK_R208,   /* r1, r2, r3, r4 */
2102   SPACWALK_RJ3, 0, SPACWALK_R206,                  /* r5, r6, r7 */
2103   0, 0, 0, 0               ,                  /* r8, r9, r10, r11 */
2104   SPACWALK_C201, 0, 0,                        /* c1, c2, c3 */
2105   5, 0, 0, 12,                              /* v1, v2, v3, vP */
2106   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2107   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2108   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
2109   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2110   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2111   DISC_OP_AMP_TRIGGER_FUNCTION_NONE
2112};
2113
2114static const discrete_op_amp_osc_info spacwalk_spaceship_osc =
2115{
2116   DISC_OP_AMP_OSCILLATOR_2 | DISC_OP_AMP_IS_NORTON,
2117   RES_K(75), RES_M(1), RES_M(6.8), RES_M(2.4), 0, 0, 0, 0,   /* r1, r2, r3, r4, r5, r6, r7, r8 */
2118   CAP_U(2.2), 12                                    /* c, vP */
2119};
2120
2121static const discrete_op_amp_osc_info spacwalk_spaceship_vco =
2122{
2123   DISC_OP_AMP_OSCILLATOR_VCO_1 | DISC_OP_AMP_IS_NORTON | DISC_OP_AMP_OSCILLATOR_OUT_CAP,
2124   RES_K(680), RES_K(300), RES_K(100), RES_K(150), RES_K(120), 0, 0, 0,   /* r1, r2, r3, r4, r5, r6, r7, r8 */
2125   CAP_U(0.0012), 12                                          /* c, vP */
2126};
2127
2128static const discrete_mixer_desc spacwalk_mixer =
2129{
2130   DISC_MIXER_IS_RESISTOR,
2131   {SPACWALK_R422, SPACWALK_R422, RES_K(39 + 10 + 1), SPACWALK_R421, SPACWALK_R420, SPACWALK_R419},
2132   {0, 0, 0, 0, 0, SPACWALK_R507_POT},      /* r_nodes */
2133   {0}, 0, 0, 0, SPACWALK_C602, 0, 1      /* c, rI, rF, cF, cAmp, vRef, gain */
2134};
2135
2136
2137/************************************************
2138 * Springboard Hit Circuit   1 or 2
2139 ************************************************/
2140#define SPACWALK_SPRINGBOARD_HIT_CIRCUIT(_num)                                              \
2141DISCRETE_RCFILTER(NODE_RELATIVE(NODE_29, _num),                                             \
2142   1,                                    /* ENAB */                              \
2143   SPACWALK_NOISE,                           /* IN0 */                               \
2144   RES_K(330), CAP_U(.1))                                                                  \
2145DISCRETE_RCFILTER(NODE_RELATIVE(NODE_31, _num),                                             \
2146   1,                                    /* ENAB */                              \
2147   NODE_RELATIVE(NODE_29, _num),               /* IN0 */                               \
2148   RES_K(330) + RES_K(150), CAP_U(.1))                                                     \
2149DISCRETE_OP_AMP_VCO1(NODE_RELATIVE(NODE_33, _num),   /* IC M2-3, pin 5 */                    \
2150   1,                                    /* ENAB */                              \
2151   NODE_RELATIVE(NODE_31, _num),               /* VMOD1 */                             \
2152   &spacwalk_sb_hit_vco)                                                                   \
2153DISCRETE_OP_AMP_TRIG_VCA(NODE_RELATIVE(NODE_35, _num),            /* IC M2-3, pin 9 */    \
2154   NODE_RELATIVE(SPACWALK_SPRINGBOARD_HIT1_EN, _num - 1), 0, 0,   /* TRG0, TRG1, TRG2 */  \
2155   NODE_RELATIVE(NODE_33, _num), 0,                        /* IN0, IN1 */          \
2156   &spacwalk_sb_hit_tvca_info)                                                             \
2157/* Wrong values.  Untested */                                                               \
2158/* The rest of the circuit is a filter. */                                                  \
2159DISCRETE_FILTER2(NODE_RELATIVE(NODE_37, _num),                                              \
2160   1,                                    /* ENAB */                              \
2161   NODE_RELATIVE(NODE_35, _num),               /* INP0 */                              \
2162   2000.0 - _num * 500, 1.0/.8,               /* FREQ, DAMP */                        \
2163   DISC_FILTER_LOWPASS)                                                                    \
2164/* The filter has a gain of 0.5 */                                                          \
2165DISCRETE_GAIN(NODE_RELATIVE(SPACWALK_SPRINGBOARD_HIT1_SND, _num - 1),                       \
2166   NODE_RELATIVE(NODE_37, _num), 0.5)
2167
2168 static DISCRETE_SOUND_START(spacwalk)
2169
2170   /************************************************
2171     * Input register mapping
2172     ************************************************/
2173   DISCRETE_INPUT_LOGIC(SPACWALK_TARGET_HIT_BOTTOM_EN)
2174   DISCRETE_INPUT_LOGIC(SPACWALK_TARGET_HIT_MIDDLE_EN)
2175   DISCRETE_INPUT_LOGIC(SPACWALK_TARGET_HIT_TOP_EN)
2176   DISCRETE_INPUT_LOGIC(SPACWALK_SPRINGBOARD_HIT1_EN)
2177   DISCRETE_INPUT_LOGIC(SPACWALK_SPRINGBOARD_HIT2_EN)
2178   DISCRETE_INPUT_LOGIC(SPACWALK_SPRINGBOARD_MISS_EN)
2179   DISCRETE_INPUT_LOGIC(SPACWALK_SPACE_SHIP_EN)
2180
2181   /* The low value of the pot is set to 7000.  A real 1M pot will never go to 0 anyways. */
2182   /* This will give the control more apparent volume range. */
2183   /* The music way overpowers the rest of the sounds anyways. */
2184   DISCRETE_ADJUSTMENT_TAG(SPACWALK_R507_POT, SPACWALK_R507, 7000, DISC_LOGADJ, "R507")
2185
2186   /************************************************
2187     * Tone generator
2188     ************************************************/
2189   MIDWAY_TONE_GENERATOR(midway_music_tvca_info)
2190
2191   /************************************************
2192     * Target hit sounds
2193     * The LFSR is the same as boothill
2194     ************************************************/
2195   /* Noise clock was breadboarded and measured at 7700Hz */
2196   DISCRETE_LFSR_NOISE(SPACWALK_NOISE,         /* IC L4, pin 10 */
2197      1, 1,                           /* ENAB, RESET */
2198      7700, 12.0, 0, 12.0/2, &midway_lfsr)   /* CLK,AMPL,FEED,BIAS,LFSRTB */
2199
2200   DISCRETE_OP_AMP_TRIG_VCA(NODE_20,         /* IC K3, pin 9 */
2201      SPACWALK_TARGET_HIT_TOP_EN, SPACWALK_TARGET_HIT_MIDDLE_EN, SPACWALK_TARGET_HIT_BOTTOM_EN,
2202      SPACWALK_NOISE, 0,                  /* IN0, IN1 */
2203      &spacwalk_hit_tvca_info)
2204   DISCRETE_RCFILTER(NODE_21,
2205      1,                              /* ENAB */
2206      NODE_20,                        /* IN0 */
2207      SPACWALK_R307, SPACWALK_C303)
2208   DISCRETE_RCFILTER(SPACWALK_TARGET_HIT_SND,
2209      1,                              /* ENAB */
2210      NODE_21,                        /* IN0 */
2211      SPACWALK_R307 + SPACWALK_R308, SPACWALK_C304)
2212
2213   /************************************************
2214     * Springboard hit sounds
2215     ************************************************/
2216   /* Nodes 30 - 40 */
2217   SPACWALK_SPRINGBOARD_HIT_CIRCUIT(1)
2218   SPACWALK_SPRINGBOARD_HIT_CIRCUIT(2)
2219
2220   /************************************************
2221     * Springboard miss sound
2222     ************************************************/
2223   DISCRETE_CONSTANT(SPACWALK_SPRINGBOARD_MISS_SND, 0)
2224
2225   /************************************************
2226     * Space ship sound
2227     ************************************************/
2228   DISCRETE_OP_AMP_OSCILLATOR(NODE_60,         /* 2.2uF cap near IC JK-2 */
2229      1,                              /* ENAB */
2230      &spacwalk_spaceship_osc)
2231   DISCRETE_OP_AMP_VCO1(NODE_61,            /* IC JK-2, pin 5 */
2232      SPACWALK_SPACE_SHIP_EN,               /* ENAB */
2233      NODE_60,                        /* VMOD1*/
2234      &spacwalk_spaceship_vco)
2235   DISCRETE_RCFILTER(NODE_62,
2236      1,                              /* ENAB */
2237      NODE_61,                        /* IN0 */
2238      RES_K(1), CAP_U(0.15))
2239   DISCRETE_RCFILTER(SPACWALK_SPACE_SHIP_SND,
2240      1,                              /* ENAB */
2241      NODE_62,                        /* IN0 */
2242      RES_K(1) + RES_K(10), CAP_U(0.015))
2243
2244   /************************************************
2245     * Combine all sound sources.
2246     ************************************************/
2247   DISCRETE_MIXER6(NODE_90,
2248      1,                              /* ENAB */
2249      SPACWALK_SPRINGBOARD_HIT1_SND,
2250      SPACWALK_SPRINGBOARD_HIT2_SND,
2251      SPACWALK_SPACE_SHIP_SND,
2252      SPACWALK_SPRINGBOARD_MISS_SND,
2253      SPACWALK_TARGET_HIT_SND,
2254      MIDWAY_TONE_SND,
2255      &spacwalk_mixer)
2256   DISCRETE_OUTPUT(NODE_90, 11000)
2257DISCRETE_SOUND_END
2258
20672259MACHINE_DRIVER_START( spacwalk_audio )
20682260   MDRV_SPEAKER_STANDARD_MONO("mono")
2261
2262   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
2263   MDRV_SOUND_CONFIG_DISCRETE(spacwalk)
2264   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20692265MACHINE_DRIVER_END
20702266
2071WRITE8_HANDLER( spacwalk_audio_1_w )
2267WRITE8_DEVICE_HANDLER( spacwalk_audio_1_w )
20722268{
20732269   coin_counter_w(0, (data >> 0) & 0x01);
20742270
20752271   clowns_set_controller_select((data >> 1) & 0x01);
20762272
2077   // D2: ?
2078   // D3: ?
2079   // D4-7: unused?
2080   // if (data&0xfc) printf("%02x ",data);
2273   sound_global_enable(device->machine, (data >> 2) & 0x01);
2274
2275   discrete_sound_w(device, SPACWALK_SPACE_SHIP_EN, (data >> 3) & 0x01);
20812276}
20822277
2278WRITE8_DEVICE_HANDLER( spacwalk_audio_2_w )
2279{
2280   discrete_sound_w(device, SPACWALK_TARGET_HIT_BOTTOM_EN, (data >> 0) & 0x01);
20832281
2282   discrete_sound_w(device, SPACWALK_TARGET_HIT_MIDDLE_EN, (data >> 1) & 0x01);
20842283
2284   discrete_sound_w(device, SPACWALK_TARGET_HIT_TOP_EN, (data >> 2) & 0x01);
2285
2286   discrete_sound_w(device, SPACWALK_SPRINGBOARD_HIT1_EN, (data >> 3) & 0x01);
2287
2288   discrete_sound_w(device, SPACWALK_SPRINGBOARD_HIT2_EN, (data >> 4) & 0x01);
2289
2290   discrete_sound_w(device, SPACWALK_SPRINGBOARD_MISS_EN, (data >> 5) & 0x01);
2291}
2292
2293
2294
20852295/*************************************
20862296 *
20872297 *  Shuffleboard
r5955r5956
21312341 *
21322342 *************************************/
21332343
2134static const discrete_op_amp_tvca_info dogpatch_music_tvca_info =
2135{
2136   RES_M(3.3),
2137   RES_K(10) + RES_K(680),
2138   0,
2139   RES_K(680),
2140   RES_K(10),
2141   0,
2142   RES_K(680),
2143   0,
2144   0,
2145   0,
2146   0,
2147   CAP_U(.001),
2148   0,
2149   0,
2150   12,         /* v1 */
2151   0,         /* v2 */
2152   0,         /* v3 */
2153   12,         /* vP */
2154   DISC_OP_AMP_TRIGGER_FUNCTION_TRG0,
2155   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2156   DISC_OP_AMP_TRIGGER_FUNCTION_TRG1,
2157   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2158   DISC_OP_AMP_TRIGGER_FUNCTION_NONE,
2159   DISC_OP_AMP_TRIGGER_FUNCTION_NONE
2160};
21612344
2162
21632345static DISCRETE_SOUND_START(dogpatch)
21642346
21652347   /************************************************
21662348     * Tone generator
21672349     ************************************************/
2168   MIDWAY_TONE_GENERATOR(dogpatch_music_tvca_info)
2350   MIDWAY_TONE_GENERATOR(midway_music_tvca_info)
21692351
21702352   /************************************************
21712353     * Filter it to be AC.
r5955r5956
25722754               NODE_31,                     /* IN0 */
25732755               -0.5)                        /* IN1 */
25742756   DISCRETE_CLAMP(NODE_33,
2575               1,                           /* ENAB */
25762757               NODE_32,                     /* IN0 */
25772758               0,                           /* MIN */
2578               12,                           /* MAX */
2579               0)                           /* CLAMP */
2759               12)                           /* MAX */
25802760   DISCRETE_CRFILTER(NODE_34,
25812761               1,                           /* ENAB */
25822762               SPCENCTR_NOISE,                  /* IN0 */
r5955r5956
26402820               NODE_63,               /* IN0 */
26412821               6.8)                  /* IN1 */
26422822   DISCRETE_CLAMP(SPCENCTR_CRASH_SND,         /* IC C2, pin 5 */
2643               1,                     /* ENAB */
26442823               NODE_64,               /* IN0 */
26452824               0,                     /* MIN */
2646               12.0 - OP_AMP_NORTON_VBE,   /* MAX */
2647               0)                     /* CLAMP */
2825               12.0 - OP_AMP_NORTON_VBE)   /* MAX */
26482826
26492827
26502828   /************************************************
r5955r5956
35993777               INVADERS_NODE(71, _board),                        /* IN0 */               \
36003778               -0.5)                                       /* IN1 */               \
36013779   DISCRETE_CLAMP(INVADERS_NODE(73, _board),                                                  \
3602               1,                                          /* ENAB */              \
36033780               INVADERS_NODE(72, _board),                        /* IN0 */               \
36043781               0,                                          /* MIN */               \
3605               12,                                          /* MAX */               \
3606               0)                                          /* CLAMP */             \
3782               12)                                          /* MAX */               \
36073783   DISCRETE_CRFILTER(INVADERS_NODE(74, _board),                                               \
36083784               1,                                          /* ENAB */              \
36093785               INVADERS_NOISE,                                 /* IN0 */               \
src/mame/machine/cx4ops.c
r5955r5956
99***************************************************************************/
1010
1111//Sprite Functions
12void CX4_op00(running_machine* machine)
12static void CX4_op00(running_machine* machine)
1313{
1414   switch(cx4.reg[0x4d])
1515   {
r5955r5956
2424}
2525
2626//Draw Wireframe
27void CX4_op01(running_machine* machine)
27static void CX4_op01(running_machine* machine)
2828{
2929   memset(cx4.ram + 0x300, 0, 2304);
3030   CX4_C4DrawWireFrame(machine);
3131}
3232
3333//Propulsion
34void CX4_op05(running_machine *machine)
34static void CX4_op05(running_machine *machine)
3535{
3636   INT32 temp = 0x10000;
3737   if(CX4_readw(0x1f83))
r5955r5956
4242}
4343
4444//Set Vector length
45void CX4_op0d(running_machine *machine)
45static void CX4_op0d(running_machine *machine)
4646{
4747   cx4.C41FXVal    = CX4_readw(0x1f80);
4848   cx4.C41FYVal    = CX4_readw(0x1f83);
r5955r5956
5656}
5757
5858//Triangle
59void CX4_op10()
59static void CX4_op10(void)
6060{
6161   cx4.r0 = CX4_ldr(0);
6262   cx4.r1 = CX4_ldr(1);
r5955r5956
8484}
8585
8686//Triangle
87void CX4_op13()
87static void CX4_op13(void)
8888{
8989   cx4.r0 = CX4_ldr(0);
9090   cx4.r1 = CX4_ldr(1);
r5955r5956
108108}
109109
110110//Pythagorean
111void CX4_op15(running_machine *machine)
111static void CX4_op15(running_machine *machine)
112112{
113113   double temp = 0.0;
114114   cx4.C41FXVal = CX4_readw(0x1f80);
r5955r5956
119119}
120120
121121//Calculate distance
122void CX4_op1f(running_machine *machine)
122static void CX4_op1f(running_machine *machine)
123123{
124124   cx4.C41FXVal = CX4_readw(0x1f80);
125125   cx4.C41FYVal = CX4_readw(0x1f83);
r5955r5956
142142}
143143
144144//Trapezoid
145void CX4_op22()
145static void CX4_op22(void)
146146{
147147   INT16 angle1 = CX4_readw(0x1f8c) & 0x1ff;
148148   INT16 angle2 = CX4_readw(0x1f8f) & 0x1ff;
r5955r5956
198198}
199199
200200//Multiply
201void CX4_op25()
201static void CX4_op25(void)
202202{
203203   cx4.r0 = CX4_ldr(0);
204204   cx4.r1 = CX4_ldr(1);
r5955r5956
208208}
209209
210210//Transform Coords
211void CX4_op2d(running_machine *machine)
211static void CX4_op2d(running_machine *machine)
212212{
213213   cx4.C4WFXVal  = CX4_readw(0x1f81);
214214   cx4.C4WFYVal  = CX4_readw(0x1f84);
r5955r5956
223223}
224224
225225//Sum
226void CX4_op40()
226static void CX4_op40(void)
227227{
228228   UINT32 i;
229229   cx4.r0 = 0;
r5955r5956
235235}
236236
237237//Square
238void CX4_op54()
238static void CX4_op54(void)
239239{
240240   cx4.r0 = CX4_ldr(0);
241241   CX4_mul(cx4.r0, cx4.r0, &cx4.r1, &cx4.r2);
r5955r5956
244244}
245245
246246//Immediate Register
247void CX4_op5c()
247static void CX4_op5c(void)
248248{
249249   CX4_str(0, 0x000000);
250250   CX4_immediate_reg(0);
251251}
252252
253253//Immediate Register (Multiple)
254void CX4_op5e() { CX4_immediate_reg( 0); }
255void CX4_op60() { CX4_immediate_reg( 3); }
256void CX4_op62() { CX4_immediate_reg( 6); }
257void CX4_op64() { CX4_immediate_reg( 9); }
258void CX4_op66() { CX4_immediate_reg(12); }
259void CX4_op68() { CX4_immediate_reg(15); }
260void CX4_op6a() { CX4_immediate_reg(18); }
261void CX4_op6c() { CX4_immediate_reg(21); }
262void CX4_op6e() { CX4_immediate_reg(24); }
263void CX4_op70() { CX4_immediate_reg(27); }
264void CX4_op72() { CX4_immediate_reg(30); }
265void CX4_op74() { CX4_immediate_reg(33); }
266void CX4_op76() { CX4_immediate_reg(36); }
267void CX4_op78() { CX4_immediate_reg(39); }
268void CX4_op7a() { CX4_immediate_reg(42); }
269void CX4_op7c() { CX4_immediate_reg(45); }
254static void CX4_op5e(void) { CX4_immediate_reg( 0); }
255static void CX4_op60(void) { CX4_immediate_reg( 3); }
256static void CX4_op62(void) { CX4_immediate_reg( 6); }
257static void CX4_op64(void) { CX4_immediate_reg( 9); }
258static void CX4_op66(void) { CX4_immediate_reg(12); }
259static void CX4_op68(void) { CX4_immediate_reg(15); }
260static void CX4_op6a(void) { CX4_immediate_reg(18); }
261static void CX4_op6c(void) { CX4_immediate_reg(21); }
262static void CX4_op6e(void) { CX4_immediate_reg(24); }
263static void CX4_op70(void) { CX4_immediate_reg(27); }
264static void CX4_op72(void) { CX4_immediate_reg(30); }
265static void CX4_op74(void) { CX4_immediate_reg(33); }
266static void CX4_op76(void) { CX4_immediate_reg(36); }
267static void CX4_op78(void) { CX4_immediate_reg(39); }
268static void CX4_op7a(void) { CX4_immediate_reg(42); }
269static void CX4_op7c(void) { CX4_immediate_reg(45); }
270270
271271//Immediate ROM
272void CX4_op89()
272static void CX4_op89(void)
273273{
274274   CX4_str(0, 0x054336);
275275   CX4_str(1, 0xffffff);
src/mame/machine/bublbobl.c
r5955r5956
119119   }
120120}
121121
122WRITE8_HANDLER(soundcpu_reset_w)
122WRITE8_HANDLER( bublbobl_soundcpu_reset_w )
123123{
124124   cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, data ? ASSERT_LINE : CLEAR_LINE);
125125}
126126
127READ8_HANDLER( sound_status_r )
127READ8_HANDLER( bublbobl_sound_status_r )
128128{
129129   return sound_status;
130130}
131131
132WRITE8_HANDLER( sound_status_w )
132WRITE8_HANDLER( bublbobl_sound_status_w )
133133{
134134   sound_status = data;
135135}
src/mame/machine/cx4fn.c
r5955r5956
1717#define PI 3.1415926535897932384626433832795
1818
1919//Wireframe Helpers
20void CX4_C4TransfWireFrame(void)
20static void CX4_C4TransfWireFrame(void)
2121{
2222   cx4.c4x = (double)cx4.C4WFXVal;
2323   cx4.c4y = (double)cx4.C4WFYVal;
r5955r5956
4343   cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95);
4444}
4545
46void CX4_C4CalcWireFrame(void)
46static void CX4_C4CalcWireFrame(void)
4747{
4848   cx4.C4WFXVal = cx4.C4WFX2Val - cx4.C4WFXVal;
4949   cx4.C4WFYVal = cx4.C4WFY2Val - cx4.C4WFYVal;
r5955r5956
6666   }
6767}
6868
69void CX4_C4TransfWireFrame2(void)
69static void CX4_C4TransfWireFrame2(void)
7070{
7171   cx4.c4x = (double)cx4.C4WFXVal;
7272   cx4.c4y = (double)cx4.C4WFYVal;
r5955r5956
9292   cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / 0x100);
9393}
9494
95void CX4_C4DrawWireFrame(running_machine *machine)
95static void CX4_C4DrawWireFrame(running_machine *machine)
9696{
9797   UINT32 line = CX4_readl(0x1f80);
9898   UINT32 point1, point2;
r5955r5956
144144   }
145145}
146146
147void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color)
147static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color)
148148{
149149   INT32 i;
150150
r5955r5956
199199   }
200200}
201201
202void CX4_C4DoScaleRotate(int row_padding)
202static void CX4_C4DoScaleRotate(int row_padding)
203203{
204204   INT16 A, B, C, D;
205205   INT32 x, y;
src/mame/machine/snesdsp3.c
r5955r5956
1212
1313************************************************************************/
1414
15UINT16 DSP3_DataROM[1024];
15static UINT16 DSP3_DataROM[1024];
1616
17void (*SetDSP3)( void );
18void DSP3_Command( void );
17static void(*SetDSP3)(void);
18static void DSP3_Command(void);
1919
20UINT16 DSP3_DR;
21UINT16 DSP3_SR;
22UINT16 DSP3_MemoryIndex;
20static UINT16 DSP3_DR;
21static UINT16 DSP3_SR;
22static UINT16 DSP3_MemoryIndex;
2323
24void DSP3_Reset( void )
24static void DSP3_Reset(void)
2525{
2626   DSP3_DR = 0x0080;
2727   DSP3_SR = 0x0084;
2828   SetDSP3 = &DSP3_Command;
2929}
3030
31void DSP3_MemorySize( void )
31#ifdef UNUSED_FUNCTION
32void DSP3_MemorySize(void)
3233{
3334   DSP3_DR = 0x0300;
3435   SetDSP3 = &DSP3_Reset;
3536}
37#endif
3638
37void DSP3_TestMemory( void )
39static void DSP3_TestMemory(void)
3840{
3941   DSP3_DR = 0x0000;
4042   SetDSP3 = &DSP3_Reset;
4143}
4244
43void DSP3_DumpDataROM( void )
45static void DSP3_DumpDataROM(void)
4446{
4547   DSP3_DR = DSP3_DataROM[DSP3_MemoryIndex++];
4648   if (DSP3_MemoryIndex == 1024)
4749      SetDSP3 = &DSP3_Reset;
4850}
4951
50void DSP3_MemoryDump( void )
52static void DSP3_MemoryDump(void)
5153{
5254   DSP3_MemoryIndex = 0;
5355   SetDSP3 = &DSP3_DumpDataROM;
5456   DSP3_DumpDataROM();
5557}
5658
57INT16 DSP3_WinLo;
58INT16 DSP3_WinHi;
59static INT16 DSP3_WinLo;
60static INT16 DSP3_WinHi;
5961
60void DSP3_OP06( void )
62static void DSP3_OP06(void)
6163{
6264   DSP3_WinLo = (UINT8)(DSP3_DR);
6365   DSP3_WinHi = (UINT8)(DSP3_DR >> 8);
6466   DSP3_Reset();
6567}
6668
67void DSP3_OP03( void )
69static void DSP3_OP03(void)
6870{
6971   INT16 Lo = (UINT8)(DSP3_DR);
7072   INT16 Hi = (UINT8)(DSP3_DR >> 8);
r5955r5956
7375   SetDSP3 = &DSP3_Reset;
7476}
7577
76INT16 DSP3_AddLo;
77INT16 DSP3_AddHi;
78static INT16 DSP3_AddLo;
79static INT16 DSP3_AddHi;
7880
79void DSP3_OP07_B( void )
81static void DSP3_OP07_B(void)
8082{
8183   INT16 Ofs = (DSP3_WinLo * DSP3_AddHi << 1) + (DSP3_AddLo << 1);
8284   DSP3_DR = Ofs >> 1;
8385   SetDSP3 = &DSP3_Reset;
8486}
8587
86void DSP3_OP07_A( void )
88static void DSP3_OP07_A(void)
8789{
8890   INT16 Lo = (UINT8)(DSP3_DR);
8991   INT16 Hi = (UINT8)(DSP3_DR >> 8);
r5955r5956
109111   SetDSP3 = &DSP3_OP07_B;
110112}
111113
112void DSP3_OP07( void )
114static void DSP3_OP07(void)
113115{
114116   UINT32 dataOfs = ((DSP3_DR << 1) + 0x03b2) & 0x03ff;
115117
r5955r5956
120122   DSP3_SR = 0x0080;
121123}
122124
123UINT16 DSP3_Codewords;
124UINT16 DSP3_Outwords;
125UINT16 DSP3_Symbol;
126UINT16 DSP3_BitCount;
127UINT16 DSP3_Index;
128UINT16 DSP3_Codes[512];
129UINT16 DSP3_BitsLeft;
130UINT16 DSP3_ReqBits;
131UINT16 DSP3_ReqData;
132UINT16 DSP3_BitCommand;
133UINT8  DSP3_BaseLength;
134UINT16 DSP3_BaseCodes;
135UINT16 DSP3_BaseCode;
136UINT8  DSP3_CodeLengths[8];
137UINT16 DSP3_CodeOffsets[8];
138UINT16 DSP3_LZCode;
139UINT8  DSP3_LZLength;
125static UINT16 DSP3_Codewords;
126static UINT16 DSP3_Outwords;
127static UINT16 DSP3_Symbol;
128static UINT16 DSP3_BitCount;
129static UINT16 DSP3_Index;
130static UINT16 DSP3_Codes[512];
131static UINT16 DSP3_BitsLeft;
132static UINT16 DSP3_ReqBits;
133static UINT16 DSP3_ReqData;
134static UINT16 DSP3_BitCommand;
135static UINT8  DSP3_BaseLength;
136static UINT16 DSP3_BaseCodes;
137static UINT16 DSP3_BaseCode;
138static UINT8  DSP3_CodeLengths[8];
139static UINT16 DSP3_CodeOffsets[8];
140static UINT16 DSP3_LZCode;
141static UINT8  DSP3_LZLength;
140142
141UINT16 DSP3_X;
142UINT16 DSP3_Y;
143static UINT16 DSP3_X;
144static UINT16 DSP3_Y;
143145
144void DSP3_Coordinate( void )
146static void DSP3_Coordinate(void)
145147{
146148   DSP3_Index++;
147149
r5955r5956
178180   }
179181}
180182
181UINT8  DSP3_Bitmap[8];
182UINT8  DSP3_Bitplane[8];
183UINT16 DSP3_BMIndex;
184UINT16 DSP3_BPIndex;
185UINT16 DSP3_Count;
183static UINT8  DSP3_Bitmap[8];
184static UINT8  DSP3_Bitplane[8];
185static UINT16 DSP3_BMIndex;
186static UINT16 DSP3_BPIndex;
187static UINT16 DSP3_Count;
186188
187void DSP3_Convert_A( void )
189static void DSP3_Convert_A(void)
188190{
189191   if (DSP3_BMIndex < 8)
190192   {
r5955r5956
221223   }
222224}
223225
224void DSP3_Convert( void )
226static void DSP3_Convert(void)
225227{
226228   DSP3_Count = DSP3_DR;
227229   DSP3_BMIndex = 0;
228230   SetDSP3 = &DSP3_Convert_A;
229231}
230232
231UINT8 DSP3_GetBits(UINT8 Count)
233static UINT8 DSP3_GetBits(UINT8 Count)
232234{
233235   if (!DSP3_BitsLeft)
234236   {
r5955r5956
255257   return 1;
256258}
257259
258void DSP3_Decode_Data( void )
260static void DSP3_Decode_Data(void)
259261{
260262   if (!DSP3_BitCount)
261263   {
r5955r5956
328330   DSP3_DR = DSP3_Symbol;
329331}
330332
331void DSP3_Decode_Tree( void )
333static void DSP3_Decode_Tree(void)
332334{
333335   if (!DSP3_BitCount)
334336   {
r5955r5956
373375   if (DSP3_BitCount) DSP3_Decode_Data();
374376}
375377
376void DSP3_Decode_Symbols( void )
378static void DSP3_Decode_Symbols(void)
377379{
378380   DSP3_ReqData = DSP3_DR;
379381   DSP3_BitCount += 16;
r5955r5956
428430   if (DSP3_BitCount) DSP3_Decode_Tree();
429431}
430432
431void DSP3_Decode_A( void )
433static void DSP3_Decode_A(void)
432434{
433435   DSP3_Outwords = DSP3_DR;
434436   SetDSP3 = &DSP3_Decode_Symbols;
r5955r5956
440442   DSP3_SR = 0xC0;
441443}
442444
443void DSP3_Decode( void )
445static void DSP3_Decode(void)
444446{
445447   DSP3_Codewords = DSP3_DR;
446448   SetDSP3 = &DSP3_Decode_A;
r5955r5956
450452// Opcodes 1E/3E bit-perfect to 'dsp3-intro' log
451453// src: adapted from SD Gundam X/G-Next
452454
453INT16 op3e_x;
454INT16 op3e_y;
455static INT16 op3e_x;
456static INT16 op3e_y;
455457
456INT16 op1e_terrain[0x2000];
457INT16 op1e_cost[0x2000];
458INT16 op1e_weight[0x2000];
458static INT16 op1e_terrain[0x2000];
459static INT16 op1e_cost[0x2000];
460static INT16 op1e_weight[0x2000];
459461
460INT16 op1e_cell;
461INT16 op1e_turn;
462INT16 op1e_search;
462static INT16 op1e_cell;
463static INT16 op1e_turn;
464static INT16 op1e_search;
463465
464INT16 op1e_x;
465INT16 op1e_y;
466static INT16 op1e_x;
467static INT16 op1e_y;
466468
467INT16 op1e_min_radius;
468INT16 op1e_max_radius;
469static INT16 op1e_min_radius;
470static INT16 op1e_max_radius;
469471
470INT16 op1e_max_search_radius;
471INT16 op1e_max_path_radius;
472static INT16 op1e_max_search_radius;
473static INT16 op1e_max_path_radius;
472474
473INT16 op1e_lcv_radius;
474INT16 op1e_lcv_steps;
475INT16 op1e_lcv_turns;
475static INT16 op1e_lcv_radius;
476static INT16 op1e_lcv_steps;
477static INT16 op1e_lcv_turns;
476478
477void DSP3_OP3E( void )
479static void DSP3_OP3E(void)
478480{
479481   op3e_x = (UINT8)(DSP3_DR & 0x00ff);
480482   op3e_y = (UINT8)((DSP3_DR & 0xff00)>>8);
r5955r5956
489491   op1e_max_path_radius = 0;
490492}
491493
492void DSP3_OP1E_A( void );
493void DSP3_OP1E_A1( void );
494void DSP3_OP1E_A2( void );
495void DSP3_OP1E_A3( void );
494static void DSP3_OP1E_A(void);
495static void DSP3_OP1E_A1(void);
496static void DSP3_OP1E_A2(void);
497static void DSP3_OP1E_A3(void);
496498
497void DSP3_OP1E_B( void );
498void DSP3_OP1E_B1( void );
499void DSP3_OP1E_B2( void );
499static void DSP3_OP1E_B(void);
500static void DSP3_OP1E_B1(void);
501static void DSP3_OP1E_B2(void);
500502
501void DSP3_OP1E_C( void );
502void DSP3_OP1E_C1( void );
503void DSP3_OP1E_C2( void );
503static void DSP3_OP1E_C(void);
504static void DSP3_OP1E_C1(void);
505static void DSP3_OP1E_C2(void);
504506
505void DSP3_OP1E_D( INT16, INT16 *, INT16 * );
506void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi );
507static void DSP3_OP1E_D( INT16, INT16 *, INT16 * );
508static void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi );
507509
508void DSP3_OP1E( void )
510static void DSP3_OP1E(void)
509511{
510512   int lcv;
511513
r5955r5956
536538   DSP3_OP1E_A();
537539}
538540
539void DSP3_OP1E_A( void )
541static void DSP3_OP1E_A(void)
540542{
541543   int lcv;
542544
r5955r5956
582584   SetDSP3 = &DSP3_OP1E_A1;
583585}
584586
585void DSP3_OP1E_A1( void )
587static void DSP3_OP1E_A1(void)
586588{
587589   DSP3_SR = 0x0084;
588590   SetDSP3 = &DSP3_OP1E_A2;
589591}
590592
591void DSP3_OP1E_A2( void )
593static void DSP3_OP1E_A2(void)
592594{
593595   op1e_terrain[ op1e_cell ] = (UINT8)(DSP3_DR & 0x00ff);
594596
r5955r5956
596598   SetDSP3 = &DSP3_OP1E_A3;
597599}
598600
599void DSP3_OP1E_A3( void )
601static void DSP3_OP1E_A3(void)
600602{
601603   op1e_cost[ op1e_cell ] = (UINT8)(DSP3_DR & 0x00ff);
602604
r5955r5956
619621}
620622
621623
622void DSP3_OP1E_B( void )
624static void DSP3_OP1E_B(void)
623625{
624626   op1e_x = op3e_x;
625627   op1e_y = op3e_y;
r5955r5956
633635}
634636
635637
636void DSP3_OP1E_B1( void )
638static void DSP3_OP1E_B1(void)
637639{
638640   while( op1e_lcv_radius < op1e_max_radius ) {
639641      op1e_y--;
r5955r5956
673675}
674676
675677
676void DSP3_OP1E_B2( void )
678static void DSP3_OP1E_B2(void)
677679{
678680   INT16 cell;
679681   INT16 path;
r5955r5956
713715}
714716
715717
716void DSP3_OP1E_C( void )
718static void DSP3_OP1E_C(void)
717719{
718720   int lcv;
719721
r5955r5956
745747}
746748
747749
748void DSP3_OP1E_C1( void )
750static void DSP3_OP1E_C1(void)
749751{
750752   int lcv;
751753
r5955r5956
792794}
793795
794796
795void DSP3_OP1E_C2( void )
797static void DSP3_OP1E_C2(void)
796798{
797799   DSP3_DR = op1e_weight[ op1e_cell ];
798800
r5955r5956
804806}
805807
806808
807void DSP3_OP1E_D( INT16 move, INT16 *lo, INT16 *hi )
809static void DSP3_OP1E_D( INT16 move, INT16 *lo, INT16 *hi )
808810{
809811   UINT32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff;
810812   INT16 Lo;
r5955r5956
838840}
839841
840842
841void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi )
843static void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi )
842844{
843845   //UINT32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff;
844846   INT16 Lo;
r5955r5956
871873}
872874
873875
874void DSP3_OP10( void )
876static void DSP3_OP10(void)
875877{
876878   if( DSP3_DR == 0xffff ) {
877879      DSP3_Reset();
r5955r5956
881883   }
882884}
883885
884
885void DSP3_OP0C_A( void )
886#ifdef UNUSED_FUNCTION
887static void DSP3_OP0C_A(void)
886888{
887889   // absorb 2 bytes
888890
889891   DSP3_DR = 0;
890892   SetDSP3 = &DSP3_Reset;
891893}
894#endif
892895
893
894void DSP3_OP0C( void )
896static void DSP3_OP0C(void)
895897{
896898   // absorb 2 bytes
897899
r5955r5956
901903}
902904
903905
904void DSP3_OP1C_C( void )
906static void DSP3_OP1C_C(void)
905907{
906908   // return 2 bytes
907909   DSP3_DR = 0;
r5955r5956
909911}
910912
911913
912void DSP3_OP1C_B( void )
914static void DSP3_OP1C_B(void)
913915{
914916   // absorb 2 bytes
915917
r5955r5956
919921}
920922
921923
922void DSP3_OP1C_A( void )
924static void DSP3_OP1C_A(void)
923925{
924926   // absorb 2 bytes
925927
r5955r5956
927929}
928930
929931
930void DSP3_OP1C( void )
932static void DSP3_OP1C(void)
931933{
932934   // absorb 2 bytes
933935
r5955r5956
935937}
936938
937939
938void DSP3_Command( void )
940static void DSP3_Command(void)
939941{
940942   if (DSP3_DR < 0x40)
941943   {
r5955r5956
963965}
964966
965967
966void DSP3_write( UINT16 dsp3_address, UINT8 dsp3_byte )
968static void DSP3_write( UINT16 dsp3_address, UINT8 dsp3_byte )
967969{
968970  if (dsp3_address < 0xC000)
969971  {
r5955r5956
987989  }
988990}
989991
990UINT8 DSP3_read( UINT16 dsp3_address )
992static UINT8 DSP3_read( UINT16 dsp3_address )
991993{
992994  UINT8 value;
993995  if (dsp3_address < 0xC000)
r5955r5956
10191021  return value;
10201022}
10211023
1022void InitDSP3( running_machine *machine )
1024static void InitDSP3( running_machine *machine )
10231025{
10241026   UINT32 i;
10251027   UINT8 *dspin = memory_region(machine, "addons");
src/mame/machine/segas24.c
r5955r5956
77   just made a copy & renamed them for now to avoid any conflicts
88*/
99
10#ifdef UNUSED_FUNCTION
1011UINT16 *system24temp_sys16_shared_ram;
1112READ16_HANDLER( system24temp_sys16_shared_ram_r )
1213{
r5955r5956
1718{
1819   COMBINE_DATA(system24temp_sys16_shared_ram + offset);
1920}
21#endif
2022
2123/* The 315-5296
2224     8 8bits I/O ports, 3 output-only pins, some protection, and
src/mame/machine/scramble.c
r5955r5956
206206{
207207}
208208
209DRIVER_INIT( scobra )
209static DRIVER_INIT( scobra )
210210{
211211   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa803, 0xa803, 0, 0, scrambold_background_enable_w);
212212}
213213
214#ifdef UNUSED_FUNCTION
214215DRIVER_INIT( atlantis )
215216{
216217   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, scrambold_background_enable_w);
r5955r5956
220221{
221222   DRIVER_INIT_CALL(atlantis);
222223}
224#endif
223225
224226DRIVER_INIT( stratgyx )
225227{
r5955r5956
250252   /*memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, (write8_space_func)SMH_NOP);*/
251253}
252254
255#ifdef UNUSED_FUNCTION
253256DRIVER_INIT( frogger )
254257{
255258   offs_t A;
r5955r5956
276279   for (A = 0;A < 0x0800;A++)
277280      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
278281}
282#endif
279283
280284DRIVER_INIT( devilfsh )
281285{
r5955r5956
396400}
397401
398402
403#ifdef UNUSED_FUNCTION
399404DRIVER_INIT( anteater )
400405{
401406   offs_t i, len;
r5955r5956
432437
433438      free(scratch);
434439}
440#endif
435441
436442DRIVER_INIT( rescue )
437443{
r5955r5956
507513      free(scratch);
508514}
509515
516#ifdef UNUSED_FUNCTION
510517DRIVER_INIT( losttomb )
511518{
512519   offs_t i, len;
r5955r5956
543550
544551      free(scratch);
545552}
553#endif
546554
547
548555DRIVER_INIT( hustler )
549556{
550557   offs_t A;
src/mame/machine/snescx4.c
r5955r5956
1010
1111***************************************************************************/
1212
13#include "driver.h"
1314#include "snescx4.h"
15
16static CX4 cx4;
17
18static UINT8 CX4_read(UINT32 addr);
19static UINT16 CX4_readw(UINT16 addr);
20static UINT32 CX4_readl(UINT16 addr);
21
22static void CX4_write(running_machine *machine, UINT32 addr, UINT8 data);
23static void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data);
24//static void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data);
25
26static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color);
27
1428#include "cx4data.c"
1529#include "cx4fn.c"
16#include "cx4oam.c"
17#include "cx4ops.c"
1830
19UINT32 CX4_ldr(UINT8 r)
31static UINT32 CX4_ldr(UINT8 r)
2032{
2133   UINT16 addr = 0x0080 + (r * 3);
2234   return (cx4.reg[addr + 0] <<  0)
r5955r5956
2436        | (cx4.reg[addr + 2] << 16);
2537}
2638
27void CX4_str(UINT8 r, UINT32 data)
39static void CX4_str(UINT8 r, UINT32 data)
2840{
2941   UINT16 addr = 0x0080 + (r * 3);
3042   cx4.reg[addr + 0] = (data >>  0);
r5955r5956
3244   cx4.reg[addr + 2] = (data >> 16);
3345}
3446
35void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh)
47static void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh)
3648{
3749   INT64 rx = x & 0xffffff;
3850   INT64 ry = y & 0xffffff;
r5955r5956
4557   *rh = (rx >> 24) & 0xffffff;
4658}
4759
48UINT32 CX4_sin(UINT32 rx)
60static UINT32 CX4_sin(UINT32 rx)
4961{
5062   cx4.r0 = rx & 0x1ff;
5163   if(cx4.r0 & 0x100)
r5955r5956
6678   }
6779}
6880
69UINT32 CX4_cos(UINT32 rx)
81static UINT32 CX4_cos(UINT32 rx)
7082{
7183   return CX4_sin(rx + 0x080);
7284}
7385
74void CX4_immediate_reg(UINT32 start)
86static void CX4_immediate_reg(UINT32 start)
7587{
7688   UINT32 i = 0;
7789   cx4.r0 = CX4_ldr(0);
r5955r5956
8698   CX4_str(0, cx4.r0);
8799}
88100
89void CX4_transfer_data(running_machine *machine)
101static void CX4_transfer_data(running_machine *machine)
90102{
91103   UINT32 src;
92104   UINT16 dest, count;
r5955r5956
102114   }
103115}
104116
105void CX4_write(running_machine *machine, UINT32 addr, UINT8 data)
117#include "cx4oam.c"
118#include "cx4ops.c"
119
120static void CX4_write(running_machine *machine, UINT32 addr, UINT8 data)
106121{
107122   addr &= 0x1fff;
108123
r5955r5956
176191   }
177192}
178193
194#ifdef UNUSED_FUNCTION
179195void CX4_writeb(running_machine *machine, UINT16 addr, UINT8 data)
180196{
181197   CX4_write(machine, addr,     data);
182198}
199#endif
183200
184void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data)
201static void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data)
185202{
186203   CX4_write(machine, addr + 0, data >> 0);
187204   CX4_write(machine, addr + 1, data >> 8);
188205}
189206
207#ifdef UNUSED_FUNCTION
190208void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data)
191209{
192210   CX4_write(machine, addr + 0, data >>  0);
193211   CX4_write(machine, addr + 1, data >>  8);
194212   CX4_write(machine, addr + 2, data >> 16);
195213}
214#endif
196215
197UINT8 CX4_read(UINT32 addr)
216static UINT8 CX4_read(UINT32 addr)
198217{
199218   addr &= 0x1fff;
200219
r5955r5956
211230   return 0xff;
212231}
213232
233#ifdef UNUSED_FUNCTION
214234UINT8 CX4_readb(UINT16 addr)
215235{
216236   return CX4_read(addr);
217237}
238#endif
218239
219UINT16 CX4_readw(UINT16 addr)
240static UINT16 CX4_readw(UINT16 addr)
220241{
221242   return CX4_read(addr) | (CX4_read(addr + 1) << 8);
222243}
223244
224UINT32 CX4_readl(UINT16 addr)
245static UINT32 CX4_readl(UINT16 addr)
225246{
226247   return CX4_read(addr) | (CX4_read(addr + 1) << 8) | (CX4_read(addr + 2) << 16);
227248}
228249
250#ifdef UNUSED_FUNCTION
229251void CX4_reset()
230252{
231253   memset(cx4.ram, 0, 0x0c00);
232254   memset(cx4.reg, 0, 0x0100);
233255}
256#endif
257
src/mame/machine/snescx4.h
r5955r5956
88
99***************************************************************************/
1010
11#include "driver.h"
12
1311typedef struct
1412{
1513       UINT8 ram[0x0c00];
r5955r5956
2422       double c4x, c4y, c4z;
2523       double c4x2, c4y2, c4z2;
2624} CX4;
27
28static CX4 cx4;
29
30UINT32 CX4_ldr(UINT8 r);
31void   CX4_str(UINT8 r, UINT32 data);
32void   CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh);
33UINT32 CX4_sin(UINT32 rx);
34UINT32 CX4_cos(UINT32 rx);
35
36void   CX4_transfer_data(running_machine *machine);
37void   CX4_immediate_reg(UINT32 num);
38
39void   CX4_op00_00(running_machine *machine);
40void   CX4_op00_03(void);
41void   CX4_op00_05(running_machine *machine);
42void   CX4_op00_07(void);
43void   CX4_op00_08(running_machine *machine);
44void   CX4_op00_0b(running_machine *machine);
45void   CX4_op00_0c(running_machine *machine);
46
47void   CX4_op00(running_machine* machine);
48void   CX4_op01(running_machine* machine);
49void   CX4_op05(running_machine *machine);
50void   CX4_op0d(running_machine *machine);
51void   CX4_op10(void);
52void   CX4_op13(void);
53void   CX4_op15(running_machine *machine);
54void   CX4_op1f(running_machine *machine);
55void   CX4_op22(void);
56void   CX4_op25(void);
57void   CX4_op2d(running_machine *machine);
58void   CX4_op40(void);
59void   CX4_op54(void);
60void   CX4_op5c(void);
61void   CX4_op5e(void);
62void   CX4_op60(void);
63void   CX4_op62(void);
64void   CX4_op64(void);
65void   CX4_op66(void);
66void   CX4_op68(void);
67void   CX4_op6a(void);
68void   CX4_op6c(void);
69void   CX4_op6e(void);
70void   CX4_op70(void);
71void   CX4_op72(void);
72void   CX4_op74(void);
73void   CX4_op76(void);
74void   CX4_op78(void);
75void   CX4_op7a(void);
76void   CX4_op7c(void);
77void   CX4_op89(void);
78
79UINT8 CX4_readb(UINT16 addr);
80UINT16 CX4_readw(UINT16 addr);
81UINT32 CX4_readl(UINT16 addr);
82
83void CX4_writeb(running_machine *machine, UINT16 addr, UINT8 data);
84void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data);
85void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data);
86
87void CX4_reset(void);
88
89UINT8 CX4_read(UINT32 addr);
90void CX4_write(running_machine *machine, UINT32 addr, UINT8 data);
91
92void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color);
src/mame/machine/balsente.c
r5955r5956
2424
2525/* global data */
2626UINT8 balsente_shooter;
27UINT8 balsente_shooter_x;
28UINT8 balsente_shooter_y;
27static UINT8 balsente_shooter_x;
28static UINT8 balsente_shooter_y;
2929UINT8 balsente_adc_shift;
3030UINT16 *shrike_shared;
3131UINT16 *shrike_io;
src/mame/machine/snesdsp4.c
r5955r5956
2727
2828#include "snesdsp4.h"
2929
30struct DSP4_t DSP4;
31struct DSP4_vars_t DSP4_vars;
30static struct DSP4_t DSP4;
31static struct DSP4_vars_t DSP4_vars;
3232
3333INLINE UINT16 READ_WORD(UINT8 *addr)
3434{
r5955r5956
142142                                    0x0333, 0x031f, 0x030c, 0x02fa, 0x02e8, 0x02d8, 0x02c8, 0x02b9, 0x02aa, 0x029c,
143143                                    0x028f, 0x0282, 0x0276, 0x026a, 0x025e, 0x0253, 0x0249, 0x023e, 0x0234, 0x022b,
144144                                    0x0222, 0x0219, 0x0210, 0x0208,  };
145INT16 DSP4_Inverse(INT16 value)
145static INT16 DSP4_Inverse(INT16 value)
146146{
147147  // saturate bounds
148148  if (value < 0)
r5955r5956
160160//////////////////////////////////////////////////////////////
161161
162162// Prototype
163void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop);
163static void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop);
164164
165165//////////////////////////////////////////////////////////////
166166
167167// OP00
168void DSP4_Multiply(INT16 Multiplicand, INT16 Multiplier, INT32 *Product)
168static void DSP4_Multiply(INT16 Multiplicand, INT16 Multiplier, INT32 *Product)
169169{
170170  *Product = (Multiplicand * Multiplier << 1) >> 1;
171171}
r5955r5956
173173//////////////////////////////////////////////////////////////
174174
175175
176void DSP4_OP01( void )
176static void DSP4_OP01( void )
177177{
178178  DSP4.waiting4command = 0;
179179
r5955r5956
388388//////////////////////////////////////////////////////////////
389389
390390
391void DSP4_OP03( void )
391static void DSP4_OP03( void )
392392{
393393  DSP4_vars.OAM_RowMax = 33;
394394  memset(DSP4_vars.OAM_Row, 0, 64);
r5955r5956
398398//////////////////////////////////////////////////////////////
399399
400400
401void DSP4_OP05( void )
401static void DSP4_OP05( void )
402402{
403403  DSP4_vars.OAM_index = 0;
404404  DSP4_vars.OAM_bits = 0;
r5955r5956
409409
410410//////////////////////////////////////////////////////////////
411411
412void DSP4_OP06( void )
412static void DSP4_OP06( void )
413413{
414414  DSP4_CLEAR_OUT();
415415  DSP4_WRITE_16_WORD(DSP4_vars.OAM_attr);
r5955r5956
418418//////////////////////////////////////////////////////////////
419419
420420
421void DSP4_OP07( void )
421static void DSP4_OP07( void )
422422{
423423  DSP4.waiting4command = 0;
424424
r5955r5956
587587
588588//////////////////////////////////////////////////////////////
589589
590void DSP4_OP08( void )
590static void DSP4_OP08( void )
591591{
592592  INT16 win_left, win_right;
593593  INT16 view_x[2], view_y[2];
r5955r5956
918918
919919//////////////////////////////////////////////////////////////
920920
921void DSP4_OP09( void )
921static void DSP4_OP09( void )
922922{
923923  DSP4.waiting4command = 0;
924924
r5955r5956
11811181
11821182//////////////////////////////////////////////////////////////
11831183
1184const UINT16 OP0A_Values[16] = { 0x0000, 0x0030, 0x0060, 0x0090, 0x00c0, 0x00f0, 0x0120, 0x0150, 0xfe80,
1184static const UINT16 OP0A_Values[16] = { 0x0000, 0x0030, 0x0060, 0x0090, 0x00c0, 0x00f0, 0x0120, 0x0150, 0xfe80,
11851185                                 0xfeb0, 0xfee0, 0xff10, 0xff40, 0xff70, 0xffa0, 0xffd0 };
11861186
1187void DSP4_OP0A(INT16 n2, INT16 *o1, INT16 *o2, INT16 *o3, INT16 *o4)
1187static void DSP4_OP0A(INT16 n2, INT16 *o1, INT16 *o2, INT16 *o3, INT16 *o4)
11881188{
11891189  *o4 = OP0A_Values[(n2 & 0x000f)];
11901190  *o3 = OP0A_Values[(n2 & 0x00f0) >> 4];
r5955r5956
11941194
11951195//////////////////////////////////////////////////////////////
11961196
1197void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop)
1197static void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop)
11981198{
11991199  INT16 Row1, Row2;
12001200
r5955r5956
12791279
12801280//////////////////////////////////////////////////////////////
12811281
1282void DSP4_OP0D( void )
1282static void DSP4_OP0D( void )
12831283{
12841284  DSP4.waiting4command = 0;
12851285
r5955r5956
14671467//////////////////////////////////////////////////////////////
14681468
14691469
1470void DSP4_OP0E( void )
1470static void DSP4_OP0E( void )
14711471{
14721472  DSP4_vars.OAM_RowMax = 16;
14731473  memset(DSP4_vars.OAM_Row, 0, 64);
r5955r5956
14761476
14771477//////////////////////////////////////////////////////////////
14781478
1479void DSP4_OP0F( void )
1479static void DSP4_OP0F( void )
14801480{
14811481  DSP4.waiting4command = 0;
14821482
r5955r5956
17271727//////////////////////////////////////////////////////////////
17281728
17291729
1730void DSP4_OP10( void )
1730static void DSP4_OP10( void )
17311731{
17321732  DSP4.waiting4command = 0;
17331733
r5955r5956
19351935
19361936//////////////////////////////////////////////////////////////
19371937
1938void DSP4_OP11(INT16 A, INT16 B, INT16 C, INT16 D, INT16 *M)
1938static void DSP4_OP11(INT16 A, INT16 B, INT16 C, INT16 D, INT16 *M)
19391939{
19401940  // 0x155 = 341 = Horizontal Width of the Screen
19411941  *M = ((A * 0x0155 >> 2) & 0xf000) |
r5955r5956
19521952//Processing Code
19531953/////////////////////////////////////////////////////////////
19541954
1955void InitDSP4( void )
1955static void InitDSP4( void )
19561956{
19571957  memset(&DSP4, 0, sizeof(DSP4));
19581958  DSP4.waiting4command = 1;
19591959}
19601960
1961void DSP4_write( UINT8 dsp4_byte )
1961static void DSP4_write( UINT8 dsp4_byte )
19621962{
19631963  // clear pending read
19641964  if (DSP4.out_index < DSP4.out_count)
r5955r5956
21592159  }
21602160}
21612161
2162UINT8 DSP4_read( void )
2162static UINT8 DSP4_read( void )
21632163{
21642164  UINT8 value;
21652165
src/mame/machine/snesdsp4.h
r5955r5956
1818  UINT8 output[512];
1919};
2020
21extern struct DSP4_t DSP4;
22
2321struct DSP4_vars_t
2422{
2523  // op control
r5955r5956
9997  INT16 OAM_Row[32];          // current number of tiles per row
10098};
10199
102extern struct DSP4_vars_t DSP4_vars;
103
104100#endif
src/mame/machine/snesst10.c
r5955r5956
486486
487487// init, reset & handlers
488488
489UINT8 st010_read( UINT16 address )
489static UINT8 st010_read( UINT16 address )
490490{
491491   return st010_readb(address);
492492}
493493
494void st010_write( UINT16 address, UINT8 data )
494static void st010_write( UINT16 address, UINT8 data )
495495{
496496   st010_writeb(address, data);
497497
r5955r5956
514514}
515515
516516
517void st010_init( running_machine* machine )
517static void st010_init( running_machine* machine )
518518{
519519   snes_st010.ram = (UINT8*)auto_alloc_array(machine, UINT8, 0x1000);
520520}
521521
522void st010_reset( void )
522static void st010_reset( void )
523523{
524524   snes_st010.x1 = 0;
525525   snes_st010.y1 = 0;
src/mame/machine/namcos2.c
r5955r5956
1717extern void namcos21_kickstart(running_machine *, int);
1818
1919static TIMER_CALLBACK( namcos2_posirq_tick );
20static void InitC148(void);
21
2022static emu_timer *namcos2_posirq_timer;
2123
2224int namcos2_gametype;
r5955r5956
110112MACHINE_RESET( namcos2 )
111113{
112114   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
113   int loop;
114115   mFinalLapProtCount = 0;
115116   namcos2_mcu_analog_ctrl = 0;
116117   namcos2_mcu_analog_data = 0xaa;
r5955r5956
126127   ResetAllSubCPUs( machine, ASSERT_LINE );
127128
128129   /* Initialise interrupt handlers */
129   for(loop = 0; loop < 0x20; loop++)
130   {
131      namcos2_68k_master_C148[loop] = 0;
132      namcos2_68k_slave_C148[loop] = 0;
133      namcos2_68k_gpu_C148[loop] = 0;
134   }
130   InitC148();
135131
136132   /* reset POSIRQ timer */
137133   timer_adjust_oneshot(namcos2_posirq_timer, attotime_never, 0);
r5955r5956
190186/* 68000 Shared serial communications processor (CPU5?)       */
191187/**************************************************************/
192188
193UINT16  namcos2_68k_serial_comms_ctrl[0x8];
189static UINT16  namcos2_68k_serial_comms_ctrl[0x8];
194190UINT16 *namcos2_68k_serial_comms_ram;
195191
196192READ16_HANDLER( namcos2_68k_serial_comms_ram_r ){
r5955r5956
458454#define FRAME_TIME      (1.0/60.0)
459455#define LINE_LENGTH    (FRAME_TIME/NO_OF_LINES)
460456
461UINT16  namcos2_68k_master_C148[0x20];
462UINT16  namcos2_68k_slave_C148[0x20];
463UINT16  namcos2_68k_gpu_C148[0x20];
457static UINT16  namcos2_68k_master_C148[0x20];
458static UINT16  namcos2_68k_slave_C148[0x20];
459static UINT16  namcos2_68k_gpu_C148[0x20];
464460
465461
466462static int IsSystem21( void )
r5955r5956
479475   }
480476}
481477
478static void InitC148(void)
479{
480   int loop;
481
482   for(loop = 0; loop < 0x20; loop++)
483   {
484      namcos2_68k_master_C148[loop] = 0;
485      namcos2_68k_slave_C148[loop] = 0;
486      namcos2_68k_gpu_C148[loop] = 0;
487   }
488}
489
482490static UINT16
483491ReadWriteC148( const address_space *space, offs_t offset, UINT16 data, int bWrite )
484492{
src/mame/machine/cx4data.c
r5955r5956
88
99***************************************************************************/
1010
11const UINT8 CX4_immediate_data[48] =
11static const UINT8 CX4_immediate_data[48] =
1212{
1313   0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
1414   0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0xff, 0x7f,
r5955r5956
1616   0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x01, 0x00, 0xff, 0xfe, 0x00
1717};
1818
19const UINT16 CX4_wave_data[40] =
19static const UINT16 CX4_wave_data[40] =
2020{
2121   0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e,
2222   0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020a, 0x020c, 0x020e,
r5955r5956
2525   0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080a, 0x080c, 0x080e
2626};
2727
28const UINT32 CX4_sin_table[256] =
28static const UINT32 CX4_sin_table[256] =
2929{
3030   0x000000, 0x000324, 0x000648, 0x00096c, 0x000c8f, 0x000fb2, 0x0012d5, 0x0015f6,
3131   0x001917, 0x001c37, 0x001f56, 0x002273, 0x002590, 0x0028aa, 0x002bc4, 0x002edb,
r5955r5956
6161   0xff013b, 0xff00f1, 0xff00b1, 0xff007b, 0xff004e, 0xff002c, 0xff0013, 0xff0004
6262};
6363
64const INT16 CX4_SinTable[512] =
64static const INT16 CX4_SinTable[512] =
6565{
6666       0,   402,    804,   1206,    1607,    2009,    2410,    2811,
6767     3211,    3611,    4011,    4409,    4808,    5205,    5602,    5997,
r5955r5956
129129    -3211,   -2811,   -2410,   -2009,   -1607,   -1206,    -804,    -402
130130};
131131
132const INT16 CX4_CosTable[512] =
132static const INT16 CX4_CosTable[512] =
133133{
134134    32767,   32765,   32758,   32745,   32728,   32706,   32679,   32647,
135135    32610,   32568,   32521,   32469,   32413,   32351,   32285,   32214,
src/mame/machine/archimds.c
r5955r5956
3737
3838static const int page_sizes[4] = { 4096, 8192, 16384, 32768 };
3939
40UINT32 *memc_physmem;
40UINT32 *archimedes_memc_physmem;
4141static UINT32 memc_pagesize;
4242static int memc_latchrom;
4343static INT16 memc_pages[(32*1024*1024)/(4096)];   // the logical RAM area is 32 megs, and the smallest page size is 4k
r5955r5956
175175   timer_adjust_oneshot(snd_timer, attotime_never, 0);
176176}
177177
178READ32_HANDLER(memc_logical_r)
178READ32_HANDLER(archimedes_memc_logical_r)
179179{
180180   UINT32 page, poffs;
181181
r5955r5956
198198
199199      if (memc_pages[page] != -1)
200200      {
201         return memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2];
201         return archimedes_memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2];
202202      }
203203      else
204204      {
r5955r5956
209209   return 0;
210210}
211211
212WRITE32_HANDLER(memc_logical_w)
212WRITE32_HANDLER(archimedes_memc_logical_w)
213213{
214214   UINT32 page, poffs;
215215
r5955r5956
228228
229229      if (memc_pages[page] != -1)
230230      {
231         COMBINE_DATA(&memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2]);
231         COMBINE_DATA(&archimedes_memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2]);
232232      }
233233      else
234234      {
r5955r5956
260260      direct->bytemask = page_sizes[memc_pagesize]-1;
261261      direct->bytestart = page * page_sizes[memc_pagesize];
262262      direct->byteend = direct->bytestart + direct->bytemask;
263      direct->raw = direct->decrypted = (UINT8 *)&memc_physmem[(memc_pages[page] * page_sizes[memc_pagesize])>>2];
263      direct->raw = direct->decrypted = (UINT8 *)&archimedes_memc_physmem[(memc_pages[page] * page_sizes[memc_pagesize])>>2];
264264   }
265265
266266   return ~0;
r5955r5956
314314   ioc_timerout[tmr] = ioc_timercnt[tmr] - (UINT32)time;
315315}
316316
317READ32_HANDLER(ioc_r)
317READ32_HANDLER(archimedes_ioc_r)
318318{
319319   #ifdef MESS
320320   const device_config *fdc = (const device_config *)devtag_get_device(space->machine, "wd1772");
r5955r5956
364364   return 0;
365365}
366366
367WRITE32_HANDLER(ioc_w)
367WRITE32_HANDLER(archimedes_ioc_w)
368368{
369369   #ifdef MESS
370370   const device_config *fdc = (const device_config *)devtag_get_device(space->machine, "wd1772");
r5955r5956
492492   }
493493}
494494
495READ32_HANDLER(vidc_r)
495READ32_HANDLER(archimedes_vidc_r)
496496{
497497   return 0;
498498}
499499
500WRITE32_HANDLER(vidc_w)
500WRITE32_HANDLER(archimedes_vidc_w)
501501{
502502   UINT32 reg = data>>24;
503503   UINT32 val = data & 0xffffff;
r5955r5956
557557   }
558558}
559559
560READ32_HANDLER(memc_r)
560READ32_HANDLER(archimedes_memc_r)
561561{
562562   return 0;
563563}
564564
565WRITE32_HANDLER(memc_w)
565WRITE32_HANDLER(archimedes_memc_w)
566566{
567567   // is it a register?
568568   if ((data & 0x0fe00000) == 0x03600000)
r5955r5956
638638            1 being bit 6
639639*/
640640
641WRITE32_HANDLER(memc_page_w)
641WRITE32_HANDLER(archimedes_memc_page_w)
642642{
643643   UINT32 log, phys, memc, perms;
644644
src/mame/machine/galaxold.c
r5955r5956
122122}
123123
124124
125#ifdef UNUSED_FUNCTION
125126static READ8_HANDLER( checkmaj_protection_r )
126127{
127128   switch (cpu_get_pc(space->cpu))
r5955r5956
212213   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3001, 0x3001, 0, 0, dingoe_3001_r);   /* Protection check */
213214
214215}
216#endif
215217
216218
217219READ8_HANDLER( scramblb_protection_1_r )
r5955r5956
253255   return (input_port_read(field->port->machine, portnames[_4in1_bank]) & bit_mask) ? 0x01 : 0x00;
254256}
255257
258#ifdef UNUSED_FUNCTION
256259DRIVER_INIT( pisces )
257260{
258261   /* the coin lockout was replaced */
r5955r5956
383386      rom[i] ^= data_xor;
384387   }
385388}
389#endif
386390
387391DRIVER_INIT( 4in1 )
388392{
src/mame/machine/cx4oam.c
r5955r5956
99***************************************************************************/
1010
1111//Build OAM
12void CX4_op00_00(running_machine *machine)
12static void CX4_op00_00(running_machine *machine)
1313{
1414   INT32 i;
1515
r5955r5956
126126}
127127
128128//Scale and Rotate
129void CX4_op00_03()
129static void CX4_op00_03(void)
130130{
131131   CX4_C4DoScaleRotate(0);
132132}
133133
134134//Transform Lines
135void CX4_op00_05(running_machine *machine)
135static void CX4_op00_05(running_machine *machine)
136136{
137137   INT32 i;
138138   UINT32 ptr = 0, ptr2 = 0;
r5955r5956
178178}
179179
180180//Scale and Rotate
181void CX4_op00_07()
181static void CX4_op00_07(void)
182182{
183183   CX4_C4DoScaleRotate(64);
184184}
185185
186186//Draw Wireframe
187void CX4_op00_08(running_machine *machine)
187static void CX4_op00_08(running_machine *machine)
188188{
189189   CX4_C4DrawWireFrame(machine);
190190}
191191
192192//Disintegrate
193void CX4_op00_0b(running_machine *machine)
193static void CX4_op00_0b(running_machine *machine)
194194{
195195   UINT8  width, height;
196196   UINT32 startx, starty;
r5955r5956
240240}
241241
242242//Bitplane Wave
243void CX4_op00_0c(running_machine *machine)
243static void CX4_op00_0c(running_machine *machine)
244244{
245245   int i, j;
246246   UINT32 destptr = 0;
src/mame/machine/system16.c
r5955r5956
22#include "system16.h"
33#include "sound/upd7759.h"
44
5UINT16 *sys16_workingram;
6UINT16 *sys16_workingram2;
7UINT16 *sys16_extraram;
8UINT16 *sys16_extraram2;
9UINT16 *sys16_extraram3;
10
115static void patch_codeX( UINT16 *mem, offs_t offset, int data )
126{
137   int aligned_offset = offset&0xfffffe;
src/mame/tiny.c
r5955r5956
2424#define DRIVER_RECURSIVE
2525
2626/* step 1: declare all external references */
27#define DRIVER(NAME) extern game_driver driver_##NAME;
27#define DRIVER(NAME) GAME_EXTERN(NAME);
2828#include "tiny.c"
2929
3030/* step 2: define the drivers[] array */
3131#undef DRIVER
32#define DRIVER(NAME) &driver_##NAME,
32#define DRIVER(NAME) &GAME_NAME(NAME),
3333const game_driver * const drivers[] =
3434{
3535#include "tiny.c"
src/mame/mamedriv.c
r5955r5956
2222#define DRIVER_RECURSIVE
2323
2424/* step 1: declare all external references */
25#define DRIVER(NAME) extern game_driver driver_##NAME;
25#define DRIVER(NAME) GAME_EXTERN(NAME);
2626#include "mamedriv.c"
2727
2828/* step 2: define the drivers[] array */
2929#undef DRIVER
30#define DRIVER(NAME) &driver_##NAME,
30#define DRIVER(NAME) &GAME_NAME(NAME),
3131const game_driver * const drivers[] =
3232{
3333#include "mamedriv.c"
r5955r5956
165165   DRIVER( gteikob2 )   /* bootleg */
166166   DRIVER( spacbatt )   /* bootleg */
167167   DRIVER( spacbat2 )   /* bootleg */
168   DRIVER( spacempr )   /* bootleg */
168169   DRIVER( skyraidr )   /* bootleg */
169170   DRIVER( batman2 )   /* bootleg */
170171   DRIVER( warofbug )   /* (c) 1981 Armenia */
r5955r5956
172173   DRIVER( exodus )   /* Subelectro - bootleg? */
173174   DRIVER( streakng )   /* [1980] Shoei */
174175   DRIVER( pacmanbl )   /* bootleg */
176   DRIVER( pacmanbla )   /* bootleg */
175177   DRIVER( devilfsg )   /* (c) 1984 Vision / Artic (bootleg?) */
176178   DRIVER( zigzag )   /* (c) 1982 LAX */
177179   DRIVER( zigzag2 )   /* (c) 1982 LAX */
r5955r5956
616618   DRIVER( warpwarpr )   /* (c) 1981 [Namco] (Rock-ola license) */
617619   DRIVER( warpwarpr2 )/* (c) 1981 [Namco] (Rock-ola license) */
618620   DRIVER( rallyx )   /* (c) 1980 Namco */
621   DRIVER( rallyxa )   /* (c) 1980 Namco */
619622   DRIVER( rallyxm )   /* (c) 1980 Midway */
620623   DRIVER( nrallyx )   /* (c) 1981 Namco */
624   DRIVER( nrallyxb )   /* (c) 1981 Namco */
621625   DRIVER( jungler )   /* GX327 (c) 1981 Konami */
622626   DRIVER( junglers )   /* GX327 (c) 1981 Stern */
623627   DRIVER( tactcian )   /* GX335 (c) 1982 Sega */
r5955r5956
17871791   DRIVER( cadashu )   /* C21 (c) 1989 Taito America Corporation */
17881792   DRIVER( cadashi )   /* C21 (c) 1989 Taito Corporation Japan */
17891793   DRIVER( cadashf )   /* C21 (c) 1989 Taito Corporation Japan */
1794   DRIVER( cadashg )   /* C21 (c) 1989 Taito Corporation Japan */
17901795   DRIVER( parentj )   /* C42 (c) 199? Taito */
17911796   DRIVER( galmedes )   /* (c) 1992 Visco (Japan) */
17921797   DRIVER( earthjkr )   /* (c) 1993 Visco (Japan) */
r5955r5956
25542559   DRIVER( sf2j )      /* 10/12/1991 (c) 1991 (Japan) */
25552560   DRIVER( sf2ja )      /* 14/02/1991 (c) 1991 (Japan) */
25562561   DRIVER( sf2jc )      /* 06/03/1991 (c) 1991 (Japan) */
2562   DRIVER( sf2qp1 )   /* hack */
25572563   DRIVER( 3wonders )   /* 20/05/1991 (c) 1991 (World) */
25582564   DRIVER( 3wondersu )   /* 20/05/1991 (c) 1991 (US)    */
25592565   DRIVER( wonder3 )   /* 20/05/1991 (c) 1991 (Japan) */
r5955r5956
25802586   DRIVER( sf2rb3 )   /* hack */
25812587   DRIVER( sf2red )   /* hack */
25822588   DRIVER( sf2v004 )   /* hack */
2589   DRIVER( sf2acc )   /* hack */
25832590   DRIVER( sf2accp2 )   /* hack */
25842591   DRIVER( sf2m1 )      /* hack */
25852592   DRIVER( sf2m2 )      /* hack */
r5955r5956
34313438   DRIVER( aafbb )      /* (c) 1989 Leland */
34323439   DRIVER( offroad )   /* (c) 1989 Leland */
34333440   DRIVER( offroadt )   /* (c) 1989 Leland */
3441   DRIVER( offrdtp2 )   /* (c) 1989 Leland */
34343442   DRIVER( pigout )   /* (c) 1990 Leland */
34353443   DRIVER( pigouta )   /* (c) 1990 Leland */
34363444   DRIVER( ataxx )      /* (c) 1990 Leland */
r5955r5956
35203528
35213529   /* Sega "Zaxxon hardware" games */
35223530   DRIVER( zaxxon )   /* (c) 1982 */
3531   DRIVER( zaxxonj )   /* (c) 1982 */
35233532   DRIVER( zaxxon2 )   /* (c) 1982 */
35243533   DRIVER( zaxxonb )   /* bootleg */
35253534   DRIVER( szaxxon )   /* (c) 1982 */
r5955r5956
45274536   DRIVER( clubkrte )   /* 2002.?? Club Kart: European Session */
45284537                  /* 2002.06 WCCF SERIE A 2001-2002 */
45294538                  /* 2002.07 Soul Surfer */
4539   DRIVER( vf4evoct )   /* 2002.08 Virtua Fighter 4 Evolution (cartridge) */
45304540   DRIVER( vf4evoa )   /* 2002.08 Virtua Fighter 4 Evolution */
45314541                  /* 2002.11 WCCF SERIE A 2001-2002 ver.1.2 */
45324542   DRIVER( initdv2j )   /* 2002.12 Initial D Arcade Stage ver.2 */
r5955r5956
53275337   DRIVER( majuu )      /* GX687 (c) 1987 (Japan) */
53285338   DRIVER( vulcan )   /* GX785 (c) 1988 */
53295339   DRIVER( vulcana )   /* GX785 (c) 1988 */
5340   DRIVER( vulcanb )   /* GX785 (c) 1988 */
53305341   DRIVER( gradius2 )   /* GX785 (c) 1988 (Japan) */
53315342   DRIVER( gradius2a )   /* GX785 (c) 1988 (Japan) */
53325343   DRIVER( gradius2b )   /* GX785 (c) 1988 (Japan) */
r5955r5956
55605571   /* Konami M2 games */
55615572   DRIVER( polystar )   /* GX623 (c)1997 */
55625573   DRIVER( totlvice )   /* GX639 (c)1997 */
5574   DRIVER( totlvicj )   /* GX639 (c)1997 */
55635575   DRIVER( btltryst )   /* GX636 (c)1998 */
55645576   DRIVER( heatof11 )   /* GX703 (c)1998 */
55655577   DRIVER( evilngt )   /* GX810 (c)1998 */
r5955r5956
67686780   DRIVER( totcarn )   /* (c) 1992 Midway */
67696781   DRIVER( totcarnp )   /* (c) 1992 Midway */
67706782   DRIVER( mk2 )      /* (c) 1993 Midway */
6783   DRIVER( mk2r31e )   /* (c) 1993 Midway */
67716784   DRIVER( mk2r32 )   /* (c) 1993 Midway */
67726785   DRIVER( mk2r30 )   /* (c) 1993 Midway */
67736786   DRIVER( mk2r21 )   /* (c) 1993 Midway */
r5955r5956
73797392   DRIVER( glass10 )   /* (c) 1993 - Ref 931021 */
73807393   DRIVER( glassbrk )   /* (c) 1993 - Ref 931021 shows "Break Edition" on a real PCB */
73817394   DRIVER( targeth )   /* (c) 1994 - Ref 940531 */
7395   DRIVER( targetha )   /* (c) 1994 - Ref 940531 */
73827396   DRIVER( thoop2 )   /* (c) 1994 - Ref ??? */
73837397   DRIVER( aligator )   /* (c) 1994 - Ref 940411 */
73847398   DRIVER( aligatorun )   /* (c) 1994 - Ref 940411 (unprotected) */
r5955r5956
74687482   /* Kaneko "Super Nova System" games */
74697483   DRIVER( skns )
74707484   DRIVER( galpani4 )   /* 1996.09 (c) 1996 Kaneko (Japan) */
7485   DRIVER( galpani4k )   /* 1996.09 (c) 1996 Kaneko (Korea) */
74717486   DRIVER( jjparads )   /* 1996.12 (c) 1996 Electro Design Co. (Japan) */
74727487   DRIVER( sarukani )   /* 1997.01 (c) 1997 Kaneko / Mediaworks (Japan) */
74737488   DRIVER( vblokbrk )   /* 1997.?? (c) 1997 Kaneko / Mediaworks (Asia) */
r5955r5956
75127527   DRIVER( calibr50 )   /* UH   (c) 1989 + Romstar or Taito license (DSW) */
75137528   DRIVER( arbalest )   /* UK   (c) 1989 + Jordan, Romstar or Taito license (DSW) */
75147529   DRIVER( metafox )   /* UP   (c) 1989 + Jordan, Romstar or Taito license (DSW) */
7530   DRIVER( setaroul )   /* UF   (c) 19?? Seta / Visco */
75157531   DRIVER( drgnunit )   /* (c) 1989 Athena / Seta + Romstar or Taito license (DSW) */
75167532   DRIVER( wits )      /* (c) 1989 Athena (Visco license) */
75177533   DRIVER( thunderl )   /* (c) 1990 Seta + Romstar or Visco license (DSW) */
r5955r5956
87178733   DRIVER( dynadice )   /* ? */
87188734   DRIVER( ssingles )   /* Yachiyo? */
87198735   DRIVER( tcl )      /* (c) 1995 Uniwang */
8736   DRIVER( othello )   /* (c) 1984 Success */
87208737   DRIVER( sothello )   /* (c) 1986 Success / Fujiwara */
87218738   DRIVER( quake )      /* (c) 19?? Lazer-Tron / iD Software  */
87228739
r5955r5956
90779094   DRIVER( gstream )   /* (c) 2002, Oriental Soft Japan */
90789095   DRIVER( miniboy7 )   /* (c) 1983, Bonanza Enterprises */
90799096   DRIVER( 39in1 )      /* MAME based bootleg */
9097   DRIVER( 48in1 )      /* MAME based bootleg */
9098   DRIVER( 48in1a )       /* MAME based bootleg */
90809099   DRIVER( kingpin )   /* (c) 1983 American Communications Laboratories Inc. */
90819100   DRIVER( kingpinm )   /* (c) 1983 American Communications Laboratories Inc. */
90829101   DRIVER( thayers )   /* (c) 1983 RDI Video Systems */
src/mame/includes/bublbobl.h
r5955r5956
1111WRITE8_HANDLER( bublbobl_sound_command_w );
1212WRITE8_HANDLER( bublbobl_sh_nmi_disable_w );
1313WRITE8_HANDLER( bublbobl_sh_nmi_enable_w );
14WRITE8_HANDLER( soundcpu_reset_w );
15WRITE8_HANDLER( sound_status_w );
16READ8_HANDLER( sound_status_r );
14WRITE8_HANDLER( bublbobl_soundcpu_reset_w );
15WRITE8_HANDLER( bublbobl_sound_status_w );
16READ8_HANDLER( bublbobl_sound_status_r );
1717READ8_HANDLER( boblbobl_ic43_a_r );
1818WRITE8_HANDLER( boblbobl_ic43_a_w );
1919READ8_HANDLER( boblbobl_ic43_b_r );
src/mame/includes/bzone.h
r5955r5956
2222/*----------- defined in audio/redbaron.c -----------*/
2323
2424WRITE8_HANDLER( redbaron_sounds_w );
25WRITE8_DEVICE_HANDLER( redbaron_pokey_w );
2625
2726DEVICE_GET_INFO( redbaron_sound );
2827#define SOUND_REDBARON DEVICE_GET_INFO_NAME(redbaron_sound)
src/mame/includes/balsente.h
r5955r5956
2121/*----------- defined in machine/balsente.c -----------*/
2222
2323extern UINT8 balsente_shooter;
24extern UINT8 balsente_shooter_x;
25extern UINT8 balsente_shooter_y;
2624extern UINT8 balsente_adc_shift;
2725extern UINT16 *shrike_shared;
2826extern UINT16 *shrike_io;
src/mame/includes/namcos2.h
r5955r5956
165165READ16_HANDLER( namcos2_68k_serial_comms_ctrl_r );
166166WRITE16_HANDLER( namcos2_68k_serial_comms_ctrl_w );
167167
168extern UINT16  namcos2_68k_serial_comms_ctrl[];
169168extern UINT16 *namcos2_68k_serial_comms_ram;
170169
171170/**************************************************************/
r5955r5956
187186#define NAMCOS2_C148_SERIRQ    6      /* 0x1cc000 */
188187#define NAMCOS2_C148_VBLANKIRQ   7      /* 0x1ce000 */
189188
190extern UINT16 namcos2_68k_master_C148[];
191extern UINT16 namcos2_68k_slave_C148[];
192extern UINT16 namcos2_68k_gpu_C148[];
193
194189WRITE16_HANDLER( namcos2_68k_master_C148_w );
195190READ16_HANDLER( namcos2_68k_master_C148_r );
196191INTERRUPT_GEN( namcos2_68k_master_vblank );
src/mame/includes/namcona1.h
r5955r5956
1/*----------- defined in drivers/namcona1.c -----------*/
2
3extern int namcona1_gametype;
4
5
61/*----------- defined in video/namcona1.c -----------*/
72
83enum
src/mame/includes/dkong.h
r5955r5956
141141WRITE8_HANDLER( dkong_videoram_w );
142142
143143PALETTE_INIT( dkong2b );
144PALETTE_INIT( dkong4b );
145144PALETTE_INIT( radarscp );
146145PALETTE_INIT( radarsc1 );
147146PALETTE_INIT( dkong3 );
src/mame/includes/kaneko16.h
r5955r5956
130130
131131extern UINT16 *galpani2_bg8_0,         *galpani2_bg8_1;
132132extern UINT16 *galpani2_palette_0,     *galpani2_palette_1;
133extern UINT16 *galpani2_bg8_regs_0,    *galpani2_bg8_regs_1;
134133extern UINT16 *galpani2_bg8_0_scrollx, *galpani2_bg8_1_scrollx;
135134extern UINT16 *galpani2_bg8_0_scrolly, *galpani2_bg8_1_scrolly;
136135
src/mame/includes/system16.h
r5955r5956
5656
5757/*----------- defined in machine/system16.c -----------*/
5858
59extern UINT16 *sys16_workingram;
60extern UINT16 *sys16_workingram2;
61extern UINT16 *sys16_extraram;
62extern UINT16 *sys16_extraram2;
63extern UINT16 *sys16_extraram3;
64
6559/* sound */
6660extern const upd7759_interface sys16_upd7759_interface;
6761
r5955r5956
116110extern int sys16_MaxShadowColors;
117111
118112/* video driver constants (vary with game) */
119extern int sys16_gr_bitmap_width;
120113extern int sys16_sprxoffset;
121114extern int sys16_bgxoffset;
122115extern int sys16_fgxoffset;
r5955r5956
153146extern UINT16 *sys18_splittab_fg_x;
154147extern UINT16 *sys18_splittab_fg_y;
155148
156extern UINT16 *sys16_gr_ver;
157extern UINT16 *sys16_gr_hor;
158extern UINT16 *sys16_gr_pal;
159extern UINT16 *sys16_gr_flip;
160extern int sys16_gr_palette;
161extern int sys16_gr_palette_default;
162extern UINT8 sys16_gr_colorflip[2][4];
163extern UINT16 *sys16_gr_second_road;
164
src/mame/includes/mw8080bw.h
r5955r5956
143143WRITE8_DEVICE_HANDLER( clowns_audio_2_w );
144144
145145MACHINE_DRIVER_EXTERN( spacwalk_audio );
146WRITE8_HANDLER( spacwalk_audio_1_w );
146WRITE8_DEVICE_HANDLER( spacwalk_audio_1_w );
147WRITE8_DEVICE_HANDLER( spacwalk_audio_2_w );
147148
148149MACHINE_DRIVER_EXTERN( shuffle_audio );
149150WRITE8_HANDLER( shuffle_audio_1_w );
src/mame/includes/cps1.h
r5955r5956
88READ16_HANDLER( qsound_sharedram1_r );
99WRITE16_HANDLER( qsound_sharedram1_w );
1010
11READ16_HANDLER( cps1_eeprom_port_r );
12WRITE16_HANDLER( cps1_eeprom_port_w );
13
14INTERRUPT_GEN( cps1_qsound_interrupt );
15
1611READ16_HANDLER( cps1_dsw_r );
1712WRITE16_HANDLER( cps1_coinctrl_w );
1813INTERRUPT_GEN( cps1_interrupt );
src/mame/includes/snk.h
r5955r5956
44
55*************************************************************************/
66
7/*----------- defined in drivers/snk.c -----------*/
8
9extern READ8_HANDLER ( snk_cpuA_nmi_trigger_r );
10extern WRITE8_HANDLER( snk_cpuA_nmi_ack_w );
11
12extern READ8_HANDLER ( snk_cpuB_nmi_trigger_r );
13extern WRITE8_HANDLER( snk_cpuB_nmi_ack_w );
14
15
167/*----------- defined in video/snk.c -----------*/
178
189extern PALETTE_INIT( tnk3 );
src/mame/includes/namconb1.h
r5955r5956
11/*----------- defined in drivers/namconb1.c -----------*/
22
3extern UINT32 *namconb1_workram32;
43extern UINT32 *namconb1_spritebank32;
54extern UINT32 *namconb1_tilebank32;
65
src/mame/includes/kyugo.h
r5955r5956
44
55***************************************************************************/
66
7/*----------- defined in drivers/kyugo.c -----------*/
8
9MACHINE_RESET( kyugo );
10
11WRITE8_HANDLER( kyugo_sub_cpu_control_w );
12
137/*----------- defined in video/kyugo.c -----------*/
148
159extern UINT8 *kyugo_fgvideoram;
src/mame/includes/segas24.h
r5955r5956
77
88/* New Code */
99
10extern UINT16 *system24temp_sys16_shared_ram;
11READ16_HANDLER( system24temp_sys16_shared_ram_r );
12WRITE16_HANDLER( system24temp_sys16_shared_ram_w );
13
1410void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(running_machine *machine, int port),
1511                     void  (*io_w)(running_machine *machine, int port, UINT8 data),
1612                     void  (*cnt_w)(const address_space *space, UINT8 data),
src/mame/includes/namcoic.h
r5955r5956
146146
147147READ16_HANDLER( namco_rozcontrol16_r );
148148WRITE16_HANDLER( namco_rozcontrol16_w );
149READ16_HANDLER( namco_rozbank16_r );
150WRITE16_HANDLER( namco_rozbank16_w );
151149READ16_HANDLER( namco_rozvideoram16_r );
152150WRITE16_HANDLER( namco_rozvideoram16_w );
153151
src/mame/includes/taito_f2.h
r5955r5956
4343VIDEO_UPDATE( taitof2_yesnoj );
4444
4545WRITE16_HANDLER( taitof2_spritebank_w );
46READ16_HANDLER ( koshien_spritebank_r );
4746WRITE16_HANDLER( koshien_spritebank_w );
4847WRITE16_HANDLER( taitof2_sprite_extension_w );
src/mame/includes/snes.h
r5955r5956
544544extern DEVICE_GET_INFO( snes_sound );
545545#define SOUND_SNES DEVICE_GET_INFO_NAME( snes_sound )
546546
547extern STREAM_UPDATE( snes_sh_update );
548
549547/* Stuff from OpenSPC 0.3.99 by Brad Martin */
550548
551549/*========== TYPES ==========*/
src/mame/includes/mcr.h
r5955r5956
102102WRITE8_HANDLER( spyhunt_videoram_w );
103103WRITE8_HANDLER( spyhunt_alpharam_w );
104104
105VIDEO_START( mcr3 );
106105VIDEO_START( mcrmono );
107106VIDEO_START( spyhunt );
108107
src/mame/includes/namcos22.h
r5955r5956
2929
3030#define NAMCOS22_PALETTE_SIZE 0x8000
3131
32/*----------- defined in drivers/namcos22.c -----------*/
33
34extern const gfx_layout namcos22_cg_layout;
35
3632/*----------- defined in video/namcos22.c -----------*/
3733
3834extern UINT32 *namcos22_cgram;
src/mame/includes/archimds.h
r5955r5956
3636
3737/*----------- defined in machine/archimds.c -----------*/
3838
39extern UINT32 *memc_physmem;
39extern UINT32 *archimedes_memc_physmem;
4040
4141void archimedes_init(running_machine *machine);         // call at MACHINE_INIT
4242void archimedes_reset(running_machine *machine);      // call at MACHINE_RESET
r5955r5956
4949void archimedes_clear_irq_b(running_machine *machine, int mask);
5050void archimedes_clear_fiq(running_machine *machine, int mask);
5151
52extern READ32_HANDLER(memc_logical_r);
53extern WRITE32_HANDLER(memc_logical_w);
54extern READ32_HANDLER(memc_r);
55extern WRITE32_HANDLER(memc_w);
56extern WRITE32_HANDLER(memc_page_w);
57extern READ32_HANDLER(ioc_r);
58extern WRITE32_HANDLER(ioc_w);
59extern READ32_HANDLER(vidc_r);
60extern WRITE32_HANDLER(vidc_w);
52extern READ32_HANDLER(archimedes_memc_logical_r);
53extern WRITE32_HANDLER(archimedes_memc_logical_w);
54extern READ32_HANDLER(archimedes_memc_r);
55extern WRITE32_HANDLER(archimedes_memc_w);
56extern WRITE32_HANDLER(archimedes_memc_page_w);
57extern READ32_HANDLER(archimedes_ioc_r);
58extern WRITE32_HANDLER(archimedes_ioc_w);
59extern READ32_HANDLER(archimedes_vidc_r);
60extern WRITE32_HANDLER(archimedes_vidc_w);
6161
6262#endif   // _ARCHIMEDES_H_
src/mame/includes/galaxold.h
r5955r5956
7070VIDEO_START( batman2 );
7171VIDEO_START( dkongjrm );
7272VIDEO_START( scrambold );
73VIDEO_START( theend );
7473VIDEO_START( darkplnt );
7574VIDEO_START( rescue );
7675VIDEO_START( minefld );
r5955r5956
9594WRITE8_HANDLER( galaxold_gfxbank_w );
9695WRITE8_HANDLER( galaxold_flip_screen_x_w );
9796WRITE8_HANDLER( galaxold_flip_screen_y_w );
98WRITE8_HANDLER( gteikob2_flip_screen_x_w );
99WRITE8_HANDLER( gteikob2_flip_screen_y_w );
10097
10198
10299/*----------- defined in machine/galaxold.c -----------*/
103100
104DRIVER_INIT( zigzag );
105DRIVER_INIT( pisces );
106DRIVER_INIT( checkmaj );
107DRIVER_INIT( dingo );
108DRIVER_INIT( dingoe );
109DRIVER_INIT( mooncrsu );
110DRIVER_INIT( mooncrst );
111DRIVER_INIT( mooncrgx );
112DRIVER_INIT( moonqsr );
113DRIVER_INIT( checkman );
114101DRIVER_INIT( 4in1 );
115102DRIVER_INIT( ladybugg );
116103
r5955r5956
132119WRITE8_HANDLER( _4in1_bank_w );
133120CUSTOM_INPUT( _4in1_fake_port_r );
134121
135WRITE8_HANDLER( zigzag_sillyprotection_w );
136
137122INTERRUPT_GEN( hunchbks_vh_interrupt );
138123
139124
r5955r5956
147132
148133
149134DRIVER_INIT( scramble_ppi );
150DRIVER_INIT( scobra );
151DRIVER_INIT( atlantis );
152DRIVER_INIT( scramble );
153135DRIVER_INIT( stratgyx );
154136DRIVER_INIT( tazmani2 );
155137DRIVER_INIT( ckongs );
156138DRIVER_INIT( mariner );
157DRIVER_INIT( frogger );
158DRIVER_INIT( froggers );
159139DRIVER_INIT( devilfsh );
160140DRIVER_INIT( mars );
161141DRIVER_INIT( hotshock );
r5955r5956
164144DRIVER_INIT( mimonkey );
165145DRIVER_INIT( mimonsco );
166146DRIVER_INIT( mimonscr );
167DRIVER_INIT( anteater );
168147DRIVER_INIT( rescue );
169148DRIVER_INIT( minefld );
170DRIVER_INIT( losttomb );
171149DRIVER_INIT( hustler );
172150DRIVER_INIT( billiard );
173151DRIVER_INIT( mrkougar );
r5955r5956
200178
201179WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w );
202180WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w );
203WRITE8_HANDLER( froggrmc_sh_irqtrigger_w );
204181WRITE8_HANDLER( hotshock_sh_irqtrigger_w );
205182
206183MACHINE_DRIVER_EXTERN( ad2083_audio );
src/mame/includes/sprint8.h
r5955r5956
1#include "sound/discrete.h"
2
13/*----------- defined in drivers/sprint8.c -----------*/
24
35void sprint8_set_collision(running_machine *machine, int n);
r5955r5956
1719VIDEO_UPDATE( sprint8 );
1820
1921WRITE8_HANDLER( sprint8_video_ram_w );
22
23
24/*----------- defined in audio/sprint8.c -----------*/
25
26DISCRETE_SOUND_EXTERN( sprint8 );
27
28WRITE8_DEVICE_HANDLER( sprint8_crash_w );
29WRITE8_DEVICE_HANDLER( sprint8_screech_w );
30WRITE8_DEVICE_HANDLER( sprint8_attract_w );
31WRITE8_DEVICE_HANDLER( sprint8_motor_w );
src/mame/includes/cloud9.h
r5955r5956
44
55*************************************************************************/
66
7/*----------- defined in drivers/cloud9.c -----------*/
8
9extern int cloud9_vblank_start;
10extern int cloud9_vblank_end;
11
12
137/*----------- defined in video/cloud9.c -----------*/
148
159VIDEO_START( cloud9 );
src/mame/mame.mak
r5955r5956
433433   $(DRIVERS)/skyraid.o $(AUDIO)/skyraid.o $(VIDEO)/skyraid.o \
434434   $(DRIVERS)/sprint2.o $(AUDIO)/sprint2.o $(VIDEO)/sprint2.o \
435435   $(DRIVERS)/sprint4.o $(VIDEO)/sprint4.o $(AUDIO)/sprint4.o \
436   $(DRIVERS)/sprint8.o $(VIDEO)/sprint8.o \
436   $(DRIVERS)/sprint8.o $(AUDIO)/sprint8.o $(VIDEO)/sprint8.o \
437437   $(DRIVERS)/starshp1.o $(AUDIO)/starshp1.o $(VIDEO)/starshp1.o \
438438   $(DRIVERS)/starwars.o $(MACHINE)/starwars.o $(AUDIO)/starwars.o \
439439   $(DRIVERS)/subs.o $(MACHINE)/subs.o $(AUDIO)/subs.o $(VIDEO)/subs.o \
r5955r5956
11281128   $(DRIVERS)/segas18.o $(VIDEO)/segas18.o \
11291129   $(DRIVERS)/segas24.o $(MACHINE)/segas24.o $(VIDEO)/segas24.o \
11301130   $(DRIVERS)/segas32.o $(MACHINE)/segas32.o $(VIDEO)/segas32.o \
1131   $(DRIVERS)/segae.o $(VIDEO)/segasyse.o \
1131   $(DRIVERS)/segamsys.o $(DRIVERS)/segae.o \
11321132   $(DRIVERS)/segaxbd.o $(VIDEO)/segaxbd.o \
11331133   $(DRIVERS)/segaybd.o $(VIDEO)/segaybd.o \
11341134   $(DRIVERS)/ssf2md.o \
r5955r5956
15751575   $(DRIVERS)/norautp.o  $(AUDIO)/norautp.o \
15761576   $(DRIVERS)/oneshot.o $(VIDEO)/oneshot.o \
15771577   $(DRIVERS)/onetwo.o \
1578   $(DRIVERS)/othello.o \
15781579   $(DRIVERS)/othldrby.o $(VIDEO)/othldrby.o \
15791580   $(DRIVERS)/pachifev.o \
15801581   $(DRIVERS)/pangofun.o \
src/mame/video/galpani2.c
r5955r5956
2525
2626UINT16 *galpani2_bg8_0,         *galpani2_bg8_1;
2727UINT16 *galpani2_palette_0,     *galpani2_palette_1;
28UINT16 *galpani2_bg8_regs_0,    *galpani2_bg8_regs_1;
28//UINT16 *galpani2_bg8_regs_0,    *galpani2_bg8_regs_1;
2929UINT16 *galpani2_bg8_0_scrollx, *galpani2_bg8_1_scrollx;
3030UINT16 *galpani2_bg8_0_scrolly, *galpani2_bg8_1_scrolly;
3131
3232static bitmap_t *galpani2_bg8_bitmap_0, *galpani2_bg8_bitmap_1;
3333
34#ifdef UNUSED_DEFINITION
3435#define galpani2_BG8_REGS_R( _n_ ) \
3536READ16_HANDLER( galpani2_bg8_regs_##_n_##_r ) \
3637{ \
r5955r5956
5556{ \
5657   COMBINE_DATA(&galpani2_bg8_regs_##_n_[offset]); \
5758}
59#endif
5860
5961#define galpani2_BG8_W( _n_ ) \
6062WRITE16_HANDLER( galpani2_bg8_##_n_##_w ) \
r5955r5956
7476   palette_set_color_rgb( space->machine, offset + 0x4000 + _n_ * 0x100, pal5bit(newword >> 5), pal5bit(newword >> 10), pal5bit(newword >> 0) ); \
7577}
7678
79#ifdef UNUSED_FUNCTION
7780galpani2_BG8_REGS_R( 0 )
7881galpani2_BG8_REGS_R( 1 )
7982
8083galpani2_BG8_REGS_W( 0 )
8184galpani2_BG8_REGS_W( 1 )
85#endif
8286
8387galpani2_BG8_W( 0 )
8488galpani2_BG8_W( 1 )
src/mame/video/dkong.c
r5955r5956
228228   free(rgb);
229229}
230230
231#ifdef UNUSED_FUNCTION
231232PALETTE_INIT( dkong4b )
232233{
233234   dkong_state *state = (dkong_state *)machine->driver_data;
r5955r5956
265266   /* color_prom now points to the beginning of the character color codes */
266267   state->color_codes = color_prom;   /* we'll need it later */
267268}
269#endif
268270
269271PALETTE_INIT( radarscp )
270272{
src/mame/video/system16.c
r5955r5956
145145int sys16_MaxShadowColors;
146146
147147/* video driver constants (potentially different for each game) */
148int sys16_gr_bitmap_width;
149
150148const int *sys16_obj_bank;
151149int sys16_sprxoffset;
152150int sys16_bgxoffset;
r5955r5956
185183UINT16 *sys18_splittab_fg_x;
186184UINT16 *sys18_splittab_fg_y;
187185
188UINT16 *sys16_gr_ver;
189UINT16 *sys16_gr_hor;
190UINT16 *sys16_gr_pal;
191UINT16 *sys16_gr_flip;
192int sys16_gr_palette;
193int sys16_gr_palette_default;
194UINT8 sys16_gr_colorflip[2][4];
195UINT16 *sys16_gr_second_road;
196
197186static tilemap *background, *foreground, *text_layer;
198187static tilemap *background2, *foreground2;
199188static int old_bg_page[4],old_fg_page[4], old_tile_bank1, old_tile_bank0;
src/mame/video/mcr3.c
r5955r5956
4242 *
4343 *************************************/
4444
45#ifdef UNUSED_FUNCTION
4546static TILE_GET_INFO( get_bg_tile_info )
4647{
4748   int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
r5955r5956
4950   int color = (data >> 12) & 3;
5051   SET_TILE_INFO(0, code, color, TILE_FLIPYX((data >> 10) & 3));
5152}
53#endif
5254
5355
5456static TILE_GET_INFO( mcrmono_get_bg_tile_info )
r5955r5956
105107 *
106108 *************************************/
107109
110#ifdef UNUSED_FUNCTION
108111VIDEO_START( mcr3 )
109112{
110113   /* initialize the background tilemap */
111114   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,  16,16, 32,30);
112115}
116#endif
113117
114118
115119VIDEO_START( mcrmono )
src/mame/video/cps1.c
r5955r5956
12911291   {"sf2j",     CPS_B_13,     mapper_STF29,  0x36 },
12921292   {"sf2ja",    CPS_B_17,     mapper_STF29,  0x36 },
12931293   {"sf2jc",    CPS_B_12,     mapper_STF29,  0x36 },
1294   {"sf2qp1",   CPS_B_17,     mapper_STF29,  0x36 },
12941295   /* from here onwards the CPS-B board has suicide battery and multiply protection */
12951296   {"3wonders", CPS_B_21_BT1, mapper_RT24B },
12961297   {"3wondersu",CPS_B_21_BT1, mapper_RT24B },
r5955r5956
13181319   {"sf2rb3",   CPS_B_21_DEF, mapper_S9263B, 0x36 },
13191320   {"sf2red",   CPS_B_21_DEF, mapper_S9263B, 0x36 },
13201321   {"sf2v004",  CPS_B_21_DEF, mapper_S9263B, 0x36 },
1322   {"sf2acc",   CPS_B_21_DEF, mapper_S9263B, 0x36 },
13211323   {"sf2accp2", CPS_B_21_DEF, mapper_S9263B, 0x36 },
13221324   {"sf2m1",    CPS_B_21_DEF, mapper_S9263B, 0x36 },
13231325   {"sf2m2",    CPS_B_21_DEF, mapper_S9263B, 0x36, 0, 0, 1 },
src/mame/video/galaxold.c
r5955r5956
9393static void (*draw_stars)(running_machine *machine, bitmap_t *, const rectangle *);      /* function to call to draw the star layer */
9494static void     noop_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
9595       void galaxold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
96static void scramble_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
96static void scrambold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
9797static void   rescue_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
9898static void  mariner_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
9999static void start_stars_blink_timer(double ra, double rb, double c);
r5955r5956
103103static UINT8 darkplnt_bullet_color;
104104static void (*draw_bullets)(running_machine *,bitmap_t *,const rectangle *,int,int,int);   /* function to call to draw a bullet */
105105static void galaxold_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y);
106static void scramble_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y);
106static void scrambold_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y);
107107static void darkplnt_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y);
108108static void dambustr_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y);
109109
r5955r5956
112112static UINT8 background_red, background_green, background_blue;
113113static void (*draw_background)(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);   /* function to call to draw the background */
114114static void galaxold_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
115static void scramble_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
116static void  turtles_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
115static void scrambold_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
116static void  ad2083_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
117117static void  mariner_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
118118static void stratgyx_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
119119static void  minefld_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
r5955r5956
575575     */
576576   tilemap_set_scrolldx(bg_tilemap, 0, 0);
577577
578   draw_stars = scramble_draw_stars;
578   draw_stars = scrambold_draw_stars;
579579
580   draw_bullets = scramble_draw_bullets;
580   draw_bullets = scrambold_draw_bullets;
581581
582   draw_background = scramble_draw_background;
582   draw_background = scrambold_draw_background;
583583}
584584
585585VIDEO_START( darkplnt )
r5955r5956
628628
629629   draw_stars = mariner_draw_stars;
630630
631   draw_bullets = scramble_draw_bullets;
631   draw_bullets = scrambold_draw_bullets;
632632
633633   draw_background = mariner_draw_background;
634634
r5955r5956
681681   modify_spritecode = pisces_modify_spritecode;
682682}
683683
684#ifdef UNUSED_FUNCTION
684685static void theend_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y)
685686{
686687   int i;
r5955r5956
702703
703704   draw_bullets = theend_draw_bullets;
704705}
706#endif
705707
706708static void mooncrst_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs)
707709{
r5955r5956
826828
827829   mooncrst_gfxextend = 0;
828830
829   draw_bullets = scramble_draw_bullets;
831   draw_bullets = scrambold_draw_bullets;
830832
831   draw_background = turtles_draw_background;
833   draw_background = ad2083_draw_background;
832834   background_enable = 0;
833835   background_blue = 0;
834836   background_red = 0;
r5955r5956
10221024}
10231025
10241026
1027#ifdef UNUSED_FUNCTION
10251028WRITE8_HANDLER( gteikob2_flip_screen_x_w )
10261029{
10271030   galaxold_flip_screen_x_w(space, offset, ~data);
r5955r5956
10311034{
10321035   galaxold_flip_screen_y_w(space, offset, ~data);
10331036}
1037#endif
10341038
10351039
10361040WRITE8_HANDLER( hotshock_flip_screen_w )
r5955r5956
12511255   }
12521256}
12531257
1254static void scramble_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y)
1258static void scrambold_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y)
12551259{
12561260   if (flipscreen_x)  x++;
12571261
r5955r5956
13081312   bitmap_fill(bitmap,cliprect,0);
13091313}
13101314
1311static void scramble_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
1315static void scrambold_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
13121316{
13131317   if (background_enable)
13141318      bitmap_fill(bitmap,cliprect,BACKGROUND_COLOR_BASE);
r5955r5956
13161320      bitmap_fill(bitmap,cliprect,0);
13171321}
13181322
1319static void turtles_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
1323static void ad2083_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
13201324{
13211325   int color = (background_blue << 2) | (background_green << 1) | background_red;
13221326
r5955r5956
16001604   }
16011605}
16021606
1603static void scramble_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
1607static void scrambold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
16041608{
16051609   int offs;
16061610
src/mame/video/plygonet.c
r5955r5956
1313/* TTL text plane stuff */
1414
1515static int ttl_gfx_index;
16static tilemap *ttl_tilemap;
17static UINT16 ttl_vram[0x800];
16static tilemap *ttl_tilemap, *roz_tilemap;
17static UINT16 ttl_vram[0x800], roz_vram[0x800];
1818
1919/* TTL text plane */
2020
r5955r5956
2929   SET_TILE_INFO(ttl_gfx_index, code, attr, 0);
3030}
3131
32static TILE_GET_INFO( roz_get_tile_info )
33{
34   int attr, code;
35
36   attr = (roz_vram[tile_index] >> 12) + 16;   // roz base palette is palette 16
37   code = roz_vram[tile_index] & 0x3ff;
38
39   SET_TILE_INFO(0, code, attr, 0);
40}
41
3242READ32_HANDLER( polygonet_ttl_ram_r )
3343{
3444   UINT32 *vram = (UINT32 *)ttl_vram;
r5955r5956
4656   tilemap_mark_tile_dirty(ttl_tilemap, offset*2+1);
4757}
4858
59READ32_HANDLER( polygonet_roz_ram_r )
60{
61   UINT32 *vram = (UINT32 *)roz_vram;
62
63   return(vram[offset]);
64}
65
66WRITE32_HANDLER( polygonet_roz_ram_w )
67{
68   UINT32 *vram = (UINT32 *)roz_vram;
69
70   COMBINE_DATA(&vram[offset]);
71
72   tilemap_mark_tile_dirty(roz_tilemap, offset*2);
73   tilemap_mark_tile_dirty(roz_tilemap, offset*2+1);
74}
75
4976static TILEMAP_MAPPER( plygonet_scan )
5077{
5178   return row * num_cols + (col^1);
5279}
5380
81static TILEMAP_MAPPER( plygonet_scan_cols )
82{
83   return col * num_rows + (row^1);
84}
85
5486VIDEO_START( polygonet )
5587{
5688   static const gfx_layout charlayout =
r5955r5956
80112   tilemap_set_transparent_pen(ttl_tilemap, 0);
81113
82114   state_save_register_global_array(machine, ttl_vram);
115
116   // set up the roz t-map too
117   roz_tilemap = tilemap_create(machine, roz_get_tile_info, plygonet_scan_cols, 16, 16, 32, 64);
118   tilemap_set_transparent_pen(roz_tilemap, 0);
83119}
84120
85121VIDEO_UPDATE( polygonet )
r5955r5956
87123   bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
88124   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
89125
126   K053936_0_zoom_draw(bitmap, cliprect, roz_tilemap, 0, 0, 0);
127
90128   tilemap_draw(bitmap, cliprect, ttl_tilemap, 0, 1<<0);
91129   return 0;
92130}
src/mame/video/lucky74.c
r5955r5956
9797#include "video/resnet.h"
9898
9999
100UINT8 *fg_videoram, *fg_colorram, *bg_videoram, *bg_colorram;
100UINT8 *lucky74_fg_videoram, *lucky74_fg_colorram, *lucky74_bg_videoram, *lucky74_bg_colorram;
101101static tilemap *fg_tilemap, *bg_tilemap;
102102
103103
104WRITE8_HANDLER( fg_videoram_w )
104WRITE8_HANDLER( lucky74_fg_videoram_w )
105105{
106   fg_videoram[offset] = data;
106   lucky74_fg_videoram[offset] = data;
107107   tilemap_mark_tile_dirty(fg_tilemap, offset);
108108}
109109
110WRITE8_HANDLER( fg_colorram_w )
110WRITE8_HANDLER( lucky74_fg_colorram_w )
111111{
112   fg_colorram[offset] = data;
112   lucky74_fg_colorram[offset] = data;
113113   tilemap_mark_tile_dirty(fg_tilemap, offset);
114114}
115115
116WRITE8_HANDLER( bg_videoram_w )
116WRITE8_HANDLER( lucky74_bg_videoram_w )
117117{
118   bg_videoram[offset] = data;
118   lucky74_bg_videoram[offset] = data;
119119   tilemap_mark_tile_dirty(bg_tilemap, offset);
120120}
121121
122WRITE8_HANDLER( bg_colorram_w )
122WRITE8_HANDLER( lucky74_bg_colorram_w )
123123{
124   bg_colorram[offset] = data;
124   lucky74_bg_colorram[offset] = data;
125125   tilemap_mark_tile_dirty(bg_tilemap, offset);
126126}
127127
r5955r5956
206206    xxxx ----   tiles page offset.
207207*/
208208   int bank = 0;
209   int attr = fg_colorram[tile_index];
210   int code = fg_videoram[tile_index] + ((attr & 0xf0) << 4);
209   int attr = lucky74_fg_colorram[tile_index];
210   int code = lucky74_fg_videoram[tile_index] + ((attr & 0xf0) << 4);
211211   int color = (attr & 0x0f);
212212
213213   SET_TILE_INFO(bank, code, color, 0);
r5955r5956
221221    xxxx ----   tiles page offset.
222222*/
223223   int bank = 1;
224   int attr = bg_colorram[tile_index];
225   int code = bg_videoram[tile_index] + ((attr & 0xf0) << 4);
224   int attr = lucky74_bg_colorram[tile_index];
225   int code = lucky74_bg_videoram[tile_index] + ((attr & 0xf0) << 4);
226226   int color = (attr & 0x0f);
227227
228228   SET_TILE_INFO(bank, code, color, 0);
src/mame/video/taito_f2.c
r5955r5956
4343static UINT16 spritebank[8];
4444//static UINT16 spritebank_eof[8];
4545static UINT16 spritebank_buffered[8];
46static UINT16 koshien_spritebank;
4746
4847static INT32 sprites_disabled,sprites_active_area,sprites_master_scrollx,sprites_master_scrolly;
4948/* remember flip status over frames because driftout can fail to set it */
r5955r5956
134133   state_save_register_global(machine, f2_hide_pixels);
135134   state_save_register_global(machine, f2_sprite_type);
136135   state_save_register_global_array(machine, spritebank);
137   state_save_register_global(machine, koshien_spritebank);
138136   state_save_register_global(machine, sprites_disabled);
139137   state_save_register_global(machine, sprites_active_area);
140138   state_save_register_global_pointer(machine, spriteram_delayed, spriteram_size/2);
r5955r5956
347345
348346}
349347
350READ16_HANDLER( koshien_spritebank_r )
351{
352   return koshien_spritebank;
353}
354
355348WRITE16_HANDLER( koshien_spritebank_w )
356349{
357   koshien_spritebank = data;
358
359350   spritebank_buffered[0]=0x0000;   /* never changes */
360351   spritebank_buffered[1]=0x0400;
361352
src/mame/video/segasyse.c
r5955r5956
1/*******************************************************************************
2 Sega System E (834-5803) Driver (video/segasyse.c)
3********************************************************************************
4 driver by David Haywood
51
6 this is currently only used by megaplay, and will soon be obsolete.
72
8*******************************************************************************/
9
10#include "driver.h"
11
12/*-- Variables --*/
13
14#define CHIPS 2                     /* There are 2 VDP Chips */
15
16static UINT8 vdp_cmdpart[CHIPS];      /* VDP Command Part Counter */
17static UINT16 vdp_command[CHIPS];      /* VDP Command Word */
18
19static UINT8 vdp_accessmode[CHIPS];      /* VDP Access Mode (VRAM, CRAM) */
20static UINT16 vdp_accessaddr[CHIPS];   /* VDP Access Address */
21static UINT8 vdp_readbuffer[CHIPS];      /* VDP Read Buffer */
22
23static UINT8 *segae_vdp_vram[CHIPS];         /* Pointer to VRAM */
24static UINT8 *vdp_cram[CHIPS];         /* Pointer to the VDP's CRAM */
25UINT8 *segae_vdp_regs[CHIPS];         /* Pointer to the VDP's Registers */
26
27static UINT8 segae_vdp_vrambank[CHIPS];      /* Current VRAM Bank number (from writes to Port 0xf7) */
28
29static UINT8 *cache_bitmap;               /* 8bpp bitmap with raw pen values */
30
31static int palette_base; // needed for megatech for now..
32
33UINT8 segae_vintpending;
34UINT8 segae_hintpending;
35
36/*-- Prototypes --*/
37
38static void vdp_start(running_machine *machine, UINT8 chip );
39
40static void vdp_processcmd(UINT8 chip, UINT16 cmd);
41static void vdp_setregister(UINT8 chip, UINT16 cmd);
42
43static void draw_tiles_line(UINT8 *dest, int line, UINT8 chip, UINT8 pri);
44static void draw_sprite_line(UINT8 *dest, UINT8 chip, UINT8 line);
45static void segae_drawscanline(running_machine *machine, int line, int chips, int blank);
46
47static void draw_8pix_solid16(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col);
48static void draw_8pix(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col);
49static void draw_8pix_sprite(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line);
50
51/*******************************************************************************
52 vhstart, vhstop and vhrefresh functions
53*******************************************************************************/
54
55/* starts vdp for bios screen only */
56VIDEO_START( megaplay_normal )
57{
58   palette_base = 0x40;
59
60   vdp_start(machine, 0);
61
62   cache_bitmap = auto_alloc_array(machine, UINT8, (16+256+16) * 192); /* 16 pixels either side to simplify drawing */
63}
64
65VIDEO_UPDATE( megaplay_normal )
66{
67   int miny = (cliprect->min_y < 16) ? 16 : cliprect->min_y;
68   int maxy = (cliprect->max_y > 16+192-1) ? 16+192-1 : cliprect->max_y;
69   int i;
70
71   /*- Draw from cache_bitmap to screen -*/
72
73   for (i = miny; i <= maxy;i++)
74      segae_drawscanline(screen->machine, i-16,0,0);
75
76   for (i = miny;i <= maxy;i++)
77   {
78      UINT16 *dest = BITMAP_ADDR16(bitmap, i, 32);
79      int x;
80      for (x = 0; x < 256; x++)
81      {
82         UINT8 pix = cache_bitmap[(i-16) * (16+256+16) + 24 + x];
83         if (pix != 0)
84            dest[x] = screen->machine->pens[palette_base + pix];
85      }
86   }
87
88   return 0;
89}
90
91/*******************************************************************************
92 VDP Start / Stop Functions
93********************************************************************************
94 note: we really should check after each allocation to make sure it was
95       successful then if one allocation fails we can free up the previous ones
96*******************************************************************************/
97
98static void vdp_start(running_machine *machine, UINT8 chip)
99{
100   UINT8 temp;
101
102   /*- VRAM -*/
103
104   segae_vdp_vram[chip] = auto_alloc_array(machine, UINT8, 0x8000); /* 32kb (2 banks) */
105   segae_vdp_vrambank[chip] = 0;
106
107   /*- CRAM -*/
108
109   vdp_cram[chip] = auto_alloc_array(machine, UINT8, 0x20);
110
111   /*- VDP Registers -*/
112
113   segae_vdp_regs[chip] = auto_alloc_array(machine, UINT8, 0x20);
114
115   /*- Clear Memory -*/
116
117   memset(segae_vdp_vram[chip], 0, 0x8000);
118   memset(vdp_cram[chip], 0, 0x20);
119   memset(segae_vdp_regs[chip], 0, 0x20);
120
121   /*- Set Up Some Default Values */
122
123   vdp_accessaddr[chip] = 0;
124   vdp_accessmode[chip] = 0;
125   vdp_cmdpart[chip] = 0;
126   vdp_command[chip] = 0;
127
128   /*- Black the Palette -*/
129
130   for (temp=0;temp<32;temp++)
131      palette_set_color(machine, temp + 32*chip+palette_base, MAKE_RGB(0, 0, 0));
132
133   /* Save State Stuff (based on video/taitoic.c) */
134
135   state_save_register_item_pointer(machine, "VDP", NULL, chip, segae_vdp_vram[chip], 0x8000);
136   state_save_register_item_pointer(machine, "VDP", NULL, chip, vdp_cram[chip], 0x20);
137   state_save_register_item_pointer(machine, "VDP", NULL, chip, segae_vdp_regs[chip], 0x20);
138   state_save_register_item(machine, "VDP", NULL, chip, vdp_cmdpart[chip]);
139   state_save_register_item(machine, "VDP", NULL, chip, vdp_command[chip]);
140   state_save_register_item(machine, "VDP", NULL, chip, vdp_accessmode[chip]);
141   state_save_register_item(machine, "VDP", NULL, chip, vdp_accessaddr[chip]);
142   state_save_register_item(machine, "VDP", NULL, chip, segae_vdp_vrambank[chip]);
143}
144
145/*******************************************************************************
146 Core VDP Functions
147*******************************************************************************/
148
149/*-- Reads --*/
150
151/***************************************
152 segae_vdp_ctrl_r ( UINT8 chip )
153****************************************
154 reading the vdp control port will
155 return the following
156
157 bit:
158  7 - vert int pending
159  6 - line int pending
160  5 - sprite collision (non 0 pixels) *not currently emulated (not needed by these games)*
161  4 - always 0
162  3 - always 0
163  2 - always 0
164  1 - always 0
165  0 - always 0
166
167  bits 5,6,7 are cleared after a read
168***************************************/
169
170UINT8 segae_vdp_ctrl_r ( UINT8 chip )
171{
172   UINT8 temp;
173
174   temp = 0;
175
176   temp |= (segae_vintpending << 7);
177   temp |= (segae_hintpending << 6);
178
179   segae_hintpending = segae_vintpending = 0;
180
181   return temp;
182}
183
184UINT8 segae_vdp_data_r ( UINT8 chip )
185{
186   UINT8 temp;
187
188   vdp_cmdpart[chip] = 0;
189
190   temp = vdp_readbuffer[chip];
191
192   if (vdp_accessmode[chip]==0x03) { /* CRAM Access */
193      /* error CRAM can't be read!! */
194   } else { /* VRAM */
195      vdp_readbuffer[chip] = segae_vdp_vram[chip][ segae_vdp_vrambank[chip]*0x4000 + vdp_accessaddr[chip] ];
196      vdp_accessaddr[chip] += 1;
197      vdp_accessaddr[chip] &= 0x3fff;
198   }
199   return temp;
200}
201
202/*-- Writes --*/
203
204void segae_vdp_ctrl_w ( UINT8 chip, UINT8 data )
205{
206   if (!vdp_cmdpart[chip]) {
207      vdp_cmdpart[chip] = 1;
208      vdp_command[chip] = data;
209   } else {
210      vdp_cmdpart[chip] = 0;
211      vdp_command[chip] |= (data << 8);
212      vdp_processcmd (chip, vdp_command[chip]);
213   }
214}
215
216void segae_vdp_data_w ( running_machine *machine, UINT8 chip, UINT8 data )
217{
218   vdp_cmdpart[chip] = 0;
219
220   if (vdp_accessmode[chip]==0x03) { /* CRAM Access */
221      UINT8 r,g,b, temp;
222
223      temp = vdp_cram[chip][vdp_accessaddr[chip]];
224
225      vdp_cram[chip][vdp_accessaddr[chip]] = data;
226
227      if (temp != data) {
228         r = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x03) >> 0;
229         g = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x0c) >> 2;
230         b = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x30) >> 4;
231
232         palette_set_color_rgb(machine, vdp_accessaddr[chip] + 32*chip+palette_base, pal2bit(r), pal2bit(g), pal2bit(b));
233      }
234
235      vdp_accessaddr[chip] += 1;
236      vdp_accessaddr[chip] &= 0x1f;
237   } else { /* VRAM Accesses */
238      segae_vdp_vram[chip][ segae_vdp_vrambank[chip]*0x4000 + vdp_accessaddr[chip] ] = data;
239      vdp_accessaddr[chip] += 1;
240      vdp_accessaddr[chip] &= 0x3fff;
241   }
242}
243
244/*-- Associated Functions --*/
245
246/***************************************
247 vdp_processcmd
248****************************************
249
250general command format
251
252 M M A A A A A A A A A A A A A A  M=Mode, A=Address
253
254 the command will be one of 3 things according to the upper
255 4 bits
256
257 0 0 - - - - - - - - - - - - - -  VRAM Acess Mode (Special Read)
258
259 0 1 - - - - - - - - - - - - - -  VRAM Acesss Mode
260
261 1 0 0 0 - - - - - - - - - - - -  VDP Register Set (current mode & address _not_ changed)
262
263 1 0 x x - - - - - - - - - - - -  VRAM Access Mode (0x1000 - 0x3FFF only, x x is anything but 0 0)
264
265 1 1 - - - - - - - - - - - - - -  CRAM Access Mode
266
267***************************************/
268
269static void vdp_processcmd (UINT8 chip, UINT16 cmd)
270{
271   if ( (cmd & 0xf000) == 0x8000 ) { /*  1 0 0 0 - - - - - - - - - - - -  VDP Register Set */
272      vdp_setregister (chip, cmd);
273   } else { /* Anything Else */
274      vdp_accessmode[chip] = (cmd & 0xc000) >> 14;
275      vdp_accessaddr[chip] = (cmd & 0x3fff);
276
277      if ((vdp_accessmode[chip]==0x03) && (vdp_accessaddr[chip] > 0x1f) ) { /* Check Address is valid for CRAM */
278         /* Illegal, CRAM isn't this large! */
279         vdp_accessaddr[chip] &= 0x1f;
280      }
281
282      if (vdp_accessmode[chip] == 0x00) { /*  0 0 - - - - - - - - - - - - - -  VRAM Acess Mode (Special Read) */
283         vdp_readbuffer[chip] = segae_vdp_vram[chip][ segae_vdp_vrambank[chip]*0x4000 + vdp_accessaddr[chip] ];
284         vdp_accessaddr[chip] += 1;
285         vdp_accessaddr[chip] &= 0x3fff;
286      }
287   }
288}
289
290/***************************************
291 vdp_setregister
292
293 general command format
294
295 1 0 0 0 R R R R D D D D D D D D  1/0 = Fixed Values, R = Register # / Address, D = Data
296
297***************************************/
298
299static void vdp_setregister(UINT8 chip, UINT16 cmd)
300{
301   UINT8 regnumber;
302   UINT8 regdata;
303
304   regnumber = (cmd & 0x0f00) >> 8;
305   regdata   = (cmd & 0x00ff);
306
307   if (regnumber < 11) {
308      segae_vdp_regs[chip][regnumber] = regdata;
309   } else {
310      /* Illegal, there aren't this many registers! */
311   }
312}
313
314/*******************************************************************************
315 System E Drawing Capabilities Notes
316********************************************************************************
317 Display Consists of
318
319 VDP0 Backdrop Color (?)
320 VDP0 Tiles (Low)
321 VDP0 Sprites
322 VDP0 Tiles (High)
323 VDP1 Tiles (Low)
324 VDP1 Sprites
325 VDP1 Tiles (High)
326
327 each vdp has its on vram, etc etc.
328
329 the tilemaps are 256x224 in size, 256x192 of this is visible, the tiles
330 are 8x8 pixels, so 32x28 of 8x8 tiles make a 256x224 tilemap.
331
332 the tiles are 4bpp (16 colours), video ram can hold upto 512 tile gfx
333
334 tile references are 16 bits (3 bits unused, 1 bit priority, 1 bit palette,
335 2 bits for flip, 9 bits for tile number)
336
337 tilemaps can be scrolled horizontally, the top 16 lines of the display can
338 have horinzontal scrolling disabled
339
340 tilemaps can be scrolled vertically, the right 64 lines of the display can
341 have the vertical scrolling disabled
342
343 the leftmost 8 line of the display can be blanked
344
345*******************************************************************************/
346
347static void segae_drawscanline(running_machine *machine, int line, int chips, int blank)
348{
349
350   UINT8* dest;
351
352   if (video_skip_this_frame())
353      return;
354
355   dest = cache_bitmap + (16+256+16) * line;
356
357   /* This should be cleared to bg colour, but which vdp determines that !, neither seems to be right, maybe its always the same col? */
358   memset(dest, 0, 16+256+16);
359
360   if (segae_vdp_regs[0][1] & 0x40) {
361      draw_tiles_line (dest+16, line, 0,0);
362      draw_sprite_line(dest+16, 0, line);
363      draw_tiles_line (dest+16, line, 0,1);
364   }
365
366   if (chips>0) /* we don't want to do this on megatech */
367   {
368      if (segae_vdp_regs[1][1] & 0x40) {
369         draw_tiles_line (dest+16, line, 1,0);
370         draw_sprite_line(dest+16, 1, line);
371         draw_tiles_line (dest+16, line, 1,1);
372      }
373   }
374
375   /* FIX ME!! */
376   if (blank)
377   {
378      if (strcmp(machine->gamedrv->name,"tetrisse")) /* and we really don't want to do it on tetrise */
379         memset(dest+16, 32+16, 8); /* Clear Leftmost column, there should be a register for this like on the SMS i imagine    */
380                                   /* on the SMS this is bit 5 of register 0 (according to CMD's SMS docs) for system E this  */                                   /* appears to be incorrect, most games need it blanked 99% of the time so we blank it      */
381   }
382}
383
384/*-- Drawing a line of tiles --*/
385
386static void draw_tiles_line(UINT8 *dest, int line, UINT8 chip, UINT8 pri)
387{
388   /* todo: fix vscrolling (or is it something else causing the glitch on the hi-score screen of hangonjr, seems to be ..  */
389
390   UINT8 hscroll;
391   UINT8 vscroll;
392   UINT16 tmbase;
393   UINT8 tilesline, tilesline2;
394   UINT8 coloffset, coloffset2;
395   UINT8 loopcount;
396
397   hscroll = (256-segae_vdp_regs[chip][8]);
398   vscroll = segae_vdp_regs[chip][9];
399   if (vscroll > 224) vscroll %= 224;
400
401   tmbase =  (segae_vdp_regs[chip][2] & 0x0e) << 10;
402   tmbase += (segae_vdp_vrambank[chip] * 0x4000);
403
404   tilesline = (line + vscroll) >> 3;
405   tilesline2= (line + vscroll) % 8;
406
407
408   coloffset = (hscroll >> 3);
409   coloffset2= (hscroll % 8);
410
411   dest -= coloffset2;
412
413   for (loopcount=0;loopcount<33;loopcount++) {
414
415      UINT16 vram_offset, vram_word;
416      UINT16 tile_no;
417      UINT8  palette, priority, flipx, flipy;
418
419      vram_offset = tmbase
420               + (2 * (32*tilesline + ((coloffset+loopcount)&0x1f) ) );
421      vram_word = segae_vdp_vram[chip][vram_offset] | (segae_vdp_vram[chip][vram_offset+1] << 8);
422
423      tile_no = (vram_word & 0x01ff);
424      flipx =   (vram_word & 0x0200) >> 9;
425      flipy =   (vram_word & 0x0400) >> 10;
426      palette = (vram_word & 0x0800) >> 11;
427      priority= (vram_word & 0x1000) >> 12;
428
429      tilesline2= (line + vscroll) % 8;
430      if (flipy) tilesline2 = 7-tilesline2;
431
432      if (priority == pri) {
433         if (chip == 0) draw_8pix_solid16(dest, chip, tile_no,tilesline2,flipx,palette);
434         else draw_8pix(dest, chip, tile_no,tilesline2,flipx,palette);
435      }
436      dest+=8;
437   }
438}
439
440static void draw_sprite_line(UINT8 *dest, UINT8 chip, UINT8 line)
441{
442   int nosprites;
443   int loopcount;
444
445   UINT16 spritebase;
446
447   nosprites = 63; // if there is no end marker we draw everything (ridleofp)
448
449   spritebase =  (segae_vdp_regs[chip][5] & 0x7e) << 7;
450   spritebase += (segae_vdp_vrambank[chip] * 0x4000);
451
452   /*- find out how many sprites there are -*/
453
454   for (loopcount=0;loopcount<64;loopcount++) {
455      UINT8 ypos;
456
457      ypos = segae_vdp_vram[chip][spritebase+loopcount];
458
459      if (ypos==208) {
460         nosprites=loopcount;
461         break;
462      }
463   }
464
465   /*- draw sprites IN REVERSE ORDER -*/
466
467   for (loopcount = nosprites; loopcount >= 0;loopcount--) {
468      int ypos;
469      UINT8 sheight;
470
471      ypos = segae_vdp_vram[chip][spritebase+loopcount] +1;
472
473      if (segae_vdp_regs[chip][1] & 0x02) sheight=16; else sheight=8;
474
475      if ( (line >= ypos) && (line < ypos+sheight) ) {
476         int xpos;
477         UINT16 sprnum;
478         UINT8 spline;
479
480         spline = line - ypos;
481
482         xpos   = segae_vdp_vram[chip][spritebase+0x80+ (2*loopcount)];
483         sprnum = segae_vdp_vram[chip][spritebase+0x81+ (2*loopcount)];
484
485         if (segae_vdp_regs[chip][6] & 0x04)
486            sprnum += 0x100;
487
488         draw_8pix_sprite(dest+xpos, chip, sprnum, spline);
489
490      }
491   }
492}
493
494static void draw_8pix_solid16(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col)
495{
496
497   UINT32 pix8 = *(UINT32 *)&segae_vdp_vram[chip][(32)*tile + (4)*line + (0x4000) * segae_vdp_vrambank[chip]];
498   UINT8  pix, coladd;
499
500   if (!pix8 && !col) return; /*note only the colour 0 of each vdp is transparent NOT colour 16???, fixes sky in HangonJr */
501
502   coladd = 16*col;
503
504   if (flipx)   {
505      pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; pix+= coladd ; if (pix) dest[0] = pix+ 32*chip;
506      pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; pix+= coladd ; if (pix) dest[1] = pix+ 32*chip;
507      pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; pix+= coladd ; if (pix) dest[2] = pix+ 32*chip;
508      pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; pix+= coladd ; if (pix) dest[3] = pix+ 32*chip;
509      pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; pix+= coladd ; if (pix) dest[4] = pix+ 32*chip;
510      pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; pix+= coladd ; if (pix) dest[5] = pix+ 32*chip;
511      pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; pix+= coladd ; if (pix) dest[6] = pix+ 32*chip;
512      pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; pix+= coladd ; if (pix) dest[7] = pix+ 32*chip;
513   } else {
514      pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; pix+= coladd ; if (pix) dest[0] = pix+ 32*chip;
515      pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; pix+= coladd ; if (pix) dest[1] = pix+ 32*chip;
516      pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; pix+= coladd ; if (pix) dest[2] = pix+ 32*chip;
517      pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; pix+= coladd ; if (pix) dest[3] = pix+ 32*chip;
518      pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; pix+= coladd ; if (pix) dest[4] = pix+ 32*chip;
519      pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; pix+= coladd ; if (pix) dest[5] = pix+ 32*chip;
520      pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; pix+= coladd ; if (pix) dest[6] = pix+ 32*chip;
521      pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; pix+= coladd ; if (pix) dest[7] = pix+ 32*chip;
522   }
523}
524
525static void draw_8pix(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col)
526{
527
528   UINT32 pix8 = *(UINT32 *)&segae_vdp_vram[chip][(32)*tile + (4)*line + (0x4000) * segae_vdp_vrambank[chip]];
529   UINT8  pix, coladd;
530
531   if (!pix8) return;
532
533   coladd = 16*col+32*chip;
534
535   if (flipx)   {
536      pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; if (pix) dest[0] = pix+ coladd;
537      pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; if (pix) dest[1] = pix+ coladd;
538      pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; if (pix) dest[2] = pix+ coladd;
539      pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; if (pix) dest[3] = pix+ coladd;
540      pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; if (pix) dest[4] = pix+ coladd;
541      pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; if (pix) dest[5] = pix+ coladd;
542      pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; if (pix) dest[6] = pix+ coladd;
543      pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; if (pix) dest[7] = pix+ coladd;
544   } else {
545      pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; if (pix) dest[0] = pix+ coladd;
546      pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; if (pix) dest[1] = pix+ coladd;
547      pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; if (pix) dest[2] = pix+ coladd;
548      pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; if (pix) dest[3] = pix+ coladd;
549      pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; if (pix) dest[4] = pix+ coladd;
550      pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; if (pix) dest[5] = pix+ coladd;
551      pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; if (pix) dest[6] = pix+ coladd;
552      pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; if (pix) dest[7] = pix+ coladd;
553   }
554}
555
556static void draw_8pix_sprite(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line)
557{
558
559   UINT32 pix8 = *(UINT32 *)&segae_vdp_vram[chip][(32)*tile + (4)*line + (0x4000) * segae_vdp_vrambank[chip]];
560   UINT8  pix;
561
562   if (!pix8) return; /*note only the colour 0 of each vdp is transparent NOT colour 16, fixes sky in HangonJr */
563
564   pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; if (pix) dest[0] = pix+16+32*chip;
565   pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; if (pix) dest[1] = pix+16+32*chip;
566   pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; if (pix) dest[2] = pix+16+32*chip;
567   pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; if (pix) dest[3] = pix+16+32*chip;
568   pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; if (pix) dest[4] = pix+16+32*chip;
569   pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; if (pix) dest[5] = pix+16+32*chip;
570   pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; if (pix) dest[6] = pix+16+32*chip;
571   pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; if (pix) dest[7] = pix+16+32*chip;
572
573}
src/mame/video/genesis.c
r5955r5956
1212
1313#include "genesis.h"
1414
15/* in video/segasyse.c */
16VIDEO_START( megaplay_normal );
17VIDEO_UPDATE( megaplay_normal );
1815
1916static const device_config *genesis_screen;
2017
r5955r5956
279276/* megaplay, draws either Genesis or SMS (single screen display) */
280277
281278/* core refresh: computes the final screen */
279#if 0
282280VIDEO_UPDATE( megaplay )
283281{
284282   int y;
r5955r5956
287285   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
288286      drawline(BITMAP_ADDR16(bitmap, y, 0), y, 0);
289287
290   VIDEO_UPDATE_CALL(megaplay_normal);
288   //VIDEO_UPDATE_CALL(megaplay_normal);
291289
292290   return 0;
293291}
292#endif
294293
295294void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect )
296295{
src/mame/drivers/bublbobl.c
r5955r5956
286286   AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE(&bublbobl_objectram) AM_SIZE(&bublbobl_objectram_size)
287287   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE(1)
288288   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram)
289   AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(sound_status_r, bublbobl_sound_command_w)
290   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(soundcpu_reset_w)
289   AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w)
290   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(bublbobl_soundcpu_reset_w)
291291   AM_RANGE(0xfa80, 0xfa80) AM_WRITE(watchdog_reset_w)
292292   AM_RANGE(0xfb40, 0xfb40) AM_WRITE(bublbobl_bankswitch_w)
293293   AM_RANGE(0xfc00, 0xffff) AM_RAM AM_BASE(&bublbobl_mcu_sharedram)
r5955r5956
303303   AM_RANGE(0x8000, 0x8fff) AM_RAM
304304   AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE("ym1", ym2203_r, ym2203_w)
305305   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ym2", ym3526_r, ym3526_w)
306   AM_RANGE(0xb000, 0xb000) AM_READWRITE(soundlatch_r, sound_status_w)
306   AM_RANGE(0xb000, 0xb000) AM_READWRITE(soundlatch_r, bublbobl_sound_status_w)
307307   AM_RANGE(0xb001, 0xb001) AM_WRITE(bublbobl_sh_nmi_enable_w) AM_READNOP
308308   AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
309309   AM_RANGE(0xe000, 0xffff) AM_ROM   // space for diagnostic ROM?
r5955r5956
342342   AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE(&bublbobl_objectram) AM_SIZE(&bublbobl_objectram_size)
343343   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE(1)
344344   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram)
345   AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(sound_status_r, bublbobl_sound_command_w)
346   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(soundcpu_reset_w)
345   AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w)
346   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(bublbobl_soundcpu_reset_w)
347347   AM_RANGE(0xfa80, 0xfa80) AM_WRITENOP // ???
348348   AM_RANGE(0xfb40, 0xfb40) AM_WRITE(bublbobl_bankswitch_w)
349349   AM_RANGE(0xfc00, 0xfcff) AM_RAM
r5955r5956
375375   AM_RANGE(0xfa80, 0xfa80) AM_WRITE(tokio_bankswitch_w)
376376   AM_RANGE(0xfb00, 0xfb00) AM_WRITE(tokio_videoctrl_w)
377377   AM_RANGE(0xfb80, 0xfb80) AM_WRITE(bublbobl_nmitrigger_w)
378   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(sound_status_r, bublbobl_sound_command_w)
378   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w)
379379   AM_RANGE(0xfe00, 0xfe00) AM_READ(tokio_mcu_r) AM_WRITENOP // ???
380380ADDRESS_MAP_END
381381
r5955r5956
387387static ADDRESS_MAP_START( tokio_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
388388   AM_RANGE(0x0000, 0x7fff) AM_ROM
389389   AM_RANGE(0x8000, 0x8fff) AM_RAM
390   AM_RANGE(0x9000, 0x9000) AM_READWRITE(soundlatch_r, sound_status_w)
390   AM_RANGE(0x9000, 0x9000) AM_READWRITE(soundlatch_r, bublbobl_sound_status_w)
391391   AM_RANGE(0x9800, 0x9800) AM_READNOP   // ???
392392   AM_RANGE(0xa000, 0xa000) AM_WRITE(bublbobl_sh_nmi_disable_w)
393393   AM_RANGE(0xa800, 0xa800) AM_WRITE(bublbobl_sh_nmi_enable_w)
src/mame/drivers/snowbros.c
r5955r5956
15581558   /* video hardware */
15591559   MDRV_GFXDECODE(wb)
15601560   MDRV_VIDEO_UPDATE(wintbob)
1561   MDRV_VIDEO_EOF(NULL)
1561   MDRV_VIDEO_EOF(0)
15621562MACHINE_DRIVER_END
15631563
15641564
src/mame/drivers/zaxxon.c
r5955r5956
11421142   ROM_LOAD( "j214a2.72",    0x0100, 0x0100, CRC(a9e1fb43) SHA1(57dbcfe2438fd090c08594818549aeea6339eab2) )
11431143ROM_END
11441144
1145ROM_START( zaxxonj )
1146   ROM_REGION( 0x6000, "maincpu", 0 )
1147   ROM_LOAD( "zaxxon_rom3.u13",  0x0000, 0x2000, CRC(925168c7) SHA1(0f14b5072b5be252955ffb3a30fa6c76b3e6a6c4) )
1148   ROM_LOAD( "zaxxon_rom2.u12",  0x2000, 0x2000, CRC(c088df92) SHA1(c0c6cd8dcf6db65129980331fa9ecc3800b63436) )
1149   ROM_LOAD( "zaxxon_rom1.u11",  0x4000, 0x1000, CRC(f832dd79) SHA1(1d626f22630eaa53603637991a06aeb7401e9769) )
1150
1151   ROM_REGION( 0x1000, "gfx1", 0 )
1152   ROM_LOAD( "zaxxon_rom14.u54", 0x0000, 0x0800, CRC(07bf8c52) SHA1(425157a1625b1bd5169c3218b958010bf6af12bb) )
1153   ROM_LOAD( "zaxxon_rom15.u55", 0x0800, 0x0800, CRC(c215edcb) SHA1(f1ded2173eb139f48d2ca86c5ef00acbe6c11cd3) )
1154
1155   ROM_REGION( 0x6000, "gfx2", 0 )
1156   ROM_LOAD( "zaxxon_rom6.u70",  0x0000, 0x2000, CRC(6e07bb68) SHA1(a002f3441b0f0044615ce71ecbd14edadba16270) )
1157   ROM_LOAD( "zaxxon_rom5.u69",  0x2000, 0x2000, CRC(0a5bce6a) SHA1(a86543727389931244ba8a576b543d7ac05a2585) )
1158   ROM_LOAD( "zaxxon_rom4.u68",  0x4000, 0x2000, CRC(a5bf1465) SHA1(a8cd27dfb4a606bae8bfddcf936e69e980fb1977) )
1159
1160   ROM_REGION( 0x6000, "gfx3", 0 )
1161   ROM_LOAD( "zaxxon_rom11.u59", 0x0000, 0x2000, CRC(eaf0dd4b) SHA1(194e2ca0a806e0cb6bb7cc8341d1fc6f2ea911f6) )
1162   ROM_LOAD( "zaxxon_rom12.u60", 0x2000, 0x2000, CRC(1c5369c7) SHA1(af6a5984c3cedfa8c9efcd669f4f205b51a433b2) )
1163   ROM_LOAD( "zaxxon_rom13.u61", 0x4000, 0x2000, CRC(ab4e8a9a) SHA1(4ac79cccc30e4adfa878b36101e97e20ac010438) )
1164
1165   ROM_REGION( 0x8000, "gfx4", 0 )
1166   ROM_LOAD( "zaxxon_rom8.u58",  0x0000, 0x2000, CRC(28d65063) SHA1(e1f90716236c61df61bdc6915a8e390cb4dcbf15) )
1167   ROM_LOAD( "zaxxon_rom7.u57",  0x2000, 0x2000, CRC(6284c200) SHA1(d26a9049541479b8b19f5aa0690cf4aaa787c9b5) )
1168   ROM_LOAD( "zaxxon_rom10.u60", 0x4000, 0x2000, CRC(a95e61fd) SHA1(a0f8c15ff75affa3532abf8f340811cf415421fd) )
1169   ROM_LOAD( "zaxxon_rom9.u59",  0x6000, 0x2000, CRC(7e42691f) SHA1(2124363be8f590b74e2b15dd3f90d77dd9ca9528) )
1170
1171   ROM_REGION( 0x0200, "proms", 0 )
1172   ROM_LOAD( "mro_16.u76",   0x0000, 0x0100, CRC(6cc6695b) SHA1(01ae8450ccc302e1a5ae74230d44f6f531a962e2) )
1173   ROM_LOAD( "mro_17.u41",   0x0100, 0x0100, CRC(a9e1fb43) SHA1(57dbcfe2438fd090c08594818549aeea6339eab2) )
1174ROM_END
1175
11451176ROM_START( zaxxonb )
11461177   ROM_REGION( 0x6000, "maincpu", 0 )
11471178   ROM_LOAD( "zaxxonb3.u27", 0x0000, 0x2000, CRC(125bca1c) SHA1(f4160966d42e5282736cde8a276204ba8910ca61) )
r5955r5956
13881419 *
13891420 *************************************/
13901421
1391static void zaxxonb_decode(running_machine *machine, const char *cputag)
1422static void zaxxonj_decode(running_machine *machine, const char *cputag)
13921423{
13931424/*
13941425    the values vary, but the translation mask is always laid out like this:
r5955r5956
14731504 *
14741505 *************************************/
14751506
1476static DRIVER_INIT( zaxxonb )
1507static DRIVER_INIT( zaxxonj )
14771508{
1478   zaxxonb_decode(machine, "maincpu");
1509   zaxxonj_decode(machine, "maincpu");
14791510}
14801511
14811512
r5955r5956
15311562/* these games run on standard Zaxxon hardware */
15321563GAME( 1982, zaxxon,   0,      zaxxon,   zaxxon,   0,        ROT90,  "Sega",    "Zaxxon (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
15331564GAME( 1982, zaxxon2,  zaxxon, zaxxon,   zaxxon,   0,        ROT90,  "Sega",    "Zaxxon (set 2)",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
1534GAME( 1982, zaxxonb,  zaxxon, zaxxon,   zaxxon,   zaxxonb,  ROT90,  "bootleg", "Jackson",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
1565GAME( 1982, zaxxonj,  zaxxon, zaxxon,   zaxxon,   zaxxonj,  ROT90,  "Sega",    "Zaxxon (Japan)",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
1566GAME( 1982, zaxxonb,  zaxxon, zaxxon,   zaxxon,   zaxxonj,  ROT90,  "bootleg", "Jackson",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
15351567GAME( 1982, szaxxon,  0,      zaxxon,   szaxxon,  szaxxon,  ROT90,  "Sega",    "Super Zaxxon (315-5013)",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
15361568GAME( 1984, futspy,   0,      futspy,   futspy,   futspy,   ROT90,  "Sega",    "Future Spy (315-5061)",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
15371569
src/mame/drivers/skyraid.c
r5955r5956
250250   /* sound hardware */
251251   MDRV_SPEAKER_STANDARD_MONO("mono")
252252
253   MDRV_SOUND_ADD("discrete", DISCRETE, 96000)
253   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
254254   MDRV_SOUND_CONFIG_DISCRETE(skyraid)
255255   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
256256MACHINE_DRIVER_END
r5955r5956
286286ROM_END
287287
288288
289GAME( 1978, skyraid, 0, skyraid, skyraid, 0, ORIENTATION_FLIP_Y, "Atari", "Sky Raider", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_COLORS )
289GAME( 1978, skyraid, 0, skyraid, skyraid, 0, ORIENTATION_FLIP_Y, "Atari", "Sky Raider", GAME_IMPERFECT_COLORS )
src/mame/drivers/mpu4.c
r5955r5956
311311static UINT8  lamp_data;
312312static UINT8  ay_data;
313313
314extern const UINT8 MPU4_chr_lut[72];
315314static UINT8 MPU4_chr_data[72];
316315
317316static UINT8 Lamps[128];      /* 128 multiplexed lamps */
318317static int optic_pattern;
319318
320319/* Lookup table for CHR data */
321const UINT8 MPU4_chr_lut[72]= {   0x00,0x1A,0x04,0x10,0x18,0x0F,0x13,0x1B,
320static const UINT8 MPU4_chr_lut[72]= {   0x00,0x1A,0x04,0x10,0x18,0x0F,0x13,0x1B,
322321                        0x03,0x07,0x17,0x1D,0x36,0x35,0x2B,0x28,
323322                        0x39,0x21,0x22,0x25,0x2C,0x29,0x31,0x34,
324323                        0x0A,0x1F,0x06,0x0E,0x1C,0x12,0x1E,0x0D,
src/mame/drivers/mw8080bw.c
r5955r5956
17731773   PORT_START(CLOWNS_CONTROLLER_P2_TAG)
17741774   PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2)
17751775
1776   PORT_START("MUSIC_ADJ")  /* 3 */
1777   PORT_ADJUSTER( 40, "Music Volume" )
1776   PORT_START("R507")
1777   PORT_ADJUSTER( 40, "R507 - Music Volume" )
17781778INPUT_PORTS_END
17791779
17801780
r5955r5956
18201820   PORT_START(CLOWNS_CONTROLLER_P2_TAG)
18211821   PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2)
18221822
1823   PORT_START("MUSIC_ADJ")  /* 3 */
1824   PORT_ADJUSTER( 40, "Music Volume" )
1823   PORT_START("R507")
1824   PORT_ADJUSTER( 40, "R507 - Music Volume" )
18251825INPUT_PORTS_END
18261826
18271827
r5955r5956
18571857
18581858   AM_RANGE(0x01, 0x01) AM_WRITE(mb14241_0_shift_count_w)
18591859   AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
1860   AM_RANGE(0x03, 0x03) AM_WRITE(spacwalk_audio_1_w)
1860   AM_RANGE(0x03, 0x03) AM_DEVWRITE("discrete", spacwalk_audio_1_w)
18611861   AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
1862   AM_RANGE(0x05, 0x05) AM_DEVWRITE("discrete", midway_tone_generator_lo_w)
1863   AM_RANGE(0x06, 0x06) AM_DEVWRITE("discrete", midway_tone_generator_hi_w)
1864   AM_RANGE(0x07, 0x07) AM_DEVWRITE("discrete", spacwalk_audio_2_w)
18621865ADDRESS_MAP_END
18631866
18641867static INPUT_PORTS_START( spacwalk )
r5955r5956
19091912
19101913   PORT_START(CLOWNS_CONTROLLER_P2_TAG)
19111914   PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2)
1915
1916   PORT_START("R507")
1917   PORT_ADJUSTER( 40, "R507 - Music Volume" )
19121918INPUT_PORTS_END
19131919
19141920static MACHINE_DRIVER_START( spacwalk )
r5955r5956
19211927   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
19221928
19231929   /* audio hardware */
1924   // MDRV_IMPORT_FROM(spacwalk_audio)
1930   MDRV_IMPORT_FROM(spacwalk_audio)
19251931
19261932MACHINE_DRIVER_END
19271933
r5955r5956
31753181/* 626 */ GAME( 1977, m4,       0,        m4,       m4,       0, ROT0,   "Midway", "M-4", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE  )
31763182/* 630 */ GAMEL(1978, clowns,   0,        clowns,   clowns,   0, ROT0,   "Midway", "Clowns (rev. 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE , layout_clowns )
31773183/* 630 */ GAMEL(1978, clowns1,  clowns,   clowns,   clowns1,  0, ROT0,   "Midway", "Clowns (rev. 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE , layout_clowns )
3178/* 640 */ GAMEL(1978, spacwalk, 0,        spacwalk, spacwalk, 0, ROT0,   "Midway", "Space Walk", GAME_NO_SOUND | GAME_SUPPORTS_SAVE, layout_spacwalk )
3184/* 640 */ GAMEL(1978, spacwalk, 0,        spacwalk, spacwalk, 0, ROT0,   "Midway", "Space Walk", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_spacwalk )
31793185/* 642 */ GAME( 1978, einning,  0,        dplay,    einning,  0, ROT0,   "Midway", "Extra Inning", GAME_SUPPORTS_SAVE  )
31803186/* 643 */ GAME( 1978, shuffle,  0,        shuffle,  shuffle,  0, ROT90,  "Midway", "Shuffleboard", GAME_NO_SOUND | GAME_SUPPORTS_SAVE  )
31813187/* 644 */ GAME( 1977, dogpatch, 0,        dogpatch, dogpatch, 0, ROT0,   "Midway", "Dog Patch", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE  )
src/mame/drivers/photon2.c
r5955r5956
7272};
7373
7474/* Initialise the palette */
75PALETTE_INIT( spectrum )
75static PALETTE_INIT( spectrum )
7676{
7777   palette_set_colors(machine, 0, spectrum_palette, ARRAY_LENGTH(spectrum_palette));
7878}
7979
80VIDEO_START( spectrum )
80static VIDEO_START( spectrum )
8181{
8282   spectrum_frame_number = 0;
8383   spectrum_flash_invert = 0;
r5955r5956
9494
9595/* Code to change the FLASH status every 25 frames. Note this must be
9696   independent of frame skip etc. */
97VIDEO_EOF( spectrum )
97static VIDEO_EOF( spectrum )
9898{
9999    spectrum_frame_number++;
100100    if (spectrum_frame_number >= 25)
r5955r5956
109109   *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color;
110110}
111111
112VIDEO_UPDATE( spectrum )
112static VIDEO_UPDATE( spectrum )
113113{
114114    /* for now do a full-refresh */
115115    int x, y, b, scrx, scry;
r5955r5956
296296   memory_set_bankptr(machine, 1, memory_region(machine, "maincpu"));
297297}
298298
299MACHINE_DRIVER_START( photon2 )
299static MACHINE_DRIVER_START( photon2 )
300300   /* basic machine hardware */
301301   MDRV_CPU_ADD("maincpu", Z80, 3500000)        /* 3.5 MHz */
302302   MDRV_CPU_PROGRAM_MAP(spectrum_mem)
src/mame/drivers/snk.c
r5955r5956
277277/*********************************************************************/
278278// Interrupt handlers common to all SNK triple Z80 games
279279
280READ8_HANDLER ( snk_cpuA_nmi_trigger_r )
280static READ8_HANDLER ( snk_cpuA_nmi_trigger_r )
281281{
282282   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
283283   return 0xff;
284284}
285285
286WRITE8_HANDLER( snk_cpuA_nmi_ack_w )
286static WRITE8_HANDLER( snk_cpuA_nmi_ack_w )
287287{
288288   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
289289}
290290
291READ8_HANDLER ( snk_cpuB_nmi_trigger_r )
291static READ8_HANDLER ( snk_cpuB_nmi_trigger_r )
292292{
293293   cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, ASSERT_LINE);
294294   return 0xff;
295295}
296296
297WRITE8_HANDLER( snk_cpuB_nmi_ack_w )
297static WRITE8_HANDLER( snk_cpuB_nmi_ack_w )
298298{
299299   cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, CLEAR_LINE);
300300}
src/mame/drivers/namconb1.c
r5955r5956
281281#define NB1_NVMEM_SIZE (0x800)
282282static UINT32 *nvmem32;
283283
284UINT32 *namconb1_workram32;
285284UINT32 *namconb1_spritebank32;
286285UINT32 *namconb1_tilebank32;
287286static UINT16 *namconb_shareram;
src/mame/drivers/othello.c
r0r5956
1/*
2
3Othello (version 3.0) - Success 1984
4-------------------------------------
5
6driver by Tomasz Slanina
7
8CPU Board:
9 D780C          - main CPU (Z80)
10 HD46505SP      - CRTC
11 D780-C         - Sound CPU (Z80)
12 AY-3-8910 x2   - Sound
13 D7751C         - ADPCM "Speech processor"
14 D8243          - I/O Expander for D7751C (8048 based)
15
16Video Board:
17 almost empty - 3/4 sodlering pins not populated
18
19
20
21Todo:
22
23- hook up upd7751c sample player (it works correctly but there's main cpu side write(latch/command) missing)
24- correct colors (based on the color DAC (24 resistors) on pcb
25- cocktail mode
26- map a bunch of unknown read/writes (related to above i think)
27
28Notes:
29
30DSw 1:2
31Limit for help/undo (matta):
32- when it's off, you can use each of them twice
33 every time you win and advance to the next game
34- when it's on, you can only use them twice throughout the game
35
36*/
37
38#include "driver.h"
39#include "deprecat.h"
40#include "cpu/z80/z80.h"
41#include "sound/ay8910.h"
42#include "video/mc6845.h"
43#include "machine/i8243.h"
44#include "cpu/mcs48/mcs48.h"
45#include "sound/dac.h"
46
47static int   ay_select=0;
48static int   ack_data=0;
49
50static UINT8 n7751_command;
51//static UINT32 n7751_rom_address;
52
53static int tile_bank=0;
54
55static int sound_addr;
56static int n7751_busy;
57
58#define   TILE_WIDTH 6
59
60static MC6845_UPDATE_ROW( update_row )
61{
62   int cx,x;
63   UINT32 data_address;
64   UINT32 tmp;
65
66   const UINT8 *gfx = memory_region(device->machine, "gfx");
67
68   for(cx=0;cx<x_count;++cx)
69   {
70      data_address=((videoram[ma+cx]+tile_bank)<<4)|ra;
71      tmp=gfx[data_address]|(gfx[data_address+0x2000]<<8)|(gfx[data_address+0x4000]<<16);
72
73      for(x=0;x<TILE_WIDTH;++x)
74      {
75         *BITMAP_ADDR16(bitmap, y, (cx*TILE_WIDTH+x)^1) = tmp&0x0f;
76         tmp>>=4;
77      }
78   }
79}
80
81static PALETTE_INIT( othello )
82{
83   int i;
84   for (i = 0;i < machine->config->total_colors;i++)
85    {
86        palette_set_color(machine,i,MAKE_RGB(0xff,0x00,0xff));
87    }
88
89    /* only colors  2,3,7,9,c,d,f are used */
90    palette_set_color(machine,0x02,MAKE_RGB(0x00,0xff,0x00));
91    palette_set_color(machine,0x03,MAKE_RGB(0xff,0x7f,0x00));
92    palette_set_color(machine,0x07,MAKE_RGB(0x00,0x00,0x00));
93    palette_set_color(machine,0x09,MAKE_RGB(0xff,0x00,0x00));
94    palette_set_color(machine,0x0c,MAKE_RGB(0x00,0x00,0xff));
95    palette_set_color(machine,0x0d,MAKE_RGB(0x7f,0x7f,0x00));
96    palette_set_color(machine,0x0f,MAKE_RGB(0xff,0xff,0xff));
97}
98
99VIDEO_UPDATE( othello )
100{
101   const device_config *mc6845 = devtag_get_device(screen->machine, "crtc");
102   mc6845_update(mc6845, bitmap, cliprect);
103   return 0;
104}
105
106static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
107   AM_RANGE(0x0000, 0x1fff) AM_ROM
108   AM_RANGE(0x8000, 0x97ff) AM_NOP /* not populated */
109   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE(&videoram)
110   AM_RANGE(0xf000, 0xffff) AM_RAM
111ADDRESS_MAP_END
112
113static READ8_HANDLER( unk_87_r )
114{
115   /* n7751_status_r ?  bit 7 = ack/status from device connected  to port 8a? */
116   return mame_rand(space->machine);
117}
118
119static WRITE8_HANDLER(unk_8a_w)
120{
121   /*
122    n7751_command = (data & 0x07);
123    cputag_set_input_line(space->machine, "n7751", 0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE);
124    //cputag_set_input_line(device->machine, "n7751", 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
125    cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(100));
126    */
127
128   logerror("8a -> %x\n",data);
129}
130
131static WRITE8_HANDLER(unk_8c_w)
132{
133   logerror("8c -> %x\n",data);
134}
135
136static READ8_HANDLER( unk_8c_r )
137{
138   return mame_rand(space->machine);
139}
140
141static READ8_HANDLER(sound_ack_r)
142{
143   return ack_data;
144}
145
146static WRITE8_HANDLER(unk_8f_w)
147{
148   logerror("8f -> %x\n",data);
149}
150
151static WRITE8_HANDLER(tilebank_w)
152{
153   tile_bank=data==0x0f?0x100:0x00;
154   logerror("tilebank -> %x\n",data);
155}
156
157static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
158   ADDRESS_MAP_GLOBAL_MASK(0xff)
159   AM_RANGE(0x08, 0x08) AM_DEVWRITE("crtc", mc6845_address_w)
160   AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
161   AM_RANGE(0x80, 0x80) AM_READ_PORT("INP")
162   AM_RANGE(0x81, 0x81) AM_READ_PORT("SYSTEM")
163   AM_RANGE(0x83, 0x83) AM_READ_PORT("DSW")
164   AM_RANGE(0x86, 0x86) AM_WRITE(tilebank_w)
165   AM_RANGE(0x87, 0x87) AM_READ(unk_87_r)
166   AM_RANGE(0x8a, 0x8a) AM_WRITE(unk_8a_w)
167   AM_RANGE(0x8c, 0x8c) AM_READWRITE(unk_8c_r, unk_8c_w)
168   AM_RANGE(0x8d, 0x8d) AM_READWRITE(sound_ack_r, soundlatch_w)
169   AM_RANGE(0x8f, 0x8f) AM_WRITE(unk_8f_w)
170ADDRESS_MAP_END
171
172static READ8_HANDLER(latch_r)
173{
174   int retval=soundlatch_r(space,0);
175   soundlatch_clear_w(space,0,0);
176   return retval;
177}
178
179static WRITE8_HANDLER(ay_select_w)
180{
181   ay_select=data;
182}
183
184static WRITE8_HANDLER(ack_w)
185{
186   ack_data=data;
187}
188
189static WRITE8_HANDLER(ay_address_w)
190{
191   if(ay_select&1) ay8910_address_w(devtag_get_device(space->machine, "ay1"),0,data);
192   if(ay_select&2) ay8910_address_w(devtag_get_device(space->machine, "ay2"),0,data);
193}
194
195static WRITE8_HANDLER(ay_data_w)
196{
197   if(ay_select&1) ay8910_data_w(devtag_get_device(space->machine, "ay1"),0,data);
198   if(ay_select&2) ay8910_data_w(devtag_get_device(space->machine, "ay2"),0,data);
199
200}
201
202static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
203   AM_RANGE(0x0000, 0x1fff) AM_ROM
204   AM_RANGE(0x8000, 0x83ff) AM_RAM
205ADDRESS_MAP_END
206
207static ADDRESS_MAP_START( audio_portmap, ADDRESS_SPACE_IO, 8 )
208   ADDRESS_MAP_GLOBAL_MASK(0xff)
209   AM_RANGE(0x00, 0x00) AM_READ(latch_r)
210   AM_RANGE(0x01, 0x01) AM_WRITE(ay_data_w)
211   AM_RANGE(0x03, 0x03) AM_WRITE(ay_address_w)
212   AM_RANGE(0x04, 0x04) AM_WRITE(ack_w)
213   AM_RANGE(0x08, 0x08) AM_WRITE(ay_select_w)
214ADDRESS_MAP_END
215
216static WRITE8_DEVICE_HANDLER( n7751_rom_control_w )
217{
218   /* P4 - address lines 0-3 */
219   /* P5 - address lines 4-7 */
220   /* P6 - address lines 8-11 */
221   /* P7 - ROM selects */
222   switch (offset)
223   {
224      case 0:
225         sound_addr = (sound_addr & ~0x00f) | ((data & 0x0f) << 0);
226         break;
227
228      case 1:
229         sound_addr = (sound_addr & ~0x0f0) | ((data & 0x0f) << 4);
230         break;
231
232      case 2:
233         sound_addr = (sound_addr & ~0xf00) | ((data & 0x0f) << 8);
234         break;
235
236      case 3:
237         sound_addr &= 0xfff;
238         {
239
240            if (!(data & 0x01) ) sound_addr |= 0x0000;
241            if (!(data & 0x02) ) sound_addr |= 0x1000;
242            if (!(data & 0x04) ) sound_addr |= 0x2000;
243            if (!(data & 0x08) ) sound_addr |= 0x3000;
244         }
245         break;
246   }
247}
248
249static READ8_HANDLER( n7751_rom_r )
250{
251   return memory_region(space->machine, "n7751data")[sound_addr];
252}
253
254static READ8_HANDLER( n7751_command_r )
255{
256   return 0x80 | ((n7751_command & 0x07) << 4);
257}
258
259static WRITE8_DEVICE_HANDLER( n7751_p2_w )
260{
261   /* write to P2; low 4 bits go to 8243 */
262   i8243_p2_w(device, offset, data & 0x0f);
263
264   /* output of bit $80 indicates we are ready (1) or busy (0) */
265   /* no other outputs are used */
266   n7751_busy = data;
267}
268
269static READ8_HANDLER( n7751_t1_r )
270{
271   /* T1 - labelled as "TEST", connected to ground */
272   return 0;
273}
274
275static ADDRESS_MAP_START( n7751_portmap, ADDRESS_SPACE_IO, 8 )
276   AM_RANGE(MCS48_PORT_T1,   MCS48_PORT_T1) AM_READ(n7751_t1_r)
277   AM_RANGE(MCS48_PORT_P2,   MCS48_PORT_P2) AM_READ(n7751_command_r)
278   AM_RANGE(MCS48_PORT_BUS,  MCS48_PORT_BUS) AM_READ(n7751_rom_r)
279   AM_RANGE(MCS48_PORT_P1,   MCS48_PORT_P1) AM_DEVWRITE("dac", dac_w)
280   AM_RANGE(MCS48_PORT_P2,   MCS48_PORT_P2) AM_DEVWRITE("n7751_8243", n7751_p2_w)
281   AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("n7751_8243", i8243_prog_w)
282ADDRESS_MAP_END
283
284static INPUT_PORTS_START( othello )
285   PORT_START("DSW")
286   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SW1:1")
287   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
288   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
289   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:2,3")
290   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
291   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
292   PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
293   PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
294   PORT_DIPNAME( 0x08, 0x00, "Limit for Matta" )   PORT_DIPLOCATION("SW1:4")
295   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
296   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
297   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )      PORT_DIPLOCATION("SW1:5") /* stored at $fd1e */
298   PORT_DIPNAME( 0x60, 0x60, "Timer (seconds)" )   PORT_DIPLOCATION("SW1:6,7")
299   PORT_DIPSETTING(    0x00, "4" )
300   PORT_DIPSETTING(    0x20, "6" )
301   PORT_DIPSETTING(    0x40, "8" )
302   PORT_DIPSETTING(    0x60, "10" )
303   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:8")
304   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
305   PORT_DIPSETTING(    0x80, DEF_STR( Hard ) )
306
307   PORT_START("INP")
308   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
309   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
310   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
311   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )  PORT_PLAYER(2)
312
313   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
314   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
315   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
316   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
317
318   PORT_START("SYSTEM")
319   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
320   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
321   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
322   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
323   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
324   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
325   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
326   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
327
328INPUT_PORTS_END
329
330static const mc6845_interface h46505_intf =
331{
332   "screen",   /* screen we are acting on */
333   TILE_WIDTH,   /* number of pixels per video memory address */
334   NULL,      /* before pixel update callback */
335   update_row, /* row update callback */
336   NULL,      /* after pixel update callback */
337   DEVCB_NULL,   /* callback for display state changes */
338   DEVCB_NULL,   /* callback for cursor state changes */
339   DEVCB_NULL,   /* HSYNC callback */
340   DEVCB_NULL,   /* VSYNC callback */
341   NULL      /* update address callback */
342};
343
344static MACHINE_DRIVER_START( othello )
345
346   /* basic machine hardware */
347   MDRV_CPU_ADD("maincpu",Z80,XTAL_8MHz/2)
348   MDRV_CPU_PROGRAM_MAP(main_map)
349   MDRV_CPU_IO_MAP(main_portmap)
350   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
351
352   MDRV_CPU_ADD("audiocpu",Z80,XTAL_3_579545MHz)
353   MDRV_CPU_PROGRAM_MAP(audio_map)
354   MDRV_CPU_IO_MAP(audio_portmap)
355
356   MDRV_CPU_ADD("n7751", N7751, XTAL_6MHz)
357   MDRV_CPU_IO_MAP(n7751_portmap)
358
359   MDRV_I8243_ADD("n7751_8243", NULL, n7751_rom_control_w)
360
361
362   /* video hardware */
363   MDRV_SCREEN_ADD("screen", RASTER)
364   MDRV_SCREEN_REFRESH_RATE(60)
365   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
366   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
367   MDRV_SCREEN_SIZE(64*6, 64*8)
368   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*6-1, 0*8, 64*8-1)
369
370   MDRV_PALETTE_LENGTH(0x10)
371   MDRV_PALETTE_INIT(othello)
372
373   MDRV_VIDEO_UPDATE(othello)
374
375   MDRV_MC6845_ADD("crtc", H46505, 1000000 /* ? MHz */, h46505_intf)   /* H46505 @ CPU clock */
376
377   /* sound hardware */
378   MDRV_SPEAKER_STANDARD_MONO("mono")
379
380   MDRV_SOUND_ADD("ay1", AY8910, 2000000)
381   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
382
383   MDRV_SOUND_ADD("ay2", AY8910, 2000000)
384   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
385
386   MDRV_SOUND_ADD("dac", DAC, 0)
387   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
388MACHINE_DRIVER_END
389
390ROM_START( othello )
391   ROM_REGION( 0x10000, "maincpu", 0 )
392   ROM_LOAD( "4.ic59",   0x0000, 0x2000, CRC(9f82fe14) SHA1(59600264ccce787383827fc5aa0f2c23728f6946))
393
394   ROM_REGION( 0x10000, "audiocpu", 0 )
395   ROM_LOAD( "3.ic32",   0x0000, 0x2000, CRC(2bb4f75d) SHA1(29a659031acf0d50f374f440b8d353bcf98145a0))
396
397   ROM_REGION( 0x1000, "n7751", 0 )      /* 4k for 7751 onboard ROM */
398   ROM_LOAD( "7751.bin",     0x0000, 0x0400, CRC(6a9534fc) SHA1(67ad94674db5c2aab75785668f610f6f4eccd158) )
399
400   ROM_REGION( 0x4000, "n7751data", 0 ) /* 7751 sound data */
401   ROM_LOAD( "1.ic48", 0x0000, 0x2000, CRC(c3807dea) SHA1(d6339380e1239f3e20bcca2fbc673ad72e9ca608))
402   ROM_LOAD( "2.ic49", 0x2000, 0x2000, CRC(a945f3e7) SHA1(ea18efc18fda63ce1747287bbe2a9704b08daff8))
403
404   ROM_REGION( 0x6000, "gfx", 0 )
405   ROM_LOAD( "5.ic40",   0x0000, 0x2000, CRC(45fdc1ab) SHA1(f30f6002e3f34a647effac8b0116c8ed064e226a))
406   ROM_LOAD( "6.ic41",   0x2000, 0x2000, CRC(467a731f) SHA1(af80e854522e53fb1b9af7945b2c803a654c6f65))
407   ROM_LOAD( "7.ic42",   0x4000, 0x2000, CRC(a76705f7) SHA1(b7d2a65d65d065732ddd0b3b738749369b382b48))
408ROM_END
409
410GAME( 1984, othello,  0,       othello,  othello,  0, ROT0, "Success", "Othello (version 3.0)", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
src/mame/drivers/jangou.c
r5955r5956
811811   MDRV_CPU_PROGRAM_MAP(nsc_map)
812812
813813   /* sound hardware */
814   MDRV_SOUND_START(NULL)
814   MDRV_SOUND_START(0)
815815   MDRV_DEVICE_REMOVE("cvsd")
816816
817817   MDRV_SOUND_ADD("msm", MSM5205, XTAL_400kHz)
r5955r5956
830830   MDRV_DEVICE_REMOVE("cpu1")
831831
832832   /* sound hardware */
833   MDRV_SOUND_START(NULL)
833   MDRV_SOUND_START(0)
834834   MDRV_DEVICE_REMOVE("cvsd")
835835MACHINE_DRIVER_END
836836
src/mame/drivers/zaccaria.c
r5955r5956
256256}
257257
258258
259extern const game_driver driver_monymony;
259GAME_EXTERN(monymony);
260260
261261static READ8_HANDLER( zaccaria_prot1_r )
262262{
r5955r5956
269269         return 0x40;    /* Jack Rabbit */
270270
271271      case 6:
272         if (space->machine->gamedrv == &driver_monymony)
272         if (space->machine->gamedrv == &GAME_NAME(monymony))
273273            return 0x70;    /* Money Money */
274274         return 0xa0;    /* Jack Rabbit */
275275
src/mame/drivers/warpwarp.c
r5955r5956
891891
892892ROM_START( warpwarp )
893893   ROM_REGION( 0x10000, "maincpu", 0 )
894   ROM_LOAD( "g-n9601n.2r",  0x0000, 0x1000, CRC(f5262f38) SHA1(1c64d0282b0a209390a548ceeaaf8b7b55e50896) )
895   ROM_LOAD( "g-09602n.2m",  0x1000, 0x1000, CRC(de8355dd) SHA1(133d137711d79aaeb45cd3ee041c0be3b73e1b2f) )
896   ROM_LOAD( "g-09603n.1p",  0x2000, 0x1000, CRC(bdd1dec5) SHA1(bb3d9d1500e31bb271a394facaec7adc3c987e5e) )
897   ROM_LOAD( "g-09613n.1t",  0x3000, 0x0800, CRC(af3d77ef) SHA1(5b79aabbe14c2997e0b1a9276c483ae76814a63a) )
894   ROM_LOAD( "ww1_prg1.s10", 0x0000, 0x1000, CRC(f5262f38) SHA1(1c64d0282b0a209390a548ceeaaf8b7b55e50896) )
895   ROM_LOAD( "ww1_prg2.s8",  0x1000, 0x1000, CRC(de8355dd) SHA1(133d137711d79aaeb45cd3ee041c0be3b73e1b2f) )
896   ROM_LOAD( "ww1_prg3.s4",  0x2000, 0x1000, CRC(bdd1dec5) SHA1(bb3d9d1500e31bb271a394facaec7adc3c987e5e) )
898897
899898   ROM_REGION( 0x800, "gfx1", 0 )
900   ROM_LOAD( "g-9611n.4c",  0x0000, 0x0800, CRC(380994c8) SHA1(0cdf6a05db52c423365bff9c9df6d93ac885794e) )
899   ROM_LOAD( "ww1_chg1.s12", 0x0000, 0x0800, CRC(380994c8) SHA1(0cdf6a05db52c423365bff9c9df6d93ac885794e) )
901900ROM_END
902901
903902ROM_START( warpwarpr )
src/mame/drivers/seta.c
r5955r5956
2727?        (M6100430A)    89 U.S. Classic(2)                      Taito / RomStar
2828?                       88 Caliber 50                           Taito / RomStar
2929?                       89 Arbalester                           Taito / RomStar
30PO-047A                 ?? Seta Roulette                        Seta / Visco
3031P1-036-A + P0-045-A +
3132P1-049-A                89 Meta Fox                             Taito / RomStar
3233P0-053-1                89 Castle of Dragon/Dragon Unit         Taito / RomStar / Athena
r5955r5956
21532154   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE(&spriteram16_2)      // Sprites Code + X + Attr
21542155ADDRESS_MAP_END
21552156
2157/***************************************************************************
2158        Seta Roulette
2159***************************************************************************/
21562160
2161static ADDRESS_MAP_START( setaroul_map, ADDRESS_SPACE_PROGRAM, 16 )
2162   AM_RANGE(0x000000, 0x01ffff) AM_ROM                        // ROM
2163
2164   AM_RANGE(0xc00000, 0xc03fff) AM_RAM
2165   AM_RANGE(0xf00000, 0xf03fff) AM_RAM
2166ADDRESS_MAP_END
2167
21572168/***************************************************************************
21582169                        Extreme Downhill / Sokonuke
21592170***************************************************************************/
r5955r5956
35513562INPUT_PORTS_END
35523563
35533564
3565/***************************************************************************
3566                                Seta Roulette
3567***************************************************************************/
35543568
3569static INPUT_PORTS_START( setaroul )
3570INPUT_PORTS_END
3571
3572
35553573/***************************************************************************
35563574                                DownTown
35573575***************************************************************************/
r5955r5956
64486466   16*16*2
64496467};
64506468
6469static const gfx_layout layout_8bpp =
6470{
6471   16,16,
6472   RGN_FRAC(1,4),
6473   8,
6474   { RGN_FRAC(0,4)+0,RGN_FRAC(0,4)+4, RGN_FRAC(1,4)+0,RGN_FRAC(1,4)+4,RGN_FRAC(2,4)+0,RGN_FRAC(2,4)+4, RGN_FRAC(3,4)+0,RGN_FRAC(3,4)+4},
6475   {128+64,128+65,128+66,128+67, 128+0,128+1,128+2,128+3,
6476    8*8+0,8*8+1,8*8+2,8*8+3, 0,1,2,3},
6477   {0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,
6478    32*8,33*8,34*8,35*8,36*8,37*8,38*8,39*8},
6479   16*16*2
6480};
64516481
64526482
64536483
r5955r5956
65096539GFXDECODE_END
65106540
65116541/***************************************************************************
6542                                Seta Roulette
6543***************************************************************************/
6544
6545static GFXDECODE_START( setaroul )
6546   GFXDECODE_ENTRY( "gfx1", 0, layout_planes_2roms,       512*0, 32 ) // [0] Sprites
6547   GFXDECODE_ENTRY( "gfx2", 0, layout_8bpp, 512*0, 32 ) // [1] Layer 1
6548GFXDECODE_END
6549
6550/***************************************************************************
65126551                                J.J.Squawkers
65136552***************************************************************************/
65146553
r5955r5956
72097248   MDRV_SOUND_ROUTE(1, "rspeaker", 1.0)
72107249MACHINE_DRIVER_END
72117250
7251/***************************************************************************
7252                                Seta Roulette
7253***************************************************************************/
72127254
7255static VIDEO_START( dummy_start )
7256{
7257
7258}
7259
7260static VIDEO_UPDATE( dummy_update )
7261{
7262   return 0;
7263}
7264
7265static MACHINE_DRIVER_START( setaroul )
7266
7267   /* basic machine hardware */
7268   MDRV_CPU_ADD("maincpu", M68000, 16000000/2)   /* 8 MHz */
7269   MDRV_CPU_PROGRAM_MAP(setaroul_map)
7270   //MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7271
7272   /* video hardware */
7273   MDRV_SCREEN_ADD("screen", RASTER)
7274   MDRV_SCREEN_REFRESH_RATE(60)
7275   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
7276   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
7277   MDRV_SCREEN_SIZE(64*8, 32*8)
7278   MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
7279
7280   MDRV_GFXDECODE(setaroul)
7281   MDRV_PALETTE_LENGTH(512)
7282
7283   MDRV_VIDEO_START(dummy_start)
7284   //MDRV_VIDEO_EOF(seta_buffer_sprites)   /* qzkklogy uses sprite buffering */
7285   MDRV_VIDEO_UPDATE(dummy_update)
7286
7287   /* sound hardware */
7288   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
7289
7290   MDRV_SOUND_ADD("x1", X1_010, 16000000)   /* 16 MHz */
7291   MDRV_SOUND_CONFIG(seta_sound_intf)
7292   MDRV_SOUND_ROUTE(0, "lspeaker", 1.0)
7293   MDRV_SOUND_ROUTE(1, "rspeaker", 1.0)
7294MACHINE_DRIVER_END
7295
7296
72137297/***************************************************************************
72147298                                Eight Force
72157299***************************************************************************/
r5955r5956
94749558   ROM_LOAD( "ya_011_012.u64", 0x80000, 0x80000, CRC(a8015ce6) SHA1(bb0b589856ec82e1fd42be9af89b07ba1d17e595) )
94759559ROM_END
94769560
9561/*
9562PCB PO-047A
94779563
95643x8 DSW
9565SETA X1-004 (826100) (input)
9566SETA X1-010 (811101) (sound)
9567MC68B50P (timer?)
9568M68000
956916Mhz OSC, near CPU
9570SETA X1-002A (sprites? - near 005 - 008)
9571SETA X1-001A (sprites? ^)
9572SETA X1-007 (737100)
9573SETA X1-011
9574SETA X1-012
9575*/
94789576
9577ROM_START( setaroul )
9578   ROM_REGION( 0x0c0000, "maincpu", 0 )      /* 68000 Code */
9579   ROM_LOAD16_BYTE( "uf1002.u14", 0x000000, 0x010000, CRC(b3a622b0) SHA1(bc4a02167002579149c19640e65e679b7c19fa66) )
9580   ROM_LOAD16_BYTE( "uf1003.u16", 0x000001, 0x010000, CRC(a6afd769) SHA1(82c54c8a2219f20d08faf9f7afcf821d83511660) )
9581
9582   ROM_REGION( 0x020000, "gfx1", 0 )   /* Sprites */
9583   ROM_LOAD16_BYTE( "uf0005.u3", 0x000000, 0x008000, CRC(383c2d57) SHA1(3bbf0464f80f657dfa275e885fbce064a0a08f4a) )
9584   ROM_LOAD16_BYTE( "uf0006.u4", 0x000001, 0x008000, CRC(90c9dae6) SHA1(a226aab82f5b8174644281fa3efab4f8a8f8d827) )
9585   ROM_LOAD16_BYTE( "uf0007.u5", 0x010000, 0x008000, CRC(e72c3dba) SHA1(aaebb484e76d8f3da0ecff26c3c1bad4f3f11ac0) )
9586   ROM_LOAD16_BYTE( "uf0008.u6", 0x010001, 0x008000, CRC(e198e602) SHA1(f53fa36d1ea51239e71fe1ea7432bb4b7b8b3466) )
9587
9588   ROM_REGION( 0x400000, "gfx2", 0 )   /* Layer 1 - 8bpp? */
9589   ROM_LOAD( "uf0010.u15",  0x000000, 0x080000, CRC(0af13a56) SHA1(c294b7947d004c0e0b280ca44636e4059e05a57e) )
9590   ROM_LOAD( "uf0009.u13",  0x080000, 0x080000, CRC(20f2d7f5) SHA1(343a8fac76d6ee7f845f9988c491698ebd0150d4) )
9591   ROM_LOAD( "uf0012.u29",  0x100000, 0x080000, CRC(cba2a6b7) SHA1(8627eda24c6980a0e786fd9dc06176893a33c58f) )
9592   ROM_LOAD( "uf0011.u22",  0x180000, 0x080000, CRC(af60adf9) SHA1(6505cbce6e066d75b779fdbe2c034ba4daabbefe) )
9593   ROM_LOAD( "uf0014.u38",  0x200000, 0x080000, CRC(da2bd4e4) SHA1(244af8705f2fa4ab3f3a002af16a0e4d60e03de8) )
9594   ROM_LOAD( "uf0013.u37",  0x280000, 0x080000, CRC(645ec3c3) SHA1(e9b8056c68bf33b0b7130a5ce2bafd11dfd6c29b) )
9595   ROM_LOAD( "uf0015.u40",  0x300000, 0x080000, CRC(11dc19fa) SHA1(e7084f61d075a61249d924a523c32e7993d9ae46) )
9596   ROM_LOAD( "uf0016.u48",  0x380000, 0x080000, CRC(10f99fa8) SHA1(7ef9a3f71dd071483cf3513ef57e2fcfe8702994) )
9597
9598   ROM_REGION( 0x100000, "x1", 0 )   /* Samples */
9599   ROM_LOAD( "uf1004.u52", 0x000000, 0x020000, CRC(d63ea334) SHA1(93aaf58c90c4f704caae19b63785e471b2c1281a) )
9600
9601   ROM_REGION( 0x400, "proms", 0 )
9602   ROM_LOAD16_BYTE( "uf-017", 0x000, 0x200, NO_DUMP )
9603   ROM_LOAD16_BYTE( "uf-018", 0x001, 0x200, NO_DUMP )
9604ROM_END
9605
94799606static READ16_HANDLER( twineagl_debug_r )
94809607{
94819608   /*  At several points in the code, the program checks if four
r5955r5956
97629889GAME( 1989, metafox,  0,        metafox,  metafox,  metafox,  ROT270, "Seta",                   "Meta Fox" , 0) // Country/License: DSW
97639890
97649891/* 68000 */
9892GAME( 198?, setaroul, 0,        setaroul, setaroul, 0,        ROT270, "Seta / Visco",           "Seta Roulette?", 0 ) // I can't see a title in the GFX roms or program but it seems to have roulette GFX
97659893GAME( 1989, drgnunit, 0,        drgnunit, drgnunit, 0,        ROT0,   "Seta",                   "Dragon Unit / Castle of Dragon", 0 )
97669894GAME( 1989, wits,     0,        wits,     wits,     0,        ROT0,   "Athena (Visco license)", "Wit's (Japan)" , 0) // Country/License: DSW
97679895GAME( 1990, thunderl, 0,        thunderl, thunderl, 0,        ROT270, "Seta",                   "Thunder & Lightning" , 0) // Country/License: DSW
src/mame/drivers/naomi.c
r5955r5956
40704070   ROM_REGION( 0x200000, "maincpu", 0)
40714071   NAOMI_BIOS
40724072
4073   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
4073   ROM_REGION( 0x10000000, "user1", ROMREGION_ERASEFF)
40744074        ROM_LOAD( "bhf1vere.2f",  0x0000000, 0x0800000, CRC(121ea283) SHA1(e4bf2b90fa3d42727b8393ffa2c5a8863914a630) )
40754075        ROM_LOAD( "bhf1ma2.4m",   0x2000000, 0x1000000, CRC(8073dec7) SHA1(2d4173ff0de37b95a8cb02e1b572a9cdeb448c24) )
4076        ROM_LOAD( "bhf1ma3.4l",   0x3000000, 0x1000000, CRC(43cd16a4) SHA1(86258df34b652a614129efd4c825c62ff1382318) )
4077        ROM_LOAD( "bhf1ma4.4k",   0x4000000, 0x1000000, CRC(f6aebed8) SHA1(687057aacb45ebffe3b5cf2b8dd52d24039392f1) )
4078        ROM_LOAD( "bhf1ma5.4j",   0x5000000, 0x1000000, CRC(b5e1b582) SHA1(47763113e6917bbf48840292c08d4f63c3ce085a) )
4079        ROM_LOAD( "bhf1ma6.4h",   0x6000000, 0x1000000, CRC(345fd824) SHA1(61ebc12c7cd7f2e2c5173cc0f57240855ec99c6f) )
4080        ROM_LOAD( "bhf1ma7.4f",   0x7000000, 0x1000000, CRC(465ecff1) SHA1(f9eabc77ed8135fa77c8e40335e6b3df1a64042c) )
4081        ROM_LOAD( "bhf1ma8.4d",   0x8000000, 0x1000000, CRC(76c92354) SHA1(0049b10144d65f574d14d9ad9d1d5380bf154532) )
4082        ROM_LOAD( "bhf1ma9.4e",   0x9000000, 0x1000000, CRC(d45a46ee) SHA1(c12764f5ba17f10fb309e47450bb89fbef51e252) )
4083        ROM_LOAD( "bhf1ma10.4c",  0xa000000, 0x1000000, CRC(8c38d1f7) SHA1(3fbc280590c49fa094c1fc1e23d6c9d0031298c5) )
4084        ROM_LOAD( "bhf1ma11.4b",  0xb000000, 0x1000000, CRC(f49153c4) SHA1(85d5583cac492317ba52dc7a31a443f5f26a67c9) )
4085        ROM_LOAD( "bhf1ma12.6p",  0xc000000, 0x1000000, CRC(0e2bdd9a) SHA1(e2f82d2c9e33da1a297d79a0324558d0ff614172) )
4086        ROM_LOAD( "bhf1ma13.6n",  0xd000000, 0x1000000, CRC(055718ad) SHA1(355c4780231a4361aa6237dd34819b60d9df0fc7) )
4087        ROM_LOAD( "bhf1ma14.6m",  0xe000000, 0x1000000, CRC(d06c9bd7) SHA1(54668a2fd31059976890da92709c18f308634887) )
4088        ROM_LOAD( "bhf1ma15.6l",  0xf000000, 0x1000000, CRC(db3c396b) SHA1(da0e125d627ce890906ca100081ab0685e11c0ef) )
40764089ROM_END
40774090
4091
40784092/* GD-ROM titles - a PIC supplies a decryption key
40794093
40804094PIC stuff
r5955r5956
52805294        ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) )
52815295ROM_END
52825296
5297/*
5298    This is the same nonsense layout rom board as gram2000, and just like
5299    that it tests IC1 which doesn't exist - is it a mirror, or protection
5300    related?  There is no physical rom for it, also note, the roms are
5301    interleaved, so each test is testing 2 roms and the labeling / ic
5302    positions on the cart don't relate to the display in test mode.
5303
5304    Desired IC1 @ 0x800000 sums from the header = 9f39 fdc4
5305
5306    We need a USB dump of this from 0x800000 to 0x1000000.
5307*/
5308ROM_START( vf4evoct )
5309   NAOMI2_BIOS
5310
5311   ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF)
5312        ROM_LOAD( "epr-23934.ic11",  0x0000000, 0x400000, CRC(656a7d84) SHA1(e407ddc923b399de99cb06a8831ef8fb328cfe64) )
5313        ROM_LOAD32_WORD( "mpr-23912.ic17s", 0x1000000, 0x800000, CRC(b2b13d97) SHA1(978bcdab7e4f220b464d5b9fa27870b5176283ca) )
5314        ROM_LOAD32_WORD( "mpr-23913.ic18",  0x1000002, 0x800000, CRC(560de9d2) SHA1(e065abb62346f5e50f654ac77beb54ee1bfc1a08) )
5315        ROM_LOAD32_WORD( "mpr-23914.ic19s", 0x2000000, 0x800000, CRC(a2104728) SHA1(48b752b6266b4d44fcb16fe179fb44ca58e11db0) )
5316        ROM_LOAD32_WORD( "mpr-23915.ic20",  0x2000002, 0x800000, CRC(295d32f0) SHA1(4cabb1ab54dad2cef7207f8d7a78f609d35800fb) )
5317        ROM_LOAD32_WORD( "mpr-23916.ic21s", 0x3000000, 0x800000, CRC(d725fdd3) SHA1(ab3a79dfcbaa65b5a085a429bcb76c1d3940d590) )
5318        ROM_LOAD32_WORD( "mpr-23917.ic22",  0x3000002, 0x800000, CRC(8794c8e8) SHA1(a2542ad8c063f77749fbc4429ec74bba26939556) )
5319        ROM_LOAD32_WORD( "mpr-23918.ic23s", 0x4000000, 0x800000, CRC(7a3da170) SHA1(72d05430cd8cd12c47ccd36bf171eaadfb987708) )
5320        ROM_LOAD32_WORD( "mpr-23919.ic24",  0x4000002, 0x800000, CRC(59601746) SHA1(514b00ee44d64593c2d257b48ac20b42ee2a402a) )
5321        ROM_LOAD32_WORD( "mpr-23920.ic25s", 0x5000000, 0x800000, CRC(6ae07021) SHA1(b018db4f868d9ebcde44759d8aea44d789958087) )
5322        ROM_LOAD32_WORD( "mpr-23921.ic26",  0x5000002, 0x800000, CRC(42028253) SHA1(aa5a3953e4306f4f69c1be568d515af249e6ab1e) )
5323        ROM_LOAD32_WORD( "mpr-23922.ic27s", 0x6000000, 0x800000, CRC(baf47df2) SHA1(d5c04e03a69a4ac8c8c066c0c750bef236e8c172) )
5324        ROM_LOAD32_WORD( "mpr-23923.ic28",  0x6000002, 0x800000, CRC(5c31b7e7) SHA1(cf1307400f7bd4b8dda840544a348eee34710256) )
5325        ROM_LOAD32_WORD( "mpr-23924.ic29",  0x7000000, 0x800000, CRC(6dfe19d9) SHA1(99b13ef752c7b8f7812ea5c3bce19cbf122008b6) )
5326        ROM_LOAD32_WORD( "mpr-23925.ic30s", 0x7000002, 0x800000, CRC(e9ec870a) SHA1(cdf385096e7fe15de98cea6ae5aabf3016e007a9) )
5327        ROM_LOAD32_WORD( "mpr-23926.ic31",  0x8000000, 0x800000, CRC(2c650728) SHA1(328748b2c786eb77c9d05280e88367cfb7b79777) )
5328        ROM_LOAD32_WORD( "mpr-23927.ic32s", 0x8000002, 0x800000, CRC(f36a765b) SHA1(ecd09db0961b0d11000c8744a2cfcf3fa473eea6) )
5329        ROM_LOAD32_WORD( "mpr-23928.ic33",  0x9000000, 0x800000, CRC(0ee92b02) SHA1(d0d26f4257a022b42b59cf4f9305a3cb2dc67f4b) )
5330        ROM_LOAD32_WORD( "mpr-23929.ic34s", 0x9000002, 0x800000, CRC(d768f242) SHA1(3ade29b094308d870ecac53cfe77b843d50af85a) )
5331        ROM_LOAD32_WORD( "mpr-23930.ic35",  0xa000000, 0x800000, CRC(0e45e4c4) SHA1(974b83d4cc35e8ac9f83d04ebd395f1e2196e829) )
5332        ROM_LOAD32_WORD( "mpr-23931.ic36s", 0xa000002, 0x800000, CRC(12ecd2f0) SHA1(3222d4d9d3e30c297a072a8888c28503306db40c) )
5333ROM_END
5334
52835335ROM_START( clubkrte )
52845336   NAOMI2_BIOS
52855337
r5955r5956
55325584/* Complete Dumps */
55335585GAME( 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 )
55345586GAME( 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 )
5535GAME( 2001, vf4cart,  naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Fighter 4 (Cart)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5587GAME( 2001, vf4cart,  naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Fighter 4 (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5588GAME( 2001, vf4evoct,  naomi2,  naomi,   naomi,    0,  ROT0,  "Sega",          "Virtua Fighter 4 Evolution (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
55365589GAME( 2002, clubkrte, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Club Kart: European Session", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
55375590
55385591/* GDS-xxxx (Sega first party games) */
src/mame/drivers/megatech.c
r5955r5956
9191#include "sound/sn76496.h"
9292#include "rendlay.h"
9393
94#include "segae.h"
94#include "segamsys.h"
9595#include "genesis.h"
9696#include "megadriv.h"
9797
r5955r5956
248248   return (mt_cart_select_reg);
249249}
250250
251static READ8_HANDLER( z80_unmapped_port_r )
252{
253   printf("unmapped z80 port read %04x\n",offset);
254   return 0;
255}
256
257static WRITE8_HANDLER( z80_unmapped_port_w )
258{
259   printf("unmapped z80 port write %04x\n",offset);
260}
261
262static READ8_HANDLER( z80_unmapped_r )
263{
264   printf("unmapped z80 read %04x\n",offset);
265   return 0;
266}
267
268static WRITE8_HANDLER( z80_unmapped_w )
269{
270   printf("unmapped z80 write %04x\n",offset);
271}
272
273static UINT8* sms_mainram;
274static UINT8* sms_rom;
275
276
277static WRITE8_HANDLER( mt_sms_standard_rom_bank_w )
278{
279   int bank = data&0x1f;
280   //logerror("bank w %02x %02x\n", offset, data);
281
282   sms_mainram[0x1ffc+offset] = data;
283   switch (offset)
284   {
285      case 0:
286         logerror("bank w %02x %02x\n", offset, data);
287         memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP);
288
289         //printf("bank ram??\n");
290         break;
291      case 1:
292         memcpy(sms_rom+0x0000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000);
293         break;
294      case 2:
295         memcpy(sms_rom+0x4000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000);
296         break;
297      case 3:
298         memcpy(sms_rom+0x8000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000);
299         break;
300
301   }
302}
303
304251#ifdef UNUSED_FUNCTION
305252READ8_HANDLER( md_sms_ioport_dc_r )
306253{
r5955r5956
315262
316263
317264
318static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine)
319{
320   /* INIT THE PORTS *********************************************************************************************/
321265
322   const address_space *io = cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_IO);
323   const device_config *sn = devtag_get_device(machine, "sn");
324
325   memory_install_readwrite8_handler(io, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
326
327   memory_install_read8_handler     (io, 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r);
328   memory_install_write8_device_handler(io, sn, 0x7e, 0x7f, 0, 0, sn76496_w);
329   memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w);
330   memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w);
331
332   memory_install_read8_handler     (io, 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris
333
334   memory_install_read8_handler     (io, 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r);
335   memory_install_read8_handler     (io, 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r);
336   memory_install_read8_handler     (io, 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r);
337   memory_install_read8_handler     (io, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family
338}
339
340static void megatech_set_genz80_as_sms_standard_map(running_machine *machine)
341{
342   /* INIT THE MEMMAP / BANKING *********************************************************************************/
343
344   /* catch any addresses that don't get mapped */
345   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
346
347   /* fixed rom bank area */
348   sms_rom = auto_alloc_array(machine, UINT8, 0x400000);
349   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP);
350   memory_set_bankptr(machine,  5, sms_rom );
351
352   memcpy(sms_rom, memory_region(machine, "maincpu"), 0x400000);
353
354   /* main ram area */
355   sms_mainram = auto_alloc_array(machine, UINT8, 0x2000); // 8kb of main ram
356   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6));
357   memory_set_bankptr(machine,  6, sms_mainram );
358   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7));
359   memory_set_bankptr(machine,  7, sms_mainram );
360   memset(sms_mainram,0x00,0x2000);
361
362   memory_install_write8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w);
363
364   megatech_set_genz80_as_sms_standard_ports(machine);
365//  smsgg_backupram = NULL;
366
367}
368
369266static void megatech_select_game(running_machine *machine, int gameno)
370267{
371268   UINT8* game_region;
r5955r5956
402299      {
403300         printf("SMS cart!!, CPU not running\n");
404301         current_game_is_sms = 1;
405         megatech_set_genz80_as_sms_standard_map(machine);
302         megatech_set_genz80_as_sms_standard_map(machine, "genesis_snd_z80", MAPPER_STANDARD);
406303         cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_HALT, CLEAR_LINE);
407304         cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, CLEAR_LINE);
408305
r5955r5956
412309      {
413310         printf("Genesis Cart, CPU0 running\n");
414311         current_game_is_sms = 0;
415         megatech_set_megadrive_z80_as_megadrive_z80(machine);
312         megatech_set_megadrive_z80_as_megadrive_z80(machine, "genesis_snd_z80");
416313         cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE);
417314         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
418315      }
src/mame/drivers/rallyx.c
r5955r5956
975975   ROM_LOAD( "8e",           0x0000, 0x1000, CRC(277c1de5) SHA1(30bc57263e8dad870c501c76bce6f42d69ab9e00) )
976976
977977   ROM_REGION( 0x0100, "gfx2", 0 )
978   ROM_LOAD( "rx-6.8m",   0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
978   ROM_LOAD( "rx1-6.8m",       0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
979979
980980   ROM_REGION( 0x0160, "proms", 0 )
981   ROM_LOAD( "rx-1.11n",  0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) )  /* Prom type: M3-7603-5 - palette */
982   ROM_LOAD( "rx-7.8p",   0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) )  /* Prom type: IM5623    - lookup table */
983   ROM_LOAD( "rx-2.4n",   0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
984   ROM_LOAD( "rx1-3.7k",  0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
981   ROM_LOAD( "rx1-1.11n",      0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) )  /* Prom type: M3-7603-5 - palette */
982   ROM_LOAD( "rx1-7.8p",       0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) )  /* Prom type: IM5623    - lookup table */
983   ROM_LOAD( "rx1-2.4n",       0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
984   ROM_LOAD( "rx1-3.7k",       0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
985985
986986   ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */
987   ROM_LOAD( "rx-5.3p",    0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
988   ROM_LOAD( "rx-4.2m",    0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
987   ROM_LOAD( "rx1-5.3p",       0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
988   ROM_LOAD( "rx1-4.2m",       0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
989989ROM_END
990990
991ROM_START( rallyxa )
992   ROM_REGION( 0x10000, "maincpu", 0 )
993   ROM_LOAD( "rx1_prg_1.1b",   0x0000, 0x0800, CRC(ef9238db) SHA1(44313381652916a59a8d9959fb170184578472af) )
994   ROM_LOAD( "rx1_prg_2.1c",   0x0800, 0x0800, CRC(7cbeb656) SHA1(ff6e669f7d3e91c1cc835106cccefcd81aa28bb8) )
995   ROM_LOAD( "rx1_prg_3.1d",   0x1000, 0x0800, CRC(334b1042) SHA1(348a303eb8f03f19e5060d81f733d3145113abd5) )
996   ROM_LOAD( "rx1_prg_4.1e",   0x1800, 0x0800, CRC(d6618add) SHA1(4c66160996f3195a83628f486789721935d2cf5b) )
997   ROM_LOAD( "rx1_prg_5.bin",  0x2000, 0x0800, CRC(3d69f24e) SHA1(fe5a43b7144f62d28aaf0dd92e1d02ef9199b132) )
998   ROM_LOAD( "rx1_prg_6.bin",  0x2800, 0x0800, CRC(e9740f16) SHA1(02a134ccd3d6557d46492747b04da02e933aa6b4) )
999   ROM_LOAD( "rx1_prg_7.1k",   0x3000, 0x0800, CRC(843109f2) SHA1(7241d1025f249d23a0d15b5e31fdb2f5297ffbf4) )
1000   ROM_LOAD( "rx1_prg_8.1l",   0x3800, 0x0800, CRC(9b846ec9) SHA1(1fd8cce517f31a15e06cf250bc50b5a663424877) )
1001
1002   ROM_REGION( 0x1000, "gfx1", 0 )
1003   ROM_LOAD( "rx1_chg_1.8e",   0x0000, 0x0800, CRC(1fff38a4) SHA1(5f6ccce2e0daad5915d017e8d067f187eb2ed41d) )
1004   ROM_LOAD( "rx1_chg_2.8d",   0x0800, 0x0800, CRC(68dff552) SHA1(5dad38db45afbd79b5627a75b295fc920ad68856) )
1005
1006   ROM_REGION( 0x0100, "gfx2", 0 )
1007   ROM_LOAD( "rx1-6.8m",       0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
1008
1009   ROM_REGION( 0x0160, "proms", 0 )
1010   ROM_LOAD( "rx1-1.11n",      0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) )  /* Prom type: M3-7603-5 - palette */
1011   ROM_LOAD( "rx1-7.8p",       0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) )  /* Prom type: IM5623    - lookup table */
1012   ROM_LOAD( "rx1-2.4n",       0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
1013   ROM_LOAD( "rx1-3.7k",       0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
1014
1015   ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */
1016   ROM_LOAD( "rx1-5.3p",       0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
1017   ROM_LOAD( "rx1-4.2m",       0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
1018ROM_END
1019
9911020ROM_START( rallyxm )
9921021   ROM_REGION( 0x10000, "maincpu", 0 )
9931022   ROM_LOAD( "1b",           0x0000, 0x1000, CRC(5882700d) SHA1(b6029e9730f1694894fe8b729ac0ba8d6712dea9) )
r5955r5956
9991028   ROM_LOAD( "8e",           0x0000, 0x1000, CRC(277c1de5) SHA1(30bc57263e8dad870c501c76bce6f42d69ab9e00) )
10001029
10011030   ROM_REGION( 0x0100, "gfx2", 0 )
1002   ROM_LOAD( "rx-6.8m",   0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
1031   ROM_LOAD( "rx1-6.8m",       0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
10031032
10041033   ROM_REGION( 0x0160, "proms", 0 )
1005   ROM_LOAD( "rx-1.11n",  0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) )  /* Prom type: M3-7603-5 - palette */
1006   ROM_LOAD( "rx-7.8p",   0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) )  /* Prom type: IM5623    - lookup table */
1007   ROM_LOAD( "rx-2.4n",   0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
1008   ROM_LOAD( "rx1-3.7k",  0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
1034   ROM_LOAD( "rx1-1.11n",      0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) )  /* Prom type: M3-7603-5 - palette */
1035   ROM_LOAD( "rx1-7.8p",       0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) )  /* Prom type: IM5623    - lookup table */
1036   ROM_LOAD( "rx1-2.4n",       0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
1037   ROM_LOAD( "rx1-3.7k",       0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
10091038
10101039   ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */
1011   ROM_LOAD( "rx-5.3p",    0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
1012   ROM_LOAD( "rx-4.2m",    0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
1040   ROM_LOAD( "rx1-5.3p",       0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
1041   ROM_LOAD( "rx1-4.2m",       0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
10131042ROM_END
10141043
10151044ROM_START( nrallyx )
10161045   ROM_REGION( 0x10000, "maincpu", 0 )
1046   ROM_LOAD( "nrx_prg1.1d",  0x0000, 0x0800, CRC(ba7de9fc) SHA1(2133ca327589600bcbd796c213f034daa0457f72) )
1047   ROM_CONTINUE(             0x1000, 0x0800 )
1048   ROM_LOAD( "nrx_prg2.1e",  0x0800, 0x0800, CRC(eedfccae) SHA1(9fca8500f724864a2b73e38bd40cbaeef41617d7) )
1049   ROM_CONTINUE(             0x1800, 0x0800 )
1050   ROM_LOAD( "nrx_prg3.1k",  0x2000, 0x0800, CRC(b4d5d34a) SHA1(c533470aac040b3471d79fd6d35beb4fd4b5bb19) )
1051   ROM_CONTINUE(             0x3000, 0x0800 )
1052   ROM_LOAD( "nrx_prg4.1l",  0x2800, 0x0800, CRC(7da5496d) SHA1(ffac2c07dda57285673073266712fa2987e3b34f) )
1053   ROM_CONTINUE(             0x3800, 0x0800 )
1054
1055   ROM_REGION( 0x1000, "gfx1", 0 )
1056   ROM_LOAD( "nrx_chg1.8e",  0x0000, 0x0800, CRC(1fff38a4) SHA1(5f6ccce2e0daad5915d017e8d067f187eb2ed41d) )
1057   ROM_LOAD( "nrx_chg2.8d",  0x0800, 0x0800, CRC(85d9fffd) SHA1(12dff66d98a808b9dc952b2d87a56308b46a973e) )
1058
1059   ROM_REGION( 0x0100, "gfx2", 0 )
1060   ROM_LOAD( "rx1-6.8m",     0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
1061
1062   ROM_REGION( 0x0160, "proms", 0 )
1063   ROM_LOAD( "nrx1-1.11n",   0x0000, 0x0020, CRC(a0a49017) SHA1(494c920a157e9f876d533c1b0146275a366c4989) )  /* Prom type: M3-7603-5 - palette */
1064   ROM_LOAD( "nrx1-7.8p",    0x0020, 0x0100, CRC(4e46f485) SHA1(3f013aafba96a76d410f2db16d1d24d2fb257aaf) )  /* Prom type: IM5623    - lookup table */
1065   ROM_LOAD( "rx1-2.4n",     0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
1066   ROM_LOAD( "rx1-3.7k",     0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
1067
1068   ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */
1069   ROM_LOAD( "rx1-5.3p",    0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
1070   ROM_LOAD( "rx1-4.2m",    0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
1071ROM_END
1072
1073ROM_START( nrallyxb )
1074   ROM_REGION( 0x10000, "maincpu", 0 )
10171075   ROM_LOAD( "nrallyx.1b",   0x0000, 0x1000, CRC(9404c8d6) SHA1(ee7e45c22a2fbf72d3ac5ac26ab1111a22623fc5) )
10181076   ROM_LOAD( "nrallyx.1e",   0x1000, 0x1000, CRC(ac01bf3f) SHA1(8e1a7cce92ef709d18727db6ee7f89936f4b8df8) )
10191077   ROM_LOAD( "nrallyx.1h",   0x2000, 0x1000, CRC(aeba29b5) SHA1(2a6e4568729b83c430bf70e43c4146ad6a556b1b) )
r5955r5956
10231081   ROM_LOAD( "nrallyx.8e",   0x0000, 0x1000, CRC(ca7a174a) SHA1(dc553df18c45ba399661122be75b71d6cb54d6a2) )
10241082
10251083   ROM_REGION( 0x0100, "gfx2", 0 )
1026   ROM_LOAD( "rx-6.8m",      0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
1084   ROM_LOAD( "rx1-6.8m",     0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) )  /* Prom type: IM5623    - dots */
10271085
10281086   ROM_REGION( 0x0160, "proms", 0 )
1029   ROM_LOAD( "nrallyx.pr1",  0x0000, 0x0020, CRC(a0a49017) SHA1(494c920a157e9f876d533c1b0146275a366c4989) )  /* Prom type: M3-7603-5 - palette */
1030   ROM_LOAD( "nrallyx.pr2",  0x0020, 0x0100, CRC(b2b7ca15) SHA1(e604d58f2f20ebf042f28b01e74eddeacf5baba9) )  /* Prom type: IM5623    - lookup table */
1031   ROM_LOAD( "rx-2.4n",      0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
1087   ROM_LOAD( "nrx1-1.11n",   0x0000, 0x0020, CRC(a0a49017) SHA1(494c920a157e9f876d533c1b0146275a366c4989) )  /* Prom type: M3-7603-5 - palette */
1088   ROM_LOAD( "nrx1-7.8p",    0x0020, 0x0100, CRC(4e46f485) SHA1(3f013aafba96a76d410f2db16d1d24d2fb257aaf) )  /* Prom type: IM5623    - lookup table */
1089   ROM_LOAD( "rx1-2.4n",     0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) )  /* Prom type: N82S123N  - video layout (not used) */
10321090   ROM_LOAD( "rx1-3.7k",     0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) )  /* Prom type: M3-7603-5 - video timing (not used) */
10331091
10341092   ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */
1035   ROM_LOAD( "nrallyx.spr",  0x0000, 0x0100, CRC(b75c4e87) SHA1(450f79a5ae09e34f7624d37769815baf93c0028e) )  /* Prom type: IM5623  */
1036   ROM_LOAD( "rx-4.2m",      0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
1093   ROM_LOAD( "rx1-5.3p",    0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) )  /* Prom type: IM5623  */
1094   ROM_LOAD( "rx1-4.2m",    0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )  /* Prom type: IM5623 - not used */
10371095ROM_END
10381096
1039
10401097ROM_START( jungler )
10411098   ROM_REGION( 0x10000, "maincpu", 0 )
10421099   ROM_LOAD( "jungr1",       0x0000, 0x1000, CRC(5bd6ad15) SHA1(608de86e19c6726bb7d21e7dc0e936f00121a3f4) )
r5955r5956
12721329
12731330
12741331
1275GAME( 1980, rallyx,   0,        rallyx,   rallyx,   0, ROT0,  "Namco", "Rally X", GAME_IMPERFECT_SOUND )
1332GAME( 1980, rallyx,   0,        rallyx,   rallyx,   0, ROT0,  "Namco", "Rally X (32k Ver.?)", GAME_IMPERFECT_SOUND )
1333GAME( 1980, rallyxa,  rallyx,   rallyx,   rallyx,   0, ROT0,  "Namco", "Rally X", GAME_IMPERFECT_SOUND )
12761334GAME( 1980, rallyxm,  rallyx,   rallyx,   rallyx,   0, ROT0,  "[Namco] (Midway license)", "Rally X (Midway)", GAME_IMPERFECT_SOUND )
12771335GAME( 1981, nrallyx,  0,        rallyx,   nrallyx,  0, ROT0,  "Namco", "New Rally X", GAME_IMPERFECT_SOUND )
1336GAME( 1981, nrallyxb, nrallyx,  rallyx,   nrallyx,  0, ROT0,  "Namco", "New Rally X (bootleg?) ", GAME_IMPERFECT_SOUND )
12781337GAME( 1981, jungler,  0,        jungler,  jungler,  0, ROT90, "Konami", "Jungler", 0 )
12791338GAME( 1981, junglers, jungler,  jungler,  jungler,  0, ROT90, "[Konami] (Stern license)", "Jungler (Stern)", 0 )
12801339GAME( 1982, tactcian, 0,        tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 1)", 0 )
src/mame/drivers/galdrvr.c
r5955r5956
29182918   ROM_LOAD( "uniwars.clr",  0x0000, 0x0020, CRC(25c79518) SHA1(e8f7e8b3d0cf1ed9d723948548f58abf0e2c6d1f) )
29192919ROM_END
29202920
2921ROM_START( spacempr )
2922   ROM_REGION( 0x4000, "maincpu", 0 )
2923   ROM_LOAD( "uw01",   0x0000, 0x0800, CRC(7c64fb92) SHA1(69f0923870cb8cbb7ae7a2a056c67a1da9b5588d) )
2924   ROM_LOAD( "uw02",   0x0800, 0x0800, CRC(b2ed14c3) SHA1(7668df11f64b8e296eedfee53437777dc53a56d5) )
2925   ROM_LOAD( "uw03",   0x1000, 0x0800, CRC(945f4160) SHA1(5fbe879f51e14c4c7ae551e5b3089f8e148770a4) )
2926   ROM_LOAD( "uw04",   0x1800, 0x0800, CRC(84885060) SHA1(a6ea3e272b426e86ff87e95c765362b44506228e) )
2927   ROM_LOAD( "uw05",   0x2000, 0x0800, CRC(e342371d) SHA1(f53caf7793df5788237d5e2f35242c0dd7a3085b) )
2928   ROM_LOAD( "uw06",   0x2800, 0x0800, CRC(d915a389) SHA1(0e2ff6eec9453856a1276889946b463cfae58eba) )
2929   ROM_LOAD( "uw07",   0x3000, 0x0800, CRC(c9245346) SHA1(239bad3fe64eaab2dfc3febd06d1124103a10504) )
2930   ROM_LOAD( "uw08",   0x3800, 0x0800, CRC(a237c394) SHA1(66dfa2aa39bd19f1f6ddb267d8f8bdbdba750d46) )
2931
2932   ROM_REGION( 0x2000, "gfx1", 0 )
2933   ROM_LOAD( "uw10",   0x0000, 0x0800, CRC(af069cba) SHA1(12b7d0a57f43613c80afd51c417628090740aabe) )
2934   ROM_LOAD( "uw12",   0x0800, 0x0800, CRC(c26132af) SHA1(7ae125a911dfd47aeca4f129f580762ce4d8d91a) )
2935   ROM_LOAD( "uw09",   0x1000, 0x0800, CRC(ff2c20d5) SHA1(48668dc4f008f44f5c15bdcc331cfe133da99cd4) )
2936   ROM_LOAD( "uw11",   0x1800, 0x0800, CRC(dcc2b33b) SHA1(c3a5ac935c519400dfabb28909f7e460769d1837) )
2937
2938   ROM_REGION( 0x0020, "proms", 0 )
2939   ROM_LOAD( "mmi6331",  0x0000, 0x0020, CRC(6a0c7d87) SHA1(140335d85c67c75b65689d4e76d29863c209cf32) )
2940ROM_END
2941
29212942ROM_START( gteikoku )
29222943   ROM_REGION( 0x4000, "maincpu", 0 )
29232944   ROM_LOAD( "f07_1a.bin",   0x0000, 0x0800, CRC(d975af10) SHA1(a2e2a36a75db8fd09441308b08b6ae073c68b8cf) )
r5955r5956
31083129   ROM_LOAD( "blpaccp",      0x0000, 0x0020, CRC(24652bc4) SHA1(d89575f3749c75dc963317fe451ffeffd9856e4d) ) /* same as pisces */
31093130ROM_END
31103131
3132/* content is the same as the above bootleg, but arranged differently in the roms */
3133ROM_START( pacmanbla )
3134   ROM_REGION( 0x10000, "maincpu", 0 )
3135   ROM_LOAD( "rom1.bin",      0x0000, 0x0800, CRC(75e4f967) SHA1(8bdb5ab2b3f978c578f1498b64bb16d2cb292ef2) )
3136   ROM_CONTINUE(0x2000,0x800)
3137   ROM_LOAD( "rom2.bin",      0x0800, 0x0800, CRC(5b2e4293) SHA1(bb925491e315d2e6bb9e756bdf664d173f83cd58) )
3138   ROM_CONTINUE(0x2800,0x800)
3139   ROM_LOAD( "rom3.bin",      0x1000, 0x0800, CRC(c06e30a4) SHA1(00d8d114bd4e0b689e75e312c93f6c7b8492426e) )
3140   ROM_CONTINUE(0x3000,0x800)
3141   ROM_LOAD( "rom4.bin",      0x1800, 0x0800, CRC(592b4ba8) SHA1(52a559344f70cd8a3a87de71de2bae57c885641a) )
3142   ROM_CONTINUE(0x3800,0x800)
31113143
3144   ROM_REGION( 0x2000, "tempgfx", 0 )
3145   ROM_LOAD( "rom5.bin",      0x0000, 0x1000, CRC(f2d8c01e) SHA1(d4a5789476fa7859bb936df10590775e97e87578) )
3146   ROM_LOAD( "rom6.bin",      0x1000, 0x1000, CRC(346a1720) SHA1(e152c9161f4e8ef53153b9c4a8ecef9fdbbe2463) )
3147
3148   ROM_REGION( 0x1000, "gfx1", 0 )
3149   ROM_COPY( "tempgfx", 0x0800, 0x0000, 0x0800 )
3150   ROM_COPY( "tempgfx", 0x1800, 0x0800, 0x0800 )
3151
3152   ROM_REGION( 0x1000, "gfx2", 0 )
3153   ROM_COPY( "tempgfx", 0x0000, 0x0000, 0x0800 )
3154   ROM_COPY( "tempgfx", 0x1000, 0x0800, 0x0800 )
3155
3156   ROM_REGION( 0x0020, "proms", 0 )
3157   ROM_LOAD( "blpaccp",      0x0000, 0x0020, CRC(24652bc4) SHA1(d89575f3749c75dc963317fe451ffeffd9856e4d) ) /* same as pisces */
3158ROM_END
3159
31123160ROM_START( devilfsg )
31133161   ROM_REGION( 0x10000, "maincpu", 0 )
31143162   ROM_LOAD( "dfish1.7f",    0x2000, 0x0800, CRC(2ab19698) SHA1(8450981d3cf3fa8abf2fb5487aa98b03a4cf03a1) )
r5955r5956
50995147GAME( 1980, gteikob2, uniwars,  galaxian, gteikob2, pisces,   ROT90,  "bootleg", "Gingateikoku No Gyakushu (bootleg set 2)", GAME_SUPPORTS_SAVE )
51005148GAME( 1980, spacbatt, uniwars,  galaxian, spacbatt, pisces,   ROT90,  "bootleg", "Space Battle (bootleg set 1)", GAME_SUPPORTS_SAVE )
51015149GAME( 1980, spacbat2, uniwars,  galaxian, spacbatt, pisces,   ROT90,  "bootleg", "Space Battle (bootleg set 2)", GAME_SUPPORTS_SAVE )
5150GAME( 1980, spacempr, uniwars,  galaxian, spacbatt, pisces,   ROT90,  "bootleg", "Space Empire (bootleg)", GAME_SUPPORTS_SAVE )
51025151GAME( 1980, skyraidr, uniwars,  galaxian, superg,   pisces,   ROT90,  "bootleg", "Sky Raiders", GAME_SUPPORTS_SAVE )
51035152
51045153/* similar to pisces, but with different video banking characteristics */
r5955r5956
51065155
51075156/* separate tile/sprite ROMs */
51085157GAME( 1981, streakng, 0,        pacmanbl, streakng, galaxian, ROT90,  "Shoei", "Streaking", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE )
5109GAME( 1981, pacmanbl, puckman,  pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware)", GAME_SUPPORTS_SAVE )
5158GAME( 1981, pacmanbl, puckman,  pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware, set 1)", GAME_SUPPORTS_SAVE )
5159GAME( 1981, pacmanbla,puckman,  pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware, set 2)", GAME_SUPPORTS_SAVE )
51105160
51115161/* separate tile/sprite ROMs, plus INT instead of NMI */
51125162GAME( 1984, devilfsg, devilfsh, pacmanbl, devilfsg, devilfsg, ROT270, "Vision / Artic", "Devil Fish (Galaxian hardware, bootleg?)", GAME_SUPPORTS_SAVE )
src/mame/drivers/lucky74.c
r5955r5956
675675#include "lucky74.lh"
676676
677677/* from video hardware */
678extern UINT8 *fg_videoram, *fg_colorram, *bg_videoram, *bg_colorram;
679WRITE8_HANDLER( fg_videoram_w );
680WRITE8_HANDLER( fg_colorram_w );
681WRITE8_HANDLER( bg_videoram_w );
682WRITE8_HANDLER( bg_colorram_w );
678extern UINT8 *lucky74_fg_videoram, *lucky74_fg_colorram, *lucky74_bg_videoram, *lucky74_bg_colorram;
679WRITE8_HANDLER( lucky74_fg_videoram_w );
680WRITE8_HANDLER( lucky74_fg_colorram_w );
681WRITE8_HANDLER( lucky74_bg_videoram_w );
682WRITE8_HANDLER( lucky74_bg_colorram_w );
683683PALETTE_INIT( lucky74 );
684684VIDEO_START( lucky74 );
685685VIDEO_UPDATE( lucky74 );
r5955r5956
821821static ADDRESS_MAP_START( lucky74_map, ADDRESS_SPACE_PROGRAM, 8 )
822822   AM_RANGE(0x0000, 0xbfff) AM_ROM
823823   AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)   /* NVRAM */
824   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(&fg_videoram)            /* VRAM1-1 */
825   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(fg_colorram_w) AM_BASE(&fg_colorram)            /* VRAM1-2 */
826   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(&bg_videoram)            /* VRAM2-1 */
827   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(bg_colorram_w) AM_BASE(&bg_colorram)            /* VRAM2-2 */
824   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(lucky74_fg_videoram_w) AM_BASE(&lucky74_fg_videoram)            /* VRAM1-1 */
825   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(lucky74_fg_colorram_w) AM_BASE(&lucky74_fg_colorram)            /* VRAM1-2 */
826   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(lucky74_bg_videoram_w) AM_BASE(&lucky74_bg_videoram)            /* VRAM2-1 */
827   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(lucky74_bg_colorram_w) AM_BASE(&lucky74_bg_colorram)            /* VRAM2-2 */
828828   AM_RANGE(0xf000, 0xf003) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)   /* Input Ports 0 & 1 */
829829   AM_RANGE(0xf080, 0xf083) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)   /* DSW 1, 2 & 3 */
830830   AM_RANGE(0xf0c0, 0xf0c3) AM_DEVREADWRITE("ppi8255_3", ppi8255_r, ppi8255_w)   /* DSW 4 */
src/mame/drivers/segamsys.c
r0r5956
1/*
2    SMS code from HazeMD
3     - used by Syetem E
4     - Megatech / Megaplay
5
6    this contains common code to support those systems
7
8    (not currently very good / accurate, should be rewritten)
9
10*/
11
12#include "driver.h"
13#include "cpu/z80/z80.h"
14#include "sound/sn76496.h"
15#include "machine/mc8123.h"
16#include "machine/segacrpt.h"
17#include "segamsys.h"
18
19
20//static UINT8* sms_rom;
21UINT8* sms_mainram;
22UINT8* smsgg_backupram = 0;
23static TIMER_CALLBACK( sms_scanline_timer_callback );
24static struct sms_vdp *vdp2;
25static struct sms_vdp *vdp1;
26
27static struct sms_vdp *md_sms_vdp;
28
29/* All Accesses to VRAM go through here for safety */
30#define SMS_VDP_VRAM(address) chip->vram[(address)&0x3fff]
31
32#ifdef UNUSED_FUNCTION
33static ADDRESS_MAP_START( sms_map, ADDRESS_SPACE_PROGRAM, 8 )
34//  AM_RANGE(0x0000 , 0xbfff) AM_ROM
35//  AM_RANGE(0xc000 , 0xdfff) AM_RAM AM_MIRROR(0x2000)
36ADDRESS_MAP_END
37#endif
38
39
40ADDRESS_MAP_START( sms_io_map, ADDRESS_SPACE_IO, 8 )
41   ADDRESS_MAP_GLOBAL_MASK(0xff)
42ADDRESS_MAP_END
43
44static INPUT_PORTS_START( sms_common )
45   PORT_START("PAD1")      /* Joypad 1 (2 button) NOT READ DIRECTLY */
46   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
47   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
48   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
49   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
50   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 B") // a
51   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 C") // b
52   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
53   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
54
55   PORT_START("PAD2")      /* Joypad 2 (2 button) NOT READ DIRECTLY */
56   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
57   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
58   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
59   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
60   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 B") // a
61   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 C") // b
62   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
63   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
64INPUT_PORTS_END
65
66INPUT_PORTS_START( sms )
67   PORT_INCLUDE( sms_common )
68
69   PORT_START("PAUSE")      /* Buttons on SMS Console */
70   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Pause Button") PORT_IMPULSE(1)
71INPUT_PORTS_END
72
73INPUT_PORTS_START( gamegear )
74   PORT_INCLUDE( sms_common )
75
76   PORT_START("GGSTART")      /* Extra GameGear button */
77   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Start Button")
78INPUT_PORTS_END
79
80/* Precalculated tables for H/V counters.  Note the position the counter 'jumps' is marked with with
81   an empty comment */
82static const UINT8 hc_256[] =
83{
84    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,    0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
85    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,    0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
86    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,    0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
87    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,    0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
88    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,    0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
89    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,    0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
90    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,    0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
91    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,    0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
92    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,    0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
93    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,    0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
94    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,    0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
95    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,    0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
96    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,    0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
97    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
98    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,/**/0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
99    0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3,    0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
100    0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,    0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
101    0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3,    0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
102    0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,    0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
103    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,    0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
104    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,    0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
105    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
106};
107
108
109static const UINT8 vc_ntsc_192[] =
110{
111    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,    0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
112    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,    0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
113    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,    0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
114    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,    0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
115    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,    0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
116    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,    0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
117    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,    0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
118    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,    0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
119    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,    0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
120    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,    0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
121    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,    0xab, 0xac, 0xad, 0xae, 0xaf,
122    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,    0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
123    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,    0xcb, 0xcc, 0xcd, 0xce, 0xcf,
124    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,/**/0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
125    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4,    0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
126    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,    0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
127    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
128};
129
130static const UINT8 vc_ntsc_224[] =
131{
132    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,    0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
133    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,    0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
134    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,    0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
135    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,    0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
136    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,    0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
137    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,    0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
138    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,    0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
139    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,    0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
140    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,    0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
141    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,    0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
142    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,    0xab, 0xac, 0xad, 0xae, 0xaf,
143    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,    0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
144    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,    0xcb, 0xcc, 0xcd, 0xce, 0xcf,
145    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,    0xdb, 0xdc, 0xdd, 0xde, 0xdf,
146    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,/**/0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
147    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,    0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
148    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
149};
150
151static const UINT8 vc_ntsc_240[] =
152{
153    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
154    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
155    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
156    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
157    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
158    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
159    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
160    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
161    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
162    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
163    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
164    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
165    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
166    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
167    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
168    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
169    0x00, 0x01, 0x02, 0x03, 0x04, 0x05
170};
171
172
173
174static const UINT8 vc_pal_192[] =
175{
176    0x00, 0x01, 0x02,    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
177    0x10, 0x11, 0x12,    0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
178    0x20, 0x21, 0x22,    0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
179    0x30, 0x31, 0x32,    0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
180    0x40, 0x41, 0x42,    0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
181    0x50, 0x51, 0x52,    0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
182    0x60, 0x61, 0x62,    0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
183    0x70, 0x71, 0x72,    0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
184    0x80, 0x81, 0x82,    0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
185    0x90, 0x91, 0x92,    0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
186    0xa0, 0xa1, 0xa2,    0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
187    0xb0, 0xb1, 0xb2,    0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
188    0xc0, 0xc1, 0xc2,    0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
189    0xd0, 0xd1, 0xd2,    0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
190    0xe0, 0xe1, 0xe2,    0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
191    0xf0, 0xf1, 0xf2,/**/0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6,
192    0xc7, 0xc8, 0xc9,    0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
193    0xd7, 0xd8, 0xd9,    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
194    0xe7, 0xe8, 0xe9,    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
195    0xf7, 0xf8, 0xf9,    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
196};
197
198
199static const UINT8 vc_pal_224[] =
200{
201    0x00, 0x01, 0x02,    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
202    0x10, 0x11, 0x12,    0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
203    0x20, 0x21, 0x22,    0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
204    0x30, 0x31, 0x32,    0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
205    0x40, 0x41, 0x42,    0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
206    0x50, 0x51, 0x52,    0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
207    0x60, 0x61, 0x62,    0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
208    0x70, 0x71, 0x72,    0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
209    0x80, 0x81, 0x82,    0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
210    0x90, 0x91, 0x92,    0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
211    0xa0, 0xa1, 0xa2,    0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
212    0xb0, 0xb1, 0xb2,    0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
213    0xc0, 0xc1, 0xc2,    0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
214    0xd0, 0xd1, 0xd2,    0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
215    0xe0, 0xe1, 0xe2,    0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
216    0xf0, 0xf1, 0xf2,    0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
217    0x00, 0x01, 0x02,/**/0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
218    0xd7, 0xd8, 0xd9,    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
219    0xe7, 0xe8, 0xe9,    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
220    0xf7, 0xf8, 0xf9,    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
221};
222
223static const UINT8 vc_pal_240[] =
224{
225    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,    0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
226    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,    0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
227    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,    0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
228    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,    0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
229    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,    0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
230    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,    0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
231    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,    0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
232    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,    0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
233    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,    0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
234    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,    0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
235    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,    0xab, 0xac, 0xad, 0xae, 0xaf,
236    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,    0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
237    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,    0xcb, 0xcc, 0xcd, 0xce, 0xcf,
238    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,    0xdb, 0xdc, 0xdd, 0xde, 0xdf,
239    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,    0xeb, 0xec, 0xed, 0xee, 0xef,
240    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa,    0xfb, 0xfc, 0xfd, 0xfe, 0xff,
241    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,/**/0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
242    0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1,    0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
243    0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1,    0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
244    0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
245};
246
247static const struct
248{
249   UINT8 sms2_name[40];
250   int sms2_valid;
251   int sms2_height;
252   int sms2_tilemap_height;
253   const UINT8* sms_vcounter_table;
254   const UINT8* sms_hcounter_table;
255
256} sms_mode_table[] =
257{
258   /* NTSC Modes */
259   { "Graphic 1 (NTSC)",         0, 192, 224, vc_ntsc_192, hc_256 },
260   { "Text (NTSC)",              0, 192, 224, vc_ntsc_192, hc_256 },
261   { "Graphic 2 (NTSC)",         0, 192, 224, vc_ntsc_192, hc_256 },
262   { "Mode 1+2 (NTSC)" ,         0, 192, 224, vc_ntsc_192, hc_256 },
263   { "Multicolor (NTSC)",        0, 192, 224, vc_ntsc_192, hc_256 },
264   { "Mode 1+3 (NTSC)",          0, 192, 224, vc_ntsc_192, hc_256 },
265   { "Mode 2+3 (NTSC)",          0, 192, 224, vc_ntsc_192, hc_256 },
266   { "Mode 1+2+3 (NTSC)",        0, 192, 224, vc_ntsc_192, hc_256 },
267   { "Mode 4 (NTSC)",            1, 192, 224, vc_ntsc_192, hc_256 },
268   { "Invalid Text (NTSC)",      0, 192, 224, vc_ntsc_192, hc_256 },
269   { "Mode 4 (NTSC)",            1, 192, 224, vc_ntsc_192, hc_256 },
270   { "Mode 4 (224-line) (NTSC)", 1, 224, 256, vc_ntsc_224, hc_256 },
271   { "Mode 4 (NTSC)",            1, 192, 224, vc_ntsc_192, hc_256 },
272   { "Invalid Text (NTSC)",      0, 192, 224, vc_ntsc_192, hc_256 },
273   { "Mode 4 (240-line) (NTSC)", 1, 240, 256, vc_ntsc_240, hc_256 },
274   { "Mode 4 (NTSC)",            1, 192, 244, vc_ntsc_192, hc_256 },
275
276   /* Pal Modes (different Vcounter) */
277   { "Graphic 1 (PAL)",         0, 192, 224, vc_pal_192, hc_256 },
278   { "Text (PAL)",              0, 192, 224, vc_pal_192, hc_256 },
279   { "Graphic 2 (PAL)",         0, 192, 224, vc_pal_192, hc_256 },
280   { "Mode 1+2 (PAL)" ,         0, 192, 224, vc_pal_192, hc_256 },
281   { "Multicolor (PAL)",        0, 192, 224, vc_pal_192, hc_256 },
282   { "Mode 1+3 (PAL)",          0, 192, 224, vc_pal_192, hc_256 },
283   { "Mode 2+3 (PAL)",          0, 192, 224, vc_pal_192, hc_256 },
284   { "Mode 1+2+3 (PAL)",        0, 192, 224, vc_pal_192, hc_256 },
285   { "Mode 4 (PAL)",            1, 192, 224, vc_pal_192, hc_256 },
286   { "Invalid Text (PAL)",      0, 192, 224, vc_pal_192, hc_256 },
287   { "Mode 4 (PAL)",            1, 192, 224, vc_pal_192, hc_256 },
288   { "Mode 4 (224-line) (PAL)", 1, 224, 256, vc_pal_224, hc_256 },
289   { "Mode 4 (PAL)",            1, 192, 224, vc_pal_192, hc_256 },
290   { "Invalid Text (PAL)",      0, 192, 224, vc_pal_192, hc_256 },
291   { "Mode 4 (240-line) (PAL)", 1, 240, 256, vc_pal_240, hc_256 },
292   { "Mode 4 (PAL)",            1, 192, 244, vc_pal_192, hc_256 }
293};
294
295enum
296{
297   SMS_VDP = 0,  // SMS1 VDP
298   SMS2_VDP = 1, // SMS2 VDP, or Game Gear VDP running in SMS2 Mode
299   GG_VDP = 2,   // Game Gear VDP running in Game Gear Mode
300   GEN_VDP = 3   // Genesis VDP running in SMS2 Mode
301};
302
303static int sms_vdp_null_irq_callback(running_machine *machine, int status)
304{
305   return -1;
306}
307
308static int sms_vdp_cpu0_irq_callback(running_machine *machine, int status)
309{
310   if (status == 1)
311      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
312   else
313      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
314
315   return 0;
316}
317
318static int sms_vdp_cpu1_irq_callback(running_machine *machine, int status)
319{
320   if (status == 1)
321      cputag_set_input_line(machine, "genesis_snd_z80", 0, HOLD_LINE);
322   else
323      cputag_set_input_line(machine, "genesis_snd_z80", 0, CLEAR_LINE);
324
325   return 0;
326}
327
328
329static int sms_vdp_cpu2_irq_callback(running_machine *machine, int status)
330{
331   if (status == 1)
332      cputag_set_input_line(machine, "mtbios", 0, HOLD_LINE);
333   else
334      cputag_set_input_line(machine, "mtbios", 0, CLEAR_LINE);
335
336   return 0;
337}
338
339
340
341
342struct sms_vdp
343{
344   UINT8 chip_id;
345
346   UINT8  cmd_pend;
347   UINT8  cmd_part1;
348   UINT8  cmd_part2;
349   UINT16 addr_reg;
350   UINT8  cmd_reg;
351   UINT8  regs[0x10];
352   UINT8  readbuf;
353   UINT8* vram;
354   UINT8* cram;
355   UINT8  writemode;
356   bitmap_t* r_bitmap;
357   UINT8* tile_renderline;
358   UINT8* sprite_renderline;
359
360   UINT8 sprite_collision;
361   UINT8 sprite_overflow;
362
363   UINT8  yscroll;
364   UINT8  hint_counter;
365
366   UINT8 frame_irq_pending;
367   UINT8 line_irq_pending;
368
369   UINT8 vdp_type;
370
371   UINT8 gg_cram_latch; // gamegear specific.
372
373   /* below are MAME specific, to make things easier */
374   UINT8 screen_mode;
375   UINT8 is_pal;
376   int sms_scanline_counter;
377   int sms_total_scanlines;
378   int sms_framerate;
379   emu_timer* sms_scanline_timer;
380   UINT16* cram_mamecolours; // for use on RGB_DIRECT screen
381   int    (*set_irq)(running_machine *machine, int state);
382
383};
384
385
386
387static void *start_vdp(running_machine *machine, int type)
388{
389   struct sms_vdp *chip;
390
391   chip = auto_alloc_clear(machine, struct sms_vdp);
392
393   chip->vdp_type = type;
394
395   chip->set_irq = sms_vdp_null_irq_callback;
396
397   chip->cmd_pend = 0;
398   chip->cmd_part1 = 0;
399   chip->cmd_part2 = 0;
400   chip->addr_reg = 0;
401   chip->cmd_reg = 0;
402
403   chip->regs[0x0] = 0x06; // mode 4
404   chip->regs[0x1] = 0x18; // mode 4
405   chip->regs[0x2] = 0;
406   chip->regs[0x3] = 0;
407   chip->regs[0x4] = 0;
408   chip->regs[0x5] = 0;
409   chip->regs[0x6] = 0;
410   chip->regs[0x7] = 0;
411   chip->regs[0x8] = 0;
412   chip->regs[0x9] = 0;
413   chip->regs[0xa] = 0;
414   /* b-f don't matter */
415   chip->readbuf = 0;
416   chip->vram = auto_alloc_array_clear(machine, UINT8, 0x4000);
417
418   //printf("%d\n", (*chip->set_irq)(machine, 200));
419
420   if (chip->vdp_type==GG_VDP)
421   {
422      chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0040);
423      chip->cram_mamecolours = auto_alloc_array_clear(machine, UINT16, 0x0080/2);
424      chip->gg_cram_latch = 0;
425   }
426   else
427   {
428      chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0020);
429      chip->cram_mamecolours = auto_alloc_array(machine, UINT16, 0x0040/2);
430   }
431
432   chip->tile_renderline = auto_alloc_array(machine, UINT8, 256+8);
433   memset(chip->tile_renderline,0x00,256+8);
434
435   chip->sprite_renderline = auto_alloc_array(machine, UINT8, 256+32);
436   memset(chip->sprite_renderline,0x00,256+32);
437
438   chip->writemode = 0;
439   chip->r_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_RGB15);
440
441   chip->sms_scanline_timer = timer_alloc(machine, sms_scanline_timer_callback, chip);
442
443   return chip;
444}
445
446/* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */
447void segae_md_sms_stop_scanline_timer(void)
448{
449   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer,  attotime_never, 0);
450   memset(md_sms_vdp->vram,0x00,0x4000);
451}
452
453
454#ifdef UNUSED_FUNCTION
455static READ8_HANDLER( z80_unmapped_r )
456{
457   printf("unmapped z80 read %04x\n",offset);
458   return 0;
459}
460
461static WRITE8_HANDLER( z80_unmapped_w )
462{
463   printf("unmapped z80 write %04x\n",offset);
464}
465#endif
466
467static UINT8 vcounter_r(struct sms_vdp *chip)
468{
469//  return vc_pal_224[sms_scanline_counter%(sizeof vc_pal_224)];
470   UINT8 retvalue;
471   int scanline = chip->sms_scanline_counter%chip->sms_total_scanlines;
472
473   retvalue = sms_mode_table[chip->screen_mode].sms_vcounter_table[scanline];
474
475   return retvalue;
476   //printf("retvalue %d\n";
477}
478
479
480static UINT8 vdp_data_r(struct sms_vdp *chip)
481{
482   UINT8 retdata = chip->readbuf;
483   chip->readbuf = SMS_VDP_VRAM(chip->addr_reg);
484   chip->addr_reg++; chip->addr_reg&=0x3fff;
485   return retdata;
486}
487
488static void vdp_data_w(const address_space *space, UINT8 data, struct sms_vdp* chip)
489{
490   /* data writes clear the pending flag */
491   chip->cmd_pend = 0;
492
493   if (chip->writemode==0)
494   { /* Write to VRAM */
495      SMS_VDP_VRAM(chip->addr_reg)=data;
496      chip->addr_reg++; chip->addr_reg&=0x3fff;
497      chip->readbuf = data; // quirk of the VDP
498   }
499   else if (chip->writemode==1)
500   {
501      if (chip->vdp_type==GG_VDP)
502      {
503         if (!(chip->addr_reg&1))
504         { /* Even address, value latched */
505            chip->gg_cram_latch = data;
506         }
507         else
508         {
509            chip->cram[(chip->addr_reg&0x3e)+1]=data;
510            chip->cram[(chip->addr_reg&0x3e)+0]=chip->gg_cram_latch;
511
512            /* Set Colour */
513            {
514               UINT16 palword;
515               UINT8 r,g,b;
516
517               palword = ((chip->cram[(chip->addr_reg&0x3e)+1])<<8)|(chip->cram[(chip->addr_reg&0x3e)+0]);
518
519               //printf("addr %04x palword %04x\n", chip->addr_reg&0x3f, palword);
520
521               r = (palword & 0x000f)>>0;
522               g = (palword & 0x00f0)>>4;
523               b = (palword & 0x0f00)>>8;
524               palette_set_color_rgb(space->machine,(chip->addr_reg&0x3e)/2, pal4bit(r), pal4bit(g), pal4bit(b));
525               chip->cram_mamecolours[(chip->addr_reg&0x3e)/2]=(b<<1)|(g<<6)|(r<<11);
526            }
527         }
528      }
529      else
530      {
531         chip->cram[chip->addr_reg&0x1f]=data;
532
533         /* Set Colour */
534         {
535            UINT8 r,g,b;
536            r = (data & 0x03)>>0;
537            g = (data & 0x0c)>>2;
538            b = (data & 0x30)>>4;
539            palette_set_color_rgb(space->machine,chip->addr_reg&0x1f, pal2bit(r), pal2bit(g), pal2bit(b));
540            chip->cram_mamecolours[chip->addr_reg&0x1f]=(b<<3)|(g<<8)|(r<<13);
541         }
542
543      }
544
545      chip->addr_reg++; chip->addr_reg&=0x3fff;
546      chip->readbuf = data; // quirk of the VDP
547
548   }
549
550}
551
552static UINT8 vdp_ctrl_r(const address_space *space, struct sms_vdp *chip)
553{
554   UINT8 retvalue;
555
556   retvalue = (chip->frame_irq_pending<<7) |
557                (chip->sprite_overflow<<6) |
558              (chip->sprite_collision<<5);
559
560   chip->cmd_pend = 0;
561   chip->frame_irq_pending = 0;
562   chip->line_irq_pending = 0;
563   chip->sprite_collision = 0;
564   chip->sprite_overflow = 0;
565
566   (chip->set_irq)(space->machine, 0); // clear IRQ;
567
568
569   return retvalue;
570}
571
572/* check me */
573static void vdp_update_code_addr_regs(struct sms_vdp *chip)
574{
575   chip->addr_reg = ((chip->cmd_part2&0x3f)<<8) | chip->cmd_part1;
576   chip->cmd_reg = (chip->cmd_part2&0xc0)>>6;
577}
578
579static void vdp_set_register(running_machine *machine, struct sms_vdp *chip)
580{
581   UINT8 reg = chip->cmd_part2&0x0f;
582   chip->regs[reg] = chip->cmd_part1;
583
584   //if(reg==0) printf("setting reg 0 to %02x\n",chip->cmd_part1);
585
586   //if (reg>0xa) printf("Invalid register write to register %01x\n",reg);
587
588   if(reg==1)
589   {
590      if ((chip->regs[0x1]&0x20) && chip->frame_irq_pending)
591      {
592         (chip->set_irq)(machine, 1); // set IRQ;
593      }
594      else
595      {
596         (chip->set_irq)(machine, 0); // clear IRQ;
597      }
598   }
599
600   if(reg==0)
601   {
602      if ((chip->regs[0x0]&0x10) && chip->line_irq_pending)
603      {
604         (chip->set_irq)(machine, 1); // set IRQ;
605      }
606      else
607      {
608         (chip->set_irq)(machine, 0); // clear IRQ;
609      }
610   }
611
612
613//  printf("VDP: setting register %01x to %02x\n",reg, chip->cmd_part1);
614}
615
616static void vdp_ctrl_w(const address_space *space, UINT8 data, struct sms_vdp *chip)
617{
618   if (chip->cmd_pend)
619   { /* Part 2 of a command word write */
620      chip->cmd_pend = 0;
621      chip->cmd_part2 = data;
622      vdp_update_code_addr_regs(chip);
623
624      switch (chip->cmd_reg)
625      {
626         case 0x0: /* VRAM read mode */
627            chip->readbuf = SMS_VDP_VRAM(chip->addr_reg);
628            chip->addr_reg++; chip->addr_reg&=0x3fff;
629            chip->writemode = 0;
630            break;
631
632         case 0x1: /* VRAM write mode */
633            chip->writemode = 0;
634            break;
635
636         case 0x2: /* REG setting */
637            vdp_set_register(space->machine, chip);
638            chip->writemode = 0;
639            break;
640
641         case 0x3: /* CRAM write mode */
642            chip->writemode = 1;
643            break;
644      }
645   }
646   else
647   { /* Part 1 of a command word write */
648      chip->cmd_pend = 1;
649      chip->cmd_part1 = data;
650      vdp_update_code_addr_regs(chip);
651   }
652}
653
654/* for the Genesis */
655
656READ8_HANDLER( md_sms_vdp_vcounter_r )
657{
658   return vcounter_r(md_sms_vdp);
659}
660
661READ8_HANDLER( md_sms_vdp_data_r )
662{
663   return vdp_data_r(md_sms_vdp);
664}
665
666WRITE8_HANDLER( md_sms_vdp_data_w )
667{
668   vdp_data_w(space, data, md_sms_vdp);
669}
670
671READ8_HANDLER( md_sms_vdp_ctrl_r )
672{
673   return vdp_ctrl_r(space, md_sms_vdp);
674}
675
676WRITE8_HANDLER( md_sms_vdp_ctrl_w )
677{
678   vdp_ctrl_w(space, data, md_sms_vdp);
679}
680
681
682/* Read / Write Handlers - call other functions */
683
684READ8_HANDLER( sms_vcounter_r )
685{
686   return vcounter_r(vdp1);
687}
688
689READ8_HANDLER( sms_vdp_data_r )
690{
691   return vdp_data_r(vdp1);
692}
693
694WRITE8_HANDLER( sms_vdp_data_w )
695{
696   vdp_data_w(space, data, vdp1);
697}
698
699READ8_HANDLER( sms_vdp_ctrl_r )
700{
701   return vdp_ctrl_r(space, vdp1);
702}
703
704WRITE8_HANDLER( sms_vdp_ctrl_w )
705{
706   vdp_ctrl_w(space, data, vdp1);
707}
708
709static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip)
710{
711   int xx;
712   UINT32 gfxdata;
713   UINT16 gfx_base = (tiledata & 0x01ff)<<5;
714   UINT8  flipx = (tiledata & 0x0200)>>9;
715   UINT8  flipy = (tiledata & 0x0400)>>10;
716   UINT8  pal   = (tiledata & 0x0800)>>11;
717   UINT8  pri   = (tiledata & 0x1000)>>12;
718
719   if (flipy)
720   {
721      gfx_base+=(7-tileline)*4;
722   }
723   else
724   {
725      gfx_base+=tileline*4;
726   }
727
728   gfxdata = (SMS_VDP_VRAM(gfx_base)<<24)|(SMS_VDP_VRAM(gfx_base+1)<<16)|(SMS_VDP_VRAM(gfx_base+2)<<8)|(SMS_VDP_VRAM(gfx_base+3)<<0);
729
730   for (xx=0;xx<8;xx++)
731   {
732      UINT8 pixel;
733
734      if (flipx)
735      {
736         pixel = (( (gfxdata>>(0+xx)  ) &0x00000001)<<3)|
737                  (( (gfxdata>>(8+xx)  ) &0x00000001)<<2)|
738                  (( (gfxdata>>(16+xx) ) &0x00000001)<<1)|
739                  (( (gfxdata>>(24+xx) ) &0x00000001)<<0);
740      }
741      else
742      {
743         pixel = (( (gfxdata>>(7-xx)  ) &0x00000001)<<3)|
744                 (( (gfxdata>>(15-xx) ) &0x00000001)<<2)|
745                 (( (gfxdata>>(23-xx) ) &0x00000001)<<1)|
746                 (( (gfxdata>>(31-xx) ) &0x00000001)<<0);
747      }
748
749      pixel += pal*0x10;
750
751      if (!pri) linebuf[drawxpos+xx] = pixel;
752      else
753      {
754         if (pixel&0xf)
755            linebuf[drawxpos+xx] = pixel|0x80;
756         else
757            linebuf[drawxpos+xx] = pixel;
758
759      }
760   }
761}
762
763static void sms_render_spriteline(int scanline, struct sms_vdp* chip)
764{
765   int spritenum;
766   int height = 8;
767   int width = 8;
768   int max_sprites = 8;
769   int visible_line = 0;
770
771   UINT16 table_base = (chip->regs[0x5]&0x7e) << 7;
772   UINT8 pattern_bit = (chip->regs[0x6]&0x04) >> 2; // high bit of the tile # (because spriteram can only contain an 8-bit tile #)
773
774
775   memset(chip->sprite_renderline, 0, 256+32);
776
777   for (spritenum = 0;spritenum<64;spritenum++)
778   {
779      int xpos,ypos,num;
780      /*
781        00: yyyyyyyyyyyyyyyy
782        10: yyyyyyyyyyyyyyyy
783        20: yyyyyyyyyyyyyyyy
784        30: yyyyyyyyyyyyyyyy
785        40: ????????????????
786        50: ????????????????
787        60: ????????????????
788        70: ????????????????
789        80: xnxnxnxnxnxnxnxn
790        90: xnxnxnxnxnxnxnxn
791        A0: xnxnxnxnxnxnxnxn
792        B0: xnxnxnxnxnxnxnxn
793        C0: xnxnxnxnxnxnxnxn
794        D0: xnxnxnxnxnxnxnxn
795        E0: xnxnxnxnxnxnxnxn
796        F0: xnxnxnxnxnxnxnxn
797        */
798
799      ypos = SMS_VDP_VRAM(table_base+spritenum);
800      xpos = SMS_VDP_VRAM(table_base+0x80+spritenum*2+0);
801      num  = SMS_VDP_VRAM(table_base+0x80+spritenum*2+1)|(pattern_bit<<8);
802
803      if (chip->regs[0x1]&0x2)
804      {
805         num &=0x1fe;
806         height=16;
807      }
808      else height = 8;
809
810
811      xpos+=16; // allow room either side for clipping (avoids xdrawpos of -8 if bit below is set)
812
813      if (chip->regs[0x0]&0x08) xpos-=8;
814
815      if ((sms_mode_table[chip->screen_mode].sms2_height)==192)
816      {
817         if (ypos == 0xd0)
818            return;
819      }
820
821      ypos++;
822
823      num <<= 5;
824      //num+=((scanline-ypos)&0x7)*4;
825
826      visible_line = 0;
827
828      if (ypos<=scanline && ypos+height>scanline)
829      {
830         visible_line = 1;
831         num+=((scanline-ypos)&(height-1))*4;
832
833      }
834      else if (ypos+height>0x100)
835      {
836         if (scanline< ypos+height-0x100)
837         {
838            visible_line = 1;
839            num+=((scanline-ypos)&(height-1))*4;
840
841         }
842      }
843
844      if (visible_line)
845      {
846         int xx;
847         UINT32 gfxdata;
848
849         gfxdata = (SMS_VDP_VRAM(num&0x3fff)<<24)|(SMS_VDP_VRAM((num+1)&0x3fff)<<16)|(SMS_VDP_VRAM((num+2)&0x3fff)<<8)|(SMS_VDP_VRAM((num+3)&0x3fff)<<0);
850
851
852         for (xx=0;xx<8;xx++)
853         {
854            UINT8 pixel = (( (gfxdata>>(0+xx)  ) &0x00000001)<<3)|
855                          (( (gfxdata>>(8+xx)  ) &0x00000001)<<2)|
856                          (( (gfxdata>>(16+xx) ) &0x00000001)<<1)|
857                          (( (gfxdata>>(24+xx) ) &0x00000001)<<0);
858
859            if (pixel)
860            {
861               if (!chip->sprite_renderline[xpos+((width-1)-xx)])
862               {
863                  chip->sprite_renderline[xpos+((width-1)-xx)] = pixel;
864               }
865               else
866               {
867                  chip->sprite_collision = 1;
868               }
869            }
870         }
871
872         max_sprites--;
873
874         if (max_sprites==0)
875         {
876            chip->sprite_overflow = 1;
877            return;
878         }
879
880      }
881   }
882}
883
884static void sms_render_tileline(int scanline, struct sms_vdp* chip)
885{
886   int column = 0;
887   int count = 32;
888   int drawxpos;
889
890   UINT8 xscroll = chip->regs[0x8];
891   UINT8 yscroll = chip->yscroll;
892   UINT16 table_base = (chip->regs[0x2]&0x0e)<<10;
893   UINT16 our_base;
894   UINT8  our_line = (scanline+yscroll) & 0x7;
895
896   /* In 224 and 240 line modes the table base is different */
897   if ((sms_mode_table[chip->screen_mode].sms2_height)!=192)
898   {
899      table_base &=0x3700; table_base|=0x700;
900   }
901
902   if ((chip->regs[0x0]&0x40) && scanline < 16)
903   {
904      xscroll = 0;
905   }
906
907//  xscroll = 0;
908
909//  table_base -= 0x0100;
910
911   our_base = table_base+(((scanline+yscroll)%sms_mode_table[chip->screen_mode].sms2_tilemap_height)>>3)*64;// + (yscroll>>3)*32;
912
913   our_base &=0x3fff;
914
915   memset(chip->tile_renderline, (chip->regs[0x7]&0x0f)+0x10, 256+8);
916
917   drawxpos = xscroll&0x7;
918   column = 32-(xscroll>>3);
919
920   do
921   {
922      UINT16 tiledata = (SMS_VDP_VRAM((our_base+(column&0x1f)*2+1)&0x3fff) << 8) |
923                        (SMS_VDP_VRAM((our_base+(column&0x1f)*2+0)&0x3fff) << 0);
924
925//      UINT16 pattern = ((column+((scanline>>3)*32)) & 0x01ff)<<5;
926
927      draw_tile_line(drawxpos, our_line, tiledata, chip->tile_renderline, chip);
928
929      drawxpos+=8;
930      column++;
931      column&=0x1f;
932      count--;
933   } while (count);
934
935}
936
937static void sms_copy_to_renderbuffer(int scanline, struct sms_vdp* chip)
938{
939   int x;
940   UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, scanline, 0);
941
942   for (x=0;x<256;x++)
943   {
944      UINT8 dat = chip->tile_renderline[x];
945      UINT8 col;
946
947
948      col = (chip->regs[0x7]&0x0f)+0x10;
949      lineptr[x] = chip->cram_mamecolours[col];
950
951
952      if ((x<8 && (chip->regs[0x0]&0x20)) || !(chip->regs[0x1]&0x40))
953         continue;
954
955
956      if (!(dat & 0x80))
957      {
958         lineptr[x] = chip->cram_mamecolours[dat&0x1f];
959         if ((dat&0xf)==0x0) lineptr[x]|=0x8000;
960
961      }
962
963      if (chip->sprite_renderline[x+16])
964      {
965         lineptr[x] =  chip->cram_mamecolours[chip->sprite_renderline[x+16]+0x10];
966      }
967
968      if (dat & 0x80)
969      {
970         lineptr[x] = chip->cram_mamecolours[dat&0x1f];
971         if ((dat&0xf)==0x0) lineptr[x]|=0x8000;
972      }
973
974   }
975
976}
977
978static void sms_draw_scanline(int scanline, struct sms_vdp* chip)
979{
980
981   if (scanline>=0 && scanline<sms_mode_table[chip->screen_mode].sms2_height)
982   {
983      sms_render_spriteline(scanline, chip);
984      sms_render_tileline(scanline, chip);
985      sms_copy_to_renderbuffer(scanline, chip);
986
987   }
988}
989
990
991static TIMER_CALLBACK( sms_scanline_timer_callback )
992{
993   /* This function is called at the very start of every scanline starting at the very
994       top-left of the screen.  The first scanline is scanline 0 (we set scanline to -1 in
995       VIDEO_EOF) */
996
997   /* Compensate for some rounding errors
998
999       When the counter reaches 314 (or whatever the max lines is) we should have reached the
1000       end of the frame, however due to rounding errors in the timer calculation we're not quite
1001       there.  Let's assume we are still in the previous scanline for now.
1002
1003       The position to get the H position also has to compensate for a few errors
1004    */
1005//  printf("num %d\n",num );
1006   struct sms_vdp *chip = (struct sms_vdp *)ptr;
1007
1008   if (chip->sms_scanline_counter<(chip->sms_total_scanlines-1))
1009   {
1010      chip->sms_scanline_counter++;
1011      timer_adjust_oneshot(chip->sms_scanline_timer, ATTOTIME_IN_HZ(chip->sms_framerate * chip->sms_total_scanlines), 0);
1012
1013      if (chip->sms_scanline_counter>sms_mode_table[chip->screen_mode].sms2_height)
1014      {
1015         chip->hint_counter=chip->regs[0xa];
1016      }
1017
1018      if (chip->sms_scanline_counter==0)
1019      {
1020         chip->hint_counter=chip->regs[0xa];
1021      }
1022
1023      if (chip->sms_scanline_counter<=192)
1024      {
1025         chip->hint_counter--;
1026
1027         if (chip->hint_counter==0xff)
1028         {
1029            //if (chip->chip_id==2) printf("irq triggerd on scanline %d %d\n", vdp1->sms_scanline_counter, vdp2->sms_scanline_counter);
1030
1031            chip->line_irq_pending = 1;
1032            chip->hint_counter=chip->regs[0xa];
1033            if (chip->regs[0x0]&0x10)
1034            {
1035               (chip->set_irq)(machine, 1); // set IRQ;
1036            }
1037            else
1038            {
1039               (chip->set_irq)(machine, 0); // clear IRQ;
1040            }
1041         }
1042
1043      }
1044
1045
1046      sms_draw_scanline(chip->sms_scanline_counter, chip);
1047
1048      //if(sms_scanline_counter==0) chip->sprite_collision = 0;
1049
1050      if (chip->sms_scanline_counter==sms_mode_table[chip->screen_mode].sms2_height+1 )
1051      {
1052         chip->frame_irq_pending = 1;
1053         if (chip->regs[0x1]&0x20)
1054         {
1055            (chip->set_irq)(machine, 1); // set IRQ;
1056         }
1057         else
1058         {
1059            (chip->set_irq)(machine, 0); // clear IRQ;
1060         }
1061      }
1062   }
1063   else
1064   {   /* if we're called passed the total number of scanlines then assume we're still on the last one.
1065           this can happen due to rounding errors */
1066      chip->sms_scanline_counter = chip->sms_total_scanlines-1;
1067   }
1068}
1069
1070#ifdef UNUSED_FUNCTION
1071static void show_tiles(struct sms_vdp* chip)
1072{
1073   int x,y,xx,yy;
1074   UINT16 count = 0;
1075
1076   for (y=0;y<16;y++)
1077   {
1078      for (x=0;x<32;x++)
1079      {
1080         for (yy=0;yy<8;yy++)
1081         {
1082            int drawypos = y*8+yy;
1083            UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, drawypos, 0);
1084
1085            UINT32 gfxdata = (SMS_VDP_VRAM(count)<<24)|(SMS_VDP_VRAM(count+1)<<16)|(SMS_VDP_VRAM(count+2)<<8)|(SMS_VDP_VRAM(count+3)<<0);
1086
1087            for (xx=0;xx<8;xx++)
1088            {
1089               int drawxpos = x*8+xx;
1090
1091               UINT8 pixel = (( (gfxdata>>(0+xx)  ) &0x00000001)<<3)|
1092                             (( (gfxdata>>(8+xx)  ) &0x00000001)<<2)|
1093                             (( (gfxdata>>(16+xx) ) &0x00000001)<<1)|
1094                             (( (gfxdata>>(24+xx) ) &0x00000001)<<0);
1095
1096               lineptr[drawxpos] = chip->cram_mamecolours[pixel+16];
1097
1098            }
1099
1100
1101            count+=4;count&=0x3fff;
1102         }
1103      }
1104   }
1105}
1106#endif
1107
1108/*
1109 Register $00 - Mode Control No. 1
1110
1111 D7 - 1= Disable vertical scrolling for columns 24-31
1112 D6 - 1= Disable horizontal scrolling for rows 0-1
1113 D5 - 1= Mask column 0 with overscan color from register #7
1114 D4 - (IE1) 1= Line interrupt enable
1115 D3 - (EC) 1= Shift sprites left by 8 pixels
1116 D2 - (M4) 1= Use Mode 4, 0= Use TMS9918 modes (selected with M1, M2, M3)
1117 D1 - (M2) Must be 1 for M1/M3 to change screen height in Mode 4.
1118      Otherwise has no effect.
1119 D0 - 1= No sync, display is monochrome, 0= Normal display
1120
1121 Bits 0 and 5 have no effect on the GameGear in either mode, while bit 6
1122 has no effect in GG mode but works normally in SMS mode.
1123 */
1124
1125 /*
1126  Register $01 - Mode Control No. 2
1127
1128  D7 - No effect
1129  D6 - (BLK) 1= Display visible, 0= display blanked.
1130  D5 - (IE0) 1= Frame interrupt enable.
1131  D4 - (M1) Selects 224-line screen for Mode 4 if M2=1, else has no effect.
1132  D3 - (M3) Selects 240-line screen for Mode 4 if M2=1, else has no effect.
1133  D2 - No effect
1134  D1 - Sprites are 1=16x16,0=8x8 (TMS9918), Sprites are 1=8x16,0=8x8 (Mode 4)
1135  D0 - Sprite pixels are doubled in size.
1136
1137 Even though some games set bit 7, it does nothing.
1138 */
1139
1140static void end_of_frame(running_machine *machine, struct sms_vdp *chip)
1141{
1142   UINT8 m1 = (chip->regs[0x1]&0x10)>>4;
1143   UINT8 m2 = (chip->regs[0x0]&0x02)>>1;
1144   UINT8 m3 = (chip->regs[0x1]&0x08)>>3;
1145   UINT8 m4 = (chip->regs[0x0]&0x04)>>2;
1146   UINT8 m5 = chip->is_pal;
1147   chip->screen_mode = m1|(m2<<1)|(m3<<2)|(m4<<3)|(m5<<4);
1148
1149   if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */
1150   {
1151      rectangle visarea;
1152
1153      visarea.min_x = 0;
1154      visarea.max_x = 256-1;
1155      visarea.min_y = 0;
1156      visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1;
1157
1158      if (chip->chip_id==3) video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
1159
1160   }
1161   else /* 160x144 */
1162   {
1163      rectangle visarea;
1164      visarea.min_x = (256-160)/2;
1165      visarea.max_x = (256-160)/2+160-1;
1166      visarea.min_y = (192-144)/2;
1167      visarea.max_y = (192-144)/2+144-1;
1168
1169      video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
1170   }
1171
1172
1173
1174//  printf("Mode: %s is ok\n", sms_mode_table[chip->screen_mode].sms2_name);
1175
1176   chip->sms_scanline_counter = -1;
1177   chip->yscroll = chip->regs[0x9]; // this can't change mid-frame
1178   timer_adjust_oneshot(chip->sms_scanline_timer, attotime_zero, 0);
1179}
1180
1181
1182VIDEO_EOF(sms)
1183{
1184   end_of_frame(machine, md_sms_vdp);
1185
1186   // the SMS has a 'RESET' button on the machine, it generates an NMI
1187   if (input_port_read_safe(machine,"PAUSE",0x00))
1188      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
1189
1190}
1191
1192
1193VIDEO_START(sms)
1194{
1195
1196}
1197
1198
1199MACHINE_RESET(sms)
1200{
1201   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_zero, 0);
1202}
1203
1204
1205
1206UINT8* vdp2_vram_bank0;
1207UINT8* vdp2_vram_bank1;
1208
1209UINT8* vdp1_vram_bank0;
1210UINT8* vdp1_vram_bank1;
1211
1212void segae_set_vram_banks(UINT8 data)
1213{
1214   if (data&0x80)
1215   {
1216      vdp1->vram = vdp1_vram_bank1;
1217   }
1218   else
1219   {
1220      vdp1->vram = vdp1_vram_bank0;
1221   }
1222
1223   if (data&0x40)
1224   {
1225      vdp2->vram = vdp2_vram_bank1;
1226   }
1227   else
1228   {
1229      vdp2->vram = vdp2_vram_bank0;
1230   }
1231
1232
1233}
1234
1235MACHINE_RESET(systeme)
1236{
1237   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0);
1238   timer_adjust_oneshot(vdp2->sms_scanline_timer, attotime_zero, 0);
1239}
1240
1241MACHINE_RESET(megatech_md_sms)
1242{
1243   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_zero, 0);
1244}
1245
1246MACHINE_RESET(megatech_bios)
1247{
1248   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0);
1249}
1250
1251VIDEO_EOF(systeme)
1252{
1253   end_of_frame(machine, vdp1);
1254   end_of_frame(machine, vdp2);
1255}
1256
1257
1258VIDEO_EOF(megatech_md_sms)
1259{
1260   end_of_frame(machine, md_sms_vdp);
1261}
1262
1263VIDEO_EOF(megatech_bios)
1264{
1265   end_of_frame(machine, vdp1);
1266}
1267
1268VIDEO_UPDATE(megatech_md_sms)
1269{
1270   int x,y;
1271
1272   for (y=0;y<224;y++)
1273   {
1274      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
1275      UINT16* srcptr =  BITMAP_ADDR16(md_sms_vdp->r_bitmap, y, 0);
1276
1277      for (x=0;x<256;x++)
1278      {
1279         lineptr[x]=srcptr[x]&0x7fff;
1280      }
1281   }
1282
1283   return 0;
1284}
1285
1286
1287VIDEO_UPDATE(megatech_bios)
1288{
1289   int x,y;
1290
1291   for (y=0;y<224;y++)
1292   {
1293      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
1294      UINT16* srcptr =  BITMAP_ADDR16(vdp1->r_bitmap, y, 0);
1295
1296      for (x=0;x<256;x++)
1297      {
1298         lineptr[x]=srcptr[x]&0x7fff;
1299      }
1300   }
1301
1302   return 0;
1303}
1304
1305VIDEO_UPDATE(megaplay_bios)
1306{
1307   int x,y;
1308
1309   for (y=0;y<224;y++)
1310   {
1311      UINT16* lineptr = BITMAP_ADDR16(bitmap, y+16, 32);
1312      UINT16* srcptr =  BITMAP_ADDR16(vdp1->r_bitmap, y, 0);
1313
1314      for (x=0;x<256;x++)
1315      {
1316         UINT16 src = srcptr[x]&0x7fff;
1317
1318         if (src)
1319            lineptr[x]=srcptr[x]&0x7fff;
1320      }
1321   }
1322
1323   return 0;
1324}
1325
1326VIDEO_UPDATE(systeme)
1327{
1328//  show_tiles();
1329   int x,y;
1330
1331   for (y=0;y<192;y++)
1332   {
1333      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
1334      UINT16* srcptr =  BITMAP_ADDR16(vdp1->r_bitmap, y, 0);
1335
1336      for (x=0;x<256;x++)
1337      {
1338         lineptr[x]=srcptr[x]&0x7fff;
1339      }
1340
1341   }
1342
1343   for (y=0;y<192;y++)
1344   {
1345      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
1346      UINT16* srcptr =  BITMAP_ADDR16(vdp2->r_bitmap, y, 0);
1347
1348      for (x=0;x<256;x++)
1349      {
1350         if(!(srcptr[x]&0x8000)) lineptr[x]=srcptr[x]&0x7fff;
1351      }
1352   }
1353
1354
1355   return 0;
1356}
1357
1358
1359
1360
1361READ8_HANDLER( sms_vdp_2_data_r )
1362{
1363   return vdp_data_r(vdp2);
1364}
1365
1366WRITE8_HANDLER( sms_vdp_2_data_w )
1367{
1368   vdp_data_w(space, data, vdp2);
1369}
1370
1371READ8_HANDLER( sms_vdp_2_ctrl_r )
1372{
1373   return vdp_ctrl_r(space, vdp2);
1374}
1375
1376WRITE8_HANDLER( sms_vdp_2_ctrl_w )
1377{
1378   vdp_ctrl_w(space, data, vdp2);
1379}
1380
1381
1382void init_for_megadrive(running_machine *machine)
1383{
1384   md_sms_vdp = (struct sms_vdp *)start_vdp(machine, GEN_VDP);
1385   md_sms_vdp->set_irq = sms_vdp_cpu1_irq_callback;
1386   md_sms_vdp->is_pal = 0;
1387   md_sms_vdp->sms_total_scanlines = 262;
1388   md_sms_vdp->sms_framerate = 60;
1389   md_sms_vdp->chip_id = 3;
1390}
1391
1392
1393
1394DRIVER_INIT( megatech_bios )
1395{
1396   vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
1397   vdp1->set_irq = sms_vdp_cpu2_irq_callback;
1398   vdp1->is_pal = 0;
1399   vdp1->sms_total_scanlines = 262;
1400   vdp1->sms_framerate = 60;
1401   vdp1->chip_id = 1;
1402
1403   vdp1_vram_bank0 = vdp1->vram;
1404   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
1405
1406   smsgg_backupram = 0;
1407}
1408
1409DRIVER_INIT( smscm )
1410{
1411   megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_CODEMASTERS);
1412
1413   md_sms_vdp = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
1414   md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback;
1415   md_sms_vdp->is_pal = 1;
1416   md_sms_vdp->sms_total_scanlines = 313;
1417   md_sms_vdp->sms_framerate = 50;
1418   md_sms_vdp->chip_id = 3;
1419
1420   vdp1_vram_bank0 = md_sms_vdp->vram;
1421   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
1422
1423   smsgg_backupram = 0;
1424}
1425
1426DRIVER_INIT( smspal )
1427{
1428   megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_STANDARD);
1429
1430   md_sms_vdp = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
1431   md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback;
1432   md_sms_vdp->is_pal = 1;
1433   md_sms_vdp->sms_total_scanlines = 313;
1434   md_sms_vdp->sms_framerate = 50;
1435   md_sms_vdp->chip_id = 3;
1436
1437   vdp1_vram_bank0 = md_sms_vdp->vram;
1438   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
1439
1440   smsgg_backupram = 0;
1441}
1442
1443DRIVER_INIT( sms )
1444{
1445   megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_STANDARD);
1446
1447   md_sms_vdp = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
1448   md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback;
1449   md_sms_vdp->is_pal = 0;
1450   md_sms_vdp->sms_total_scanlines = 262;
1451   md_sms_vdp->sms_framerate = 60;
1452   md_sms_vdp->chip_id = 3;
1453
1454   vdp1_vram_bank0 = md_sms_vdp->vram;
1455   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
1456
1457   smsgg_backupram = 0;
1458}
1459
1460static UINT8 ioport_gg00_r(running_machine* machine)
1461{
1462   UINT8 GG_START_BUTTON = input_port_read_safe(machine,"GGSTART",0x00);
1463
1464   return (GG_START_BUTTON << 7) |
1465         (0               << 6) |
1466         (0               << 5) |
1467         (0               << 4) |
1468         (0               << 3) |
1469         (0               << 2) |
1470         (0               << 1) |
1471         (0               << 0);
1472}
1473
1474
1475READ8_HANDLER( sms_ioport_gg00_r )
1476{
1477   return ioport_gg00_r(space->machine);
1478}
1479
1480
1481void init_extra_gg_ports(running_machine* machine, const char* tag)
1482{
1483   const address_space *io = cputag_get_address_space(machine, tag, ADDRESS_SPACE_IO);
1484   memory_install_read8_handler     (io, 0x00, 0x00, 0, 0, sms_ioport_gg00_r);
1485}
1486
1487DRIVER_INIT( smsgg )
1488{
1489   megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_STANDARD);
1490   init_extra_gg_ports(machine, "maincpu");
1491
1492   md_sms_vdp = (struct sms_vdp *)start_vdp(machine, GG_VDP);
1493   md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback;
1494   md_sms_vdp->is_pal = 0;
1495   md_sms_vdp->sms_total_scanlines = 262;
1496   md_sms_vdp->sms_framerate = 60;
1497   md_sms_vdp->chip_id = 3;
1498
1499   smsgg_backupram = 0;
1500}
1501
1502
1503DRIVER_INIT( hazemd_segasyse )
1504{
1505   vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
1506//  vdp1->set_irq = sms_vdp_cpu0_irq_callback;
1507   vdp1->is_pal = 0;
1508   vdp1->sms_total_scanlines = 262;
1509   vdp1->sms_framerate = 60;
1510   vdp1->chip_id = 1;
1511
1512   vdp1_vram_bank0 = vdp1->vram;
1513   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
1514
1515
1516   vdp2 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
1517   vdp2->set_irq = sms_vdp_cpu0_irq_callback;
1518   vdp2->is_pal = 0;
1519   vdp2->sms_total_scanlines = 262;
1520   vdp2->sms_framerate = 60;
1521   vdp2->chip_id = 2;
1522
1523   vdp2_vram_bank0 = vdp2->vram;
1524   vdp2_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
1525}
1526
1527/* Functions to set up the Memory Map
1528
1529 -- these are needed because on a Genesis the Sound Z80 becomes the SMS Z80 in comptibility mode
1530    so we need to be able to dynamically change the mapping
1531
1532*/
1533
1534static READ8_HANDLER( z80_unmapped_port_r )
1535{
1536//  printf("unmapped z80 port read %04x\n",offset);
1537   return 0;
1538}
1539
1540static WRITE8_HANDLER( z80_unmapped_port_w )
1541{
1542//  printf("unmapped z80 port write %04x\n",offset);
1543}
1544
1545static READ8_HANDLER( z80_unmapped_r )
1546{
1547   printf("unmapped z80 read %04x\n",offset);
1548   return 0;
1549}
1550
1551static WRITE8_HANDLER( z80_unmapped_w )
1552{
1553   printf("unmapped z80 write %04x\n",offset);
1554}
1555
1556static UINT8* sms_rom;
1557
1558
1559/* the SMS inputs should be more complex, like the megadrive ones */
1560READ8_HANDLER (megatech_sms_ioport_dc_r)
1561{
1562   running_machine *machine = space->machine;
1563   /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */
1564   /* bit 4: TL-A; bit 5: TR-A */
1565   return (input_port_read(machine, "PAD1") & 0x3f) | ((input_port_read(machine, "PAD2") & 0x03) << 6);
1566}
1567
1568READ8_HANDLER (megatech_sms_ioport_dd_r)
1569{
1570   running_machine *machine = space->machine;
1571   /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */
1572   /* bit 2: TL-B; bit 3: TR-B; bit 4: RESET; bit 5: unused; bit 6: TH-A; bit 7: TH-B*/
1573   return ((input_port_read(machine, "PAD2") & 0x3c) >> 2) | 0x10;
1574}
1575
1576
1577READ8_HANDLER( smsgg_backupram_r )
1578{
1579   return smsgg_backupram[offset];
1580}
1581
1582WRITE8_HANDLER( smsgg_backupram_w )
1583{
1584   smsgg_backupram[offset] = data;
1585}
1586
1587
1588static WRITE8_HANDLER( mt_sms_standard_rom_bank_w )
1589{
1590   int bank = data&0x1f;
1591   //logerror("bank w %02x %02x\n", offset, data);
1592
1593   sms_mainram[0x1ffc+offset] = data;
1594   switch (offset)
1595   {
1596      case 0:
1597         logerror("bank w %02x %02x\n", offset, data);
1598         if ((data & 0x08) && smsgg_backupram)
1599         {
1600            memory_install_readwrite8_handler(space, 0x8000, 0x9fff, 0, 0, smsgg_backupram_r, smsgg_backupram_w);
1601         }
1602         else
1603         {
1604            memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP);
1605         }
1606
1607         //printf("bank ram??\n");
1608         break;
1609      case 1:
1610         memcpy(sms_rom+0x0000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000);
1611         break;
1612      case 2:
1613         memcpy(sms_rom+0x4000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000);
1614         break;
1615      case 3:
1616         memcpy(sms_rom+0x8000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000);
1617         break;
1618
1619   }
1620}
1621
1622static WRITE8_HANDLER( codemasters_rom_bank_0000_w )
1623{
1624   int bank = data&0x1f;
1625   memcpy(sms_rom+0x0000, memory_region(space->machine,"maincpu")+bank*0x4000, 0x4000);
1626}
1627
1628static WRITE8_HANDLER( codemasters_rom_bank_4000_w )
1629{
1630   int bank = data&0x1f;
1631   memcpy(sms_rom+0x4000, memory_region(space->machine,"maincpu")+bank*0x4000, 0x4000);
1632}
1633
1634static WRITE8_HANDLER( codemasters_rom_bank_8000_w )
1635{
1636   int bank = data&0x1f;
1637   memcpy(sms_rom+0x8000, memory_region(space->machine,"maincpu")+bank*0x4000, 0x4000);
1638}
1639
1640
1641static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine, const char* tag)
1642{
1643   /* INIT THE PORTS *********************************************************************************************/
1644
1645   const address_space *io = cputag_get_address_space(machine, tag, ADDRESS_SPACE_IO);
1646   const device_config *sn = devtag_get_device(machine, "sn");
1647
1648   memory_install_readwrite8_handler(io, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
1649
1650   memory_install_read8_handler     (io, 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r);
1651   memory_install_write8_device_handler(io, sn, 0x7e, 0x7f, 0, 0, sn76496_w);
1652   memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w);
1653   memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w);
1654
1655   memory_install_read8_handler     (io, 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris
1656
1657   memory_install_read8_handler     (io, 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r);
1658   memory_install_read8_handler     (io, 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r);
1659   memory_install_read8_handler     (io, 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r);
1660   memory_install_read8_handler     (io, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family
1661}
1662
1663void megatech_set_genz80_as_sms_standard_map(running_machine *machine, const char* tag, int mapper)
1664{
1665   /* INIT THE MEMMAP / BANKING *********************************************************************************/
1666
1667   /* catch any addresses that don't get mapped */
1668   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
1669
1670   /* main ram area */
1671   sms_mainram = auto_alloc_array(machine, UINT8, 0x2000); // 8kb of main ram
1672   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6));
1673   memory_set_bankptr(machine,  6, sms_mainram );
1674   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7));
1675   memory_set_bankptr(machine,  7, sms_mainram );
1676   memset(sms_mainram,0x00,0x2000);
1677
1678   megatech_set_genz80_as_sms_standard_ports(machine,  tag);
1679
1680   if (mapper == MAPPER_STANDARD )
1681   {
1682      /* fixed rom bank area */
1683      sms_rom = auto_alloc_array(machine, UINT8, 0x400000);
1684      memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP);
1685      memory_set_bankptr(machine,  5, sms_rom );
1686
1687      memcpy(sms_rom, memory_region(machine, "maincpu"), 0x400000);
1688
1689
1690      memory_install_write8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w);
1691
1692   }
1693   else if (mapper == MAPPER_CODEMASTERS )
1694   {
1695      /* fixed rom bank area */
1696      sms_rom = auto_alloc_array(machine, UINT8, 0xc000);
1697      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP);
1698      memory_set_bankptr(machine,  5, sms_rom );
1699
1700      memcpy(sms_rom, memory_region(machine, "maincpu"), 0xc000);
1701
1702      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x0000, 0, 0, codemasters_rom_bank_0000_w);
1703      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x4000, 0, 0, codemasters_rom_bank_4000_w);
1704      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, codemasters_rom_bank_8000_w);
1705   }
1706//  smsgg_backupram = NULL;
1707}
1708
1709static NVRAM_HANDLER( sms )
1710{
1711   if (smsgg_backupram!=NULL)
1712   {
1713      if (read_or_write)
1714         mame_fwrite(file, smsgg_backupram, 0x2000);
1715      else
1716      {
1717         if (file)
1718         {
1719            mame_fread(file, smsgg_backupram, 0x2000);
1720         }
1721      }
1722   }
1723}
1724
1725MACHINE_DRIVER_START( sms )
1726   MDRV_CPU_ADD("maincpu", Z80, 3579540)
1727   //MDRV_CPU_PROGRAM_MAP(sms_map)
1728   MDRV_CPU_IO_MAP(sms_io_map)
1729
1730   /* IRQ handled via the timers */
1731   MDRV_MACHINE_RESET(sms)
1732
1733   MDRV_SCREEN_ADD("screen", RASTER)
1734   MDRV_SCREEN_REFRESH_RATE(60)
1735   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) // Vblank handled manually.
1736   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15)
1737   MDRV_SCREEN_SIZE(256, 256)
1738   MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 223)
1739//  MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 191)
1740
1741   MDRV_PALETTE_LENGTH(0x200)
1742
1743   MDRV_VIDEO_START(sms)
1744   MDRV_VIDEO_UPDATE(megatech_md_sms) /* Copies a bitmap */
1745   MDRV_VIDEO_EOF(sms) /* Used to Sync the timing */
1746
1747   MDRV_NVRAM_HANDLER( sms )
1748
1749   /* sound hardware */
1750   MDRV_SPEAKER_STANDARD_MONO("mono")
1751
1752   MDRV_SOUND_ADD("sn", SN76496, 3579540)
1753   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
1754MACHINE_DRIVER_END
1755
1756
src/mame/drivers/megaplay.c
r5955r5956
22
33  changelog:
44
5  01 Oct  2009 - Converted to use the HazeMD SMS code so that old code
6                 can be removed, however this makes the text transparent,
7                 which IIRC is incorrect
8
59  22 Sept 2007 - Started updating this to use the new Megadrive code,
610                 fixing issues with Mazin Wars + Grand Slam.
711                 However I'm still not convinced that the handling of
r5955r5956
3741
3842Only a handful of games were released for this system.
3943
44Bugs:
45 Most of this is guesswork and should be verified on real hw.  Sometims after inserting
46 a coin and pressing start the 'press start' message remains on screen and no credit is
47 deducted.  (timing?)
48
49
4050*/
4151
4252#include "driver.h"
r5955r5956
4656#include "deprecat.h"
4757#include "genesis.h"
4858#include "megadriv.h"
59#include "segamsys.h"
4960
5061#define MASTER_CLOCK      53693100
5162
r5955r5956
5667static UINT32 bios_bank; // ROM bank selection
5768static UINT16 game_banksel;  // Game bank selection
5869static UINT32 bios_mode = MP_ROM;  // determines whether ROM banks or Game data
59                                  // is to read from 0x8000-0xffff
70                           // is to read from 0x8000-0xffff
71static UINT32 mp_bios_bank_addr;
72
6073static UINT32 bios_width;  // determines the way the game info ROM is read
6174UINT8 bios_ctrl[6];
6275static UINT8 bios_6600;
r5955r5956
7184//static UINT8 ic36_ram[0x4000];
7285
7386
74static UINT8 hintcount;         /* line interrupt counter, decreased each scanline */
87//static UINT8 hintcount;           /* line interrupt counter, decreased each scanline */
7588extern UINT8 segae_vintpending;
7689extern UINT8 segae_hintpending;
7790extern UINT8 *segae_vdp_regs[];      /* pointer to vdp's registers */
7891
7992// Interrupt handler - from drivers/segasyse.c
93#if 0
8094static INTERRUPT_GEN (megaplay_bios_irq)
8195{
8296   int sline;
r5955r5956
116130   }
117131
118132}
133#endif
119134
120
121135static UINT32 readpos = 1;  // serial bank selection position (9-bit)
122136
123137static INPUT_PORTS_START ( megaplay )
r5955r5956
564578
565579static READ8_HANDLER( bank_r )
566580{
567   UINT8* bank = memory_region(space->machine, "mpbios");
568   UINT8* game = memory_region(space->machine, "maincpu");
581   UINT32 fulladdress;
582   UINT8* bank = memory_region(space->machine, "mtbios");
569583
570   if(game_banksel == 0x142) // Genesis I/O
571      return OLD_megaplay_genesis_io_r(space, (offset & 0x1f) / 2, 0xffff);
584   fulladdress = mp_bios_bank_addr + offset;
572585
573   if(bios_mode & MP_ROM)
586
587   if ((fulladdress >= 0x000000) && (fulladdress <= 0x3fffff)) // ROM Addresses
574588   {
575      int sel = (bios_bank >> 6) & 0x03;
589      if(bios_mode & MP_ROM)
590      {
591         int sel = (bios_bank >> 6) & 0x03;
576592
577//      popmessage("Reading from Bank %i",sel);
578
579      if(sel == 0)
580         return 0xff;
593         if(sel == 0)
594            return 0xff;
595         else
596            return bank[0x10000 + (sel-1)*0x8000 + offset];
597      }
598      else if(bios_width & 0x08)
599      {
600         if(offset >= 0x2000)
601            return ic36_ram[offset - 0x2000];
602         else
603            return ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset];
604      }
581605      else
582         return bank[0x10000 + (sel-1)*0x8000 + offset];
606      {
607         return memory_region(space->machine, "maincpu")[fulladdress^1];
608      }
583609   }
610   else if(fulladdress>=0xa10000 && fulladdress<=0xa1001f) // IO Acess
611   {
612      return OLD_megaplay_genesis_io_r(space, (offset & 0x1f) / 2, 0xffff);
613   }
584614   else
585615   {
586      if(game_banksel == 0x60 || game_banksel == 0x61)  /* read game info ROM */
587         if(bios_width & 0x08)
588         {
589            if(offset >= 0x2000)
590               return ic36_ram[offset - 0x2000];
591            else
592               return ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset];
593         }
594         else
595            return game[((game_banksel)*0x8000 + offset)];
596      else
597         return game[(game_banksel*0x8000 + (offset ^ 0x01))];
616      printf("bank_r fulladdress %08x\n",fulladdress);
617      return 0x00;
598618   }
619
599620}
600621
601622static WRITE8_HANDLER ( bank_w )
602623{
603   if(game_banksel == 0x142) // Genesis I/O
604      OLD_megaplay_genesis_io_w(space, (offset & 0x1f) / 2, data, 0xffff);
624   UINT32 fulladdress;
625   fulladdress = mp_bios_bank_addr + offset;
605626
606   if(offset <= 0x1fff && (bios_width & 0x08))
607      ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset] = data;
627   if ((fulladdress >= 0x000000) && (fulladdress <= 0x3fffff)) // ROM / Megaplay Custom Addresses
628   {
629      if(offset <= 0x1fff && (bios_width & 0x08))
630      {
631         ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset] = data;
632      }
608633
609   if(offset >= 0x2000 && (bios_width & 0x08))
610//      ic36_ram[offset] = data;
611      ic36_ram[offset - 0x2000] = data;
634      if(offset >= 0x2000 && (bios_width & 0x08))
635      {
636   //      ic36_ram[offset] = data;
637         ic36_ram[offset - 0x2000] = data;
638      }
639   }
640   else if(fulladdress>=0xa10000 && fulladdress<=0xa1001f) // IO Access
641   {
642      OLD_megaplay_genesis_io_w(space, (offset & 0x1f) / 2, data, 0xffff);
643   }
644   else
645   {
646      printf("bank_w fulladdress %08x\n",fulladdress);
647   }
612648}
613649
614650
r5955r5956
686722//      popmessage("Game bank selected: 0x%03x",game_banksel);
687723      logerror("BIOS [0x%04x]: 68K address space bank selected: 0x%03x\n",cpu_get_previouspc(space->cpu),game_banksel);
688724   }
725
726   mp_bios_bank_addr = ( ( mp_bios_bank_addr >> 1 ) | ( data << 23 ) ) & 0xff8000;
727
728
689729}
690730
691731static ADDRESS_MAP_START( megaplay_bios_map, ADDRESS_SPACE_PROGRAM, 8 )
r5955r5956
714754void segae_vdp_ctrl_w ( UINT8 chip, UINT8 data );
715755void segae_vdp_data_w ( running_machine *machine, UINT8 chip, UINT8 data );
716756
757#if 0
717758static READ8_HANDLER (megaplay_bios_port_be_bf_r)
718759{
719760   UINT8 temp = 0;
r5955r5956
738779         segae_vdp_ctrl_w(0, data); break;
739780   }
740781}
782#endif
741783
742
743784static ADDRESS_MAP_START( megaplay_bios_io_map, ADDRESS_SPACE_IO, 8 )
744785   ADDRESS_MAP_GLOBAL_MASK(0xff)
745//  AM_RANGE(0x3f, 0x3f) AM_WRITE(megatech_bios_port_ctrl_w)
746786   AM_RANGE(0x7f, 0x7f) AM_DEVWRITE("sn2", sn76496_w)   /* SN76489 */
747//  AM_RANGE(0xdc, 0xdc) AM_READ(megatech_bios_port_dc_r)  // player inputs
748//  AM_RANGE(0xdd, 0xdd) AM_READ(megatech_bios_port_dd_r)  // other player 2 inputs
749   AM_RANGE(0xbe, 0xbf) AM_READWRITE(megaplay_bios_port_be_bf_r, megaplay_bios_port_be_bf_w)   /* VDP */
787   AM_RANGE(0xbe, 0xbe) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w)   /* VDP */
788   AM_RANGE(0xbf, 0xbf) AM_READWRITE(sms_vdp_ctrl_r, sms_vdp_ctrl_w)   /* VDP */
750789ADDRESS_MAP_END
751790
752/* in video/segasyse.c */
753VIDEO_START( megaplay_normal );
754VIDEO_UPDATE( megaplay_normal );
755791
792
793
756794static VIDEO_START(megplay)
757795{
758796   //printf("megplay vs\n");
759797   VIDEO_START_CALL(megadriv);
760   VIDEO_START_CALL(megaplay_normal);
798//  VIDEO_START_CALL(megaplay_normal);
761799}
762800
763801static VIDEO_UPDATE(megplay)
764802{
765803   //printf("megplay vu\n");
766804   VIDEO_UPDATE_CALL(megadriv);
767   VIDEO_UPDATE_CALL(megaplay_normal);
805//  VIDEO_UPDATE_CALL(megaplay_normal);
806   VIDEO_UPDATE_CALL(megaplay_bios);
768807   return 0;
769808}
770809
771810
772811//extern VIDEO_EOF(megadriv);
812static MACHINE_RESET( mpnew )
813{
814   mp_bios_bank_addr = 0;
815   MACHINE_RESET_CALL(megadriv);
816   MACHINE_RESET_CALL(megatech_bios);
817}
773818
819static VIDEO_EOF( mpnew )
820{
821   VIDEO_EOF_CALL(megadriv);
822   VIDEO_EOF_CALL(megatech_bios);
823}
824
774825static MACHINE_DRIVER_START( mpnew )
775826
776827   /* basic machine hardware */
r5955r5956
778829
779830   /* The Megaplay has an extra BIOS cpu which drives an SMS VDP
780831       which includes an SN76496 for sound */
781   MDRV_CPU_ADD("mpbios", Z80, MASTER_CLOCK / 15) /* ?? */
832   MDRV_CPU_ADD("mtbios", Z80, MASTER_CLOCK / 15) /* ?? */
782833   MDRV_CPU_PROGRAM_MAP(megaplay_bios_map)
783834   MDRV_CPU_IO_MAP(megaplay_bios_io_map)
784   MDRV_CPU_VBLANK_INT_HACK(megaplay_bios_irq, 262)
835   //MDRV_CPU_VBLANK_INT_HACK(megaplay_bios_irq, 262)
785836
837   MDRV_MACHINE_RESET( mpnew )
838   MDRV_VIDEO_EOF( mpnew )
839
786840   MDRV_QUANTUM_TIME(HZ(6000))
787841
788842   MDRV_SOUND_ADD("sn2", SN76496, MASTER_CLOCK/15)
r5955r5956
811865
812866   ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF )
813867
814   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
868   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
815869   MEGAPLAY_BIOS
816870ROM_END
817871
872/* The system appears to access the instruction rom at
873    0x300000 in the 68k space (rom window from z80 side)
874
875   This probably means the maximum 68k rom size is 0x2fffff for MegaPlay
876*/
877
818878ROM_START( mp_sonic ) /* Sonic */
819879   ROM_REGION( 0x400000, "maincpu", 0 )
820880   ROM_LOAD16_BYTE( "ep15177.ic2", 0x000000, 0x040000, CRC(a389b03b) SHA1(8e9e1cf3dd65ddf08757f5a1ce472130c902ea2c) )
r5955r5956
824884   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
825885   ROM_LOAD( "ep15175-01.ic3", 0x000000, 0x08000, CRC(99246889) SHA1(184aa3b7fdedcf578c5e34edb7ed44f57f832258) )
826886
827   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
887   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
828888   MEGAPLAY_BIOS
829889ROM_END
830890
r5955r5956
840900   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
841901   ROM_LOAD( "1.ic3", 0x000000, 0x08000,  CRC(dac9bf91) SHA1(0117972a7181f8aaf942a259cc8764b821031253) )
842902
843   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
903   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
844904   MEGAPLAY_BIOS
845905ROM_END
846906
r5955r5956
853913   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
854914   ROM_LOAD( "ep15175-02b.ic3", 0x000000, 0x08000, CRC(3039b653) SHA1(b19874c74d0fc0cca1169f62e5e74f0e8ca83679) ) // 15175-02b.ic3
855915
856   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
916   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
857917   MEGAPLAY_BIOS
858918ROM_END
859919
r5955r5956
866926   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
867927   ROM_LOAD( "epr-15175-03.ic3", 0x000000, 0x08000, CRC(70ea1aec) SHA1(0d9d82a1f8aa51d02707f7b343e7cfb6591efccd) ) // 15175-02b.ic3
868928
869   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
929   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
870930   MEGAPLAY_BIOS
871931ROM_END
872932
r5955r5956
880940    ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
881941   ROM_LOAD( "ep15175-04.ic3", 0x000000, 0x08000, CRC(faf7c030) SHA1(16ef405335b4d3ecb0b7d97b088dafc4278d4726) )
882942
883    ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
943    ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
884944    MEGAPLAY_BIOS
885945ROM_END
886946
r5955r5956
892952   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
893953   ROM_LOAD( "epr-15175-05.ic2", 0x000000, 0x08000, CRC(1df5347c) SHA1(faced2e875e1914392f61577b5256d006eebeef9) )
894954
895   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
955   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
896956   MEGAPLAY_BIOS
897957ROM_END
898958
r5955r5956
904964   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
905965   ROM_LOAD( "epr-15175-06.ic2", 0x000000, 0x08000, CRC(1ef64e41) SHA1(13984b714b014ea41963b70de74a5358ed223bc5) )
906966
907   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
967   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
908968   MEGAPLAY_BIOS
909969ROM_END
910970
r5955r5956
916976   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
917977   ROM_LOAD( "epr-15175-07.ic1", 0x000000, 0x08000, CRC(bb5f67f0) SHA1(33b7a5d14015a5fcf41976a8f648f8f48ce9bb03) )
918978
919   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
979   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
920980   MEGAPLAY_BIOS
921981ROM_END
922982
r5955r5956
928988   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
929989   ROM_LOAD( "epr-15175-11.ic2", 0x000000, 0x08000, CRC(bb651120) SHA1(81cb736f2732373e260dde162249c1d29a3489c3) )
930990
931   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
991   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
932992   MEGAPLAY_BIOS
933993ROM_END
934994
r5955r5956
9401000   ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */
9411001   ROM_LOAD( "epr-15175-09.ic2", 0x000000, 0x08000, CRC(6254e45a) SHA1(8667922a6eade03c964ce224f7fa39ba871c60a4) )
9421002
943   ROM_REGION( 0x28000, "mpbios", 0 ) /* Bios */
1003   ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */
9441004   MEGAPLAY_BIOS
9451005ROM_END
9461006
9471007
9481008static void megplay_stat(running_machine *machine)
9491009{
950   UINT8 *src = memory_region(machine, "mpbios");
1010   UINT8 *src = memory_region(machine, "mtbios");
9511011   UINT8 *instruction_rom = memory_region(machine, "user1");
9521012   UINT8 *game_rom = memory_region(machine, "maincpu");
9531013   int offs;
r5955r5956
10101070
10111071   /* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */
10121072   memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa02000, 0xa03fff, 0, 0, megadriv_68k_read_z80_extra_ram, megadriv_68k_write_z80_extra_ram);
1073
1074   DRIVER_INIT_CALL(megatech_bios); // create the SMS vdp etc.
1075
10131076}
10141077
10151078/*
src/mame/drivers/segamsys.h
r0r5956
1/* System E stuff */
2
3enum sms_mapper
4{
5   MAPPER_STANDARD = 0,
6   MAPPER_CODEMASTERS = 1
7};
8
9
10extern VIDEO_UPDATE(megatech_bios);
11extern VIDEO_UPDATE(megaplay_bios);
12extern VIDEO_UPDATE(megatech_md_sms);
13extern DRIVER_INIT( megatech_bios );
14extern DRIVER_INIT( hazemd_segasyse );
15extern MACHINE_RESET(megatech_bios);
16extern MACHINE_RESET(megatech_md_sms);
17extern VIDEO_EOF(megatech_bios);
18extern VIDEO_EOF(megatech_md_sms);
19
20extern READ8_HANDLER( sms_vcounter_r );
21extern READ8_HANDLER( sms_vdp_data_r );
22extern WRITE8_HANDLER( sms_vdp_data_w );
23extern READ8_HANDLER( sms_vdp_ctrl_r );
24extern WRITE8_HANDLER( sms_vdp_ctrl_w );
25
26extern void init_for_megadrive(running_machine *machine);
27extern void segae_md_sms_stop_scanline_timer(void);
28
29
30extern READ8_HANDLER( md_sms_vdp_vcounter_r );
31extern READ8_HANDLER( md_sms_vdp_data_r );
32extern WRITE8_HANDLER( md_sms_vdp_data_w );
33extern READ8_HANDLER( md_sms_vdp_ctrl_r );
34extern WRITE8_HANDLER( md_sms_vdp_ctrl_w );
35
36extern VIDEO_START(sms);
37extern READ8_HANDLER( sms_vdp_2_data_r );
38extern WRITE8_HANDLER( sms_vdp_2_data_w );
39extern READ8_HANDLER( sms_vdp_2_ctrl_r );
40extern WRITE8_HANDLER( sms_vdp_2_ctrl_w );
41extern VIDEO_EOF(systeme);
42extern VIDEO_UPDATE(systeme);
43extern MACHINE_RESET(systeme);
44extern UINT8* sms_mainram;
45extern UINT8* vdp2_vram_bank0;
46extern UINT8* vdp2_vram_bank1;
47extern UINT8* vdp1_vram_bank0;
48extern UINT8* vdp1_vram_bank1;
49extern void segae_set_vram_banks(UINT8 data);
50extern void megatech_set_genz80_as_sms_standard_map(running_machine *machine, const char* tag, int mapper);
51MACHINE_DRIVER_EXTERN(sms);
52extern DRIVER_INIT(sms);
53extern DRIVER_INIT(smspal);
54extern DRIVER_INIT(smscm);
55extern DRIVER_INIT( smsgg );
56
57INPUT_PORTS_EXTERN(sms);
58INPUT_PORTS_EXTERN(gamegear);
59extern UINT8* smsgg_backupram;
60
61
62
63
64
src/mame/drivers/segae.c
r5955r5956
1/* Sega System E */
2
13/*
24
3Sega System E
4-- this is a modified version of the sms.c from HazeMD
5 it really needs some improvements
65
7
86 Sega System 'E' is a piece of hardware used for a couple of Arcade Games
97 produced by Sega in the Mid 80's, its roughly based on their Sega Master System
108 home console unit, using the same '315-5124' VDP (actually in this case 2 of
r5955r5956
285283
286284Known issues:
287285
288sometimes hangonjr has corrupt gfx when you start a game, I don't know why
286sometimes hangonjr has corrupt gfx when you start a game, I don't know why (timing?)
289287
290288todo:
291289
r5955r5956
300298#include "sound/sn76496.h"
301299#include "machine/mc8123.h"
302300#include "machine/segacrpt.h"
303#include "segae.h"
301#include "segamsys.h"
304302
303/****************************************************************************************
304 Memory Maps
305305
306//static UINT8* sms_rom;
307static UINT8* sms_mainram;
308//static UINT8* smsgg_backupram;
309static TIMER_CALLBACK( sms_scanline_timer_callback );
310static struct sms_vdp *vdp2;
311static struct sms_vdp *vdp1;
306 most of the memory map / IO maps are filled in at run time - this is due to the SMS
307 code that this is based on being designed that way due to weird features of the MD.
312308
313static struct sms_vdp *md_sms_vdp;
309****************************************************************************************/
314310
315/* All Accesses to VRAM go through here for safety */
316#define SMS_VDP_VRAM(address) chip->vram[(address)&0x3fff]
311static UINT8 f7_bank_value;
317312
318#ifdef UNUSED_FUNCTION
319static ADDRESS_MAP_START( sms_map, ADDRESS_SPACE_PROGRAM, 8 )
320//  AM_RANGE(0x0000 , 0xbfff) AM_ROM
321//  AM_RANGE(0xc000 , 0xdfff) AM_RAM AM_MIRROR(0x2000)
322ADDRESS_MAP_END
323#endif
324
325313/* we have to fill in the ROM addresses for systeme due to the encrypted games */
326314static ADDRESS_MAP_START( systeme_map, ADDRESS_SPACE_PROGRAM, 8 )
327315   AM_RANGE(0x0000, 0x7fff) AM_ROM                        /* Fixed ROM */
328316   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)                  /* Banked ROM */
329
330//  AM_RANGE(0x0000 , 0xbfff) AM_ROM
331//  AM_RANGE(0xc000 , 0xdfff) AM_RAM     AM_MIRROR(0x2000)
332317ADDRESS_MAP_END
333318
334static ADDRESS_MAP_START( sms_io_map, ADDRESS_SPACE_IO, 8 )
335   ADDRESS_MAP_GLOBAL_MASK(0xff)
336ADDRESS_MAP_END
337319
338/* Precalculated tables for H/V counters.  Note the position the counter 'jumps' is marked with with
339   an empty comment */
340static const UINT8 hc_256[] =
320static WRITE8_HANDLER( segasyse_videoram_w )
341321{
342    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,    0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
343    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,    0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
344    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,    0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
345    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,    0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
346    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,    0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
347    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,    0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
348    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,    0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
349    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,    0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
350    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,    0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
351    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,    0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
352    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,    0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
353    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,    0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
354    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,    0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
355    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
356    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,/**/0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
357    0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3,    0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
358    0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,    0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
359    0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3,    0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
360    0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,    0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
361    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,    0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
362    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,    0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
363    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
364};
365
366
367static const UINT8 vc_ntsc_192[] =
368{
369    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,    0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
370    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,    0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
371    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,    0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
372    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,    0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
373    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,    0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
374    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,    0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
375    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,    0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
376    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,    0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
377    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,    0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
378    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,    0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
379    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,    0xab, 0xac, 0xad, 0xae, 0xaf,
380    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,    0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
381    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,    0xcb, 0xcc, 0xcd, 0xce, 0xcf,
382    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,/**/0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
383    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4,    0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
384    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,    0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
385    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
386};
387
388static const UINT8 vc_ntsc_224[] =
389{
390    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,    0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
391    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,    0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
392    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,    0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
393    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,    0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
394    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,    0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
395    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,    0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
396    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,    0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
397    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,    0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
398    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,    0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
399    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,    0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
400    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,    0xab, 0xac, 0xad, 0xae, 0xaf,
401    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,    0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
402    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,    0xcb, 0xcc, 0xcd, 0xce, 0xcf,
403    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,    0xdb, 0xdc, 0xdd, 0xde, 0xdf,
404    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,/**/0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
405    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,    0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
406    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
407};
408
409static const UINT8 vc_ntsc_240[] =
410{
411    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
412    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
413    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
414    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
415    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
416    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
417    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
418    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
419    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
420    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
421    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
422    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
423    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
424    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
425    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
426    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
427    0x00, 0x01, 0x02, 0x03, 0x04, 0x05
428};
429
430
431
432static const UINT8 vc_pal_192[] =
433{
434    0x00, 0x01, 0x02,    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
435    0x10, 0x11, 0x12,    0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
436    0x20, 0x21, 0x22,    0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
437    0x30, 0x31, 0x32,    0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
438    0x40, 0x41, 0x42,    0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
439    0x50, 0x51, 0x52,    0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
440    0x60, 0x61, 0x62,    0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
441    0x70, 0x71, 0x72,    0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
442    0x80, 0x81, 0x82,    0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
443    0x90, 0x91, 0x92,    0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
444    0xa0, 0xa1, 0xa2,    0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
445    0xb0, 0xb1, 0xb2,    0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
446    0xc0, 0xc1, 0xc2,    0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
447    0xd0, 0xd1, 0xd2,    0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
448    0xe0, 0xe1, 0xe2,    0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
449    0xf0, 0xf1, 0xf2,/**/0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6,
450    0xc7, 0xc8, 0xc9,    0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
451    0xd7, 0xd8, 0xd9,    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
452    0xe7, 0xe8, 0xe9,    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
453    0xf7, 0xf8, 0xf9,    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
454};
455
456
457static const UINT8 vc_pal_224[] =
458{
459    0x00, 0x01, 0x02,    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
460    0x10, 0x11, 0x12,    0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
461    0x20, 0x21, 0x22,    0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
462    0x30, 0x31, 0x32,    0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
463    0x40, 0x41, 0x42,    0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
464    0x50, 0x51, 0x52,    0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
465    0x60, 0x61, 0x62,    0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
466    0x70, 0x71, 0x72,    0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
467    0x80, 0x81, 0x82,    0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
468    0x90, 0x91, 0x92,    0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
469    0xa0, 0xa1, 0xa2,    0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
470    0xb0, 0xb1, 0xb2,    0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
471    0xc0, 0xc1, 0xc2,    0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
472    0xd0, 0xd1, 0xd2,    0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
473    0xe0, 0xe1, 0xe2,    0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
474    0xf0, 0xf1, 0xf2,    0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
475    0x00, 0x01, 0x02,/**/0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
476    0xd7, 0xd8, 0xd9,    0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
477    0xe7, 0xe8, 0xe9,    0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
478    0xf7, 0xf8, 0xf9,    0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
479};
480
481static const UINT8 vc_pal_240[] =
482{
483    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,    0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
484    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,    0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
485    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,    0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
486    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,    0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
487    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,    0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
488    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,    0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
489    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,    0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
490    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,    0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
491    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,    0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
492    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,    0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
493    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,    0xab, 0xac, 0xad, 0xae, 0xaf,
494    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,    0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
495    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,    0xcb, 0xcc, 0xcd, 0xce, 0xcf,
496    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,    0xdb, 0xdc, 0xdd, 0xde, 0xdf,
497    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,    0xeb, 0xec, 0xed, 0xee, 0xef,
498    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa,    0xfb, 0xfc, 0xfd, 0xfe, 0xff,
499    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,/**/0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
500    0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1,    0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
501    0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1,    0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
502    0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
503};
504
505static const struct
506{
507   UINT8 sms2_name[40];
508   int sms2_valid;
509   int sms2_height;
510   int sms2_tilemap_height;
511   const UINT8* sms_vcounter_table;
512   const UINT8* sms_hcounter_table;
513
514} sms_mode_table[] =
515{
516   /* NTSC Modes */
517   { "Graphic 1 (NTSC)",         0, 192, 224, vc_ntsc_192, hc_256 },
518   { "Text (NTSC)",              0, 192, 224, vc_ntsc_192, hc_256 },
519   { "Graphic 2 (NTSC)",         0, 192, 224, vc_ntsc_192, hc_256 },
520   { "Mode 1+2 (NTSC)" ,         0, 192, 224, vc_ntsc_192, hc_256 },
521   { "Multicolor (NTSC)",        0, 192, 224, vc_ntsc_192, hc_256 },
522   { "Mode 1+3 (NTSC)",          0, 192, 224, vc_ntsc_192, hc_256 },
523   { "Mode 2+3 (NTSC)",          0, 192, 224, vc_ntsc_192, hc_256 },
524   { "Mode 1+2+3 (NTSC)",        0, 192, 224, vc_ntsc_192, hc_256 },
525   { "Mode 4 (NTSC)",            1, 192, 224, vc_ntsc_192, hc_256 },
526   { "Invalid Text (NTSC)",      0, 192, 224, vc_ntsc_192, hc_256 },
527   { "Mode 4 (NTSC)",            1, 192, 224, vc_ntsc_192, hc_256 },
528   { "Mode 4 (224-line) (NTSC)", 1, 224, 256, vc_ntsc_224, hc_256 },
529   { "Mode 4 (NTSC)",            1, 192, 224, vc_ntsc_192, hc_256 },
530   { "Invalid Text (NTSC)",      0, 192, 224, vc_ntsc_192, hc_256 },
531   { "Mode 4 (240-line) (NTSC)", 1, 240, 256, vc_ntsc_240, hc_256 },
532   { "Mode 4 (NTSC)",            1, 192, 244, vc_ntsc_192, hc_256 },
533
534   /* Pal Modes (different Vcounter) */
535   { "Graphic 1 (PAL)",         0, 192, 224, vc_pal_192, hc_256 },
536   { "Text (PAL)",              0, 192, 224, vc_pal_192, hc_256 },
537   { "Graphic 2 (PAL)",         0, 192, 224, vc_pal_192, hc_256 },
538   { "Mode 1+2 (PAL)" ,         0, 192, 224, vc_pal_192, hc_256 },
539   { "Multicolor (PAL)",        0, 192, 224, vc_pal_192, hc_256 },
540   { "Mode 1+3 (PAL)",          0, 192, 224, vc_pal_192, hc_256 },
541   { "Mode 2+3 (PAL)",          0, 192, 224, vc_pal_192, hc_256 },
542   { "Mode 1+2+3 (PAL)",        0, 192, 224, vc_pal_192, hc_256 },
543   { "Mode 4 (PAL)",            1, 192, 224, vc_pal_192, hc_256 },
544   { "Invalid Text (PAL)",      0, 192, 224, vc_pal_192, hc_256 },
545   { "Mode 4 (PAL)",            1, 192, 224, vc_pal_192, hc_256 },
546   { "Mode 4 (224-line) (PAL)", 1, 224, 256, vc_pal_224, hc_256 },
547   { "Mode 4 (PAL)",            1, 192, 224, vc_pal_192, hc_256 },
548   { "Invalid Text (PAL)",      0, 192, 224, vc_pal_192, hc_256 },
549   { "Mode 4 (240-line) (PAL)", 1, 240, 256, vc_pal_240, hc_256 },
550   { "Mode 4 (PAL)",            1, 192, 244, vc_pal_192, hc_256 }
551};
552
553enum
554{
555   SMS_VDP = 0,  // SMS1 VDP
556   SMS2_VDP = 1, // SMS2 VDP, or Game Gear VDP running in SMS2 Mode
557   GG_VDP = 2,   // Game Gear VDP running in Game Gear Mode
558   GEN_VDP = 3   // Genesis VDP running in SMS2 Mode
559};
560
561static int sms_vdp_null_irq_callback(running_machine *machine, int status)
562{
563   return -1;
564}
565
566static int sms_vdp_cpu0_irq_callback(running_machine *machine, int status)
567{
568   if (status == 1)
569      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
570   else
571      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
572
573   return 0;
574}
575
576static int sms_vdp_cpu1_irq_callback(running_machine *machine, int status)
577{
578   if (status == 1)
579      cputag_set_input_line(machine, "genesis_snd_z80", 0, HOLD_LINE);
580   else
581      cputag_set_input_line(machine, "genesis_snd_z80", 0, CLEAR_LINE);
582
583   return 0;
584}
585
586
587static int sms_vdp_cpu2_irq_callback(running_machine *machine, int status)
588{
589   if (status == 1)
590      cputag_set_input_line(machine, "mtbios", 0, HOLD_LINE);
591   else
592      cputag_set_input_line(machine, "mtbios", 0, CLEAR_LINE);
593
594   return 0;
595}
596
597
598
599
600struct sms_vdp
601{
602   UINT8 chip_id;
603
604   UINT8  cmd_pend;
605   UINT8  cmd_part1;
606   UINT8  cmd_part2;
607   UINT16 addr_reg;
608   UINT8  cmd_reg;
609   UINT8  regs[0x10];
610   UINT8  readbuf;
611   UINT8* vram;
612   UINT8* cram;
613   UINT8  writemode;
614   bitmap_t* r_bitmap;
615   UINT8* tile_renderline;
616   UINT8* sprite_renderline;
617
618   UINT8 sprite_collision;
619   UINT8 sprite_overflow;
620
621   UINT8  yscroll;
622   UINT8  hint_counter;
623
624   UINT8 frame_irq_pending;
625   UINT8 line_irq_pending;
626
627   UINT8 vdp_type;
628
629   UINT8 gg_cram_latch; // gamegear specific.
630
631   /* below are MAME specific, to make things easier */
632   UINT8 screen_mode;
633   UINT8 is_pal;
634   int sms_scanline_counter;
635   int sms_total_scanlines;
636   int sms_framerate;
637   emu_timer* sms_scanline_timer;
638   UINT16* cram_mamecolours; // for use on RGB_DIRECT screen
639   int    (*set_irq)(running_machine *machine, int state);
640
641};
642
643
644
645static void *start_vdp(running_machine *machine, int type)
646{
647   struct sms_vdp *chip;
648
649   chip = auto_alloc_clear(machine, struct sms_vdp);
650
651   chip->vdp_type = type;
652
653   chip->set_irq = sms_vdp_null_irq_callback;
654
655   chip->cmd_pend = 0;
656   chip->cmd_part1 = 0;
657   chip->cmd_part2 = 0;
658   chip->addr_reg = 0;
659   chip->cmd_reg = 0;
660
661   chip->regs[0x0] = 0x06; // mode 4
662   chip->regs[0x1] = 0x18; // mode 4
663   chip->regs[0x2] = 0;
664   chip->regs[0x3] = 0;
665   chip->regs[0x4] = 0;
666   chip->regs[0x5] = 0;
667   chip->regs[0x6] = 0;
668   chip->regs[0x7] = 0;
669   chip->regs[0x8] = 0;
670   chip->regs[0x9] = 0;
671   chip->regs[0xa] = 0;
672   /* b-f don't matter */
673   chip->readbuf = 0;
674   chip->vram = auto_alloc_array_clear(machine, UINT8, 0x4000);
675
676   //printf("%d\n", (*chip->set_irq)(machine, 200));
677
678   if (chip->vdp_type==GG_VDP)
679   {
680      chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0040);
681      chip->cram_mamecolours = auto_alloc_array_clear(machine, UINT16, 0x0080/2);
682      chip->gg_cram_latch = 0;
683   }
684   else
685   {
686      chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0020);
687      chip->cram_mamecolours = auto_alloc_array(machine, UINT16, 0x0040/2);
688   }
689
690   chip->tile_renderline = auto_alloc_array(machine, UINT8, 256+8);
691   memset(chip->tile_renderline,0x00,256+8);
692
693   chip->sprite_renderline = auto_alloc_array(machine, UINT8, 256+32);
694   memset(chip->sprite_renderline,0x00,256+32);
695
696   chip->writemode = 0;
697   chip->r_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_RGB15);
698
699   chip->sms_scanline_timer = timer_alloc(machine, sms_scanline_timer_callback, chip);
700
701   return chip;
702}
703
704/* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */
705void segae_md_sms_stop_scanline_timer(void)
706{
707   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer,  attotime_never, 0);
708   memset(md_sms_vdp->vram,0x00,0x4000);
709}
710
711
712#ifdef UNUSED_FUNCTION
713static READ8_HANDLER( z80_unmapped_r )
714{
715   printf("unmapped z80 read %04x\n",offset);
716   return 0;
717}
718
719static WRITE8_HANDLER( z80_unmapped_w )
720{
721   printf("unmapped z80 write %04x\n",offset);
722}
723#endif
724
725static UINT8 vcounter_r(struct sms_vdp *chip)
726{
727//  return vc_pal_224[sms_scanline_counter%(sizeof vc_pal_224)];
728   UINT8 retvalue;
729   int scanline = chip->sms_scanline_counter%chip->sms_total_scanlines;
730
731   retvalue = sms_mode_table[chip->screen_mode].sms_vcounter_table[scanline];
732
733   return retvalue;
734   //printf("retvalue %d\n";
735}
736
737
738static UINT8 vdp_data_r(struct sms_vdp *chip)
739{
740   UINT8 retdata = chip->readbuf;
741   chip->readbuf = SMS_VDP_VRAM(chip->addr_reg);
742   chip->addr_reg++; chip->addr_reg&=0x3fff;
743   return retdata;
744}
745
746static void vdp_data_w(const address_space *space, UINT8 data, struct sms_vdp* chip)
747{
748   /* data writes clear the pending flag */
749   chip->cmd_pend = 0;
750
751   if (chip->writemode==0)
752   { /* Write to VRAM */
753      SMS_VDP_VRAM(chip->addr_reg)=data;
754      chip->addr_reg++; chip->addr_reg&=0x3fff;
755      chip->readbuf = data; // quirk of the VDP
756   }
757   else if (chip->writemode==1)
758   {
759      if (chip->vdp_type==GG_VDP)
322   if (f7_bank_value & 0x20)
323   { // to vdp1 vram
324      if (f7_bank_value & 0x80)
760325      {
761         if (!(chip->addr_reg&1))
762         { /* Even address, value latched */
763            chip->gg_cram_latch = data;
764         }
765         else
766         {
767            chip->cram[(chip->addr_reg&0x3e)+1]=data;
768            chip->cram[(chip->addr_reg&0x3e)+0]=chip->gg_cram_latch;
769
770            /* Set Colour */
771            {
772               UINT16 palword;
773               UINT8 r,g,b;
774
775               palword = ((chip->cram[(chip->addr_reg&0x3e)+1])<<8)|(chip->cram[(chip->addr_reg&0x3e)+0]);
776
777               //printf("addr %04x palword %04x\n", chip->addr_reg&0x3f, palword);
778
779               r = (palword & 0x000f)>>0;
780               g = (palword & 0x00f0)>>4;
781               b = (palword & 0x0f00)>>8;
782               palette_set_color_rgb(space->machine,(chip->addr_reg&0x3e)/2, pal4bit(r), pal4bit(g), pal4bit(b));
783               chip->cram_mamecolours[(chip->addr_reg&0x3e)/2]=(b<<1)|(g<<6)|(r<<11);
784            }
785         }
326         vdp1_vram_bank0[offset] = data;
786327      }
787328      else
788329      {
789         chip->cram[chip->addr_reg&0x1f]=data;
790
791         /* Set Colour */
792         {
793            UINT8 r,g,b;
794            r = (data & 0x03)>>0;
795            g = (data & 0x0c)>>2;
796            b = (data & 0x30)>>4;
797            palette_set_color_rgb(space->machine,chip->addr_reg&0x1f, pal2bit(r), pal2bit(g), pal2bit(b));
798            chip->cram_mamecolours[chip->addr_reg&0x1f]=(b<<3)|(g<<8)|(r<<13);
799         }
800
330         vdp1_vram_bank1[offset] = data;
801331      }
802
803      chip->addr_reg++; chip->addr_reg&=0x3fff;
804      chip->readbuf = data; // quirk of the VDP
805
806332   }
807
808}
809
810static UINT8 vdp_ctrl_r(const address_space *space, struct sms_vdp *chip)
811{
812   UINT8 retvalue;
813
814   retvalue = (chip->frame_irq_pending<<7) |
815                (chip->sprite_overflow<<6) |
816              (chip->sprite_collision<<5);
817
818   chip->cmd_pend = 0;
819   chip->frame_irq_pending = 0;
820   chip->line_irq_pending = 0;
821   chip->sprite_collision = 0;
822   chip->sprite_overflow = 0;
823
824   (chip->set_irq)(space->machine, 0); // clear IRQ;
825
826
827   return retvalue;
828}
829
830/* check me */
831static void vdp_update_code_addr_regs(struct sms_vdp *chip)
832{
833   chip->addr_reg = ((chip->cmd_part2&0x3f)<<8) | chip->cmd_part1;
834   chip->cmd_reg = (chip->cmd_part2&0xc0)>>6;
835}
836
837static void vdp_set_register(running_machine *machine, struct sms_vdp *chip)
838{
839   UINT8 reg = chip->cmd_part2&0x0f;
840   chip->regs[reg] = chip->cmd_part1;
841
842   //if(reg==0) printf("setting reg 0 to %02x\n",chip->cmd_part1);
843
844   //if (reg>0xa) printf("Invalid register write to register %01x\n",reg);
845
846   if(reg==1)
847   {
848      if ((chip->regs[0x1]&0x20) && chip->frame_irq_pending)
849      {
850         (chip->set_irq)(machine, 1); // set IRQ;
851      }
852      else
853      {
854         (chip->set_irq)(machine, 0); // clear IRQ;
855      }
856   }
857
858   if(reg==0)
859   {
860      if ((chip->regs[0x0]&0x10) && chip->line_irq_pending)
861      {
862         (chip->set_irq)(machine, 1); // set IRQ;
863      }
864      else
865      {
866         (chip->set_irq)(machine, 0); // clear IRQ;
867      }
868   }
869
870
871//  printf("VDP: setting register %01x to %02x\n",reg, chip->cmd_part1);
872}
873
874static void vdp_ctrl_w(const address_space *space, UINT8 data, struct sms_vdp *chip)
875{
876   if (chip->cmd_pend)
877   { /* Part 2 of a command word write */
878      chip->cmd_pend = 0;
879      chip->cmd_part2 = data;
880      vdp_update_code_addr_regs(chip);
881
882      switch (chip->cmd_reg)
883      {
884         case 0x0: /* VRAM read mode */
885            chip->readbuf = SMS_VDP_VRAM(chip->addr_reg);
886            chip->addr_reg++; chip->addr_reg&=0x3fff;
887            chip->writemode = 0;
888            break;
889
890         case 0x1: /* VRAM write mode */
891            chip->writemode = 0;
892            break;
893
894         case 0x2: /* REG setting */
895            vdp_set_register(space->machine, chip);
896            chip->writemode = 0;
897            break;
898
899         case 0x3: /* CRAM write mode */
900            chip->writemode = 1;
901            break;
902      }
903   }
904333   else
905   { /* Part 1 of a command word write */
906      chip->cmd_pend = 1;
907      chip->cmd_part1 = data;
908      vdp_update_code_addr_regs(chip);
909   }
910}
911
912/* for the Genesis */
913
914READ8_HANDLER( md_sms_vdp_vcounter_r )
915{
916   return vcounter_r(md_sms_vdp);
917}
918
919READ8_HANDLER( md_sms_vdp_data_r )
920{
921   return vdp_data_r(md_sms_vdp);
922}
923
924WRITE8_HANDLER( md_sms_vdp_data_w )
925{
926   vdp_data_w(space, data, md_sms_vdp);
927}
928
929READ8_HANDLER( md_sms_vdp_ctrl_r )
930{
931   return vdp_ctrl_r(space, md_sms_vdp);
932}
933
934WRITE8_HANDLER( md_sms_vdp_ctrl_w )
935{
936   vdp_ctrl_w(space, data, md_sms_vdp);
937}
938
939
940/* Read / Write Handlers - call other functions */
941
942READ8_HANDLER( sms_vcounter_r )
943{
944   return vcounter_r(vdp1);
945}
946
947READ8_HANDLER( sms_vdp_data_r )
948{
949   return vdp_data_r(vdp1);
950}
951
952WRITE8_HANDLER( sms_vdp_data_w )
953{
954   vdp_data_w(space, data, vdp1);
955}
956
957READ8_HANDLER( sms_vdp_ctrl_r )
958{
959   return vdp_ctrl_r(space, vdp1);
960}
961
962WRITE8_HANDLER( sms_vdp_ctrl_w )
963{
964   vdp_ctrl_w(space, data, vdp1);
965}
966
967static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip)
968{
969   int xx;
970   UINT32 gfxdata;
971   UINT16 gfx_base = (tiledata & 0x01ff)<<5;
972   UINT8  flipx = (tiledata & 0x0200)>>9;
973   UINT8  flipy = (tiledata & 0x0400)>>10;
974   UINT8  pal   = (tiledata & 0x0800)>>11;
975   UINT8  pri   = (tiledata & 0x1000)>>12;
976
977   if (flipy)
978   {
979      gfx_base+=(7-tileline)*4;
980   }
981   else
982   {
983      gfx_base+=tileline*4;
984   }
985
986   gfxdata = (SMS_VDP_VRAM(gfx_base)<<24)|(SMS_VDP_VRAM(gfx_base+1)<<16)|(SMS_VDP_VRAM(gfx_base+2)<<8)|(SMS_VDP_VRAM(gfx_base+3)<<0);
987
988   for (xx=0;xx<8;xx++)
989   {
990      UINT8 pixel;
991
992      if (flipx)
334   { // to vdp2 vram
335      if (f7_bank_value & 0x40)
993336      {
994         pixel = (( (gfxdata>>(0+xx)  ) &0x00000001)<<3)|
995                  (( (gfxdata>>(8+xx)  ) &0x00000001)<<2)|
996                  (( (gfxdata>>(16+xx) ) &0x00000001)<<1)|
997                  (( (gfxdata>>(24+xx) ) &0x00000001)<<0);
337         vdp2_vram_bank0[offset] = data;
998338      }
999339      else
1000340      {
1001         pixel = (( (gfxdata>>(7-xx)  ) &0x00000001)<<3)|
1002                 (( (gfxdata>>(15-xx) ) &0x00000001)<<2)|
1003                 (( (gfxdata>>(23-xx) ) &0x00000001)<<1)|
1004                 (( (gfxdata>>(31-xx) ) &0x00000001)<<0);
341         vdp2_vram_bank1[offset] = data;
1005342      }
1006
1007      pixel += pal*0x10;
1008
1009      if (!pri) linebuf[drawxpos+xx] = pixel;
1010      else
1011      {
1012         if (pixel&0xf)
1013            linebuf[drawxpos+xx] = pixel|0x80;
1014         else
1015            linebuf[drawxpos+xx] = pixel;
1016
1017      }
1018343   }
1019}
1020344
1021static void sms_render_spriteline(int scanline, struct sms_vdp* chip)
1022{
1023   int spritenum;
1024   int height = 8;
1025   int width = 8;
1026   int max_sprites = 8;
1027   int visible_line = 0;
1028
1029   UINT16 table_base = (chip->regs[0x5]&0x7e) << 7;
1030   UINT8 pattern_bit = (chip->regs[0x6]&0x04) >> 2; // high bit of the tile # (because spriteram can only contain an 8-bit tile #)
1031
1032
1033   memset(chip->sprite_renderline, 0, 256+32);
1034
1035   for (spritenum = 0;spritenum<64;spritenum++)
1036   {
1037      int xpos,ypos,num;
1038      /*
1039        00: yyyyyyyyyyyyyyyy
1040        10: yyyyyyyyyyyyyyyy
1041        20: yyyyyyyyyyyyyyyy
1042        30: yyyyyyyyyyyyyyyy
1043        40: ????????????????
1044        50: ????????????????
1045        60: ????????????????
1046        70: ????????????????
1047        80: xnxnxnxnxnxnxnxn
1048        90: xnxnxnxnxnxnxnxn
1049        A0: xnxnxnxnxnxnxnxn
1050        B0: xnxnxnxnxnxnxnxn
1051        C0: xnxnxnxnxnxnxnxn
1052        D0: xnxnxnxnxnxnxnxn
1053        E0: xnxnxnxnxnxnxnxn
1054        F0: xnxnxnxnxnxnxnxn
1055        */
1056
1057      ypos = SMS_VDP_VRAM(table_base+spritenum);
1058      xpos = SMS_VDP_VRAM(table_base+0x80+spritenum*2+0);
1059      num  = SMS_VDP_VRAM(table_base+0x80+spritenum*2+1)|(pattern_bit<<8);
1060
1061      if (chip->regs[0x1]&0x2)
1062      {
1063         num &=0x1fe;
1064         height=16;
1065      }
1066      else height = 8;
1067
1068
1069      xpos+=16; // allow room either side for clipping (avoids xdrawpos of -8 if bit below is set)
1070
1071      if (chip->regs[0x0]&0x08) xpos-=8;
1072
1073      if ((sms_mode_table[chip->screen_mode].sms2_height)==192)
1074      {
1075         if (ypos == 0xd0)
1076            return;
1077      }
1078
1079      ypos++;
1080
1081      num <<= 5;
1082      //num+=((scanline-ypos)&0x7)*4;
1083
1084      visible_line = 0;
1085
1086      if (ypos<=scanline && ypos+height>scanline)
1087      {
1088         visible_line = 1;
1089         num+=((scanline-ypos)&(height-1))*4;
1090
1091      }
1092      else if (ypos+height>0x100)
1093      {
1094         if (scanline< ypos+height-0x100)
1095         {
1096            visible_line = 1;
1097            num+=((scanline-ypos)&(height-1))*4;
1098
1099         }
1100      }
1101
1102      if (visible_line)
1103      {
1104         int xx;
1105         UINT32 gfxdata;
1106
1107         gfxdata = (SMS_VDP_VRAM(num&0x3fff)<<24)|(SMS_VDP_VRAM((num+1)&0x3fff)<<16)|(SMS_VDP_VRAM((num+2)&0x3fff)<<8)|(SMS_VDP_VRAM((num+3)&0x3fff)<<0);
1108
1109
1110         for (xx=0;xx<8;xx++)
1111         {
1112            UINT8 pixel = (( (gfxdata>>(0+xx)  ) &0x00000001)<<3)|
1113                          (( (gfxdata>>(8+xx)  ) &0x00000001)<<2)|
1114                          (( (gfxdata>>(16+xx) ) &0x00000001)<<1)|
1115                          (( (gfxdata>>(24+xx) ) &0x00000001)<<0);
1116
1117            if (pixel)
1118            {
1119               if (!chip->sprite_renderline[xpos+((width-1)-xx)])
1120               {
1121                  chip->sprite_renderline[xpos+((width-1)-xx)] = pixel;
1122               }
1123               else
1124               {
1125                  chip->sprite_collision = 1;
1126               }
1127            }
1128         }
1129
1130         max_sprites--;
1131
1132         if (max_sprites==0)
1133         {
1134            chip->sprite_overflow = 1;
1135            return;
1136         }
1137
1138      }
1139   }
1140345}
1141346
1142static void sms_render_tileline(int scanline, struct sms_vdp* chip)
347static WRITE8_HANDLER( systeme_bank_w )
1143348{
1144   int column = 0;
1145   int count = 32;
1146   int drawxpos;
349   int rombank;
350   f7_bank_value = data;
1147351
1148   UINT8 xscroll = chip->regs[0x8];
1149   UINT8 yscroll = chip->yscroll;
1150   UINT16 table_base = (chip->regs[0x2]&0x0e)<<10;
1151   UINT16 our_base;
1152   UINT8  our_line = (scanline+yscroll) & 0x7;
352   rombank = data & 0x0f;
1153353
1154   /* In 224 and 240 line modes the table base is different */
1155   if ((sms_mode_table[chip->screen_mode].sms2_height)!=192)
1156   {
1157      table_base &=0x3700; table_base|=0x700;
1158   }
354   segae_set_vram_banks(data);
1159355
1160   if ((chip->regs[0x0]&0x40) && scanline < 16)
1161   {
1162      xscroll = 0;
1163   }
356   //memcpy(sms_rom+0x8000, memory_region(space->machine, "user1")+0x10000+rombank*0x4000, 0x4000);
357   memory_set_bank(space->machine, 1, rombank);
1164358
1165//  xscroll = 0;
1166
1167//  table_base -= 0x0100;
1168
1169   our_base = table_base+(((scanline+yscroll)%sms_mode_table[chip->screen_mode].sms2_tilemap_height)>>3)*64;// + (yscroll>>3)*32;
1170
1171   our_base &=0x3fff;
1172
1173   memset(chip->tile_renderline, (chip->regs[0x7]&0x0f)+0x10, 256+8);
1174
1175   drawxpos = xscroll&0x7;
1176   column = 32-(xscroll>>3);
1177
1178   do
1179   {
1180      UINT16 tiledata = (SMS_VDP_VRAM((our_base+(column&0x1f)*2+1)&0x3fff) << 8) |
1181                        (SMS_VDP_VRAM((our_base+(column&0x1f)*2+0)&0x3fff) << 0);
1182
1183//      UINT16 pattern = ((column+((scanline>>3)*32)) & 0x01ff)<<5;
1184
1185      draw_tile_line(drawxpos, our_line, tiledata, chip->tile_renderline, chip);
1186
1187      drawxpos+=8;
1188      column++;
1189      column&=0x1f;
1190      count--;
1191   } while (count);
1192
1193359}
1194360
1195static void sms_copy_to_renderbuffer(int scanline, struct sms_vdp* chip)
1196{
1197   int x;
1198   UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, scanline, 0);
1199361
1200   for (x=0;x<256;x++)
1201   {
1202      UINT8 dat = chip->tile_renderline[x];
1203      UINT8 col;
1204
1205
1206      col = (chip->regs[0x7]&0x0f)+0x10;
1207      lineptr[x] = chip->cram_mamecolours[col];
1208
1209
1210      if ((x<8 && (chip->regs[0x0]&0x20)) || !(chip->regs[0x1]&0x40))
1211         continue;
1212
1213
1214      if (!(dat & 0x80))
1215      {
1216         lineptr[x] = chip->cram_mamecolours[dat&0x1f];
1217         if ((dat&0xf)==0x0) lineptr[x]|=0x8000;
1218
1219      }
1220
1221      if (chip->sprite_renderline[x+16])
1222      {
1223         lineptr[x] =  chip->cram_mamecolours[chip->sprite_renderline[x+16]+0x10];
1224      }
1225
1226      if (dat & 0x80)
1227      {
1228         lineptr[x] = chip->cram_mamecolours[dat&0x1f];
1229         if ((dat&0xf)==0x0) lineptr[x]|=0x8000;
1230      }
1231
1232   }
1233
1234}
1235
1236static void sms_draw_scanline(int scanline, struct sms_vdp* chip)
362static void init_ports_systeme(running_machine *machine)
1237363{
364   /* INIT THE PORTS *********************************************************************************************/
1238365
1239   if (scanline>=0 && scanline<sms_mode_table[chip->screen_mode].sms2_height)
1240   {
1241      sms_render_spriteline(scanline, chip);
1242      sms_render_tileline(scanline, chip);
1243      sms_copy_to_renderbuffer(scanline, chip);
366   const address_space *io = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO);
367   const device_config *sn1 = devtag_get_device(machine, "sn1");
368   const device_config *sn2 = devtag_get_device(machine, "sn2");
1244369
1245   }
1246}
370   memory_install_write8_device_handler(io, sn2, 0x7b, 0x7b, 0, 0, sn76496_w);
371   memory_install_write8_device_handler(io, sn1, 0x7e, 0x7f, 0, 0, sn76496_w);
372   memory_install_read8_handler        (io, 0x7e, 0x7e, 0, 0, sms_vcounter_r);
1247373
374   memory_install_readwrite8_handler(io, 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w);
375   memory_install_readwrite8_handler(io, 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w);
1248376
1249static TIMER_CALLBACK( sms_scanline_timer_callback )
1250{
1251   /* This function is called at the very start of every scanline starting at the very
1252       top-left of the screen.  The first scanline is scanline 0 (we set scanline to -1 in
1253       VIDEO_EOF) */
377   memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w);
378   memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w);
1254379
1255   /* Compensate for some rounding errors
380   memory_install_read_port_handler     (io, 0xe0, 0xe0, 0, 0, "e0");
381   memory_install_read_port_handler     (io, 0xe1, 0xe1, 0, 0, "e1");
382   memory_install_read_port_handler     (io, 0xe2, 0xe2, 0, 0, "e2");
383   memory_install_read_port_handler     (io, 0xf2, 0xf2, 0, 0, "f2");
384   memory_install_read_port_handler     (io, 0xf3, 0xf3, 0, 0, "f3");
1256385
1257       When the counter reaches 314 (or whatever the max lines is) we should have reached the
1258       end of the frame, however due to rounding errors in the timer calculation we're not quite
1259       there.  Let's assume we are still in the previous scanline for now.
1260
1261       The position to get the H position also has to compensate for a few errors
1262    */
1263//  printf("num %d\n",num );
1264   struct sms_vdp *chip = (struct sms_vdp *)ptr;
1265
1266   if (chip->sms_scanline_counter<(chip->sms_total_scanlines-1))
1267   {
1268      chip->sms_scanline_counter++;
1269      timer_adjust_oneshot(chip->sms_scanline_timer, ATTOTIME_IN_HZ(chip->sms_framerate * chip->sms_total_scanlines), 0);
1270
1271      if (chip->sms_scanline_counter>sms_mode_table[chip->screen_mode].sms2_height)
1272      {
1273         chip->hint_counter=chip->regs[0xa];
1274      }
1275
1276      if (chip->sms_scanline_counter==0)
1277      {
1278         chip->hint_counter=chip->regs[0xa];
1279      }
1280
1281      if (chip->sms_scanline_counter<=192)
1282      {
1283         chip->hint_counter--;
1284
1285         if (chip->hint_counter==0xff)
1286         {
1287            //if (chip->chip_id==2) printf("irq triggerd on scanline %d %d\n", vdp1->sms_scanline_counter, vdp2->sms_scanline_counter);
1288
1289            chip->line_irq_pending = 1;
1290            chip->hint_counter=chip->regs[0xa];
1291            if (chip->regs[0x0]&0x10)
1292            {
1293               (chip->set_irq)(machine, 1); // set IRQ;
1294            }
1295            else
1296            {
1297               (chip->set_irq)(machine, 0); // clear IRQ;
1298            }
1299         }
1300
1301      }
1302
1303
1304      sms_draw_scanline(chip->sms_scanline_counter, chip);
1305
1306      //if(sms_scanline_counter==0) chip->sprite_collision = 0;
1307
1308      if (chip->sms_scanline_counter==sms_mode_table[chip->screen_mode].sms2_height+1 )
1309      {
1310         chip->frame_irq_pending = 1;
1311         if (chip->regs[0x1]&0x20)
1312         {
1313            (chip->set_irq)(machine, 1); // set IRQ;
1314         }
1315         else
1316         {
1317            (chip->set_irq)(machine, 0); // clear IRQ;
1318         }
1319      }
1320   }
1321   else
1322   {   /* if we're called passed the total number of scanlines then assume we're still on the last one.
1323           this can happen due to rounding errors */
1324      chip->sms_scanline_counter = chip->sms_total_scanlines-1;
1325   }
386   memory_install_write8_handler    (io, 0xf7, 0xf7, 0, 0, systeme_bank_w );
1326387}
1327388
1328#ifdef UNUSED_FUNCTION
1329static void show_tiles(struct sms_vdp* chip)
1330{
1331   int x,y,xx,yy;
1332   UINT16 count = 0;
1333389
1334   for (y=0;y<16;y++)
1335   {
1336      for (x=0;x<32;x++)
1337      {
1338         for (yy=0;yy<8;yy++)
1339         {
1340            int drawypos = y*8+yy;
1341            UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, drawypos, 0);
1342390
1343            UINT32 gfxdata = (SMS_VDP_VRAM(count)<<24)|(SMS_VDP_VRAM(count+1)<<16)|(SMS_VDP_VRAM(count+2)<<8)|(SMS_VDP_VRAM(count+3)<<0);
1344
1345            for (xx=0;xx<8;xx++)
1346            {
1347               int drawxpos = x*8+xx;
1348
1349               UINT8 pixel = (( (gfxdata>>(0+xx)  ) &0x00000001)<<3)|
1350                             (( (gfxdata>>(8+xx)  ) &0x00000001)<<2)|
1351                             (( (gfxdata>>(16+xx) ) &0x00000001)<<1)|
1352                             (( (gfxdata>>(24+xx) ) &0x00000001)<<0);
1353
1354               lineptr[drawxpos] = chip->cram_mamecolours[pixel+16];
1355
1356            }
1357
1358
1359            count+=4;count&=0x3fff;
1360         }
1361      }
1362   }
1363}
1364#endif
1365
1366/*
1367 Register $00 - Mode Control No. 1
1368
1369 D7 - 1= Disable vertical scrolling for columns 24-31
1370 D6 - 1= Disable horizontal scrolling for rows 0-1
1371 D5 - 1= Mask column 0 with overscan color from register #7
1372 D4 - (IE1) 1= Line interrupt enable
1373 D3 - (EC) 1= Shift sprites left by 8 pixels
1374 D2 - (M4) 1= Use Mode 4, 0= Use TMS9918 modes (selected with M1, M2, M3)
1375 D1 - (M2) Must be 1 for M1/M3 to change screen height in Mode 4.
1376      Otherwise has no effect.
1377 D0 - 1= No sync, display is monochrome, 0= Normal display
1378
1379 Bits 0 and 5 have no effect on the GameGear in either mode, while bit 6
1380 has no effect in GG mode but works normally in SMS mode.
1381 */
1382
1383 /*
1384  Register $01 - Mode Control No. 2
1385
1386  D7 - No effect
1387  D6 - (BLK) 1= Display visible, 0= display blanked.
1388  D5 - (IE0) 1= Frame interrupt enable.
1389  D4 - (M1) Selects 224-line screen for Mode 4 if M2=1, else has no effect.
1390  D3 - (M3) Selects 240-line screen for Mode 4 if M2=1, else has no effect.
1391  D2 - No effect
1392  D1 - Sprites are 1=16x16,0=8x8 (TMS9918), Sprites are 1=8x16,0=8x8 (Mode 4)
1393  D0 - Sprite pixels are doubled in size.
1394
1395 Even though some games set bit 7, it does nothing.
1396 */
1397
1398static void end_of_frame(running_machine *machine, struct sms_vdp *chip)
391static void init_systeme_map(running_machine *machine)
1399392{
1400   UINT8 m1 = (chip->regs[0x1]&0x10)>>4;
1401   UINT8 m2 = (chip->regs[0x0]&0x02)>>1;
1402   UINT8 m3 = (chip->regs[0x1]&0x08)>>3;
1403   UINT8 m4 = (chip->regs[0x0]&0x04)>>2;
1404   UINT8 m5 = chip->is_pal;
1405   chip->screen_mode = m1|(m2<<1)|(m3<<2)|(m4<<3)|(m5<<4);
393   memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000);
1406394
1407   if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */
1408   {
1409      rectangle visarea;
395   /* alternate way of accessing video ram */
396   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, segasyse_videoram_w);
1410397
1411      visarea.min_x = 0;
1412      visarea.max_x = 256-1;
1413      visarea.min_y = 0;
1414      visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1;
398   /* main ram area */
399   sms_mainram = auto_alloc_array(machine, UINT8, 0x4000);
400   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2));
401   memory_set_bankptr(machine,  2, sms_mainram );
402   memset(sms_mainram,0x00,0x4000);
1415403
1416      if (chip->chip_id==3) video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
1417
1418   }
1419   else /* 160x144 */
1420   {
1421      rectangle visarea;
1422      visarea.min_x = (256-160)/2;
1423      visarea.max_x = (256-160)/2+160-1;
1424      visarea.min_y = (192-144)/2;
1425      visarea.max_y = (192-144)/2+144-1;
1426   }
1427
1428
1429
1430//  printf("Mode: %s is ok\n", sms_mode_table[chip->screen_mode].sms2_name);
1431
1432   chip->sms_scanline_counter = -1;
1433   chip->yscroll = chip->regs[0x9]; // this can't change mid-frame
1434   timer_adjust_oneshot(chip->sms_scanline_timer, attotime_zero, 0);
404   init_ports_systeme(machine);
1435405}
1436406
1437#ifdef UNUSED_FUNCTION
1438VIDEO_EOF(sms)
407DRIVER_INIT( segasyse )
1439408{
1440   end_of_frame(machine, vdp1);
1441   //if (SMS_PAUSE_BUTTON) cputag_set_input_line(machine, , "maincpu", INPUT_LINE_NMI, PULSE_LINE); // not on systeme!!!
409   init_systeme_map(machine);
410   DRIVER_INIT_CALL(hazemd_segasyse);
1442411}
1443#endif
1444412
1445static VIDEO_START(sms)
1446{
1447413
1448//  vdp->is_pal = 1;
1449//  vdp->sms_total_scanlines = 313;
1450//  vdp->sms_framerate = 50;
1451}
1452
1453#ifdef UNUSED_FUNCTION
1454MACHINE_RESET(sms)
1455{
1456   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0);
1457}
1458#endif
1459
1460/* Sega System E */
1461
1462414/*******************************************************************************
1463415 Input Ports
1464416********************************************************************************
r5955r5956
1911863   ROM_LOAD( "317-0042.key",  0x0000, 0x2000, CRC(d6312538) SHA1(494ac7f080775c21dc7d369e6ea78f3299e6975a) )
1912864ROM_END
1913865
866ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
867   ADDRESS_MAP_GLOBAL_MASK(0xff)
868ADDRESS_MAP_END
1914869
1915static UINT8* vdp2_vram_bank0;
1916static UINT8* vdp2_vram_bank1;
1917
1918static UINT8* vdp1_vram_bank0;
1919static UINT8* vdp1_vram_bank1;
1920static UINT8 f7_bank_value;
1921
1922static MACHINE_RESET(systeme)
1923{
1924   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0);
1925   timer_adjust_oneshot(vdp2->sms_scanline_timer, attotime_zero, 0);
1926}
1927
1928MACHINE_RESET(megatech_md_sms)
1929{
1930   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_zero, 0);
1931}
1932
1933MACHINE_RESET(megatech_bios)
1934{
1935   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0);
1936}
1937
1938static VIDEO_EOF(systeme)
1939{
1940   end_of_frame(machine, vdp1);
1941   end_of_frame(machine, vdp2);
1942}
1943
1944
1945VIDEO_EOF(megatech_md_sms)
1946{
1947   end_of_frame(machine, md_sms_vdp);
1948}
1949
1950VIDEO_EOF(megatech_bios)
1951{
1952   end_of_frame(machine, vdp1);
1953}
1954
1955VIDEO_UPDATE(megatech_md_sms)
1956{
1957   int x,y;
1958
1959   for (y=0;y<224;y++)
1960   {
1961      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
1962      UINT16* srcptr =  BITMAP_ADDR16(md_sms_vdp->r_bitmap, y, 0);
1963
1964      for (x=0;x<256;x++)
1965      {
1966         lineptr[x]=srcptr[x]&0x7fff;
1967      }
1968   }
1969
1970   return 0;
1971}
1972
1973
1974VIDEO_UPDATE(megatech_bios)
1975{
1976   int x,y;
1977
1978   for (y=0;y<224;y++)
1979   {
1980      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
1981      UINT16* srcptr =  BITMAP_ADDR16(vdp1->r_bitmap, y, 0);
1982
1983      for (x=0;x<256;x++)
1984      {
1985         lineptr[x]=srcptr[x]&0x7fff;
1986      }
1987   }
1988
1989   return 0;
1990}
1991
1992static VIDEO_UPDATE(systeme)
1993{
1994//  show_tiles();
1995   int x,y;
1996
1997   for (y=0;y<192;y++)
1998   {
1999      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
2000      UINT16* srcptr =  BITMAP_ADDR16(vdp1->r_bitmap, y, 0);
2001
2002      for (x=0;x<256;x++)
2003      {
2004         lineptr[x]=srcptr[x]&0x7fff;
2005      }
2006
2007   }
2008
2009   for (y=0;y<192;y++)
2010   {
2011      UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0);
2012      UINT16* srcptr =  BITMAP_ADDR16(vdp2->r_bitmap, y, 0);
2013
2014      for (x=0;x<256;x++)
2015      {
2016         if(!(srcptr[x]&0x8000)) lineptr[x]=srcptr[x]&0x7fff;
2017      }
2018   }
2019
2020
2021   return 0;
2022}
2023
2024
2025870static MACHINE_DRIVER_START( systeme )
2026   MDRV_CPU_ADD("maincpu", Z80, 10738600/2) /* correct for hangonjr, and astroflash/transformer at least  */
871   MDRV_CPU_ADD("maincpu", Z80, 10738600/2) /* correct?  */
2027872   MDRV_CPU_PROGRAM_MAP(systeme_map)
2028   MDRV_CPU_IO_MAP(sms_io_map)
873   MDRV_CPU_IO_MAP(io_map)
2029874
2030875   /* IRQ handled via the timers */
2031876   MDRV_MACHINE_RESET(systeme)
r5955r5956
2057902MACHINE_DRIVER_END
2058903
2059904
2060static READ8_HANDLER( sms_vdp_2_data_r )
2061{
2062   return vdp_data_r(vdp2);
2063}
2064
2065static WRITE8_HANDLER( sms_vdp_2_data_w )
2066{
2067   vdp_data_w(space, data, vdp2);
2068}
2069
2070static READ8_HANDLER( sms_vdp_2_ctrl_r )
2071{
2072   return vdp_ctrl_r(space, vdp2);
2073}
2074
2075static WRITE8_HANDLER( sms_vdp_2_ctrl_w )
2076{
2077   vdp_ctrl_w(space, data, vdp2);
2078}
2079
2080static WRITE8_HANDLER( segasyse_videoram_w )
2081{
2082   if (f7_bank_value & 0x20)
2083   { // to vdp1 vram
2084      if (f7_bank_value & 0x80)
2085      {
2086         vdp1_vram_bank0[offset] = data;
2087      }
2088      else
2089      {
2090         vdp1_vram_bank1[offset] = data;
2091      }
2092   }
2093   else
2094   { // to vdp2 vram
2095      if (f7_bank_value & 0x40)
2096      {
2097         vdp2_vram_bank0[offset] = data;
2098      }
2099      else
2100      {
2101         vdp2_vram_bank1[offset] = data;
2102      }
2103   }
2104
2105}
2106
2107static WRITE8_HANDLER( systeme_bank_w )
2108{
2109   int rombank;
2110   f7_bank_value = data;
2111
2112   rombank = data & 0x0f;
2113
2114   if (f7_bank_value&0x80)
2115   {
2116      vdp1->vram = vdp1_vram_bank1;
2117   }
2118   else
2119   {
2120      vdp1->vram = vdp1_vram_bank0;
2121   }
2122
2123   if (f7_bank_value&0x40)
2124   {
2125      vdp2->vram = vdp2_vram_bank1;
2126   }
2127   else
2128   {
2129      vdp2->vram = vdp2_vram_bank0;
2130   }
2131
2132   //memcpy(sms_rom+0x8000, memory_region(space->machine, "user1")+0x10000+rombank*0x4000, 0x4000);
2133   memory_set_bank(space->machine, 1, rombank);
2134
2135}
2136
2137static void init_ports_systeme(running_machine *machine)
2138{
2139   /* INIT THE PORTS *********************************************************************************************/
2140
2141   const address_space *io = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO);
2142   const device_config *sn1 = devtag_get_device(machine, "sn1");
2143   const device_config *sn2 = devtag_get_device(machine, "sn2");
2144
2145   memory_install_write8_device_handler(io, sn2, 0x7b, 0x7b, 0, 0, sn76496_w);
2146   memory_install_write8_device_handler(io, sn1, 0x7e, 0x7f, 0, 0, sn76496_w);
2147   memory_install_read8_handler        (io, 0x7e, 0x7e, 0, 0, sms_vcounter_r);
2148
2149   memory_install_readwrite8_handler(io, 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w);
2150   memory_install_readwrite8_handler(io, 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w);
2151
2152   memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w);
2153   memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w);
2154
2155   memory_install_read_port_handler     (io, 0xe0, 0xe0, 0, 0, "e0");
2156   memory_install_read_port_handler     (io, 0xe1, 0xe1, 0, 0, "e1");
2157   memory_install_read_port_handler     (io, 0xe2, 0xe2, 0, 0, "e2");
2158   memory_install_read_port_handler     (io, 0xf2, 0xf2, 0, 0, "f2");
2159   memory_install_read_port_handler     (io, 0xf3, 0xf3, 0, 0, "f3");
2160
2161   memory_install_write8_handler    (io, 0xf7, 0xf7, 0, 0, systeme_bank_w );
2162}
2163
2164
2165
2166static void init_systeme_map(running_machine *machine)
2167{
2168   /* INIT THE MEMMAP / BANKING *********************************************************************************/
2169
2170   /* catch any addresses that don't get mapped */
2171//  memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
2172
2173   /* fixed rom bank area */
2174//  sms_rom = auto_alloc_array(machine, UINT8, 0xc000);
2175//  memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_UNMAP);
2176//  memory_set_bankptr(machine,  1, sms_rom );
2177
2178   memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000);
2179
2180   /* alternate way of accessing video ram */
2181   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, segasyse_videoram_w);
2182
2183
2184//  memcpy(sms_rom, memory_region(machine, "user1"), 0x8000);
2185
2186   /* main ram area */
2187   sms_mainram = auto_alloc_array(machine, UINT8, 0x4000);
2188   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2));
2189   memory_set_bankptr(machine,  2, sms_mainram );
2190   memset(sms_mainram,0x00,0x4000);
2191
2192   init_ports_systeme(machine);
2193}
2194
2195void init_for_megadrive(running_machine *machine)
2196{
2197   md_sms_vdp = (struct sms_vdp *)start_vdp(machine, GEN_VDP);
2198   md_sms_vdp->set_irq = sms_vdp_cpu1_irq_callback;
2199   md_sms_vdp->is_pal = 0;
2200   md_sms_vdp->sms_total_scanlines = 262;
2201   md_sms_vdp->sms_framerate = 60;
2202   md_sms_vdp->chip_id = 3;
2203}
2204
2205
2206
2207DRIVER_INIT( megatech_bios )
2208{
2209//  init_systeme_map(machine);
2210
2211   vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
2212   vdp1->set_irq = sms_vdp_cpu2_irq_callback;
2213   vdp1->is_pal = 0;
2214   vdp1->sms_total_scanlines = 262;
2215   vdp1->sms_framerate = 60;
2216   vdp1->chip_id = 1;
2217
2218   vdp1_vram_bank0 = vdp1->vram;
2219   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
2220}
2221
2222static DRIVER_INIT( segasyse )
2223{
2224   init_systeme_map(machine);
2225
2226   vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
2227//  vdp1->set_irq = sms_vdp_cpu0_irq_callback;
2228   vdp1->is_pal = 0;
2229   vdp1->sms_total_scanlines = 262;
2230   vdp1->sms_framerate = 60;
2231   vdp1->chip_id = 1;
2232
2233   vdp1_vram_bank0 = vdp1->vram;
2234   vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
2235
2236
2237   vdp2 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP);
2238   vdp2->set_irq = sms_vdp_cpu0_irq_callback;
2239   vdp2->is_pal = 0;
2240   vdp2->sms_total_scanlines = 262;
2241   vdp2->sms_framerate = 60;
2242   vdp2->chip_id = 2;
2243
2244   vdp2_vram_bank0 = vdp2->vram;
2245   vdp2_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000);
2246}
2247
2248905/*- Hang On Jr. Specific -*/
2249906static UINT8 port_fa_last;      /* Last thing written to port 0xfa (control related) */
2250907
src/mame/drivers/namcoic.c
r5955r5956
13431343   COMBINE_DATA( &rozcontrol16[offset] );
13441344} /* namco_rozcontrol16_w */
13451345
1346#ifdef UNUSED_FUNCTION
13461347READ16_HANDLER( namco_rozbank16_r )
13471348{
13481349   return rozbank16[offset];
r5955r5956
13611362      }
13621363   }
13631364} /* namco_rozbank16_w */
1365#endif
13641366
13651367static void
13661368writerozvideo( int offset, UINT16 data )
src/mame/drivers/gottlieb.c
r5955r5956
19871987   MDRV_CPU_MODIFY("maincpu")
19881988   MDRV_CPU_PROGRAM_MAP(reactor_map)
19891989
1990   MDRV_NVRAM_HANDLER(NULL)
1990   MDRV_NVRAM_HANDLER(0)
19911991
19921992   /* sound hardware */
19931993   MDRV_SOUND_ADD("samples", SAMPLES, 0)
src/mame/drivers/39in1.c
r5955r5956
14681468   for (i = 0; i < 0x80000; i += 2)
14691469   {
14701470      ROM[i] = BITSWAP8(ROM[i],7,2,5,6,0,3,1,4) ^ BITSWAP8((i>>3)&0xf, 3,2,4,1,4,4,0,4) ^ 0x90;
1471
1472// 60-in-1 decrypt
1473//          if ((i%2)==0)
1474//          {
1475//              ROM[i] = BITSWAP8(ROM[i],5,1,4,2,0,7,6,3)^BITSWAP8(i, 6,0,4,13,0,5,3,11);
1476//          }
14711477   }
14721478
14731479   pxa255_start(machine);
r5955r5956
15391545   ROM_LOAD16_WORD_SWAP( "93c66_eeprom.bin", 0x000, 0x200, CRC(a423a969) SHA1(4c68654c81e70367209b9f6c712564aae89a3122) )
15401546ROM_END
15411547
1542/*ROM_START( arm4in1 )
1543    // main program, encrypted
1544    ROM_REGION( 0x80000, "maincpu", 0 )
1545        ROM_LOAD( "27c4096_plz-v001_ver.300.bin", 0x000000, 0x080000, CRC(9149dbc4) SHA1(40efe1f654f11474f75ae7fee1613f435dbede38) )
1548ROM_START( 48in1 )
1549   // main program, encrypted
1550   ROM_REGION( 0x80000, "maincpu", 0 )
1551        ROM_LOAD( "hph_ver309",   0x000000, 0x080000, CRC(27023186) SHA1(a2b3770c4b03d6026c6a0ff2e62ab17c3b359b12) )
15461552
1547    // data ROM - contains a filesystem with ROMs, fonts, graphics, etc. in an unknown compressed format
1548    ROM_REGION32_LE( 0x200000, "data", 0 )
1553   // data ROM - contains a filesystem with ROMs, fonts, graphics, etc. in an unknown compressed format
1554   ROM_REGION32_LE( 0x200000, "data", 0 )
15491555        ROM_LOAD( "16mflash.bin", 0x000000, 0x200000, CRC(a089f0f8) SHA1(e975eadd9176a8b9e416229589dfe3158cba22cb) )
1550ROM_END*/
15511556
1552GAME(2004, 39in1, 0, 39in1, 39in1, 39in1, ROT270, "<unknown>", "39 in 1 MAME bootleg", GAME_IMPERFECT_SOUND)
1553//GAME(2004, arm4in1, 0, 39in1, 39in1, 0, ROT0, "<unknown>", "4 in 1 MAME bootleg", GAME_NOT_WORKING|GAME_NO_SOUND)
1557   // EEPROM - contains security data
1558   ROM_REGION( 0x200, "eeprom", 0 )
1559   ROM_LOAD16_WORD_SWAP( "93c66_eeprom.bin", 0x000, 0x200, NO_DUMP )
1560ROM_END
1561
1562ROM_START( 48in1a )
1563   // main program, encrypted
1564   ROM_REGION( 0x80000, "maincpu", 0 )
1565        ROM_LOAD( "ver302.u2",    0x000000, 0x080000, CRC(5ea25870) SHA1(66edc59a3d355bc3462e98d2062ada721c371af6) )
1566
1567   // data ROM - contains a filesystem with ROMs, fonts, graphics, etc. in an unknown compressed format
1568   ROM_REGION32_LE( 0x200000, "data", 0 )
1569        ROM_LOAD( "16mflash.bin", 0x000000, 0x200000, CRC(a089f0f8) SHA1(e975eadd9176a8b9e416229589dfe3158cba22cb) )
1570
1571   // EEPROM - contains security data
1572   ROM_REGION( 0x200, "eeprom", 0 )
1573   ROM_LOAD16_WORD_SWAP( "93c66_eeprom.bin", 0x000, 0x200, NO_DUMP )
1574ROM_END
1575
1576GAME(2004, 39in1,  0,     39in1, 39in1, 39in1, ROT270, "<unknown>", "39 in 1 MAME bootleg", GAME_IMPERFECT_SOUND)
1577GAME(2004, 48in1,  39in1, 39in1, 39in1, 39in1, ROT270, "<unknown>", "48 in 1 MAME bootleg (ver 3.09)", GAME_NOT_WORKING|GAME_IMPERFECT_SOUND)
1578GAME(2004, 48in1a, 39in1, 39in1, 39in1, 39in1, ROT270, "<unknown>", "48 in 1 MAME bootleg (ver 3.02)", GAME_NOT_WORKING|GAME_IMPERFECT_SOUND)
src/mame/drivers/cloud9.c
r5955r5956
115115static UINT8 irq_state;
116116static emu_timer *irq_timer;
117117
118int cloud9_vblank_start;
119int cloud9_vblank_end;
118static int cloud9_vblank_start;
119static int cloud9_vblank_end;
120120
121121
122122
src/mame/drivers/targeth.c
r5955r5956
207207
208208ROM_START( targeth )
209209   ROM_REGION( 0x100000, "maincpu", 0 )   /* 68000 code */
210   ROM_LOAD16_BYTE(   "targeth.c23",   0x000000, 0x040000, CRC(840887d6) SHA1(9a36b346608d531a62a2e0704ea44f12e07f9d91) )
211   ROM_LOAD16_BYTE(   "targeth.c22",   0x000001, 0x040000, CRC(d2435eb8) SHA1(ce75a115dad8019c8e66a1c3b3e15f54781f65ae) )
210   ROM_LOAD16_BYTE( "targeth.c23",   0x000000, 0x040000, CRC(840887d6) SHA1(9a36b346608d531a62a2e0704ea44f12e07f9d91) )
211   ROM_LOAD16_BYTE( "targeth.c22",   0x000001, 0x040000, CRC(d2435eb8) SHA1(ce75a115dad8019c8e66a1c3b3e15f54781f65ae) )
212212
213213   ROM_REGION( 0x200000, "gfx1", 0 )   /* Graphics */
214214   ROM_LOAD( "targeth.i13",   0x000000, 0x080000, CRC(b892be24) SHA1(9cccaaacf20e77c7358f0ceac60b8a1012f1216c) )
r5955r5956
223223   ROM_LOAD( "targeth.c3",      0x0c0000, 0x080000, CRC(d4c771df) SHA1(7cc0a86ef6aa3d26ab8f19d198f62112bf012870) )
224224ROM_END
225225
226GAME( 1994, targeth, 0, targeth,targeth, 0, ROT0, "Gaelco", "Target Hits", GAME_UNEMULATED_PROTECTION )
226ROM_START( targetha )
227   ROM_REGION( 0x100000, "maincpu", 0 )   /* 68000 code */
228   ROM_LOAD16_BYTE( "c23.bin",   0x000000, 0x040000, CRC(e38a54e2) SHA1(239bfa6f1c0fc8aa0ad7de9be237bef55b384007) )
229   ROM_LOAD16_BYTE( "c22.bin",   0x000001, 0x040000, CRC(24fe3efb) SHA1(8f48f08a6db28966c9263be119883c9179e349ed) )
230
231   ROM_REGION( 0x200000, "gfx1", 0 )   /* Graphics */
232   ROM_LOAD( "targeth.i13",   0x000000, 0x080000, CRC(b892be24) SHA1(9cccaaacf20e77c7358f0ceac60b8a1012f1216c) )
233   ROM_LOAD( "targeth.i11",   0x080000, 0x080000, CRC(6797faf9) SHA1(112cffe72f91cb46c262e19a47b0cab3237dd60f) )
234   ROM_LOAD( "targeth.i9",      0x100000, 0x080000, CRC(0e922c1c) SHA1(6920e345c82e76f7e0af6101f39eb65ac1f112b9) )
235   ROM_LOAD( "targeth.i7",      0x180000, 0x080000, CRC(d8b41000) SHA1(cbe91eb91bdc7a60b2333c6bea37d08a57902669) )
236
237   ROM_REGION( 0x140000, "oki", 0 )   /* ADPCM samples - sound chip is OKIM6295 */
238   ROM_LOAD( "targeth.c1",      0x000000, 0x080000, CRC(d6c9dfbc) SHA1(3ec70dea94fc89df933074012a52de6034571e87) )
239   /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
240   ROM_RELOAD(               0x040000, 0x080000 )
241   ROM_LOAD( "targeth.c3",      0x0c0000, 0x080000, CRC(d4c771df) SHA1(7cc0a86ef6aa3d26ab8f19d198f62112bf012870) )
242ROM_END
243
244GAME( 1994, targeth,  0,       targeth, targeth, 0, ROT0, "Gaelco", "Target Hits (ver 1.1)", GAME_UNEMULATED_PROTECTION )
245GAME( 1994, targetha, targeth, targeth, targeth, 0, ROT0, "Gaelco", "Target Hits (ver 1.0)", GAME_UNEMULATED_PROTECTION )
src/mame/drivers/sfbonus.c
r5955r5956
691691   int globalyscroll = (sfbonus_vregs[2] | sfbonus_vregs[3]<<8);
692692   int globalxscroll = (sfbonus_vregs[0] | sfbonus_vregs[1]<<8);
693693   UINT8* front_rowscroll = &sfbonus_videoram[0x200];
694   const input_port_token *ipt;
694695   int i;
695696
696697   // align to 0
r5955r5956
744745         }
745746      }
746747   }
747   /*
748#if 0
748749    popmessage("%02x %02x %02x %02x %02x %02x %02x %02x -- %02x -- %02x %02x -- %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
749750    sfbonus_3800_regs[0],
750751    sfbonus_3800_regs[1],
r5955r5956
782783    sfbonus_vregs[30],
783784    sfbonus_vregs[31]
784785    );
785    */
786786
787   /*
788787    popmessage("-- %02x %02x %02x %02x %02x %02x %02x %02x",
789788    sfbonus_1800_regs[0],
790789    sfbonus_1800_regs[1],
r5955r5956
794793    sfbonus_1800_regs[5],
795794    sfbonus_1800_regs[6],
796795    sfbonus_1800_regs[7]);
797    */
796#endif
798797
799   if ((screen->machine->gamedrv->ipt == ipt_amcoe2_reels3) || (screen->machine->gamedrv->ipt == ipt_amcoe2_reels4)
800      || (screen->machine->gamedrv->ipt == ipt_amcoe2_poker))
798   ipt = screen->machine->gamedrv->ipt;
799   if ((ipt == INPUT_PORTS_NAME(amcoe2_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe2_reels4))
800      || (ipt == INPUT_PORTS_NAME(amcoe2_poker)))
801801   {
802802      // based on pirpok2
803803      output_set_lamp_value(0, (sfbonus_1800_regs[6] & 0x1) >> 0);
r5955r5956
807807      output_set_lamp_value(4, (sfbonus_1800_regs[4] & 0x4) >> 2);
808808      output_set_lamp_value(5, (sfbonus_1800_regs[4] & 0x1) >> 0);
809809   }
810   else if ((screen->machine->gamedrv->ipt == ipt_amcoe1_reels3) || (screen->machine->gamedrv->ipt == ipt_amcoe1_reels4)
811      || (screen->machine->gamedrv->ipt == ipt_amcoe1_poker))
810   else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4))
811      || (ipt == INPUT_PORTS_NAME(amcoe1_poker)))
812812   {
813813      output_set_lamp_value(0, (sfbonus_1800_regs[0] & 0x2) >> 1);
814814      output_set_lamp_value(1, (sfbonus_1800_regs[4] & 0x2) >> 1);
src/mame/drivers/twinkle.c
r5955r5956
257257      }
258258   }
259259
260   nvram_handler_i2cmem_0( machine, file, read_or_write );
260   NVRAM_HANDLER_CALL(i2cmem_0);
261261}
262262
263263static UINT32 twinkle_unknown;
src/mame/drivers/multfish.c
r5955r5956
1818  Turn Service Mode OFF (press 'F2')
1919  Reset the game (press 'F3')
2020
21  To Init Roll Fruit
2122
23  Turn Service Mode ON (press 'F2')
24  Press and hold Service 1 ('9')
25  Reset the game (press 'F3')
26  Use Service 2 ('0') to move pointer to INIT
27  Hold Service 1 ('9') for 5 seconds
28  Turn Service Mode OFF (press 'F2')
29
2230  Todo:
2331  -------------------------------------------------------------------------
24  Payout doesn't currently work and causes 'Call Attendant' to be displayed
2532  Hook up Lamps
2633  Emulate the RTC (real time clock)
2734
r5955r5956
210217   return video_screen_get_vpos(space->machine->primary_screen);
211218}
212219
220static UINT8 multfish_hopper_motor = 0;
221static UINT8 multfish_hopper = 0;
213222
223static CUSTOM_INPUT( multfish_hopper_r )
224{
225   if ( multfish_hopper_motor != 0 )
226   {
227         multfish_hopper++;
228         return multfish_hopper>>4;
229   }
230   else
231   {
232         return 0;
233   }
234}
214235
236static WRITE8_HANDLER( multfish_port33_w )
237{
238   multfish_hopper_motor = data & 0x10; //0x10 Hopper Motor (33B)
239}
240
241
215242static ADDRESS_MAP_START( multfish_map, ADDRESS_SPACE_PROGRAM, 8 )
216243   AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_ROM, multfish_vid_w)
217244   AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM )
r5955r5956
239266   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) // unused?
240267
241268   PORT_START("IN1")
242   PORT_DIPNAME(     0x01, 0x01, "Hopper SW (22 B)" )
243   PORT_DIPSETTING(  0x01, DEF_STR( Off ) )
244   PORT_DIPSETTING(  0x00, DEF_STR( On ) )
269   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B)
245270   PORT_DIPNAME(     0x02, 0x02, "BK Door (17 A)"  )
246271   PORT_DIPSETTING(  0x02, DEF_STR( Off ) )
247272   PORT_DIPSETTING(  0x00, DEF_STR( On ) )
r5955r5956
335360   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) // unused?
336361INPUT_PORTS_END
337362
363static INPUT_PORTS_START( rollfr )
364   PORT_START("IN0")
365   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
366   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // COIN B (18 B)
367   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
338368
369   PORT_START("IN1")
370   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B)
371   PORT_DIPNAME(     0x02, 0x02, "BK Door (17 A)"  )
372   PORT_DIPSETTING(  0x02, DEF_STR( Off ) )
373   PORT_DIPSETTING(  0x00, DEF_STR( On ) )
374   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
375
376   PORT_START("IN2")
377   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
378
379   PORT_START("IN3")
380   PORT_DIPNAME(     0x08, 0x08, "Hopper Inhibit (08 B)" )
381   PORT_DIPSETTING(  0x08, DEF_STR( Off ) )
382   PORT_DIPSETTING(  0x00, DEF_STR( On ) )
383   PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNUSED )
384
385   PORT_START("IN4")
386   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
387
388   PORT_START("IN5")
389   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) //Service SW (20 B)
390   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
391
392   PORT_START("IN6")
393   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) //Statistic SW (20 A)
394   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
395
396   PORT_START("IN7")
397   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
398   PORT_SERVICE( 0x02, IP_ACTIVE_LOW ) // Fr Door (16 A)
399   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
400INPUT_PORTS_END
401
402
339403static WRITE8_HANDLER( multfish_f3_w )
340404{
341405   //popmessage("multfish_f3_w %02x",data);
r5955r5956
363427//  AM_RANGE(0x30, 0x30) AM_WRITE(multfish_port30_w)
364428//  AM_RANGE(0x31, 0x31) AM_WRITE(multfish_port31_w)
365429//  AM_RANGE(0x32, 0x32) AM_WRITE(multfish_port32_w)
366//  AM_RANGE(0x33, 0x33) AM_WRITE(multfish_port33_w)
430   AM_RANGE(0x33, 0x33) AM_WRITE(multfish_port33_w) //0x10 Hopper Motor (33B)
367431//  AM_RANGE(0x34, 0x34) AM_WRITE(multfish_port34_w)
368432//  AM_RANGE(0x35, 0x35) AM_WRITE(multfish_port35_w)
369433//  AM_RANGE(0x36, 0x36) AM_WRITE(multfish_port36_w)
r5955r5956
639703   ROM_LOAD( "mf031124.rom", 0x00000, 0x40000, MD5(9cd800719c6e4a2267e3c140467238d3) SHA1(c0d1b541c4b076bbc810ad637acb4a2663a919ba) )
640704
641705   ROM_REGION( 0x400000, "gfx", 0 )
706   ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) )
642707   ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) )
643708   ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) )
644709   ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) )
r5955r5956
654719   ROM_LOAD( "mf040308.rom", 0x00000, 0x40000, CRC(adb9c1d9) SHA1(88c69f48766dc7c98a6f03c1a0a4aa63b76560b6) )
655720
656721   ROM_REGION( 0x400000, "gfx", 0 )
722   ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) )
657723   ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) )
658724   ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) )
659725   ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) )
r5955r5956
668734   ROM_LOAD( "mf040308a.rom", 0x00000, 0x40000, CRC(44537648) SHA1(7bce6085778ff0b21c052ae91703de3b78b8eed0) ) /* Not officially listed on Igrosoft's web site hash page */
669735
670736   ROM_REGION( 0x400000, "gfx", 0 )
737   ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) )
671738   ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) )
672739   ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) )
673740   ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) )
r5955r5956
683750   ROM_LOAD( "mf040316.rom", 0x00000, 0x40000, MD5(66019927201954518261652147b05e43) SHA1(c1f4d1c51632a45b533d19c8b6f63d337d84d9cd) )
684751
685752   ROM_REGION( 0x400000, "gfx", 0 )
753   ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) )
686754   ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) )
687755   ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) )
688756   ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) )
r5955r5956
17821850#endif
17831851
17841852#if ALL_REVISIONS
1785GAME( 2003, rollfr,      0,        multfish, multfish,  0, ROT0, "Igrosoft", "Roll Fruit (030821)",  0 )
1853GAME( 2003, rollfr,      0,        multfish, rollfr,    0, ROT0, "Igrosoft", "Roll Fruit (030821)",  0 )
17861854#endif
1787GAME( 2003, rollfr_2,    0,        multfish, multfish,  0, ROT0, "Igrosoft", "Roll Fruit (040318)",  0 )
1855GAME( 2003, rollfr_2,    0,        multfish, rollfr,    0, ROT0, "Igrosoft", "Roll Fruit (040318)",  0 )
17881856
17891857GAME( 2004, garage_4,    0,        multfish, multfish,  0, ROT0, "Igrosoft", "Garage (040219, set 1)",  0 )
17901858GAME( 2004, garage_4a,   garage_4, multfish, multfish,  0, ROT0, "Igrosoft", "Garage (040219, set 2)",  0 )
src/mame/drivers/midtunit.c
r5955r5956
784784ROM_END
785785
786786
787ROM_START( mk2r31e )
788   ROM_REGION16_LE( 0xc00000, "dcs", ROMREGION_ERASEFF )   /* sound data */
789   ROM_LOAD16_BYTE( "su2.l1", 0x000000, 0x80000, CRC(5f23d71d) SHA1(54c2afef243759e0f3dbe2907edbc4302f5c8bad) )
790   ROM_RELOAD(                  0x100000, 0x80000 )
791   ROM_LOAD16_BYTE( "su3.l1", 0x200000, 0x80000, CRC(d6d92bf9) SHA1(397351c6b707f2595e36360471015f9fa494e894) )
792   ROM_RELOAD(                  0x300000, 0x80000 )
793   ROM_LOAD16_BYTE( "su4.l1", 0x400000, 0x80000, CRC(eebc8e0f) SHA1(705ab63ff7672a4857d546afda6dca4973cce1ad) )
794   ROM_RELOAD(                  0x500000, 0x80000 )
795   ROM_LOAD16_BYTE( "su5.l1", 0x600000, 0x80000, CRC(2b0b7961) SHA1(1cdc64aab74d14afbd8c3531e3d0bd49271a281f) )
796   ROM_RELOAD(                  0x700000, 0x80000 )
797   ROM_LOAD16_BYTE( "su6.l1", 0x800000, 0x80000, CRC(f694b27f) SHA1(d43e38a124665f49ebb4ffc5a55e8f19a1a64686) )
798   ROM_RELOAD(                  0x900000, 0x80000 )
799   ROM_LOAD16_BYTE( "su7.l1", 0xa00000, 0x80000, CRC(20387e0a) SHA1(505d05173b2a1f1ee3ebc2898ccd3a95c98dd04a) )
800   ROM_RELOAD(                  0xb00000, 0x80000 )
801   /* su8 and su9 are unpopulated */
802
803   ROM_REGION16_LE( 0x100000, "user1", 0 )   /* 34010 code */
804   ROM_LOAD16_BYTE( "uj12.e31", 0x00000, 0x80000, CRC(f64306d1) SHA1(b1fb8d59400a411498a56a740a7b35e4687ecebd) )
805   ROM_LOAD16_BYTE( "ug12.e31", 0x00001, 0x80000, CRC(4adeae7e) SHA1(4c9e5c7df3f86cc5c97c7fb70d4acca71d65cab5) )
806
807   ROM_REGION( 0xc00000, "gfx1", 0 )
808   ROM_LOAD( "ug14-vid", 0x000000, 0x100000, CRC(01e73af6) SHA1(6598cfd704cc92a7f358a0e1f1c973ab79dcc493) )
809   ROM_LOAD( "ug16-vid", 0x100000, 0x100000, CRC(8ba6ae18) SHA1(465fe907de4a1e502180c4e41642998dd3abc8e6) )
810   ROM_LOAD( "ug17-vid", 0x200000, 0x100000, CRC(937d8620) SHA1(8b9f80a460b124a747a6d1495b53f01f580e28f1) )
811
812   ROM_LOAD( "uj14-vid", 0x300000, 0x100000, CRC(d4985cbb) SHA1(367865da7efae38d83de3c0868d02a705177ae63) )
813   ROM_LOAD( "uj16-vid", 0x400000, 0x100000, CRC(39d885b4) SHA1(2251826d247c3c6df421124718401fb35a672f83) )
814   ROM_LOAD( "uj17-vid", 0x500000, 0x100000, CRC(218de160) SHA1(87aea173720d2a33d8183903f4fe8ba1d47e3348) )
815
816   ROM_LOAD( "ug19-vid", 0x600000, 0x100000, CRC(fec137be) SHA1(f11ecb8a7993f5c4f4449564b4911f69bd6e9bf8) )
817   ROM_LOAD( "ug20-vid", 0x700000, 0x100000, CRC(809118c1) SHA1(86153e648834c749e34573151cd4fee403a81962) )
818   ROM_LOAD( "ug22-vid", 0x800000, 0x100000, CRC(154d53b1) SHA1(58ff0aa59101f40a9a3b5fbae1c904d0b0b31612) )
819
820   ROM_LOAD( "uj19-vid", 0x900000, 0x100000, CRC(2d763156) SHA1(06536006da49ab5fb6b75b25f801b83fad000ff5) )
821   ROM_LOAD( "uj20-vid", 0xa00000, 0x100000, CRC(b96824f0) SHA1(d42b122f9a57da330192abc7e5f97abc4065d718) )
822   ROM_LOAD( "uj22-vid", 0xb00000, 0x100000, CRC(8891d785) SHA1(fd460df1ef8f4306ea42f7dc41488a80fd2c8f53) )
823ROM_END
824
825
787826ROM_START( mk2r32 )
788827   ROM_REGION16_LE( 0xc00000, "dcs", ROMREGION_ERASEFF )   /* sound data */
789828   ROM_LOAD16_BYTE( "su2.l1", 0x000000, 0x80000, CRC(5f23d71d) SHA1(54c2afef243759e0f3dbe2907edbc4302f5c8bad) )
r5955r5956
13541393GAME( 1992, mktturbo,  mk,     tunit_adpcm, mk,       mkturbo,  ROT0, "hack",     "Mortal Kombat (Turbo Ninja T-Unit 03/19/93, hack)", GAME_SUPPORTS_SAVE )
13551394
13561395GAME( 1993, mk2,      0,       tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.1)", GAME_SUPPORTS_SAVE )
1396GAME( 1993, mk2r31e,  mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.1 (European))", GAME_SUPPORTS_SAVE )
13571397GAME( 1993, mk2r32,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.2 (European))", GAME_SUPPORTS_SAVE )
13581398GAME( 1993, mk2r30,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.0)", GAME_SUPPORTS_SAVE )
13591399GAME( 1993, mk2r21,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L2.1)", GAME_SUPPORTS_SAVE )
src/mame/drivers/suprnova.c
r5955r5956
10951095   ROM_LOAD( "gp430000.u4", 0x000000, 0x200000, CRC(8374663a) SHA1(095512564f4de25dc3752d9fbd254b9dabd16d1b) )
10961096ROM_END
10971097
1098ROM_START( galpani4k )
1099   ROM_REGION( 0x080000, "maincpu", 0 ) /* SH-2 Code */
1100   ROM_LOAD       ( "sknsk1.u10",   0x000000, 0x080000, CRC(ff1c9f79) SHA1(a51e598d43e76d37da69b1f094c111273bdfc94a) ) /* Korean BIOS */
1101
1102   ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */
1103   ROM_LOAD16_BYTE( "gp4k1.u10", 0x000000, 0x080000, CRC(cbd5c3a0) SHA1(17fc0d6f6050ffd31707cee3fcc263cd5b9d0c4f) )
1104   ROM_LOAD16_BYTE( "gp4k1.u8",  0x000001, 0x080000, CRC(7a95bfe2) SHA1(82e24fd4674ec25bc6608ced0921e8573fcff2c2) )
1105
1106   ROM_REGION( 0x400000, "gfx1", 0 )
1107   ROM_LOAD( "gp410000.u24", 0x000000, 0x200000, CRC(1df61f01) SHA1(a9e95bbb3013e8f2fd01243b1b392ff07b4f7d02) )
1108   ROM_LOAD( "gp410100.u20", 0x200000, 0x100000, CRC(8e2c9349) SHA1(a58fa9bcc9684ed4558e3395d592b64a1978a902) )
1109
1110   ROM_REGION( 0x400000, "gfx2", 0 )
1111   ROM_LOAD( "gp420000.u16", 0x000000, 0x200000, CRC(f0781376) SHA1(aeab9553a9af922524e528eb2d019cf36b6e2094) )
1112   ROM_LOAD( "gp420100.u18", 0x200000, 0x200000, CRC(10c4b183) SHA1(80e05f3932495ad4fc9bf928fa66e6d2931bbb06) )
1113
1114   ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */
1115   /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */
1116   /* 0x040000 - 0x3fffff empty? */
1117
1118   ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */
1119   ROM_LOAD( "gp430000.u4", 0x000000, 0x200000, CRC(8374663a) SHA1(095512564f4de25dc3752d9fbd254b9dabd16d1b) )
1120ROM_END
1121
10981122ROM_START( galpanis )
10991123   ROM_REGION( 0x080000, "maincpu", 0 ) /* SH-2 Code */
11001124   ROM_LOAD       ( "sknsj1.u10",   0x000000, 0x080000, CRC(7e2b836c) SHA1(92c5a7a2472496028bff0e5980d41dd294f42144) ) /* Japan BIOS */
r5955r5956
16331657GAME( 1996, skns,      0,        skns, skns,     0,         ROT0,  "Kaneko", "Super Kaneko Nova System BIOS", GAME_IS_BIOS_ROOT )
16341658
16351659GAME( 1996, galpani4,  skns,     skns, cyvern,   galpani4,  ROT0,  "Kaneko", "Gals Panic 4 (Japan)", GAME_IMPERFECT_GRAPHICS )
1660GAME( 1996, galpani4k, galpani4, skns, cyvern,   galpani4,  ROT0,  "Kaneko", "Gals Panic 4 (Korea)", GAME_IMPERFECT_GRAPHICS )
16361661GAME( 1996, jjparads,  skns,     skns, skns_1p,  jjparads,  ROT0,  "Electro Design", "Jan Jan Paradise", GAME_IMPERFECT_GRAPHICS )
16371662GAME( 1997, galpanis,  skns,     skns, galpanis, galpanis,  ROT0,  "Kaneko", "Gals Panic S - Extra Edition (Japan)", GAME_IMPERFECT_GRAPHICS )
16381663GAME( 1997, jjparad2,  skns,     skns, skns_1p,  jjparad2,  ROT0,  "Electro Design", "Jan Jan Paradise 2", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/megadriv.c
r5955r5956
16541654
16551655static void megadrive_init_io(running_machine *machine)
16561656{
1657   const input_port_token *ipt = machine->gamedrv->ipt;
1658
16571659   megadrive_io_data_regs[0] = 0x7f;
16581660   megadrive_io_data_regs[1] = 0x7f;
16591661   megadrive_io_data_regs[2] = 0x7f;
r5955r5956
16641666   megadrive_io_tx_regs[1] = 0xff;
16651667   megadrive_io_tx_regs[2] = 0xff;
16661668
1667   if (machine->gamedrv->ipt == ipt_megadri6)
1669   if (ipt == INPUT_PORTS_NAME(megadri6))
16681670      init_megadri6_io(machine);
16691671
1670   if (machine->gamedrv->ipt == ipt_ssf2ghw)
1672   if (ipt == INPUT_PORTS_NAME(ssf2ghw))
16711673      init_megadri6_io(machine);
16721674}
16731675
r5955r5956
17731775   return retdata;
17741776}
17751777
1776/* the SMS inputs should be more complex, like the megadrive ones */
1777READ8_HANDLER (megatech_sms_ioport_dc_r)
1778{
1779   running_machine *machine = space->machine;
1780   /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */
1781   /* bit 4: TL-A; bit 5: TR-A */
1782   return (input_port_read(machine, "PAD1") & 0x3f) | ((input_port_read(machine, "PAD2") & 0x03) << 6);
1783}
1784
1785READ8_HANDLER (megatech_sms_ioport_dd_r)
1786{
1787   running_machine *machine = space->machine;
1788   /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */
1789   /* bit 2: TL-B; bit 3: TR-B; bit 4: RESET; bit 5: unused; bit 6: TH-A; bit 7: TH-B*/
1790   return ((input_port_read(machine, "PAD2") & 0x3c) >> 2) | 0x10;
1791}
1792
17931778static UINT8 megadrive_io_read_ctrl_port(int portnum)
17941779{
17951780   UINT8 retdata;
r5955r5956
62126197
62136198static void megadriv_init_common(running_machine *machine)
62146199{
6200   const input_port_token *ipt = machine->gamedrv->ipt;
6201
62156202   /* Look to see if this system has the standard Sound Z80 */
62166203   _genesis_snd_z80_cpu = cputag_get_cpu(machine, "genesis_snd_z80");
62176204   if (_genesis_snd_z80_cpu != NULL)
r5955r5956
62666253
62676254   m68k_set_tas_callback(cputag_get_cpu(machine, "maincpu"), megadriv_tas_callback);
62686255
6269   if ((machine->gamedrv->ipt==ipt_megadri6) || (machine->gamedrv->ipt==ipt_ssf2ghw))
6256   if ((ipt == INPUT_PORTS_NAME(megadri6)) || (ipt == INPUT_PORTS_NAME(ssf2ghw)))
62706257   {
62716258      megadrive_io_read_data_port_ptr   = megadrive_io_read_data_port_6button;
62726259      megadrive_io_write_data_port_ptr = megadrive_io_write_data_port_6button;
r5955r5956
63836370
63846371
63856372/* sets the megadrive z80 to it's normal ports / map */
6386void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine)
6373void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine, const char* tag)
63876374{
63886375   const device_config *ym = devtag_get_device(machine, "ym");
63896376
63906377   /* INIT THE PORTS *********************************************************************************************/
6391   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
6378   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
63926379
63936380   /* catch any addresses that don't get mapped */
6394   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
6381   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
63956382
63966383
6397   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1));
6384   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1));
63986385   memory_set_bankptr(machine,  1, genz80.z80_prgram );
63996386
6400   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6));
6387   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6));
64016388   memory_set_bankptr(machine,  6, genz80.z80_prgram );
64026389
64036390
64046391   // not allowed??
6405//  memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1));
6392//  memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1));
64066393
6407   memory_install_readwrite8_device_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w);
6408   memory_install_write8_handler    (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w);
6409   memory_install_write8_handler    (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w);
6410   memory_install_read8_handler     (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read);
6411   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write);
6412   memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data);
6394   memory_install_readwrite8_device_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w);
6395   memory_install_write8_handler    (cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w);
6396   memory_install_write8_handler    (cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w);
6397   memory_install_read8_handler     (cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read);
6398   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write);
6399   memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data);
64136400}
64146401
64156402// these are tests for 'special case' hardware to make sure I don't break anything while rearranging things
src/mame/drivers/megadriv.h
r5955r5956
2525extern UINT8 megatech_bios_port_cc_dc_r(running_machine *machine, int offset, int ctrl);
2626extern void megadriv_stop_scanline_timer(void);
2727
28void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine);
28void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine, const char* tag);
2929
3030extern READ8_HANDLER (megatech_sms_ioport_dc_r);
3131extern READ8_HANDLER (megatech_sms_ioport_dd_r);
src/mame/drivers/galpanic.c
r5955r5956
919919
920920   /* video hardware */
921921   MDRV_VIDEO_UPDATE(comad)
922   MDRV_VIDEO_EOF(NULL)
922   MDRV_VIDEO_EOF(0)
923923MACHINE_DRIVER_END
924924
925925static MACHINE_DRIVER_START( supmodel )
r5955r5956
932932
933933   /* video hardware */
934934   MDRV_VIDEO_UPDATE(comad)
935   MDRV_VIDEO_EOF(NULL)
935   MDRV_VIDEO_EOF(0)
936936
937937   /* sound hardware */
938938   MDRV_SOUND_REPLACE("oki", OKIM6295, 1584000)
r5955r5956
950950
951951   /* video hardware */
952952   MDRV_VIDEO_UPDATE(comad)
953   MDRV_VIDEO_EOF(NULL)
953   MDRV_VIDEO_EOF(0)
954954MACHINE_DRIVER_END
955955
956956static MACHINE_DRIVER_START( galhustl )
r5955r5956
963963
964964   /* video hardware */
965965   MDRV_VIDEO_UPDATE(comad)
966   MDRV_VIDEO_EOF(NULL)
966   MDRV_VIDEO_EOF(0)
967967
968968   /* sound hardware */
969969   MDRV_SOUND_REPLACE("oki", OKIM6295, 1056000)
src/mame/drivers/namcona1.c
r5955r5956
167167
168168static UINT16 *mpBank0, *mpBank1;
169169static int mEnableInterrupts;
170int namcona1_gametype;
170static int namcona1_gametype;
171171
172172/*************************************************************************/
173173
src/mame/drivers/seicross.c
r5955r5956
447447   MDRV_CPU_MODIFY("mcu")
448448   MDRV_CPU_PROGRAM_MAP(mcu_no_nvram_map)
449449
450   MDRV_NVRAM_HANDLER(NULL)
450   MDRV_NVRAM_HANDLER(0)
451451MACHINE_DRIVER_END
452452
453453
src/mame/drivers/cps1.c
r5955r5956
345345
346346static UINT8 *qsound_sharedram1,*qsound_sharedram2;
347347
348INTERRUPT_GEN( cps1_qsound_interrupt )
348static INTERRUPT_GEN( cps1_qsound_interrupt )
349349{
350350   cpu_set_input_line(device, 2, HOLD_LINE);
351351}
r5955r5956
458458}
459459#endif
460460
461READ16_HANDLER( cps1_eeprom_port_r )
461static READ16_HANDLER( cps1_eeprom_port_r )
462462{
463463   return eeprom_read_bit();
464464}
465465
466WRITE16_HANDLER( cps1_eeprom_port_w )
466static WRITE16_HANDLER( cps1_eeprom_port_w )
467467{
468468   if (ACCESSING_BITS_0_7)
469469   {
r5955r5956
56445644   ROM_LOAD( "01.bin",    0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
56455645ROM_END
56465646
5647ROM_START( sf2qp1 )
5648   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
5649   ROM_LOAD16_WORD_SWAP( "stfii-qkn-cps-17.33", 0x000000, 0x40000, CRC(3a9458ee) SHA1(cbf56115c22a45e5ce1cde313fa5a5ba496316eb) )
5650   ROM_CONTINUE(              0xc0000, 0x40000 )
5651   ROM_LOAD16_WORD_SWAP( "stfii-qkn-cps-17.34", 0x080000, 0x40000, CRC(4ed215d8) SHA1(b09075f883c3a4976ab47203acc04f8f993969a8) )
5652   ROM_CONTINUE(              0x40000, 0x40000 )
5653
5654   ROM_REGION( 0x600000, "gfx", 0 )
5655   ROMX_LOAD( "sf2_06.bin", 0x000000, 0x80000, CRC(22c9cc8e) SHA1(b9194fb337b30502c1c9501cd6c64ae4035544d4) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx02.rom */
5656   ROMX_LOAD( "sf2_08.bin", 0x000002, 0x80000, CRC(57213be8) SHA1(3759b851ac0904ec79cbb67a2264d384b6f2f9f9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx04.rom */
5657   ROMX_LOAD( "sf2_05.bin", 0x000004, 0x80000, CRC(ba529b4f) SHA1(520840d727161cf09ca784919fa37bc9b54cc3ce) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx01.rom */
5658   ROMX_LOAD( "sf2_07.bin", 0x000006, 0x80000, CRC(4b1b33a8) SHA1(2360cff890551f76775739e2d6563858bff80e41) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx03.rom */
5659   ROMX_LOAD( "sf2_15.bin", 0x200000, 0x80000, CRC(2c7e2229) SHA1(357c2275af9133fd0bd6fbb1fa9ad5e0b490b3a2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx11.rom */
5660   ROMX_LOAD( "sf2_17.bin", 0x200002, 0x80000, CRC(b5548f17) SHA1(baa92b91cf616bc9e2a8a66adc777ffbf962a51b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx13.rom */
5661   ROMX_LOAD( "sf2_14.bin", 0x200004, 0x80000, CRC(14b84312) SHA1(2eea16673e60ba7a10bd4d8f6c217bb2441a5b0e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx10.rom */
5662   ROMX_LOAD( "sf2_16.bin", 0x200006, 0x80000, CRC(5e9cd89a) SHA1(f787aab98668d4c2c54fc4ba677c0cb808e4f31e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx12.rom */
5663   ROMX_LOAD( "sf2_25.bin", 0x400000, 0x80000, CRC(994bfa58) SHA1(5669b845f624b10e7be56bfc89b76592258ce48b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx21.rom */
5664   ROMX_LOAD( "sf2_27.bin", 0x400002, 0x80000, CRC(3e66ad9d) SHA1(9af9df0826988872662753e9717c48d46f2974b0) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx23.rom */
5665   ROMX_LOAD( "sf2_24.bin", 0x400004, 0x80000, CRC(c1befaa8) SHA1(a6a7f4725e52678cbd8d557285c01cdccb2c2602) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx20.rom */
5666   ROMX_LOAD( "sf2_26.bin", 0x400006, 0x80000, CRC(0627c831) SHA1(f9a92d614e8877d648449de2612fc8b43c85e4c2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx22.rom */
5667
5668   ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
5669   ROM_LOAD( "sf2_09.bin",    0x00000, 0x08000, CRC(a4823a1b) SHA1(7b6bf59dfd578bfbbdb64c27988796783442d659) )
5670   ROM_CONTINUE(              0x10000, 0x08000 )
5671
5672   ROM_REGION( 0x40000, "oki", 0 )   /* Samples */
5673   ROM_LOAD( "sf2_18.bin",    0x00000, 0x20000, CRC(7f162009) SHA1(346bf42992b4c36c593e21901e22c87ae4a7d86d) )
5674   ROM_LOAD( "sf2_19.bin",    0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
5675
5676   ROM_REGION( 0x0200, "aboardplds", 0 )
5677   ROM_LOAD( "buf1",         0x0000, 0x0117, CRC(eb122de7) SHA1(b26b5bfe258e3e184f069719f9fd008d6b8f6b9b) )
5678   ROM_LOAD( "ioa1",         0x0000, 0x0117, CRC(59c7ee3b) SHA1(fbb887c5b4f5cb8df77cec710eaac2985bc482a6) )
5679   ROM_LOAD( "prg1",         0x0000, 0x0117, CRC(f1129744) SHA1(a5300f301c1a08a7da768f0773fa0fe3f683b237) )
5680   ROM_LOAD( "rom1",         0x0000, 0x0117, CRC(41dc73b9) SHA1(7d4c9f1693c821fbf84e32dd6ef62ddf14967845) )
5681   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
5682ROM_END
5683
56475684/* B-Board 89624B */
56485685ROM_START( 3wonders )
56495686   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
r5955r5956
66306667   ROM_LOAD( "s92_19.bin",    0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
66316668ROM_END
66326669
6670ROM_START( sf2acc )
6671   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
6672   ROM_LOAD16_WORD_SWAP( "sf2ca_23-c.bin", 0x000000, 0x80000, CRC(e7c8c5a6) SHA1(247fb38c041f4d516899db32545d8b4d8debc4cf) )
6673   ROM_LOAD16_WORD_SWAP( "sf2ca_22-c.bin", 0x080000, 0x80000, CRC(99f1cca4) SHA1(64111eba81d743fc3fd51d7a89cd0b2eefcc900d) )
6674   ROM_LOAD16_WORD_SWAP( "sf2ca_21-c.bin", 0x100000, 0x40000, CRC(cf7fcc8c) SHA1(47d338634dd72d1ef912fbdb8c1a7ae945ca1a5f) )
6675
6676   ROM_REGION( 0x600000, "gfx", 0 )
6677   ROMX_LOAD( "s92_01.bin",   0x000000, 0x80000, CRC(03b0d852) SHA1(f370f25c96ad2b94f8c53d6b7139100285a25bef) , ROM_GROUPWORD | ROM_SKIP(6) )
6678   ROMX_LOAD( "s92_02.bin",   0x000002, 0x80000, CRC(840289ec) SHA1(2fb42a242f60ba7e74009b5a90eb26e035ba1e82) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.03 */
6679   ROMX_LOAD( "s92_03.bin",   0x000004, 0x80000, CRC(cdb5f027) SHA1(4c7d944fef200fdfcaf57758b901b5511188ed2e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.02 */
6680   ROMX_LOAD( "s92_04.bin",   0x000006, 0x80000, CRC(e2799472) SHA1(27d3796429338d82a8de246a0ea06dd487a87768) , ROM_GROUPWORD | ROM_SKIP(6) )
6681   ROMX_LOAD( "s92_05.bin",   0x200000, 0x80000, CRC(ba8a2761) SHA1(4b696d66c51611e43522bed752654314e76d33b6) , ROM_GROUPWORD | ROM_SKIP(6) )
6682   ROMX_LOAD( "s92_06.bin",   0x200002, 0x80000, CRC(e584bfb5) SHA1(ebdf1f5e2638eed3a65dda82b1ed9151a355f4c9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.07 */
6683   ROMX_LOAD( "s92_07.bin",   0x200004, 0x80000, CRC(21e3f87d) SHA1(4a4961bb68c3a1ce15f9d393d9c03ecb2466cc29) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.06 */
6684   ROMX_LOAD( "s92_08.bin",   0x200006, 0x80000, CRC(befc47df) SHA1(520390420da3a0271ba90b0a933e65143265e5cf) , ROM_GROUPWORD | ROM_SKIP(6) )
6685   ROMX_LOAD( "s92_10.bin",   0x400000, 0x80000, CRC(960687d5) SHA1(2868c31121b1c7564e9767b9a19cdbf655c7ed1d) , ROM_GROUPWORD | ROM_SKIP(6) )
6686   ROMX_LOAD( "s92_11.bin",   0x400002, 0x80000, CRC(978ecd18) SHA1(648a59706b93c84b4206a968ecbdc3e834c476f6) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.11 */
6687   ROMX_LOAD( "s92_12.bin",   0x400004, 0x80000, CRC(d6ec9a0a) SHA1(ed6143f8737013b6ef1684e37c05e037e7a80dae) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.12 */
6688   ROMX_LOAD( "s92_13.bin",   0x400006, 0x80000, CRC(ed2c67f6) SHA1(0083c0ffaf6fe7659ff0cf822be4346cd6e61329) , ROM_GROUPWORD | ROM_SKIP(6) )
6689
6690   ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
6691   ROM_LOAD( "s92_09.bin",    0x00000, 0x08000, CRC(08f6b60e) SHA1(8258fcaca4ac419312531eec67079b97f471179c) )
6692   ROM_CONTINUE(              0x10000, 0x08000 )
6693
6694   ROM_REGION( 0x40000, "oki", 0 )   /* Samples */
6695   ROM_LOAD( "s92_18.bin",    0x00000, 0x20000, CRC(7f162009) SHA1(346bf42992b4c36c593e21901e22c87ae4a7d86d) )
6696   ROM_LOAD( "s92_19.bin",    0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
6697ROM_END
6698
66336699ROM_START( sf2accp2 )
66346700   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
66356701   ROM_LOAD16_WORD_SWAP( "sf2ca-23.bin", 0x000000, 0x80000, CRC(36c3ba2f) SHA1(a3ddc479b725ddb3521757c8efa7aed125004997) )
r5955r5956
86568722GAME( 1991, sf2j,     sf2,      cps1_10MHz, sf2j,     cps1,     ROT0,   "Capcom", "Street Fighter II - The World Warrior (Japan 911210)", 0 )
86578723GAME( 1991, sf2ja,    sf2,      cps1_10MHz, sf2j,     cps1,     ROT0,   "Capcom", "Street Fighter II - The World Warrior (Japan 910214)", 0 )
86588724GAME( 1991, sf2jc,    sf2,      cps1_10MHz, sf2j,     cps1,     ROT0,   "Capcom", "Street Fighter II - The World Warrior (Japan 910306)", 0 )
8725GAME( 1991, sf2qp1,   sf2,      cps1_10MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II - The World Warrior (Quicken Pt-I, bootleg)" , 0)      // 910214
86598726GAME( 1991, 3wonders, 0,        cps1_10MHz, 3wonders, cps1,     ROT0,   "Capcom", "Three Wonders (World 910520)" , 0)               // "ETC"
86608727GAME( 1991, 3wondersu,3wonders, cps1_10MHz, 3wonders, cps1,     ROT0,   "Capcom", "Three Wonders (US 910520)", 0 )
86618728GAME( 1991, wonder3,  3wonders, cps1_10MHz, 3wonders, cps1,     ROT0,   "Capcom", "Wonder 3 (Japan 910520)", 0 )
r5955r5956
86818748GAME( 1992, sf2rb3,   sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II' - Champion Edition (Rainbow set 3, bootleg)" , 0)
86828749GAME( 1992, sf2red,   sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II' - Champion Edition (Red Wave, bootleg)" , 0)      // 920313 - based on World version
86838750GAME( 1992, sf2v004,  sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II! - Champion Edition (V004, bootleg)", 0 )         // "102092" !!! - based on (heavily modified) World version
8751GAME( 1992, sf2acc,   sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II' - Champion Edition (Accelerator!, bootleg)" , 0)  // 920313 - based on USA version
86848752GAME( 1992, sf2accp2, sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II' - Champion Edition (Accelerator Pt.II, bootleg)" , 0)  // 920313 - based on USA version
86858753GAME( 1992, sf2m1,    sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II' - Champion Edition (M1, bootleg)", GAME_NOT_WORKING )
86868754GAME( 1992, sf2m2,    sf2ce,    cps1_12MHz, sf2m2,    sf2hack,  ROT0,   "bootleg","Street Fighter II' - Champion Edition (M2, bootleg)", 0 )
src/mame/drivers/kyugo.c
r5955r5956
2929
3030
3131static UINT8 *shared_ram;
32static WRITE8_HANDLER( kyugo_sub_cpu_control_w );
3233
3334
3435/*************************************
r5955r5956
3738 *
3839 *************************************/
3940
40MACHINE_RESET( kyugo )
41static MACHINE_RESET( kyugo )
4142{
4243   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
4344   // must start with interrupts and sub CPU disabled
r5955r5956
4647}
4748
4849
49WRITE8_HANDLER( kyugo_sub_cpu_control_w )
50static WRITE8_HANDLER( kyugo_sub_cpu_control_w )
5051{
5152   cputag_set_input_line(space->machine, "sub", INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE);
5253}
src/mame/drivers/leland.c
r5955r5956
621621INPUT_PORTS_END
622622
623623
624static INPUT_PORTS_START( offrdtp2 )
625   PORT_INCLUDE( offroad )
626
627   PORT_MODIFY("IN0")
628   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
629   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
630   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
631INPUT_PORTS_END
632
633
624634static INPUT_PORTS_START( pigout )      /* complete, verified from code */
625635   PORT_START("IN0")   /* 0x40 */
626636   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
r5955r5956
17471757ROM_END
17481758
17491759
1760ROM_START( offrdtp2 )
1761   ROM_REGION( 0x040000, "master", 0 )
1762   ROM_LOAD( "ortp2u58.bin", 0x00000, 0x10000, CRC(8a785b66) SHA1(a9e369d446eec658294c81223399acc99e4198c2) )
1763   ROM_LOAD( "ortp2u59.bin", 0x10000, 0x10000, CRC(ff553895) SHA1(8d91b46306fa680ea96ebbb76418d7a82ed19568) )
1764   ROM_LOAD( "ortpu57.bin",  0x20000, 0x10000, CRC(e9f0f175) SHA1(db8c55015d1e8230f1fb27dfac6b8b364b0718a2) )
1765   ROM_LOAD( "ortpu56.bin",  0x30000, 0x10000, CRC(2c1a22b3) SHA1(fb18af5ec873968beab47d163d9ef23532c40771) )
1766
1767   ROM_REGION( 0x90000, "slave", 0 )
1768   ROM_LOAD( "ortpu3b.bin", 0x00000, 0x02000, CRC(95abb9f1) SHA1(98e9e8f388047d6992a664ae87c50ca65a5db0b1) )
1769   ROM_LOAD( "ortpu2.bin",  0x10000, 0x10000, CRC(c46c1627) SHA1(1e911bc774cbc0a66b2feb68b600aa5ad272daa6) )
1770   ROM_LOAD( "ortpu3.bin",  0x20000, 0x10000, CRC(2276546f) SHA1(d19335504a71ccf74864c8e9896347709bf794e4) )
1771   ROM_LOAD( "ortpu4.bin",  0x30000, 0x10000, CRC(aa4b5975) SHA1(7d695957c283aae4c7e6fb90dab117add65571b4) )
1772   ROM_LOAD( "ortpu5.bin",  0x40000, 0x10000, CRC(69100b06) SHA1(c25d1273d08fd20651d1873ce412bb1e18eff06f) )
1773   ROM_LOAD( "ortpu6.bin",  0x50000, 0x10000, CRC(b75015b8) SHA1(2bb6b4422e087502cfeb9bce0d3e3ffe18192fe0) )
1774   ROM_LOAD( "ortpu7.bin",  0x60000, 0x10000, CRC(a5af5b4f) SHA1(e4992bfbf628d034a879bf9317377348ee4c24e9) )
1775   ROM_LOAD( "ortpu8.bin",  0x70000, 0x10000, CRC(0f735078) SHA1(cb59b11fbed672cb372759384e5916418e6c3dc7) )
1776
1777   ROM_REGION( 0x100000, "audiocpu", 0 )
1778   ROM_LOAD16_BYTE( "ortpu25.bin", 0x040001, 0x10000, CRC(f952f800) SHA1(0f1fc837b0b5f5495a666b0a42adb6068e58a57a) )
1779   ROM_LOAD16_BYTE( "ortpu13.bin", 0x040000, 0x10000, CRC(7beec9fc) SHA1(b03b4a28217a8c7c02dc0314db97fef1d4ab6f20) )
1780   ROM_LOAD16_BYTE( "ortpu26.bin", 0x060001, 0x10000, CRC(6227ea94) SHA1(26384af82f73452b7be8a0eeac9f8a3b464068f6) )
1781   ROM_LOAD16_BYTE( "ortpu14.bin", 0x060000, 0x10000, CRC(0a44331d) SHA1(1a52da64c44bc91c2fc9499d1c41191725f9f2be) )
1782   ROM_LOAD16_BYTE( "ortpu27.bin", 0x0e0001, 0x10000, CRC(b80c5f99) SHA1(6b0657db870fb4e14e20cbd955655d0990dd7bda) )
1783   ROM_LOAD16_BYTE( "ortpu15.bin", 0x0e0000, 0x10000, CRC(2a1a1c3c) SHA1(990328240a2dba7264bb5add5ea8cae2752327d9) )
1784
1785   ROM_REGION( 0x18000, "gfx1", 0 )
1786   ROM_LOAD( "ortpu93b.bin", 0x00000, 0x08000, CRC(f0c1d8b0) SHA1(aa6e53b56474fa97b17b60ef1123a28442482b80) )
1787   ROM_LOAD( "ortpu94b.bin", 0x08000, 0x08000, CRC(7460d8c0) SHA1(9e3560056da89108c58b320125deeed0e009d0a8) )
1788   ROM_LOAD( "ortpu95b.bin", 0x10000, 0x08000, CRC(081ee7a8) SHA1(2b884a8ed4173b64f7890edf9a6954c62b5ba012) )
1789
1790   ROM_REGION( 0x20000, "user1", 0 )   /* Ordering: 70/92/69/91/68/90/67/89 */
1791   /* 70 = empty */
1792   ROM_LOAD( "ortpu92b.bin",  0x04000, 0x4000, CRC(f9988e28) SHA1(250071f4a26782266303331ddbef5479cc241220) )
1793   ROM_LOAD( "ortpu69b.bin",  0x08000, 0x4000, CRC(fe5f8d8f) SHA1(5e520da33f30a594c8f37e8e214d0d257ba5c801) )
1794   /* 91 = empty */
1795   /* 68 = empty */
1796   ROM_LOAD( "ortpu90b.bin",  0x14000, 0x4000, CRC(bda2ecb1) SHA1(c7a70ed794cf1655aebdf4538ab25f74be38cda3) )
1797   ROM_LOAD( "ortpu67b.bin",  0x18000, 0x4000, CRC(38c9bf29) SHA1(aa681f0a3eb5d31f2b01116939162d296e113428) )
1798   /* 89 = empty */
1799ROM_END
1800
1801
17501802ROM_START( pigout )
17511803   ROM_REGION( 0x040000, "master", 0 )
17521804   ROM_LOAD( "poutu58t.bin",  0x00000, 0x10000, CRC(8fe4b683) SHA1(6f98a4e54a558a642b7193af85823b29ade46919) )
r5955r5956
24732525/* huge master banks, large slave banks, 80186 sound */
24742526GAME( 1989, offroad,  0,       lelandi,  offroad,  offroad,  ROT0,   "Leland Corp.", "Ironman Ivan Stewart's Super Off-Road", 0 )
24752527GAME( 1989, offroadt, 0,       lelandi,  offroad,  offroadt, ROT0,   "Leland Corp.", "Ironman Ivan Stewart's Super Off-Road Track-Pak", 0 )
2528GAME( 1989, offrdtp2, offroadt,lelandi,  offrdtp2, offroadt, ROT0,   "Leland Corp.", "Ironman Ivan Stewart's Super Off-Road Track-Pak (2 Players)", 0 )
24762529GAME( 1990, pigout,   0,       lelandi,  pigout,   pigout,   ROT0,   "Leland Corp.", "Pig Out: Dine Like a Swine! (set 1)", 0 )
24772530GAME( 1990, pigouta,  pigout,  lelandi,  pigout,   pigout,   ROT0,   "Leland Corp.", "Pig Out: Dine Like a Swine! (set 2)", 0 )
src/mame/drivers/segag80r.c
r5955r5956
1212
1313    Known bugs:
1414        * Pig Newton doesn't read cocktail controls (might be game bug)
15        * Astro Blaster v1 dies when you first start
15        * Astro Blaster v1 dies when you first start if you only
16          have one credit at the time (bad dump?, protection?)
1617
1718****************************************************************************
1819
r5955r5956
10661067
10671068ROM_START( astrob1 )
10681069   ROM_REGION( 0xc000, "maincpu", 0 )
1069   ROM_LOAD( "829.cpu-u25",    0x0000, 0x0800, CRC(5f66046e) SHA1(6aa7f94122db1a75a89c12ad9d087aec1a70d675) )
1070   ROM_LOAD( "829.cpu-u25",    0x0000, 0x0800, CRC(5f66046e) SHA1(6aa7f94122db1a75a89c12ad9d087aec1a70d675) ) // verify that this isn't just a bad dump..
10701071   ROM_LOAD( "837.prom-u1",    0x0800, 0x0800, CRC(ce9c3763) SHA1(2cb4c3041905d38b040ef76f69f6197d699f9ec5) )
10711072   ROM_LOAD( "838.prom-u2",    0x1000, 0x0800, CRC(3557289e) SHA1(57258b149f0872c34f82fe3dc06bc1fc60d7393f) )
10721073   ROM_LOAD( "839.prom-u3",    0x1800, 0x0800, CRC(c88bda24) SHA1(9253306bd929e04a2136a0d9a9627dab8979baa1) )
r5955r5956
10941095   ROM_LOAD( "812a.speech-u3", 0x1800, 0x0800, CRC(410ad0d2) SHA1(9b5f05bb64a6ecfe3543025a10c6ec67de797333) )
10951096ROM_END
10961097
1098ROM_START( astrode )
1099   ROM_REGION( 0xc000, "maincpu", 0 )
1100   ROM_LOAD( "829b.u25",   0x0000, 0x0800, CRC(14ae953c) SHA1(eb63d1b95faa5193db7fa6ab245e99325d519b5e) )
1101   ROM_LOAD( "834b.u01",   0x0800, 0x0800, CRC(82630950) SHA1(6e13cf5868d64835d9de823801cc4162b3c7b316) )
1102   ROM_LOAD( "814a.u02",   0x1000, 0x0800, CRC(d70d7d5e) SHA1(3d663cb36579c91cdb0ea82fd0af3b0ade8246b7) )
1103   ROM_LOAD( "815a.u03",   0x1800, 0x0800, CRC(0dbad477) SHA1(1fc6b3c628abd0d7a13b75eb2aeed7c04381f674) )
1104   ROM_LOAD( "816a.u04",   0x2000, 0x0800, CRC(8fa809ab) SHA1(c1dcae3b825dc283526b5ba742ca6816e5722464) )
1105   ROM_LOAD( "817a.u05",   0x2800, 0x0800, CRC(c7a3c014) SHA1(da25c2c2a116128e74df4de21727e2a4820c1045) )
1106   ROM_LOAD( "818a.u06",   0x3000, 0x0800, CRC(f13e804c) SHA1(550a02a4d21915d1127ba1be587539a8e27aa7ef) )
1107   ROM_LOAD( "819a.u07",   0x3800, 0x0800, CRC(2194a624) SHA1(a8a9baf202eb353b93dced71d74de713d54a5e5e) )
1108   ROM_LOAD( "820a.u08",   0x4000, 0x0800, CRC(95d84829) SHA1(a1684a695de41270721da851bed887a0c379e8c1) )
1109   ROM_LOAD( "821a.u09",   0x4800, 0x0800, CRC(1495059f) SHA1(d771274d5205421757076b9a5cfbd73fe2949901) )
1110   ROM_LOAD( "822a.u10",   0x5000, 0x0800, CRC(d036a5c5) SHA1(5557795280c5e492b94d670b156024d67d51aa8b) )
1111   ROM_LOAD( "823a.u11",   0x5800, 0x0800, CRC(788380dd) SHA1(6392386f9625c6fd609174e765a24e2c25fca957) )
1112   ROM_LOAD( "824a.u12",   0x6000, 0x0800, CRC(a43686c4) SHA1(1a6eae526de1667a7aa3a995b2655950555461eb) )
1113   ROM_LOAD( "825a.u13",   0x6800, 0x0800, CRC(43c8b973) SHA1(12ee379d24e2bcdd6b491262ac02f862a8a33aaf) )
1114   ROM_LOAD( "826a.u14",   0x7000, 0x0800, CRC(9f26d132) SHA1(5323a61de883ed1f2dca776b9d7c53a484249c02) )
1115   ROM_LOAD( "835.u15",    0x7800, 0x0800, CRC(6eeeb409) SHA1(1caf9b7ac08a4adcbf8c17f9e4b398373db706e1) )
1116   ROM_LOAD( "836.u16",    0x8000, 0x0800, CRC(07ffe6dc) SHA1(70673e8266139034afa64bf980b1b9ddbf294e0f) )
10971117
1118   ROM_REGION( 0x0800, "audiocpu", 0 )
1119   ROM_LOAD( "808b_speech_de.u07", 0x0000, 0x0800, CRC(5988c767) SHA1(3b91a8cd46aa7e714028cc40f700fea32287afb1) )
1120
1121   ROM_REGION( 0x4000, "speech", 0 )
1122   ROM_LOAD( "830_speech_de.u06", 0x0000, 0x0800, CRC(2d840552) SHA1(7a2a7b54378b6cc85b8ab5c26e42266aa747c635) )
1123   ROM_LOAD( "831_speech_de.u05", 0x0800, 0x0800, CRC(46b30ee4) SHA1(c9e19a9b9ebc9b3b853e79f93ad74e4ec5dfd1ae) )
1124   ROM_LOAD( "832_speech_de.u04", 0x1000, 0x0800, CRC(d05280b8) SHA1(8d30b23b83b32465a8a2decd2ce9bfed24394e7e) )
1125   ROM_LOAD( "833_speech_de.u03", 0x1800, 0x0800, CRC(08f11459) SHA1(da6dc2bf30b95882f95c21739ec02fc89d286a66) )
1126ROM_END
1127
10981128ROM_START( 005 )
10991129   ROM_REGION( 0xc000, "maincpu", 0 )
11001130   ROM_LOAD( "1346b.cpu-u25",     0x0000, 0x0800, CRC(8e68533e) SHA1(a257c556d31691068ed5c991f1fb2b51da4826db) )
r5955r5956
15411571GAME( 1981, astrob,   0,       astrob,   astrob,   astrob,   ROT270, "Sega", "Astro Blaster (version 3)", GAME_IMPERFECT_SOUND )
15421572GAME( 1981, astrob2,  astrob,  astrob,   astrob2,  astrob,   ROT270, "Sega", "Astro Blaster (version 2)", GAME_IMPERFECT_SOUND )
15431573GAME( 1981, astrob2a, astrob,  astrob,   astrob2,  astrob,   ROT270, "Sega", "Astro Blaster (version 2a)", GAME_IMPERFECT_SOUND )
1544GAME( 1981, astrob1,  astrob,  astrob,   astrob,   astrob,   ROT270, "Sega", "Astro Blaster (version 1)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
1574GAME( 1981, astrob1,  astrob,  astrob,   astrob,   astrob,   ROT270, "Sega", "Astro Blaster (version 1)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // instant death if you start game with 1 credit, protection?, bad dump?
1575GAME( 1981, astrode,  astrob,  astrob,   astrob,   astrob,   ROT270, "Sega", "Astro Blaster (German)", GAME_IMPERFECT_SOUND )
15451576GAME( 1981, 005,      0,       005,      005,      005,      ROT270, "Sega", "005", GAME_IMPERFECT_SOUND )
15461577
1578
15471579/* basic G-80 system with individual background boards */
15481580GAME( 1981, spaceod,  0,       spaceod,  spaceod,  spaceod,  ROT270, "Sega", "Space Odyssey (version 2)", GAME_IMPERFECT_SOUND )
15491581GAME( 1981, spaceod2, spaceod, spaceod,  spaceod,  spaceod,  ROT270, "Sega", "Space Odyssey (version 1)", GAME_IMPERFECT_SOUND )
src/mame/drivers/namcos22.c
r5955r5956
20072007#define XOR(a) WORD2_XOR_BE(a)
20082008
20092009/* text layer uses a set of 16x16x8bpp tiles defined in RAM */
2010const gfx_layout namcos22_cg_layout =
2010static const gfx_layout namcos22_cg_layout =
20112011{
20122012   16,16,
20132013   0x400, /* 0x3c0 */
src/mame/drivers/galaxold.c
r5955r5956
22522252   MDRV_CPU_IO_MAP(ozon1_io_map)
22532253   MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
22542254
2255   MDRV_MACHINE_RESET(NULL)
2255   MDRV_MACHINE_RESET(0)
22562256
22572257   MDRV_PALETTE_INIT(rockclim)
22582258   MDRV_PALETTE_LENGTH(32)
r5955r5956
23442344   MDRV_CPU_PROGRAM_MAP(harem_cpu2)
23452345   MDRV_CPU_IO_MAP(harem_cpu2_io)
23462346
2347   MDRV_MACHINE_RESET(NULL)
2347   MDRV_MACHINE_RESET(0)
23482348
23492349   MDRV_PALETTE_INIT(rockclim)
23502350   MDRV_PALETTE_LENGTH(32)
src/mame/drivers/sprint8.c
r5955r5956
103103}
104104
105105
106/* names of sound effects taken from Tank 8, might differ for Sprint 8 */
107
108static WRITE8_HANDLER( sprint8_crash_w ) {}
109static WRITE8_HANDLER( sprint8_explosion_w ) {}
110static WRITE8_HANDLER( sprint8_bugle_w ) {}
111static WRITE8_HANDLER( sprint8_bug_w ) {}
112static WRITE8_HANDLER( sprint8_attract_w ) {}
113static WRITE8_HANDLER( sprint8_motor_w ) {}
114
115
116106static ADDRESS_MAP_START( sprint8_map, ADDRESS_SPACE_PROGRAM, 8 )
117107   AM_RANGE(0x0000, 0x00ff) AM_RAM
118108   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(sprint8_video_ram_w) AM_BASE(&sprint8_video_ram)
r5955r5956
126116   AM_RANGE(0x1c20, 0x1c2f) AM_WRITEONLY AM_BASE(&sprint8_pos_d_ram)
127117   AM_RANGE(0x1c30, 0x1c37) AM_WRITE(sprint8_lockout_w)
128118   AM_RANGE(0x1d00, 0x1d00) AM_WRITE(sprint8_int_reset_w)
129   AM_RANGE(0x1d01, 0x1d01) AM_WRITE(sprint8_crash_w)
130   AM_RANGE(0x1d02, 0x1d02) AM_WRITE(sprint8_explosion_w)
131   AM_RANGE(0x1d03, 0x1d03) AM_WRITE(sprint8_bugle_w)
132   AM_RANGE(0x1d04, 0x1d04) AM_WRITE(sprint8_bug_w)
119   AM_RANGE(0x1d01, 0x1d01) AM_DEVWRITE("discrete", sprint8_crash_w)
120   AM_RANGE(0x1d02, 0x1d02) AM_DEVWRITE("discrete", sprint8_screech_w)
121   AM_RANGE(0x1d03, 0x1d03) AM_WRITENOP
122   AM_RANGE(0x1d04, 0x1d04) AM_WRITENOP
133123   AM_RANGE(0x1d05, 0x1d05) AM_WRITEONLY AM_BASE(&sprint8_team)
134   AM_RANGE(0x1d06, 0x1d06) AM_WRITE(sprint8_attract_w)
135   AM_RANGE(0x1e00, 0x1e07) AM_WRITE(sprint8_motor_w)
124   AM_RANGE(0x1d06, 0x1d06) AM_DEVWRITE("discrete", sprint8_attract_w)
125   AM_RANGE(0x1e00, 0x1e07) AM_DEVWRITE("discrete", sprint8_motor_w)
136126   AM_RANGE(0x1f00, 0x1f00) AM_WRITENOP /* probably a watchdog, disabled in service mode */
137127   AM_RANGE(0x2000, 0x3fff) AM_ROM
138128   AM_RANGE(0xf800, 0xffff) AM_ROM
r5955r5956
271261   PORT_START("VBLANK")
272262   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
273263
264   /* this is actually a variable resistor */
265   PORT_START("R132")
266   PORT_ADJUSTER(65, "R132 - Crash & Screech Volume")
267
274268INPUT_PORTS_END
275269
276270
r5955r5956
395389   PORT_START("VBLANK")
396390   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
397391
392   /* this is actually a variable resistor */
393   PORT_START("R132")
394   PORT_ADJUSTER(65, "R132 - Crash & Screech Volume")
395
398396INPUT_PORTS_END
399397
400398
r5955r5956
479477   MDRV_VIDEO_UPDATE(sprint8)
480478   MDRV_VIDEO_EOF(sprint8)
481479
480
482481   /* sound hardware */
482   /* the proper way is to hook up 4 speakers, but they are not really
483     * F/R/L/R speakers.  Though you can pretend the 1-2 mix is the front. */
484   MDRV_SPEAKER_ADD("speaker_1_2", 0.0, 0.0, 1.0)      /* front */
485   MDRV_SPEAKER_ADD("speaker_3_7", -0.2, 0.0, 1.0)      /* left */
486   MDRV_SPEAKER_ADD("speaker_5_6",  0.0, 0.0, -0.5)   /* back */
487   MDRV_SPEAKER_ADD("speaker_4_8", 0.2, 0.0, 1.0)      /* right */
488
489   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
490   MDRV_SOUND_CONFIG_DISCRETE(sprint8)
491   MDRV_SOUND_ROUTE(0, "speaker_1_2", 1.0)
492   /* volumes on other channels defaulted to off, */
493   /* user can turn them up if needed. */
494   /* The game does not sound good with all channels mixed to stereo. */
495   MDRV_SOUND_ROUTE(1, "speaker_3_7", 0.0)
496   MDRV_SOUND_ROUTE(2, "speaker_5_6", 0.0)
497   MDRV_SOUND_ROUTE(3, "speaker_4_8", 0.0)
483498MACHINE_DRIVER_END
484499
485500
r5955r5956
516531ROM_END
517532
518533
519GAME( 1977, sprint8,  0,       sprint8, sprint8,  0, ROT0, "Atari", "Sprint 8",             GAME_NO_SOUND )
520GAME( 1977, sprint8a, sprint8, sprint8, sprint8p, 0, ROT0, "Atari", "Sprint 8 (play tag & chase)", GAME_NO_SOUND )
534GAME( 1977, sprint8,  0,       sprint8, sprint8,  0, ROT0, "Atari", "Sprint 8",  0 )
535GAME( 1977, sprint8a, sprint8, sprint8, sprint8p, 0, ROT0, "Atari", "Sprint 8 (play tag & chase)", 0 )
src/mame/drivers/mpu4drvr.c
r5955r5956
13791379
13801380
13811381/* machine start (called only once) */
1382MACHINE_START( mpu4_vid )
1382static MACHINE_START( mpu4_vid )
13831383{
13841384   mpu4_config_common(machine);
13851385
r5955r5956
20552055   ROM_LOAD( "meter-zero.p1",  0x8000, 0x8000,  CRC(e74297e5) SHA1(49a2cc85eda14199975ec37a794b685c839d3ab9))
20562056ROM_END
20572057
2058DRIVER_INIT (connect4)
2058static DRIVER_INIT (connect4)
20592059{
20602060   led_extend=1;
20612061}
src/mame/drivers/plygonet.c
r5955r5956
9292
9393READ32_HANDLER( polygonet_ttl_ram_r );
9494WRITE32_HANDLER( polygonet_ttl_ram_w );
95READ32_HANDLER( polygonet_roz_ram_r );
96WRITE32_HANDLER( polygonet_roz_ram_w );
9597
9698static int init_eeprom_count;
9799
r5955r5956
246248   COMBINE_DATA(&shared_ram[offset]) ;
247249
248250   logerror("68k WRITING %04x & %04x to shared ram %x & %x [%08x] (@%x)\n", (shared_ram[offset] & 0xffff0000) >> 16,
249                                                             (shared_ram[offset] & 0x0000ffff),
250                                                              0xc000 + (offset<<1),
251                                                              0xc000 +((offset<<1)+1),
252                                                            mem_mask,
253                                                            cpu_get_pc(space->cpu));
251                                                          (shared_ram[offset] & 0x0000ffff),
252                                                           0xc000 + (offset<<1),
253                                                           0xc000 +((offset<<1)+1),
254                                                           mem_mask,
255                                                           cpu_get_pc(space->cpu));
254256
255257   /* write to the current dsp56k word */
256258   if (mem_mask | (0xffff0000))
r5955r5956
272274   /* 0x01000000 is the reset line - 0 is high, 1 is low */
273275   if ((data >> 24) & 0x01)
274276   {
275      logerror("RESET CLEARED\n");
277//      logerror("RESET CLEARED\n");
276278      cputag_set_input_line(space->machine, "dsp", DSP56K_IRQ_RESET, CLEAR_LINE);
277279   }
278280   else
279281   {
280      logerror("RESET ASSERTED\n");
282//      logerror("RESET ASSERTED\n");
281283      cputag_set_input_line(space->machine, "dsp", DSP56K_IRQ_RESET, ASSERT_LINE);
282284
283285      /* A little hacky - I can't seem to set these lines anywhere else where reset is asserted, so i do it here */
r5955r5956
403405      const UINT16 bit1   = (portC & 0x0001) >> 0;
404406      return (bits32 | bit1);
405407   }
406
407   if (bank_group == INVALID_BANK_GROUP)
408   else if (bank_group == INVALID_BANK_GROUP)
409   {
408410      fatalerror("Plygonet: dsp56k bank num invalid.\n");
411   }
409412
410413   return 0;
411414}
r5955r5956
524527static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 )
525528   AM_RANGE(0x000000, 0x1fffff) AM_ROM
526529   AM_RANGE(0x200000, 0x21ffff) AM_RAM_WRITE(plygonet_palette_w) AM_BASE(&paletteram32)
527   AM_RANGE(0x440000, 0x440fff) AM_RAM      /* PSVR: PSAC2 VRAM? */
530   AM_RANGE(0x400000, 0x40001f) AM_RAM AM_BASE((UINT32**)&K053936_0_ctrl)
531   AM_RANGE(0x440000, 0x440fff) AM_READWRITE(polygonet_roz_ram_r, polygonet_roz_ram_w)
528532   AM_RANGE(0x480000, 0x4bffff) AM_READ(polygonet_eeprom_r)
529533   AM_RANGE(0x4C0000, 0x4fffff) AM_WRITE(polygonet_eeprom_w)
530534   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(shared_ram_write) AM_BASE(&shared_ram)
r5955r5956
602606};
603607
604608/**********************************************************************************/
605
606609static const gfx_layout bglayout =
607610{
608611   16,16,
609   RGN_FRAC(1,1),
612   1024,
610613   4,
611614   { 0, 1, 2, 3 },
615   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
616      8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
612617   { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, 8*4,
613618     9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
614   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
615      8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
616   128*8
619
620     128*8
617621};
618622
619623static GFXDECODE_START( plygonet )
r5955r5956
660664   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
661665   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
662666   MDRV_SCREEN_SIZE(64*8, 32*8)
663   MDRV_SCREEN_VISIBLE_AREA(48, 48+384-1, 0, 32*8-1)
667   MDRV_SCREEN_VISIBLE_AREA(64, 64+368-1, 0, 32*8-1)
664668
665669   MDRV_PALETTE_LENGTH(32768)
666670
r5955r5956
681685   MDRV_SOUND_ROUTE(1, "rspeaker", 0.75)
682686MACHINE_DRIVER_END
683687
688
689/**********************************************************************************/
684690static INPUT_PORTS_START( polygonet )
685691   PORT_START("IN0")
686692   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
687693   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
688694   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
689   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
690   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )   /* SW1 (changes player color).  It's mapped on the JAMMA connector and plugs into an external switch mech. */
691   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 )   /* SW2 (changes player color).  It's mapped on the JAMMA connector and plugs into an external switch mech. */
692   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 )
693   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 )
695   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
696   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )   /* SW1 (changes player color).  It's mapped on the JAMMA connector and plugs into an external switch mech. */
697   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 )   /* SW2 (changes player color).  It's mapped on the JAMMA connector and plugs into an external switch mech. */
698   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
699   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
694700
695701   PORT_START("IN1")
696702   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP )   PORT_PLAYER(1)
r5955r5956
699705   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN )   PORT_PLAYER(1)
700706   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
701707   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
702   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON8 )
703   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON9 )
708   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
709   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
704710INPUT_PORTS_END
705711
712static INPUT_PORTS_START( polynetw )
713   PORT_START("IN0")
714   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
715   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
716   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
717   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
718   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )   /* SW1 (changes player color).  It's mapped on the JAMMA connector and plugs into an external switch mech. */
719   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )   /* SW2 (changes player color).  It's mapped on the JAMMA connector and plugs into an external switch mech. */
720   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
721   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
722
723   PORT_START("IN1")
724   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_PLAYER(1)
725   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(1)
726   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_PLAYER(1)
727   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_PLAYER(1)
728   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
729   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(1)
730   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
731   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
732INPUT_PORTS_END
733
734
735/**********************************************************************************/
706736static DRIVER_INIT(polygonet)
707737{
708738   /* Set default bankswitch */
r5955r5956
720750   dsp56k_update_handler = memory_set_direct_update_handler(cputag_get_address_space(machine, "dsp", ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler);
721751}
722752
753
754/**********************************************************************************/
723755ROM_START( plygonet )
724756   /* main program */
725757   ROM_REGION( 0x200000, "maincpu", 0)
r5955r5956
775807
776808/*          ROM       parent   machine   inp        init */
777809GAME( 1993, plygonet, 0,       plygonet, polygonet, polygonet, ROT90, "Konami", "Polygonet Commanders (ver UAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
778GAME( 1993, polynetw, 0,       plygonet, polygonet, polygonet, ROT90, "Konami", "Poly-Net Warriors (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
810GAME( 1993, polynetw, 0,       plygonet, polynetw, polygonet, ROT90, "Konami", "Poly-Net Warriors (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
779811
src/mame/drivers/ksys573.c
r5955r5956
15231523         switch( cart )
15241524         {
15251525         case 0:
1526            nvram_handler_security_cart_0 = nvram_handler_x76f041_0;
1526            nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f041_0);
15271527            break;
15281528         case 1:
1529            nvram_handler_security_cart_1 = nvram_handler_x76f041_1;
1529            nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f041_1);
15301530            break;
15311531         }
15321532
r5955r5956
15391539         switch( cart )
15401540         {
15411541         case 0:
1542            nvram_handler_security_cart_0 = nvram_handler_x76f100_0;
1542            nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f100_0);
15431543            break;
15441544         case 1:
1545            nvram_handler_security_cart_1 = nvram_handler_x76f100_1;
1545            nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f100_1);
15461546            break;
15471547         }
15481548
r5955r5956
15551555         switch( cart )
15561556         {
15571557         case 0:
1558            nvram_handler_security_cart_0 = nvram_handler_zs01_0;
1558            nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(zs01_0);
15591559            break;
15601560         case 1:
1561            nvram_handler_security_cart_1 = nvram_handler_zs01_1;
1561            nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(zs01_1);
15621562            break;
15631563         }
15641564
src/mame/drivers/aristmk5.c
r5955r5956
1313#include "includes/archimds.h"
1414
1515static ADDRESS_MAP_START( aristmk5_map, ADDRESS_SPACE_PROGRAM, 32 )
16   AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(memc_logical_r, memc_logical_w)
17   AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */
18   AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(ioc_r, ioc_w)
19   AM_RANGE(0x03400000, 0x035fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(memc_page_w)
20   AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(memc_r, memc_w)
21   AM_RANGE(0x03800000, 0x039fffff) AM_READWRITE(vidc_r, vidc_w)
16   AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w)
17   AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&archimedes_memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */
18   AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w)
19   AM_RANGE(0x03400000, 0x035fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(archimedes_memc_page_w)
20   AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w)
21   AM_RANGE(0x03800000, 0x039fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w)
2222ADDRESS_MAP_END
2323
2424
src/mame/drivers/timeplt.c
r5955r5956
345345   MDRV_CPU_PROGRAM_MAP(psurge_main_map)
346346   MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
347347
348   MDRV_MACHINE_START(NULL)
348   MDRV_MACHINE_START(0)
349349MACHINE_DRIVER_END
350350
351351
src/mame/drivers/twin16.c
r5955r5956
982982
983983ROM_START( vulcana )
984984   ROM_REGION( 0x40000, "maincpu", 0 )   // 68000 code (CPU A)
985   ROM_LOAD16_BYTE( "785_r05.6n",   0x00000, 0x10000, CRC(1777a57b) SHA1(9696fa9c6d53587972d213d5c12245e40fbc2bda) )
986   ROM_LOAD16_BYTE( "785_r04.4n",   0x00001, 0x10000, CRC(790cbdf3) SHA1(e247c2be00169490aea945518c1a68e94799f5f4) )
987   ROM_LOAD16_BYTE( "785_u09.6r",   0x20000, 0x10000, CRC(1aba7010) SHA1(bcf28640d5ba7864ed7112db23ff344434b2d944) )
988   ROM_LOAD16_BYTE( "785_k08.4r",   0x20001, 0x10000, CRC(36bb1be1) SHA1(ce9a98443a453b1c05dfb8d0f8ba0f94292b9d30) ) /* Same as 785_r08.4r */
989
990   ROM_REGION( 0x40000, "sub", 0 )   // 68000 code (CPU B)
991   ROM_LOAD16_BYTE( "785_p07.10n",   0x00000, 0x10000, CRC(686d549d) SHA1(9687be801c4fb963bf6b0199e2ae9f5051213f7a) )
992   ROM_LOAD16_BYTE( "785_p06.8n" ,   0x00001, 0x10000, CRC(70c94bee) SHA1(951e00ca4d3a47a21b4db05bcdc8ead45b42c3f1) )
993   ROM_LOAD16_BYTE( "785_p13.10s",   0x20000, 0x10000, CRC(478fdb0a) SHA1(2e285ad6dcfc67f3e24d231e0e1be19036ce64d2) )
994   ROM_LOAD16_BYTE( "785_p12.8s",   0x20001, 0x10000, CRC(38ea402a) SHA1(90ff2bd71435988cde967704ce3b1401de206683) )
995
996   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
997   ROM_LOAD( "785_g03.10a", 0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
998
999   ROM_REGION( 0x4000, "gfx1", 0 )
1000   ROM_LOAD( "785_h14.d8", 0x0000,   0x4000, CRC(02f4b16f) SHA1(45addc99f520770f38c6aa69aef9af59cfc410b5) ) /* Title screen graphics & characters */
1001
1002   ROM_REGION16_BE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
1003   ROM_LOAD16_WORD( "785f17.p16",   0x000000, 0x80000, CRC(8fbec1a4) SHA1(71cbdb25470b5a2ca7e80c92f12fc47e28085793) )
1004   ROM_LOAD16_WORD( "785f18.p18",   0x080000, 0x80000, CRC(50d61e38) SHA1(051d332d93d435d19571e22d69ffc5395dbb16a4) )
1005   ROM_LOAD16_WORD( "785f15.p13",   0x100000, 0x80000, CRC(af96aef3) SHA1(a58e26a8b134ab6e7938cd4fa342c04c236efd99) )
1006   ROM_LOAD16_WORD( "785f16.p15",   0x180000, 0x80000, CRC(b858df1f) SHA1(c434da7ba54d59643fe6ca30bceccf16413904c3) )
1007
1008   ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 )   // tile data; mapped at 0x80000 on CPUB
1009
1010   ROM_REGION( 0x20000, "konami", 0 )    // samples
1011   ROM_LOAD( "785_f01.5a", 0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
1012
1013   ROM_REGION( 0x20000, "upd", 0 )    // samples
1014   ROM_LOAD( "785_f02.7c", 0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
1015ROM_END
1016
1017ROM_START( vulcanb )
1018   ROM_REGION( 0x40000, "maincpu", 0 )   // 68000 code (CPU A)
9851019   ROM_LOAD16_BYTE( "785_n05.6n",   0x00000, 0x10000, CRC(6371d475) SHA1(82e6adc38de8363c126cd073dbc95eeec576db98) )
9861020   ROM_LOAD16_BYTE( "785_n04.4n",   0x00001, 0x10000, CRC(b6f24b9e) SHA1(01685f89955385714062cc70316edce1a6a64e35) )
9871021   ROM_LOAD16_BYTE( "785_r09.6r",   0x20000, 0x10000, CRC(fbfd1543) SHA1(8ef41a0a9d3d1de9395bdd5288199841c61d7045) )
9881022   ROM_LOAD16_BYTE( "785_r08.4r",   0x20001, 0x10000, CRC(36bb1be1) SHA1(ce9a98443a453b1c05dfb8d0f8ba0f94292b9d30) )
9891023
9901024   ROM_REGION( 0x40000, "sub", 0 )   // 68000 code (CPU B)
991   ROM_LOAD16_BYTE( "785_g07.10n",   0x00000, 0x10000, CRC(ee09dd5d) SHA1(9b6fb12c2cb7930df12d9876810811540fd560ee) )
1025   ROM_LOAD16_BYTE( "785_g07.10n",   0x00000, 0x10000, CRC(ee09dd5d) SHA1(9b6fb12c2cb7930df12d9876810811540fd560ee) ) /* requires older CPU B code compared to other sets */
9921026   ROM_LOAD16_BYTE( "785_g06.8n" ,   0x00001, 0x10000, CRC(85ab7af7) SHA1(5cb36918a5cdfd16611da76f07450ae1d115f2c7) )
9931027   ROM_LOAD16_BYTE( "785_g13.10s",   0x20000, 0x10000, CRC(274f325d) SHA1(1076efa204eff0fc8a8788706b17b9a128023d35) )
9941028   ROM_LOAD16_BYTE( "785_g12.8s",   0x20001, 0x10000, CRC(1625f933) SHA1(3f25d7396af46e75e3ae8456414e31935de43d34) )
r5955r5956
13071341GAME( 1987, devilw,   0,        devilw,      devilw,   twin16,   ROT0, "Konami", "Devil World", GAME_SUPPORTS_SAVE )
13081342GAME( 1987, majuu,    devilw,   devilw,      devilw,   twin16,   ROT0, "Konami", "Majuu no Ohkoku", GAME_SUPPORTS_SAVE )
13091343GAME( 1987, darkadv,  devilw,   devilw,      darkadv,  twin16,   ROT0, "Konami", "Dark Adventure", GAME_SUPPORTS_SAVE )
1310GAME( 1988, vulcan,   0,        twin16,      vulcan,   twin16,   ROT0, "Konami", "Vulcan Venture", GAME_SUPPORTS_SAVE )
1311GAME( 1988, vulcana,  vulcan,   twin16,      gradius2, twin16,   ROT0, "Konami", "Vulcan Venture (Older Ver.)", GAME_SUPPORTS_SAVE )
1344GAME( 1988, vulcan,   0,        twin16,      vulcan,   twin16,   ROT0, "Konami", "Vulcan Venture (New)", GAME_SUPPORTS_SAVE )
1345GAME( 1988, vulcana,  vulcan,   twin16,      gradius2, twin16,   ROT0, "Konami", "Vulcan Venture (Old)", GAME_SUPPORTS_SAVE )
1346GAME( 1988, vulcanb,  vulcan,   twin16,      gradius2, twin16,   ROT0, "Konami", "Vulcan Venture (Oldest)", GAME_SUPPORTS_SAVE )
13121347GAME( 1988, gradius2, vulcan,   twin16,      gradius2, twin16,   ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan New Ver.)", GAME_SUPPORTS_SAVE )
13131348GAME( 1988, gradius2a,vulcan,   twin16,      vulcan,   twin16,   ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan Old Ver.)", GAME_SUPPORTS_SAVE )
13141349GAME( 1988, gradius2b,vulcan,   twin16,      vulcan,   twin16,   ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan Older Ver.)", GAME_SUPPORTS_SAVE )
src/mame/drivers/konamim2.c
r5955r5956
1010
1111There were only 5 known games on this hardware. They include....
1212
13Game                                                 Year    CD Codes     Konami Part#
14--------------------------------------------------------------------------------------
13Game                                                 Year    CD Codes                        Konami Part#
14-------------------------------------------------------------------------------------------------
1515Battle Tryst                                         1998    636JAC02
1616Evil Night                                           1998    810UBA02
1717Hell Night (alt. Region title, same as Evil Night)   1998    810EAA02
1818Heat Of Eleven '98                                   1998    703EAA02
19Polystars                                            1997    623JAA02     003894
20Total Vice                                           1997    639AAB01
19Tobe! Polystars                                      1997    623JAA02                        003894
20Total Vice                                           1997    639UAC01, 639JAD01, 639AAB01
2121
2222
2323PCB Layouts
r5955r5956
12231223   ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */
12241224   ROM_LOAD( "639jaa02.bin",  0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) )
12251225
1226   DISK_REGION( "cdrom" ) // TODO: Add correct CHD
1226   DISK_REGION( "cdrom" )
1227   DISK_IMAGE( "639uac01", 0, SHA1(88431b8a0ce83c156c8b19efbba1af901b859404) )
1228ROM_END
1229
1230ROM_START( totlvicj )
1231   ROM_REGION64_BE( 0x200000, "boot", 0 )
1232   ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) )
1233
1234   ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */
1235   ROM_LOAD( "639jaa02.bin",  0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) )
1236
1237   DISK_REGION( "cdrom" ) // Need a re-image
12271238   DISK_IMAGE( "639jad01", 0, BAD_DUMP SHA1(39d41d5a9d1c40636d174c8bb8172b1121e313f8) )
12281239ROM_END
12291240
r5955r5956
12341245   cde_init(machine);
12351246}
12361247
1237GAME( 1997, polystar, 0,       m2, m2, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1238GAME( 1997, totlvice, 0,       m2, m2, m2, ROT0, "Konami", "Total Vice (ver JAD)", GAME_NOT_WORKING | GAME_NO_SOUND )
1239GAME( 1998, btltryst, 0,       m2, m2, m2, ROT0, "Konami", "Battle Tryst (ver JAC)", GAME_NOT_WORKING | GAME_NO_SOUND )
1240GAME( 1998, heatof11, 0,       m2, m2, m2, ROT0, "Konami", "Heat of Eleven '98 (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1241GAME( 1998, evilngt,  0,       m2, m2, m2, ROT0, "Konami", "Evil Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1242GAME( 1998, hellngt,  evilngt, m2, m2, m2, ROT0, "Konami", "Hell Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1248GAME( 1997, polystar, 0,        m2, m2, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1249GAME( 1997, totlvice, 0,        m2, m2, m2, ROT0, "Konami", "Total Vice (ver UAC)", GAME_NOT_WORKING | GAME_NO_SOUND )
1250GAME( 1997, totlvicj, totlvice, m2, m2, m2, ROT0, "Konami", "Total Vice (ver JAD)", GAME_NOT_WORKING | GAME_NO_SOUND )
1251//GAME( 1997, totlvica, totlvice, m2, m2, m2, ROT0, "Konami", "Total Vice (ver AAB)", GAME_NOT_WORKING | GAME_NO_SOUND )
1252GAME( 1998, btltryst, 0,        m2, m2, m2, ROT0, "Konami", "Battle Tryst (ver JAC)", GAME_NOT_WORKING | GAME_NO_SOUND )
1253GAME( 1998, heatof11, 0,        m2, m2, m2, ROT0, "Konami", "Heat of Eleven '98 (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1254GAME( 1998, evilngt,  0,        m2, m2, m2, ROT0, "Konami", "Evil Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
1255GAME( 1998, hellngt,  evilngt,  m2, m2, m2, ROT0, "Konami", "Hell Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/asuka.c
r5955r5956
13141314   ROM_LOAD( "c21-07.57",   0x00000, 0x08000, CRC(f02292bd) SHA1(0a5c06a048ad67f90e0d766b504582e9eef035f7) )
13151315ROM_END
13161316
1317ROM_START( cadashg )
1318   ROM_REGION( 0x80000, "maincpu", 0 )     /* 512k for 68000 code */
1319   ROM_LOAD16_BYTE( "c21-23-1.12",  0x00000, 0x20000, CRC(30ddbabe) SHA1(f48ea6fe36c4d9fe291232fd7adddb8f3547270f) )
1320   ROM_LOAD16_BYTE( "c21-25-1.16",  0x00001, 0x20000, CRC(24e10611) SHA1(6f406267777dd693a3869ccb34fe3f2f8dea857d) )
1321   ROM_LOAD16_BYTE( "c21-22-1.11",  0x40000, 0x20000, CRC(daf58b2d) SHA1(7a64df848f46f27bb6f9757ce0cc81311c2f172f) )
1322   ROM_LOAD16_BYTE( "c21-24-1.15",  0x40001, 0x20000, CRC(2359b93e) SHA1(9a5ce34dd8667a987ab8b6e6246f0ad032af868f) )
1323
1324   ROM_REGION( 0x80000, "gfx1", 0 )
1325   ROM_LOAD( "c21-02.9",  0x00000, 0x80000, CRC(205883b9) SHA1(5aafee8cab3f949a7db91bcc26912f331041b51e) )   /* SCR tiles (8 x 8) */
1326
1327   ROM_REGION( 0x80000, "gfx2", 0 )
1328   ROM_LOAD( "c21-01.1",  0x00000, 0x80000, CRC(1ff6f39c) SHA1(742f296efc8073fafa73da2c8d7d26ca9514b6bf) )   /* Sprites (16 x 16) */
1329
1330   ROM_REGION( 0x1c000, "audiocpu", 0 )   /* sound cpu */
1331   ROM_LOAD( "c21-08.38",   0x00000, 0x04000, CRC(dca495a0) SHA1(4e0f401f1b967da75f33fd7294860ad0b4bf2dce) )
1332   ROM_CONTINUE(            0x10000, 0x0c000 )   /* banked stuff */
1333
1334   ROM_REGION( 0x08000, "user1", 0 )   /* 2 machine interface mcu rom ? */
1335   ROM_LOAD( "c21-07.57",   0x00000, 0x08000, CRC(f02292bd) SHA1(0a5c06a048ad67f90e0d766b504582e9eef035f7) )
1336ROM_END
1337
13171338ROM_START( galmedes )
13181339   ROM_REGION( 0x100000, "maincpu", 0 )     /* 1024k for 68000 code */
13191340   ROM_LOAD16_BYTE( "gm-prg1.bin",  0x00000, 0x20000, CRC(32a70753) SHA1(3bd094b7ae600dbc87ba74e8b2d6b86a68346f4f) )
r5955r5956
13831404GAME( 1989, cadashu,  cadash,   cadash,   cadashu,  0, ROT0,   "Taito America Corporation", "Cadash (US)", 0 )
13841405GAME( 1989, cadashi,  cadash,   cadash,   cadash,   0, ROT0,   "Taito Corporation Japan", "Cadash (Italy)", 0 )
13851406GAME( 1989, cadashf,  cadash,   cadash,   cadash,   0, ROT0,   "Taito Corporation Japan", "Cadash (France)", 0 )
1407GAME( 1989, cadashg,  cadash,   cadash,   cadash,   0, ROT0,   "Taito Corporation Japan", "Cadash (Germany)", 0 )
13861408GAME( 1992, galmedes, 0,        galmedes, galmedes, 0, ROT270, "Visco", "Galmedes (Japan)", GAME_SUPPORTS_SAVE )
13871409GAME( 1993, earthjkr, 0,        galmedes, earthjkr, 0, ROT270, "Visco", "U.N. Defense Force: Earth Joker", GAME_SUPPORTS_SAVE )
13881410GAME( 1994, eto,      0,        eto,      eto,      0, ROT0,   "Visco", "Kokontouzai Eto Monogatari (Japan)", GAME_SUPPORTS_SAVE )
src/tools/srcclean.c
r5955r5956
4646   const char *ext;
4747   FILE *file;
4848   int bytes;
49   int col = 0;
4950
5051   /* print usage info */
5152   if (argc != 2)
5253   {
5354      printf("Usage:\nsrcclean <file>\n");
5455      return 0;
55    }
56   }
5657
5758   /* read the file */
5859   file = fopen(argv[1], "rb");
r5955r5956
114115         /* insert a proper CR/LF */
115116         modified[dst++] = 0x0d;
116117         modified[dst++] = 0x0a;
118         col = 0;
117119
118120         /* skip over any LF in the source file */
119121         if (original[src] == 0x0a)
r5955r5956
125127         in_cpp_comment = FALSE;
126128      }
127129
128      /* if we hit a tab within a comment, expand it */
129      else if (ch == 0x09 && (in_c_comment || in_cpp_comment))
130      /* if we hit a tab... */
131      else if (ch == 0x09)
130132      {
131         int temp, col;
133         int spaces = 4 - col % 4;
132134
133         /* scan backwards to find the start of line */
134         for (temp = dst; temp >= 0; temp--)
135            if (modified[temp] == 0x0a)
136               break;
135         col += spaces;
137136
138         /* scan forwards to compute the current column */
139         for (temp++, col = 0; temp < dst; temp++)
140            if (modified[temp] == 0x09)
141               col += 4 - col % 4;
142            else
143               col++;
144
145         /* compute how many spaces */
146         col = 4 - col % 4;
147         while (col--) modified[dst++] = ' ';
148         removed_tabs++;
137         /* if inside a comment, expand it */
138         if (in_c_comment || in_cpp_comment)
139         {
140            while (spaces--) modified[dst++] = ' ';
141            removed_tabs++;
142         }
143         else
144         {
145            modified[dst++] = ch;
146         }
149147      }
150148
151149      /* otherwise, copy the source character */
152150      else
151      {
153152         modified[dst++] = ch;
153         col++;
154      }
154155   }
155156
156157   /* if we didn't find an end of comment, we screwed up */
src/osd/windows/vconv.c
r5955r5956
6868   { 0,      "-fno-strict-aliasing",      "/Oa" },
6969   { 0,      "-fno-omit-frame-pointer",   "" },
7070   { 0,      "-Werror",               "/WX" },
71   { VS7,      "-Wall",               "/Wall /W3 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
71   { VS7,      "-Wall",               "/Wall /W3 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
7272   { 0,      "-Wall",               "/W0" },
7373   { VS7,      "-Wno-unused",            "/wd4100 /wd4101 /wd4102" },
7474   { 0,      "-W*",                  "" },
src/emu/debug/debugcpu.c
r5955r5956
9999
100100/* expression handlers */
101101static UINT64 expression_read_memory(void *param, const char *name, int space, UINT32 address, int size);
102static UINT64 expression_read_address_space(const address_space *space, offs_t address, int size);
103102static UINT64 expression_read_program_direct(const address_space *space, int opcode, offs_t address, int size);
104103static UINT64 expression_read_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size);
105104static UINT64 expression_read_eeprom(running_machine *machine, offs_t address, int size);
106105static void expression_write_memory(void *param, const char *name, int space, UINT32 address, int size, UINT64 data);
107static void expression_write_address_space(const address_space *space, offs_t address, int size, UINT64 data);
108106static void expression_write_program_direct(const address_space *space, int opcode, offs_t address, int size, UINT64 data);
109107static void expression_write_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size, UINT64 data);
110108static void expression_write_eeprom(running_machine *machine, offs_t address, int size, UINT64 data);
r5955r5956
24592457    space
24602458-------------------------------------------------*/
24612459
2462static UINT64 expression_read_memory(void *param, const char *name, int space, UINT32 address, int size)
2460static UINT64 expression_read_memory(void *param, const char *name, int spacenum, UINT32 address, int size)
24632461{
24642462   running_machine *machine = (running_machine *)param;
2463   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
24652464   const device_config *cpu = NULL;
2465   const address_space *space;
24662466
2467   switch (space)
2467   switch (spacenum)
24682468   {
2469      case EXPSPACE_PROGRAM:
2470      case EXPSPACE_DATA:
2471      case EXPSPACE_IO:
2469      case EXPSPACE_PROGRAM_LOGICAL:
2470      case EXPSPACE_DATA_LOGICAL:
2471      case EXPSPACE_IO_LOGICAL:
2472      case EXPSPACE_SPACE3_LOGICAL:
24722473         if (name != NULL)
24732474            cpu = expression_cpu_index(machine, name);
24742475         if (cpu == NULL)
24752476            cpu = debug_cpu_get_visible_cpu(machine);
2476         return expression_read_address_space(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)), address, size);
2477         space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
2478         if (space != NULL)
2479            result = debug_read_memory(space, memory_address_to_byte(space, address), size, TRUE);
2480         break;
24772481
2482      case EXPSPACE_PROGRAM_PHYSICAL:
2483      case EXPSPACE_DATA_PHYSICAL:
2484      case EXPSPACE_IO_PHYSICAL:
2485      case EXPSPACE_SPACE3_PHYSICAL:
2486         if (name != NULL)
2487            cpu = expression_cpu_index(machine, name);
2488         if (cpu == NULL)
2489            cpu = debug_cpu_get_visible_cpu(machine);
2490         space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL));
2491         if (space != NULL)
2492            result = debug_read_memory(space, memory_address_to_byte(space, address), size, FALSE);
2493         break;
2494
24782495      case EXPSPACE_OPCODE:
24792496      case EXPSPACE_RAMWRITE:
24802497         if (name != NULL)
24812498            cpu = expression_cpu_index(machine, name);
24822499         if (cpu == NULL)
24832500            cpu = debug_cpu_get_visible_cpu(machine);
2484         return expression_read_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (space == EXPSPACE_OPCODE), address, size);
2501         result = expression_read_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size);
2502         break;
24852503
24862504      case EXPSPACE_EEPROM:
2487         return expression_read_eeprom(machine, address, size);
2505         result = expression_read_eeprom(machine, address, size);
2506         break;
24882507
24892508      case EXPSPACE_REGION:
24902509         if (name == NULL)
24912510            break;
2492         return expression_read_memory_region(machine, name, address, size);
2511         result = expression_read_memory_region(machine, name, address, size);
2512         break;
24932513   }
2494   return ~(UINT64)0 >> (64 - 8*size);
2495}
2496
2497
2498/*-------------------------------------------------
2499    expression_read_address_space - read memory
2500    from a specific CPU's address space
2501-------------------------------------------------*/
2502
2503static UINT64 expression_read_address_space(const address_space *space, offs_t address, int size)
2504{
2505   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
2506
2507   if (space != NULL)
2508      result = debug_read_memory(space, memory_address_to_byte(space, address), size, TRUE);
25092514   return result;
25102515}
25112516
r5955r5956
26522657    space
26532658-------------------------------------------------*/
26542659
2655static void expression_write_memory(void *param, const char *name, int space, UINT32 address, int size, UINT64 data)
2660static void expression_write_memory(void *param, const char *name, int spacenum, UINT32 address, int size, UINT64 data)
26562661{
26572662   running_machine *machine = (running_machine *)param;
26582663   const device_config *cpu = NULL;
2664   const address_space *space;
26592665
2660   switch (space)
2666   switch (spacenum)
26612667   {
2662      case EXPSPACE_PROGRAM:
2663      case EXPSPACE_DATA:
2664      case EXPSPACE_IO:
2668      case EXPSPACE_PROGRAM_LOGICAL:
2669      case EXPSPACE_DATA_LOGICAL:
2670      case EXPSPACE_IO_LOGICAL:
2671      case EXPSPACE_SPACE3_LOGICAL:
26652672         if (name != NULL)
26662673            cpu = expression_cpu_index(machine, name);
26672674         if (cpu == NULL)
26682675            cpu = debug_cpu_get_visible_cpu(machine);
2669         expression_write_address_space(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)), address, size, data);
2676         space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
2677         if (space != NULL)
2678            debug_write_memory(space, memory_address_to_byte(space, address), data, size, TRUE);
26702679         break;
26712680
2681      case EXPSPACE_PROGRAM_PHYSICAL:
2682      case EXPSPACE_DATA_PHYSICAL:
2683      case EXPSPACE_IO_PHYSICAL:
2684      case EXPSPACE_SPACE3_PHYSICAL:
2685         if (name != NULL)
2686            cpu = expression_cpu_index(machine, name);
2687         if (cpu == NULL)
2688            cpu = debug_cpu_get_visible_cpu(machine);
2689         space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL));
2690         if (space != NULL)
2691            debug_write_memory(space, memory_address_to_byte(space, address), data, size, FALSE);
2692         break;
2693
26722694      case EXPSPACE_OPCODE:
26732695      case EXPSPACE_RAMWRITE:
26742696         if (name != NULL)
26752697            cpu = expression_cpu_index(machine, name);
26762698         if (cpu == NULL)
26772699            cpu = debug_cpu_get_visible_cpu(machine);
2678         expression_write_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (space == EXPSPACE_OPCODE), address, size, data);
2700         expression_write_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size, data);
26792701         break;
26802702
26812703      case EXPSPACE_EEPROM:
r5955r5956
26922714
26932715
26942716/*-------------------------------------------------
2695    expression_write_address_space - write memory
2696    to a specific CPU's address space
2697-------------------------------------------------*/
2698
2699static void expression_write_address_space(const address_space *space, offs_t address, int size, UINT64 data)
2700{
2701   if (space != NULL)
2702      debug_write_memory(space, memory_address_to_byte(space, address), data, size, TRUE);
2703}
2704
2705
2706/*-------------------------------------------------
27072717    expression_write_program_direct - write memory
27082718    directly to an opcode or RAM pointer
27092719-------------------------------------------------*/
r5955r5956
28792889
28802890   switch (space)
28812891   {
2882      case EXPSPACE_PROGRAM:
2883      case EXPSPACE_DATA:
2884      case EXPSPACE_IO:
2892      case EXPSPACE_PROGRAM_LOGICAL:
2893      case EXPSPACE_DATA_LOGICAL:
2894      case EXPSPACE_IO_LOGICAL:
2895      case EXPSPACE_SPACE3_LOGICAL:
28852896         if (name != NULL)
28862897         {
28872898            cpu = expression_cpu_index(machine, name);
r5955r5956
28902901         }
28912902         if (cpu == NULL)
28922903            cpu = debug_cpu_get_visible_cpu(machine);
2893         if (cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)) == NULL)
2904         if (cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM_LOGICAL)) == NULL)
28942905            return EXPRERR_NO_SUCH_MEMORY_SPACE;
28952906         break;
28962907
2908      case EXPSPACE_PROGRAM_PHYSICAL:
2909      case EXPSPACE_DATA_PHYSICAL:
2910      case EXPSPACE_IO_PHYSICAL:
2911      case EXPSPACE_SPACE3_PHYSICAL:
2912         if (name != NULL)
2913         {
2914            cpu = expression_cpu_index(machine, name);
2915            if (cpu == NULL)
2916               return EXPRERR_INVALID_MEMORY_NAME;
2917         }
2918         if (cpu == NULL)
2919            cpu = debug_cpu_get_visible_cpu(machine);
2920         if (cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM_PHYSICAL)) == NULL)
2921            return EXPRERR_NO_SUCH_MEMORY_SPACE;
2922         break;
2923
28972924      case EXPSPACE_OPCODE:
28982925      case EXPSPACE_RAMWRITE:
28992926         if (name != NULL)
src/emu/debug/express.h
r5955r5956
4747#define EXPRERR_MISSING_MEMORY_NAME         (19)
4848
4949/* values for the address space passed to external_read/write_memory */
50#define EXPSPACE_PROGRAM               (0)
51#define EXPSPACE_DATA                  (1)
52#define EXPSPACE_IO                     (2)
53#define EXPSPACE_OPCODE                  (3)
54#define EXPSPACE_RAMWRITE               (4)
55#define EXPSPACE_EEPROM                  (5)
56#define EXPSPACE_REGION                  (6)
50#define EXPSPACE_PROGRAM_LOGICAL         (0)
51#define EXPSPACE_DATA_LOGICAL            (1)
52#define EXPSPACE_IO_LOGICAL               (2)
53#define EXPSPACE_SPACE3_LOGICAL            (3)
54#define EXPSPACE_PROGRAM_PHYSICAL         (4)
55#define EXPSPACE_DATA_PHYSICAL            (5)
56#define EXPSPACE_IO_PHYSICAL            (6)
57#define EXPSPACE_SPACE3_PHYSICAL         (7)
58#define EXPSPACE_OPCODE                  (8)
59#define EXPSPACE_RAMWRITE               (9)
60#define EXPSPACE_EEPROM                  (10)
61#define EXPSPACE_REGION                  (11)
5762
5863
5964
src/emu/debug/debugcmd.c
r5955r5956
4141   UINT32      size;
4242};
4343
44
4445typedef struct _cheat_map cheat_map;
4546struct _cheat_map
4647{
r5955r5956
5152   UINT8      undo:7;
5253};
5354
55
5456typedef struct _cheat_system cheat_system;
5557struct _cheat_system
5658{
57   char         cpu;
58   UINT64         length;
59   UINT8         width;
60   cheat_map *      cheatmap;
61   UINT8         undo;
62   UINT8         signed_cheat;
63   UINT8         swapped_cheat;
59   char      cpu;
60   UINT64      length;
61   UINT8      width;
62   cheat_map *   cheatmap;
63   UINT8      undo;
64   UINT8      signed_cheat;
65   UINT8      swapped_cheat;
6466};
6567
6668
69typedef struct _cheat_region_map cheat_region_map;
70struct _cheat_region_map
71{
72   UINT64      offset;
73   UINT64      endoffset;
74   UINT8      share;
75   UINT8      disabled;
76};
77
78
79
6780/***************************************************************************
6881    GLOBAL VARIABLES
6982***************************************************************************/
r5955r5956
17081721
17091722static void execute_cheatinit(running_machine *machine, int ref, int params, const char *param[])
17101723{
1711   UINT64 offset, endoffset, length = 0, real_length = 0;
1724   UINT64 offset, length = 0, real_length = 0;
17121725   const address_space *space;
17131726   UINT32 active_cheat = 0;
17141727   UINT64 curaddr;
1728   UINT8 i, region_count = 0;
17151729
1730   address_map_entry *entry;
1731   cheat_region_map cheat_region[100];
1732
1733   memset(cheat_region, 0, sizeof(cheat_region));
1734
17161735   /* validate parameters */
17171736   if (!debug_command_parameter_cpu_space(machine, (params > 3) ? param[3] : NULL, ADDRESS_SPACE_PROGRAM, &space))
17181737      return;
17191738
17201739   if (ref == 0)
17211740   {
1741      cheat.width = 1;
1742      cheat.signed_cheat = FALSE;
1743      cheat.swapped_cheat = FALSE;
17221744      if (params > 0)
17231745      {
17241746         char *srtpnt = (char*)param[0];
r5955r5956
17521774         else
17531775            cheat.swapped_cheat = FALSE;
17541776      }
1755      else
1777   }
1778
1779   /* initialize entire memory by default */
1780   if (params <= 1)
1781   {
1782      offset = 0;
1783      length = space->bytemask + 1;
1784      for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
17561785      {
1757         cheat.width = 1;
1758         cheat.signed_cheat = FALSE;
1759         cheat.swapped_cheat = FALSE;
1786         cheat_region[region_count].offset = memory_address_to_byte(space, entry->addrstart) & space->bytemask;
1787         cheat_region[region_count].endoffset = memory_address_to_byte(space, entry->addrend) & space->bytemask;
1788         cheat_region[region_count].share = entry->share;
1789         cheat_region[region_count].disabled = (entry->write.shandler8 == SMH_RAM) ? FALSE : TRUE;
1790
1791         /* disable double share regions */
1792         if (entry->share != 0)
1793            for (i = 0; i < region_count; i++)
1794               if (cheat_region[i].share == entry->share)
1795                  cheat_region[region_count].disabled = TRUE;
1796
1797         region_count++;
17601798      }
17611799   }
1762
1763   if (params > 1)
1800   else
17641801   {
1802      /* validate parameters */
17651803      if (!debug_command_parameter_number(machine, param[(ref == 0) ? 1 : 0], &offset))
17661804         return;
17671805      if (!debug_command_parameter_number(machine, param[(ref == 0) ? 2 : 1], &length))
17681806         return;
1807
1808      /* force region to the specified range */
1809      cheat_region[region_count].offset = memory_address_to_byte(space, offset) & space->bytemask;;
1810      cheat_region[region_count].endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;;
1811      cheat_region[region_count].share = 0;
1812      cheat_region[region_count].disabled = FALSE;
1813      region_count++;
17691814   }
1770   else
1771   {
1772      /* initialize entire memory  */
1773      offset = 0;
1774      length = space->bytemask + 1;
1775   }
17761815
1777   endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;
1778   offset = memory_address_to_byte(space, offset) & space->bytemask;
1816   /* determine the writable extent of each region in total */
1817   for (i = 0; i <= region_count; i++)
1818      if (!cheat_region[i].disabled)
1819         for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += cheat.width)
1820            if (cheat_address_is_valid(space, curaddr))
1821               real_length++;
17791822
1780   /* counts the writable bytes in the area */
1781   for (curaddr = offset; curaddr <= endoffset; curaddr += cheat.width)
1782      if (cheat_address_is_valid(space, curaddr))
1783         real_length++;
1784
17851823   if (real_length == 0)
17861824   {
17871825      debug_console_printf(machine, "No writable bytes found in this area\n");
r5955r5956
18311869   }
18321870
18331871   /* initialize cheatmap in the selected space */
1834   for (curaddr = offset; curaddr <= endoffset; curaddr += cheat.width)
1835      if (cheat_address_is_valid(space, curaddr))
1836      {
1837         cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&cheat, space, curaddr);
1838         cheat.cheatmap[active_cheat].first_value = cheat.cheatmap[active_cheat].previous_value;
1839         cheat.cheatmap[active_cheat].offset = curaddr;
1840         cheat.cheatmap[active_cheat].state = 1;
1841         cheat.cheatmap[active_cheat].undo = 0;
1842         active_cheat++;
1843      }
1872   for (i = 0; i < region_count; i++)
1873      if (!cheat_region[i].disabled)
1874         for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += cheat.width)
1875            if (cheat_address_is_valid(space, curaddr))
1876            {
1877               cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&cheat, space, curaddr);
1878               cheat.cheatmap[active_cheat].first_value = cheat.cheatmap[active_cheat].previous_value;
1879               cheat.cheatmap[active_cheat].offset = curaddr;
1880               cheat.cheatmap[active_cheat].state = 1;
1881               cheat.cheatmap[active_cheat].undo = 0;
1882               active_cheat++;
1883            }
18441884
18451885   debug_console_printf(machine, "%u cheat initialized\n", active_cheat);
18461886}
r5955r5956
20672107            active_cheat++;
20682108            fprintf(f, "  <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(value, cheat.width * 2));
20692109            fprintf(f, "    <script state=\"run\">\n");
2070            fprintf(f, "      <action>%s.%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2));
2110            fprintf(f, "      <action>%s.p%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2));
20712111            fprintf(f, "    </script>\n");
20722112            fprintf(f, "  </cheat>\n\n");
20732113         }
src/emu/debug/debugcon.c
r5955r5956
6565
6666
6767/***************************************************************************
68    FUNCTION PROTOTYPES
69***************************************************************************/
6870
71static void debug_console_exit(running_machine *machine);
72
73
74
75/***************************************************************************
76
6977    Initialization and tear down
7078
7179***************************************************************************/
r5955r5956
100108    system
101109-------------------------------------------------*/
102110
103void debug_console_exit(running_machine *machine)
111static void debug_console_exit(running_machine *machine)
104112{
105113   /* free allocated memory */
106114   if (console_textbuf)
src/emu/debug/express.c
r5955r5956
8181
8282   TIN_MEMORY_SPACE_SHIFT   = 12,
8383   TIN_MEMORY_SPACE_MASK   = (0xf << TIN_MEMORY_SPACE_SHIFT),
84   TIN_MEMORY_PROGRAM      = (EXPSPACE_PROGRAM   << TIN_MEMORY_SPACE_SHIFT),
85   TIN_MEMORY_DATA         = (EXPSPACE_DATA      << TIN_MEMORY_SPACE_SHIFT),
86   TIN_MEMORY_IO         = (EXPSPACE_IO        << TIN_MEMORY_SPACE_SHIFT),
87   TIN_MEMORY_OPCODE      = (EXPSPACE_OPCODE    << TIN_MEMORY_SPACE_SHIFT),
88   TIN_MEMORY_RAMWRITE      = (EXPSPACE_RAMWRITE  << TIN_MEMORY_SPACE_SHIFT),
89   TIN_MEMORY_EEPROM      = (EXPSPACE_EEPROM     << TIN_MEMORY_SPACE_SHIFT),
90   TIN_MEMORY_REGION      = (EXPSPACE_REGION    << TIN_MEMORY_SPACE_SHIFT),
84   TIN_MEMORY_PROGRAM_LOG   = (EXPSPACE_PROGRAM_LOGICAL  << TIN_MEMORY_SPACE_SHIFT),
85   TIN_MEMORY_DATA_LOG      = (EXPSPACE_DATA_LOGICAL     << TIN_MEMORY_SPACE_SHIFT),
86   TIN_MEMORY_IO_LOG      = (EXPSPACE_IO_LOGICAL       << TIN_MEMORY_SPACE_SHIFT),
87   TIN_MEMORY_SPACE3_LOG   = (EXPSPACE_SPACE3_LOGICAL   << TIN_MEMORY_SPACE_SHIFT),
88   TIN_MEMORY_PROGRAM_PHYS   = (EXPSPACE_PROGRAM_PHYSICAL << TIN_MEMORY_SPACE_SHIFT),
89   TIN_MEMORY_DATA_PHYS   = (EXPSPACE_DATA_PHYSICAL    << TIN_MEMORY_SPACE_SHIFT),
90   TIN_MEMORY_IO_PHYS      = (EXPSPACE_IO_PHYSICAL      << TIN_MEMORY_SPACE_SHIFT),
91   TIN_MEMORY_SPACE3_PHYS   = (EXPSPACE_SPACE3_PHYSICAL  << TIN_MEMORY_SPACE_SHIFT),
92   TIN_MEMORY_OPCODE      = (EXPSPACE_OPCODE           << TIN_MEMORY_SPACE_SHIFT),
93   TIN_MEMORY_RAMWRITE      = (EXPSPACE_RAMWRITE         << TIN_MEMORY_SPACE_SHIFT),
94   TIN_MEMORY_EEPROM      = (EXPSPACE_EEPROM            << TIN_MEMORY_SPACE_SHIFT),
95   TIN_MEMORY_REGION      = (EXPSPACE_REGION           << TIN_MEMORY_SPACE_SHIFT),
9196
9297   TIN_MEMORY_INDEX_SHIFT   = 16,
9398   TIN_MEMORY_INDEX_MASK   = (0xffff << TIN_MEMORY_INDEX_SHIFT)
r5955r5956
525530   const char *startbuffer = buffer;
526531   const char *namestring = NULL;
527532   int space = 'p', size;
533   int physical = FALSE;
528534   const char *dot;
529535   int length;
530536
r5955r5956
543549      buffer = dot + 1;
544550   }
545551
546   /* length 2 means space then size */
552   /* length 3 means logical/physical, then space, then size */
547553   length = (int)strlen(buffer);
548   if (length == 2)
554   if (length == 3)
549555   {
556      if (buffer[0] != 'l' && buffer[0] != 'p')
557         return MAKE_EXPRERR_INVALID_MEMORY_SPACE(offset + (buffer - startbuffer));
558      if (buffer[1] != 'p' && buffer[1] != 'd' && buffer[1] != 'i' && buffer[1] != '3')
559         return MAKE_EXPRERR_INVALID_MEMORY_SPACE(offset + (buffer - startbuffer));
560      physical = (buffer[0] == 'p');
561      space = buffer[1];
562      size = buffer[2];
563   }
564
565   /* length 2 means space then size */
566   else if (length == 2)
567   {
550568      space = buffer[0];
551569      size = buffer[1];
552570   }
r5955r5956
562580   /* convert the space to flags */
563581   switch (space)
564582   {
565      case 'p':   *flags |= TIN_MEMORY_PROGRAM;   break;
566      case 'd':   *flags |= TIN_MEMORY_DATA;      break;
567      case 'i':   *flags |= TIN_MEMORY_IO;      break;
568      case 'o':   *flags |= TIN_MEMORY_OPCODE;   break;
569      case 'r':   *flags |= TIN_MEMORY_RAMWRITE;   break;
570      case 'e':   *flags |= TIN_MEMORY_EEPROM;   break;
571      case 'm':   *flags |= TIN_MEMORY_REGION;   break;
583      case 'p':   *flags |= physical ? TIN_MEMORY_PROGRAM_PHYS : TIN_MEMORY_PROGRAM_LOG;   break;
584      case 'd':   *flags |= physical ? TIN_MEMORY_DATA_PHYS    : TIN_MEMORY_DATA_LOG;      break;
585      case 'i':   *flags |= physical ? TIN_MEMORY_IO_PHYS      : TIN_MEMORY_IO_LOG;      break;
586      case '3':   *flags |= physical ? TIN_MEMORY_SPACE3_PHYS  : TIN_MEMORY_SPACE3_LOG;   break;
587      case 'o':   *flags |= TIN_MEMORY_OPCODE;                                 break;
588      case 'r':   *flags |= TIN_MEMORY_RAMWRITE;                                 break;
589      case 'e':   *flags |= TIN_MEMORY_EEPROM;                                 break;
590      case 'm':   *flags |= TIN_MEMORY_REGION;                                 break;
572591      default:   return MAKE_EXPRERR_INVALID_MEMORY_SPACE(offset + (buffer - startbuffer));
573592   }
574593
src/emu/debug/debugcon.h
r5955r5956
7777
7878/* initialization */
7979void            debug_console_init(running_machine *machine);
80void            debug_console_exit(running_machine *machine);
8180
8281/* command handling */
8382CMDERR            debug_console_execute_command(running_machine *machine, const char *command, int echo);
src/emu/cpu/h83002/h8_16.c
r5955r5956
653653{
654654   switch (state)
655655   {
656      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = address_map_h8_3007_internal_map;  break;
656      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3007_internal_map);  break;
657657      case CPUINFO_FCT_INIT:            info->init = CPU_INIT_NAME(h8_3007);      break;
658658      case DEVINFO_STR_NAME:            strcpy(info->s, "H8/3007");      break;
659659      default:
src/emu/cpu/h83002/h8_8.c
r5955r5956
747747   case CPUINFO_INT_ADDRBUS_SHIFT_IO:   info->i = 0;                  break;
748748
749749      // Internal maps
750   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = address_map_h8_3334_internal_map; break;
750   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(h8_3334_internal_map); break;
751751   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = NULL;   break;
752752   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map16 = NULL;   break;
753753
src/emu/cpu/m68000/m68000.h
r5955r5956
2626   M68K_CPU_TYPE_68010,
2727   M68K_CPU_TYPE_68EC020,
2828   M68K_CPU_TYPE_68020,
29   M68K_CPU_TYPE_68030,   /* Supported by disassembler ONLY */
29   M68K_CPU_TYPE_68EC030,
30   M68K_CPU_TYPE_68030,
31   M68K_CPU_TYPE_68EC040,
3032   M68K_CPU_TYPE_68040,
3133   M68K_CPU_TYPE_SCC68070
3234};
r5955r5956
7476CPU_GET_INFO( m68010 );
7577CPU_GET_INFO( m68ec020 );
7678CPU_GET_INFO( m68020 );
79CPU_GET_INFO( m68ec030 );
80CPU_GET_INFO( m68030 );
81CPU_GET_INFO( m68ec040 );
7782CPU_GET_INFO( m68040 );
7883
7984CPU_GET_INFO( scc68070 );
r5955r5956
8388#define CPU_M68010 CPU_GET_INFO_NAME( m68010 )
8489#define CPU_M68EC020 CPU_GET_INFO_NAME( m68ec020 )
8590#define CPU_M68020 CPU_GET_INFO_NAME( m68020 )
91#define CPU_M68EC030 CPU_GET_INFO_NAME( m68ec030 )
92#define CPU_M68030 CPU_GET_INFO_NAME( m68030 )
93#define CPU_M68EC040 CPU_GET_INFO_NAME( m68ec040 )
8694#define CPU_M68040 CPU_GET_INFO_NAME( m68040 )
8795
8896#define CPU_SCC68070 CPU_GET_INFO_NAME( scc68070 )
src/emu/cpu/m68000/m68kcpu.h
r5955r5956
7373#define FUNCTION_CODE_CPU_SPACE          7
7474
7575/* CPU types for deciding what to emulate */
76#define CPU_TYPE_000      1
77#define CPU_TYPE_008      2
78#define CPU_TYPE_010      4
79#define CPU_TYPE_EC020    8
80#define CPU_TYPE_020      16
81#define CPU_TYPE_040      32
82#define CPU_TYPE_060      64
83#define CPU_TYPE_SCC070 128
76#define CPU_TYPE_000   (0x00000001)
77#define CPU_TYPE_008    (0x00000002)
78#define CPU_TYPE_010    (0x00000004)
79#define CPU_TYPE_EC020  (0x00000008)
80#define CPU_TYPE_020    (0x00000010)
81#define CPU_TYPE_EC030  (0x00000020)
82#define CPU_TYPE_030    (0x00000040)
83#define CPU_TYPE_EC040  (0x00000080)
84#define CPU_TYPE_040    (0x00000100)
85#define CPU_TYPE_SCC070 (0x00000200)
8486
8587/* Different ways to stop the CPU */
8688#define STOP_LEVEL_STOP 1
r5955r5956
217219/* These defines are dependant on the configuration defines in m68kconf.h */
218220
219221/* Disable certain comparisons if we're not using all CPU types */
220#define CPU_TYPE_IS_040_PLUS(A)    ((A) & CPU_TYPE_040)
222#define CPU_TYPE_IS_040_PLUS(A)    ((A) & (CPU_TYPE_040 | CPU_TYPE_EC040))
221223#define CPU_TYPE_IS_040_LESS(A)    1
222224
223#define CPU_TYPE_IS_020_PLUS(A)    ((A) & (CPU_TYPE_020 | CPU_TYPE_040))
225#define CPU_TYPE_IS_030_PLUS(A)    ((A) & (CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040))
226#define CPU_TYPE_IS_030_LESS(A)    1
227
228#define CPU_TYPE_IS_020_PLUS(A)    ((A) & (CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040))
224229#define CPU_TYPE_IS_020_LESS(A)    1
225230
226231#define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020))
227232
228#define CPU_TYPE_IS_EC020_PLUS(A)  ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040))
233#define CPU_TYPE_IS_EC020_PLUS(A)  ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040))
229234#define CPU_TYPE_IS_EC020_LESS(A)  ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020))
230235
231236#define CPU_TYPE_IS_010(A)         ((A) == CPU_TYPE_010)
232#define CPU_TYPE_IS_010_PLUS(A)    ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040))
233#define CPU_TYPE_IS_010_LESS(A)    ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_SCC070))
237#define CPU_TYPE_IS_010_PLUS(A)    ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_040 | CPU_TYPE_EC040))
238#define CPU_TYPE_IS_010_LESS(A)    ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010))
234239
235240#define CPU_TYPE_IS_000(A)         ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008)
236241
r5955r5956
542547
543548struct _m68ki_cpu_core
544549{
545   UINT32 cpu_type;     /* CPU Type: 68000, 68008, 68010, 68EC020, or 68020 */
550   UINT32 cpu_type;     /* CPU Type: 68000, 68008, 68010, 68EC020, 68020, 68EC030, 68030, 68EC040, or 68040 */
546551   UINT32 dasm_type;    /* disassembly type */
547552   UINT32 dar[16];      /* Data and Address Registers */
548553   UINT32 ppc;         /* Previous program counter */
r5955r5956
575580   UINT32 sr_mask;      /* Implemented status register bits */
576581   UINT32 instr_mode;   /* Stores whether we are in instruction mode or group 0/1 exception mode */
577582   UINT32 run_mode;     /* Stores whether we are processing a reset, bus error, address error, or something else */
583   int    has_pmmu;     /* Indicates if a PMMU available (yes on 030, 040, no on EC030) */
578584
579585   /* Clocks required for instructions / exceptions */
580586   UINT32 cyc_bcc_notake_b;
src/emu/cpu/m68000/m68kmake.c
r5955r5956
33/* ======================================================================== */
44/*
55 *                                  MUSASHI
6 *                                Version 3.32
6 *                                Version 4.10
77 *
88 * A portable Motorola M680x0 processor emulation engine.
99 * Copyright Karl Stenerud.  All rights reserved.
r5955r5956
1616 * (Karl Stenerud).
1717 *
1818 * The latest version of this code can be obtained at:
19 * http://kstenerud.cjb.net
19 * http://kstenerud.cjb.net or http://mamedev.org/
2020 */
2121
2222/*
2323 * Modified For OpenVMS By:  Robert Alan Byer
2424 *                           byer@mail.ourservers.net
25 *
26 * 68030 and PMMU by R. Belmont
27 * 68040 and FPU by Ville Linde
2528 */
2629
2730
r5955r5956
5255 */
5356
5457
55static const char g_version[] = "3.32";
58static const char g_version[] = "4.10";
5659
5760/* ======================================================================== */
5861/* =============================== INCLUDES =============================== */
r5955r5956
132135   CPU_TYPE_000 = 0,
133136   CPU_TYPE_010,
134137   CPU_TYPE_020,
138   CPU_TYPE_030,
135139   CPU_TYPE_040,
136140   NUM_CPUS
137141};
r5955r5956
182186   char ea_allowed[EA_ALLOWED_LENGTH];   /* Effective addressing modes allowed */
183187   char cpu_mode[NUM_CPUS];              /* User or supervisor mode */
184188   char cpus[NUM_CPUS+1];                /* Allowed CPUs */
185   unsigned char cycles[NUM_CPUS];       /* cycles for 000, 010, 020 */
189   unsigned char cycles[NUM_CPUS];       /* cycles for 000, 010, 020, 030, 040 */
186190} opcode_struct;
187191
188192
r5955r5956
313317};
314318
315319/* Extra cycles required for certain EA modes */
316/* TODO: correct timings for 040 */
320/* TODO: correct timings for 030, 040 */
317321static const int g_ea_cycle_table[13][NUM_CPUS][3] =
318{/*       000           010           020           040  */
319   {{ 0,  0,  0}, { 0,  0,  0}, { 0,  0,  0}, { 0,  0,  0}}, /* EA_MODE_NONE */
320   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_AI   */
321   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_PI   */
322   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_PI7  */
323   {{ 0,  6, 10}, { 0,  6, 10}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_PD   */
324   {{ 0,  6, 10}, { 0,  6, 10}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_PD7  */
325   {{ 0,  8, 12}, { 0,  8, 12}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_DI   */
326   {{ 0, 10, 14}, { 0, 10, 14}, { 0,  7,  7}, { 0,  7,  7}}, /* EA_MODE_IX   */
327   {{ 0,  8, 12}, { 0,  8, 12}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_AW   */
328   {{ 0, 12, 16}, { 0, 12, 16}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_AL   */
329   {{ 0,  8, 12}, { 0,  8, 12}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_PCDI */
330   {{ 0, 10, 14}, { 0, 10, 14}, { 0,  7,  7}, { 0,  7,  7}}, /* EA_MODE_PCIX */
331   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  2,  4}, { 0,  2,  4}}, /* EA_MODE_I    */
322{/*       000           010           020           030           040  */
323   {{ 0,  0,  0}, { 0,  0,  0}, { 0,  0,  0}, { 0,  0,  0}, { 0,  0,  0}}, /* EA_MODE_NONE */
324   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  4,  4}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_AI   */
325   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  4,  4}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_PI   */
326   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  4,  4}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_PI7  */
327   {{ 0,  6, 10}, { 0,  6, 10}, { 0,  5,  5}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_PD   */
328   {{ 0,  6, 10}, { 0,  6, 10}, { 0,  5,  5}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_PD7  */
329   {{ 0,  8, 12}, { 0,  8, 12}, { 0,  5,  5}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_DI   */
330   {{ 0, 10, 14}, { 0, 10, 14}, { 0,  7,  7}, { 0,  7,  7}, { 0,  7,  7}}, /* EA_MODE_IX   */
331   {{ 0,  8, 12}, { 0,  8, 12}, { 0,  4,  4}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_AW   */
332   {{ 0, 12, 16}, { 0, 12, 16}, { 0,  4,  4}, { 0,  4,  4}, { 0,  4,  4}}, /* EA_MODE_AL   */
333   {{ 0,  8, 12}, { 0,  8, 12}, { 0,  5,  5}, { 0,  5,  5}, { 0,  5,  5}}, /* EA_MODE_PCDI */
334   {{ 0, 10, 14}, { 0, 10, 14}, { 0,  7,  7}, { 0,  7,  7}, { 0,  7,  7}}, /* EA_MODE_PCIX */
335   {{ 0,  4,  8}, { 0,  4,  8}, { 0,  2,  4}, { 0,  2,  4}, { 0,  2,  4}}, /* EA_MODE_I    */
332336};
333337
334338/* Extra cycles for JMP instruction (000, 010) */
r5955r5956
10731077   /* Find the start of the table */
10741078   while(strcmp(buff, ID_TABLE_START) != 0)
10751079      if(fgetline(buff, MAX_LINE_LENGTH, g_input_file) < 0)
1076         error_exit("Premature EOF while reading table");
1080         error_exit("(table_start) Premature EOF while reading table");
10771081
10781082   /* Process the entire table */
10791083   for(op = g_opcode_input_table;;op++)
10801084   {
10811085      if(fgetline(buff, MAX_LINE_LENGTH, g_input_file) < 0)
1082         error_exit("Premature EOF while reading table");
1086         error_exit("(inline) Premature EOF while reading table");
10831087      if(strlen(buff) == 0)
10841088         continue;
10851089      /* We finish when we find an input separator */
r5955r5956
12371241   int table_body_read = 0;
12381242   int ophandler_body_read = 0;
12391243
1240   printf("\n\tMusashi v%s 68000, 68008, 68010, 68EC020, 68020, 68040 emulator\n", g_version);
1244   printf("\n\tMusashi v%s 68000, 68008, 68010, 68EC020, 68020, 68EC030, 68030, 68EC040, 68040 emulator\n", g_version);
12411245   printf("\tCopyright Karl Stenerud\n\n");
12421246
12431247   /* Check if output path and source for the input file are given */
src/emu/cpu/m68000/m68kdasm.c
r5955r5956
225225     "?",   "?",   "?",   "?",   "?",   "?",   "?",   "?"  /* 111 */
226226};
227227
228static const char *const g_mmuregs[8] =
229{
230   "tc", "drp", "srp", "crp", "cal", "val", "sccr", "acr"
231};
228232
229233/* ======================================================================== */
230234/* =========================== UTILITY FUNCTIONS ========================== */
r5955r5956
30153019}
30163020
30173021
3022static void d68030_pmove(void)
3023{
3024   char* str;
3025   UINT16 modes = read_imm_16();
30183026
3027   // do this after fetching the second PMOVE word so we properly get the 3rd if necessary
3028   str = get_ea_mode_str_32(g_cpu_ir);
3029
3030   switch ((modes>>13) & 0x7)
3031   {
3032      case 0:   // MC68030/040 form with FD bit
3033      case 2:   // MC68881 form, FD never set
3034         if (modes & 0x0100)
3035         {
3036            if (modes & 0x0200)
3037            {
3038                sprintf(g_dasm_str, "pmovefd  %s, %s", g_mmuregs[(modes>>10)&7], str);
3039            }
3040            else
3041            {
3042                sprintf(g_dasm_str, "pmovefd  %s, %s", str, g_mmuregs[(modes>>10)&7]);
3043            }
3044         }
3045         else
3046         {
3047            if (modes & 0x0200)
3048            {
3049                sprintf(g_dasm_str, "pmove  %s, %s", g_mmuregs[(modes>>10)&7], str);
3050            }
3051            else
3052            {
3053                sprintf(g_dasm_str, "pmove  %s, %s", str, g_mmuregs[(modes>>10)&7]);
3054            }
3055         }
3056         break;
3057
3058      case 3:   // MC68030 to/from status reg
3059         if (modes & 0x0200)
3060         {
3061             sprintf(g_dasm_str, "pmove  mmusr, %s", str);
3062         }
3063         else
3064         {
3065             sprintf(g_dasm_str, "pmove  %s, mmusr", str);
3066         }
3067         break;
3068
3069      default:
3070         sprintf(g_dasm_str, "pmove [unknown form] %s", str);
3071         break;
3072   }
3073}
3074
3075
30193076/* ======================================================================== */
30203077/* ======================= INSTRUCTION TABLE BUILDER ====================== */
30213078/* ======================================================================== */
r5955r5956
30373094
30383095static const opcode_struct g_opcode_info[] =
30393096{
3040/*  opcode handler    mask    match   ea mask */
3097/*  opcode handler             mask    match   ea mask */
30413098   {d68000_1010         , 0xf000, 0xa000, 0x000},
30423099   {d68000_1111         , 0xf000, 0xf000, 0x000},
30433100   {d68000_abcd_rr      , 0xf1f8, 0xc100, 0x000},
r5955r5956
33383395   {d68000_unlk         , 0xfff8, 0x4e58, 0x000},
33393396   {d68020_unpk_rr      , 0xf1f8, 0x8180, 0x000},
33403397   {d68020_unpk_mm      , 0xf1f8, 0x8188, 0x000},
3398   {d68030_pmove        , 0xffc0, 0xf000, 0x278},
33413399   {0, 0, 0, 0}
33423400};
33433401
src/emu/cpu/m68000/m68k_in.c
r5955r5956
125125
126126#include "m68kops.h"
127127
128#define NUM_CPU_TYPES 4
128#define NUM_CPU_TYPES 5
129129
130130void  (*m68ki_instruction_jump_table[0x10000])(m68ki_cpu_core *m68k); /* opcode handler jump table */
131131unsigned char m68ki_cycles[NUM_CPU_TYPES][0x10000]; /* Cycles used by CPU type */
r5955r5956
150150XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
151151M68KMAKE_TABLE_FOOTER
152152
153   {0, 0, 0, {0, 0, 0, 0}}
153   {0, 0, 0, {0, 0, 0, 0, 0}}
154154};
155155
156156
r5955r5956
351351
352352
353353
354              spec  spec                    allowed ea  mode     cpu cycles
355name    size  proc   ea   bit pattern       A+-DXWLdxI  0 1 2 4  000 010 020 040  comments
356======  ====  ====  ====  ================  ==========  = = = =  === === === === =============
354              spec  spec                    allowed ea  mode       cpu cycles
355name    size  proc   ea   bit pattern       A+-DXWLdxI  0 1 2 3 4  000 010 020 030 040  comments
356======  ====  ====  ====  ================  ==========  = = = = =  === === === === === =============
357357M68KMAKE_TABLE_START
3581010       0  .     .     1010............  ..........  U U U U   4   4   4   4
3591111       0  .     .     1111............  ..........  U U U U   4   4   4   4
360040fpu0   32  .     .     11110010........  ..........  . . . U   .   .   .   0
361040fpu1   32  .     .     11110011........  ..........  . . . U   .   .   .   0
362abcd       8  rr    .     1100...100000...  ..........  U U U U   6   6   4   4
363abcd       8  mm    ax7   1100111100001...  ..........  U U U U  18  18  16  16
364abcd       8  mm    ay7   1100...100001111  ..........  U U U U  18  18  16  16
365abcd       8  mm    axy7  1100111100001111  ..........  U U U U  18  18  16  16
366abcd       8  mm    .     1100...100001...  ..........  U U U U  18  18  16  16
367add        8  er    d     1101...000000...  ..........  U U U U   4   4   2   2
368add        8  er    .     1101...000......  A+-DXWLdxI  U U U U   4   4   2   2
369add       16  er    d     1101...001000...  ..........  U U U U   4   4   2   2
370add       16  er    a     1101...001001...  ..........  U U U U   4   4   2   2
371add       16  er    .     1101...001......  A+-DXWLdxI  U U U U   4   4   2   2
372add       32  er    d     1101...010000...  ..........  U U U U   6   6   2   2
373add       32  er    a     1101...010001...  ..........  U U U U   6   6   2   2
374add       32  er    .     1101...010......  A+-DXWLdxI  U U U U   6   6   2   2
375add        8  re    .     1101...100......  A+-DXWL...  U U U U   8   8   4   4
376add       16  re    .     1101...101......  A+-DXWL...  U U U U   8   8   4   4
377add       32  re    .     1101...110......  A+-DXWL...  U U U U  12  12   4   4
378adda      16  .     d     1101...011000...  ..........  U U U U   8   8   2   2
379adda      16  .     a     1101...011001...  ..........  U U U U   8   8   2   2
380adda      16  .     .     1101...011......  A+-DXWLdxI  U U U U   8   8   2   2
381adda      32  .     d     1101...111000...  ..........  U U U U   6   6   2   2
382adda      32  .     a     1101...111001...  ..........  U U U U   6   6   2   2
383adda      32  .     .     1101...111......  A+-DXWLdxI  U U U U   6   6   2   2
384addi       8  .     d     0000011000000...  ..........  U U U U   8   8   2   2
385addi       8  .     .     0000011000......  A+-DXWL...  U U U U  12  12   4   4
386addi      16  .     d     0000011001000...  ..........  U U U U   8   8   2   2
387addi      16  .     .     0000011001......  A+-DXWL...  U U U U  12  12   4   4
388addi      32  .     d     0000011010000...  ..........  U U U U  16  14   2   2
389addi      32  .     .     0000011010......  A+-DXWL...  U U U U  20  20   4   4
390addq       8  .     d     0101...000000...  ..........  U U U U   4   4   2   2
391addq       8  .     .     0101...000......  A+-DXWL...  U U U U   8   8   4   4
392addq      16  .     d     0101...001000...  ..........  U U U U   4   4   2   2
393addq      16  .     a     0101...001001...  ..........  U U U U   4   4   2   2
394addq      16  .     .     0101...001......  A+-DXWL...  U U U U   8   8   4   4
395addq      32  .     d     0101...010000...  ..........  U U U U   8   8   2   2
396addq      32  .     a     0101...010001...  ..........  U U U U   8   8   2   2
397addq      32  .     .     0101...010......  A+-DXWL...  U U U U  12  12   4   4
398addx       8  rr    .     1101...100000...  ..........  U U U U   4   4   2   2
399addx      16  rr    .     1101...101000...  ..........  U U U U   4   4   2   2
400addx      32  rr    .     1101...110000...  ..........  U U U U   8   6   2   2
401addx       8  mm    ax7   1101111100001...  ..........  U U U U  18  18  12  12
402addx       8  mm    ay7   1101...100001111  ..........  U U U U  18  18  12  12
403addx       8  mm    axy7  1101111100001111  ..........  U U U U  18  18  12  12
404addx       8  mm    .     1101...100001...  ..........  U U U U  18  18  12  12
405addx      16  mm    .     1101...101001...  ..........  U U U U  18  18  12  12
406addx      32  mm    .     1101...110001...  ..........  U U U U  30  30  12  12
407and        8  er    d     1100...000000...  ..........  U U U U   4   4   2   2
408and        8  er    .     1100...000......  A+-DXWLdxI  U U U U   4   4   2   2
409and       16  er    d     1100...001000...  ..........  U U U U   4   4   2   2
410and       16  er    .     1100...001......  A+-DXWLdxI  U U U U   4   4   2   2
411and       32  er    d     1100...010000...  ..........  U U U U   6   6   2   2
412and       32  er    .     1100...010......  A+-DXWLdxI  U U U U   6   6   2   2
413and        8  re    .     1100...100......  A+-DXWL...  U U U U   8   8   4   4
414and       16  re    .     1100...101......  A+-DXWL...  U U U U   8   8   4   4
415and       32  re    .     1100...110......  A+-DXWL...  U U U U  12  12   4   4
416andi      16  toc   .     0000001000111100  ..........  U U U U  20  16  12  12
417andi      16  tos   .     0000001001111100  ..........  S S S S  20  16  12  12
418andi       8  .     d     0000001000000...  ..........  U U U U   8   8   2   2
419andi       8  .     .     0000001000......  A+-DXWL...  U U U U  12  12   4   4
420andi      16  .     d     0000001001000...  ..........  U U U U   8   8   2   2
421andi      16  .     .     0000001001......  A+-DXWL...  U U U U  12  12   4   4
422andi      32  .     d     0000001010000...  ..........  U U U U  14  14   2   2
423andi      32  .     .     0000001010......  A+-DXWL...  U U U U  20  20   4   4
424asr        8  s     .     1110...000000...  ..........  U U U U   6   6   6   6
425asr       16  s     .     1110...001000...  ..........  U U U U   6   6   6   6
426asr       32  s     .     1110...010000...  ..........  U U U U   8   8   6   6
427asr        8  r     .     1110...000100...  ..........  U U U U   6   6   6   6
428asr       16  r     .     1110...001100...  ..........  U U U U   6   6   6   6
429asr       32  r     .     1110...010100...  ..........  U U U U   8   8   6   6
430asr       16  .     .     1110000011......  A+-DXWL...  U U U U   8   8   5   5
431asl        8  s     .     1110...100000...  ..........  U U U U   6   6   8   8
432asl       16  s     .     1110...101000...  ..........  U U U U   6   6   8   8
433asl       32  s     .     1110...110000...  ..........  U U U U   8   8   8   8
434asl        8  r     .     1110...100100...  ..........  U U U U   6   6   8   8
435asl       16  r     .     1110...101100...  ..........  U U U U   6   6   8   8
436asl       32  r     .     1110...110100...  ..........  U U U U   8   8   8   8
437asl       16  .     .     1110000111......  A+-DXWL...  U U U U   8   8   6   6
438bcc        8  .     .     0110............  ..........  U U U U  10  10   6   6
439bcc       16  .     .     0110....00000000  ..........  U U U U  10  10   6   6
440bcc       32  .     .     0110....11111111  ..........  U U U U  10  10   6   6
441bchg       8  r     .     0000...101......  A+-DXWL...  U U U U   8   8   4   4
442bchg      32  r     d     0000...101000...  ..........  U U U U   8   8   4   4
443bchg       8  s     .     0000100001......  A+-DXWL...  U U U U  12  12   4   4
444bchg      32  s     d     0000100001000...  ..........  U U U U  12  12   4   4
445bclr       8  r     .     0000...110......  A+-DXWL...  U U U U   8  10   4   4
446bclr      32  r     d     0000...110000...  ..........  U U U U  10  10   4   4
447bclr       8  s     .     0000100010......  A+-DXWL...  U U U U  12  12   4   4
448bclr      32  s     d     0000100010000...  ..........  U U U U  14  14   4   4
449bfchg     32  .     d     1110101011000...  ..........  . . U U   .   .  12  12  timing not quite correct
450bfchg     32  .     .     1110101011......  A..DXWL...  . . U U   .   .  20  20
451bfclr     32  .     d     1110110011000...  ..........  . . U U   .   .  12  12
452bfclr     32  .     .     1110110011......  A..DXWL...  . . U U   .   .  20  20
453bfexts    32  .     d     1110101111000...  ..........  . . U U   .   .   8   8
454bfexts    32  .     .     1110101111......  A..DXWLdx.  . . U U   .   .  15  15
455bfextu    32  .     d     1110100111000...  ..........  . . U U   .   .   8   8
456bfextu    32  .     .     1110100111......  A..DXWLdx.  . . U U   .   .  15  15
457bfffo     32  .     d     1110110111000...  ..........  . . U U   .   .  18  18
458bfffo     32  .     .     1110110111......  A..DXWLdx.  . . U U   .   .  28  28
459bfins     32  .     d     1110111111000...  ..........  . . U U   .   .  10  10
460bfins     32  .     .     1110111111......  A..DXWL...  . . U U   .   .  17  17
461bfset     32  .     d     1110111011000...  ..........  . . U U   .   .  12  12
462bfset     32  .     .     1110111011......  A..DXWL...  . . U U   .   .  20  20
463bftst     32  .     d     1110100011000...  ..........  . . U U   .   .   6   6
464bftst     32  .     .     1110100011......  A..DXWLdx.  . . U U   .   .  13  13
465bkpt       0  .     .     0100100001001...  ..........  . U U U   .  10  10  10
466bra        8  .     .     01100000........  ..........  U U U U  10  10  10  10
467bra       16  .     .     0110000000000000  ..........  U U U U  10  10  10  10
468bra       32  .     .     0110000011111111  ..........  U U U U  10  10  10  10
469bset      32  r     d     0000...111000...  ..........  U U U U   8   8   4   4
470bset       8  r     .     0000...111......  A+-DXWL...  U U U U   8   8   4   4
471bset       8  s     .     0000100011......  A+-DXWL...  U U U U  12  12   4   4
472bset      32  s     d     0000100011000...  ..........  U U U U  12  12   4   4
473bsr        8  .     .     01100001........  ..........  U U U U  18  18   7   7
474bsr       16  .     .     0110000100000000  ..........  U U U U  18  18   7   7
475bsr       32  .     .     0110000111111111  ..........  U U U U  18  18   7   7
476btst       8  r     .     0000...100......  A+-DXWLdxI  U U U U   4   4   4   4
477btst      32  r     d     0000...100000...  ..........  U U U U   6   6   4   4
478btst       8  s     .     0000100000......  A+-DXWLdx.  U U U U   8   8   4   4
479btst      32  s     d     0000100000000...  ..........  U U U U  10  10   4   4
480callm     32  .     .     0000011011......  A..DXWLdx.  . . U U   .   .  60  60  not properly emulated
481cas        8  .     .     0000101011......  A+-DXWL...  . . U U   .   .  12  12
482cas       16  .     .     0000110011......  A+-DXWL...  . . U U   .   .  12  12
483cas       32  .     .     0000111011......  A+-DXWL...  . . U U   .   .  12  12
484cas2      16  .     .     0000110011111100  ..........  . . U U   .   .  12  12
485cas2      32  .     .     0000111011111100  ..........  . . U U   .   .  12  12
486chk       16  .     d     0100...110000...  ..........  U U U U  10   8   8   8
487chk       16  .     .     0100...110......  A+-DXWLdxI  U U U U  10   8   8   8
488chk       32  .     d     0100...100000...  ..........  . . U U   .   .   8   8
489chk       32  .     .     0100...100......  A+-DXWLdxI  . . U U   .   .   8   8
490chk2cmp2   8  .     pcdi  0000000011111010  ..........  . . U U   .   .  23  23
491chk2cmp2   8  .     pcix  0000000011111011  ..........  . . U U   .   .  23  23
492chk2cmp2   8  .     .     0000000011......  A..DXWL...  . . U U   .   .  18  18
493chk2cmp2  16  .     pcdi  0000001011111010  ..........  . . U U   .   .  23  23
494chk2cmp2  16  .     pcix  0000001011111011  ..........  . . U U   .   .  23  23
495chk2cmp2  16  .     .     0000001011......  A..DXWL...  . . U U   .   .  18  18
496chk2cmp2  32  .     pcdi  0000010011111010  ..........  . . U U   .   .  23  23
497chk2cmp2  32  .     pcix  0000010011111011  ..........  . . U U   .   .  23  23
498chk2cmp2  32  .     .     0000010011......  A..DXWL...  . . U U   .   .  18  18
499clr        8  .     d     0100001000000...  ..........  U U U U   4   4   2   2
500clr        8  .     .     0100001000......  A+-DXWL...  U U U U   8   4   4   4
501clr       16  .     d     0100001001000...  ..........  U U U U   4   4   2   2
502clr       16  .     .     0100001001......  A+-DXWL...  U U U U   8   4   4   4
503clr       32  .     d     0100001010000...  ..........  U U U U   6   6   2   2
504clr       32  .     .     0100001010......  A+-DXWL...  U U U U  12   6   4   4
505cmp        8  .     d     1011...000000...  ..........  U U U U   4   4   2   2
506cmp        8  .     .     1011...000......  A+-DXWLdxI  U U U U   4   4   2   2
507cmp       16  .     d     1011...001000...  ..........  U U U U   4   4   2   2
508cmp       16  .     a     1011...001001...  ..........  U U U U   4   4   2   2
509cmp       16  .     .     1011...001......  A+-DXWLdxI  U U U U   4   4   2   2
510cmp       32  .     d     1011...010000...  ..........  U U U U   6   6   2   2
511cmp       32  .     a     1011...010001...  ..........  U U U U   6   6   2   2
512cmp       32  .     .     1011...010......  A+-DXWLdxI  U U U U   6   6   2   2
513cmpa      16  .     d     1011...011000...  ..........  U U U U   6   6   4   4
514cmpa      16  .     a     1011...011001...  ..........  U U U U   6   6   4   4
515cmpa      16  .     .     1011...011......  A+-DXWLdxI  U U U U   6   6   4   4
516cmpa      32  .     d     1011...111000...  ..........  U U U U   6   6   4   4
517cmpa      32  .     a     1011...111001...  ..........  U U U U   6   6   4   4
518cmpa      32  .     .     1011...111......  A+-DXWLdxI  U U U U   6   6   4   4
519cmpi       8  .     d     0000110000000...  ..........  U U U U   8   8   2   2
520cmpi       8  .     .     0000110000......  A+-DXWL...  U U U U   8   8   2   2
521cmpi       8  .     pcdi  0000110000111010  ..........  . . U U   .   .   7   7
522cmpi       8  .     pcix  0000110000111011  ..........  . . U U   .   .   9   9
523cmpi      16  .     d     0000110001000...  ..........  U U U U   8   8   2   2
524cmpi      16  .     .     0000110001......  A+-DXWL...  U U U U   8   8   2   2
525cmpi      16  .     pcdi  0000110001111010  ..........  . . U U   .   .   7   7
526cmpi      16  .     pcix  0000110001111011  ..........  . . U U   .   .   9   9
527cmpi      32  .     d     0000110010000...  ..........  U U U U  14  12   2   2
528cmpi      32  .     .     0000110010......  A+-DXWL...  U U U U  12  12   2   2
529cmpi      32  .     pcdi  0000110010111010  ..........  . . U U   .   .   7   7
530cmpi      32  .     pcix  0000110010111011  ..........  . . U U   .   .   9   9
531cmpm       8  .     ax7   1011111100001...  ..........  U U U U  12  12   9   9
532cmpm       8  .     ay7   1011...100001111  ..........  U U U U  12  12   9   9
533cmpm       8  .     axy7  1011111100001111  ..........  U U U U  12  12   9   9
534cmpm       8  .     .     1011...100001...  ..........  U U U U  12  12   9   9
535cmpm      16  .     .     1011...101001...  ..........  U U U U  12  12   9   9
536cmpm      32  .     .     1011...110001...  ..........  U U U U  20  20   9   9
537cpbcc     32  .     .     1111...01.......  ..........  . . U .   .   .   4   .  unemulated
538cpdbcc    32  .     .     1111...001001...  ..........  . . U .   .   .   4   .  unemulated
539cpgen     32  .     .     1111...000......  ..........  . . U .   .   .   4   .  unemulated
540cpscc     32  .     .     1111...001......  ..........  . . U .   .   .   4   .  unemulated
541cptrapcc  32  .     .     1111...001111...  ..........  . . U .   .   .   4   .  unemulated
542dbt       16  .     .     0101000011001...  ..........  U U U U  12  12   6   6
543dbf       16  .     .     0101000111001...  ..........  U U U U  12  12   6   6
544dbcc      16  .     .     0101....11001...  ..........  U U U U  12  12   6   6
545divs      16  .     d     1000...111000...  ..........  U U U U 158 122  56  56
546divs      16  .     .     1000...111......  A+-DXWLdxI  U U U U 158 122  56  56
547divu      16  .     d     1000...011000...  ..........  U U U U 140 108  44  44
548divu      16  .     .     1000...011......  A+-DXWLdxI  U U U U 140 108  44  44
549divl      32  .     d     0100110001000...  ..........  . . U U   .   .  84  84
550divl      32  .     .     0100110001......  A+-DXWLdxI  . . U U   .   .  84  84
551eor        8  .     d     1011...100000...  ..........  U U U U   4   4   2   2
552eor        8  .     .     1011...100......  A+-DXWL...  U U U U   8   8   4   4
553eor       16  .     d     1011...101000...  ..........  U U U U   4   4   2   2
554eor       16  .     .     1011...101......  A+-DXWL...  U U U U   8   8   4   4
555eor       32  .     d     1011...110000...  ..........  U U U U   8   6   2   2
556eor       32  .     .     1011...110......  A+-DXWL...  U U U U  12  12   4   4
557eori      16  toc   .     0000101000111100  ..........  U U U U  20  16  12  12
558eori      16  tos   .     0000101001111100  ..........  S S S S  20  16  12  12
559eori       8  .     d     0000101000000...  ..........  U U U U   8   8   2   2
560eori       8  .     .     0000101000......  A+-DXWL...  U U U U  12  12   4   4
561eori      16  .     d     0000101001000...  ..........  U U U U   8   8   2   2
562eori      16  .     .     0000101001......  A+-DXWL...  U U U U  12  12   4   4
563eori      32  .     d     0000101010000...  ..........  U U U U  16  14   2   2
564eori      32  .     .     0000101010......  A+-DXWL...  U U U U  20  20   4   4
565exg       32  dd    .     1100...101000...  ..........  U U U U   6   6   2   2
566exg       32  aa    .     1100...101001...  ..........  U U U U   6   6   2   2
567exg       32  da    .     1100...110001...  ..........  U U U U   6   6   2   2
568ext       16  .     .     0100100010000...  ..........  U U U U   4   4   4   4
569ext       32  .     .     0100100011000...  ..........  U U U U   4   4   4   4
570extb      32  .     .     0100100111000...  ..........  . . U U   .   .   4   4
571illegal    0  .     .     0100101011111100  ..........  U U U U   4   4   4   4
572jmp       32  .     .     0100111011......  A..DXWLdx.  U U U U   4   4   0   0
573jsr       32  .     .     0100111010......  A..DXWLdx.  U U U U  12  12   0   0
574lea       32  .     .     0100...111......  A..DXWLdx.  U U U U   0   0   2   2
575link      16  .     a7    0100111001010111  ..........  U U U U  16  16   5   5
576link      16  .     .     0100111001010...  ..........  U U U U  16  16   5   5
577link      32  .     a7    0100100000001111  ..........  . . U U   .   .   6   6
578link      32  .     .     0100100000001...  ..........  . . U U   .   .   6   6
579lsr        8  s     .     1110...000001...  ..........  U U U U   6   6   4   4
580lsr       16  s     .     1110...001001...  ..........  U U U U   6   6   4   4
581lsr       32  s     .     1110...010001...  ..........  U U U U   8   8   4   4
582lsr        8  r     .     1110...000101...  ..........  U U U U   6   6   6   6
583lsr       16  r     .     1110...001101...  ..........  U U U U   6   6   6   6
584lsr       32  r     .     1110...010101...  ..........  U U U U   8   8   6   6
585lsr       16  .     .     1110001011......  A+-DXWL...  U U U U   8   8   5   5
586lsl        8  s     .     1110...100001...  ..........  U U U U   6   6   4   4
587lsl       16  s     .     1110...101001...  ..........  U U U U   6   6   4   4
588lsl       32  s     .     1110...110001...  ..........  U U U U   8   8   4   4
589lsl        8  r     .     1110...100101...  ..........  U U U U   6   6   6   6
590lsl       16  r     .     1110...101101...  ..........  U U U U   6   6   6   6
591lsl       32  r     .     1110...110101...  ..........  U U U U   8   8   6   6
592lsl       16  .     .     1110001111......  A+-DXWL...  U U U U   8   8   5   5
593move       8  d     d     0001...000000...  ..........  U U U U   4   4   2   2
594move       8  d     .     0001...000......  A+-DXWLdxI  U U U U   4   4   2   2
595move       8  ai    d     0001...010000...  ..........  U U U U   8   8   4   4
596move       8  ai    .     0001...010......  A+-DXWLdxI  U U U U   8   8   4   4
597move       8  pi    d     0001...011000...  ..........  U U U U   8   8   4   4
598move       8  pi    .     0001...011......  A+-DXWLdxI  U U U U   8   8   4   4
599move       8  pi7   d     0001111011000...  ..........  U U U U   8   8   4   4
600move       8  pi7   .     0001111011......  A+-DXWLdxI  U U U U   8   8   4   4
601move       8  pd    d     0001...100000...  ..........  U U U U   8   8   5   5
602move       8  pd    .     0001...100......  A+-DXWLdxI  U U U U   8   8   5   5
603move       8  pd7   d     0001111100000...  ..........  U U U U   8   8   5   5
604move       8  pd7   .     0001111100......  A+-DXWLdxI  U U U U   8   8   5   5
605move       8  di    d     0001...101000...  ..........  U U U U  12  12   5   5
606move       8  di    .     0001...101......  A+-DXWLdxI  U U U U  12  12   5   5
607move       8  ix    d     0001...110000...  ..........  U U U U  14  14   7   7
608move       8  ix    .     0001...110......  A+-DXWLdxI  U U U U  14  14   7   7
609move       8  aw    d     0001000111000...  ..........  U U U U  12  12   4   4
610move       8  aw    .     0001000111......  A+-DXWLdxI  U U U U  12  12   4   4
611move       8  al    d     0001001111000...  ..........  U U U U  16  16   6   6
612move       8  al    .     0001001111......  A+-DXWLdxI  U U U U  16  16   6   6
613move      16  d     d     0011...000000...  ..........  U U U U   4   4   2   2
614move      16  d     a     0011...000001...  ..........  U U U U   4   4   2   2
615move      16  d     .     0011...000......  A+-DXWLdxI  U U U U   4   4   2   2
616move      16  ai    d     0011...010000...  ..........  U U U U   8   8   4   4
617move      16  ai    a     0011...010001...  ..........  U U U U   8   8   4   4
618move      16  ai    .     0011...010......  A+-DXWLdxI  U U U U   8   8   4   4
619move      16  pi    d     0011...011000...  ..........  U U U U   8   8   4   4
620move      16  pi    a     0011...011001...  ..........  U U U U   8   8   4   4
621move      16  pi    .     0011...011......  A+-DXWLdxI  U U U U   8   8   4   4
622move      16  pd    d     0011...100000...  ..........  U U U U   8   8   5   5
623move      16  pd    a     0011...100001...  ..........  U U U U   8   8   5   5
624move      16  pd    .     0011...100......  A+-DXWLdxI  U U U U   8   8   5   5
625move      16  di    d     0011...101000...  ..........  U U U U  12  12   5   5
626move      16  di    a     0011...101001...  ..........  U U U U  12  12   5   5
627move      16  di    .     0011...101......  A+-DXWLdxI  U U U U  12  12   5   5
628move      16  ix    d     0011...110000...  ..........  U U U U  14  14   7   7
629move      16  ix    a     0011...110001...  ..........  U U U U  14  14   7   7
630move      16  ix    .     0011...110......  A+-DXWLdxI  U U U U  14  14   7   7
631move      16  aw    d     0011000111000...  ..........  U U U U  12  12   4   4
632move      16  aw    a     0011000111001...  ..........  U U U U  12  12   4   4
633move      16  aw    .     0011000111......  A+-DXWLdxI  U U U U  12  12   4   4
634move      16  al    d     0011001111000...  ..........  U U U U  16  16   6   6
635move      16  al    a     0011001111001...  ..........  U U U U  16  16   6   6
636move      16  al    .     0011001111......  A+-DXWLdxI  U U U U  16  16   6   6
637move      32  d     d     0010...000000...  ..........  U U U U   4   4   2   2
638move      32  d     a     0010...000001...  ..........  U U U U   4   4   2   2
639move      32  d     .     0010...000......  A+-DXWLdxI  U U U U   4   4   2   2
640move      32  ai    d     0010...010000...  ..........  U U U U  12  12   4   4
641move      32  ai    a     0010...010001...  ..........  U U U U  12  12   4   4
642move      32  ai    .     0010...010......  A+-DXWLdxI  U U U U  12  12   4   4
643move      32  pi    d     0010...011000...  ..........  U U U U  12  12   4   4
644move      32  pi    a     0010...011001...  ..........  U U U U  12  12   4   4
645move      32  pi    .     0010...011......  A+-DXWLdxI  U U U U  12  12   4   4
646move      32  pd    d     0010...100000...  ..........  U U U U  12  14   5   5
647move      32  pd    a     0010...100001...  ..........  U U U U  12  14   5   5
648move      32  pd    .     0010...100......  A+-DXWLdxI  U U U U  12  14   5   5
649move      32  di    d     0010...101000...  ..........  U U U U  16  16   5   5
650move      32  di    a     0010...101001...  ..........  U U U U  16  16   5   5
651move      32  di    .     0010...101......  A+-DXWLdxI  U U U U  16  16   5   5
652move      32  ix    d     0010...110000...  ..........  U U U U  18  18   7   7
653move      32  ix    a     0010...110001...  ..........  U U U U  18  18   7   7
654move      32  ix    .     0010...110......  A+-DXWLdxI  U U U U  18  18   7   7
655move      32  aw    d     0010000111000...  ..........  U U U U  16  16   4   4
656move      32  aw    a     0010000111001...  ..........  U U U U  16  16   4   4
657move      32  aw    .     0010000111......  A+-DXWLdxI  U U U U  16  16   4   4
658move      32  al    d     0010001111000...  ..........  U U U U  20  20   6   6
659move      32  al    a     0010001111001...  ..........  U U U U  20  20   6   6
660move      32  al    .     0010001111......  A+-DXWLdxI  U U U U  20  20   6   6
661movea     16  .     d     0011...001000...  ..........  U U U U   4   4   2   2
662movea     16  .     a     0011...001001...  ..........  U U U U   4   4   2   2
663movea     16  .     .     0011...001......  A+-DXWLdxI  U U U U   4   4   2   2
664movea     32  .     d     0010...001000...  ..........  U U U U   4   4   2   2
665movea     32  .     a     0010...001001...  ..........  U U U U   4   4   2   2
666movea     32  .     .     0010...001......  A+-DXWLdxI  U U U U   4   4   2   2
667move      16  frc   d     0100001011000...  ..........  . U U U   .   4   4   4
668move      16  frc   .     0100001011......  A+-DXWL...  . U U U   .   8   4   4
669move      16  toc   d     0100010011000...  ..........  U U U U  12  12   4   4
670move      16  toc   .     0100010011......  A+-DXWLdxI  U U U U  12  12   4   4
671move      16  frs   d     0100000011000...  ..........  U S S S   6   4   8   8  U only for 000
672move      16  frs   .     0100000011......  A+-DXWL...  U S S S   8   8   8   8  U only for 000
673move      16  tos   d     0100011011000...  ..........  S S S S  12  12   8   8
674move      16  tos   .     0100011011......  A+-DXWLdxI  S S S S  12  12   8   8
675move      32  fru   .     0100111001101...  ..........  S S S S   4   6   2   2
676move      32  tou   .     0100111001100...  ..........  S S S S   4   6   2   2
677movec     32  cr    .     0100111001111010  ..........  . S S S   .  12   6   6
678movec     32  rc    .     0100111001111011  ..........  . S S S   .  10  12  12
679movem     16  re    pd    0100100010100...  ..........  U U U U   8   8   4   4
680movem     16  re    .     0100100010......  A..DXWL...  U U U U   8   8   4   4
681movem     32  re    pd    0100100011100...  ..........  U U U U   8   8   4   4
682movem     32  re    .     0100100011......  A..DXWL...  U U U U   8   8   4   4
683movem     16  er    pi    0100110010011...  ..........  U U U U  12  12   8   8
684movem     16  er    pcdi  0100110010111010  ..........  U U U U  16  16   9   9
685movem     16  er    pcix  0100110010111011  ..........  U U U U  18  18  11  11
686movem     16  er    .     0100110010......  A..DXWL...  U U U U  12  12   8   8
687movem     32  er    pi    0100110011011...  ..........  U U U U  12  12   8   8
688movem     32  er    pcdi  0100110011111010  ..........  U U U U  16  16   9   9
689movem     32  er    pcix  0100110011111011  ..........  U U U U  18  18  11  11
690movem     32  er    .     0100110011......  A..DXWL...  U U U U  12  12   8   8
691movep     16  er    .     0000...100001...  ..........  U U U U  16  16  12  12
692movep     32  er    .     0000...101001...  ..........  U U U U  24  24  18  18
693movep     16  re    .     0000...110001...  ..........  U U U U  16  16  11  11
694movep     32  re    .     0000...111001...  ..........  U U U U  24  24  17  17
695moveq     32  .     .     0111...0........  ..........  U U U U   4   4   2   2
696moves      8  .     .     0000111000......  A+-DXWL...  . S S S   .  14   5   5
697moves     16  .     .     0000111001......  A+-DXWL...  . S S S   .  14   5   5
698moves     32  .     .     0000111010......  A+-DXWL...  . S S S   .  16   5   5
699move16    32  .     .     1111011000100...  ..........  . . . U   .   .   .   4  TODO: correct timing
700muls      16  .     d     1100...111000...  ..........  U U U U  54  32  27  27
701muls      16  .     .     1100...111......  A+-DXWLdxI  U U U U  54  32  27  27
702mulu      16  .     d     1100...011000...  ..........  U U U U  54  30  27  27
703mulu      16  .     .     1100...011......  A+-DXWLdxI  U U U U  54  30  27  27
704mull      32  .     d     0100110000000...  ..........  . . U U   .   .  43  43
705mull      32  .     .     0100110000......  A+-DXWLdxI  . . U U   .   .  43  43
706nbcd       8  .     d     0100100000000...  ..........  U U U U   6   6   6   6
707nbcd       8  .     .     0100100000......  A+-DXWL...  U U U U   8   8   6   6
708neg        8  .     d     0100010000000...  ..........  U U U U   4   4   2   2
709neg        8  .     .     0100010000......  A+-DXWL...  U U U U   8   8   4   4
710neg       16  .     d     0100010001000...  ..........  U U U U   4   4   2   2
711neg       16  .     .     0100010001......  A+-DXWL...  U U U U   8   8   4   4
712neg       32  .     d     0100010010000...  ..........  U U U U   6   6   2   2
713neg       32  .     .     0100010010......  A+-DXWL...  U U U U  12  12   4   4
714negx       8  .     d     0100000000000...  ..........  U U U U   4   4   2   2
715negx       8  .     .     0100000000......  A+-DXWL...  U U U U   8   8   4   4
716negx      16  .     d     0100000001000...  ..........  U U U U   4   4   2   2
717negx      16  .     .     0100000001......  A+-DXWL...  U U U U   8   8   4   4
718negx      32  .     d     0100000010000...  ..........  U U U U   6   6   2   2
719negx      32  .     .     0100000010......  A+-DXWL...  U U U U  12  12   4   4
720nop        0  .     .     0100111001110001  ..........  U U U U   4   4   2   2
721not        8  .     d     0100011000000...  ..........  U U U U   4   4   2   2
722not        8  .     .     0100011000......  A+-DXWL...  U U U U   8   8   4   4
723not       16  .     d     0100011001000...  ..........  U U U U   4   4   2   2
724not       16  .     .     0100011001......  A+-DXWL...  U U U U   8   8   4   4
725not       32  .     d     0100011010000...  ..........  U U U U   6   6   2   2
726not       32  .     .     0100011010......  A+-DXWL...  U U U U  12  12   4   4
727or         8  er    d     1000...000000...  ..........  U U U U   4   4   2   2
728or         8  er    .     1000...000......  A+-DXWLdxI  U U U U   4   4   2   2
729or        16  er    d     1000...001000...  ..........  U U U U   4   4   2   2
730or        16  er    .     1000...001......  A+-DXWLdxI  U U U U   4   4   2   2
731or        32  er    d     1000...010000...  ..........  U U U U   6   6   2   2
732or        32  er    .     1000...010......  A+-DXWLdxI  U U U U   6   6   2   2
733or         8  re    .     1000...100......  A+-DXWL...  U U U U   8   8   4   4
734or        16  re    .     1000...101......  A+-DXWL...  U U U U   8   8   4   4
735or        32  re    .     1000...110......  A+-DXWL...  U U U U  12  12   4   4
736ori       16  toc   .     0000000000111100  ..........  U U U U  20  16  12  12
737ori       16  tos   .     0000000001111100  ..........  S S S S  20  16  12  12
738ori        8  .     d     0000000000000...  ..........  U U U U   8   8   2   2
739ori        8  .     .     0000000000......  A+-DXWL...  U U U U  12  12   4   4
740ori       16  .     d     0000000001000...  ..........  U U U U   8   8   2   2
741ori       16  .     .     0000000001......  A+-DXWL...  U U U U  12  12   4   4
742ori       32  .     d     0000000010000...  ..........  U U U U  16  14   2   2
743ori       32  .     .     0000000010......  A+-DXWL...  U U U U  20  20   4   4
744pack      16  rr    .     1000...101000...  ..........  . . U U   .   .   6   6
745pack      16  mm    ax7   1000111101001...  ..........  . . U U   .   .  13  13
746pack      16  mm    ay7   1000...101001111  ..........  . . U U   .   .  13  13
747pack      16  mm    axy7  1000111101001111  ..........  . . U U   .   .  13  13
748pack      16  mm    .     1000...101001...  ..........  . . U U   .   .  13  13
749pea       32  .     .     0100100001......  A..DXWLdx.  U U U U   6   6   5   5
750pflush    32  .     .     1111010100011000  ..........  . . . S   .   .   .   4   TODO: correct timing
751reset      0  .     .     0100111001110000  ..........  S S S S   0   0   0   0
752ror        8  s     .     1110...000011...  ..........  U U U U   6   6   8   8
753ror       16  s     .     1110...001011...  ..........  U U U U   6   6   8   8
754ror       32  s     .     1110...010011...  ..........  U U U U   8   8   8   8
755ror        8  r     .     1110...000111...  ..........  U U U U   6   6   8   8
756ror       16  r     .     1110...001111...  ..........  U U U U   6   6   8   8
757ror       32  r     .     1110...010111...  ..........  U U U U   8   8   8   8
758ror       16  .     .     1110011011......  A+-DXWL...  U U U U   8   8   7   7
759rol        8  s     .     1110...100011...  ..........  U U U U   6   6   8   8
760rol       16  s     .     1110...101011...  ..........  U U U U   6   6   8   8
761rol       32  s     .     1110...110011...  ..........  U U U U   8   8   8   8
762rol        8  r     .     1110...100111...  ..........  U U U U   6   6   8   8
763rol       16  r     .     1110...101111...  ..........  U U U U   6   6   8   8
764rol       32  r     .     1110...110111...  ..........  U U U U   8   8   8   8
765rol       16  .     .     1110011111......  A+-DXWL...  U U U U   8   8   7   7
766roxr       8  s     .     1110...000010...  ..........  U U U U   6   6  12  12
767roxr      16  s     .     1110...001010...  ..........  U U U U   6   6  12  12
768roxr      32  s     .     1110...010010...  ..........  U U U U   8   8  12  12
769roxr       8  r     .     1110...000110...  ..........  U U U U   6   6  12  12
770roxr      16  r     .     1110...001110...  ..........  U U U U   6   6  12  12
771roxr      32  r     .     1110...010110...  ..........  U U U U   8   8  12  12
772roxr      16  .     .     1110010011......  A+-DXWL...  U U U U   8   8   5   5
773roxl       8  s     .     1110...100010...  ..........  U U U U   6   6  12  12
774roxl      16  s     .     1110...101010...  ..........  U U U U   6   6  12  12
775roxl      32  s     .     1110...110010...  ..........  U U U U   8   8  12  12
776roxl       8  r     .     1110...100110...  ..........  U U U U   6   6  12  12
777roxl      16  r     .     1110...101110...  ..........  U U U U   6   6  12  12
778roxl      32  r     .     1110...110110...  ..........  U U U U   8   8  12  12
779roxl      16  .     .     1110010111......  A+-DXWL...  U U U U   8   8   5   5
780rtd       32  .     .     0100111001110100  ..........  . U U U   .  16  10  10
781rte       32  .     .     0100111001110011  ..........  S S S S  20  24  20  20  bus fault not emulated
782rtm       32  .     .     000001101100....  ..........  . . U U   .   .  19  19  not properly emulated
783rtr       32  .     .     0100111001110111  ..........  U U U U  20  20  14  14
784rts       32  .     .     0100111001110101  ..........  U U U U  16  16  10  10
785sbcd       8  rr    .     1000...100000...  ..........  U U U U   6   6   4   4
786sbcd       8  mm    ax7   1000111100001...  ..........  U U U U  18  18  16  16
787sbcd       8  mm    ay7   1000...100001111  ..........  U U U U  18  18  16  16
788sbcd       8  mm    axy7  1000111100001111  ..........  U U U U  18  18  16  16
789sbcd       8  mm    .     1000...100001...  ..........  U U U U  18  18  16  16
790st         8  .     d     0101000011000...  ..........  U U U U   6   4   4   4
791st         8  .     .     0101000011......  A+-DXWL...  U U U U   8   8   6   6
792sf         8  .     d     0101000111000...  ..........  U U U U   4   4   4   4
793sf         8  .     .     0101000111......  A+-DXWL...  U U U U   8   8   6   6
794scc        8  .     d     0101....11000...  ..........  U U U U   4   4   4   4
795scc        8  .     .     0101....11......  A+-DXWL...  U U U U   8   8   6   6
796stop       0  .     .     0100111001110010  ..........  S S S S   4   4   8   8
797sub        8  er    d     1001...000000...  ..........  U U U U   4   4   2   2
798sub        8  er    .     1001...000......  A+-DXWLdxI  U U U U   4   4   2   2
799sub       16  er    d     1001...001000...  ..........  U U U U   4   4   2   2
800sub       16  er    a     1001...001001...  ..........  U U U U   4   4   2   2
801sub       16  er    .     1001...001......  A+-DXWLdxI  U U U U   4   4   2   2
802sub       32  er    d     1001...010000...  ..........  U U U U   6   6   2   2
803sub       32  er    a     1001...010001...  ..........  U U U U   6   6   2   2
804sub       32  er    .     1001...010......  A+-DXWLdxI  U U U U   6   6   2   2
805sub        8  re    .     1001...100......  A+-DXWL...  U U U U   8   8   4   4
806sub       16  re    .     1001...101......  A+-DXWL...  U U U U   8   8   4   4
807sub       32  re    .     1001...110......  A+-DXWL...  U U U U  12  12   4   4
808suba      16  .     d     1001...011000...  ..........  U U U U   8   8   2   2
809suba      16  .     a     1001...011001...  ..........  U U U U   8   8   2   2
810suba      16  .     .     1001...011......  A+-DXWLdxI  U U U U   8   8   2   2
811suba      32  .     d     1001...111000...  ..........  U U U U   6   6   2   2
812suba      32  .     a     1001...111001...  ..........  U U U U   6   6   2   2
813suba      32  .     .     1001...111......  A+-DXWLdxI  U U U U   6   6   2   2
814subi       8  .     d     0000010000000...  ..........  U U U U   8   8   2   2
815subi       8  .     .     0000010000......  A+-DXWL...  U U U U  12  12   4   4
816subi      16  .     d     0000010001000...  ..........  U U U U   8   8   2   2
817subi      16  .     .     0000010001......  A+-DXWL...  U U U U  12  12   4   4
818subi      32  .     d     0000010010000...  ..........  U U U U  16  14   2   2
819subi      32  .     .     0000010010......  A+-DXWL...  U U U U  20  20   4   4
820subq       8  .     d     0101...100000...  ..........  U U U U   4   4   2   2
821subq       8  .     .     0101...100......  A+-DXWL...  U U U U   8   8   4   4
822subq      16  .     d     0101...101000...  ..........  U U U U   4   4   2   2
823subq      16  .     a     0101...101001...  ..........  U U U U   8   4   2   2
824subq      16  .     .     0101...101......  A+-DXWL...  U U U U   8   8   4   4
825subq      32  .     d     0101...110000...  ..........  U U U U   8   8   2   2
826subq      32  .     a     0101...110001...  ..........  U U U U   8   8   2   2
827subq      32  .     .     0101...110......  A+-DXWL...  U U U U  12  12   4   4
828subx       8  rr    .     1001...100000...  ..........  U U U U   4   4   2   2
829subx      16  rr    .     1001...101000...  ..........  U U U U   4   4   2   2
830subx      32  rr    .     1001...110000...  ..........  U U U U   8   6   2   2
831subx       8  mm    ax7   1001111100001...  ..........  U U U U  18  18  12  12
832subx       8  mm    ay7   1001...100001111  ..........  U U U U  18  18  12  12
833subx       8  mm    axy7  1001111100001111  ..........  U U U U  18  18  12  12
834subx       8  mm    .     1001...100001...  ..........  U U U U  18  18  12  12
835subx      16  mm    .     1001...101001...  ..........  U U U U  18  18  12  12
836subx      32  mm    .     1001...110001...  ..........  U U U U  30  30  12  12
837swap      32  .     .     0100100001000...  ..........  U U U U   4   4   4   4
838tas        8  .     d     0100101011000...  ..........  U U U U   4   4   4   4
839tas        8  .     .     0100101011......  A+-DXWL...  U U U U  14  14  12  12
840trap       0  .     .     010011100100....  ..........  U U U U   4   4   4   4
841trapt      0  .     .     0101000011111100  ..........  . . U U   .   .   4   4
842trapt     16  .     .     0101000011111010  ..........  . . U U   .   .   6   6
843trapt     32  .     .     0101000011111011  ..........  . . U U   .   .   8   8
844trapf      0  .     .     0101000111111100  ..........  . . U U   .   .   4   4
845trapf     16  .     .     0101000111111010  ..........  . . U U   .   .   6   6
846trapf     32  .     .     0101000111111011  ..........  . . U U   .   .   8   8
847trapcc     0  .     .     0101....11111100  ..........  . . U U   .   .   4   4
848trapcc    16  .     .     0101....11111010  ..........  . . U U   .   .   6   6
849trapcc    32  .     .     0101....11111011  ..........  . . U U   .   .   8   8
850trapv      0  .     .     0100111001110110  ..........  U U U U   4   4   4   4
851tst        8  .     d     0100101000000...  ..........  U U U U   4   4   2   2
852tst        8  .     .     0100101000......  A+-DXWL...  U U U U   4   4   2   2
853tst        8  .     pcdi  0100101000111010  ..........  . . U U   .   .   7   7
854tst        8  .     pcix  0100101000111011  ..........  . . U U   .   .   9   9
855tst        8  .     i     0100101000111100  ..........  . . U U   .   .   6   6
856tst       16  .     d     0100101001000...  ..........  U U U U   4   4   2   2
857tst       16  .     a     0100101001001...  ..........  . . U U   .   .   2   2
858tst       16  .     .     0100101001......  A+-DXWL...  U U U U   4   4   2   2
859tst       16  .     pcdi  0100101001111010  ..........  . . U U   .   .   7   7
860tst       16  .     pcix  0100101001111011  ..........  . . U U   .   .   9   9
861tst       16  .     i     0100101001111100  ..........  . . U U   .   .   6   6
862tst       32  .     d     0100101010000...  ..........  U U U U   4   4   2   2
863tst       32  .     a     0100101010001...  ..........  . . U U   .   .   2   2
864tst       32  .     .     0100101010......  A+-DXWL...  U U U U   4   4   2   2
865tst       32  .     pcdi  0100101010111010  ..........  . . U U   .   .   7   7
866tst       32  .     pcix  0100101010111011  ..........  . . U U   .   .   9   9
867tst       32  .     i     0100101010111100  ..........  . . U U   .   .   6   6
868unlk      32  .     a7    0100111001011111  ..........  U U U U  12  12   6   6
869unlk      32  .     .     0100111001011...  ..........  U U U U  12  12   6   6
870unpk      16  rr    .     1000...110000...  ..........  . . U U   .   .   8   8
871unpk      16  mm    ax7   1000111110001...  ..........  . . U U   .   .  13  13
872unpk      16  mm    ay7   1000...110001111  ..........  . . U U   .   .  13  13
873unpk      16  mm    axy7  1000111110001111  ..........  . . U U   .   .  13  13
874unpk      16  mm    .     1000...110001...  ..........  . . U U   .   .  13  13
3581010       0  .     .     1010............  ..........  U U U U U   4   4   4   4   4
3591111       0  .     .     1111............  ..........  U U U U U   4   4   4   4   4
360040fpu0   32  .     .     11110010........  ..........  . . . . U   .   .   .   .   0
361040fpu1   32  .     .     11110011........  ..........  . . . . U   .   .   .   .   0
362abcd       8  rr    .     1100...100000...  ..........  U U U U U   6   6   4   4   4
363abcd       8  mm    ax7   1100111100001...  ..........  U U U U U  18  18  16  16  16
364abcd       8  mm    ay7   1100...100001111  ..........  U U U U U  18  18  16  16  16
365abcd       8  mm    axy7  1100111100001111  ..........  U U U U U  18  18  16  16  16
366abcd       8  mm    .     1100...100001...  ..........  U U U U U  18  18  16  16  16
367add        8  er    d     1101...000000...  ..........  U U U U U   4   4   2   2   2
368add        8  er    .     1101...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
369add       16  er    d     1101...001000...  ..........  U U U U U   4   4   2   2   2
370add       16  er    a     1101...001001...  ..........  U U U U U   4   4   2   2   2
371add       16  er    .     1101...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
372add       32  er    d     1101...010000...  ..........  U U U U U   6   6   2   2   2
373add       32  er    a     1101...010001...  ..........  U U U U U   6   6   2   2   2
374add       32  er    .     1101...010......  A+-DXWLdxI  U U U U U   6   6   2   2   2
375add        8  re    .     1101...100......  A+-DXWL...  U U U U U   8   8   4   4   4
376add       16  re    .     1101...101......  A+-DXWL...  U U U U U   8   8   4   4   4
377add       32  re    .     1101...110......  A+-DXWL...  U U U U U  12  12   4   4   4
378adda      16  .     d     1101...011000...  ..........  U U U U U   8   8   2   2   2
379adda      16  .     a     1101...011001...  ..........  U U U U U   8   8   2   2   2
380adda      16  .     .     1101...011......  A+-DXWLdxI  U U U U U   8   8   2   2   2
381adda      32  .     d     1101...111000...  ..........  U U U U U   6   6   2   2   2
382adda      32  .     a     1101...111001...  ..........  U U U U U   6   6   2   2   2
383adda      32  .     .     1101...111......  A+-DXWLdxI  U U U U U   6   6   2   2   2
384addi       8  .     d     0000011000000...  ..........  U U U U U   8   8   2   2   2
385addi       8  .     .     0000011000......  A+-DXWL...  U U U U U  12  12   4   4   4
386addi      16  .     d     0000011001000...  ..........  U U U U U   8   8   2   2   2
387addi      16  .     .     0000011001......  A+-DXWL...  U U U U U  12  12   4   4   4
388addi      32  .     d     0000011010000...  ..........  U U U U U  16  14   2   2   2
389addi      32  .     .     0000011010......  A+-DXWL...  U U U U U  20  20   4   4   4
390addq       8  .     d     0101...000000...  ..........  U U U U U   4   4   2   2   2
391addq       8  .     .     0101...000......  A+-DXWL...  U U U U U   8   8   4   4   4
392addq      16  .     d     0101...001000...  ..........  U U U U U   4   4   2   2   2
393addq      16  .     a     0101...001001...  ..........  U U U U U   4   4   2   2   2
394addq      16  .     .     0101...001......  A+-DXWL...  U U U U U   8   8   4   4   4
395addq      32  .     d     0101...010000...  ..........  U U U U U   8   8   2   2   2
396addq      32  .     a     0101...010001...  ..........  U U U U U   8   8   2   2   2
397addq      32  .     .     0101...010......  A+-DXWL...  U U U U U  12  12   4   4   4
398addx       8  rr    .     1101...100000...  ..........  U U U U U   4   4   2   2   2
399addx      16  rr    .     1101...101000...  ..........  U U U U U   4   4   2   2   2
400addx      32  rr    .     1101...110000...  ..........  U U U U U   8   6   2   2   2
401addx       8  mm    ax7   1101111100001...  ..........  U U U U U  18  18  12  12  12
402addx       8  mm    ay7   1101...100001111  ..........  U U U U U  18  18  12  12  12
403addx       8  mm    axy7  1101111100001111  ..........  U U U U U  18  18  12  12  12
404addx       8  mm    .     1101...100001...  ..........  U U U U U  18  18  12  12  12
405addx      16  mm    .     1101...101001...  ..........  U U U U U  18  18  12  12  12
406addx      32  mm    .     1101...110001...  ..........  U U U U U  30  30  12  12  12
407and        8  er    d     1100...000000...  ..........  U U U U U   4   4   2   2   2
408and        8  er    .     1100...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
409and       16  er    d     1100...001000...  ..........  U U U U U   4   4   2   2   2
410and       16  er    .     1100...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
411and       32  er    d     1100...010000...  ..........  U U U U U   6   6   2   2   2
412and       32  er    .     1100...010......  A+-DXWLdxI  U U U U U   6   6   2   2   2
413and        8  re    .     1100...100......  A+-DXWL...  U U U U U   8   8   4   4   4
414and       16  re    .     1100...101......  A+-DXWL...  U U U U U   8   8   4   4   4
415and       32  re    .     1100...110......  A+-DXWL...  U U U U U  12  12   4   4   4
416andi      16  toc   .     0000001000111100  ..........  U U U U U  20  16  12  12  12
417andi      16  tos   .     0000001001111100  ..........  S S S S S  20  16  12  12  12
418andi       8  .     d     0000001000000...  ..........  U U U U U   8   8   2   2   2
419andi       8  .     .     0000001000......  A+-DXWL...  U U U U U  12  12   4   4   4
420andi      16  .     d     0000001001000...  ..........  U U U U U   8   8   2   2   2
421andi      16  .     .     0000001001......  A+-DXWL...  U U U U U  12  12   4   4   4
422andi      32  .     d     0000001010000...  ..........  U U U U U  14  14   2   2   2
423andi      32  .     .     0000001010......  A+-DXWL...  U U U U U  20  20   4   4   4
424asr        8  s     .     1110...000000...  ..........  U U U U U   6   6   6   6   6
425asr       16  s     .     1110...001000...  ..........  U U U U U   6   6   6   6   6
426asr       32  s     .     1110...010000...  ..........  U U U U U   8   8   6   6   6
427asr        8  r     .     1110...000100...  ..........  U U U U U   6   6   6   6   6
428asr       16  r     .     1110...001100...  ..........  U U U U U   6   6   6   6   6
429asr       32  r     .     1110...010100...  ..........  U U U U U   8   8   6   6   6
430asr       16  .     .     1110000011......  A+-DXWL...  U U U U U   8   8   5   5   5
431asl        8  s     .     1110...100000...  ..........  U U U U U   6   6   8   8   8
432asl       16  s     .     1110...101000...  ..........  U U U U U   6   6   8   8   8
433asl       32  s     .     1110...110000...  ..........  U U U U U   8   8   8   8   8
434asl        8  r     .     1110...100100...  ..........  U U U U U   6   6   8   8   8
435asl       16  r     .     1110...101100...  ..........  U U U U U   6   6   8   8   8
436asl       32  r     .     1110...110100...  ..........  U U U U U   8   8   8   8   8
437asl       16  .     .     1110000111......  A+-DXWL...  U U U U U   8   8   6   6   6
438bcc        8  .     .     0110............  ..........  U U U U U  10  10   6   6   6
439bcc       16  .     .     0110....00000000  ..........  U U U U U  10  10   6   6   6
440bcc       32  .     .     0110....11111111  ..........  U U U U U  10  10   6   6   6
441bchg       8  r     .     0000...101......  A+-DXWL...  U U U U U   8   8   4   4   4
442bchg      32  r     d     0000...101000...  ..........  U U U U U   8   8   4   4   4
443bchg       8  s     .     0000100001......  A+-DXWL...  U U U U U  12  12   4   4   4
444bchg      32  s     d     0000100001000...  ..........  U U U U U  12  12   4   4   4
445bclr       8  r     .     0000...110......  A+-DXWL...  U U U U U   8  10   4   4   4
446bclr      32  r     d     0000...110000...  ..........  U U U U U  10  10   4   4   4
447bclr       8  s     .     0000100010......  A+-DXWL...  U U U U U  12  12   4   4   4
448bclr      32  s     d     0000100010000...  ..........  U U U U U  14  14   4   4   4
449bfchg     32  .     d     1110101011000...  ..........  . . U U U   .   .  12  12  12  timing not quite correct
450bfchg     32  .     .     1110101011......  A..DXWL...  . . U U U   .   .  20  20  20
451bfclr     32  .     d     1110110011000...  ..........  . . U U U   .   .  12  12  12
452bfclr     32  .     .     1110110011......  A..DXWL...  . . U U U   .   .  20  20  20
453bfexts    32  .     d     1110101111000...  ..........  . . U U U   .   .   8   8   8
454bfexts    32  .     .     1110101111......  A..DXWLdx.  . . U U U   .   .  15  15  15
455bfextu    32  .     d     1110100111000...  ..........  . . U U U   .   .   8   8   8
456bfextu    32  .     .     1110100111......  A..DXWLdx.  . . U U U   .   .  15  15  15
457bfffo     32  .     d     1110110111000...  ..........  . . U U U   .   .  18  18  18
458bfffo     32  .     .     1110110111......  A..DXWLdx.  . . U U U   .   .  28  28  28
459bfins     32  .     d     1110111111000...  ..........  . . U U U   .   .  10  10  10
460bfins     32  .     .     1110111111......  A..DXWL...  . . U U U   .   .  17  17  17
461bfset     32  .     d     1110111011000...  ..........  . . U U U   .   .  12  12  12
462bfset     32  .     .     1110111011......  A..DXWL...  . . U U U   .   .  20  20  20
463bftst     32  .     d     1110100011000...  ..........  . . U U U   .   .   6   6   6
464bftst     32  .     .     1110100011......  A..DXWLdx.  . . U U U   .   .  13  13  13
465bkpt       0  .     .     0100100001001...  ..........  . U U U U   .  10  10  10  10
466bra        8  .     .     01100000........  ..........  U U U U U  10  10  10  10  10
467bra       16  .     .     0110000000000000  ..........  U U U U U  10  10  10  10  10
468bra       32  .     .     0110000011111111  ..........  U U U U U  10  10  10  10  10
469bset      32  r     d     0000...111000...  ..........  U U U U U   8   8   4   4   4
470bset       8  r     .     0000...111......  A+-DXWL...  U U U U U   8   8   4   4   4
471bset       8  s     .     0000100011......  A+-DXWL...  U U U U U  12  12   4   4   4
472bset      32  s     d     0000100011000...  ..........  U U U U U  12  12   4   4   4
473bsr        8  .     .     01100001........  ..........  U U U U U  18  18   7   7   7
474bsr       16  .     .     0110000100000000  ..........  U U U U U  18  18   7   7   7
475bsr       32  .     .     0110000111111111  ..........  U U U U U  18  18   7   7   7
476btst       8  r     .     0000...100......  A+-DXWLdxI  U U U U U   4   4   4   4   4
477btst      32  r     d     0000...100000...  ..........  U U U U U   6   6   4   4   4
478btst       8  s     .     0000100000......  A+-DXWLdx.  U U U U U   8   8   4   4   4
479btst      32  s     d     0000100000000...  ..........  U U U U U  10  10   4   4   4
480callm     32  .     .     0000011011......  A..DXWLdx.  . . U U U   .   .  60  60  60  not properly emulated
481cas        8  .     .     0000101011......  A+-DXWL...  . . U U U   .   .  12  12  12
482cas       16  .     .     0000110011......  A+-DXWL...  . . U U U   .   .  12  12  12
483cas       32  .     .     0000111011......  A+-DXWL...  . . U U U   .   .  12  12  12
484cas2      16  .     .     0000110011111100  ..........  . . U U U   .   .  12  12  12
485cas2      32  .     .     0000111011111100  ..........  . . U U U   .   .  12  12  12
486chk       16  .     d     0100...110000...  ..........  U U U U U  10   8   8   8   8
487chk       16  .     .     0100...110......  A+-DXWLdxI  U U U U U  10   8   8   8   8
488chk       32  .     d     0100...100000...  ..........  . . U U U   .   .   8   8   8
489chk       32  .     .     0100...100......  A+-DXWLdxI  . . U U U   .   .   8   8   8
490chk2cmp2   8  .     pcdi  0000000011111010  ..........  . . U U U   .   .  23  23  23
491chk2cmp2   8  .     pcix  0000000011111011  ..........  . . U U U   .   .  23  23  23
492chk2cmp2   8  .     .     0000000011......  A..DXWL...  . . U U U   .   .  18  18  18
493chk2cmp2  16  .     pcdi  0000001011111010  ..........  . . U U U   .   .  23  23  23
494chk2cmp2  16  .     pcix  0000001011111011  ..........  . . U U U   .   .  23  23  23
495chk2cmp2  16  .     .     0000001011......  A..DXWL...  . . U U U   .   .  18  18  18
496chk2cmp2  32  .     pcdi  0000010011111010  ..........  . . U U U   .   .  23  23  23
497chk2cmp2  32  .     pcix  0000010011111011  ..........  . . U U U   .   .  23  23  23
498chk2cmp2  32  .     .     0000010011......  A..DXWL...  . . U U U   .   .  18  18  18
499clr        8  .     d     0100001000000...  ..........  U U U U U   4   4   2   2   2
500clr        8  .     .     0100001000......  A+-DXWL...  U U U U U   8   4   4   4   4
501clr       16  .     d     0100001001000...  ..........  U U U U U   4   4   2   2   2
502clr       16  .     .     0100001001......  A+-DXWL...  U U U U U   8   4   4   4   4
503clr       32  .     d     0100001010000...  ..........  U U U U U   6   6   2   2   2
504clr       32  .     .     0100001010......  A+-DXWL...  U U U U U  12   6   4   4   4
505cmp        8  .     d     1011...000000...  ..........  U U U U U   4   4   2   2   2
506cmp        8  .     .     1011...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
507cmp       16  .     d     1011...001000...  ..........  U U U U U   4   4   2   2   2
508cmp       16  .     a     1011...001001...  ..........  U U U U U   4   4   2   2   2
509cmp       16  .     .     1011...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
510cmp       32  .     d     1011...010000...  ..........  U U U U U   6   6   2   2   2
511cmp       32  .     a     1011...010001...  ..........  U U U U U   6   6   2   2   2
512cmp       32  .     .     1011...010......  A+-DXWLdxI  U U U U U   6   6   2   2   2
513cmpa      16  .     d     1011...011000...  ..........  U U U U U   6   6   4   4   4
514cmpa      16  .     a     1011...011001...  ..........  U U U U U   6   6   4   4   4
515cmpa      16  .     .     1011...011......  A+-DXWLdxI  U U U U U   6   6   4   4   4
516cmpa      32  .     d     1011...111000...  ..........  U U U U U   6   6   4   4   4
517cmpa      32  .     a     1011...111001...  ..........  U U U U U   6   6   4   4   4
518cmpa      32  .     .     1011...111......  A+-DXWLdxI  U U U U U   6   6   4   4   4
519cmpi       8  .     d     0000110000000...  ..........  U U U U U   8   8   2   2   2
520cmpi       8  .     .     0000110000......  A+-DXWL...  U U U U U   8   8   2   2   2
521cmpi       8  .     pcdi  0000110000111010  ..........  . . U U U   .   .   7   7   7
522cmpi       8  .     pcix  0000110000111011  ..........  . . U U U   .   .   9   9   9
523cmpi      16  .     d     0000110001000...  ..........  U U U U U   8   8   2   2   2
524cmpi      16  .     .     0000110001......  A+-DXWL...  U U U U U   8   8   2   2   2
525cmpi      16  .     pcdi  0000110001111010  ..........  . . U U U   .   .   7   7   7
526cmpi      16  .     pcix  0000110001111011  ..........  . . U U U   .   .   9   9   9
527cmpi      32  .     d     0000110010000...  ..........  U U U U U  14  12   2   2   2
528cmpi      32  .     .     0000110010......  A+-DXWL...  U U U U U  12  12   2   2   2
529cmpi      32  .     pcdi  0000110010111010  ..........  . . U U U   .   .   7   7   7
530cmpi      32  .     pcix  0000110010111011  ..........  . . U U U   .   .   9   9   9
531cmpm       8  .     ax7   1011111100001...  ..........  U U U U U  12  12   9   9   9
532cmpm       8  .     ay7   1011...100001111  ..........  U U U U U  12  12   9   9   9
533cmpm       8  .     axy7  1011111100001111  ..........  U U U U U  12  12   9   9   9
534cmpm       8  .     .     1011...100001...  ..........  U U U U U  12  12   9   9   9
535cmpm      16  .     .     1011...101001...  ..........  U U U U U  12  12   9   9   9
536cmpm      32  .     .     1011...110001...  ..........  U U U U U  20  20   9   9   9
537cpbcc     32  .     .     1111...01.......  ..........  . . U U .   .   .   4   4   .  unemulated
538cpdbcc    32  .     .     1111...001001...  ..........  . . U U .   .   .   4   4   .  unemulated
539cpgen     32  .     .     1111...000......  ..........  . . U U .   .   .   4   4   .  unemulated
540cpscc     32  .     .     1111...001......  ..........  . . U U .   .   .   4   4   .  unemulated
541cptrapcc  32  .     .     1111...001111...  ..........  . . U U .   .   .   4   4   .  unemulated
542dbt       16  .     .     0101000011001...  ..........  U U U U U  12  12   6   6   6
543dbf       16  .     .     0101000111001...  ..........  U U U U U  12  12   6   6   6
544dbcc      16  .     .     0101....11001...  ..........  U U U U U  12  12   6   6   6
545divs      16  .     d     1000...111000...  ..........  U U U U U 158 122  56  56  56
546divs      16  .     .     1000...111......  A+-DXWLdxI  U U U U U 158 122  56  56  56
547divu      16  .     d     1000...011000...  ..........  U U U U U 140 108  44  44  44
548divu      16  .     .     1000...011......  A+-DXWLdxI  U U U U U 140 108  44  44  44
549divl      32  .     d     0100110001000...  ..........  . . U U U   .   .  84  84  84
550divl      32  .     .     0100110001......  A+-DXWLdxI  . . U U U   .   .  84  84  84
551eor        8  .     d     1011...100000...  ..........  U U U U U   4   4   2   2   2
552eor        8  .     .     1011...100......  A+-DXWL...  U U U U U   8   8   4   4   4
553eor       16  .     d     1011...101000...  ..........  U U U U U   4   4   2   2   2
554eor       16  .     .     1011...101......  A+-DXWL...  U U U U U   8   8   4   4   4
555eor       32  .     d     1011...110000...  ..........  U U U U U   8   6   2   2   2
556eor       32  .     .     1011...110......  A+-DXWL...  U U U U U  12  12   4   4   4
557eori      16  toc   .     0000101000111100  ..........  U U U U U  20  16  12  12  12
558eori      16  tos   .     0000101001111100  ..........  S S S S S  20  16  12  12  12
559eori       8  .     d     0000101000000...  ..........  U U U U U   8   8   2   2   2
560eori       8  .     .     0000101000......  A+-DXWL...  U U U U U  12  12   4   4   4
561eori      16  .     d     0000101001000...  ..........  U U U U U   8   8   2   2   2
562eori      16  .     .     0000101001......  A+-DXWL...  U U U U U  12  12   4   4   4
563eori      32  .     d     0000101010000...  ..........  U U U U U  16  14   2   2   2
564eori      32  .     .     0000101010......  A+-DXWL...  U U U U U  20  20   4   4   4
565exg       32  dd    .     1100...101000...  ..........  U U U U U   6   6   2   2   2
566exg       32  aa    .     1100...101001...  ..........  U U U U U   6   6   2   2   2
567exg       32  da    .     1100...110001...  ..........  U U U U U   6   6   2   2   2
568ext       16  .     .     0100100010000...  ..........  U U U U U   4   4   4   4   4
569ext       32  .     .     0100100011000...  ..........  U U U U U   4   4   4   4   4
570extb      32  .     .     0100100111000...  ..........  . . U U U   .   .   4   4   4
571illegal    0  .     .     0100101011111100  ..........  U U U U U   4   4   4   4   4
572jmp       32  .     .     0100111011......  A..DXWLdx.  U U U U U   4   4   0   0   0
573jsr       32  .     .     0100111010......  A..DXWLdx.  U U U U U  12  12   0   0   0
574lea       32  .     .     0100...111......  A..DXWLdx.  U U U U U   0   0   2   2   2
575link      16  .     a7    0100111001010111  ..........  U U U U U  16  16   5   5   5
576link      16  .     .     0100111001010...  ..........  U U U U U  16  16   5   5   5
577link      32  .     a7    0100100000001111  ..........  . . U U U   .   .   6   6   6
578link      32  .     .     0100100000001...  ..........  . . U U U   .   .   6   6   6
579lsr        8  s     .     1110...000001...  ..........  U U U U U   6   6   4   4   4
580lsr       16  s     .     1110...001001...  ..........  U U U U U   6   6   4   4   4
581lsr       32  s     .     1110...010001...  ..........  U U U U U   8   8   4   4   4
582lsr        8  r     .     1110...000101...  ..........  U U U U U   6   6   6   6   6
583lsr       16  r     .     1110...001101...  ..........  U U U U U   6   6   6   6   6
584lsr       32  r     .     1110...010101...  ..........  U U U U U   8   8   6   6   6
585lsr       16  .     .     1110001011......  A+-DXWL...  U U U U U   8   8   5   5   5
586lsl        8  s     .     1110...100001...  ..........  U U U U U   6   6   4   4   4
587lsl       16  s     .     1110...101001...  ..........  U U U U U   6   6   4   4   4
588lsl       32  s     .     1110...110001...  ..........  U U U U U   8   8   4   4   4
589lsl        8  r     .     1110...100101...  ..........  U U U U U   6   6   6   6   6
590lsl       16  r     .     1110...101101...  ..........  U U U U U   6   6   6   6   6
591lsl       32  r     .     1110...110101...  ..........  U U U U U   8   8   6   6   6
592lsl       16  .     .     1110001111......  A+-DXWL...  U U U U U   8   8   5   5   5
593move       8  d     d     0001...000000...  ..........  U U U U U   4   4   2   2   2
594move       8  d     .     0001...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
595move       8  ai    d     0001...010000...  ..........  U U U U U   8   8   4   4   4
596move       8  ai    .     0001...010......  A+-DXWLdxI  U U U U U   8   8   4   4   4
597move       8  pi    d     0001...011000...  ..........  U U U U U   8   8   4   4   4
598move       8  pi    .     0001...011......  A+-DXWLdxI  U U U U U   8   8   4   4   4
599move       8  pi7   d     0001111011000...  ..........  U U U U U   8   8   4   4   4
600move       8  pi7   .     0001111011......  A+-DXWLdxI  U U U U U   8   8   4   4   4
601move       8  pd    d     0001...100000...  ..........  U U U U U   8   8   5   5   5
602move       8  pd    .     0001...100......  A+-DXWLdxI  U U U U U   8   8   5   5   5
603move       8  pd7   d     0001111100000...  ..........  U U U U U   8   8   5   5   5
604move       8  pd7   .     0001111100......  A+-DXWLdxI  U U U U U   8   8   5   5   5
605move       8  di    d     0001...101000...  ..........  U U U U U  12  12   5   5   5
606move       8  di    .     0001...101......  A+-DXWLdxI  U U U U U  12  12   5   5   5
607move       8  ix    d     0001...110000...  ..........  U U U U U  14  14   7   7   7
608move       8  ix    .     0001...110......  A+-DXWLdxI  U U U U U  14  14   7   7   7
609move       8  aw    d     0001000111000...  ..........  U U U U U  12  12   4   4   4
610move       8  aw    .     0001000111......  A+-DXWLdxI  U U U U U  12  12   4   4   4
611move       8  al    d     0001001111000...  ..........  U U U U U  16  16   6   6   6
612move       8  al    .     0001001111......  A+-DXWLdxI  U U U U U  16  16   6   6   6
613move      16  d     d     0011...000000...  ..........  U U U U U   4   4   2   2   2
614move      16  d     a     0011...000001...  ..........  U U U U U   4   4   2   2   2
615move      16  d     .     0011...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
616move      16  ai    d     0011...010000...  ..........  U U U U U   8   8   4   4   4
617move      16  ai    a     0011...010001...  ..........  U U U U U   8   8   4   4   4
618move      16  ai    .     0011...010......  A+-DXWLdxI  U U U U U   8   8   4   4   4
619move      16  pi    d     0011...011000...  ..........  U U U U U   8   8   4   4   4
620move      16  pi    a     0011...011001...  ..........  U U U U U   8   8   4   4   4
621move      16  pi    .     0011...011......  A+-DXWLdxI  U U U U U   8   8   4   4   4
622move      16  pd    d     0011...100000...  ..........  U U U U U   8   8   5   5   5
623move      16  pd    a     0011...100001...  ..........  U U U U U   8   8   5   5   5
624move      16  pd    .     0011...100......  A+-DXWLdxI  U U U U U   8   8   5   5   5
625move      16  di    d     0011...101000...  ..........  U U U U U  12  12   5   5   5
626move      16  di    a     0011...101001...  ..........  U U U U U  12  12   5   5   5
627move      16  di    .     0011...101......  A+-DXWLdxI  U U U U U  12  12   5   5   5
628move      16  ix    d     0011...110000...  ..........  U U U U U  14  14   7   7   7
629move      16  ix    a     0011...110001...  ..........  U U U U U  14  14   7   7   7
630move      16  ix    .     0011...110......  A+-DXWLdxI  U U U U U  14  14   7   7   7
631move      16  aw    d     0011000111000...  ..........  U U U U U  12  12   4   4   4
632move      16  aw    a     0011000111001...  ..........  U U U U U  12  12   4   4   4
633move      16  aw    .     0011000111......  A+-DXWLdxI  U U U U U  12  12   4   4   4
634move      16  al    d     0011001111000...  ..........  U U U U U  16  16   6   6   6
635move      16  al    a     0011001111001...  ..........  U U U U U  16  16   6   6   6
636move      16  al    .     0011001111......  A+-DXWLdxI  U U U U U  16  16   6   6   6
637move      32  d     d     0010...000000...  ..........  U U U U U   4   4   2   2   2
638move      32  d     a     0010...000001...  ..........  U U U U U   4   4   2   2   2
639move      32  d     .     0010...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
640move      32  ai    d     0010...010000...  ..........  U U U U U  12  12   4   4   4
641move      32  ai    a     0010...010001...  ..........  U U U U U  12  12   4   4   4
642move      32  ai    .     0010...010......  A+-DXWLdxI  U U U U U  12  12   4   4   4
643move      32  pi    d     0010...011000...  ..........  U U U U U  12  12   4   4   4
644move      32  pi    a     0010...011001...  ..........  U U U U U  12  12   4   4   4
645move      32  pi    .     0010...011......  A+-DXWLdxI  U U U U U  12  12   4   4   4
646move      32  pd    d     0010...100000...  ..........  U U U U U  12  14   5   5   5
647move      32  pd    a     0010...100001...  ..........  U U U U U  12  14   5   5   5
648move      32  pd    .     0010...100......  A+-DXWLdxI  U U U U U  12  14   5   5   5
649move      32  di    d     0010...101000...  ..........  U U U U U  16  16   5   5   5
650move      32  di    a     0010...101001...  ..........  U U U U U  16  16   5   5   5
651move      32  di    .     0010...101......  A+-DXWLdxI  U U U U U  16  16   5   5   5
652move      32  ix    d     0010...110000...  ..........  U U U U U  18  18   7   7   7
653move      32  ix    a     0010...110001...  ..........  U U U U U  18  18   7   7   7
654move      32  ix    .     0010...110......  A+-DXWLdxI  U U U U U  18  18   7   7   7
655move      32  aw    d     0010000111000...  ..........  U U U U U  16  16   4   4   4
656move      32  aw    a     0010000111001...  ..........  U U U U U  16  16   4   4   4
657move      32  aw    .     0010000111......  A+-DXWLdxI  U U U U U  16  16   4   4   4
658move      32  al    d     0010001111000...  ..........  U U U U U  20  20   6   6   6
659move      32  al    a     0010001111001...  ..........  U U U U U  20  20   6   6   6
660move      32  al    .     0010001111......  A+-DXWLdxI  U U U U U  20  20   6   6   6
661movea     16  .     d     0011...001000...  ..........  U U U U U   4   4   2   2   2
662movea     16  .     a     0011...001001...  ..........  U U U U U   4   4   2   2   2
663movea     16  .     .     0011...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
664movea     32  .     d     0010...001000...  ..........  U U U U U   4   4   2   2   2
665movea     32  .     a     0010...001001...  ..........  U U U U U   4   4   2   2   2
666movea     32  .     .     0010...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
667move      16  frc   d     0100001011000...  ..........  . U U U U   .   4   4   4   4
668move      16  frc   .     0100001011......  A+-DXWL...  . U U U U   .   8   4   4   4
669move      16  toc   d     0100010011000...  ..........  U U U U U  12  12   4   4   4
670move      16  toc   .     0100010011......  A+-DXWLdxI  U U U U U  12  12   4   4   4
671move      16  frs   d     0100000011000...  ..........  U S S S S   6   4   8   8   8  U only for 000
672move      16  frs   .     0100000011......  A+-DXWL...  U S S S S   8   8   8   8   8  U only for 000
673move      16  tos   d     0100011011000...  ..........  S S S S S  12  12   8   8   8
674move      16  tos   .     0100011011......  A+-DXWLdxI  S S S S S  12  12   8   8   8
675move      32  fru   .     0100111001101...  ..........  S S S S S   4   6   2   2   2
676move      32  tou   .     0100111001100...  ..........  S S S S S   4   6   2   2   2
677movec     32  cr    .     0100111001111010  ..........  . S S S S   .  12   6   6   6
678movec     32  rc    .     0100111001111011  ..........  . S S S S   .  10  12  12  12
679movem     16  re    pd    0100100010100...  ..........  U U U U U   8   8   4   4   4
680movem     16  re    .     0100100010......  A..DXWL...  U U U U U   8   8   4   4   4
681movem     32  re    pd    0100100011100...  ..........  U U U U U   8   8   4   4   4
682movem     32  re    .     0100100011......  A..DXWL...  U U U U U   8   8   4   4   4
683movem     16  er    pi    0100110010011...  ..........  U U U U U  12  12   8   8   8
684movem     16  er    pcdi  0100110010111010  ..........  U U U U U  16  16   9   9   9
685movem     16  er    pcix  0100110010111011  ..........  U U U U U  18  18  11  11  11
686movem     16  er    .     0100110010......  A..DXWL...  U U U U U  12  12   8   8   8
687movem     32  er    pi    0100110011011...  ..........  U U U U U  12  12   8   8   8
688movem     32  er    pcdi  0100110011111010  ..........  U U U U U  16  16   9   9   9
689movem     32  er    pcix  0100110011111011  ..........  U U U U U  18  18  11  11  11
690movem     32  er    .     0100110011......  A..DXWL...  U U U U U  12  12   8   8   8
691movep     16  er    .     0000...100001...  ..........  U U U U U  16  16  12  12  12
692movep     32  er    .     0000...101001...  ..........  U U U U U  24  24  18  18  18
693movep     16  re    .     0000...110001...  ..........  U U U U U  16  16  11  11  11
694movep     32  re    .     0000...111001...  ..........  U U U U U  24  24  17  17  17
695moveq     32  .     .     0111...0........  ..........  U U U U U   4   4   2   2   2
696moves      8  .     .     0000111000......  A+-DXWL...  . S S S S   .  14   5   5   5
697moves     16  .     .     0000111001......  A+-DXWL...  . S S S S   .  14   5   5   5
698moves     32  .     .     0000111010......  A+-DXWL...  . S S S S   .  16   5   5   5
699move16    32  .     .     1111011000100...  ..........  . . . . U   .   .   .   .   4  TODO: correct timing
700muls      16  .     d     1100...111000...  ..........  U U U U U  54  32  27  27  27
701muls      16  .     .     1100...111......  A+-DXWLdxI  U U U U U  54  32  27  27  27
702mulu      16  .     d     1100...011000...  ..........  U U U U U  54  30  27  27  27
703mulu      16  .     .     1100...011......  A+-DXWLdxI  U U U U U  54  30  27  27  27
704mull      32  .     d     0100110000000...  ..........  . . U U U   .   .  43  43  43
705mull      32  .     .     0100110000......  A+-DXWLdxI  . . U U U   .   .  43  43  43
706nbcd       8  .     d     0100100000000...  ..........  U U U U U   6   6   6   6   6
707nbcd       8  .     .     0100100000......  A+-DXWL...  U U U U U   8   8   6   6   6
708neg        8  .     d     0100010000000...  ..........  U U U U U   4   4   2   2   2
709neg        8  .     .     0100010000......  A+-DXWL...  U U U U U   8   8   4   4   4
710neg       16  .     d     0100010001000...  ..........  U U U U U   4   4   2   2   2
711neg       16  .     .     0100010001......  A+-DXWL...  U U U U U   8   8   4   4   4
712neg       32  .     d     0100010010000...  ..........  U U U U U   6   6   2   2   2
713neg       32  .     .     0100010010......  A+-DXWL...  U U U U U  12  12   4   4   4
714negx       8  .     d     0100000000000...  ..........  U U U U U   4   4   2   2   2
715negx       8  .     .     0100000000......  A+-DXWL...  U U U U U   8   8   4   4   4
716negx      16  .     d     0100000001000...  ..........  U U U U U   4   4   2   2   2
717negx      16  .     .     0100000001......  A+-DXWL...  U U U U U   8   8   4   4   4
718negx      32  .     d     0100000010000...  ..........  U U U U U   6   6   2   2   2
719negx      32  .     .     0100000010......  A+-DXWL...  U U U U U  12  12   4   4   4
720nop        0  .     .     0100111001110001  ..........  U U U U U   4   4   2   2   2
721not        8  .     d     0100011000000...  ..........  U U U U U   4   4   2   2   2
722not        8  .     .     0100011000......  A+-DXWL...  U U U U U   8   8   4   4   4
723not       16  .     d     0100011001000...  ..........  U U U U U   4   4   2   2   2
724not       16  .     .     0100011001......  A+-DXWL...  U U U U U   8   8   4   4   4
725not       32  .     d     0100011010000...  ..........  U U U U U   6   6   2   2   2
726not       32  .     .     0100011010......  A+-DXWL...  U U U U U  12  12   4   4   4
727or         8  er    d     1000...000000...  ..........  U U U U U   4   4   2   2   2
728or         8  er    .     1000...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
729or        16  er    d     1000...001000...  ..........  U U U U U   4   4   2   2   2
730or        16  er    .     1000...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
731or        32  er    d     1000...010000...  ..........  U U U U U   6   6   2   2   2
732or        32  er    .     1000...010......  A+-DXWLdxI  U U U U U   6   6   2   2   2
733or         8  re    .     1000...100......  A+-DXWL...  U U U U U   8   8   4   4   4
734or        16  re    .     1000...101......  A+-DXWL...  U U U U U   8   8   4   4   4
735or        32  re    .     1000...110......  A+-DXWL...  U U U U U  12  12   4   4   4
736ori       16  toc   .     0000000000111100  ..........  U U U U U  20  16  12  12  12
737ori       16  tos   .     0000000001111100  ..........  S S S S S  20  16  12  12  12
738ori        8  .     d     0000000000000...  ..........  U U U U U   8   8   2   2   2
739ori        8  .     .     0000000000......  A+-DXWL...  U U U U U  12  12   4   4   4
740ori       16  .     d     0000000001000...  ..........  U U U U U   8   8   2   2   2
741ori       16  .     .     0000000001......  A+-DXWL...  U U U U U  12  12   4   4   4
742ori       32  .     d     0000000010000...  ..........  U U U U U  16  14   2   2   2
743ori       32  .     .     0000000010......  A+-DXWL...  U U U U U  20  20   4   4   4
744pack      16  rr    .     1000...101000...  ..........  . . U U U   .   .   6   6   6
745pack      16  mm    ax7   1000111101001...  ..........  . . U U U   .   .  13  13  13
746pack      16  mm    ay7   1000...101001111  ..........  . . U U U   .   .  13  13  13
747pack      16  mm    axy7  1000111101001111  ..........  . . U U U   .   .  13  13  13
748pack      16  mm    .     1000...101001...  ..........  . . U U U   .   .  13  13  13
749pea       32  .     .     0100100001......  A..DXWLdx.  U U U U U   6   6   5   5   5
750pflush    32  .     .     1111010100011000  ..........  . . . . S   .   .   .   .   4   TODO: correct timing
751pmove     32  .     .     1111000000......  A..DXWLdx.  . . S S S   .   .   8   8   8
752reset      0  .     .     0100111001110000  ..........  S S S S S   0   0   0   0   0
753ror        8  s     .     1110...000011...  ..........  U U U U U   6   6   8   8   8
754ror       16  s     .     1110...001011...  ..........  U U U U U   6   6   8   8   8
755ror       32  s     .     1110...010011...  ..........  U U U U U   8   8   8   8   8
756ror        8  r     .     1110...000111...  ..........  U U U U U   6   6   8   8   8
757ror       16  r     .     1110...001111...  ..........  U U U U U   6   6   8   8   8
758ror       32  r     .     1110...010111...  ..........  U U U U U   8   8   8   8   8
759ror       16  .     .     1110011011......  A+-DXWL...  U U U U U   8   8   7   7   7
760rol        8  s     .     1110...100011...  ..........  U U U U U   6   6   8   8   8
761rol       16  s     .     1110...101011...  ..........  U U U U U   6   6   8   8   8
762rol       32  s     .     1110...110011...  ..........  U U U U U   8   8   8   8   8
763rol        8  r     .     1110...100111...  ..........  U U U U U   6   6   8   8   8
764rol       16  r     .     1110...101111...  ..........  U U U U U   6   6   8   8   8
765rol       32  r     .     1110...110111...  ..........  U U U U U   8   8   8   8   8
766rol       16  .     .     1110011111......  A+-DXWL...  U U U U U   8   8   7   7   7
767roxr       8  s     .     1110...000010...  ..........  U U U U U   6   6  12  12  12
768roxr      16  s     .     1110...001010...  ..........  U U U U U   6   6  12  12  12
769roxr      32  s     .     1110...010010...  ..........  U U U U U   8   8  12  12  12
770roxr       8  r     .     1110...000110...  ..........  U U U U U   6   6  12  12  12
771roxr      16  r     .     1110...001110...  ..........  U U U U U   6   6  12  12  12
772roxr      32  r     .     1110...010110...  ..........  U U U U U   8   8  12  12  12
773roxr      16  .     .     1110010011......  A+-DXWL...  U U U U U   8   8   5   5   5
774roxl       8  s     .     1110...100010...  ..........  U U U U U   6   6  12  12  12
775roxl      16  s     .     1110...101010...  ..........  U U U U U   6   6  12  12  12
776roxl      32  s     .     1110...110010...  ..........  U U U U U   8   8  12  12  12
777roxl       8  r     .     1110...100110...  ..........  U U U U U   6   6  12  12  12
778roxl      16  r     .     1110...101110...  ..........  U U U U U   6   6  12  12  12
779roxl      32  r     .     1110...110110...  ..........  U U U U U   8   8  12  12  12
780roxl      16  .     .     1110010111......  A+-DXWL...  U U U U U   8   8   5   5   5
781rtd       32  .     .     0100111001110100  ..........  . U U U U   .  16  10  10  10
782rte       32  .     .     0100111001110011  ..........  S S S S S  20  24  20  20  20  bus fault not emulated
783rtm       32  .     .     000001101100....  ..........  . . U U U   .   .  19  19  19  not properly emulated
784rtr       32  .     .     0100111001110111  ..........  U U U U U  20  20  14  14  14
785rts       32  .     .     0100111001110101  ..........  U U U U U  16  16  10  10  10
786sbcd       8  rr    .     1000...100000...  ..........  U U U U U   6   6   4   4   4
787sbcd       8  mm    ax7   1000111100001...  ..........  U U U U U  18  18  16  16  16
788sbcd       8  mm    ay7   1000...100001111  ..........  U U U U U  18  18  16  16  16
789sbcd       8  mm    axy7  1000111100001111  ..........  U U U U U  18  18  16  16  16
790sbcd       8  mm    .     1000...100001...  ..........  U U U U U  18  18  16  16  16
791st         8  .     d     0101000011000...  ..........  U U U U U   6   4   4   4   4
792st         8  .     .     0101000011......  A+-DXWL...  U U U U U   8   8   6   6   6
793sf         8  .     d     0101000111000...  ..........  U U U U U   4   4   4   4   4
794sf         8  .     .     0101000111......  A+-DXWL...  U U U U U   8   8   6   6   6
795scc        8  .     d     0101....11000...  ..........  U U U U U   4   4   4   4   4
796scc        8  .     .     0101....11......  A+-DXWL...  U U U U U   8   8   6   6   6
797stop       0  .     .     0100111001110010  ..........  S S S S S   4   4   8   8   8
798sub        8  er    d     1001...000000...  ..........  U U U U U   4   4   2   2   2
799sub        8  er    .     1001...000......  A+-DXWLdxI  U U U U U   4   4   2   2   2
800sub       16  er    d     1001...001000...  ..........  U U U U U   4   4   2   2   2
801sub       16  er    a     1001...001001...  ..........  U U U U U   4   4   2   2   2
802sub       16  er    .     1001...001......  A+-DXWLdxI  U U U U U   4   4   2   2   2
803sub       32  er    d     1001...010000...  ..........  U U U U U   6   6   2   2   2
804sub       32  er    a     1001...010001...  ..........  U U U U U   6   6   2   2   2
805sub       32  er    .     1001...010......  A+-DXWLdxI  U U U U U   6   6   2   2   2
806sub        8  re    .     1001...100......  A+-DXWL...  U U U U U   8   8   4   4   4
807sub       16  re    .     1001...101......  A+-DXWL...  U U U U U   8   8   4   4   4
808sub       32  re    .     1001...110......  A+-DXWL...  U U U U U  12  12   4   4   4
809suba      16  .     d     1001...011000...  ..........  U U U U U   8   8   2   2   2
810suba      16  .     a     1001...011001...  ..........  U U U U U   8   8   2   2   2
811suba      16  .     .     1001...011......  A+-DXWLdxI  U U U U U   8   8   2   2   2
812suba      32  .     d     1001...111000...  ..........  U U U U U   6   6   2   2   2
813suba      32  .     a     1001...111001...  ..........  U U U U U   6   6   2   2   2
814suba      32  .     .     1001...111......  A+-DXWLdxI  U U U U U   6   6   2   2   2
815subi       8  .     d     0000010000000...  ..........  U U U U U   8   8   2   2   2
816subi       8  .     .     0000010000......  A+-DXWL...  U U U U U  12  12   4   4   4
817subi      16  .     d     0000010001000...  ..........  U U U U U   8   8   2   2   2
818subi      16  .     .     0000010001......  A+-DXWL...  U U U U U  12  12   4   4   4
819subi      32  .     d     0000010010000...  ..........  U U U U U  16  14   2   2   2
820subi      32  .     .     0000010010......  A+-DXWL...  U U U U U  20  20   4   4   4
821subq       8  .     d     0101...100000...  ..........  U U U U U   4   4   2   2   2
822subq       8  .     .     0101...100......  A+-DXWL...  U U U U U   8   8   4   4   4
823subq      16  .     d     0101...101000...  ..........  U U U U U   4   4   2   2   2
824subq      16  .     a     0101...101001...  ..........  U U U U U   8   4   2   2   2
825subq      16  .     .     0101...101......  A+-DXWL...  U U U U U   8   8   4   4   4
826subq      32  .     d     0101...110000...  ..........  U U U U U   8   8   2   2   2
827subq      32  .     a     0101...110001...  ..........  U U U U U   8   8   2   2   2
828subq      32  .     .     0101...110......  A+-DXWL...  U U U U U  12  12   4   4   4
829subx       8  rr    .     1001...100000...  ..........  U U U U U   4   4   2   2   2
830subx      16  rr    .     1001...101000...  ..........  U U U U U   4   4   2   2   2
831subx      32  rr    .     1001...110000...  ..........  U U U U U   8   6   2   2   2
832subx       8  mm    ax7   1001111100001...  ..........  U U U U U  18  18  12  12  12
833subx       8  mm    ay7   1001...100001111  ..........  U U U U U  18  18  12  12  12
834subx       8  mm    axy7  1001111100001111  ..........  U U U U U  18  18  12  12  12
835subx       8  mm    .     1001...100001...  ..........  U U U U U  18  18  12  12  12
836subx      16  mm    .     1001...101001...  ..........  U U U U U  18  18  12  12  12
837subx      32  mm    .     1001...110001...  ..........  U U U U U  30  30  12  12  12
838swap      32  .     .     0100100001000...  ..........  U U U U U   4   4   4   4   4
839tas        8  .     d     0100101011000...  ..........  U U U U U   4   4   4   4   4
840tas        8  .     .     0100101011......  A+-DXWL...  U U U U U  14  14  12  12  12
841trap       0  .     .     010011100100....  ..........  U U U U U   4   4   4   4   4
842trapt      0  .     .     0101000011111100  ..........  . . U U U   .   .   4   4   4
843trapt     16  .     .     0101000011111010  ..........  . . U U U   .   .   6   6   6
844trapt     32  .     .     0101000011111011  ..........  . . U U U   .   .   8   8   8
845trapf      0  .     .     0101000111111100  ..........  . . U U U   .   .   4   4   4
846trapf     16  .     .     0101000111111010  ..........  . . U U U   .   .   6   6   6
847trapf     32  .     .     0101000111111011  ..........  . . U U U   .   .   8   8   8
848trapcc     0  .     .     0101....11111100  ..........  . . U U U   .   .   4   4   4
849trapcc    16  .     .     0101....11111010  ..........  . . U U U   .   .   6   6   6
850trapcc    32  .     .     0101....11111011  ..........  . . U U U   .   .   8   8   8
851trapv      0  .     .     0100111001110110  ..........  U U U U U   4   4   4   4   4
852tst        8  .     d     0100101000000...  ..........  U U U U U   4   4   2   2   2
853tst        8  .     .     0100101000......  A+-DXWL...  U U U U U   4   4   2   2   2
854tst        8  .     pcdi  0100101000111010  ..........  . . U U U   .   .   7   7   7
855tst        8  .     pcix  0100101000111011  ..........  . . U U U   .   .   9   9   9
856tst        8  .     i     0100101000111100  ..........  . . U U U   .   .   6   6   6
857tst       16  .     d     0100101001000...  ..........  U U U U U   4   4   2   2   2
858tst       16  .     a     0100101001001...  ..........  . . U U U   .   .   2   2   2
859tst       16  .     .     0100101001......  A+-DXWL...  U U U U U   4   4   2   2   2
860tst       16  .     pcdi  0100101001111010  ..........  . . U U U   .   .   7   7   7
861tst       16  .     pcix  0100101001111011  ..........  . . U U U   .   .   9   9   9
862tst       16  .     i     0100101001111100  ..........  . . U U U   .   .   6   6   6
863tst       32  .     d     0100101010000...  ..........  U U U U U   4   4   2   2   2
864tst       32  .     a     0100101010001...  ..........  . . U U U   .   .   2   2   2
865tst       32  .     .     0100101010......  A+-DXWL...  U U U U U   4   4   2   2   2
866tst       32  .     pcdi  0100101010111010  ..........  . . U U U   .   .   7   7   7
867tst       32  .     pcix  0100101010111011  ..........  . . U U U   .   .   9   9   9
868tst       32  .     i     0100101010111100  ..........  . . U U U   .   .   6   6   6
869unlk      32  .     a7    0100111001011111  ..........  U U U U U  12  12   6   6   6
870unlk      32  .     .     0100111001011...  ..........  U U U U U  12  12   6   6   6
871unpk      16  rr    .     1000...110000...  ..........  . . U U U   .   .   8   8   8
872unpk      16  mm    ax7   1000111110001...  ..........  . . U U U   .   .  13  13  13
873unpk      16  mm    ay7   1000...110001111  ..........  . . U U U   .   .  13  13  13
874unpk      16  mm    axy7  1000111110001111  ..........  . . U U U   .   .  13  13  13
875unpk      16  mm    .     1000...110001...  ..........  . . U U U   .   .  13  13  13
875876
876877
877878
r5955r5956
66666667            m68k->dfc = REG_DA[(word2 >> 12) & 15] & 7;
66676668            return;
66686669         case 0x002:            /* CACR */
6670            /* Only EC020 and later have CACR */
66696671            if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
66706672            {
6673               /* 68030 can write all bits except 5-7, 040 can write all */
66716674               if (CPU_TYPE_IS_040_PLUS(m68k->cpu_type))
66726675               {
66736676                  m68k->cacr = REG_DA[(word2 >> 12) & 15];
66746677               }
6678               else if (CPU_TYPE_IS_030_PLUS(m68k->cpu_type))
6679               {
6680                  m68k->cacr = REG_DA[(word2 >> 12) & 15] & 0xff1f;
6681               }
66756682               else
66766683               {
6677                  /* non 68040 can only set the lower 4 bits (C,CE,F,E) */
66786684                  m68k->cacr = REG_DA[(word2 >> 12) & 15] & 0x0f;
66796685               }
66806686               return;
r5955r5956
79917997
79927998M68KMAKE_OP(pflush, 32, ., .)
79937999{
7994   if(CPU_TYPE_IS_040_PLUS(m68k->cpu_type))
8000   if ((CPU_TYPE_IS_040_PLUS(m68k->cpu_type)) && (m68k->has_pmmu))
79958001   {
79968002      // Nothing to do, unless address translation cache is emulated
8003      logerror("680x0: unhandled PFLUSH\n");
79978004      return;
79988005   }
79998006   m68ki_exception_illegal(m68k);
80008007}
80018008
8009M68KMAKE_OP(pmove, 32, ., .)
8010{
8011   UINT16 modes;
8012   UINT32 ea;
80028013
8014   modes = m68ki_read_imm_16(m68k);
8015   ea = M68KMAKE_GET_EA_AY_32;
8016
8017   if ((CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type)) && (m68k->has_pmmu))
8018   {
8019      logerror("680x0: unhandled PMOVE modes %x ea %x\n", modes, ea);
8020   }
8021   else
8022   {
8023      m68ki_exception_illegal(m68k);
8024   }
8025}
8026
80038027M68KMAKE_OP(reset, 0, ., .)
80048028{
80058029   if(m68k->s_flag)
src/emu/cpu/m68000/m68kcpu.c
r5955r5956
55#if 0
66static const char copyright_notice[] =
77"MUSASHI\n"
8"Version 4.00 (2008-11-17)\n"
8"Version 4.10 (2009-09-27)\n"
99"A portable Motorola M680x0 processor emulation engine.\n"
1010"Copyright Karl Stenerud.  All rights reserved.\n"
1111"\n"
r5955r5956
1717"(Karl Stenerud).\n"
1818"\n"
1919"The latest version of this code can be obtained at:\n"
20"http://kstenerud.cjb.net\n"
20"http://kstenerud.cjb.net or http://mamedev.org\n"
2121;
2222#endif
2323
r5955r5956
8585/* Number of clock cycles to use for exception processing.
8686 * I used 4 for any vectors that are undocumented for processing times.
8787 */
88const UINT8 m68ki_exception_cycle_table[4][256] =
88const UINT8 m68ki_exception_cycle_table[5][256] =
8989{
9090   { /* 000 */
9191       40, /*  0: Reset - Initial Stack Pointer                      */
r5955r5956
306306        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
307307        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
308308   },
309   { /* 030 - not correct */
310        4, /*  0: Reset - Initial Stack Pointer                      */
311        4, /*  1: Reset - Initial Program Counter                    */
312       50, /*  2: Bus Error                             (unemulated) */
313       50, /*  3: Address Error                         (unemulated) */
314       20, /*  4: Illegal Instruction                                */
315       38, /*  5: Divide by Zero                                     */
316       40, /*  6: CHK                                                */
317       20, /*  7: TRAPV                                              */
318       34, /*  8: Privilege Violation                                */
319       25, /*  9: Trace                                              */
320       20, /* 10: 1010                                               */
321       20, /* 11: 1111                                               */
322        4, /* 12: RESERVED                                           */
323        4, /* 13: Coprocessor Protocol Violation        (unemulated) */
324        4, /* 14: Format Error                                       */
325       30, /* 15: Uninitialized Interrupt                            */
326        4, /* 16: RESERVED                                           */
327        4, /* 17: RESERVED                                           */
328        4, /* 18: RESERVED                                           */
329        4, /* 19: RESERVED                                           */
330        4, /* 20: RESERVED                                           */
331        4, /* 21: RESERVED                                           */
332        4, /* 22: RESERVED                                           */
333        4, /* 23: RESERVED                                           */
334       30, /* 24: Spurious Interrupt                                 */
335       30, /* 25: Level 1 Interrupt Autovector                       */
336       30, /* 26: Level 2 Interrupt Autovector                       */
337       30, /* 27: Level 3 Interrupt Autovector                       */
338       30, /* 28: Level 4 Interrupt Autovector                       */
339       30, /* 29: Level 5 Interrupt Autovector                       */
340       30, /* 30: Level 6 Interrupt Autovector                       */
341       30, /* 31: Level 7 Interrupt Autovector                       */
342       20, /* 32: TRAP #0                                            */
343       20, /* 33: TRAP #1                                            */
344       20, /* 34: TRAP #2                                            */
345       20, /* 35: TRAP #3                                            */
346       20, /* 36: TRAP #4                                            */
347       20, /* 37: TRAP #5                                            */
348       20, /* 38: TRAP #6                                            */
349       20, /* 39: TRAP #7                                            */
350       20, /* 40: TRAP #8                                            */
351       20, /* 41: TRAP #9                                            */
352       20, /* 42: TRAP #10                                           */
353       20, /* 43: TRAP #11                                           */
354       20, /* 44: TRAP #12                                           */
355       20, /* 45: TRAP #13                                           */
356       20, /* 46: TRAP #14                                           */
357       20, /* 47: TRAP #15                                           */
358        4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */
359        4, /* 49: FP Inexact Result                     (unemulated) */
360        4, /* 50: FP Divide by Zero                     (unemulated) */
361        4, /* 51: FP Underflow                          (unemulated) */
362        4, /* 52: FP Operand Error                      (unemulated) */
363        4, /* 53: FP Overflow                           (unemulated) */
364        4, /* 54: FP Signaling NAN                      (unemulated) */
365        4, /* 55: FP Unimplemented Data Type            (unemulated) */
366        4, /* 56: MMU Configuration Error               (unemulated) */
367        4, /* 57: MMU Illegal Operation Error           (unemulated) */
368        4, /* 58: MMU Access Level Violation Error      (unemulated) */
369        4, /* 59: RESERVED                                           */
370        4, /* 60: RESERVED                                           */
371        4, /* 61: RESERVED                                           */
372        4, /* 62: RESERVED                                           */
373        4, /* 63: RESERVED                                           */
374           /* 64-255: User Defined                                   */
375        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
376        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
377        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
378        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
379        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
380        4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
381   },
309382   { /* 040 */ // TODO: these values are not correct
310383        4, /*  0: Reset - Initial Stack Pointer                      */
311384        4, /*  1: Reset - Initial Program Counter                    */
r5955r5956
407480    CPU STATE DESCRIPTION
408481***************************************************************************/
409482
410#define MASK_ALL                (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)
483#define MASK_ALL             (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040)
411484#define MASK_24BIT_SPACE         (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020)
412#define MASK_32BIT_SPACE         (CPU_TYPE_020 | CPU_TYPE_040)
413#define MASK_010_OR_LATER         (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)
414#define MASK_020_OR_LATER         (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)
415#define MASK_040_OR_LATER         (CPU_TYPE_040)
485#define MASK_32BIT_SPACE         (CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040)
486#define MASK_010_OR_LATER         (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040)
487#define MASK_020_OR_LATER         (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040)
488#define MASK_030_OR_LATER         (CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040)
489#define MASK_040_OR_LATER         (CPU_TYPE_040 | CPU_TYPE_EC040)
416490
417491#define M68K_STATE_ENTRY(_name, _format, _member, _datamask, _flags, _mask) \
418492   CPU_STATE_ENTRY(M68K_##_name, #_name, _format, m68ki_cpu_core, _member, _datamask, _mask, _flags)
r5955r5956
484558         cpu_get_type(device) == CPU_M68010 ||
485559         cpu_get_type(device) == CPU_M68EC020 ||
486560         cpu_get_type(device) == CPU_M68020 ||
561         cpu_get_type(device) == CPU_M68EC030 ||
562         cpu_get_type(device) == CPU_M68030 ||
563         cpu_get_type(device) == CPU_M68EC040 ||
487564         cpu_get_type(device) == CPU_M68040 ||
488565         cpu_get_type(device) == CPU_SCC68070);
489566   return (m68ki_cpu_core *)device->token;
r5955r5956
10391116   m68k->cyc_movem_l      = 3;
10401117   m68k->cyc_shift        = 1;
10411118   m68k->cyc_reset        = 132;
1119   m68k->has_pmmu          = 0;
10421120}
10431121
10441122CPU_GET_INFO( m68000 )
r5955r5956
10821160   m68k->cyc_movem_l      = 3;
10831161   m68k->cyc_shift        = 1;
10841162   m68k->cyc_reset        = 132;
1163   m68k->has_pmmu          = 0;
10851164}
10861165
10871166CPU_GET_INFO( m68008 )
r5955r5956
11291208   m68k->cyc_movem_l      = 3;
11301209   m68k->cyc_shift        = 1;
11311210   m68k->cyc_reset        = 130;
1211   m68k->has_pmmu          = 0;
11321212}
11331213
11341214CPU_GET_INFO( m68010 )
r5955r5956
11721252   m68k->cyc_movem_l      = 2;
11731253   m68k->cyc_shift        = 0;
11741254   m68k->cyc_reset        = 518;
1255   m68k->has_pmmu          = 0;
11751256}
11761257
11771258CPU_GET_INFO( m68020 )
r5955r5956
12471328   m68k->cyc_movem_l      = 2;
12481329   m68k->cyc_shift        = 0;
12491330   m68k->cyc_reset        = 518;
1331   m68k->has_pmmu          = 0;
12501332}
12511333
12521334CPU_GET_INFO( m68ec020 )
r5955r5956
12671349}
12681350
12691351/****************************************************************************
1352 * M68030 section
1353 ****************************************************************************/
1354
1355static CPU_INIT( m68030 )
1356{
1357   m68ki_cpu_core *m68k = get_safe_token(device);
1358
1359   CPU_INIT_CALL(m68k);
1360
1361   m68k->cpu_type         = CPU_TYPE_030;
1362   m68k->state.subtypemask = m68k->cpu_type;
1363   m68k->dasm_type        = M68K_CPU_TYPE_68030;
1364   m68k->memory           = interface_d32;
1365   m68k->sr_mask          = 0xf71f; /* T1 T0 S  M  -- I2 I1 I0 -- -- -- X  N  Z  V  C  */
1366   m68k->cyc_instruction  = m68ki_cycles[3];
1367   m68k->cyc_exception    = m68ki_exception_cycle_table[3];
1368   m68k->cyc_bcc_notake_b = -2;
1369   m68k->cyc_bcc_notake_w = 0;
1370   m68k->cyc_dbcc_f_noexp = 0;
1371   m68k->cyc_dbcc_f_exp   = 4;
1372   m68k->cyc_scc_r_true   = 0;
1373   m68k->cyc_movem_w      = 2;
1374   m68k->cyc_movem_l      = 2;
1375   m68k->cyc_shift        = 0;
1376   m68k->cyc_reset        = 518;
1377   m68k->has_pmmu          = 1;
1378}
1379
1380CPU_GET_INFO( m68030 )
1381{
1382   m68ki_cpu_core *m68k = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
1383   int sr;
1384
1385   switch (state)
1386   {
1387      /* --- the following bits of info are returned as 64-bit signed integers --- */
1388      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 20;                     break;
1389      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
1390      case CPUINFO_INT_MAX_CYCLES:               info->i = 158;                     break;
1391
1392      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 32;                     break;
1393      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:       info->i = 32;                     break;
1394
1395      /* --- the following bits of info are returned as pointers to data or functions --- */
1396      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(m68030);                  break;
1397
1398      /* --- the following bits of info are returned as NULL-terminated strings --- */
1399      case DEVINFO_STR_NAME:                     strcpy(info->s, "68030");            break;
1400
1401      case CPUINFO_STR_FLAGS:
1402         sr = m68ki_get_sr(m68k);
1403         sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
1404            sr & 0x8000 ? 'T':'.',
1405            sr & 0x4000 ? 't':'.',
1406            sr & 0x2000 ? 'S':'.',
1407            sr & 0x1000 ? 'M':'.',
1408            sr & 0x0800 ? '?':'.',
1409            sr & 0x0400 ? 'I':'.',
1410            sr & 0x0200 ? 'I':'.',
1411            sr & 0x0100 ? 'I':'.',
1412            sr & 0x0080 ? '?':'.',
1413            sr & 0x0040 ? '?':'.',
1414            sr & 0x0020 ? '?':'.',
1415            sr & 0x0010 ? 'X':'.',
1416            sr & 0x0008 ? 'N':'.',
1417            sr & 0x0004 ? 'Z':'.',
1418            sr & 0x0002 ? 'V':'.',
1419            sr & 0x0001 ? 'C':'.');
1420         break;
1421
1422      default:                              CPU_GET_INFO_CALL(m68k);            break;
1423   }
1424}
1425
1426
1427/****************************************************************************
1428 * M680EC30 section
1429 ****************************************************************************/
1430
1431static CPU_INIT( m68ec030 )
1432{
1433   m68ki_cpu_core *m68k = get_safe_token(device);
1434
1435   CPU_INIT_CALL(m68k);
1436
1437   m68k->cpu_type         = CPU_TYPE_EC030;
1438   m68k->state.subtypemask = m68k->cpu_type;
1439   m68k->dasm_type        = M68K_CPU_TYPE_68EC030;
1440   m68k->memory           = interface_d32;
1441   m68k->sr_mask          = 0xf71f; /* T1 T0 S  M  -- I2 I1 I0 -- -- -- X  N  Z  V  C  */
1442   m68k->cyc_instruction  = m68ki_cycles[3];
1443   m68k->cyc_exception    = m68ki_exception_cycle_table[3];
1444   m68k->cyc_bcc_notake_b = -2;
1445   m68k->cyc_bcc_notake_w = 0;
1446   m68k->cyc_dbcc_f_noexp = 0;
1447   m68k->cyc_dbcc_f_exp   = 4;
1448   m68k->cyc_scc_r_true   = 0;
1449   m68k->cyc_movem_w      = 2;
1450   m68k->cyc_movem_l      = 2;
1451   m68k->cyc_shift        = 0;
1452   m68k->cyc_reset        = 518;
1453   m68k->has_pmmu          = 0;      /* EC030 lacks the PMMU and is effectively a die-shrink 68020 */
1454}
1455
1456CPU_GET_INFO( m68ec030 )
1457{
1458   switch (state)
1459   {
1460      /* --- the following bits of info are returned as pointers to data or functions --- */
1461      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(m68ec030);               break;
1462
1463      /* --- the following bits of info are returned as NULL-terminated strings --- */
1464      case DEVINFO_STR_NAME:                     strcpy(info->s, "68EC030");            break;
1465
1466      default:                              CPU_GET_INFO_CALL(m68030);            break;
1467   }
1468}
1469
1470/****************************************************************************
12701471 * M68040 section
12711472 ****************************************************************************/
12721473
r5955r5956
12811482   m68k->dasm_type        = M68K_CPU_TYPE_68040;
12821483   m68k->memory           = interface_d32;
12831484   m68k->sr_mask          = 0xf71f; /* T1 T0 S  M  -- I2 I1 I0 -- -- -- X  N  Z  V  C  */
1284   m68k->cyc_instruction  = m68ki_cycles[2];
1285   m68k->cyc_exception    = m68ki_exception_cycle_table[2];
1485   m68k->cyc_instruction  = m68ki_cycles[4];
1486   m68k->cyc_exception    = m68ki_exception_cycle_table[4];
12861487   m68k->cyc_bcc_notake_b = -2;
12871488   m68k->cyc_bcc_notake_w = 0;
12881489   m68k->cyc_dbcc_f_noexp = 0;
r5955r5956
12921493   m68k->cyc_movem_l      = 2;
12931494   m68k->cyc_shift        = 0;
12941495   m68k->cyc_reset        = 518;
1496   m68k->has_pmmu          = 1;
12951497}
12961498
12971499CPU_GET_INFO( m68040 )
r5955r5956
13401542   }
13411543}
13421544
1545/****************************************************************************
1546 * M680EC30 section
1547 ****************************************************************************/
13431548
1549static CPU_INIT( m68ec040 )
1550{
1551   m68ki_cpu_core *m68k = get_safe_token(device);
1552
1553   CPU_INIT_CALL(m68k);
1554
1555   m68k->cpu_type         = CPU_TYPE_EC040;
1556   m68k->state.subtypemask = m68k->cpu_type;
1557   m68k->dasm_type        = M68K_CPU_TYPE_68EC040;
1558   m68k->memory           = interface_d32;
1559   m68k->sr_mask          = 0xf71f; /* T1 T0 S  M  -- I2 I1 I0 -- -- -- X  N  Z  V  C  */
1560   m68k->cyc_instruction  = m68ki_cycles[4];
1561   m68k->cyc_exception    = m68ki_exception_cycle_table[4];
1562   m68k->cyc_bcc_notake_b = -2;
1563   m68k->cyc_bcc_notake_w = 0;
1564   m68k->cyc_dbcc_f_noexp = 0;
1565   m68k->cyc_dbcc_f_exp   = 4;
1566   m68k->cyc_scc_r_true   = 0;
1567   m68k->cyc_movem_w      = 2;
1568   m68k->cyc_movem_l      = 2;
1569   m68k->cyc_shift        = 0;
1570   m68k->cyc_reset        = 518;
1571   m68k->has_pmmu          = 1;
1572}
1573
1574CPU_GET_INFO( m68ec040 )
1575{
1576   switch (state)
1577   {
1578      /* --- the following bits of info are returned as pointers to data or functions --- */
1579      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(m68ec040);               break;
1580
1581      /* --- the following bits of info are returned as NULL-terminated strings --- */
1582      case DEVINFO_STR_NAME:                     strcpy(info->s, "68EC040");            break;
1583
1584      default:                              CPU_GET_INFO_CALL(m68040);            break;
1585   }
1586}
1587
13441588/****************************************************************************
13451589 * SCC-68070 section
13461590 ****************************************************************************/
r5955r5956
13701614      default:                               CPU_GET_INFO_CALL(m68k);            break;
13711615   }
13721616}
1617
src/emu/cpu/z180/z180.h
r5955r5956
135135#define Z180_INT_ASCI0   8         /* Internal ASCI channel 0 */
136136#define Z180_INT_ASCI1   9         /* Internal ASCI channel 1 */
137137
138#ifdef UNUSED_DEFINITION
138139/* MMU mapped memory lookup */
139140extern UINT8 z180_readmem(const device_config *device, offs_t offset);
140141extern void z180_writemem(const device_config *device, offs_t offset, UINT8 data);
142#endif
141143
142144extern CPU_GET_INFO( z180 );
143145#define CPU_Z180 CPU_GET_INFO_NAME( z180 )
src/emu/cpu/z180/z180ops.h
r5955r5956
6969 * Read a byte from given memory location
7070 ***************************************************************/
7171#define RM(cs,addr)   memory_read_byte_8le((cs)->program, MMU_REMAP_ADDR(cs,addr))
72#ifdef UNUSED_FUNCTION
7273UINT8 z180_readmem(const device_config *device, offs_t offset)
7374{
7475   z180_state *cpustate = get_safe_token(device);
7576   return RM(cpustate, offset);
7677}
78#endif
7779
7880/***************************************************************
7981 * Write a byte to given memory location
8082 ***************************************************************/
8183#define WM(cs,addr,value) memory_write_byte_8le((cs)->program, MMU_REMAP_ADDR(cs,addr),value)
84#ifdef UNUSED_FUNCTION
8285void z180_writemem(const device_config *device, offs_t offset, UINT8 data)
8386{
8487   z180_state *cpustate = get_safe_token(device);
8588   WM(cpustate, offset, data);
8689}
90#endif
8791
88
8992/***************************************************************
9093 * Read a word from given memory location
9194 ***************************************************************/
src/emu/cpu/v60/v60d.c
r5955r5956
33#include "v60.h"
44
55// Register names
6const char *const v60_reg_names[69] = {
6static const char *const v60_reg_names[69] = {
77   "R0", "R1", "R2", "R3",
88   "R4", "R5", "R6", "R7",
99   "R8", "R9", "R10", "R11",
src/emu/cpu/v60/v60.h
r5955r5956
7878   V60_REGMAX
7979};
8080
81extern const char *const v60_reg_names[];
8281void v60_stall(const device_config *device);
8382
8483CPU_GET_INFO( v60 );
src/emu/cpu/dsp56k/dsp56ops.c
r5955r5956
16551655/* SUB : .... .... 0100 FJJJ : A-202 */
16561656static size_t dsp56k_op_sub(dsp56k_core* cpustate, const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles)
16571657{
1658   UINT64 useVal = 0;
1659   typed_pointer S = {NULL, DT_BYTE};
1660   typed_pointer D = {NULL, DT_BYTE};
1661
1662   decode_JJJF_table(cpustate, BITS(op_byte,0x0007), BITS(op_byte,0x0008), &S, &D);
1663
1664   /* Get on with it. */
1665   switch(S.data_type)
1666   {
1667      case DT_WORD:        useVal = (UINT64)*((UINT16*)S.addr) << 16; break;
1668      case DT_DOUBLE_WORD: useVal = (UINT64)*((UINT32*)S.addr);       break;
1669      case DT_LONG_WORD:   useVal = (UINT64)*((UINT64*)S.addr);       break;
1670   }
1671
1672   /* Sign-extend word for proper sub op */
1673   if ((S.data_type == DT_WORD) && useVal & U64(0x0000000080000000))
1674      useVal |= U64(0x000000ff00000000);
1675
1676   /* Operate*/
1677   *((UINT64*)D.addr) -= useVal;
1678
1679   d_register->addr = D.addr;
1680   d_register->data_type = D.data_type;
1681
16581682   /* S L E U N Z V C */
16591683   /* * * * * * * * * */
1660   return 0;
1684   /* TODO S, L, E, U, V, C */
1685   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1686   if (*((UINT64*)D.addr) == 0)                 Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
1687
1688   cycles += 2;      /* TODO: + mv oscillator cycles */
1689   return 1;
16611690}
16621691
16631692/* CLR24 : .... .... 0101 F001 : A-62 */
r5955r5956
29953024   /* TODO: Verify, since it's not in the docs, but it must be true */
29963025   PC += 2;
29973026
2998   SP++;
2999   SSH = PC;
3000   SSL = SR;
3027   /* TODO: This is a hacky implementation of Long vs Fast Interrupts.  Do it right someday! */
3028   if (PC < WORD(0x40))
3029   {
3030      /* Long interrupt gets the previous PC, not the current one */
3031      SP++;
3032      SSH = cpustate->ppc;
3033      SSL = SR;
30013034
3002   cpustate->ppc = PC;
3003   PC = branchOffset;
3035      cpustate->ppc = cpustate->ppc;
3036      PC = branchOffset;
3037   }
3038   else
3039   {
3040      /* Normal operation */
3041      SP++;
3042      SSH = PC;
3043      SSL = SR;
30043044
3045      cpustate->ppc = PC;
3046      PC = branchOffset;
3047   }
3048
30053049   /* S L E U N Z V C */
30063050   /* - - - - - - - - */
30073051   cycles += 4;      /* TODO: + jx oscillator cycles */
src/emu/cpu/dsp56k/dsp56pcu.c
r5955r5956
276276      // 1-12 Make sure you're not masked out against the Interrupt Mask Bits (disabled is handled for free here)
277277      if (priority >= I_bits(cpustate))
278278      {
279         // TODO: Implement long interrupts & fast interrupts correctly!
280         //       Right now they are handled in the JSR & BSR ops.  SupahLame.
281         cpustate->ppc = PC;
282
279283         // Are you anything but the Host Command interrupt?
280284         if (interrupt_index != 22)
281285         {
r5955r5956
287291            // The host command input has a floating vector.
288292            const UINT16 irq_vector = HV_bits(cpustate) << 1;
289293
290            cpustate->ppc = PC;
291294            PC = irq_vector;
292295
293296            // TODO: 5-9 5-11 Gotta' Clear HC (HCP gets it too) when taking this exception!
src/emu/cpu/dsp56k/dsp56k.c
r5955r5956
141141         {
142142            /* If it changes state from asserted to cleared.  Call the reset function. */
143143            if (cpustate->reset_state == TRUE)
144               cpu_reset_dsp56k(cpustate->device);
144               CPU_RESET_NAME(dsp56k)(cpustate->device);
145145
146146            cpustate->reset_state = FALSE;
147147         }
src/emu/cpu/arm/arm.h
r5955r5956
1919extern CPU_GET_INFO( arm );
2020#define CPU_ARM CPU_GET_INFO_NAME( arm )
2121
22extern UINT32 arm_disasm(char *pBuf, UINT32 pc, UINT32 opcode);
23
2422enum
2523{
2624   ARM32_PC=0,
src/emu/cpu/arm/armdasm.c
r5955r5956
9999   return pBuf;
100100}
101101
102UINT32 arm_disasm( char *pBuf, UINT32 pc, UINT32 opcode )
102static UINT32 arm_disasm( char *pBuf, UINT32 pc, UINT32 opcode )
103103{
104104   const char *pBuf0;
105105
src/emu/cpu/sh2/sh2comn.h
r5955r5956
173173#endif
174174} SH2;
175175
176TIMER_CALLBACK( sh2_timer_callback );
177TIMER_CALLBACK( sh2_dmac_callback );
178
179176void sh2_common_init(SH2 *sh2, const device_config *device, cpu_irq_callback irqcallback);
180177void sh2_recalc_irq(SH2 *sh2);
181178void sh2_set_irq_line(SH2 *sh2, int irqline, int state);
src/emu/cpu/sh2/sh2.h
r5955r5956
7777void sh2_set_ftcsr_read_callback(const device_config *device, void (*callback)(UINT32));
7878void sh2_set_frt_input(const device_config *device, int state);
7979
80extern unsigned DasmSH2( char *dst, unsigned pc, UINT16 opcode );
81
8280/***************************************************************************
8381    COMPILER-SPECIFIC OPTIONS
8482***************************************************************************/
src/emu/cpu/sh2/sh2dasm.c
r5955r5956
573573   return 0;
574574}
575575
576unsigned DasmSH2(char *buffer, unsigned pc, UINT16 opcode)
576static unsigned DasmSH2(char *buffer, unsigned pc, UINT16 opcode)
577577{
578578   UINT32 flags;
579579
src/emu/cpu/sh2/sh2comn.c
r5955r5956
106106   }
107107}
108108
109TIMER_CALLBACK( sh2_timer_callback )
109static TIMER_CALLBACK( sh2_timer_callback )
110110{
111111   SH2 *sh2 = (SH2 *)ptr;
112112   UINT16 frc;
r5955r5956
133133   sh2_timer_activate(sh2);
134134}
135135
136TIMER_CALLBACK( sh2_dmac_callback )
136static TIMER_CALLBACK( sh2_dmac_callback )
137137{
138138   int dma = param & 1;
139139   SH2 *sh2 = (SH2 *)ptr;
src/emu/cpu/sh4/sh4.h
r5955r5956
9797WRITE32_HANDLER( sh4_internal_w );
9898READ32_HANDLER( sh4_internal_r );
9999
100extern unsigned DasmSH4( char *dst, unsigned pc, UINT16 opcode );
101
102100void sh4_set_frt_input(const device_config *device, int state);
103101void sh4_set_irln_input(const device_config *device, int value);
104102void sh4_set_ftcsr_callback(const device_config *device, sh4_ftcsr_callback callback);
src/emu/cpu/sh4/sh4dasm.c
r5955r5956
782782   return 0;
783783}
784784
785unsigned DasmSH4(char *buffer, unsigned pc, UINT16 opcode)
785static unsigned DasmSH4(char *buffer, unsigned pc, UINT16 opcode)
786786{
787787   UINT32 flags;
788788
src/emu/cpu/i960/i960.c
r5955r5956
11#include "debugger.h"
22#include "i960.h"
3#include "i960dis.h"
43#include <math.h>
54
65CPU_DISASSEMBLE( i960  );
src/emu/cpu/i960/i960dis.c
r5955r5956
154154
155155#define READ32(dis,offs) ((dis)->oprom[(offs) + 0] | ((dis)->oprom[(offs) + 1] << 8) | ((dis)->oprom[(offs) + 2] << 16) | ((dis)->oprom[(offs) + 3] << 24))
156156
157char *i960_disassemble(disassemble_t *diss)
157static char *i960_disassemble(disassemble_t *diss)
158158{
159159   unsigned char op,op2;
160160   unsigned char mode, modeh, model;
src/emu/cpu/i960/i960dis.h
r5955r5956
1111   UINT32 disflags;
1212};
1313
14char *i960_disassemble(disassemble_t *diss);
15
1614#endif /* __I960DIS_H__ */
src/emu/cpu/arm7/arm7core.h
r5955r5956
492492extern void arm7_dt_r_callback(arm_state *cpustate, UINT32 insn, UINT32 *prn, UINT32 (*read32)(arm_state *cpustate, UINT32 addr));
493493extern void arm7_dt_w_callback(arm_state *cpustate, UINT32 insn, UINT32 *prn, void (*write32)(arm_state *cpustate, UINT32 addr, UINT32 data));
494494
495extern UINT32 arm7_disasm(char *pBuf, UINT32 pc, UINT32 opcode);
496extern UINT32 thumb_disasm(char *pBuf, UINT32 pc, UINT16 opcode);
497
498495#ifdef UNUSED_DEFINITION
499496extern char *(*arm7_dasm_cop_dt_callback)(arm_state *cpustate, char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0);
500497extern char *(*arm7_dasm_cop_rt_callback)(arm_state *cpustate, char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0);
src/emu/cpu/arm7/arm7dasm.c
r5955r5956
198198   return pBuf;
199199} /* WriteBranchAddress */
200200
201UINT32 arm7_disasm( char *pBuf, UINT32 pc, UINT32 opcode )
201static UINT32 arm7_disasm( char *pBuf, UINT32 pc, UINT32 opcode )
202202{
203203   const char *pBuf0;
204204
r5955r5956
692692   return dasmflags | DASMFLAG_SUPPORTED;
693693}
694694
695UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
695static UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
696696{
697697   const char *pBuf0;
698698   UINT32 dasmflags = 0;
src/emu/uigfx.c
r5955r5956
275275      x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth));
276276
277277   /* go ahead and draw the outer box now */
278   ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_FILLCOLOR);
278   ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR);
279279
280280   /* draw the title */
281281   x0 = 0.5f - 0.5f * titlewidth;
r5955r5956
518518      x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth));
519519
520520   /* go ahead and draw the outer box now */
521   ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_FILLCOLOR);
521   ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR);
522522
523523   /* draw the title */
524524   x0 = 0.5f - 0.5f * titlewidth;
r5955r5956
918918   }
919919
920920   /* go ahead and draw the outer box now */
921   ui_draw_outlined_box(boxbounds.x0, boxbounds.y0, boxbounds.x1, boxbounds.y1, UI_FILLCOLOR);
921   ui_draw_outlined_box(boxbounds.x0, boxbounds.y0, boxbounds.x1, boxbounds.y1, UI_GFXVIEWER_BG_COLOR);
922922
923923   /* draw the title */
924924   x0 = 0.5f - 0.5f * titlewidth;
src/emu/devtempl.h
r5955r5956
6464***************************************************************************/
6565
6666
67#define DEVTEMPLATE_ID1(x) DEVTEMPLATE_ID(x,)
68#define DEVTEMPLATE_DERIVED_ID1(x) DEVTEMPLATE_DERIVED_ID(x,)
69
6770/* flag bits for DEVTEMPLATE_FEATURES */
6871#define DT_HAS_START         0x0001
6972#define DT_HAS_RESET         0x0002
r5955r5956
164167
165168      /* --- the following bits of info are returned as pointers --- */
166169#if ((DEVTEMPLATE_FEATURES) & DT_HAS_ROM_REGION)
167      case DEVINFO_PTR_ROM_REGION:         info->romregion = DEVTEMPLATE_ID(rom_,);                  break;
170      case DEVINFO_PTR_ROM_REGION:         info->romregion = DEVTEMPLATE_ID1(ROM_NAME());                  break;
168171#endif
169172#if ((DEVTEMPLATE_FEATURES) & DT_HAS_MACHINE_CONFIG)
170      case DEVINFO_PTR_MACHINE_CONFIG:      info->machine_config = DEVTEMPLATE_ID(machine_config_,);      break;
173      case DEVINFO_PTR_MACHINE_CONFIG:      info->machine_config = DEVTEMPLATE_ID1(MACHINE_DRIVER_NAME());      break;
171174#endif
172175#if ((DEVTEMPLATE_FEATURES) & DT_HAS_CONTRACT_LIST)
173      case DEVINFO_PTR_CONTRACT_LIST:         info->contract_list = DEVTEMPLATE_ID(device_contract_list_,);   break;
176      case DEVINFO_PTR_CONTRACT_LIST:         info->contract_list = DEVTEMPLATE_ID1(DEVICE_CONTRACT_LIST_NAME());   break;
174177#endif
175178
176179      /* --- the following bits of info are returned as pointers to data or functions --- */
177180#if ((DEVTEMPLATE_FEATURES) & DT_HAS_START)
178      case DEVINFO_FCT_START:               info->start = DEVTEMPLATE_ID(device_start_,);                break;
181      case DEVINFO_FCT_START:               info->start = DEVTEMPLATE_ID1(DEVICE_START_NAME());                break;
179182#endif
180183#if ((DEVTEMPLATE_FEATURES) & DT_HAS_RESET)
181      case DEVINFO_FCT_RESET:               info->reset = DEVTEMPLATE_ID(device_reset_,);                break;
184      case DEVINFO_FCT_RESET:               info->reset = DEVTEMPLATE_ID1(DEVICE_RESET_NAME());                break;
182185#endif
183186#if ((DEVTEMPLATE_FEATURES) & DT_HAS_STOP)
184      case DEVINFO_FCT_STOP:               info->stop = DEVTEMPLATE_ID(device_stop_,);                break;
187      case DEVINFO_FCT_STOP:               info->stop = DEVTEMPLATE_ID1(DEVICE_STOP_NAME());                break;
185188#endif
186189#if ((DEVTEMPLATE_FEATURES) & DT_HAS_EXECUTE)
187      case DEVINFO_FCT_EXECUTE:            info->execute = DEVTEMPLATE_ID(device_execute_,);             break;
190      case DEVINFO_FCT_EXECUTE:            info->execute = DEVTEMPLATE_ID1(DEVICE_EXECUTE_NAME());             break;
188191#endif
189192#if ((DEVTEMPLATE_FEATURES) & DT_HAS_NVRAM)
190      case DEVINFO_FCT_NVRAM:               info->nvram = DEVTEMPLATE_ID(device_nvram_,);                break;
193      case DEVINFO_FCT_NVRAM:               info->nvram = DEVTEMPLATE_ID1(DEVICE_NVRAM_NAME());                break;
191194#endif
192195#if ((DEVTEMPLATE_FEATURES) & DT_HAS_VALIDITY_CHECK)
193      case DEVINFO_FCT_VALIDITY_CHECK:      info->validity_check = DEVTEMPLATE_ID(device_validity_check_,);   break;
196      case DEVINFO_FCT_VALIDITY_CHECK:      info->validity_check = DEVTEMPLATE_ID1(DEVICE_VALIDITY_CHECK_NAME());   break;
194197#endif
195198#if ((DEVTEMPLATE_FEATURES) & DT_HAS_CUSTOM_CONFIG)
196      case DEVINFO_FCT_CUSTOM_CONFIG:         info->custom_config = DEVTEMPLATE_ID(device_custom_config_,);   break;
199      case DEVINFO_FCT_CUSTOM_CONFIG:         info->custom_config = DEVTEMPLATE_ID1(DEVICE_CUSTOM_CONFIG_NAME());   break;
197200#endif
198201
199202      /* --- the following bits of info are returned as NULL-terminated strings --- */
r5955r5956
239242   {
240243      /* --- the following bits of info are returned as pointers --- */
241244#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_ROM_REGION)
242      case DEVINFO_PTR_ROM_REGION:         info->romregion = DEVTEMPLATE_DERIVED_ID(rom_,);                  break;
245      case DEVINFO_PTR_ROM_REGION:         info->romregion = DEVTEMPLATE_DERIVED_ID1(ROM_NAME());                  break;
243246#endif
244247#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_MACHINE_CONFIG)
245      case DEVINFO_PTR_MACHINE_CONFIG:      info->machine_config = DEVTEMPLATE_DERIVED_ID(machine_config_,);       break;
248      case DEVINFO_PTR_MACHINE_CONFIG:      info->machine_config = DEVTEMPLATE_DERIVED_ID1(MACHINE_DRIVER_NAME());       break;
246249#endif
247250#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CONTRACT_LIST)
248      case DEVINFO_PTR_CONTRACT_LIST:         info->contract_list = DEVTEMPLATE_DERIVED_ID(contract_list_,);          break;
251      case DEVINFO_PTR_CONTRACT_LIST:         info->contract_list = DEVTEMPLATE_DERIVED_ID1(DEVICE_CONTRACT_LIST_NAME());          break;
249252#endif
250253
251254      /* --- the following bits of info are returned as pointers to data or functions --- */
252255#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_START)
253      case DEVINFO_FCT_START:               info->start = DEVTEMPLATE_DERIVED_ID(device_start_,);                break;
256      case DEVINFO_FCT_START:               info->start = DEVTEMPLATE_DERIVED_ID1(DEVICE_START_NAME());                break;
254257#endif
255258#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_RESET)
256      case DEVINFO_FCT_RESET:               info->reset = DEVTEMPLATE_DERIVED_ID(device_reset_,);                break;
259      case DEVINFO_FCT_RESET:               info->reset = DEVTEMPLATE_DERIVED_ID1(DEVICE_RESET_NAME());                break;
257260#endif
258261#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_STOP)
259      case DEVINFO_FCT_STOP:               info->stop = DEVTEMPLATE_DERIVED_ID(device_stop_,);                break;
262      case DEVINFO_FCT_STOP:               info->stop = DEVTEMPLATE_DERIVED_ID1(DEVICE_STORE_NAME());                break;
260263#endif
261264#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_EXECUTE)
262      case DEVINFO_FCT_EXECUTE:            info->execute = DEVTEMPLATE_DERIVED_ID(device_execute_,);             break;
265      case DEVINFO_FCT_EXECUTE:            info->execute = DEVTEMPLATE_DERIVED_ID1(DEVICE_EXECUTE_NAME());             break;
263266#endif
264267#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_NVRAM)
265      case DEVINFO_FCT_NVRAM:               info->nvram = DEVTEMPLATE_DERIVED_ID(device_nvram_,);                break;
268      case DEVINFO_FCT_NVRAM:               info->nvram = DEVTEMPLATE_DERIVED_ID1(DEVICE_NVRAM_NAME());                break;
266269#endif
267270#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_VALIDITY_CHECK)
268      case DEVINFO_FCT_VALIDITY_CHECK:      info->validity_check = DEVTEMPLATE_DERIVED_ID(device_validity_check_,); break;
271      case DEVINFO_FCT_VALIDITY_CHECK:      info->validity_check = DEVTEMPLATE_DERIVED_ID1(DEVICE_VALIDITY_CHECK_NAME()); break;
269272#endif
270273#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CUSTOM_CONFIG)
271      case DEVINFO_FCT_CUSTOM_CONFIG:         info->custom_config = DEVTEMPLATE_DERIVED_ID(device_custom_config_,);    break;
274      case DEVINFO_FCT_CUSTOM_CONFIG:         info->custom_config = DEVTEMPLATE_DERIVED_ID1(DEVICE_CUSTOM_CONFIG_NAME());    break;
272275#endif
273276
274277      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/uimenu.c
r5955r5956
3333#define UI_MENU_POOL_SIZE      65536
3434#define UI_MENU_ALLOC_ITEMS      256
3535
36#define MENU_TEXTCOLOR         ARGB_WHITE
37#define MENU_SELECTCOLOR      MAKE_ARGB(0xff,0xff,0xff,0x00)
38#define MENU_UNAVAILABLECOLOR   MAKE_ARGB(0xff,0x40,0x40,0x40)
39
4036#define VISIBLE_GAMES_IN_LIST   15
4137
4238#define MAX_PHYSICAL_DIPS      10
r5955r5956
242238static const char backtext[] = "Return to " CAPSTARTGAMENOUN;
243239static const char exittext[] = "Exit";
244240
245static const rgb_t text_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0xff);
246static const rgb_t text_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x80);
247static const rgb_t sel_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x00);
248static const rgb_t sel_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x00);
249static const rgb_t mouseover_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80);
250static const rgb_t mouseover_bgcolor = MAKE_ARGB(0x70,0x40,0x40,0x00);
251static const rgb_t mousedown_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80);
252static const rgb_t mousedown_bgcolor = MAKE_ARGB(0xB0,0x60,0x60,0x00);
253241
254242
255
256243/***************************************************************************
257244    FUNCTION PROTOTYPES
258245***************************************************************************/
r5955r5956
815802   x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
816803   y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER;
817804   if (!customonly)
818      ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
805      ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
819806
820807   /* determine the first visible line based on the current selection */
821808   top_line = menu->selected - visible_lines / 2;
r5955r5956
848835         int itemnum = top_line + linenum;
849836         const ui_menu_item *item = &menu->item[itemnum];
850837         const char *itemtext = item->text;
851         rgb_t fgcolor = text_fgcolor;
852         rgb_t bgcolor = text_bgcolor;
838         rgb_t fgcolor = UI_TEXT_COLOR;
839         rgb_t bgcolor = UI_TEXT_BG_COLOR;
840         rgb_t fgcolor2 = UI_SUBITEM_COLOR;
841         rgb_t fgcolor3 = UI_CLONE_COLOR;
853842         float line_x0 = x1 + 0.5f * UI_LINE_WIDTH;
854843         float line_y0 = line_y;
855844         float line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
r5955r5956
862851         /* if we're selected, draw with a different background */
863852         if (itemnum == menu->selected)
864853         {
865            fgcolor = sel_fgcolor;
866            bgcolor = sel_bgcolor;
854            fgcolor = UI_SELECTED_COLOR;
855            bgcolor = UI_SELECTED_BG_COLOR;
856            fgcolor2 = UI_SELECTED_COLOR;
857            fgcolor3 = UI_SELECTED_COLOR;
867858         }
868859
869860         /* else if the mouse is over this item, draw with a different background */
870861         else if (itemnum == menu->hover)
871862         {
872            fgcolor = mouseover_fgcolor;
873            bgcolor = mouseover_bgcolor;
863            fgcolor = UI_MOUSEOVER_COLOR;
864            bgcolor = UI_MOUSEOVER_BG_COLOR;
865            fgcolor2 = UI_MOUSEOVER_COLOR;
866            fgcolor3 = UI_MOUSEOVER_COLOR;
874867         }
875868
876869         /* if we have some background hilighting to do, add a quad behind everything else */
877         if (bgcolor != text_bgcolor)
870         if (bgcolor != UI_TEXT_BG_COLOR)
878871            render_ui_add_quad(line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture,
879872                           PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
880873
r5955r5956
908901
909902         /* if we're just a divider, draw a line */
910903         else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0)
911            render_ui_add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
904            render_ui_add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
912905
913906         /* if we don't have a subitem, just draw the string centered */
914907         else if (item->subtext == NULL)
r5955r5956
939932
940933            /* draw the subitem right-justified */
941934            ui_draw_text_full(subitem_text, effective_left + item_width, line_y, effective_width - item_width,
942                     JUSTIFY_RIGHT, WRAP_TRUNCATE, subitem_invert ? DRAW_OPAQUE : DRAW_NORMAL, fgcolor, bgcolor, &subitem_width, NULL);
935                     JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, NULL);
943936
944937            /* apply arrows */
945938            if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW))
r5955r5956
989982      ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER,
990983                   target_y - UI_BOX_TB_BORDER,
991984                   target_x + target_width + UI_BOX_LR_BORDER,
992                   target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? sel_bgcolor : UI_FILLCOLOR);
985                   target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR);
993986      ui_draw_text_full(item->subtext, target_x, target_y, target_width,
994               JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, sel_fgcolor, sel_bgcolor, NULL, NULL);
987               JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, NULL, NULL);
995988   }
996989
997   /* if there is somthing special to add, do it by calling the passed routine */
990   /* if there is something special to add, do it by calling the passed routine */
998991   if (menu->custom != NULL)
999992   {
1000993      void *selectedref = (menu->selected >= 0 && menu->selected < menu->numitems) ? menu->item[menu->selected].ref : NULL;
r5955r5956
10511044   ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER - gutter_width,
10521045                target_y - UI_BOX_TB_BORDER,
10531046                target_x + target_width + gutter_width + UI_BOX_LR_BORDER,
1054                target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ?  UI_REDCOLOR : UI_FILLCOLOR);
1047                target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ?  UI_RED_COLOR : UI_BACKGROUND_COLOR);
10551048   ui_draw_text_full(text, target_x, target_y, target_width,
1056            JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
1049            JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
10571050
10581051   /* draw the "return to prior menu" text with a hilight behind it */
10591052   render_ui_add_quad(   target_x + 0.5f * UI_LINE_WIDTH,
10601053                  target_y + target_height - line_height,
10611054                  target_x + target_width - 0.5f * UI_LINE_WIDTH,
10621055                  target_y + target_height,
1063                  sel_bgcolor,
1056                  UI_SELECTED_BG_COLOR,
10641057                  hilight_texture,
10651058                  PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
10661059   ui_draw_text_full(backtext, target_x, target_y + target_height - line_height, target_width,
1067            JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, sel_fgcolor, sel_bgcolor, NULL, NULL);
1060            JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, NULL, NULL);
10681061
10691062   /* artificially set the hover to the last item so a double-click exits */
10701063   menu->hover = menu->numitems - 1;
r5955r5956
21082101   y2 = y1 + bottom;
21092102
21102103   /* draw extra menu area */
2111   ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
2104   ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
21122105   y1 += (float)DIP_SWITCH_SPACING;
21132106
21142107   /* iterate over DIP switches */
r5955r5956
21572150                  JUSTIFY_RIGHT,
21582151                  WRAP_NEVER,
21592152                  DRAW_NORMAL,
2160                  ARGB_WHITE,
2153                  UI_TEXT_COLOR,
21612154                  PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA),
21622155                  NULL ,
21632156                  NULL);
r5955r5956
21732166      float innerx1;
21742167
21752168      /* first outline the switch */
2176      ui_draw_outlined_box(x1, y1, x1 + switch_field_width, y2, UI_FILLCOLOR);
2169      ui_draw_outlined_box(x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR);
21772170
21782171      /* compute x1/x2 for the inner filled in switch */
21792172      innerx1 = x1 + (switch_field_width - switch_width) / 2;
r5955r5956
21832176      {
21842177         float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off;
21852178         render_ui_add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
2186                        (selectedmask & (1 << toggle)) ? MENU_SELECTCOLOR : ARGB_WHITE,
2179                        (selectedmask & (1 << toggle)) ? UI_DIPSW_COLOR : UI_TEXT_COLOR,
21872180                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
21882181      }
21892182      else
21902183      {
21912184         render_ui_add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
2192                        MENU_UNAVAILABLECOLOR,
2185                        UI_UNAVAILABLE_COLOR,
21932186                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
21942187      }
21952188
r5955r5956
28772870      x2 = 1.0f - UI_BOX_LR_BORDER;
28782871
28792872      /* draw extra menu area */
2880      ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
2873      ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
28812874      y1 += UI_BOX_TB_BORDER;
28822875
28832876      /* determine the text height */
r5955r5956
28972890      current_x = bar_left + bar_width * percentage;
28982891
28992892      /* fill in the percentage */
2900      render_ui_add_rect(bar_left, bar_top, current_x, bar_bottom, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2893      render_ui_add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
29012894
29022895      /* draw the top and bottom lines */
2903      render_ui_add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2904      render_ui_add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2896      render_ui_add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2897      render_ui_add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
29052898
29062899      /* draw default marker */
2907      render_ui_add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2908      render_ui_add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2900      render_ui_add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2901      render_ui_add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
29092902
29102903      /* draw the actual text */
29112904      ui_draw_text_full(astring_c(tempstring), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
2912               JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, &text_height);
2905               JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, &text_height);
29132906
29142907      astring_free(tempstring);
29152908   }
r5955r5956
34733466   if (menustate->error)
34743467      ui_draw_text_box("The selected game is missing one or more required ROM or CHD images. "
34753468                       "Please select a different game.\n\nPress any key to continue.",
3476                       JUSTIFY_CENTER, 0.5f, 0.5f, UI_REDCOLOR);
3469                       JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
34773470}
34783471
34793472
r5955r5956
36493642   y2 = origy1 - UI_BOX_TB_BORDER;
36503643
36513644   /* draw a box */
3652   ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
3645   ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
36533646
36543647   /* take off the borders */
36553648   x1 += UI_BOX_LR_BORDER;
r5955r5956
36593652
36603653   /* draw the text within it */
36613654   ui_draw_text_full(&tempbuf[0][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
3662                 DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
3655                 DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
36633656
36643657   /* determine the text to render below */
36653658   driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : NULL;
r5955r5956
37383731   y2 = origy2 + bottom;
37393732
37403733   /* draw a box */
3741   color = UI_FILLCOLOR;
3734   color = UI_BACKGROUND_COLOR;
3735   if (driver != NULL)
3736      color = UI_GREEN_COLOR;
37423737   if (driver != NULL && (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_NO_SOUND | GAME_IMPERFECT_SOUND)) != 0)
3743      color = UI_YELLOWCOLOR;
3738      color = UI_YELLOW_COLOR;
37443739   if (driver != NULL && (driver->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION)) != 0)
3745      color = UI_REDCOLOR;
3740      color = UI_RED_COLOR;
37463741   ui_draw_outlined_box(x1, y1, x2, y2, color);
37473742
37483743   /* take off the borders */
r5955r5956
37553750   for (line = 0; line < 4; line++)
37563751   {
37573752      ui_draw_text_full(&tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
3758                    DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
3753                    DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
37593754      y1 += ui_get_line_height();
37603755   }
37613756}
src/emu/memory.c
r5955r5956
136136/* banking constants */
137137#define MAX_BANKS            (STATIC_BANKMAX - STATIC_BANK1) /* maximum number of banks */
138138#define MAX_BANK_ENTRIES      4096               /* maximum number of possible bank values */
139#define MAX_EXPLICIT_BANKS      64                  /* maximum number of explicitly-defined banks */
139#define MAX_EXPLICIT_BANKS      96                  /* maximum number of explicitly-defined banks */
140140
141141/* address map lookup table definitions */
142142#define LEVEL1_BITS            18                  /* number of address bits in the level 1 table */
r5955r5956
34273427      "bank 20",      "bank 21",      "bank 22",      "bank 23",
34283428      "bank 24",      "bank 25",      "bank 26",      "bank 27",
34293429      "bank 28",      "bank 29",      "bank 30",      "bank 31",
3430      "bank 32",      "ram[33]",      "ram[34]",      "ram[35]",
3431      "ram[36]",      "ram[37]",      "ram[38]",      "ram[39]",
3432      "ram[40]",      "ram[41]",      "ram[42]",      "ram[43]",
3433      "ram[44]",      "ram[45]",      "ram[46]",      "ram[47]",
3434      "ram[48]",      "ram[49]",      "ram[50]",      "ram[51]",
3435      "ram[52]",      "ram[53]",      "ram[54]",      "ram[55]",
3436      "ram[56]",      "ram[57]",      "ram[58]",      "ram[59]",
3437      "ram[60]",      "ram[61]",      "ram[62]",      "ram[63]",
3438      "ram[64]",      "ram[65]",      "ram[66]",      "ram",
3430      "bank 32",      "bank 33",      "bank 34",      "bank 35",
3431      "bank 36",      "bank 37",      "bank 38",      "bank 39",
3432      "bank 40",      "bank 41",      "bank 42",      "bank 43",
3433      "bank 44",      "bank 45",      "bank 46",      "bank 47",
3434      "bank 48",      "bank 49",      "bank 50",      "bank 51",
3435      "bank 52",      "bank 53",      "bank 54",      "bank 55",
3436      "bank 56",      "bank 57",      "bank 58",      "bank 59",
3437      "bank 60",      "bank 61",      "bank 62",      "bank 63",
3438      "bank 64",      "bank 65",      "bank 66",      "bank 67",
3439      "bank 68",      "bank 69",      "bank 70",      "bank 71",
3440      "bank 72",      "bank 73",      "bank 74",      "bank 75",
3441      "bank 76",      "bank 77",      "bank 78",      "bank 79",
3442      "bank 80",      "bank 81",      "bank 82",      "bank 83",
3443      "bank 84",      "bank 85",      "bank 86",      "bank 87",
3444      "bank 88",      "bank 89",      "bank 90",      "bank 91",
3445      "bank 92",      "bank 93",      "bank 94",      "bank 95",
3446      "bank 96",      "ram[97]",      "ram[98]",      "ram[99]",
3447      "ram[100]",      "ram[101]",      "ram[102]",      "ram[103]",
3448      "ram[104]",      "ram[105]",      "ram[106]",      "ram[107]",
3449      "ram[108]",      "ram[109]",      "ram[110]",      "ram[111]",
3450      "ram[112]",      "ram[113]",      "ram[114]",      "ram[115]",
3451      "ram[116]",      "ram[117]",      "ram[118]",      "ram[119]",
3452      "ram[120]",      "ram[121]",      "ram[122]",      "ram",
34393453      "rom",         "nop",         "unmapped",     "watchpoint"
34403454   };
34413455
r5955r5956
34433457   if (entry < STATIC_COUNT)
34443458      return strings[entry];
34453459   else
3446      return table->handlers[entry]->name ? table->handlers[entry]->name : "???";
3460      return (table->handlers[entry]->name != NULL) ? table->handlers[entry]->name : "???";
34473461}
34483462
34493463
src/emu/memory.h
r5955r5956
4040{
4141   STATIC_INVALID = 0,                           /* invalid - should never be used */
4242   STATIC_BANK1 = 1,                           /* first memory bank */
43   /* entries 1-64 are for fixed banks 1-64 specified by the driver */
44   /* entries 65-122 are for dynamically allocated internal banks */
43   /* entries 1-96 are for fixed banks 1-96 specified by the driver */
44   /* entries 97-122 are for dynamically allocated internal banks */
4545   STATIC_BANKMAX = 122,                        /* last memory bank */
4646   STATIC_RAM,                                 /* RAM - reads/writes map to dynamic banks */
4747   STATIC_ROM,                                 /* ROM - reads = RAM; writes = UNMAP */
src/emu/mame.c
r5955r5956
273273      /* if no driver, use the internal empty driver */
274274      if (driver == NULL)
275275      {
276         driver = &driver_empty;
276         driver = &GAME_NAME(empty);
277277         if (firstgame)
278278            started_empty = TRUE;
279279      }
src/emu/machine/laserdsc.h
r5955r5956
103103   MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, audio, _func)
104104
105105#define MDRV_LASERDISC_OVERLAY(_update, _width, _height, _format) \
106   MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, overupdate, video_update_##_update) \
106   MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, overupdate, VIDEO_UPDATE_NAME(_update)) \
107107   MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overwidth, _width) \
108108   MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overheight, _height) \
109109   MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overformat, _format)
src/emu/inptport.h
r5955r5956
744744    MACROS FOR BUILDING INPUT PORTS
745745***************************************************************************/
746746
747/* so that "0" can be used for unneeded input ports */
748#define ipt_0 NULL
749
750/* name of table */
751#define INPUT_PORTS_NAME(_name) ipt_##_name
752
747753/* start of table */
748754#define INPUT_PORTS_START(_name) \
749   const input_port_token ipt_##_name[] = {
755   const input_port_token INPUT_PORTS_NAME(_name)[] = {
750756
751757/* end of table */
752758#define INPUT_PORTS_END \
r5955r5956
754760
755761/* aliasing */
756762#define INPUT_PORTS_EXTERN(_name) \
757   extern const input_port_token ipt_##_name[]
763   extern const input_port_token INPUT_PORTS_NAME(_name)[]
758764
759765/* including */
760766#define PORT_INCLUDE(_name) \
761767   TOKEN_UINT32_PACK1(INPUT_TOKEN_INCLUDE, 8), \
762   TOKEN_PTR(tokenptr, &ipt_##_name[0]),
768   TOKEN_PTR(tokenptr, &INPUT_PORTS_NAME(_name)[0]),
763769
764770/* start of a new input port (with included tag) */
765771#define PORT_START(_tag) \
src/emu/sound/disc_sys.c
r5955r5956
3636 *
3737 *************************************/
3838
39static DISCRETE_START( dso_task )
39static void task_check(discrete_task *task, const discrete_task *dest_task)
4040{
41   discrete_task_context *task =  (discrete_task_context *) node->context;
4241   int inputnum;
4342   const linked_list_entry *node_entry;
4443   const linked_list_entry *step_entry;
4544
46   /* Determine, which nodes in the task are referenced in the main task
45   /* Determine, which nodes in the task are referenced by nodes in dest_task
4746     * and add them to the list of nodes to be buffered for further processing
4847     */
4948   for (node_entry = task->list; node_entry != NULL; node_entry = node_entry->next)
5049   {
51      node_description *node = (node_description *) node_entry->ptr;
52      int found = 0;
50      const node_description *task_node = (node_description *) node_entry->ptr;
5351
54      for (step_entry = node->info->step_list; step_entry != NULL; step_entry = step_entry->next)
52      for (step_entry = dest_task->list; step_entry != NULL; step_entry = step_entry->next)
5553      {
56         node_description *snode = (node_description *) step_entry->ptr;
54         node_description *dest_node = (node_description *) step_entry->ptr;
5755
5856         /* loop over all active inputs */
59         for (inputnum = 0; inputnum < snode->active_inputs; inputnum++)
57         for (inputnum = 0; inputnum < dest_node->active_inputs; inputnum++)
6058         {
61            int inputnode = snode->block->input_node[inputnum];
59            int inputnode = dest_node->block->input_node[inputnum];
6260            if IS_VALUE_A_NODE(inputnode)
6361            {
64               if (NODE_DEFAULT_NODE(node->block->node) == NODE_DEFAULT_NODE(inputnode))
62               if (NODE_DEFAULT_NODE(task_node->block->node) == NODE_DEFAULT_NODE(inputnode))
6563               {
66                  int i;
67                  found = 0;
64                  discrete_source_node *source;
65                  int i, found = -1;
66
6867                  for (i = 0; i < task->numbuffered; i++)
6968                     if (task->nodes[i]->block->node == inputnode)
70                        found = 1;
71                  if (!found)
69                     {
70                        found = i;
71                        break;
72                     }
73
74                  if (found<0)
7275                  {
7376                     if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS)
7477                        fatalerror("dso_task_start - Number of maximum buffered nodes exceeded");
7578
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);
79                     task->node_buf[task->numbuffered] = auto_alloc_array(task_node->info->device->machine, double, 2048);
80                     task->source[task->numbuffered] = (double *) dest_node->input[inputnum];
81                     task->nodes[task->numbuffered] = discrete_find_node(task_node->info, inputnode);
82                     i = task->numbuffered;
8083                     task->numbuffered++;
8184                  }
85                  discrete_log(task_node->info, "dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, task->task_group, NODE_BLOCKINDEX(dest_node), dest_task->task_group);
86
87                  /* register into source list */
88                  source = auto_alloc(dest_node->info->device->machine, discrete_source_node);
89                  linked_list_add(dest_node->info,
90                        (linked_list_entry **) (FPTR) &dest_task->source_list,
91                        source);
92                  source->task = task;
93                  source->output_node = i;
94
95                  /* point the input to a buffered location */
96                  dest_node->input[inputnum] = &source->buffer;
97
8298               }
8399            }
84100         }
r5955r5956
86102   }
87103}
88104
89static DISCRETE_STEP( dso_task )
105static DISCRETE_START( dso_task_start )
90106{
91   discrete_task_context *task =  (discrete_task_context *) node->context;
107   discrete_task *task =  (discrete_task *) node->context;
108   const linked_list_entry *task_entry;
109
110   task->task_group = (int) DISCRETE_INPUT(0);
111
112   if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS)
113      fatalerror("discrete_dso_task: illegal task_group %d", task->task_group);
114
115   for (task_entry = node->info->task_list; task_entry != NULL; task_entry = task_entry->next)
116   {
117      discrete_task *dest_task = (discrete_task *) task_entry->ptr;
118
119      if (task->task_group > dest_task->task_group)
120         task_check(dest_task, task);
121   }
122
123}
124
125static DISCRETE_STEP( dso_task_end )
126{
127   discrete_task *task =  (discrete_task *) node->context;
92128   int i;
93129
94130   for (i = 0; i < task->numbuffered; i++)
95      *(task->ptr[i]++) = **task->dest[i]; //DISCRETE_INPUT(i);
131      *(task->ptr[i]++) = *task->source[i];
96132}
97133
134static DISCRETE_STEP( dso_task_start )
135{
136   const discrete_task *task =  (discrete_task *) node->context;
137   const linked_list_entry *entry;
138
139   /* update source node buffer */
140   for (entry = task->source_list; entry != 0; entry = entry->next)
141   {
142      discrete_source_node *sn = (discrete_source_node *) entry->ptr;
143      sn->buffer = *sn->ptr++;
144   }
145}
146
147
98148static DISCRETE_RESET( dso_task )
99149{
100150   /* nothing to do - just avoid being stepped */
src/emu/sound/disc_inp.c
r5955r5956
6363   /* Read the node input value if allowed */
6464   if (node)
6565   {
66      struct dss_input_context *context = (struct dss_input_context *)node->context;
67
6866      /* Bring the system up to now */
6967      stream_update(info->discrete_stream);
7068
71      if ((node->module->type >= DSS_INPUT_DATA) && (node->module->type <= DSS_INPUT_PULSE))
72      {
73         data = context->data;
74      }
69      data = (UINT8) node->output[NODE_CHILD_NODE_NUM(offset)];
7570   }
7671   else
77      discrete_log(info, "discrete_sound_r read from non-existent NODE_%02d\n", offset-NODE_00);
72      fatalerror("discrete_sound_r read from non-existent NODE_%02d\n", offset-NODE_00);
7873
7974    return data;
8075}
src/emu/sound/disc_mth.c
r5955r5956
109109   double   countdown;
110110   int      state;
111111   int      last_trig;
112   int      type;
112113};
113114
114115struct dss_ramp_context
r5955r5956
272273 *
273274 * DST_CLAMP - Simple signal clamping circuit
274275 *
275 * input[0]    - Enable ramp
276 * input[1]    - Input value
277 * input[2]    - Minimum value
278 * input[3]    - Maximum value
279 * input[4]    - Clamp output when disabled
276 * input[0]    - Input value
277 * input[1]    - Minimum value
278 * input[2]    - Maximum value
280279 *
281280 ************************************************************************/
282#define DST_CLAMP__ENABLE   DISCRETE_INPUT(0)
283#define DST_CLAMP__IN      DISCRETE_INPUT(1)
284#define DST_CLAMP__MIN      DISCRETE_INPUT(2)
285#define DST_CLAMP__MAX      DISCRETE_INPUT(3)
286#define DST_CLAMP__CLAMP   DISCRETE_INPUT(4)
281#define DST_CLAMP__IN      DISCRETE_INPUT(0)
282#define DST_CLAMP__MIN      DISCRETE_INPUT(1)
283#define DST_CLAMP__MAX      DISCRETE_INPUT(2)
287284
288285static DISCRETE_STEP(dst_clamp)
289286{
290   if(DST_CLAMP__ENABLE)
291   {
292      if (DST_CLAMP__IN < DST_CLAMP__MIN) node->output[0] = DST_CLAMP__MIN;
293      else if (DST_CLAMP__IN > DST_CLAMP__MAX) node->output[0] = DST_CLAMP__MAX;
294      else node->output[0]= DST_CLAMP__IN;
295   }
296   else
297   {
298      node->output[0] = DST_CLAMP__CLAMP;
299   }
287   if (DST_CLAMP__IN < DST_CLAMP__MIN) node->output[0] = DST_CLAMP__MIN;
288   else if (DST_CLAMP__IN > DST_CLAMP__MAX) node->output[0] = DST_CLAMP__MAX;
289   else node->output[0]= DST_CLAMP__IN;
300290}
301291
302292
r5955r5956
11671157         bit_mask = bit_mask << 1;
11681158         }
11691159      }
1170      else
1160      else if (c_bit_flag != 0)
11711161      {
11721162         /* no r_nodes, so just do high pass filtering */
11731163         for (bit = 0; bit < context->size; bit++)
r5955r5956
11831173            i += ((type == DISC_MIXER_IS_OP_AMP) ? v_ref - vTemp : vTemp) / info->r[bit];
11841174         }
11851175      }
1176      else
1177      {
1178         /* no r_nodes or c_nodes, mixing only */
1179         if (type == DISC_MIXER_IS_OP_AMP)
1180         {
1181            for (bit = 0; bit < context->size; bit++)
1182               i += ( v_ref - DST_MIXER__IN(bit) ) / info->r[bit];
1183         }
1184         else
1185         {
1186            for (bit = 0; bit < context->size; bit++)
1187               i += DST_MIXER__IN(bit) / info->r[bit];
1188         }
1189      }
11861190
11871191      if (type == DISC_MIXER_IS_OP_AMP_WITH_RI)
11881192         i += v_ref / rI;
r5955r5956
12221226   }
12231227}
12241228
1229
12251230static DISCRETE_RESET(dst_mixer)
12261231{
12271232   const  discrete_mixer_desc *info    = (const  discrete_mixer_desc *)node->custom;
r5955r5956
13661371{
13671372   struct dst_size_context *context = (struct dst_size_context *)node->context;
13681373
1369   context->size = node->active_inputs - 2;
1374   context->size = node->active_inputs - 1;
13701375
13711376   DISCRETE_STEP_CALL(dst_multiplex);
13721377}
r5955r5956
14141419         context->last_trig = trigger;
14151420
14161421         /* Is it the proper edge trigger */
1417         if ((DST_ONESHOT__TYPE & DISC_ONESHOT_REDGE) ? trigger : !trigger)
1422         if ((context->type & DISC_ONESHOT_REDGE) ? trigger : !trigger)
14181423         {
14191424            if (!context->state)
14201425            {
14211426               /* We have first trigger */
14221427               context->state     = 1;
1423               node->output[0]    = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? 0 : DST_ONESHOT__AMP;
1428               node->output[0]    = (context->type & DISC_OUT_ACTIVE_LOW) ? 0 : DST_ONESHOT__AMP;
14241429               context->countdown = DST_ONESHOT__WIDTH;
14251430            }
14261431            else
14271432            {
14281433               /* See if we retrigger */
1429               if (DST_ONESHOT__TYPE & DISC_ONESHOT_RETRIG)
1434               if (context->type & DISC_ONESHOT_RETRIG)
14301435               {
14311436                  /* Retrigger */
14321437                  context->countdown = DST_ONESHOT__WIDTH;
r5955r5956
14411446         context->countdown -= node->info->sample_time;
14421447         if(context->countdown <= 0.0)
14431448         {
1444            node->output[0]    = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0;
1449            node->output[0]    = (context->type & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0;
14451450            context->countdown = 0;
14461451            context->state     = 0;
14471452         }
r5955r5956
14581463   context->state     = 0;
14591464
14601465    context->last_trig = 0;
1461    node->output[0] = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0;
1466    context->type = DST_ONESHOT__TYPE;
1467
1468    node->output[0] = (context->type & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0;
14621469}
14631470
14641471
src/emu/sound/discrete.c
r5955r5956
6767typedef struct _task_info task_info;
6868struct _task_info
6969{
70   discrete_task_context *context;
70   discrete_task *task;
7171   int samples;
7272};
7373
r5955r5956
7878 *
7979 *************************************/
8080
81static void init_nodes(discrete_info *info, linked_list_entry *block_list, const device_config *device);
82static void find_input_nodes(discrete_info *info);
83static node_description *discrete_find_node(const discrete_info *info, int node);
81static void init_nodes(discrete_info *info, const linked_list_entry *block_list, const device_config *device);
82static void find_input_nodes(const discrete_info *info);
83static node_description *discrete_find_node(const discrete_info *info, const int node);
8484static DEVICE_RESET( discrete );
8585static STREAM_UPDATE( discrete_stream_update );
8686static STREAM_UPDATE( buffer_stream_update );
r5955r5956
103103      {
104104         vfprintf(disc_info->disclogfile, text, arg);
105105         fprintf(disc_info->disclogfile, "\n");
106         fflush(disc_info->disclogfile);
106107      }
107108
108109      va_end(arg);
r5955r5956
132133   return -1;
133134}
134135
135INLINE void linked_list_add(const discrete_info *info, linked_list_entry ***list_tail_ptr, const void *ptr)
136INLINE void linked_list_tail_add(const discrete_info *info, linked_list_entry ***list_tail_ptr, const void *ptr)
136137{
137138   **list_tail_ptr = auto_alloc(info->device->machine, linked_list_entry);
138139   (**list_tail_ptr)->ptr = ptr;
r5955r5956
150151
151152   return cnt;
152153}
154
155INLINE void linked_list_add(const discrete_info *info, linked_list_entry **list, const void *ptr)
156{
157   linked_list_entry *entry;
158
159   if (*list == NULL)
160   {
161      *list = auto_alloc(info->device->machine, linked_list_entry);
162      (*list)->ptr = ptr;
163      (*list)->next = NULL;
164   }
165   else
166   {
167      for (entry = *list; entry != NULL && entry->next != NULL; entry = entry->next)
168         ;
169      entry->next = auto_alloc(info->device->machine, linked_list_entry);
170      entry->next->ptr = ptr;
171      entry->next->next = NULL;
172   }
173}
174
153175/*************************************
154176 *
155177 *  Included simulation objects
r5955r5956
179201   { DSO_IMPORT      ,"DSO_IMPORT"      , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
180202
181203   /* parallel modules */
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                 },
204   { DSO_TASK_START  ,"DSO_TASK_START"  , 0 ,0                                      ,dso_task_reset        ,dso_task_start_step  ,dso_task_start_start  ,NULL                 },
205   { DSO_TASK_END    ,"DSO_TASK_END"    , 0 ,0                                      ,dso_task_reset        ,dso_task_end_step    ,NULL                  ,NULL                 },
184206   { DSO_TASK_SYNC   ,"DSO_TASK_SYNC"   , 0 ,0                                      ,NULL                  ,NULL                 ,NULL                  ,NULL                 },
185207
186208   /* nop */
r5955r5956
395417      else
396418      {
397419         discrete_log(info, "discrete_build_list() - adding node %d (*current %p)\n", node_count, *current);
398         linked_list_add(info, current, &intf[node_count]);
420         linked_list_tail_add(info, current, &intf[node_count]);
399421      }
400422
401423      node_count++;
r5955r5956
410432
411433static void discrete_sanity_check(const discrete_info *info)
412434{
413   linked_list_entry *entry;
435   const linked_list_entry *entry;
414436   int node_count = 0;
415437
416438   discrete_log(info, "discrete_start() - Doing node list sanity check");
r5955r5956
449471static DEVICE_START( discrete )
450472{
451473   linked_list_entry **intf;
452   linked_list_entry *entry;
453   discrete_sound_block *intf_start = (discrete_sound_block *)device->static_config;
474   const linked_list_entry *entry;
475   const discrete_sound_block *intf_start = (discrete_sound_block *)device->static_config;
454476   discrete_info *info = get_safe_token(device);
455477   char name[32];
456478
r5955r5956
482504
483505   /* Start with empty lists */
484506   info->node_list = NULL;
485   info->step_list = NULL;
486507   info->output_list = NULL;
487508   info->input_list = NULL;
488509
r5955r5956
562583   /* Task information */
563584   for (entry = info->task_list; entry != 0; entry = entry->next)
564585   {
565      discrete_task_context *task = (discrete_task_context *) entry->ptr;
586      discrete_task *task = (discrete_task *) entry->ptr;
566587      tt =  list_run_time(task->list);
567588
568      printf("Task: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples);
589      printf("Task(%d): %8.2f %15.2f\n", task->task_group, tt / (double) total * 100.0, tt / (double) info->total_samples);
569590   }
570   tt =  list_run_time(info->step_list);
571591
572   printf("Main: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples);
573
574592   printf("Average samples/stream_update: %8.2f\n", (double) info->total_samples / (double) info->total_stream_updates);
575593}
576594
577595static DEVICE_STOP( discrete )
578596{
579597   discrete_info *info = get_safe_token(device);
580   linked_list_entry *entry;
598   const linked_list_entry *entry;
581599
582600   osd_work_queue_free(info->queue);
583601
r5955r5956
615633
616634static DEVICE_RESET( discrete )
617635{
618   discrete_info *info = get_safe_token(device);
619   linked_list_entry *entry;
636   const discrete_info *info = get_safe_token(device);
637   const linked_list_entry *entry;
620638
621639   /* loop over all nodes */
622640   for (entry = info->node_list; entry != 0; entry = entry->next)
r5955r5956
643661
644662static void *task_callback(void *param, int threadid)
645663{
646   task_info *ti = (task_info *) param;
664   const task_info *ti = (task_info *) param;
665   const linked_list_entry *entry;
666   discrete_task *task = ti->task;
647667   int samples, i;
648668
649669   /* set up task buffers */
650   for (i = 0; i < ti->context->numbuffered; i++)
651      ti->context->ptr[i] = &ti->context->node_buf[i][0];
670   for (i = 0; i < task->numbuffered; i++)
671      task->ptr[i] = task->node_buf[i];
652672
673   /* initialize sources */
674   for (entry = task->source_list; entry != 0; entry = entry->next)
675   {
676      discrete_source_node *sn = (discrete_source_node *) entry->ptr;
677      sn->ptr = sn->task->node_buf[sn->output_node];
678   }
679
653680   samples = ti->samples;
654681   while (samples-- > 0)
655682   {
656      step_nodes_in_list(ti->context->list);
683      /* step */
684      step_nodes_in_list(task->list);
657685   }
658   /* reset ptr */
659   for (i = 0; i < ti->context->numbuffered; i++)
660      ti->context->ptr[i] = &ti->context->node_buf[i][0];
661686
662687   free(param);
663688   return NULL;
664689}
665690
666INLINE void discrete_stream_update_nodes(discrete_info *info)
667{
668   linked_list_entry *entry;
669691
670   if (DISCRETE_PROFILING)
671      info->total_samples++;
672
673   /* update task nodes */
674   for (entry = info->task_list; entry != 0; entry = entry->next)
675   {
676      discrete_task_context *task = (discrete_task_context *) entry->ptr;
677      int i;
678
679      for (i = task->numbuffered - 1; i >= 0 ; i--)
680         **task->dest[i] = *task->ptr[i]++;
681   }
682
683   /* loop over all nodes */
684   step_nodes_in_list(info->step_list);
685}
686
687692static STREAM_UPDATE( buffer_stream_update )
688693{
689   node_description *node = (node_description *) param;
690   struct dss_input_context *context = (struct dss_input_context *)node->context;
694   const node_description *node = (node_description *) param;
695   const struct dss_input_context *context = (struct dss_input_context *)node->context;
691696   stream_sample_t *ptr = outputs[0];
692697   int data = context->data;
693698   int samplenum = samples;
r5955r5956
700705static STREAM_UPDATE( discrete_stream_update )
701706{
702707   discrete_info *info = (discrete_info *)param;
703   linked_list_entry *entry;
704   int samplenum, outputnum;
708   const linked_list_entry *entry;
709   int outputnum, task_group;
705710
706711   if (samples == 0)
707712      return;
r5955r5956
719724      context->ptr = (stream_sample_t *) inputs[context->stream_in_number];
720725   }
721726
722   /* Queue tasks */
723   for (entry = info->task_list; entry != 0; entry = entry->next)
727   for (task_group = 0; task_group < DISCRETE_MAX_TASK_GROUPS; task_group++)
724728   {
725      task_info *ti = (task_info *)malloc(sizeof(task_info));
726      discrete_task_context *task = (discrete_task_context *) entry->ptr;
729      /* Queue tasks */
730      for (entry = info->task_list; entry != 0; entry = entry->next)
731      {
732         discrete_task *task = (discrete_task *) entry->ptr;
727733
728      /* Fire task */
729      ti->context = task;
730      ti->samples = samples;
731      osd_work_item_queue(info->queue, task_callback, (void *) ti, WORK_ITEM_FLAG_AUTO_RELEASE);
734         if (task->task_group == task_group)
735         {
736            task_info *ti = (task_info *)malloc(sizeof(task_info));
737
738            /* Fire task */
739            ti->task = task;
740            ti->samples = samples;
741            osd_work_item_queue(info->queue, task_callback, (void *) ti, WORK_ITEM_FLAG_AUTO_RELEASE);
742         }
743      }
744      /* and wait for them */
745      osd_work_queue_wait(info->queue, osd_ticks_per_second()*10);
732746   }
733747
734   /* and wait for them */
735   osd_work_queue_wait(info->queue, osd_ticks_per_second()*10);
736
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);
740
741748   if (DISCRETE_PROFILING)
749   {
750      info->total_samples += samples;
742751      info->total_stream_updates++;
752   }
743753
744754}
745755
r5955r5956
752762 *************************************/
753763
754764
755static void init_nodes(discrete_info *info, linked_list_entry *block_list, const device_config *device)
765static void init_nodes(discrete_info *info, const linked_list_entry *block_list, const device_config *device)
756766{
757   linked_list_entry   **task_node_list_ptr = NULL;
758   linked_list_entry   *entry;
767   const linked_list_entry   *entry;
759768   linked_list_entry   *task_node_list = NULL;
760   discrete_task_context *task = NULL;
769   discrete_task *task = NULL;
761770   /* list tail pointers */
762   linked_list_entry   **step_list_ptr = &info->step_list;
771   linked_list_entry   **task_node_list_ptr = NULL;
763772   linked_list_entry   **node_list_ptr = &info->node_list;
764773   linked_list_entry   **task_list_ptr = &info->task_list;
765774   linked_list_entry   **output_list_ptr = &info->output_list;
766775   linked_list_entry   **input_list_ptr = &info->input_list;
776   int               has_tasks = 0;
767777
778   /* check whether we have tasks ... */
779   for (entry = block_list; entry != NULL; entry = entry->next)
780   {
781      const discrete_sound_block *block = (discrete_sound_block *) entry->ptr;
782      if (block->type == DSO_TASK_START)
783         has_tasks = 1;
784   }
785
786   if (!has_tasks)
787   {
788      /* set up a main task */
789      task_node_list = NULL;
790      task_node_list_ptr = &task_node_list;
791   }
792
768793   /* loop over all nodes */
769794   for (entry = block_list; entry != NULL; entry = entry->next)
770795   {
771      discrete_sound_block *block = (discrete_sound_block *) entry->ptr;
796      const discrete_sound_block *block = (discrete_sound_block *) entry->ptr;
772797      node_description *node = auto_alloc_clear(info->device->machine, node_description);
773798      int modulenum;
774799
r5955r5956
808833         {
809834            /* Output Node */
810835            case DSO_OUTPUT:
811               linked_list_add(info, &output_list_ptr, node);
836               linked_list_tail_add(info, &output_list_ptr, node);
812837               break;
813838
814839            /* CSVlog Node for debugging */
r5955r5956
823848            case DSO_TASK_START:
824849               if (task_node_list_ptr != NULL)
825850                  fatalerror("init_nodes() - Nested DISCRETE_START_TASK.");
851               task = auto_alloc_clear(info->device->machine, discrete_task);
852               node->context = task;
826853               task_node_list = NULL;
827854               task_node_list_ptr = &task_node_list;
828855               break;
r5955r5956
830857            case DSO_TASK_END:
831858               if (task_node_list_ptr == NULL)
832859                  fatalerror("init_nodes() - NO DISCRETE_START_TASK.");
833               task = auto_alloc_clear(info->device->machine, discrete_task_context);
834860               task->numbuffered = 0;
835861               task->list = task_node_list;
836               linked_list_add(info, &task_list_ptr, task);
862               task->task_group = -1; /* will be set later */
863               task->source_list = NULL;
864               linked_list_tail_add(info, &task_list_ptr, task);
837865               node->context = task;
838866               task = NULL;
839867               task_node_list = NULL;
r5955r5956
855883      /* if we are an stream input node, track that */
856884      if (block->type == DSS_INPUT_STREAM)
857885      {
858         linked_list_add(info, &input_list_ptr, node);
886         linked_list_tail_add(info, &input_list_ptr, node);
859887      }
860888      else if (block->type == DSS_INPUT_BUFFER)
861889      {
862         linked_list_add(info, &input_list_ptr, node);
890         linked_list_tail_add(info, &input_list_ptr, node);
863891      }
864892
865893      /* add to node list */
866      linked_list_add(info, &node_list_ptr, node);
894      linked_list_tail_add(info, &node_list_ptr, node);
867895
868896      /* our running order just follows the order specified */
869897      /* does the node step ? */
r5955r5956
871899      {
872900         /* do we belong to a task? */
873901         if (task_node_list_ptr == NULL)
874            linked_list_add(info, &step_list_ptr, node);
902            fatalerror("init_nodes() - found node outside of task.");
875903         else
876            linked_list_add(info, &task_node_list_ptr, node);
904            linked_list_tail_add(info, &task_node_list_ptr, node);
877905      }
878906
879907      if (block->type == DSO_TASK_END)
r5955r5956
886914         state_save_register_device_item_array(device, node->block->node, node->output);
887915   }
888916
917   if (!has_tasks)
918   {
919      /* make sure we have one simple task
920         * No need to create a node since there are no dependencies.
921         */
922      task = auto_alloc_clear(info->device->machine, discrete_task);
923      task->numbuffered = 0;
924      task->list = task_node_list;
925      task->task_group = 0;
926      task->source_list = NULL;
927      linked_list_tail_add(info, &task_list_ptr, task);
928   }
929
889930   /* if no outputs, give an error */
890931   if (linked_list_count(info->output_list) == 0)
891932      fatalerror("init_nodes() - Couldn't find an output node");
r5955r5956
898939 *
899940 *************************************/
900941
901static void find_input_nodes(discrete_info *info)
942static void find_input_nodes(const discrete_info *info)
902943{
944   const linked_list_entry *entry;
903945   int inputnum;
904   linked_list_entry *entry;
905946
906947   /* loop over all nodes */
907948   for (entry = info->node_list; entry != NULL; entry = entry->next)
r5955r5956
917958         /* if this input is node-based, find the node in the indexed list */
918959         if IS_VALUE_A_NODE(inputnode)
919960         {
920            node_description *node_ref = info->indexed_node[NODE_INDEX(inputnode)];
961            const node_description *node_ref = info->indexed_node[NODE_INDEX(inputnode)];
921962            if (!node_ref)
922963               fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", NODE_BLOCKINDEX(node), NODE_INDEX(inputnode));
923964
r5955r5956
944985      }
945986      for (inputnum = node->active_inputs; inputnum < DISCRETE_MAX_INPUTS; inputnum++)
946987      {
947         //FIXME: Check that no nodes follow !
988         /* FIXME: Check that no nodes follow ! */
948989         node->input[inputnum] = &(block->initial[inputnum]);
949990      }
950991   }
src/emu/sound/discrete.h
r5955r5956
1616 *  Coding started in November 2000
1717 *
1818 *  Additions/bugfix February 2003 - D.Renaud, F.Palazzolo, K.Wilkins
19 *  Discrete parallel tasks 2009 - Couriersud
1920 *
2021 ***********************************************************************
2122 *
r5955r5956
9596 *      DISCRETE_INPUT_LOGIC(NODE_01)
9697 *      DISCRETE_SQUAREWFIX(NODE_11, 1, 0.5, 1, 50, 1.0/2, 0)   // Output 0:1
9798 *      DISCRETE_SINEWAVE(NODE_12, NODE_11, 2000, 10000, 0, 0)
98 *      DISCRETE_LOGIC_INVERT(NODE_13, 1, NODE_11)
99 *      DISCRETE_LOGIC_INVERT(NODE_13, NODE_11)
99100 *      DISCRETE_SINEWAVE(NODE_14, NODE_13, 4000, 10000, 0, 0)
100101 *      DISCRETE_ADDER2(NODE_20, NODE_01, NODE_12, NODE_14)
101102 *      DISCRETE_OUTPUT(NODE_20, 1)
r5955r5956
303304 * DISCRETE_555_CC(NODE,RESET,VIN,R,C,RBIAS,RGND,RDIS,OPTIONS)
304305 * DISCRETE_555_VCO1(NODE,RESET,VIN,OPTIONS)
305306 * DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS)
306 * DISCRETE_566(NODE,VMOD,R,C,OPTIONS)
307 * DISCRETE_566(NODE,VMOD,R,C,VPOS,VNEG,VCHARGE,OPTIONS)
307308 * DISCRETE_74LS624(NODE,VMOD,VRNG,C,OUTTYPE)
308309 *
309310 * DISCRETE_CUSTOM1(NODE,IN0,INFO)
r5955r5956
811812 *     discrete_op_amp_osc_info = {type, r1, r2, r3, r4, r5, r6, r7, r8, c, vP}
812813 *
813814 * Note: Set all unused components to 0.
815 *       _OUT_SQW can also be replaced with
816 *                _OUT_ENERGY, _OUT_LOGIC_X, _OUT_COUNT_F_X, _OUT_COUNT_R_X
814817 *
815818 *  Types:
816819 *
r5955r5956
840843 *
841844 * EXAMPLES: see Polaris, Amazing Maze
842845 *
846 *          --------------------------------------------------
847 *
848 *     DISC_OP_AMP_OSCILLATOR_2 | DISC_OP_AMP_IS_NORTON
849 *          Basic Norton Op Amp Oscillator circuit.
850 *
851 *       .-------------------------------------------> DISC_OP_AMP_OSCILLATOR_OUT_CAP
852 *       |
853 *       |       r1
854 *       +------ZZZZ-----.
855 *       |               |
856 *       |         |\    |
857 *       |    r2   | \   |
858 *       +---ZZZZ--|- \  |
859 *       |         |   >-+-------> DISC_OP_AMP_OSCILLATOR_OUT_SQW
860 *      --- c      |+ /  |
861 *      ---    .---| /   |
862 *       |     |   |/    |
863 *      gnd    |         |
864 *             |   r3    |
865 *             +--ZZZZ---'
866 *             |
867 *             Z
868 *             Z r4
869 *             Z
870 *             |
871 *             ^
872 *             vP
873 *
874 * Note: All values are static.
875 *
876 * EXAMPLES: see Space Walk
877 *
843878 ***********************************************************************
844879 *
845880 * DISCRETE_OP_AMP_VCOn - Various single power supply op-amp VCO circuits
r5955r5956
856891 *     discrete_op_amp_osc_info = {type, r1, r2, r3, r4, r5, r6, r7, r8, c, vP}
857892 *
858893 * Note: Set all unused components to 0.
894 *       _OUT_SQW can also be replaced with
895 *                _OUT_ENERGY, _OUT_LOGIC_X, _OUT_COUNT_F_X, _OUT_COUNT_R_X
859896 *
860897 *  Types:
861898 *
r5955r5956
11931230 *
11941231 *                        .------------.
11951232 *                        |            |
1196 *    ENAB       -0------>|            |
1233 *    INP0       -0------>|            |
11971234 *                        |            |
1198 *    INP0       -1------>|           |
1235 *    MIN        -1------>|   CLAMP    |---->   Netlist node
11991236 *                        |            |
1200 *    MIN        -2------>|   CLAMP    |---->   Netlist node
1237 *    MAX        -2------>|           |
12011238 *                        |            |
1202 *    MAX        -3------>|            |
1203 *                        |            |
1204 *    CLAMP      -4------>|            |
1205 *                        |            |
12061239 *                        '------------'
12071240 *
12081241 *  Declaration syntax
12091242 *
12101243 *        DISCRETE_CLAMP(name of node,
1211 *                       enable,
12121244 *                       input node,
12131245 *                       minimum node or static value,
1214 *                       maximum node or static value,
1215 *                       clamp node or static value when disabled)
1246 *                       maximum node or static value),
12161247 *
12171248 *  Example config line
12181249 *
1219 *     DISCRETE_CLAMP(NODE_9,NODE_10,NODE_11,2.0,10.0,5.0)
1250 *     DISCRETE_CLAMP(NODE_9,NODE_10,2.0,10.0)
12201251 *
1221 *  Node10 when not zero will allow clamp to operate forcing the value
1222 *  on the node output, to be within the MIN/MAX boundard. When enable
1223 *  is set to zero the node will output the clamp value
1252 *  Force the value on the node output, to be within the MIN/MAX
1253 *  boundary.  In this example the output is clamped to the range
1254 *  of 2.0 to 10.0 inclusive.
12241255 *
1256 * EXAMPLES: Sprint 8
1257 *
12251258 ***********************************************************************
12261259 *
12271260 * DISCRETE_DIVIDE     - Node division function
r5955r5956
28932926 *        options,        - bit mapped options
28942927 *        v_pos,          - B+ voltage of 555
28952928 *        v_charge,       - voltage (or node) to charge circuit  (Defaults to v_pos)
2896 *        v_out_high,     - High output voltage of 555 (Defaults to v_pos - 1.2V)
2929 *        v_out_high     - High output voltage of 555 (Defaults to v_pos - 1.2V)
28972930 *    }
28982931 *
28992932 * The last 2 options of discrete_555_desc can use the following defaults:
r5955r5956
29933026 *     DISC_555_TRIGGER_IS_VOLTAGE - Input is actual voltage.
29943027 *                                   Voltage must drop below
29953028 *                                   trigger to activate.
3029 *     DISC_555_TRIGGER_IS_COUNT   - 1 when trigger, allows passing of x_time.
3030 *                                   Mainly connected with other module using
3031 *                                   a xxx_COUNT_F_X type.
29963032 *     DISC_555_TRIGGER_DISCHARGES_CAP - some circuits connect an external
29973033 *                                       device (transistor) to the cap to
29983034 *                                       discharge it when the trigger is
r5955r5956
30063042 *  Waveform Types: (ORed with trigger types)
30073043 *     DISC_555_OUT_SQW     - Output is Squarewave.  0 or v_out_high. (DEFAULT)
30083044 *     DISC_555_OUT_CAP     - Output is Timing Capacitor 'C' voltage.
3045 *     DISC_555_OUT_ENERGY  - see DISCRETE_555_MSTABLE.
30093046 *
3010 * EXAMPLES: see Frogs
3047 * EXAMPLES: see Frogs, Sprint 8
30113048 *
30123049 ***********************************************************************
30133050 *
r5955r5956
31793216 *                  vMod node or static value,
31803217 *                  R node or static value in ohms,
31813218 *                  C node or static value in Farads,
3182 *                  address of discrete_566_desc structure)
3219 *                  v_pos static value
3220 *                  v_neg static value
3221 *                  v_charge node or static value
3222 *                  options)
31833223 *
3184 *     discrete_566_desc = {options, v_pos, v_neg, v_charge}
3185 *       Note: v_charge can be static value, a node
3186 *             or use DEFAULT_566_CHARGE to connect to v_pos
3187 *
31883224 *  Output Types:
31893225 *     DISC_566_OUT_DC - Output is actual DC. (DEFAULT)
31903226 *     DISC_566_OUT_AC - A cheat to make the waveform AC.
r5955r5956
31933229 *     DISC_566_OUT_SQUARE   - Pin 3 Square Wave Output (DEFAULT)
31943230 *     DISC_566_OUT_TRIANGLE - Pin 4 Triangle Wave Output
31953231 *     DISC_566_OUT_LOGIC    - Internal Flip/Flop Output
3232 *     DISC_566_COUNT_F      - # of falling edges
3233 *     DISC_566_COUNT_R      - # of rising edges
3234 *     DISC_566_COUNT_F_X    - # of falling edges with x-time
3235 *     DISC_566_COUNT_R_X    - # of rising edges with x-time
31963236 *
31973237 * EXAMPLES: see Starship 1
31983238 *
r5955r5956
34073447#define DISCRETE_MAX_INPUTS               10
34083448#define DISCRETE_MAX_OUTPUTS             8
34093449#define DISCRETE_MAX_TASK_OUTPUTS         8
3450#define DISCRETE_MAX_TASK_GROUPS         8
34103451
34113452
34123453/*************************************
r5955r5956
34873528/* Mixer types */
34883529#define DISC_MIXER_IS_RESISTOR            0
34893530#define DISC_MIXER_IS_OP_AMP            1
3490#define DISC_MIXER_IS_OP_AMP_WITH_RI       2   // Used only internally.  Use DISC_MIXER_IS_OP_AMP
3531#define DISC_MIXER_IS_OP_AMP_WITH_RI       2   /* Used only internally.  Use DISC_MIXER_IS_OP_AMP */
34913532
34923533/* Triggered Op Amp Functions */
34933534enum
r5955r5956
35053546
35063547
35073548/* Common Op Amp Flags and values */
3508#define DISC_OP_AMP_IS_NORTON            0x01
3549#define DISC_OP_AMP_IS_NORTON            0x100
35093550#define OP_AMP_NORTON_VBE               0.5      // This is the norton junction voltage. Used only internally.
35103551#define OP_AMP_VP_RAIL_OFFSET            1.5      // This is how close an op-amp can get to the vP rail. Used only internally.
35113552
r5955r5956
35333574
35343575
35353576/* Op Amp Oscillator Flags */
3577#define DISC_OP_AMP_OSCILLATOR_TYPE_MASK   (0xf0 | DISC_OP_AMP_IS_NORTON)   // Used only internally.
35363578#define DISC_OP_AMP_OSCILLATOR_1         0x00
3537#define DISC_OP_AMP_OSCILLATOR_VCO_1      0x80
3538#define DISC_OP_AMP_OSCILLATOR_VCO_2      0x90
3539#define DISC_OP_AMP_OSCILLATOR_VCO_3      0xa0
3540#define DISC_OP_AMP_OSCILLATOR_OUT_CAP      0x00
3541#define DISC_OP_AMP_OSCILLATOR_OUT_SQW      0x02
3579#define DISC_OP_AMP_OSCILLATOR_2         0x10
3580#define DISC_OP_AMP_OSCILLATOR_VCO_1      0x20
3581#define DISC_OP_AMP_OSCILLATOR_VCO_2      0x30
3582#define DISC_OP_AMP_OSCILLATOR_VCO_3      0x40
35423583
3543#define DISC_OP_AMP_OSCILLATOR_TYPE_MASK   (0xf0 | DISC_OP_AMP_IS_NORTON)   // Used only internally.
3584#define DISC_OP_AMP_OSCILLATOR_OUT_MASK         0x07
3585#define DISC_OP_AMP_OSCILLATOR_OUT_CAP         0x00
3586#define DISC_OP_AMP_OSCILLATOR_OUT_SQW         0x01
3587#define DISC_OP_AMP_OSCILLATOR_OUT_ENERGY      0x02
3588#define DISC_OP_AMP_OSCILLATOR_OUT_LOGIC_X      0x03
3589#define DISC_OP_AMP_OSCILLATOR_OUT_COUNT_F_X   0x04
3590#define DISC_OP_AMP_OSCILLATOR_OUT_COUNT_R_X   0x05
35443591
35453592/* Schmitt Oscillator Options */
35463593#define DISC_SCHMITT_OSC_IN_IS_LOGIC      0x00
r5955r5956
35593606#define DISC_555_OUT_AC                  0x10
35603607
35613608#define DISC_555_TRIGGER_IS_LOGIC         0x00
3562#define DISC_555_TRIGGER_IS_VOLTAGE         0x40
3609#define DISC_555_TRIGGER_IS_VOLTAGE         0x20
3610#define DISC_555_TRIGGER_IS_COUNT         0x40
3611#define DSD_555_TRIGGER_TYPE_MASK         0x60
35633612#define DISC_555_TRIGGER_DISCHARGES_CAP      0x80
35643613
35653614#define DISC_555_OUT_SQW               0x00   /* Squarewave */
r5955r5956
35853634#define DISC_566_OUT_SQUARE               0x00   /* Squarewave */
35863635#define DISC_566_OUT_TRIANGLE            0x10   /* Triangle waveform */
35873636#define DISC_566_OUT_LOGIC               0x20   /* 0/1 logic output */
3588
3589#define DISC_566_OUT_MASK               0x30   /* Bits that define output type.
3637#define DISC_566_OUT_COUNT_F            0x30
3638#define DISC_566_OUT_COUNT_R            0x40
3639#define DISC_566_OUT_COUNT_F_X            0x50
3640#define DISC_566_OUT_COUNT_R_X            0x60
3641#define DISC_566_OUT_MASK               0x70   /* Bits that define output type.
35903642                                                     * Used only internally in module. */
3591#define DEFAULT_566_CHARGE   -1
35923643
35933644/* LS624 output flags */
35943645#define DISC_LS624_OUT_ENERGY            0x01
r5955r5956
36983749   linked_list_entry    *next;
36993750};
37003751
3701typedef struct _discrete_task_context discrete_task_context;
3702struct _discrete_task_context
3752typedef struct _discrete_task discrete_task;
3753struct _discrete_task
37033754{
37043755   const linked_list_entry *list;
37053756
3757   int               task_group;
37063758   int             numbuffered;
37073759   double             *ptr[DISCRETE_MAX_TASK_OUTPUTS];
37083760   double             *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
37093761   node_description   *nodes[DISCRETE_MAX_TASK_OUTPUTS];
3710   double             **dest[DISCRETE_MAX_TASK_OUTPUTS];
3762   double             *source[DISCRETE_MAX_TASK_OUTPUTS];
37113763
3764   /* list of source nodes */
3765   linked_list_entry   *source_list;      /* discrete_source_node */
37123766};
37133767
3768typedef struct _discrete_source_node discrete_source_node;
3769struct _discrete_source_node
3770{
3771   const discrete_task   *task;
3772   int               output_node;
3773   double            buffer;
3774   double            *ptr;
3775};
3776
37143777struct _discrete_info
37153778{
37163779   const device_config *device;
r5955r5956
37263789   /* list of all nodes */
37273790   linked_list_entry    *node_list;      /* node_description * */
37283791
3729   /* list of nodes which step */
3730   linked_list_entry    *step_list;      /* node_description * */
3731
37323792   /* list of discrete blocks after prescan (IMPORT, DELETE, REPLACE) */
37333793   linked_list_entry    *block_list;      /* discrete_sound_block * */
37343794
r5955r5956
37873847typedef struct _discrete_op_amp_osc_info discrete_op_amp_osc_info;
37883848struct _discrete_op_amp_osc_info
37893849{
3790   int      type;
3850   UINT32   type;
37913851   double   r1;
37923852   double   r2;
37933853   double   r3;
r5955r5956
38433903typedef struct _discrete_integrate_info discrete_integrate_info;
38443904struct _discrete_integrate_info
38453905{
3846   int      type;
3906   UINT32   type;
38473907   double   r1;      // r1a + r1b
38483908   double   r2;      // r2a + r2b
38493909   double   r3;      // r3a + r3b
r5955r5956
38763936typedef struct _discrete_op_amp_info discrete_op_amp_info;
38773937struct _discrete_op_amp_info
38783938{
3879   int      type;
3939   UINT32   type;
38803940   double   r1;
38813941   double   r2;
38823942   double   r3;
r5955r5956
38903950typedef struct _discrete_op_amp_1sht_info discrete_op_amp_1sht_info;
38913951struct _discrete_op_amp_1sht_info
38923952{
3893   int      type;
3953   UINT32   type;
38943954   double   r1;
38953955   double   r2;
38963956   double   r3;
r5955r5956
39874047};
39884048
39894049
3990typedef struct _discrete_566_desc discrete_566_desc;
3991struct _discrete_566_desc
3992{
3993   int      options;   // bit mapped options
3994   double   v_pos;      // B+ voltage of 566
3995   double   v_neg;      // B- voltage of 566
3996   double   v_charge;
3997};
3998
3999
40004050typedef struct _discrete_adsr discrete_adsr;
40014051struct _discrete_adsr
40024052{
r5955r5956
43184368#define DISCRETE_ADDER2(NODE,ENAB,INP0,INP1)                            { NODE, DST_ADDER       , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_ADDER2" },
43194369#define DISCRETE_ADDER3(NODE,ENAB,INP0,INP1,INP2)                       { NODE, DST_ADDER       , 4, { ENAB,INP0,INP1,INP2 }, { ENAB,INP0,INP1,INP2 }, NULL, "DISCRETE_ADDER3" },
43204370#define DISCRETE_ADDER4(NODE,ENAB,INP0,INP1,INP2,INP3)                  { NODE, DST_ADDER       , 5, { ENAB,INP0,INP1,INP2,INP3 }, { ENAB,INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_ADDER4" },
4321#define DISCRETE_CLAMP(NODE,ENAB,INP0,MIN,MAX,CLAMP)                    { NODE, DST_CLAMP       , 5, { ENAB,INP0,MIN,MAX,CLAMP }, { ENAB,INP0,MIN,MAX,CLAMP }, NULL, "DISCRETE_CLAMP" },
4371#define DISCRETE_CLAMP(NODE,INP0,MIN,MAX)                               { NODE, DST_CLAMP       , 3, { INP0,MIN,MAX }, { INP0,MIN,MAX }, NULL, "DISCRETE_CLAMP" },
43224372#define DISCRETE_DIVIDE(NODE,ENAB,INP0,INP1)                            { NODE, DST_DIVIDE      , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_DIVIDE" },
43234373#define DISCRETE_GAIN(NODE,INP0,GAIN)                                   { NODE, DST_GAIN        , 3, { INP0,NODE_NC,NODE_NC }, { INP0,GAIN,0 }, NULL, "DISCRETE_GAIN" },
43244374#define DISCRETE_INVERT(NODE,INP0)                                      { NODE, DST_GAIN        , 3, { INP0,NODE_NC,NODE_NC }, { INP0,-1,0 }, NULL, "DISCRETE_INVERT" },
r5955r5956
43504400#define DISCRETE_MULTIPLEX8(NODE,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7) { NODE, DST_MULTIPLEX, 9, { ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, { ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, NULL, "DISCRETE_MULTIPLEX8" },
43514401#define DISCRETE_MULTIPLY(NODE,INP0,INP1)                               { NODE, DST_GAIN        , 3, { INP0,INP1,NODE_NC }, { INP0,INP1,0 }, NULL, "DISCRETE_MULTIPLY" },
43524402#define DISCRETE_MULTADD(NODE,INP0,INP1,INP2)                           { NODE, DST_GAIN        , 3, { INP0,INP1,INP2 }, { INP0,INP1,INP2 }, NULL, "DISCRETE_MULTADD" },
4353#define DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE)                     { NODE, DST_ONESHOT     , 5, { NODE_NC,TRIG,AMPL,WIDTH,NODE_NC }, { 0,TRIG,AMPL,WIDTH,TYPE }, NULL, "DISCRETE_ONESHOT" },
4403#define DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE)                     { NODE, DST_ONESHOT     , 5, { 0,TRIG,AMPL,WIDTH,NODE_NC }, { 0,TRIG,AMPL,WIDTH,TYPE }, NULL, "DISCRETE_ONESHOT" },
43544404#define DISCRETE_ONESHOTR(NODE,RESET,TRIG,AMPL,WIDTH,TYPE)              { NODE, DST_ONESHOT     , 5, { RESET,TRIG,AMPL,WIDTH,NODE_NC }, { RESET,TRIG,AMPL,WIDTH,TYPE }, NULL, "One Shot Resetable" },
43554405#define DISCRETE_ONOFF(NODE,ENAB,INP0)                                  { NODE, DST_GAIN        , 3, { ENAB,INP0,NODE_NC }, { 0,1,0 }, NULL, "DISCRETE_ONOFF" },
43564406#define DISCRETE_RAMP(NODE,ENAB,RAMP,GRAD,START,END,CLAMP)              { NODE, DST_RAMP        , 6, { ENAB,RAMP,GRAD,START,END,CLAMP }, { ENAB,RAMP,GRAD,START,END,CLAMP }, NULL, "DISCRETE_RAMP" },
r5955r5956
44224472#define DISCRETE_555_CC(NODE,RESET,VIN,R,C,RBIAS,RGND,RDIS,OPTIONS)     { NODE, DSD_555_CC      , 7, { RESET,VIN,R,C,RBIAS,RGND,RDIS }, { RESET,VIN,R,C,RBIAS,RGND,RDIS }, OPTIONS, "DISCRETE_555_CC" },
44234473#define DISCRETE_555_VCO1(NODE,RESET,VIN,OPTIONS)                       { NODE, DSD_555_VCO1    , 3, { RESET,VIN,NODE_NC }, { RESET,VIN,-1 }, OPTIONS, "DISCRETE_555_VCO1" },
44244474#define DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS)              { NODE, DSD_555_VCO1    , 3, { RESET,VIN,CTRLV }, { RESET,VIN,CTRLV }, OPTIONS, "DISCRETE_555_VCO1_CV" },
4425#define DISCRETE_566(NODE,VMOD,R,C,OPTIONS)                             { NODE, DSD_566         , 3, { VMOD,R,C }, { VMOD,R,C }, OPTIONS, "DISCRETE_566" },
4475#define DISCRETE_566(NODE,VMOD,R,C,VPOS,VNEG,VCHARGE,OPTIONS)           { NODE, DSD_566         , 7, { VMOD,R,C,NODE_NC,NODE_NC,VCHARGE,NODE_NC }, { VMOD,R,C,VPOS,VNEG,VCHARGE,OPTIONS }, NULL, "DISCRETE_566" },
44264476#define DISCRETE_74LS624(NODE,VMOD,VRNG,C,OUTTYPE)                      { NODE, DSD_LS624       , 4, { VMOD,NODE_NC,NODE_NC,NODE_NC }, { VMOD,VRNG,C,OUTTYPE }, NULL, "DISCRETE_74LS624" },
44274477
44284478/* NOP */
r5955r5956
44444494
44454495/* parallel tasks */
44464496
4447#define DISCRETE_TASK_START()                                           { NODE_SPECIAL, DSO_TASK_START,0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
4497#define DISCRETE_TASK_START(TASK_GROUP)                                 { NODE_SPECIAL, DSO_TASK_START,1, { NODE_NC, NODE_NC }, { TASK_GROUP, 0 }, NULL, "DISCRETE_TASK_START" },
44484498#define DISCRETE_TASK_END()                                             { NODE_SPECIAL, DSO_TASK_END , 1, { 0 }, { 0 }, NULL, "DISCRETE_TASK_END" },
44494499//#define DISCRETE_TASK_SYNC()                                          { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" },
44504500
src/emu/sound/disc_dev.c
r5955r5956
5858   int      output_is_ac;
5959   double   ac_shift;            /* DC shift needed to make waveform ac */
6060   int      flip_flop;            /* 555 flip/flop output state */
61   int      has_rc_nodes;
62   double   exp_charge;
6163   double   cap_voltage;         /* voltage on cap */
6264   double   threshold;
6365   double   trigger;
r5955r5956
109111   unsigned int state[2];         /* keeps track of excess flip_flop changes during the current step */
110112   int         flip_flop;         /* 566 flip/flop output state */
111113   double      cap_voltage;      /* voltage on cap */
112   double      v_charge;         /* static charge value */
113   double      *v_charge_node;      /* point to charge node */
114114   double      v_sqr_low;         /* voltage for a squarewave at low */
115115   double      v_sqr_high;         /* voltage for a squarewave at high */
116116   double      threshold_low;      /* falling threshold */
117117   double      threshold_high;      /* rising threshold */
118118   double      triangle_ac_offset;   /* used to shift a triangle to AC */
119   double      v_osc_stable;
120   double      v_osc_stop;
119121};
120122
121123struct dsd_ls624_context
r5955r5956
125127   int         out_type;
126128   double      k1;            /* precalculated cap part of formula */
127129   double      k2;            /* precalculated ring part of formula */
130   double      dt_vmod_at_0;
128131};
129132
130133
r5955r5956
456459#define DSD_555_MSTBL__R      DISCRETE_INPUT(2)
457460#define DSD_555_MSTBL__C      DISCRETE_INPUT(3)
458461
462/* bit mask of the above RC inputs */
463#define DSD_555_MSTBL_RC_MASK   0x0c
464
459465static DISCRETE_STEP(dsd_555_mstbl)
460466{
461467   const  discrete_555_desc     *info    = (const  discrete_555_desc *)node->custom;
r5955r5956
463469
464470   double v_cap;         /* Current voltage on capacitor, before dt */
465471   double v_cap_next = 0;   /* Voltage on capacitor, after dt */
472   double x_time  = 0;      /* time since change happened */
473   double dt, exponent;
474   int trigger = 0;
475   int trigger_type;
476   int update_exponent = 0;
466477
467478   if(DSD_555_MSTBL__RESET)
468479   {
r5955r5956
470481      node->output[0]     = 0;
471482      context->flip_flop  = 0;
472483      context->cap_voltage = 0;
484      return;
473485   }
474   else
486
487   trigger_type = info->options;
488   dt = node->info->sample_time;
489
490   switch (trigger_type & DSD_555_TRIGGER_TYPE_MASK)
475491   {
476      int trigger;
492      case DISC_555_TRIGGER_IS_LOGIC:
493         trigger = (int)!DSD_555_MSTBL__TRIGGER;
494         break;
495      case DISC_555_TRIGGER_IS_VOLTAGE:
496         trigger = (int)(DSD_555_MSTBL__TRIGGER < context->trigger);
497         break;
498      case DISC_555_TRIGGER_IS_COUNT:
499         trigger = (int)DSD_555_MSTBL__TRIGGER;
500         if (trigger && !context->flip_flop)
501         {
502            x_time = DSD_555_MSTBL__TRIGGER - trigger;
503            if (x_time != 0)
504            {
505               /* adjust sample to after trigger */
506               x_time = (1.0 - x_time);
507               update_exponent = 1;
508               dt = x_time * node->info->sample_time;
509            }
510         }
511         break;
512   }
477513
478      if (context->trig_is_logic)
479         trigger = !DSD_555_MSTBL__TRIGGER;
480      else
481         trigger = DSD_555_MSTBL__TRIGGER < context->trigger;
514   if ((trigger_type & DISC_555_TRIGGER_DISCHARGES_CAP) && trigger)
515      context->cap_voltage = 0;
482516
483      if (context->trig_discharges_cap && trigger)
484         context->cap_voltage = 0;
517   /* Wait for trigger */
518   if (!context->flip_flop && trigger)
519      context->flip_flop = 1;
485520
486      if (!context->flip_flop)
521   if (context->flip_flop)
522   {
523      v_cap = context->cap_voltage;
524
525      /* Sometimes a switching network is used to setup the capacitance.
526         * These may select 'no' capacitor, causing oscillation to stop.
527         */
528      if (DSD_555_MSTBL__C == 0)
487529      {
488         /* Wait for trigger */
489         if (trigger)
490            context->flip_flop = 1;
530         context->flip_flop = 0;
531         /* The voltage goes high because the cap circuit is open. */
532         v_cap_next = info->v_pos;
533         v_cap      = info->v_pos;
534         context->cap_voltage = 0;
491535      }
492536      else
493537      {
494         v_cap = context->cap_voltage;
538         /* Charging */
539         update_exponent |= context->has_rc_nodes;
540         if (update_exponent)
541            exponent = RC_CHARGE_EXP_DT(DSD_555_MSTBL__R * DSD_555_MSTBL__C, dt);
542         else
543            exponent = context->exp_charge;
544         v_cap_next = v_cap + ((info->v_pos - v_cap) * exponent);
495545
496         /* Sometimes a switching network is used to setup the capacitance.
497             * These may select 'no' capacitor, causing oscillation to stop.
498             */
499         if (DSD_555_MSTBL__C == 0)
546         /* Has it charged past upper limit? */
547         /* If trigger is still enabled, then we keep charging,
548             * regardless of threshold. */
549         if ((v_cap_next >= context->threshold) && !trigger)
500550         {
551            dt = DSD_555_MSTBL__R * DSD_555_MSTBL__C  * log(1.0 / (1.0 - ((v_cap_next - context->threshold) / (context->v_charge - v_cap))));
552            x_time = dt / node->info->sample_time;
553            v_cap_next = 0;
554            v_cap      = context->threshold;
501555            context->flip_flop = 0;
502            /* The voltage goes high because the cap circuit is open. */
503            v_cap_next = info->v_pos;
504            v_cap      = info->v_pos;
505            context->cap_voltage = 0;
506556         }
507         else
508         {
509            /* Charging */
510            v_cap_next = v_cap + ((info->v_pos - v_cap) * RC_CHARGE_EXP(DSD_555_MSTBL__R * DSD_555_MSTBL__C));
557      }
511558
512            /* Has it charged past upper limit? */
513            /* If trigger is still enabled, then we keep charging,
514                 * regardless of threshold. */
515            if ((v_cap_next >= context->threshold) && !trigger)
516            {
517               v_cap_next = 0;
518               v_cap      = context->threshold;
519               context->flip_flop = 0;
520            }
521         }
559      context->cap_voltage = v_cap_next;
560   }
522561
523         context->cap_voltage = v_cap_next;
524
525         switch (info->options & DISC_555_OUT_MASK)
526         {
527            case DISC_555_OUT_SQW:
528               node->output[0] = context->flip_flop * context->v_out_high;
529               /* Fake it to AC if needed */
530               if (context->output_is_ac)
531                  node->output[0] -= context->v_out_high / 2.0;
532               break;
533            case DISC_555_OUT_CAP:
534               node->output[0] = v_cap_next;
535               /* Fake it to AC if needed */
536               if (context->output_is_ac)
537                  node->output[0] -= context->threshold * 3.0 /4.0;
538               break;
539         }
540      }
562   switch (info->options & DISC_555_OUT_MASK)
563   {
564      case DISC_555_OUT_SQW:
565         node->output[0] = context->flip_flop * context->v_out_high;
566         /* Fake it to AC if needed */
567         if (context->output_is_ac)
568            node->output[0] -= context->v_out_high / 2.0;
569         break;
570      case DISC_555_OUT_CAP:
571         node->output[0] = v_cap_next;
572         /* Fake it to AC if needed */
573         if (context->output_is_ac)
574            node->output[0] -= context->threshold * 3.0 /4.0;
575         break;
576      case DISC_555_OUT_ENERGY:
577         if (x_time == 0) x_time = 1.0;
578         node->output[0] = context->v_out_high * (context->flip_flop ? x_time : (1.0 - x_time));
579            if (context->output_is_ac)
580               node->output[0] -= context->v_out_high / 2.0;
581         break;
541582   }
542583}
543584
r5955r5956
571612   context->flip_flop   = 0;
572613   context->cap_voltage = 0;
573614
615   /* optimization if none of the values are nodes */
616   context->has_rc_nodes = 0;
617   if (node->input_is_node & DSD_555_MSTBL_RC_MASK)
618      context->has_rc_nodes = 1;
619   else
620      context->exp_charge = RC_CHARGE_EXP(DSD_555_MSTBL__R * DSD_555_MSTBL__C);
621
574622   node->output[0] = 0;
575623}
576624
r5955r5956
13731421   context->ac_shift = context->output_is_ac ? -context->v_out_high / 2.0 : 0;
13741422}
13751423
1424
13761425/************************************************************************
13771426 *
13781427 * DSD_566 - Usage of node_description values
13791428 *
1380 * input[0]    - Modulation Voltage
1381 * input[1]    - R value
1382 * input[2]    - C value
1429 * Mar 2004, D Renaud. updated Sept 2009
13831430 *
1384 * also passed discrete_566_desc structure
1431 * The data sheets for this are no where near correct.
1432 * This simulation is based on the internal schematic and testing of
1433 * a real Signetics IC.
13851434 *
1386 * Mar 2004, D Renaud.
1435 * The 566 is a constant current based VCO.  If you change R, that affects
1436 * the charge/discharge rate.  A constant current source will charge the
1437 * cap linearly.  Of course due to the transistors there will be some
1438 * non-linear areas at the ends of the Vmod range.  As the Vmod voltage
1439 * drops from Vcharge, the frequency generated increases.
1440 *
1441 * The Triangle (pin 4) output is just a buffered version of the cap
1442 * charge.  It is about 1.35 higher then the cap voltage.
1443 * The Square (pin 3) output starts low as the cap voltages rises.
1444 * Once a threshold is reached, the cap starts to discharge, and the
1445 * Square output goes high.  The Square high output is about 1V less then
1446 * B+.  Unloaded it is .75V less.  With a 4.7k pull-down resistor, it
1447 * is 1.06V less.  So I will simulate at 1V less. The Square low voltage
1448 * is non-linear so I will use a table.  The cap toggle thresholds vary
1449 * depending on B+, so they will be simulated with a table.
1450 *
1451 * The data sheets show Vmod should be no less then 3/4*B+.  In reality
1452 * you can go to close to 1/2*B+ before you loose linearity.  Below 1/2,
1453 * oscillation stops.  When Vmod is 0V to 0.1V less then B+, it also
1454 * looses linearity, and stops oscillating when >= B+.  This is because
1455 * there is no voltage difference to create a current source.
1456 *
1457 * The current source is dependant on the voltage difference between B+
1458 * and Vmod.  Due to transistor action, it is not 100%, but this formula
1459 * gives a good approximation:
1460 * I = ((B+ - Vmod - 0.1) * 0.95) / R
1461 * You can test the current VS modulation function by using 10k for R
1462 * and replace C with a 10k resistor.  Then you can monitor the voltage
1463 * on pin 7 to work out the current.  I=V/R.  It will start to oscillate
1464 * when in the cap threshold range.
1465 *
1466 * When Vmod drops below the stable range, the current source no longer
1467 * functions properly.  Technically this is out of the range specified
1468 * for the IC.  Of course old games used this range anyways, so we need
1469 * to know how the real IC behaves.  When Vmod drops below the stable range,
1470 * the charge current is stops dropping instead of increasing, while the
1471 * discharge current still functions.  This means the frequency generated
1472 * starts to drop as the voltage lowers, instead of the normal increase
1473 * in frequency.
1474 *
13871475 ************************************************************************/
1388#define DSD_566__VMOD   DISCRETE_INPUT(0)
1389#define DSD_566__R      DISCRETE_INPUT(1)
1390#define DSD_566__C      DISCRETE_INPUT(2)
1476#define DSD_566__VMOD      DISCRETE_INPUT(0)
1477#define DSD_566__R         DISCRETE_INPUT(1)
1478#define DSD_566__C         DISCRETE_INPUT(2)
1479#define DSD_566__VPOS      DISCRETE_INPUT(3)
1480#define DSD_566__VNEG      DISCRETE_INPUT(4)
1481#define DSD_566__VCHARGE   DISCRETE_INPUT(5)
1482#define DSD_566__OPTIONS   DISCRETE_INPUT(6)
13911483
1484
1485static const struct
1486{
1487   double   c_high[6];
1488   double   c_low[6];
1489   double   sqr_low[6];
1490   double   osc_stable[6];
1491   double   osc_stop[6];
1492} ne566 =
1493{
1494   /* 10      10.5      11      11.5      12     13     14     15             B+ */
1495   {3.364, /*3.784,*/ 4.259, /*4.552,*/ 4.888, 5.384, 5.896, 6.416},      /* c_high */
1496   {1.940, /*2.100,*/ 2.276, /*2.404,*/ 2.580, 2.880, 3.180, 3.488},      /* c_low */
1497   {4.352, /*4.144,*/ 4.080, /*4.260,*/ 4.500, 4.960, 5.456, 5.940},      /* sqr_low */
1498   {4.885, /*5.316,*/ 5.772, /*6.075,*/ 6.335, 6.912, 7.492, 7.945},      /* osc_stable */
1499   {4.495, /*4.895,*/ 5.343, /*5.703,*/ 5.997, 6.507, 7.016, 7.518}      /* osc_stop */
1500};
1501
13921502static DISCRETE_STEP(dsd_566)
13931503{
1394   const  discrete_566_desc *info    = (const  discrete_566_desc *)node->custom;
13951504   struct dsd_566_context   *context = (struct dsd_566_context *)node->context;
13961505
1397   double i;            /* Charging current created by vIn */
1398   double dt;            /* change in time */
1399   double v_cap;         /* Current voltage on capacitor, before dt */
1400   double v_cap_next = 0;   /* Voltage on capacitor, after dt */
1401   double v_charge;
1506   double   i = 0;         /* Charging current created by vIn */
1507   double   i_rise;         /* non-linear rise charge current */
1508   double   dt;            /* change in time */
1509   double   x_time = 0;
1510   double   v_cap;         /* Current voltage on capacitor, before dt */
1511   double   v_cap_next = 0;   /* Voltage on capacitor, after dt */
1512   int      count_f = 0, count_r = 0;
1513   int      options = (int)DSD_566__OPTIONS;
14021514
14031515   dt    = node->info->sample_time;   /* Change in time */
14041516   v_cap = context->cap_voltage;   /* Set to voltage before change */
14051517
1406   /* get the v_charge and update each step if it is a node */
1407   if (context->v_charge_node != NULL)
1518
1519   /* Calculate charging current if it is in range */
1520   if (DSD_566__VMOD > context->v_osc_stop)
14081521   {
1409      v_charge  = *context->v_charge_node;
1410      v_charge -= info->v_neg;
1522      double v_charge = DSD_566__VCHARGE - DSD_566__VMOD - 0.1;
1523      if (v_charge > 0)
1524      {
1525         i = (v_charge * .95) / DSD_566__R;
1526         if (DSD_566__VMOD < context->v_osc_stable)
1527         {
1528            /* no where near correct calculation of non linear range */
1529            i_rise = ((DSD_566__VCHARGE - context->v_osc_stable - 0.1) * .95) / DSD_566__R;
1530            i_rise *= 1.0 - (context->v_osc_stable - DSD_566__VMOD) / (context->v_osc_stable - context->v_osc_stop);
1531         }
1532         else
1533            i_rise = i;
1534      }
1535      else
1536         return;
14111537   }
1412   else
1413      v_charge = context->v_charge;
1538   else return;
14141539
1415   /* Calculate charging current */
1416   i = (v_charge - DSD_566__VMOD) / DSD_566__R;
1417
1418   /* Keep looping until all toggling in time sample is used up. */
1540   /* Keep looping until all toggling in this time sample is used up. */
14191541   do
14201542   {
14211543      if (context->flip_flop)
r5955r5956
14341556            }
14351557            v_cap = context->threshold_low;
14361558            context->flip_flop = 0;
1437            /*
1438                 * If the sampling rate is too low and the desired frequency is too high
1439                 * then we will start getting too many outputs that can't catch up.  We will
1440                 * limit this to 3.  The output is already incorrect because of the low sampling,
1441                 * but at least this way it can recover.
1442                 */
1443            context->state[0] = (context->state[0] + 1) & 0x03;
1559            count_f++;
1560            x_time = dt;
14441561         }
14451562      }
14461563      else
14471564      {
14481565         /* Charging */
14491566         /* iC=C*dv/dt  works out to dv=iC*dt/C */
1450         v_cap_next = v_cap + (i * dt / DSD_566__C);
1567         v_cap_next = v_cap + (i_rise * dt / DSD_566__C);
14511568         dt         = 0;
14521569         /* Yes, if the cap voltage has reached the max voltage it can,
14531570             * and the 566 threshold has not been reached, then oscillation stops.
r5955r5956
14661583            }
14671584            v_cap = context->threshold_high;
14681585            context->flip_flop = 1;
1469            context->state[1] = (context->state[1] + 1) & 0x03;
1586            count_r++;
1587            x_time = dt;
14701588         }
14711589      }
14721590   } while(dt);
14731591
14741592   context->cap_voltage = v_cap_next;
14751593
1476   switch (info->options & DISC_566_OUT_MASK)
1594   switch (options & DISC_566_OUT_MASK)
14771595   {
14781596      case DISC_566_OUT_SQUARE:
14791597      case DISC_566_OUT_LOGIC:
1480         /* use up any output states */
1481         if (node->output[0] && context->state[0])
1482         {
1483            node->output[0] = 0;
1484            context->state[0]--;
1485         }
1486         else if (!node->output[0] && context->state[1])
1487         {
1488            node->output[0] = 1;
1489            context->state[1]--;
1490         }
1491         else
1492         {
14931598            node->output[0] = context->flip_flop;
1494         }
1495         if ((info->options & DISC_566_OUT_MASK) != DISC_566_OUT_LOGIC)
1599         if ((options & DISC_566_OUT_MASK) != DISC_566_OUT_LOGIC)
14961600            node->output[0] = context->flip_flop ? context->v_sqr_high : context->v_sqr_low;
14971601         break;
14981602      case DISC_566_OUT_TRIANGLE:
14991603         /* we can ignore any unused states when
15001604             * outputting the cap voltage */
1501         node->output[0] = v_cap_next;
1502         if (info->options & DISC_566_OUT_AC)
1605         node->output[0] = v_cap_next + 1.35;
1606         if (options & DISC_566_OUT_AC)
15031607            node->output[0] -= context->triangle_ac_offset;
15041608         break;
1609      case DISC_566_OUT_COUNT_F_X:
1610         node->output[0] = count_f ? count_f + x_time : count_f;
1611         break;
1612      case DISC_566_OUT_COUNT_R_X:
1613         node->output[0] =  count_r ? count_r + x_time : count_r;
1614         break;
1615      case DISC_566_OUT_COUNT_F:
1616         node->output[0] = count_f;
1617         break;
1618      case DISC_566_OUT_COUNT_R:
1619         node->output[0] = count_r;
1620         break;
15051621   }
15061622}
15071623
15081624static DISCRETE_RESET(dsd_566)
15091625{
1510   const  discrete_566_desc *info    = (const  discrete_566_desc *)node->custom;
15111626   struct dsd_566_context   *context = (struct dsd_566_context *)node->context;
1512   node_description *v_charge_node;
15131627
1514   double   v_diff, temp;
1628   double   temp;
1629   int      v_int;
1630   double   v_float;
15151631
1516   if (info->v_neg >= info->v_pos)
1517   {
1518      fatalerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", NODE_BLOCKINDEX(node));
1519   }
1632   if (DSD_566__VNEG >= DSD_566__VPOS)
1633      fatalerror("[v_neg >= v_pos] in NODE_%d!\n", NODE_BLOCKINDEX(node));
15201634
1521   /* setup v_charge or node */
1522   v_charge_node = discrete_find_node(node->info, info->v_charge);
1523   if (v_charge_node)
1524      context->v_charge_node = &(v_charge_node->output[NODE_CHILD_NODE_NUM(info->v_charge)]);
1525   else
1526   {
1527      context->v_charge  = (info->v_charge == DEFAULT_566_CHARGE) ? info->v_pos : info->v_charge;
1528      context->v_charge -= info->v_neg;
1529      context->v_charge_node = NULL;
1530   }
1635   v_float = DSD_566__VPOS - DSD_566__VNEG;
1636   v_int = (int)v_float;
1637   if ( v_float < 10 || v_float > 15 )
1638      fatalerror("v_neg and/or v_pos out of range in NODE_%d\n", NODE_BLOCKINDEX(node));
1639   if ( v_float != v_int )
1640      /* fatal for now. */
1641      fatalerror("Power should be integer in NODE_%d\n", NODE_BLOCKINDEX(node));
15311642
1532   v_diff = info->v_pos - info->v_neg;
15331643   context->flip_flop   = 0;
15341644   context->cap_voltage = 0;
1535   context->state[0]    = 0;
1536   context->state[1]    = 0;
15371645
1538   /* The data sheets are useless for this IC.  I will have to get my hands on a chip
1539     * to make real measurements.  For now this should work fine for 12V. */
1540   context->threshold_high = v_diff / 2 + info->v_neg;
1541   context->threshold_low  = context->threshold_high - (0.2 * v_diff);
1542   context->v_sqr_high     = info->v_pos - 0.6;
1543   context->v_sqr_low      = context->threshold_high;
1646   v_int -= 10;
1647   context->threshold_high = ne566.c_high[v_int] + DSD_566__VNEG;
1648   context->threshold_low  = ne566.c_low[v_int] + DSD_566__VNEG;
1649   context->v_sqr_high     = DSD_566__VPOS - 1;
1650   context->v_sqr_low      = ne566.sqr_low[v_int] + DSD_566__VNEG;
1651   context->v_osc_stable   = ne566.osc_stable[v_int] + DSD_566__VNEG;
1652   context->v_osc_stop      = ne566.osc_stop[v_int] + DSD_566__VNEG;
15441653
1545   if (info->options & DISC_566_OUT_AC)
1654   if ((int)DSD_566__OPTIONS & DISC_566_OUT_AC)
15461655   {
15471656      temp = (context->v_sqr_high - context->v_sqr_low) / 2;
15481657      context->v_sqr_high =  temp;
15491658      context->v_sqr_low  = -temp;
1550      context->triangle_ac_offset = context->threshold_high - (0.1 * v_diff);
1659      context->triangle_ac_offset = context->threshold_high - (0.1 * v_float) + 1.35/2;
15511660   }
15521661
15531662   /* Step the output */
15541663   DISCRETE_STEP_CALL(dsd_566);
15551664}
15561665
1666
15571667/************************************************************************
15581668 *
15591669 * DSD_LS624 - Usage of node_description values
r5955r5956
15861696 #define LS624_F(_C, _VI, _VR)  pow(10, -0.912029404 * log10(_C) + 0.243264328 * (_VI) \
15871697                  - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925)
15881698*/
1589#define LS624_F(_VI)   pow(10, context->k1 + 0.243264328 * (_VI) + context->k2 * (_VI))
15901699
1700/* pow(10, x) = exp(ln(10)*x) */
1701#define pow10(x) exp(2.30258509299404568401*(x))
1702
1703#define LS624_F(_VI)   pow10(context->k1 + 0.243264328 * (_VI) + context->k2 * (_VI))
1704
15911705static DISCRETE_STEP(dsd_ls624)
15921706{
15931707   struct dsd_ls624_context *context = (struct dsd_ls624_context *)node->context;
r5955r5956
16001714
16011715   sample_t = node->info->sample_time;   /* Change in time */
16021716   //dt  = LS624_T(DSD_LS624__C, DSD_LS624__VRNG, DSD_LS624__VMOD) / 2.0;
1603   dt  = 1.0f / (2.0f * LS624_F(DSD_LS624__VMOD));
1717   if (DSD_LS624__VMOD > 0.001)
1718      dt = 0.5 / LS624_F(DSD_LS624__VMOD);
1719   else
1720      /* close enough to 0, so we can speed things up by no longer call pow() */
1721      dt = context->dt_vmod_at_0;
16041722   t   = context->remain;
16051723   en += (double) context->state * t;
16061724   while (t + dt <= sample_t)
r5955r5956
16491767   context->k1 = -0.912029404 * log10(DSD_LS624__C) -0.091695877 * (DSD_LS624__VRNG) - 3.207072925;
16501768   context->k2 = -0.014110946 * (DSD_LS624__VRNG);
16511769
1770   context->dt_vmod_at_0 = 0.5 / LS624_F(0);
1771
16521772   /* Step the output */
16531773   DISCRETE_STEP_CALL(dsd_ls624);
16541774}
src/emu/sound/disc_wav.c
r5955r5956
100100   int      type;
101101   UINT8   flip_flop;      /* flip/flop output state */
102102   UINT8   flip_flop_xor;   /* flip_flop ^ flip_flop_xor, 0 = discharge, 1 = charge */
103   UINT8   is_squarewave;
103   UINT8   output_type;
104104   double   v_out_high;
105105   double   threshold_low;   /* falling threshold */
106106   double   threshold_high;   /* rising threshold */
r5955r5956
110110   double   temp1;         /* Multi purpose */
111111   double   temp2;         /* Multi purpose */
112112   double   temp3;         /* Multi purpose */
113   double   is_linear_charge;
114   double   charge_rc;
115   double   charge_exp;
113116};
114117
115118struct dss_sawtoothwave_context
r5955r5956
745748   struct dss_op_amp_osc_context   *context = (struct dss_op_amp_osc_context *)node->context;
746749
747750
748   double i;         /* Charging current created by vIn */
749   double v = 0;      /* all input voltages mixed */
750   double dt;         /* change in time */
751   double vC;         /* Current voltage on capacitor, before dt */
752   double vCnext = 0;   /* Voltage on capacitor, after dt */
753   double iCharge[2]  = {0};
751   double i;            /* Charging current created by vIn */
752   double v = 0;         /* all input voltages mixed */
753   double dt;            /* change in time */
754   double v_cap;         /* Current voltage on capacitor, before dt */
755   double v_cap_next = 0;   /* Voltage on capacitor, after dt */
756   double charge[2]  = {0};
757   double x_time  = 0;      /* time since change happened */
758   double exponent;
754759   UINT8 force_charge = 0;
755760   UINT8 enable = DSS_OP_AMP_OSC__ENABLE;
761   UINT8 update_exponent = 0;
762   int count_f = 0;
763   int count_r = 0;
756764
757765   dt = node->info->sample_time;   /* Change in time */
758   vC = context->v_cap;   /* Set to voltage before change */
766   v_cap = context->v_cap;   /* Set to voltage before change */
759767
760   /* work out the charge currents for the VCOs. */
768   /* work out the charge currents/voltages. */
761769   switch (context->type)
762770   {
763771      case DISC_OP_AMP_OSCILLATOR_VCO_1:
764772         /* Work out the charge rates. */
765773         /* i is not a current.  It is being used as a temp variable. */
766774         i = DSS_OP_AMP_OSC__VMOD1 * context->temp1;
767         iCharge[0] = (DSS_OP_AMP_OSC__VMOD1 - i) / info->r1;
768         iCharge[1] = (i - (DSS_OP_AMP_OSC__VMOD1 * context->temp2)) / context->temp3;
775         charge[0] = (DSS_OP_AMP_OSC__VMOD1 - i) / info->r1;
776         charge[1] = (i - (DSS_OP_AMP_OSC__VMOD1 * context->temp2)) / context->temp3;
769777         break;
770778
771779      case DISC_OP_AMP_OSCILLATOR_1 | DISC_OP_AMP_IS_NORTON:
r5955r5956
773781         /* resistors can be nodes, so everything needs updating */
774782         double i1, i2;
775783         /* Work out the charge rates. */
776         iCharge[0] = DSS_OP_AMP_OSC_NORTON_VP_IN / *context->r1;
777         iCharge[1] = (context->v_out_high - OP_AMP_NORTON_VBE) / *context->r2 - iCharge[0];
784         charge[0] = DSS_OP_AMP_OSC_NORTON_VP_IN / *context->r1;
785         charge[1] = (context->v_out_high - OP_AMP_NORTON_VBE) / *context->r2 - charge[0];
778786         /* Work out the Inverting Schmitt thresholds. */
779787         i1 = DSS_OP_AMP_OSC_NORTON_VP_IN / *context->r5;
780788         i2 = (0.0 - OP_AMP_NORTON_VBE) / *context->r4;
r5955r5956
803811
804812         /* Work out the charge rates. */
805813         v -= OP_AMP_NORTON_VBE;
806         iCharge[0] = v / info->r1;
807         iCharge[1] = v / info->r2 - iCharge[0];
814         charge[0] = v / info->r1;
815         charge[1] = v / info->r2 - charge[0];
808816
809817         /* use the real enable circuit */
810818         force_charge = !enable;
r5955r5956
814822      case DISC_OP_AMP_OSCILLATOR_VCO_2 | DISC_OP_AMP_IS_NORTON:
815823         /* Work out the charge rates. */
816824         i = DSS_OP_AMP_OSC__VMOD1 / info->r1;
817         iCharge[0] = i - context->temp1;
818         iCharge[1] = context->temp2 - i;
825         charge[0] = i - context->temp1;
826         charge[1] = context->temp2 - i;
819827         /* if the negative pin current is less then the positive pin current, */
820828         /* then the osc is disabled and the cap keeps charging */
821         if (iCharge[0] < 0)
829         if (charge[0] < 0)
822830         {
823831            force_charge =  1;
824            iCharge[0]  *= -1;
832            charge[0]  *= -1;
825833         }
826834         break;
827835
828836      case DISC_OP_AMP_OSCILLATOR_VCO_3 | DISC_OP_AMP_IS_NORTON:
829837         /* we need to mix any bias and all modulation voltages together. */
830         iCharge[0] = context->i_fixed;
838         charge[0] = context->i_fixed;
831839         v = DSS_OP_AMP_OSC__VMOD1 - OP_AMP_NORTON_VBE;
832         iCharge[0] += v / info->r1;
840         charge[0] += v / info->r1;
833841         if (info->r6 != 0)
834842         {
835843            v = DSS_OP_AMP_OSC__VMOD2 - OP_AMP_NORTON_VBE;
836            iCharge[0] += v / info->r6;
844            charge[0] += v / info->r6;
837845         }
838         iCharge[1] = context->temp1 - iCharge[0];
846         charge[1] = context->temp1 - charge[0];
839847         break;
840848   }
841849
842   if (enable)
850   if (!enable)
843851   {
844      int toggled = 0;
845      /* Keep looping until all toggling in time sample is used up. */
846      do
852      /* we will just output 0 for oscillators that have no real enable. */
853      node->output[0] = 0;
854      return;
855   }
856
857   /* Keep looping until all toggling in time sample is used up. */
858   do
859   {
860      if (context->is_linear_charge)
847861      {
848862         if ((context->flip_flop ^ context->flip_flop_xor) || force_charge)
849863         {
850864            /* Charging */
851865            /* iC=C*dv/dt  works out to dv=iC*dt/C */
852            vCnext = vC + (iCharge[1] * dt / info->c);
866            v_cap_next = v_cap + (charge[1] * dt / info->c);
853867            dt = 0;
854868
855869            /* has it charged past upper limit? */
856            if (vCnext > context->threshold_high)
870            if (v_cap_next > context->threshold_high)
857871            {
858872               context->flip_flop = context->flip_flop_xor;
859               toggled++;
873               if (context->flip_flop)
874                  count_r++;
875               else
876                  count_f++;
860877               if (force_charge)
861878               {
862879                  /* we need to keep charging the cap to the max thereby disabling the circuit */
863                  if (vCnext > context->v_out_high)
864                     vCnext = context->v_out_high;
880                  if (v_cap_next > context->v_out_high)
881                     v_cap_next = context->v_out_high;
865882               }
866883               else
867884               {
868885                  /* calculate the overshoot time */
869                  dt = info->c * (vCnext - context->threshold_high) / iCharge[1];
870                  vC = context->threshold_high;
886                  dt = info->c * (v_cap_next - context->threshold_high) / charge[1];
887                  x_time = dt;
888                  v_cap = context->threshold_high;
871889               }
872890            }
873891         }
874892         else
875893         {
876894            /* Discharging */
877            vCnext = vC - (iCharge[0] * dt / info->c);
895            v_cap_next = v_cap - (charge[0] * dt / info->c);
878896            dt     = 0;
879897
880898            /* has it discharged past lower limit? */
881            if (vCnext < context->threshold_low)
899            if (v_cap_next < context->threshold_low)
882900            {
883901               context->flip_flop = !context->flip_flop_xor;
884               toggled++;
902               if (context->flip_flop)
903                  count_r++;
904               else
905                  count_f++;
885906               /* calculate the overshoot time */
886               dt = info->c * (context->threshold_low - vCnext) / iCharge[0];
887               vC = context->threshold_low;
907               dt = info->c * (context->threshold_low - v_cap_next) / charge[0];
908               x_time = dt;
909               v_cap = context->threshold_low;
888910            }
889911         }
890      } while(dt);
912      }
913      else   /* non-linear charge */
914      {
915         if (update_exponent)
916            exponent = RC_CHARGE_EXP_DT(context->charge_rc, dt);
917         else
918            exponent = context->charge_exp;
891919
892      context->v_cap = vCnext;
920         if (context->flip_flop)
921         {
922            /* Charging */
923            v_cap_next = v_cap + ((context->v_out_high - v_cap) * exponent);
924            dt = 0;
893925
894      if (context->is_squarewave)
895      {
896         if (toggled == 2)
897            /* Some oscillators have rapid rise or fall times causing 1 part of the */
898            /* squarewave to happen in the sample time causing it to be missed. */
899            /* If we toggle 2 states we force the missed output for 1 sample. */
900            /* If more then 2 states happen, there is no hope, the sample rate is just too low. */
901            node->output[0] = context->v_out_high * (context->flip_flop ? 0 : 1);
926            /* Has it charged past upper limit? */
927            if (v_cap_next > context->threshold_high)
928            {
929               dt = context->charge_rc  * log(1.0 / (1.0 - ((v_cap_next - context->threshold_high) / (context->v_out_high - v_cap))));
930               x_time = dt;
931               v_cap_next = 0;
932               v_cap      = context->threshold_high;
933               context->flip_flop = 0;
934               count_f++;
935               update_exponent = 1;
936            }
937         }
902938         else
903            node->output[0] = context->v_out_high * context->flip_flop;
939         {
940            /* Discharging */
941            v_cap_next = v_cap - (v_cap * exponent);
942            dt = 0;
943
944            /* has it discharged past lower limit? */
945            if (v_cap_next < context->threshold_low)
946            {
947               dt = context->charge_rc * log(1.0 / (1.0 - ((context->threshold_low - v_cap_next) / v_cap)));
948               x_time = dt;
949               v_cap  = context->threshold_low;
950               context->flip_flop = 1;
951               count_r++;
952               update_exponent = 1;
953            }
954         }
904955      }
905      else
906         node->output[0] = context->v_cap;
907   }
908   else
956      context->v_cap = v_cap_next;
957   } while(dt);
958
959   x_time = dt / node->info->sample_time;
960
961   switch (context->output_type)
909962   {
910         /* we will just output 0 for oscillators that have no real enable. */
911         node->output[0] = 0;
963      case DISC_OP_AMP_OSCILLATOR_OUT_CAP:
964         node->output[0] = v_cap_next;
965         break;
966      case DISC_OP_AMP_OSCILLATOR_OUT_ENERGY:
967         if (x_time == 0) x_time = 1.0;
968         node->output[0]  = context->v_out_high * (context->flip_flop ? x_time : (1.0 - x_time));
969         break;
970      case DISC_OP_AMP_OSCILLATOR_OUT_SQW:
971         node->output[0] = context->flip_flop * context->v_out_high ;
972         break;
973      case DISC_OP_AMP_OSCILLATOR_OUT_COUNT_F_X:
974         node->output[0] = count_f ? count_f + x_time : count_f;
975         break;
976      case DISC_OP_AMP_OSCILLATOR_OUT_COUNT_R_X:
977         node->output[0] =  count_r ? count_r + x_time : count_r;
978         break;
979      case DISC_OP_AMP_OSCILLATOR_OUT_LOGIC_X:
980         node->output[0] = context->flip_flop + x_time;
981         break;
912982   }
913983}
914984
r5955r5956
9401010      r_context_ptr++;
9411011   }
9421012
943   context->is_squarewave = info->type & DISC_OP_AMP_OSCILLATOR_OUT_SQW;
944   context->type          = info->type & DISC_OP_AMP_OSCILLATOR_TYPE_MASK;
1013   context->is_linear_charge = 1;
1014   context->output_type = info->type & DISC_OP_AMP_OSCILLATOR_OUT_MASK;
1015   context->type        = info->type & DISC_OP_AMP_OSCILLATOR_TYPE_MASK;
9451016
9461017   switch (context->type)
9471018   {
r5955r5956
9631034         context->temp3 = 1.0 / (1.0 / info->r1 + 1.0 / info->r6);   /* input resistance when r6 switched in */
9641035         break;
9651036
1037      case DISC_OP_AMP_OSCILLATOR_2 | DISC_OP_AMP_IS_NORTON:
1038         context->is_linear_charge = 0;
1039         context->charge_rc = info->r1 * info->c;
1040         context->charge_exp = RC_CHARGE_EXP(context->charge_rc);
1041         context->threshold_low  = (info->vP - OP_AMP_NORTON_VBE) / info->r4;
1042         context->threshold_high = context->threshold_low + (info->vP - OP_AMP_VP_RAIL_OFFSET - OP_AMP_VP_RAIL_OFFSET) / info->r3;;
1043         context->threshold_low  = context->threshold_low * info->r2 + OP_AMP_NORTON_VBE;
1044         context->threshold_high = context->threshold_high * info->r2 + OP_AMP_NORTON_VBE;
1045         /* fall through */
1046
9661047      case DISC_OP_AMP_OSCILLATOR_1 | DISC_OP_AMP_IS_NORTON:
9671048         /* Charges while FlipFlop High */
9681049         context->flip_flop_xor = 0;
src/emu/sound/tms5220.c
r5955r5956
12991299
13001300***********************************************************************************************/
13011301
1302TIMER_CALLBACK( io_ready_cb )
1302static TIMER_CALLBACK( io_ready_cb )
13031303{
13041304   tms5220_state *tms = (tms5220_state *) ptr;
13051305   if (param)
src/emu/ui.c
r5955r5956
255255
256256   /* disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver,
257257       or if we are debugging */
258   if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &driver_empty || (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
258   if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &GAME_NAME(empty) || (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
259259      show_gameinfo = show_warnings = show_disclaimer = FALSE;
260260
261261   /* initialize the on-screen display system */
r5955r5956
266266   for (state = 0; state < maxstate && !mame_is_scheduled_event_pending(machine) && !ui_menu_is_force_game_select(); state++)
267267   {
268268      /* default to standard colors */
269      messagebox_backcolor = UI_FILLCOLOR;
269      messagebox_backcolor = UI_BACKGROUND_COLOR;
270270
271271      /* pick the next state */
272272      switch (state)
r5955r5956
281281            {
282282               ui_set_handler(handler_messagebox_ok, 0);
283283               if (machine->gamedrv->flags & (GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_REQUIRES_ARTWORK | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NO_SOUND))
284                  messagebox_backcolor = UI_YELLOWCOLOR;
284                  messagebox_backcolor = UI_YELLOW_COLOR;
285285               if (machine->gamedrv->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION))
286                  messagebox_backcolor = UI_REDCOLOR;
286                  messagebox_backcolor = UI_RED_COLOR;
287287            }
288288            break;
289289
r5955r5956
330330
331331   /* copy in the new text */
332332   astring_cpyc(messagebox_text, text);
333   messagebox_backcolor = UI_FILLCOLOR;
333   messagebox_backcolor = UI_BACKGROUND_COLOR;
334334
335335   /* don't update more than 4 times/second */
336336   if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4)
r5955r5956
470470
471471void ui_draw_outlined_box(float x0, float y0, float x1, float y1, rgb_t backcolor)
472472{
473   float hw = UI_LINE_WIDTH * 0.5f;
474473   render_ui_add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
475   render_ui_add_line(x0 + hw, y0 + hw, x1 - hw, y0 + hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
476   render_ui_add_line(x1 - hw, y0 + hw, x1 - hw, y1 - hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
477   render_ui_add_line(x1 - hw, y1 - hw, x0 + hw, y1 - hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
478   render_ui_add_line(x0 + hw, y1 - hw, x0 + hw, y0 + hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
474   render_ui_add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
475   render_ui_add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
476   render_ui_add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
477   render_ui_add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
479478}
480479
481480
r5955r5956
485484
486485void ui_draw_text(const char *buf, float x, float y)
487486{
488   ui_draw_text_full(buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
487   ui_draw_text_full(buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
489488}
490489
491490
r5955r5956
730729                target_x + target_width + UI_BOX_LR_BORDER,
731730                target_y + target_height + UI_BOX_TB_BORDER, backcolor);
732731   ui_draw_text_full(text, target_x, target_y, target_width,
733            justify, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
732            justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
734733}
735734
736735
r5955r5956
746745   /* extract the text */
747746   va_start(arg,text);
748747   astring_vprintf(messagebox_text, text, arg);
749   messagebox_backcolor = UI_FILLCOLOR;
748   messagebox_backcolor = UI_BACKGROUND_COLOR;
750749   va_end(arg);
751750
752751   /* set a timer */
src/emu/profiler.c
r5955r5956
134134      { PROFILER_USER2,            "User 2" },
135135      { PROFILER_USER3,            "User 3" },
136136      { PROFILER_USER4,            "User 4" },
137      { PROFILER_USER5,            "User 5" },
138      { PROFILER_USER6,            "User 6" },
139      { PROFILER_USER7,            "User 7" },
140      { PROFILER_USER8,            "User 8" },
137141      { PROFILER_PROFILER,         "Profiler" },
138142      { PROFILER_IDLE,             "Idle" }
139143   };
src/emu/ui.h
r5955r5956
3838/* handy colors */
3939#define ARGB_WHITE            MAKE_ARGB(0xff,0xff,0xff,0xff)
4040#define ARGB_BLACK            MAKE_ARGB(0xff,0x00,0x00,0x00)
41#define UI_FILLCOLOR         MAKE_ARGB(0xe0,0x10,0x10,0x30)
42#define UI_YELLOWCOLOR         MAKE_ARGB(0xe0,0x60,0x60,0x10)
43#define UI_REDCOLOR            MAKE_ARGB(0xf0,0x60,0x10,0x10)
41#define UI_BORDER_COLOR         MAKE_ARGB(0xff,0xff,0xff,0xff)
42#define UI_BACKGROUND_COLOR      MAKE_ARGB(0xe0,0x10,0x10,0x30)
43#define UI_GFXVIEWER_BG_COLOR   MAKE_ARGB(0xe0,0x10,0x10,0x30)
44#define UI_GREEN_COLOR         MAKE_ARGB(0xe0,0x10,0x60,0x10)
45#define UI_YELLOW_COLOR         MAKE_ARGB(0xe0,0x60,0x60,0x10)
46#define UI_RED_COLOR         MAKE_ARGB(0xf0,0x60,0x10,0x10)
47#define UI_UNAVAILABLE_COLOR   MAKE_ARGB(0xff,0x40,0x40,0x40)
48#define UI_TEXT_COLOR         MAKE_ARGB(0xff,0xff,0xff,0xff)
49#define UI_TEXT_BG_COLOR      MAKE_ARGB(0xe0,0x00,0x00,0x00)
50#define UI_SUBITEM_COLOR      MAKE_ARGB(0xff,0xff,0xff,0xff)
51#define UI_CLONE_COLOR         MAKE_ARGB(0xff,0x80,0x80,0x80)
52#define UI_SELECTED_COLOR      MAKE_ARGB(0xff,0xff,0xff,0x00)
53#define UI_SELECTED_BG_COLOR   MAKE_ARGB(0xe0,0x80,0x80,0x00)
54#define UI_MOUSEOVER_COLOR      MAKE_ARGB(0xff,0xff,0xff,0x80)
55#define UI_MOUSEOVER_BG_COLOR   MAKE_ARGB(0x70,0x40,0x40,0x00)
56#define UI_MOUSEDOWN_COLOR      MAKE_ARGB(0xff,0xff,0xff,0x80)
57#define UI_MOUSEDOWN_BG_COLOR   MAKE_ARGB(0xb0,0x60,0x60,0x00)
58#define UI_DIPSW_COLOR         MAKE_ARGB(0xff,0xff,0xff,0x00)
59#define UI_SLIDER_COLOR         MAKE_ARGB(0xff,0xff,0xff,0xff)
4460
4561/* cancel return value for a UI handler */
4662#define UI_HANDLER_CANCEL      ((UINT32)~0)
r5955r5956
98114    MACROS
99115***************************************************************************/
100116
101#define ui_draw_message_window(text) ui_draw_text_box(text, JUSTIFY_LEFT, 0.5f, 0.5f, UI_FILLCOLOR)
117#define ui_draw_message_window(text) ui_draw_text_box(text, JUSTIFY_LEFT, 0.5f, 0.5f, UI_BACKGROUND_COLOR)
102118
103119
104120
src/emu/profiler.h
r5955r5956
3434/* profiling */
3535enum
3636{
37   PROFILER_END = -1,
3837   PROFILER_CPU_FIRST = 0,
3938   PROFILER_CPU_MAX = PROFILER_CPU_FIRST + 32,
4039   PROFILER_MEMREAD,
r5955r5956
5958   PROFILER_USER2,
6059   PROFILER_USER3,
6160   PROFILER_USER4,
61   PROFILER_USER5,
62   PROFILER_USER6,
63   PROFILER_USER7,
64   PROFILER_USER8,
6265
6366   PROFILER_PROFILER,
6467   PROFILER_IDLE,
src/emu/input.c
r5955r5956
13571357   if (item != NULL && item->token != NULL)
13581358      devcode = astring_c(item->token);
13591359   else
1360   {
13601361      devcode = code_to_string(itemid_token_table, INPUT_CODE_ITEMID(code));
1361   assert(devcode != NULL);
1362      if (devcode == NULL)
1363         devcode = "UNKNOWN";
1364   }
13621365
13631366   /* determine the modifier part */
13641367   modifier = code_to_string(modifier_token_table, INPUT_CODE_MODIFIER(code));
src/emu/driver.h
r5955r5956
2121
2222#include "devintrf.h"
2323
24#define DRIVER_INIT(name)         void driver_init_##name(running_machine *machine)
25#define DRIVER_INIT_CALL(name)      driver_init_##name(machine)
24#define DRIVER_INIT_NAME(name)      driver_init_##name
25#define DRIVER_INIT(name)         void DRIVER_INIT_NAME(name)(running_machine *machine)
26#define DRIVER_INIT_CALL(name)      DRIVER_INIT_NAME(name)(machine)
2627
27#define NVRAM_HANDLER(name)         void nvram_handler_##name(running_machine *machine, mame_file *file, int read_or_write)
28#define NVRAM_HANDLER_CALL(name)   nvram_handler_##name(machine, file, read_or_write)
28#define NVRAM_HANDLER_NAME(name)   nvram_handler_##name
29#define NVRAM_HANDLER(name)         void NVRAM_HANDLER_NAME(name)(running_machine *machine, mame_file *file, int read_or_write)
30#define NVRAM_HANDLER_CALL(name)   NVRAM_HANDLER_NAME(name)(machine, file, read_or_write)
2931
30#define MEMCARD_HANDLER(name)      void memcard_handler_##name(running_machine *machine, mame_file *file, int action)
31#define MEMCARD_HANDLER_CALL(name)   memcard_handler_##name(machine, file, action)
32#define MEMCARD_HANDLER_NAME(name)   memcard_handler_##name
33#define MEMCARD_HANDLER(name)      void MEMCARD_HANDLER_NAME(name)(running_machine *machine, mame_file *file, int action)
34#define MEMCARD_HANDLER_CALL(name)   MEMCARD_HANDLER_NAME(name)(machine, file, action)
3235
33#define MACHINE_START(name)         void machine_start_##name(running_machine *machine)
34#define MACHINE_START_CALL(name)   machine_start_##name(machine)
36#define MACHINE_START_NAME(name)   machine_start_##name
37#define MACHINE_START(name)         void MACHINE_START_NAME(name)(running_machine *machine)
38#define MACHINE_START_CALL(name)   MACHINE_START_NAME(name)(machine)
3539
36#define MACHINE_RESET(name)         void machine_reset_##name(running_machine *machine)
37#define MACHINE_RESET_CALL(name)   machine_reset_##name(machine)
40#define MACHINE_RESET_NAME(name)   machine_reset_##name
41#define MACHINE_RESET(name)         void MACHINE_RESET_NAME(name)(running_machine *machine)
42#define MACHINE_RESET_CALL(name)   MACHINE_RESET_NAME(name)(machine)
3843
39#define SOUND_START(name)         void sound_start_##name(running_machine *machine)
40#define SOUND_START_CALL(name)      sound_start_##name(machine)
44#define SOUND_START_NAME(name)      sound_start_##name
45#define SOUND_START(name)         void SOUND_START_NAME(name)(running_machine *machine)
46#define SOUND_START_CALL(name)      SOUND_START_NAME(name)(machine)
4147
42#define SOUND_RESET(name)         void sound_reset_##name(running_machine *machine)
43#define SOUND_RESET_CALL(name)      sound_reset_##name(machine)
48#define SOUND_RESET_NAME(name)      sound_reset_##name
49#define SOUND_RESET(name)         void SOUND_RESET_NAME(name)(running_machine *machine)
50#define SOUND_RESET_CALL(name)      SOUND_RESET_NAME(name)(machine)
4451
45#define VIDEO_START(name)         void video_start_##name(running_machine *machine)
46#define VIDEO_START_CALL(name)      video_start_##name(machine)
52#define VIDEO_START_NAME(name)      video_start_##name
53#define VIDEO_START(name)         void VIDEO_START_NAME(name)(running_machine *machine)
54#define VIDEO_START_CALL(name)      VIDEO_START_NAME(name)(machine)
4755
48#define VIDEO_RESET(name)         void video_reset_##name(running_machine *machine)
49#define VIDEO_RESET_CALL(name)      video_reset_##name(machine)
56#define VIDEO_RESET_NAME(name)      video_reset_##name
57#define VIDEO_RESET(name)         void VIDEO_RESET_NAME(name)(running_machine *machine)
58#define VIDEO_RESET_CALL(name)      VIDEO_RESET_NAME(name)(machine)
5059
51#define PALETTE_INIT(name)         void palette_init_##name(running_machine *machine, const UINT8 *color_prom)
52#define PALETTE_INIT_CALL(name)      palette_init_##name(machine, color_prom)
60#define PALETTE_INIT_NAME(name)      palette_init_##name
61#define PALETTE_INIT(name)         void PALETTE_INIT_NAME(name)(running_machine *machine, const UINT8 *color_prom)
62#define PALETTE_INIT_CALL(name)      PALETTE_INIT_NAME(name)(machine, color_prom)
5363
54#define VIDEO_EOF(name)            void video_eof_##name(running_machine *machine)
55#define VIDEO_EOF_CALL(name)      video_eof_##name(machine)
64#define VIDEO_EOF_NAME(name)      video_eof_##name
65#define VIDEO_EOF(name)            void VIDEO_EOF_NAME(name)(running_machine *machine)
66#define VIDEO_EOF_CALL(name)      VIDEO_EOF_NAME(name)(machine)
5667
57#define VIDEO_UPDATE(name)         UINT32 video_update_##name(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect)
58#define VIDEO_UPDATE_CALL(name)      video_update_##name(screen, bitmap, cliprect)
68#define VIDEO_UPDATE_NAME(name)      video_update_##name
69#define VIDEO_UPDATE(name)         UINT32 VIDEO_UPDATE_NAME(name)(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect)
70#define VIDEO_UPDATE_CALL(name)      VIDEO_UPDATE_NAME(name)(screen, bitmap, cliprect)
5971
6072
6173/* NULL versions */
62#define nvram_handler_NULL          NULL
63#define memcard_handler_NULL      NULL
64#define machine_start_NULL          NULL
65#define machine_reset_NULL          NULL
66#define sound_start_NULL          NULL
67#define sound_reset_NULL          NULL
68#define video_start_NULL          NULL
69#define video_reset_NULL          NULL
70#define palette_init_NULL         NULL
71#define video_eof_NULL             NULL
72#define video_update_NULL          NULL
74#define driver_init_0            NULL
75#define nvram_handler_0          NULL
76#define memcard_handler_0         NULL
77#define machine_start_0          NULL
78#define machine_reset_0          NULL
79#define sound_start_0             NULL
80#define sound_reset_0             NULL
81#define video_start_0             NULL
82#define video_reset_0             NULL
83#define palette_init_0            NULL
84#define video_eof_0             NULL
85#define video_update_0             NULL
7386
7487
7588typedef void   (*driver_init_func)(running_machine *machine);
r5955r5956
185198    MACROS FOR BUILDING GAME DRIVERS
186199***************************************************************************/
187200
201#define GAME_NAME(name) driver_##name
202#define GAME_EXTERN(name) extern const game_driver GAME_NAME(name)
203
188204#define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS)   \
189205   GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0))
190206
191207#define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT)   \
192extern const game_driver driver_##NAME;      \
193const game_driver driver_##NAME =         \
208const game_driver GAME_NAME(NAME) =         \
194209{                                 \
195210   __FILE__,                        \
196211   #PARENT,                        \
r5955r5956
198213   FULLNAME,                        \
199214   #YEAR,                           \
200215   COMPANY,                        \
201   machine_config_##MACHINE,            \
202   ipt_##INPUT,                     \
203   driver_init_##INIT,                  \
204   rom_##NAME,                        \
216   MACHINE_DRIVER_NAME(MACHINE),            \
217   INPUT_PORTS_NAME(INPUT),                     \
218   DRIVER_INIT_NAME(INIT),                  \
219   ROM_NAME(NAME),                        \
205220   (MONITOR)|(FLAGS),                  \
206221   &LAYOUT[0]                        \
207222};
208223
209/* this allows to leave the INIT field empty in the GAME() macro call */
210#define driver_init_0 0
211#define ipt_0 0
212224
213225
214
215226/***************************************************************************
216227    GLOBAL VARIABLES
217228***************************************************************************/
218229
219230extern const game_driver * const drivers[];
220231
221extern const game_driver driver_empty;
232GAME_EXTERN(empty);
222233
223234
224235
src/emu/drawgfx.h
r5955r5956
8282
8383
8484/* these macros are used for declaring gfx_decode_entry_entry info arrays. */
85#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry gfxdecodeinfo_##name[]
86#define GFXDECODE_START( name ) const gfx_decode_entry gfxdecodeinfo_##name[] = {
85#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
86#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
87#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
8788#define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0, 0 },
8889#define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale },
8990#define GFXDECODE_END { 0 } };
src/emu/mconfig.h
r5955r5956
191191
192192/* use this to declare external references to a machine driver */
193193#define MACHINE_DRIVER_EXTERN(_name) \
194   extern const machine_config_token machine_config_##_name[]
194   extern const machine_config_token MACHINE_DRIVER_NAME(_name)[]
195195
196196
197197/* importing data from other machine drivers */
198198#define MDRV_IMPORT_FROM(_name) \
199199   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \
200   TOKEN_PTR(tokenptr, machine_config_##_name),
200   TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)),
201201
202202
203203/* core parameters */
r5955r5956
223223/* core functions */
224224#define MDRV_MACHINE_START(_func) \
225225   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \
226   TOKEN_PTR(machine_start, machine_start_##_func),
226   TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)),
227227
228228#define MDRV_MACHINE_RESET(_func) \
229229   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_RESET, 8), \
230   TOKEN_PTR(machine_reset, machine_reset_##_func),
230   TOKEN_PTR(machine_reset, MACHINE_RESET_NAME(_func)),
231231
232232#define MDRV_NVRAM_HANDLER(_func) \
233233   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_NVRAM_HANDLER, 8), \
234   TOKEN_PTR(nvram_handler, nvram_handler_##_func),
234   TOKEN_PTR(nvram_handler, NVRAM_HANDLER_NAME(_func)),
235235
236236#define MDRV_MEMCARD_HANDLER(_func) \
237237   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MEMCARD_HANDLER, 8), \
238   TOKEN_PTR(memcard_handler, memcard_handler_##_func),
238   TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)),
239239
240240
241241/* core video parameters */
r5955r5956
244244
245245#define MDRV_GFXDECODE(_gfx) \
246246   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_GFXDECODE, 8), \
247   TOKEN_PTR(gfxdecode, gfxdecodeinfo_##_gfx),
247   TOKEN_PTR(gfxdecode, GFXDECODE_NAME(_gfx)),
248248
249249#define MDRV_PALETTE_LENGTH(_length) \
250250   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_PALETTE_LENGTH, 8, _length, 24),
r5955r5956
257257/* core video functions */
258258#define MDRV_PALETTE_INIT(_func) \
259259   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \
260   TOKEN_PTR(palette_init, palette_init_##_func),
260   TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)),
261261
262262#define MDRV_VIDEO_START(_func) \
263263   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_START, 8), \
264   TOKEN_PTR(video_start, video_start_##_func),
264   TOKEN_PTR(video_start, VIDEO_START_NAME(_func)),
265265
266266#define MDRV_VIDEO_RESET(_func) \
267267   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_RESET, 8), \
268   TOKEN_PTR(video_reset, video_reset_##_func),
268   TOKEN_PTR(video_reset, VIDEO_RESET_NAME(_func)),
269269
270270#define MDRV_VIDEO_EOF(_func) \
271271   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_EOF, 8), \
272   TOKEN_PTR(video_eof, video_eof_##_func),
272   TOKEN_PTR(video_eof, VIDEO_EOF_NAME(_func)),
273273
274274#define MDRV_VIDEO_UPDATE(_func) \
275275   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_UPDATE, 8), \
276   TOKEN_PTR(video_update, video_update_##_func),
276   TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)),
277277
278278
279279/* core sound functions */
280280#define MDRV_SOUND_START(_func) \
281281   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \
282   TOKEN_PTR(sound_start, sound_start_##_func),
282   TOKEN_PTR(sound_start, SOUND_START_NAME(_func)),
283283
284284#define MDRV_SOUND_RESET(_func) \
285285   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_RESET, 8), \
286   TOKEN_PTR(sound_start, sound_reset_##_func),
286   TOKEN_PTR(sound_start, SOUND_RESET_NAME(_func)),
287287
288288
289289/* add/remove devices */
src/mess/devices/cassette.c
r5955r5956
377377      (int) length);
378378
379379   /* draw the cassette */
380   ui_draw_text_box(buf, JUSTIFY_LEFT, x, y, UI_FILLCOLOR);
380   ui_draw_text_box(buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR);
381381}
382382
383383
src/mess/filemngr.c
r5955r5956
170170   }
171171
172172   /* draw a box */
173   ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
173   ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
174174
175175   /* take off the borders */
176176   x1 += UI_BOX_LR_BORDER;
src/mess/drivers/oric.c
r5955r5956
430430   MDRV_CPU_PROGRAM_MAP( telestrat_mem)
431431
432432   MDRV_MACHINE_START( telestrat )
433   MDRV_MACHINE_RESET( NULL )
434433
435434   /* acia */
436435   MDRV_ACIA6551_ADD("acia")
src/mess/drivers/a310.c
r5955r5956
8585}
8686
8787static ADDRESS_MAP_START( a310_mem, ADDRESS_SPACE_PROGRAM, 32 )
88   AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(memc_logical_r, memc_logical_w)
89   AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */
90   AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(ioc_r, ioc_w)
91   AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(vidc_r, vidc_w)
92   AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(memc_r, memc_w)
93   AM_RANGE(0x03800000, 0x03ffffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(memc_page_w)
88   AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w)
89   AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&archimedes_memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */
90   AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w)
91   AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w)
92   AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w)
93   AM_RANGE(0x03800000, 0x03ffffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(archimedes_memc_page_w)
9494ADDRESS_MAP_END
9595
9696
docs/messnew.txt
r5955r5956
6464
6565Source Changes:
6666----------------
67- The core is based on MAME 0.134u1.  This incorporates all features of the
67- The core is based on MAME 0.134u2.  This incorporates all features of the
6868  update to this core.  [MAME team]
6969
7070- Moved implementation to device.  [Miodrag Milanovic]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team