Previous 15994 Revisions Next

r5892 Saturday 26th September, 2009 at 12:18:31 UTC by Nathan Woods
Updated to MAME 0.134u1 core
[ROOT]makefile
[docs]messnew.txt
[src/emu]devintrf.c eigccx86.h emuopts.h info.c mame.c memory.c memory.h uimenu.c
[src/emu/cpu/arm7]arm7dasm.c arm7exec.c
[src/emu/cpu/dsp56k]dsp56dsm.c dsp56ops.c
[src/emu/cpu/i386]i386ops.c i386priv.h
[src/emu/cpu/i86]i86priv.h
[src/emu/cpu/m68000]m68kcpu.h
[src/emu/cpu/nec]necpriv.h
[src/emu/cpu/s2650]s2650.c s2650.h
[src/emu/cpu/sh4]sh4.c sh4comn.c
[src/emu/cpu/v30mz]v30mz.h
[src/emu/debug]debugcmd.c debugcpu.c debughlp.c
[src/emu/drivers]xtal.h
[src/emu/machine]6532riot.c 6532riot.h generic.c
[src/emu/sound]cdp1863.c cdp1863.h cdp1864.c cdp1864.h disc_dev.c disc_flt.c disc_mth.c disc_wav.c discrete.c discrete.h tms5110.c tms5110.h tms5220.c tms5220.h ymf271.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]8080bw.c asteroid.c atarifb.c atarijsa.c bsktball.c bzone.c canyon.c circus.c crbaloon.c dkong.c dragrace.c exidy.c firetrk.c galaga.c galaxian.c gottlieb.c grchamp.c hitme.c jedi.c llander.c m79amb.c madalien.c mario.c mw8080bw.c nitedrvr.c norautp.c orbit.c phoenix.c polepos.c poolshrk.c skydiver.c skyraid.c* snes.c spiders.c sprint2.c sprint4.c starshp1.c starwars.c subs.c tank8.c triplhnt.c vicdual.c
[src/mame/drivers]amaticmg.c* atarisy1.c atarisy2.c bogeyman.c btime.c cbuster.c chinagat.c cvs.c dkong.c esripsys.c exzisus.c f1gp.c firefox.c gameplan.c gauntlet.c goldnpkr.c hikaru.c jangou.c kaneko16.c looping.c m92.c midtunit.c mirax.c multfish.c namcoic.c namcos11.c namcos2.c namcos22.c namcos23.c naomi.c neodrvr.c nmk16.c nova2001.c photon2.c segas16b.c skyraid.c spiders.c taito_f2.c taito_f3.c tgtpanic.c* toaplan1.c toaplan2.c tomcat.c tourtabl.c twin16.c wiz.c xmen.c zaccaria.c
[src/mame/includes]atari.h dkong.h skyraid.h* taito_f2.h
[src/mame/machine]cx4data.c cx4oam.c cx4ops.c mhavoc.c naomibd.c neocrypt.c snes.c snescx4.c snescx4.h
[src/mame/video]konamiic.c namcona1.c neogeo.c segaic24.c taito_f2.c taitoic.c vigilant.c
[src/mess]mess.mak
[src/mess/drivers]a2600.c aim65.c beta.c geneve.c junior.c osi.c ti99_4p.c ti99_4x.c ti99_8.c
[src/mess/includes]aim65.h
[src/mess/machine]a7800.c aim65.c bbc.c geneve.c sym1.c ti99_4x.c
[src/osd/windows]windows.mak

src/mame/audio/skydiver.c
r5891r5892
124124   /* a 68k resistor and 22uf capacitor.           */
125125   /************************************************/
126126   DISCRETE_ADJUSTMENT_TAG(NODE_30, 250000, 50000, DISC_LINADJ, "WHISTLE1")   /* R66 */
127   DISCRETE_MULTADD(NODE_31, 1, SKYDIVER_WHISTLE1_EN, 3.05-0.33, 0.33)
127   DISCRETE_MULTADD(NODE_31, SKYDIVER_WHISTLE1_EN, 3.05-0.33, 0.33)
128128   DISCRETE_RCDISC2(NODE_32, SKYDIVER_WHISTLE1_EN, NODE_31, 1.0, NODE_31, 68000.0, 2.2e-5)   /* CV */
129129   DISCRETE_SWITCH(NODE_33, 1, SKYDIVER_OCT1_EN, 1e-8, 1e-8 + 3.3e-9)   /* Cap C73 & C58 */
130130   DISCRETE_555_ASTABLE_CV(NODE_34, SKYDIVER_WHISTLE1_EN, 100000, NODE_30, NODE_33, NODE_32, &skydiverWhistl555)
131   DISCRETE_MULTIPLY(SKYDIVER_WHISTLE1_SND, SKYDIVER_WHISTLE1_EN, NODE_34, 228.5/3.3)
131   DISCRETE_MULTIPLY(SKYDIVER_WHISTLE1_SND, NODE_34, 228.5/3.3)
132132
133133   DISCRETE_ADJUSTMENT_TAG(NODE_35, 250000, 50000, DISC_LINADJ, "WHISTLE2")   /* R65 */
134   DISCRETE_MULTADD(NODE_36, 1, SKYDIVER_WHISTLE2_EN, 3.05-0.33, 0.33)
134   DISCRETE_MULTADD(NODE_36, SKYDIVER_WHISTLE2_EN, 3.05-0.33, 0.33)
135135   DISCRETE_RCDISC2(NODE_37, SKYDIVER_WHISTLE2_EN, NODE_36, 1.0, NODE_36, 68000.0, 2.2e-5)   /* CV */
136136   DISCRETE_SWITCH(NODE_38, 1, SKYDIVER_OCT2_EN, 1e-8, 1e-8 + 3.3e-9)   /* Cap C72 & C59 */
137137   DISCRETE_555_ASTABLE_CV(NODE_39, SKYDIVER_WHISTLE2_EN, 100000, NODE_35, NODE_38, NODE_37, &skydiverWhistl555)
138   DISCRETE_MULTIPLY(SKYDIVER_WHISTLE2_SND, SKYDIVER_WHISTLE2_EN, NODE_39, 228.5/3.3)
138   DISCRETE_MULTIPLY(SKYDIVER_WHISTLE2_SND, NODE_39, 228.5/3.3)
139139
140140   /************************************************/
141141   /* Final mix and output.                        */
src/mame/audio/snes.c
r5891r5892
179179                                    /* Returns SUSTAIN rate         */
180180
181181/* Handle endianness */
182#ifndef LSB_FIRST
183#define LEtoME16( x )                                                \
184    ( ( ( ( x ) >> 8 ) & 0xFF ) | ( ( ( x ) << 8 ) & 0xFF00 ) )
185#define MEtoLE16( x )                                                \
186    ( ( ( ( x ) >> 8 ) & 0xFF ) | ( ( ( x ) << 8 ) & 0xFF00 ) )
187#else
188#define LEtoME16( x )   ( x )
189#define MEtoLE16( x )   ( x )
190#endif
182#define LEtoME16( x ) LITTLE_ENDIANIZE_INT16(x)
183#define MEtoLE16( x ) LITTLE_ENDIANIZE_INT16(x)
191184
192185/*========== PROCEDURES ==========*/
193186
src/mame/audio/spiders.c
r5891r5892
22
33    Sigma Spiders hardware
44
5To Do: add filters
6
57***************************************************************************/
68
79#include "driver.h"
r5891r5892
121123   /* Web sound */
122124   DISCRETE_NOTE(NODE_20, 1, SPIDERS_SOUND_CLK/8, SPIDERS_WEB_SOUND_DATA, 255, 15, DISC_CLK_IS_FREQ)
123125    DISCRETE_TRANSFORM2(NODE_21, NODE_20, SPIDER_WEB_SOUND_MOD_DATA, "01&")
124   DISCRETE_DAC_R1(NODE_22, 1, NODE_21, DEFAULT_TTL_V_LOGIC_1, &spiders_sound_dac)
126   DISCRETE_DAC_R1(NODE_22, NODE_21, DEFAULT_TTL_V_LOGIC_1, &spiders_sound_dac)
125127
126128   /* Noise */
127129   /* LFSR NOISE Should be 3 MHz, but setting it to 6KHz should make no difference (except wasting less CPU cycles) since we sample it
128130    at 3.75 kHz */
129131   DISCRETE_LFSR_NOISE(NODE_30, 1, 1, SPIDERS_SOUND_CLK/(1000), 1, 0, 0.5, &spiders_lfsr)
130132    DISCRETE_SQUAREWFIX(NODE_31, 1, SPIDERS_SOUND_CLK/(10*10*16),1, 50.0, 0.5, 0)   /* 3.75 kHz */
131   DISCRETE_SAMPLHOLD(NODE_32,1,NODE_30,NODE_31,DISC_SAMPHOLD_REDGE)
133   DISCRETE_SAMPLHOLD(NODE_32,NODE_30,NODE_31,DISC_SAMPHOLD_REDGE)
132134
133135   /* Fire */
134   DISCRETE_DAC_R1(NODE_40, 1, NODE_32, DEFAULT_TTL_V_LOGIC_1, &spiders_fire_dac)
136   DISCRETE_DAC_R1(NODE_40, NODE_32, DEFAULT_TTL_V_LOGIC_1, &spiders_fire_dac)
135137
136138   // Fire envelope
137   DISCRETE_MULTIPLY(NODE_41, 1, DEFAULT_TTL_V_LOGIC_1, SPIDERS_FIRE_EN)
139   DISCRETE_MULTIPLY(NODE_41, DEFAULT_TTL_V_LOGIC_1, SPIDERS_FIRE_EN)
138140   DISCRETE_RCFILTER(NODE_42, 1, NODE_41,RES_K(2.2),CAP_U(47)) //R11, C11
139141   DISCRETE_TRANSFORM4(NODE_43, NODE_40, NODE_42, 2.5, 24.5,"012*3/-")
140142
141143   DISCRETE_555_ASTABLE_CV(NODE_44, 1, RES_K(10), RES_K(22), CAP_N(100), NODE_43, &spiders_fire_555a) //R10, R18, C12
142   DISCRETE_MULTIPLY(NODE_45, 1, DEFAULT_TTL_V_LOGIC_1-0.7, SPIDERS_FIRE_EN) // Diode drop D2
143   DISCRETE_ASWITCH(NODE_46,1, NODE_44, NODE_45, DISC_CD4066_THRESHOLD)
144   DISCRETE_MULTIPLY(NODE_45, DEFAULT_TTL_V_LOGIC_1-0.7, SPIDERS_FIRE_EN) // Diode drop D2
145   DISCRETE_ASWITCH(NODE_46, NODE_44, NODE_45, DISC_CD4066_THRESHOLD)
144146
145147   /* Explosion */
146   DISCRETE_MULTIPLY(NODE_50, 1, DEFAULT_TTL_V_LOGIC_1, SPIDERS_EXP_EN)
148   DISCRETE_MULTIPLY(NODE_50, DEFAULT_TTL_V_LOGIC_1, SPIDERS_EXP_EN)
147149    DISCRETE_RCDISC5(NODE_51, 1, NODE_50, RES_M(1),CAP_U(0.47)) //R51, C8
148   DISCRETE_MULTIPLY(NODE_52, 1, DEFAULT_TTL_V_LOGIC_1, NODE_32) // Noise 0/1 -> TTL
149    DISCRETE_ASWITCH(NODE_53, 1, NODE_52, NODE_51, DISC_CD4066_THRESHOLD)
150   DISCRETE_MULTIPLY(NODE_52, DEFAULT_TTL_V_LOGIC_1, NODE_32) // Noise 0/1 -> TTL
151    DISCRETE_ASWITCH(NODE_53, NODE_52, NODE_51, DISC_CD4066_THRESHOLD)
150152
151153   /*Super web explosion*/
152    DISCRETE_DAC_R1(NODE_60, 1, NODE_32, DEFAULT_TTL_V_LOGIC_1, &spiders_web_exp_dac)
154    DISCRETE_DAC_R1(NODE_60, NODE_32, DEFAULT_TTL_V_LOGIC_1, &spiders_web_exp_dac)
153155   DISCRETE_555_ASTABLE_CV(NODE_61, 1, RES_K(10), RES_K(22), CAP_N(22), NODE_60, &spiders_fire_555a)  //R48, R47, C24
154   DISCRETE_MULTIPLY(NODE_62, 1, DEFAULT_TTL_V_LOGIC_1, SPIDERS_SUPER_WEB_EXPL_EN)
156   DISCRETE_MULTIPLY(NODE_62, DEFAULT_TTL_V_LOGIC_1, SPIDERS_SUPER_WEB_EXPL_EN)
155157    DISCRETE_RCDISC5(NODE_63, 1, NODE_62, RES_M(1),CAP_U(0.47)) //R9, C9
156   DISCRETE_ASWITCH(NODE_64, 1, NODE_61, NODE_63, DISC_CD4066_THRESHOLD)
158   DISCRETE_ASWITCH(NODE_64, NODE_61, NODE_63, DISC_CD4066_THRESHOLD)
157159
158160   /*Super web */
159161   DISCRETE_555_ASTABLE_CV(NODE_70, 1, RES_K(330), 0, CAP_U(1), -1, &spiders_super_web_555a) //R46, C23
160    DISCRETE_MULTIPLY(NODE_71, 1, 57/47, NODE_70) // R27, R28
162    DISCRETE_MULTIPLY(NODE_71, 57/47, NODE_70) // R27, R28
161163   DISCRETE_555_ASTABLE_CV(NODE_72, SPIDERS_SUPER_WEB_EN, RES_K(100), RES_K(330), CAP_U(0.01), NODE_71, &spiders_super_web_555a) //R22, R33, C16
162164    DISCRETE_555_ASTABLE_CV(NODE_73, SPIDERS_X_EN, RES_K(100), RES_K(470), CAP_N(47), NODE_71, &spiders_super_web_555a) // R23, R32, C15
163165
src/mame/audio/phoenix.c
r5891r5892
367367               DEFAULT_TTL_V_LOGIC_1,
368368               DEFAULT_TTL_V_LOGIC_1 * RES_K(100) / (RES_K(10) + RES_K(100)))   /* R20, R19 */
369369   DISCRETE_MULTIPLY(NODE_24,
370                 1,                  /* ENAB */
371370                 NODE_22,
372371                 NODE_23)
373372   DISCRETE_RCFILTER(NODE_25,
r5891r5892
457456              1,                     /* Maximum count of second counter 0-1 (IC21) */
458457              DISC_CLK_BY_COUNT | DISC_OUT_IS_ENERGY)
459458   DISCRETE_MULTIPLY(PHOENIX_EFFECT_2_SND,
460                 1,                  /* ENAB */
461459                 NODE_40,               /* IC21 pin 9 output */
462460                 NODE_32)               /* voltage level selected by high bit of PHOENIX_EFFECT_2_FREQ */
463461
src/mame/audio/llander.c
r5891r5892
6565
6666   DISCRETE_SQUAREWFIX(LLANDER_TONE_6K_SND, LLANDER_TONE6K_EN, 6000, 9.2, 50, 0, 0)   // 6KHz
6767
68   DISCRETE_MULTIPLY(NODE_30, 1, LLANDER_NOISE, LLANDER_THRUST_DATA)   // Mix in 12KHz Noise source for thrust
68   DISCRETE_MULTIPLY(NODE_30, LLANDER_NOISE, LLANDER_THRUST_DATA)   // Mix in 12KHz Noise source for thrust
6969   /* TBD - replace this line with a Sallen-Key Bandpass macro */
7070   DISCRETE_FILTER2(NODE_31, 1, NODE_30, 89.5, (1.0 / 7.6), DISC_FILTER_BANDPASS)
71   DISCRETE_MULTIPLY(NODE_32, LLANDER_EXPLOD_EN, NODE_30, 1000.0/600.0)   // Explode adds original noise source onto filtered source
72   DISCRETE_ADDER2(NODE_33, 1, NODE_31, NODE_32)
71   DISCRETE_MULTIPLY(NODE_32, NODE_30, 1000.0/600.0)   // Explode adds original noise source onto filtered source
72   DISCRETE_ONOFF(NODE_33, LLANDER_EXPLOD_EN, NODE_32)
73   DISCRETE_ADDER2(NODE_34, 1, NODE_31, NODE_33)
7374   /* TBD - replace this line with a Active Lowpass macro */
74   DISCRETE_FILTER1(LLANDER_THRUST_EXPLOD_SND, 1, NODE_33, 560, DISC_FILTER_LOWPASS)
75   DISCRETE_FILTER1(LLANDER_THRUST_EXPLOD_SND, 1, NODE_34, 560, DISC_FILTER_LOWPASS)
7576
7677   DISCRETE_ADDER3(NODE_90, 1, LLANDER_TONE_3K_SND, LLANDER_TONE_6K_SND, LLANDER_THRUST_EXPLOD_SND)   // Mix all four sound sources
7778   DISCRETE_GAIN(NODE_91, NODE_90, 65534.0/(9.2+9.2+600+1000))
src/mame/audio/grchamp.c
r5891r5892
5050   DISCRETE_INPUT_DATA (GRCHAMP_A_DATA)
5151   DISCRETE_INPUT_DATA (GRCHAMP_B_DATA)
5252
53   DISCRETE_DAC_R1(NODE_20, 1, GRCHAMP_A_DATA, DEFAULT_TTL_V_LOGIC_1, &grchamp_sound_dac1)
53   DISCRETE_DAC_R1(NODE_20, GRCHAMP_A_DATA, DEFAULT_TTL_V_LOGIC_1, &grchamp_sound_dac1)
5454
55   DISCRETE_DAC_R1(NODE_21, 1, GRCHAMP_B_DATA, DEFAULT_TTL_V_LOGIC_1, &grchamp_sound_dac2)
55   DISCRETE_DAC_R1(NODE_21, GRCHAMP_B_DATA, DEFAULT_TTL_V_LOGIC_1, &grchamp_sound_dac2)
5656
5757    DISCRETE_ADDER4(NODE_89, 1, 0, NODE_20, NODE_21, 0)
5858
src/mame/audio/galaxian.c
r5891r5892
275275      /* Background                                   */
276276      /************************************************/
277277
278      DISCRETE_DAC_R1(NODE_100, 1, GAL_INP_BG_DAC, TTL_OUT, &galaxian_bck_dac)
278      DISCRETE_DAC_R1(NODE_100, GAL_INP_BG_DAC, TTL_OUT, &galaxian_bck_dac)
279279      DISCRETE_555_CC(NODE_105, 1, NODE_100, GAL_R21, GAL_C15, 0, 0, 0, &galaxian_bck_vco)
280280      // Next is mult/add opamp circuit
281      DISCRETE_MULTADD(NODE_110, 1, NODE_105, GAL_R33/RES_3_PARALLEL(GAL_R31,GAL_R32,GAL_R33),
281      DISCRETE_MULTADD(NODE_110, NODE_105, GAL_R33/RES_3_PARALLEL(GAL_R31,GAL_R32,GAL_R33),
282282            -5.0*GAL_R33/GAL_R31)
283283      DISCRETE_CLAMP(NODE_111,1,NODE_110,0.0,5.0,0.0)
284284      // The three 555
r5891r5892
324324         */
325325       DISCRETE_LFSR_NOISE(NODE_150, 1, 1, RNG_RATE/100, 1.0, 0, 0.5, &galaxian_lfsr)
326326      DISCRETE_SQUAREWFIX(NODE_151,1,60*264/2,1.0,50,0.5,0)  /* 2V signal */
327      DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,1,NODE_151,NODE_150)
327      DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,NODE_151,NODE_150)
328328
329329
330330      /* Not 100% correct - switching causes high impedance input for node_157
r5891r5892
336336      /* FIRE                                         */
337337      /************************************************/
338338
339      DISCRETE_LOGIC_INVERT(NODE_170, 1, GAL_INP_FIRE)
340      DISCRETE_MULTIPLY(NODE_171, 1, TTL_OUT, GAL_INP_FIRE)
341      DISCRETE_MULTIPLY(NODE_172, 1, TTL_OUT, NODE_170) // inverted
339      DISCRETE_LOGIC_INVERT(NODE_170, GAL_INP_FIRE)
340      DISCRETE_MULTIPLY(NODE_171, TTL_OUT, GAL_INP_FIRE)
341      DISCRETE_MULTIPLY(NODE_172, TTL_OUT, NODE_170) // inverted
342342      DISCRETE_RCFILTER(NODE_173, 1, NODE_172, GAL_R47, GAL_C28)
343343      /* Mix noise and 163 */
344344      DISCRETE_TRANSFORM5(NODE_177, NODE_152, TTL_OUT, 1.0/GAL_R46, NODE_173, 1.0/GAL_R48,
r5891r5892
347347      //DISCRETE_MULTIPLY(NODE_175, 1, 1.0/GAL_R46, NODE_174)
348348      //DISCRETE_MULTIPLY(NODE_176, 1, 1.0/GAL_R48, NODE_173)
349349      //DISCRETE_ADDER2(NODE_177, 1, NODE_175, NODE_176)
350      DISCRETE_MULTIPLY(NODE_178, 1, RES_2_PARALLEL(GAL_R46, GAL_R48), NODE_177)
350      DISCRETE_MULTIPLY(NODE_178, RES_2_PARALLEL(GAL_R46, GAL_R48), NODE_177)
351351
352352      DISCRETE_555_ASTABLE_CV(NODE_181, 1, GAL_R44, GAL_R45, GAL_C27, NODE_178, &galaxian_555_fire_vco_desc)
353353
src/mame/audio/canyon.c
r5891r5892
124124   /************************************************/
125125   DISCRETE_RCFILTER(NODE_20, 1, CANYON_MOTOR1_DATA, 123000, 1e-6)
126126   DISCRETE_ADJUSTMENT_TAG(NODE_21, (214.0-27.0)/12/15, (4416.0-27.0)/12/15, DISC_LOGADJ, "MOTOR1")
127   DISCRETE_MULTIPLY(NODE_22, 1, NODE_20, NODE_21)
127   DISCRETE_MULTIPLY(NODE_22, NODE_20, NODE_21)
128128
129   DISCRETE_MULTADD(NODE_23, 1, NODE_22, 2, 27.0/6)   /* F1 = /12*2 = /6 */
129   DISCRETE_MULTADD(NODE_23, NODE_22, 2, 27.0/6)   /* F1 = /12*2 = /6 */
130130   DISCRETE_SQUAREWAVE(NODE_24, 1, NODE_23, (142.9/3), 50.0, 0, 0)
131131   DISCRETE_RCFILTER(NODE_25, 1, NODE_24, 10000, 1e-7)
132132
133   DISCRETE_MULTADD(NODE_26, 1, NODE_22, 3, 27.0/4)   /* F2 = /12*3 = /4 */
133   DISCRETE_MULTADD(NODE_26, NODE_22, 3, 27.0/4)   /* F2 = /12*3 = /4 */
134134   DISCRETE_SQUAREWAVE(NODE_27, 1, NODE_26, (142.9/3), 50.0, 0, 0)
135135   DISCRETE_RCFILTER(NODE_28, 1, NODE_27, 10000, 1e-7)
136136
137   DISCRETE_MULTADD(NODE_29, 1, NODE_22, 4, 27.0/3)   /* F3 = /12*4 = /3 */
137   DISCRETE_MULTADD(NODE_29, NODE_22, 4, 27.0/3)   /* F3 = /12*4 = /3 */
138138   DISCRETE_SQUAREWAVE(NODE_30, 1, NODE_29, (142.9/3), 100.0/3, 0, 360.0/3)
139139   DISCRETE_RCFILTER(NODE_31, 1, NODE_30, 10000, 1e-7)
140140
r5891r5892
147147   /************************************************/
148148   DISCRETE_RCFILTER(NODE_40, 1, CANYON_MOTOR2_DATA, 123000, 1e-6)
149149   DISCRETE_ADJUSTMENT_TAG(NODE_41, (214.0-27.0)/12/15, (4416.0-27.0)/12/15, DISC_LOGADJ, "MOTOR2")
150   DISCRETE_MULTIPLY(NODE_42, 1, NODE_40, NODE_41)
150   DISCRETE_MULTIPLY(NODE_42, NODE_40, NODE_41)
151151
152   DISCRETE_MULTADD(NODE_43, 1, NODE_42, 2, 27.0/6)   /* F1 = /12*2 = /6 */
152   DISCRETE_MULTADD(NODE_43, NODE_42, 2, 27.0/6)   /* F1 = /12*2 = /6 */
153153   DISCRETE_SQUAREWAVE(NODE_44, 1, NODE_43, (142.9/3), 50.0, 0, 0)
154154   DISCRETE_RCFILTER(NODE_45, 1, NODE_44, 10000, 1e-7)
155155
156   DISCRETE_MULTADD(NODE_46, 1, NODE_42, 3, 27.0/4)   /* F2 = /12*3 = /4 */
156   DISCRETE_MULTADD(NODE_46, NODE_42, 3, 27.0/4)   /* F2 = /12*3 = /4 */
157157   DISCRETE_SQUAREWAVE(NODE_47, 1, NODE_46, (142.9/3), 50.0, 0, 0)
158158   DISCRETE_RCFILTER(NODE_48, 1, NODE_47, 10000, 1e-7)
159159
160   DISCRETE_MULTADD(NODE_49, 1, NODE_42, 4, 27.0/3)   /* F3 = /12*4 = /3 */
160   DISCRETE_MULTADD(NODE_49, NODE_42, 4, 27.0/3)   /* F3 = /12*4 = /3 */
161161   DISCRETE_SQUAREWAVE(NODE_50, 1, NODE_49, (142.9/3), 100.0/3, 0, 360.0/3)
162162   DISCRETE_RCFILTER(NODE_51, 1, NODE_50, 10000, 1e-7)
163163
r5891r5892
172172   /* Output is binary weighted with 4 bits of     */
173173   /* crash volume.                                */
174174   /************************************************/
175   DISCRETE_LOGIC_OR(NODE_60, 1, CANYON_ATTRACT1_EN, CANYON_ATTRACT2_EN)
175   DISCRETE_LOGIC_OR(NODE_60, CANYON_ATTRACT1_EN, CANYON_ATTRACT2_EN)
176176   DISCRETE_LFSR_NOISE(CANYON_NOISE, NODE_60, NODE_60, 15750.0/4, 1.0, 0, 0, &canyon_lfsr)
177177
178   DISCRETE_MULTIPLY(NODE_61, 1, CANYON_NOISE, CANYON_EXPLODE_DATA)
178   DISCRETE_MULTIPLY(NODE_61, CANYON_NOISE, CANYON_EXPLODE_DATA)
179179   DISCRETE_RCFILTER(CANYON_EXPLODESND, 1, NODE_61, 545, 5e-6)
180180
181181   /************************************************/
r5891r5892
188188   /* a 68k resistor and 22uf capacitor.           */
189189   /************************************************/
190190   DISCRETE_ADJUSTMENT_TAG(NODE_70, 50000, 100000, DISC_LINADJ, "WHISTLE1")   /* R59 */
191   DISCRETE_MULTADD(NODE_71, 1, CANYON_WHISTLE1_EN, 3.05-0.33, 0.33)
191   DISCRETE_MULTADD(NODE_71, CANYON_WHISTLE1_EN, 3.05-0.33, 0.33)
192192   DISCRETE_RCDISC2(NODE_72, CANYON_WHISTLE1_EN, NODE_71, 1.0, NODE_71, 68000.0, 2.2e-5)   /* CV */
193193   DISCRETE_555_ASTABLE_CV(NODE_73, CANYON_WHISTLE1_EN, 33000, NODE_70, 1e-8, NODE_72, &canyonWhistl555)
194   DISCRETE_MULTIPLY(CANYON_WHISTLESND1, CANYON_WHISTLE1_EN, NODE_73, 519.4/3.3)
194   DISCRETE_MULTIPLY(CANYON_WHISTLESND1, NODE_73, 519.4/3.3)
195195
196196   DISCRETE_ADJUSTMENT_TAG(NODE_75, 50000, 100000, DISC_LINADJ, "WHISTLE2")   /* R69 */
197   DISCRETE_MULTADD(NODE_76, 1, CANYON_WHISTLE2_EN, 3.05-0.33, 0.33)
197   DISCRETE_MULTADD(NODE_76, CANYON_WHISTLE2_EN, 3.05-0.33, 0.33)
198198   DISCRETE_RCDISC2(NODE_77, CANYON_WHISTLE2_EN, NODE_76, 1.0, NODE_76, 68000.0, 2.2e-5)   /* CV */
199199   DISCRETE_555_ASTABLE_CV(NODE_78, CANYON_WHISTLE2_EN, 33000, NODE_75, 1e-8, NODE_77, &canyonWhistl555)
200   DISCRETE_MULTIPLY(CANYON_WHISTLESND2, CANYON_WHISTLE2_EN, NODE_78, 519.4/3.3)
200   DISCRETE_MULTIPLY(CANYON_WHISTLESND2, NODE_78, 519.4/3.3)
201201
202202   /************************************************/
203203   /* Combine all 5 sound sources.                 */
src/mame/audio/circus.c
r5891r5892
130130   /************************************************/
131131   /* Music is just a 1 bit DAC                    */
132132   /************************************************/
133   DISCRETE_MULTADD(CRASH_MUSIC_SND, 1, CRASH_MUSIC_BIT, CRASH_R63, 0.5)
133   DISCRETE_MULTADD(CRASH_MUSIC_SND, CRASH_MUSIC_BIT, CRASH_R63, 0.5)
134134
135135   /************************************************/
136136   /* Beeper - oneshot gates tone                  */
137137   /************************************************/
138138   DISCRETE_555_MSTABLE(NODE_30, 1, CRASH_BEEPER_EN, RES_K(22), CAP_U(.47), &crash_beeper_555m)
139139   DISCRETE_555_ASTABLE(NODE_31, NODE_30, RES_K(4.7), RES_K(4.7), CAP_U(.1), &crash_beeper_555a)
140   DISCRETE_MULTIPLY(CRASH_BEEPER_SND, 1, NODE_31, CRASH_R39)
140   DISCRETE_MULTIPLY(CRASH_BEEPER_SND, NODE_31, CRASH_R39)
141141
142142   /************************************************/
143143   /* Final mix with gain                          */
src/mame/audio/norautp.c
r5891r5892
1515#define NORAUTP_R2      RES_K(2.2)
1616
1717/* Parts List - Capacitors */
18#define NORAUTP_C1      CAP_U(.009)      /* The real value is .01, but using .009 the tone for this line is accurate */
18#define NORAUTP_C1      CAP_U(.01)
1919#define NORAUTP_C2      CAP_U(.022)
2020#define NORAUTP_C3      CAP_U(.047)
2121#define NORAUTP_C4      CAP_U(.01)
src/mame/audio/atarijsa.c
r5891r5892
226226         if (!(input_port_read(space->machine, test_port) & test_mask)) result ^= 0x80;
227227         if (atarigen_cpu_to_sound_ready) result ^= 0x40;
228228         if (atarigen_sound_to_cpu_ready) result ^= 0x20;
229         if (tms5220 == NULL || tms5220_ready_r(tms5220)) result ^= 0x10;
229         if (tms5220 == NULL || !tms5220_readyq_r(tms5220)) result ^= 0x10;
230230         break;
231231
232232      case 0x006:      /* /IRQACK */
src/mame/audio/crbaloon.c
r5891r5892
111111      /* The following will calculate the reference control voltage with no signal applied to the cap. */
112112      5.0* (1.0/(1.0/RES_K(10) + 1.0/RES_K(100))) / (RES_K(5)+(1.0/(1.0/RES_K(10) + 1.0/RES_K(100)))) )
113113   DISCRETE_555_ASTABLE_CV(NODE_12, CRBALOON_LAUGH_EN, RES_K(1), RES_K(22), CAP_U(.1), NODE_11, &desc_crbaloon_laugh_osc)
114   DISCRETE_MULTIPLY(NODE_13, 1, NODE_12, CRBALOON_VR2)
114   DISCRETE_MULTIPLY(NODE_13, NODE_12, CRBALOON_VR2)
115115   DISCRETE_CRFILTER(CRBALOON_LAUGH_SND, 1, NODE_13, RES_K(20), CAP_U(1))
116116
117117   /************************************************
118118    * Music Generator is amplitude modulated by a
119119    * linear ramp.
120120    ************************************************/
121   /* TO BE FIXED - needs proper modulation */
121122   DISCRETE_NOTE(NODE_20, 1, CRBALOON_16H / 2, CRBALOON_MUSIC_DATA, 255, 7, DISC_CLK_IS_FREQ)
122   DISCRETE_DAC_R1(NODE_21, CRBALOON_MUSIC_EN, NODE_20, DEFAULT_TTL_V_LOGIC_1, &desc_crbaloon_music_dac)
123   DISCRETE_DAC_R1(NODE_21, NODE_20, DEFAULT_TTL_V_LOGIC_1, &desc_crbaloon_music_dac)
124   DISCRETE_ONOFF(NODE_22, CRBALOON_MUSIC_EN, NODE_21)
123125//  DISCRETE_RAMP(NODE_21, 1, RAMP, GRAD, MIN, MAX, CLAMP)
124   DISCRETE_MULTIPLY(NODE_22, 1, NODE_21, CRBALOON_VR3)
125   DISCRETE_CRFILTER(CRBALOON_MUSIC_SND, 1, NODE_22, RES_K(50), CAP_U(1))
126   DISCRETE_MULTIPLY(NODE_23, NODE_22, CRBALOON_VR3)
127   DISCRETE_CRFILTER(CRBALOON_MUSIC_SND, 1, NODE_23, RES_K(50), CAP_U(1))
126128
127129   /************************************************
128130    * Final mix and output.
src/mame/audio/hitme.c
r5891r5892
6464
6565   /* This flipflop represents the latch at 1L. It is clocked when OUT1 is written and latches
6666     * the value from the processor. When the downcounter above rolls over, it clears the latch. */
67   DISCRETE_LOGIC_DFLIPFLOP(NODE_22,1,NODE_21,1,HITME_OUT1,HITME_ENABLE_VAL)
67   DISCRETE_LOGIC_DFLIPFLOP(NODE_22,NODE_21,1,HITME_OUT1,HITME_ENABLE_VAL)
6868
6969   /* The output of the latch goes through a series of various capacitors in parallel. */
7070   DISCRETE_COMP_ADDER(NODE_23,NODE_22,&desc_hitme_adder)
src/mame/audio/asteroid.c
r5891r5892
111111   /* an RC filter to perform smoothing on the     */
112112   /* output                                       */
113113   /************************************************/
114   DISCRETE_DAC_R1(NODE_30, 1, ASTEROID_THUMP_DATA, 3.5, &asteroid_thump_dac1) // CMOS
114   DISCRETE_DAC_R1(NODE_30, ASTEROID_THUMP_DATA, 3.5, &asteroid_thump_dac1) // CMOS
115115   DISCRETE_555_CC(NODE_31, ASTEROID_THUMP_EN, NODE_30, RES_K(22), CAP_U(0.22), 0, 0, RES_K(18), &asteroid_thump_555cc)
116116   DISCRETE_RCFILTER(NODE_32, 1, NODE_31, RES_K(3.3), CAP_U(0.1))
117117   DISCRETE_GAIN(ASTEROID_THUMP_SND, NODE_32, 30)
r5891r5892
129129   /* adder constants in the 2 lines below         */
130130   /************************************************/
131131   // SAUCER_SEL = 1 - larger saucer
132   DISCRETE_MULTADD(NODE_40, 1, ASTEROID_SAUCER_SEL, -2.5, 8.25)   // Saucer Warble rate (5.75 or 8.25Hz)
132   DISCRETE_MULTADD(NODE_40, ASTEROID_SAUCER_SEL, -2.5, 8.25)   // Saucer Warble rate (5.75 or 8.25Hz)
133133   DISCRETE_TRIANGLEWAVE(NODE_41, 1, NODE_40, 920.0, 920.0/2, 0)   // (amount of warble)
134134
135135   DISCRETE_TRANSFORM4(NODE_42, ASTEROID_SAUCER_SEL, -250, NODE_41, 750, "01*2+3+")   // Large saucer is 250hz lower
r5891r5892
193193   DISCRETE_DIVIDE(NODE_80, 1, 12000, ASTEROID_EXPLODE_PITCH)      /* Frequency */
194194   DISCRETE_DIVIDE(NODE_81, 1, 100, ASTEROID_EXPLODE_PITCH)      /* Duty */
195195   DISCRETE_SQUAREWFIX(NODE_82, 1, NODE_80, 1.0, NODE_81, 1.0/2, 0)   /* Pitch clock */
196   DISCRETE_SAMPLHOLD(NODE_83, 1, ASTEROID_NOISE, NODE_82, DISC_SAMPHOLD_REDGE)
197   DISCRETE_MULTIPLY(NODE_84, 1, NODE_83, ASTEROID_EXPLODE_DATA)
196   DISCRETE_SAMPLHOLD(NODE_83, ASTEROID_NOISE, NODE_82, DISC_SAMPHOLD_REDGE)
197   DISCRETE_MULTIPLY(NODE_84, NODE_83, ASTEROID_EXPLODE_DATA)
198198   DISCRETE_RCFILTER(ASTEROID_EXPLODE_SND, 1, NODE_84, 3042, 1e-6)
199199
200200   /************************************************/
r5891r5892
263263   DISCRETE_DIVIDE(NODE_80, 1, 12000, ASTEROID_EXPLODE_PITCH)      /* Frequency */
264264   DISCRETE_DIVIDE(NODE_81, 1, 100, ASTEROID_EXPLODE_PITCH)      /* Duty */
265265   DISCRETE_SQUAREWFIX(NODE_82, 1, NODE_80, 1.0, NODE_81, 1.0/2, 0)   /* Pitch clock */
266   DISCRETE_SAMPLHOLD(NODE_83, 1, ASTEROID_NOISE, NODE_82, DISC_SAMPHOLD_REDGE)
267   DISCRETE_MULTIPLY(NODE_84, 1, NODE_83, ASTEROID_EXPLODE_DATA)
266   DISCRETE_SAMPLHOLD(NODE_83, ASTEROID_NOISE, NODE_82, DISC_SAMPHOLD_REDGE)
267   DISCRETE_MULTIPLY(NODE_84, NODE_83, ASTEROID_EXPLODE_DATA)
268268   DISCRETE_RCFILTER(ASTEROID_EXPLODE_SND, 1, NODE_84, 3042, 1e-6)
269269
270270   /************************************************/
src/mame/audio/bzone.c
r5891r5892
207207
208208   DISCRETE_BITS_DECODE(NODE_32, NODE_SUB(30,1), 11, 14, 1)      /* to NAND LS20, J4 */
209209   /* 11-14 */
210   DISCRETE_LOGIC_NAND4(NODE_33,1,NODE_SUB(32,0),NODE_SUB(32,1),NODE_SUB(32,2),NODE_SUB(32,3))
210   DISCRETE_LOGIC_NAND4(NODE_33,NODE_SUB(32,0),NODE_SUB(32,1),NODE_SUB(32,2),NODE_SUB(32,3))
211211   /* divide by 2 */
212212   DISCRETE_COUNTER(NODE_34, 1, 0, NODE_33, 1, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE)
213213
r5891r5892
217217
218218   /* FIXME: +0.7 for diode */
219219   DISCRETE_RCDISC5(NODE_40, NODE_34, BZ_INP_EXPLO, BZ_R17 + BZ_R16, BZ_C14)
220   DISCRETE_MULTIPLY(NODE_41, 1, BZ_R16 / (BZ_R17 + BZ_R16), NODE_40)
220   DISCRETE_MULTIPLY(NODE_41, BZ_R16 / (BZ_R17 + BZ_R16), NODE_40)
221221
222222   /* one of two filter configurations active */
223   DISCRETE_LOGIC_INVERT(NODE_42, 1, BZ_INP_EXPLOLS)
223   DISCRETE_LOGIC_INVERT(NODE_42, BZ_INP_EXPLOLS)
224224   DISCRETE_OP_AMP_FILTER(NODE_43, BZ_INP_EXPLOLS,  0, NODE_41,
225225         DISC_OP_AMP_FILTER_IS_LOW_PASS_1M, &bzone_explo_1)
226226   DISCRETE_OP_AMP_FILTER(NODE_44, NODE_42,  0, NODE_41,
r5891r5892
232232   /************************************************/
233233   /* FIXME: +0.7 for diode */
234234   DISCRETE_RCDISC5(NODE_50, NODE_31, BZ_INP_SHELL, BZ_R14 + BZ_R15, BZ_C9)
235   DISCRETE_MULTIPLY(NODE_51, 1, BZ_R15 / (BZ_R14 + BZ_R15), NODE_50)
235   DISCRETE_MULTIPLY(NODE_51, BZ_R15 / (BZ_R14 + BZ_R15), NODE_50)
236236
237237   /* one of two filter configurations active */
238   DISCRETE_LOGIC_INVERT(NODE_52, 1, BZ_INP_SHELLLS)
238   DISCRETE_LOGIC_INVERT(NODE_52, BZ_INP_SHELLLS)
239239   DISCRETE_OP_AMP_FILTER(NODE_53, BZ_INP_SHELLLS,  0, NODE_51,
240240         DISC_OP_AMP_FILTER_IS_LOW_PASS_1M, &bzone_shell_1)
241241   DISCRETE_OP_AMP_FILTER(NODE_54, NODE_52,  0, NODE_51,
r5891r5892
249249
250250   DISCRETE_TRANSFORM2(NODE_60, BZ_INP_ENGREV, 0.0, "01=")
251251   // FIXME: from R5 .. R7
252   DISCRETE_MULTIPLEX2(NODE_61, 1, NODE_60, 2.5, 4.2)
252   DISCRETE_MULTIPLEX2(NODE_61, NODE_60, 2.5, 4.2)
253253   DISCRETE_RCDISC3(NODE_62, 1, NODE_61, BZ_R8, BZ_R9, BZ_C13, -0.5)
254254
255255   /* R11 taken from adjuster port */
src/mame/audio/vicdual.c
r5891r5892
355355    DISCRETE_COUNTER(NODE_27, 1, 0, NODE_25, 3, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE) //divide by 4
356356    DISCRETE_COUNTER(NODE_28, 1, 0, NODE_25, 2, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE) //divide by 3
357357   DISCRETE_TRANSFORM5(NODE_29,NODE_26,NODE_27,NODE_28,1,2,"13>24=+0+")
358   DISCRETE_MULTIPLY(HEADON_PLAYER_CAR_OUT, 1, NODE_29, 12 / 3)
358   DISCRETE_MULTIPLY(HEADON_PLAYER_CAR_OUT, NODE_29, 12 / 3)
359359
360360   /************************************************
361361     * CAR Sound generation Computer Car
r5891r5892
374374    DISCRETE_COUNTER(NODE_37, 1, 0, NODE_35, 3, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE) //divide by 4
375375    DISCRETE_COUNTER(NODE_38, 1, 0, NODE_35, 2, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE) //divide by 3
376376   DISCRETE_TRANSFORM5(NODE_39,NODE_36,NODE_37,NODE_38,1,2,"13>24=+0+")
377   DISCRETE_MULTIPLY(HEADON_COMP_CAR_OUT, 1, NODE_39, 12 / 3)
377   DISCRETE_MULTIPLY(HEADON_COMP_CAR_OUT, NODE_39, 12 / 3)
378378
379379   /************************************************
380380     * Screech #1
381381     ************************************************/
382382
383   DISCRETE_MULTIPLY(NODE_50,1,HEADON_SCREECH1_EN,12)
383   DISCRETE_MULTIPLY(NODE_50,HEADON_SCREECH1_EN,12)
384384   DISCRETE_LFSR_NOISE(NODE_51, 1, 1, MM5837_CLOCK_12V, 12.0, 0, 6.0, &mm5837_lfsr)
385385   DISCRETE_INVERTER_OSC(HEADON_SCREECH1_OUT,NODE_50,NODE_51,RES_K(10),RES_K(100),CAP_N(47),RES_K(10),&headon_inverter_osc_1)
386386
r5891r5892
388388     * Screech #2
389389     ************************************************/
390390
391   DISCRETE_MULTIPLY(NODE_60,1,HEADON_SCREECH2_EN,12)
391   DISCRETE_MULTIPLY(NODE_60,HEADON_SCREECH2_EN,12)
392392   DISCRETE_INVERTER_OSC(HEADON_SCREECH2_OUT,NODE_60,NODE_51,RES_K(10),RES_K(100),CAP_N(57),RES_K(10),&headon_inverter_osc_1)
393393
394394   /************************************************
395395     * Bonus
396396     ************************************************/
397397
398   DISCRETE_LOGIC_INVERT(NODE_70, 1, HEADON_BONUS_EN)
399   DISCRETE_MULTIPLY(NODE_71,1,NODE_70,12)
398   DISCRETE_LOGIC_INVERT(NODE_70, HEADON_BONUS_EN)
399   DISCRETE_MULTIPLY(NODE_71,NODE_70,12)
400400   DISCRETE_INVERTER_OSC(NODE_73,NODE_71,0,RES_K(22),RES_M(1),CAP_N(470),RES_M(10),&headon_inverter_osc_2)
401401
402402   /* FIXME: the following is a bit of a hack
r5891r5892
411411     */
412412   DISCRETE_TRANSFORM3(NODE_74,NODE_73,200000,165000,"102*-")
413413   DISCRETE_555_ASTABLE(NODE_75, 1, NODE_74, RES_K(100), CAP_N(10), &headon_555_bonus)
414   DISCRETE_MULTIPLY(HEADON_BONUS_OUT,1,NODE_75,HEADON_BONUS_EN)
414   DISCRETE_MULTIPLY(HEADON_BONUS_OUT,NODE_75,HEADON_BONUS_EN)
415415
416416   /************************************************
417417     * Crash
418418     * FIXME: Just a prototype several filter missing
419419     ************************************************/
420420
421   DISCRETE_LOGIC_INVERT(NODE_80, 1, HEADON_CRASH_EN)
421   DISCRETE_LOGIC_INVERT(NODE_80, HEADON_CRASH_EN)
422422   DISCRETE_555_MSTABLE(NODE_81, 1, NODE_80, RES_K(470), CAP_U(1), &headon_555_crash)
423423   // Mix with noise
424   DISCRETE_MULTIPLY(NODE_84, 1, NODE_81, NODE_51)
424   DISCRETE_MULTIPLY(NODE_84, NODE_81, NODE_51)
425425   // Taken from simulation
426426   // Center frequency is 500 Hz
427427   // roughly 6db per octave
r5891r5892
430430
431431   DISCRETE_555_MSTABLE(NODE_86, 1, NODE_80, RES_K(470), CAP_U(2.2), &headon_555_crash)
432432   // Mix with noise
433   DISCRETE_MULTIPLY(NODE_87, 1, NODE_86, NODE_51)
433   DISCRETE_MULTIPLY(NODE_87, NODE_86, NODE_51)
434434   // Sallen Key filter ...
435435   // http://www.t-linespeakers.org/tech/filters/Sallen-Key.html
436436   // f = w / 2 / pi  = 1 / ( 2 * pi * 15k*sqrt(470n*47n)) = 71 Hz
r5891r5892
553553   DISCRETE_COUNTER(NODE_21, 1, 1, NODE_20,MAX,DIR,INIT0, DISC_CLK_BY_COUNT)
554554   DISCRETE_COUNTER(NODE_22, 1, 1, NODE_20,MAX,DIR,INIT0, DISC_CLK_BY_COUNT)
555555   DISCRETE_TRANSFORM3(NODE,INP0,INP1,INP2,FUNCT)
556   DISCRETE_DAC_R1(NODE,ENAB,DATA,VDATA,LADDER)
556   DISCRETE_DAC_R1(NODE,DATA,VDATA,LADDER)
557557
558558   /************************************************
559559     * POINT TRG
src/mame/audio/bsktball.c
r5891r5892
107107   /************************************************/
108108   DISCRETE_LFSR_NOISE(BSKTBALL_NOISE, BSKTBALL_NOISE_EN, BSKTBALL_NOISE_EN, BSKTBALL_256H, 1, 0, .5, &bsktball_lfsr)
109109   DISCRETE_SWITCH(NODE_20, 1, BSKTBALL_NOISE, 0, BSKTBALL_CROWD_DATA)   // enable data, gate D11
110   DISCRETE_DAC_R1(NODE_21, 1, NODE_20, DEFAULT_TTL_V_LOGIC_1, &bsktball_crowd_r1_ladder)
110   DISCRETE_DAC_R1(NODE_21, NODE_20, DEFAULT_TTL_V_LOGIC_1, &bsktball_crowd_r1_ladder)
111111   DISCRETE_OP_AMP_FILTER(BSKTBALL_CROWD_SND, 1, NODE_21, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &bsktball_crowd_filt)
112112
113113   /************************************************/
src/mame/audio/poolshrk.c
r5891r5892
9696                    0, DISC_CLK_IS_FREQ)   // Cleared to 0
9797   DISCRETE_TRANSFORM2(NODE_31, NODE_30, 15, "01=!")   // TC output of E8, pin 15. (inverted)
9898
99   DISCRETE_DAC_R1(NODE_32, 1,   // Base of Q3
99   DISCRETE_DAC_R1(NODE_32,   // Base of Q3
100100         NODE_30,   // IC E8, Q0-Q3
101101         3.4,      // TTL ON level = 3.4V
102102         &poolshrk_score_v_dac)
r5891r5892
131131   /* not at TC, so the click is counted once.     */
132132   /* This should also happen on the original PCB. */
133133   /************************************************/
134   DISCRETE_LOGIC_OR(NODE_40 ,1 ,POOLSHRK_CLICK_EN , NODE_39)   // gate K9, pin 11
134   DISCRETE_LOGIC_OR(NODE_40, POOLSHRK_CLICK_EN , NODE_39)   // gate K9, pin 11
135135   DISCRETE_COUNTER(NODE_41,            // Counter J9 (9316 is a 74161)
136136                    NODE_42,            // Clock enabled by F8, pin 1
137137                    NODE_40,            // Reset/triggered by K9, pin 11
src/mame/audio/sprint2.c
r5891r5892
126126            RES_K(10),   // R21 + R23 @ min
127127            DISC_LOGADJ, "MOTOR1")
128128
129   DISCRETE_DAC_R1(NODE_21, 1,
129   DISCRETE_DAC_R1(NODE_21,
130130         SPRINT2_MOTORSND1_DATA,
131131         DEFAULT_TTL_V_LOGIC_1,
132132         &sprint2_motor_v_dac)
r5891r5892
144144   /* Mask the bits and XOR for clock input */
145145   DISCRETE_TRANSFORM2(NODE_24, NODE_23, 1, "01&")
146146   DISCRETE_TRANSFORM2(NODE_25, NODE_23, 4, "01&")
147   DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25)
147   DISCRETE_LOGIC_XOR(NODE_26, NODE_24, NODE_25)
148148
149149   /* QA of 7492 */
150150   DISCRETE_COUNTER(NODE_27, 1, SPRINT2_ATTRACT_EN, NODE_26, 1, 1, 0, DISC_CLK_ON_F_EDGE)
r5891r5892
152152   /* Mix QA and QB-D together */
153153   DISCRETE_TRANSFORM3(NODE_28, NODE_23, 2, NODE_27, "01*2+")
154154
155   DISCRETE_DAC_R1(SPRINT2_MOTORSND1, 1, NODE_28,
155   DISCRETE_DAC_R1(SPRINT2_MOTORSND1, NODE_28,
156156         DEFAULT_TTL_V_LOGIC_1,
157157         &sprint2_motor_out_dac)
158158
r5891r5892
164164            RES_K(10),   // R21 + R23 @ min
165165            DISC_LOGADJ, "MOTOR2")
166166
167   DISCRETE_DAC_R1(NODE_41, 1,
167   DISCRETE_DAC_R1(NODE_41,
168168         SPRINT2_MOTORSND2_DATA,
169169         DEFAULT_TTL_V_LOGIC_1,
170170         &sprint2_motor_v_dac)
r5891r5892
182182   /* Mask the bits and XOR for clock input */
183183   DISCRETE_TRANSFORM2(NODE_44, NODE_43, 1, "01&")
184184   DISCRETE_TRANSFORM2(NODE_45, NODE_43, 4, "01&")
185   DISCRETE_LOGIC_XOR(NODE_46, 1, NODE_44, NODE_45)
185   DISCRETE_LOGIC_XOR(NODE_46, NODE_44, NODE_45)
186186
187187   /* QA of 7492 */
188188   DISCRETE_COUNTER(NODE_47, 1, SPRINT2_ATTRACT_EN, NODE_46, 1, 1, 0, DISC_CLK_ON_F_EDGE)
r5891r5892
190190   /* Mix QA and QB-D together */
191191   DISCRETE_TRANSFORM3(NODE_48, NODE_43, 2, NODE_47, "01*2+")
192192
193   DISCRETE_DAC_R1(SPRINT2_MOTORSND2, 1, NODE_48,
193   DISCRETE_DAC_R1(SPRINT2_MOTORSND2, NODE_48,
194194         DEFAULT_TTL_V_LOGIC_1,
195195         &sprint2_motor_out_dac)
196196
r5891r5892
205205
206206   DISCRETE_SWITCH(NODE_60, 1, SPRINT2_NOISE, 0, SPRINT2_CRASHSND_DATA)
207207
208   DISCRETE_DAC_R1(SPRINT2_CRASHSND, 1, NODE_60, DEFAULT_TTL_V_LOGIC_1, &sprint2_crash_dac)
208   DISCRETE_DAC_R1(SPRINT2_CRASHSND, NODE_60, DEFAULT_TTL_V_LOGIC_1, &sprint2_crash_dac)
209209
210210   /************************************************/
211211   /* Screech is noise modulating a  Schmitt VCO.  */
r5891r5892
249249            RES_K(10),   // R21 + R23 @ min
250250            DISC_LOGADJ, "MOTOR")
251251
252   DISCRETE_DAC_R1(NODE_21, 1,
252   DISCRETE_DAC_R1(NODE_21,
253253         SPRINT2_MOTORSND1_DATA,
254254         DEFAULT_TTL_V_LOGIC_1,
255255         &sprint2_motor_v_dac)
r5891r5892
267267   /* Mask the bits and XOR for clock input */
268268   DISCRETE_TRANSFORM2(NODE_24, NODE_23, 1, "01&")
269269   DISCRETE_TRANSFORM2(NODE_25, NODE_23, 4, "01&")
270   DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25)
270   DISCRETE_LOGIC_XOR(NODE_26, NODE_24, NODE_25)
271271
272272   /* QA of 7492 */
273273   DISCRETE_COUNTER(NODE_27, 1, SPRINT2_ATTRACT_EN, NODE_26, 1, 1, 0, DISC_CLK_ON_F_EDGE)
r5891r5892
275275   /* Mix QA and QB-D together */
276276   DISCRETE_TRANSFORM3(NODE_28, NODE_23, 2, NODE_27, "01*2+")
277277
278   DISCRETE_DAC_R1(SPRINT2_MOTORSND1, 1, NODE_28,
278   DISCRETE_DAC_R1(SPRINT2_MOTORSND1, NODE_28,
279279         DEFAULT_TTL_V_LOGIC_1,
280280         &sprint2_motor_out_dac)
281281
r5891r5892
290290
291291   DISCRETE_SWITCH(NODE_60, 1, SPRINT2_NOISE, 0, SPRINT2_CRASHSND_DATA)
292292
293   DISCRETE_DAC_R1(SPRINT2_CRASHSND, 1, NODE_60, DEFAULT_TTL_V_LOGIC_1, &sprint2_crash_dac)
293   DISCRETE_DAC_R1(SPRINT2_CRASHSND, NODE_60, DEFAULT_TTL_V_LOGIC_1, &sprint2_crash_dac)
294294
295295   /************************************************/
296296   /* Screech is noise modulating a  Schmitt VCO.  */
r5891r5892
376376   /************************************************/
377377   /* Tone Sound                                   */
378378   /************************************************/
379   DISCRETE_DAC_R1(NODE_20, 1, DOMINOS_FREQ_DATA, DEFAULT_TTL_V_LOGIC_1, &dominos_tone_vco_dac)
379   DISCRETE_DAC_R1(NODE_20, DOMINOS_FREQ_DATA, DEFAULT_TTL_V_LOGIC_1, &dominos_tone_vco_dac)
380380   DISCRETE_555_CC(NODE_21, 1, NODE_20, DOMINOS_R23, CAP_U(.01), 0, 0, 0, &dominos_tone_vco)
381381   DISCRETE_COUNTER_7492(NODE_22, 1, DOMINOS_ATTRACT_EN,   // IC D8, QB-QD
382382         NODE_21, DISC_CLK_ON_F_EDGE)               // from IC D7/8, pin 3
383383   DISCRETE_TRANSFORM2(NODE_23, NODE_22, 0x01, "01&")   // IC D8, pin 11-QB
384384   DISCRETE_SWITCH(NODE_24, 1, NODE_23, 0,   // Enable gate C5
385385         DOMINOS_AMP_DATA)      // IC C4
386   DISCRETE_DAC_R1(DOMINOS_TONE_SND, 1, NODE_24, DEFAULT_TTL_V_LOGIC_1, &dominos_tone_dac)
386   DISCRETE_DAC_R1(DOMINOS_TONE_SND, NODE_24, DEFAULT_TTL_V_LOGIC_1, &dominos_tone_dac)
387387
388388   /************************************************/
389389   /* Topple sound is just the 4V source           */
src/mame/audio/dkong.c
r5891r5892
335335   context->r_total[0] = RES_2_PARALLEL(context->r_in[0] + DKONG_CUSTOM_R4, NE555_CV_R);
336336   context->r_total[1] = RES_2_PARALLEL((context->r_in[1] + DKONG_CUSTOM_R4), NE555_CV_R);
337337   /* precalculate charging exponents */
338   context->exp[0] = RC_CHARGE_EXP(node, context->r_total[0] * DKONG_CUSTOM_C);
339   context->exp[1] = RC_CHARGE_EXP(node, context->r_total[1] * DKONG_CUSTOM_C);
338   context->exp[0] = RC_CHARGE_EXP(context->r_total[0] * DKONG_CUSTOM_C);
339   context->exp[1] = RC_CHARGE_EXP(context->r_total[1] * DKONG_CUSTOM_C);
340340
341341   node->output[0] = 0;
342342}
r5891r5892
383383   DISCRETE_DIODE_MIXER2(NODE_20, NODE_17, NODE_13, &dkong_diode_mix_table) /* D1, D2 + D3 */
384384
385385   DISCRETE_RCINTEGRATE(NODE_22,NODE_20,DK_R5, RES_2_PARALLEL(DK_R4+DK_R3,DK_R6),0,DK_C19,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
386   DISCRETE_MULTIPLY(DS_OUT_SOUND0,1,NODE_22,DK_R3/R_SERIES(DK_R3,DK_R4))
386   DISCRETE_MULTIPLY(DS_OUT_SOUND0,NODE_22,DK_R3/R_SERIES(DK_R3,DK_R4))
387387   DISCRETE_TASK_END()
388388
389389   /************************************************/
r5891r5892
417417   DISCRETE_DIODE_MIXER2(NODE_38, NODE_35, NODE_29, &dkong_diode_mix_table)
418418
419419   DISCRETE_RCINTEGRATE(NODE_39,NODE_38,DK_R27, RES_2_PARALLEL(DK_R28,DK_R26+DK_R25),0,DK_C16,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
420   DISCRETE_MULTIPLY(DS_OUT_SOUND1,1,NODE_39,DK_R25/(DK_R26+DK_R25))
420   DISCRETE_MULTIPLY(DS_OUT_SOUND1,NODE_39,DK_R25/(DK_R26+DK_R25))
421421   DISCRETE_TASK_END()
422422
423423   /************************************************/
r5891r5892
443443   DISCRETE_RCDISC_MODULATED(NODE_60,DS_SOUND0_INV,NODE_55,DK_R36,DK_R18,DK_R35,DK_R17,DK_C25,DK_SUP_V)
444444   /* Filter and divide - omitted C22 */
445445   DISCRETE_CRFILTER(NODE_61, 1, NODE_60, DK_R15+DK_R16, DK_C23)
446   DISCRETE_MULTIPLY(DS_OUT_SOUND2, 1, NODE_61, DK_R15/(DK_R15+DK_R16))
446   DISCRETE_MULTIPLY(DS_OUT_SOUND2, NODE_61, DK_R15/(DK_R15+DK_R16))
447447   DISCRETE_TASK_END()
448448
449449   /************************************************/
r5891r5892
472472#if DK_NO_FILTERS
473473   DISCRETE_MULTIPLY(DS_OUT_DAC, 1, NODE_71, DS_ADJ_DAC)
474474#else
475   DISCRETE_MULTIPLY(DS_OUT_DAC, 1, NODE_73, DS_ADJ_DAC)
475   DISCRETE_MULTIPLY(DS_OUT_DAC, NODE_73, DS_ADJ_DAC)
476476#endif
477477   DISCRETE_TASK_END()
478478
r5891r5892
648648   /* SIGNALS                                      */
649649   /************************************************/
650650
651   DISCRETE_LOGIC_INVERT(DS_SOUND6,1,DS_SOUND6_INV)
652   DISCRETE_LOGIC_INVERT(DS_SOUND7,1,DS_SOUND7_INV)
651   DISCRETE_LOGIC_INVERT(DS_SOUND6,DS_SOUND6_INV)
652   DISCRETE_LOGIC_INVERT(DS_SOUND7,DS_SOUND7_INV)
653653
654654   /************************************************/
655655   /* Noise                                      */
r5891r5892
674674   DISCRETE_DIODE_MIXER2(NODE_20, NODE_18, NODE_13, &dkong_diode_mix_table) /* D1, D2 + D3 */
675675
676676   DISCRETE_RCINTEGRATE(NODE_22,NODE_20,RS_R5, RES_2_PARALLEL(RS_R4+RS_R3,RS_R6),0,RS_C18,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
677   DISCRETE_MULTIPLY(DS_OUT_SOUND2,1,NODE_22,RS_R3/R_SERIES(RS_R3,RS_R4))
677   DISCRETE_MULTIPLY(DS_OUT_SOUND2,NODE_22,RS_R3/R_SERIES(RS_R3,RS_R4))
678678
679679   /************************************************/
680680   /* SOUND1                                       */
r5891r5892
689689   DISCRETE_DIODE_MIXER2(NODE_30, NODE_28, NODE_14, &dkong_diode_mix_table) /* D1, D2 + D3 */
690690
691691   DISCRETE_RCINTEGRATE(NODE_31,NODE_30,RS_R28, RES_2_PARALLEL(RS_R27+RS_R26,RS_R29),0,RS_C29,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
692   DISCRETE_MULTIPLY(DS_OUT_SOUND1,1,NODE_31,RS_R26/R_SERIES(RS_R26,RS_R27))
692   DISCRETE_MULTIPLY(DS_OUT_SOUND1,NODE_31,RS_R26/R_SERIES(RS_R26,RS_R27))
693693
694694   /************************************************/
695695   /* SOUND0                                       */
r5891r5892
703703
704704   DISCRETE_RCDISC_MODULATED(NODE_44,DS_SOUND0_INV,NODE_43,RS_R39,RS_R18,RS_R37,RS_R38,RS_C22,DK_SUP_V)
705705   DISCRETE_CRFILTER(NODE_45, 1, NODE_44, RS_R15+RS_R16, RS_C33)
706   DISCRETE_MULTIPLY(DS_OUT_SOUND0, 1, NODE_45, RS_R15/(RS_R15+RS_R16))
706   DISCRETE_MULTIPLY(DS_OUT_SOUND0, NODE_45, RS_R15/(RS_R15+RS_R16))
707707
708708   /************************************************/
709709   /* SOUND7                                       */
r5891r5892
720720   DISCRETE_RCINTEGRATE(NODE_55,NODE_52,RS_R46, RS_R46,0,RS_C45,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
721721   DISCRETE_TRANSFORM4(NODE_56, NODE_55, DS_SOUND7,NODE_54,2.5, "01*23<*")
722722   DISCRETE_CRFILTER(NODE_57, 1, NODE_56, RS_R43+RS_R44, RS_C46)
723   DISCRETE_MULTIPLY(DS_OUT_SOUND7, 1, NODE_57, RS_R44/(RS_R43+RS_R44))
723   DISCRETE_MULTIPLY(DS_OUT_SOUND7, NODE_57, RS_R44/(RS_R43+RS_R44))
724724
725725   /************************************************/
726726   /* DAC                                          */
r5891r5892
740740   DISCRETE_SALLEN_KEY_FILTER(NODE_173, 1, NODE_171, DISC_SALLEN_KEY_LOW_PASS, &dkong_sallen_key_info)
741741
742742   /* Adjustment VR3 */
743   DISCRETE_MULTIPLY(DS_OUT_DAC, 1, NODE_173, DS_ADJ_DAC)
743   DISCRETE_MULTIPLY(DS_OUT_DAC, NODE_173, DS_ADJ_DAC)
744744
745745   /************************************************/
746746   /* Amplifier                                    */
r5891r5892
870870   DISCRETE_INPUT_NOT(DS_SOUND7_INV)
871871   DISCRETE_INPUT_NOT(DS_SOUND9_INV)
872872   DISCRETE_INPUT_NOT(DS_DISCHARGE_INV)
873   DISCRETE_INPUT_DATA(DS_DAC)
873   //DISCRETE_INPUT_DATA(DS_DAC)
874874
875875   /************************************************/
876   /* SIGNALS                                     */
876   /* SOUND0 / SOUND7                              */
877877   /************************************************/
878878
879   DISCRETE_LOGIC_INVERT(DS_SOUND7,1,DS_SOUND7_INV)
880   DISCRETE_LOGIC_INVERT(DS_SOUND9,1,DS_SOUND9_INV)
879DISCRETE_TASK_START()
880   DISCRETE_LOGIC_INVERT(DS_SOUND7,DS_SOUND7_INV)
881   DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT)
881882
883   DISCRETE_BIT_DECODE(NODE_101, NODE_100,  6, 1)    /*LS157 2A */
884   DISCRETE_BIT_DECODE(NODE_102, NODE_100,  3, 1)    /*LS157 2B */
885   DISCRETE_BIT_DECODE(NODE_103, NODE_100, 12, 1)  /*LS157 3A */
886   DISCRETE_BIT_DECODE(NODE_104, NODE_100, 11, 1)  /*LS157 3B */
887
888   /* LS157 Switches */
889   DISCRETE_SWITCH(NODE_105, 1, DS_SOUND7_INV, GND, NODE_113) /* Switch 1 from LS624 */
890   DISCRETE_SWITCH(NODE_106, 1, DS_SOUND7_INV, NODE_101, NODE_102) /* Switch 2 */
891   DISCRETE_SWITCH(NODE_107, 1, DS_SOUND7_INV, NODE_103, NODE_104) /* Switch 3 */
892
893   DISCRETE_LS123(NODE_110, DS_SOUND0_INV, JR_R8, JR_C14)
894   DISCRETE_TRANSFORM2(NODE_111, TTL_HIGH, NODE_110, "01-")
895   DISCRETE_RCFILTER(NODE_112, 1, NODE_111, JR_R10, JR_C17)
896   DISCRETE_74LS624(NODE_113, NODE_112, DK_SUP_V, JR_C18, DISC_LS624_OUT_ENERGY)
897
898   DISCRETE_LOGIC_XOR(NODE_115, NODE_105, NODE_106)
899
900   DISCRETE_TRANSFORM2(NODE_116, NODE_107, TTL_HIGH, "0!1*")
901   DISCRETE_RCFILTER(NODE_117, 1, NODE_116, JR_R11, JR_C16)
902   DISCRETE_74LS624(NODE_118, NODE_117, DK_SUP_V, JR_C19, DISC_LS624_OUT_COUNT_F)
903
904   DISCRETE_LOGIC_NAND(NODE_120, NODE_115, NODE_110)
905   DISCRETE_MULTIPLY(DS_OUT_SOUND0, NODE_120, TTL_HIGH)
906DISCRETE_TASK_END()
907
882908   /************************************************/
883909   /* SOUND1                                       */
884910   /************************************************/
885911
912DISCRETE_TASK_START()
886913   DISCRETE_LS123(NODE_10, DS_SOUND1_INV, JR_R9, JR_C15)
887914   DISCRETE_TRANSFORM2(NODE_11,NODE_104,TTL_HIGH,"0!1*")
888   DISCRETE_LOGIC_INVERT(NODE_12,1,NODE_10)
915   DISCRETE_LOGIC_INVERT(NODE_12,NODE_10)
889916   DISCRETE_MIXER2(NODE_13, 1, NODE_10, NODE_11, &dkongjr_s1_mixer_desc)
890   DISCRETE_74LS624( NODE_14, 1, NODE_13, 0.98*DK_SUP_V, JR_C22, DISC_LS624_OUT_ENERGY)
917   DISCRETE_74LS624( NODE_14, NODE_13, 0.98*DK_SUP_V, JR_C22, DISC_LS624_OUT_ENERGY)
891918   DISCRETE_RCDISC_MODULATED(NODE_15, NODE_12, NODE_14, 120, JR_R27, RES_K(0.001), JR_R28, JR_C28, DK_SUP_V)
892919   /* The following circuit does not match 100%, however works.
893920     * To be exact, we need a C-R-C-R circuit, we actually do not have.
894921     */
895922   DISCRETE_CRFILTER_VREF(NODE_16, 1, NODE_15, JR_R4, JR_C23, 2.5)
896923   DISCRETE_RCFILTER(DS_OUT_SOUND1, 1, NODE_16, JR_R19, JR_C21)
924DISCRETE_TASK_END()
897925
898926   /************************************************/
899927   /* SOUND2                                       */
900928   /************************************************/
901929
902   DISCRETE_74LS624( NODE_20, 1, 0, 0.98*DK_SUP_V, JR_C20, DISC_LS624_OUT_COUNT_F)
930DISCRETE_TASK_START()
931   DISCRETE_74LS624(NODE_20, 0, 0.98*DK_SUP_V, JR_C20, DISC_LS624_OUT_COUNT_F)
903932   DISCRETE_LFSR_NOISE(NODE_21, 1, 1, NODE_20, 1.0, 0, 0.5, &dkongjr_lfsr)
904933   DISCRETE_LS123_INV(NODE_25, DS_SOUND2_INV, JR_R17, JR_C27)
905934   DISCRETE_RCDISC_MODULATED(NODE_26, NODE_25, NODE_21, 120, JR_R24, RES_K(0.001), JR_R18, JR_C29, DK_SUP_V)
r5891r5892
908937     */
909938   DISCRETE_CRFILTER_VREF(NODE_27, 1, NODE_26, JR_R6, JR_C30, 2.5)
910939   DISCRETE_RCFILTER(DS_OUT_SOUND2, 1, NODE_27, JR_R2, JR_C25)
940DISCRETE_TASK_END()
911941
912942   /************************************************/
913943   /* SOUND9                                       */
914944   /************************************************/
915945
946DISCRETE_TASK_START()
947   DISCRETE_LOGIC_INVERT(DS_SOUND9,DS_SOUND9_INV)
916948   DISCRETE_RCFILTER(NODE_90, 1, DS_SOUND9_INV, JR_R14, JR_C26)
917   DISCRETE_MULTIPLY(NODE_91, 1, NODE_90, TTL_HIGH)
918   DISCRETE_74LS624( NODE_92, 1, NODE_91, DK_SUP_V, JR_C37, DISC_LS624_OUT_ENERGY)
949   DISCRETE_MULTIPLY(NODE_91, NODE_90, TTL_HIGH)
950   DISCRETE_74LS624( NODE_92, NODE_91, DK_SUP_V, JR_C37, DISC_LS624_OUT_ENERGY)
919951   DISCRETE_ENERGY_NAND(NODE_93, NODE_92, DS_SOUND9)
920   DISCRETE_MULTIPLY(DS_OUT_SOUND9, 1, NODE_93, TTL_HIGH)
952   DISCRETE_MULTIPLY(DS_OUT_SOUND9, NODE_93, TTL_HIGH)
953DISCRETE_TASK_END()
921954
922955   /************************************************/
923   /* SOUND0 / SOUND7                              */
956   /* DAC                                         */
924957   /************************************************/
925958
926   DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT)
927
928   DISCRETE_BIT_DECODE(NODE_101, NODE_100,  6, 1)    /*LS157 2A */
929   DISCRETE_BIT_DECODE(NODE_102, NODE_100,  3, 1)    /*LS157 2B */
930   DISCRETE_BIT_DECODE(NODE_103, NODE_100, 12, 1)  /*LS157 3A */
931   DISCRETE_BIT_DECODE(NODE_104, NODE_100, 11, 1)  /*LS157 3B */
932
933   /* LS157 Switches */
934   DISCRETE_SWITCH(NODE_105, 1, DS_SOUND7_INV, GND, NODE_113) /* Switch 1 from LS624 */
935   DISCRETE_SWITCH(NODE_106, 1, DS_SOUND7_INV, NODE_101, NODE_102) /* Switch 2 */
936   DISCRETE_SWITCH(NODE_107, 1, DS_SOUND7_INV, NODE_103, NODE_104) /* Switch 3 */
937
938   DISCRETE_LS123(NODE_110, DS_SOUND0_INV, JR_R8, JR_C14)
939   DISCRETE_TRANSFORM2(NODE_111, TTL_HIGH, NODE_110, "01-")
940   DISCRETE_RCFILTER(NODE_112, 1, NODE_111, JR_R10, JR_C17)
941   DISCRETE_74LS624(NODE_113, 1, NODE_112, DK_SUP_V, JR_C18, DISC_LS624_OUT_ENERGY)
942
943   DISCRETE_LOGIC_XOR(NODE_115, 1, NODE_105, NODE_106)
944
945   DISCRETE_TRANSFORM2(NODE_116, NODE_107, TTL_HIGH, "0!1*")
946   DISCRETE_RCFILTER(NODE_117, 1, NODE_116, JR_R11, JR_C16)
947   DISCRETE_74LS624(NODE_118, 1, NODE_117, DK_SUP_V, JR_C19, DISC_LS624_OUT_COUNT_F)
948
949   DISCRETE_LOGIC_NAND(NODE_120, 1, NODE_115, NODE_110)
950   DISCRETE_MULTIPLY(DS_OUT_SOUND0, 1, NODE_120, TTL_HIGH)
951
952   /************************************************/
953   /* DAC                                          */
954   /************************************************/
959DISCRETE_TASK_START()
960   DISCRETE_INPUT_BUFFER(DS_DAC, 0)
955961   /* Signal decay circuit Q7, R20, C32 */
956962   DISCRETE_RCDISC(NODE_170, DS_DISCHARGE_INV, 1, JR_R20, JR_C32)
957963   DISCRETE_TRANSFORM4(NODE_171, DS_DAC,  DK_SUP_V/256.0, NODE_170, DS_DISCHARGE_INV, "01*3!2+*")
r5891r5892
966972     */
967973
968974   DISCRETE_SALLEN_KEY_FILTER(DS_OUT_DAC, 1, NODE_171, DISC_SALLEN_KEY_LOW_PASS, &dkong_sallen_key_info)
975DISCRETE_TASK_END()
969976
970977   /************************************************/
971978   /* Amplifier                                    */
r5891r5892
12871294   MDRV_LATCH8_ADD( "virtual_p1" )   /* virtual latch for port A */
12881295   MDRV_LATCH8_INVERT( 0x80 )      /* signal is inverted       */
12891296   MDRV_LATCH8_DEVREAD(7, "ls259.6h", latch8_r, 3)
1290   MDRV_LATCH8_DEVREAD(6, "tms", tms5110_status_r, 0)
1297   MDRV_LATCH8_DEVREAD(6, "tms", m58817_status_r, 0)
12911298
12921299   MDRV_SOUND_ADD("tms", M58817, XTAL_640kHz)
12931300   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
src/mame/audio/sprint4.c
r5891r5892
143143/* setup the attract input and it's inverse */
144144#define SPRINT4_ATTRACT                                                 \
145145   DISCRETE_INPUT_NOT(SPRINT4_ATTRACT_EN)                              \
146   DISCRETE_LOGIC_INVERT(SPRINT4_ATTRACT_INV, 1, SPRINT4_ATTRACT_EN)
146   DISCRETE_LOGIC_INVERT(SPRINT4_ATTRACT_INV, SPRINT4_ATTRACT_EN)
147147
148148
149149/* port tags used for the discrete adjusters */
r5891r5892
169169   DISCRETE_INPUTX_DATA(SPRINT4_MOTOR_DATA_##_plr,                                                 \
170170               -1, 0x0f, 0)   /* latch IC D8 inverts the data */                              \
171171   DISCRETE_DAC_R1(SPRINT4_PLAYER_MOTOR_NODE(1, _plr),                                             \
172               1,                                 /* ENAB */                          \
173172               SPRINT4_MOTOR_DATA_##_plr,               /* DATA */                          \
174173               DEFAULT_TTL_V_LOGIC_1,                  /* VDATA */                         \
175174               &sprint4_motor_freq_DAC)               /* LADDER */                        \
r5891r5892
211210               0x08,                              /* INP2 */                          \
212211               "012*+")                           /* join 7492 bits together */       \
213212   DISCRETE_DAC_R1(SPRINT4_MOTOR_SND_##_plr,                                                     \
214               1,                                 /* ENAB */                          \
215213               SPRINT4_PLAYER_MOTOR_NODE(7, _plr),         /* DATA */                          \
216214               DEFAULT_TTL_V_LOGIC_1,                  /* VDATA */                         \
217215               &sprint4_motor_out_DAC)                  /* LADDER */
r5891r5892
234232               SPRINT4_NOISE,                  /* ENAB */      \
235233               SPRINT4_BANG_DATA)               /* INP0 */      \
236234   DISCRETE_DAC_R1(SPRINT4_BANG_SND,                                   \
237               1,                           /* ENAB */      \
238235               NODE_70,                     /* DATA */      \
239236               DEFAULT_TTL_V_LOGIC_1,            /* VDATA */     \
240237               &sprint4_bang_DAC)               /* LADDER */
src/mame/audio/firetrk.c
r5891r5892
197197   DISCRETE_INPUT_LOGIC(FIRETRUCK_ATTRACT_EN)
198198   DISCRETE_INPUT_NOT  (FIRETRUCK_XTNDPLY_EN)
199199
200   DISCRETE_LOGIC_INVERT(FIRETRUCK_ATTRACT_INV, 1, FIRETRUCK_ATTRACT_EN)
200   DISCRETE_LOGIC_INVERT(FIRETRUCK_ATTRACT_INV, FIRETRUCK_ATTRACT_EN)
201201
202202   /************************************************/
203203   /* Motor sound circuit is based on a 556 VCO    */
r5891r5892
210210            RES_K(260),   // R26 + R27 @ max
211211            RES_K(10),   // R26 + R27 @ min
212212            DISC_LOGADJ, "R27")
213   DISCRETE_DAC_R1(NODE_21, 1,      // base of Q1
213   DISCRETE_DAC_R1(NODE_21,      // base of Q1
214214         FIRETRUCK_MOTOR_DATA,   // IC F8, pins 2,5,6,9
215215         DEFAULT_TTL_V_LOGIC_1,
216216         &firetrk_motor_v_dac)
r5891r5892
227227         NODE_24,                           // from IC A9, pin 8
228228         1, 1, 0, DISC_CLK_ON_F_EDGE)
229229   DISCRETE_TRANSFORM3(NODE_26, NODE_23, 2, NODE_25, "01*2+")   // Mix QA and QB-D together
230   DISCRETE_DAC_R1(FIRETRUCK_MOTORSND, 1, NODE_26,
230   DISCRETE_DAC_R1(FIRETRUCK_MOTORSND, NODE_26,
231231         DEFAULT_TTL_V_LOGIC_1,
232232         &firetrk_motor_out_dac)
233233
r5891r5892
246246   /* 0000 = 666Hz with 35% duty cycle             */
247247   /* 1111 = 526Hz with 63% duty cycle             */
248248   /************************************************/
249   DISCRETE_DAC_R1(NODE_40, 1,      // IC E9, pin 7
249   DISCRETE_DAC_R1(NODE_40,      // IC E9, pin 7
250250         FIRETRUCK_SIREN_DATA,   // IC F8, pins 15,16,12,19
251251         DEFAULT_TTL_V_LOGIC_1,
252252         &firetrk_siren_cv_dac)
r5891r5892
270270
271271   DISCRETE_SWITCH(NODE_50, 1, FIRETRUCK_NOISE, 0,   // Enable gate K9
272272         FIRETRUCK_CRASH_DATA)      // IC K9, pins 3,6,11,8
273   DISCRETE_DAC_R1(FIRETRUCK_BANGSND, 1,   // Bang
273   DISCRETE_DAC_R1(FIRETRUCK_BANGSND,   // Bang
274274         NODE_50,      // from enable gates K9
275275         DEFAULT_TTL_V_LOGIC_1,
276276         &firetrk_bang_dac)
r5891r5892
401401   DISCRETE_INPUT_LOGIC(SUPERBUG_ATTRACT_EN)
402402   DISCRETE_INPUT_LOGIC(SUPERBUG_ASR_EN)
403403
404   DISCRETE_LOGIC_INVERT(SUPERBUG_ATTRACT_INV, 1, SUPERBUG_ATTRACT_EN)
404   DISCRETE_LOGIC_INVERT(SUPERBUG_ATTRACT_INV, SUPERBUG_ATTRACT_EN)
405405
406406   /************************************************/
407407   /* Motor sound circuit is based on a 556 VCO    */
r5891r5892
413413            RES_K(260),   // R12 + R62 @ max
414414            RES_K(10),   // R12 + R62 @ min
415415            DISC_LOGADJ, "R62")
416   DISCRETE_DAC_R1(NODE_21, 1,      // base of Q1
416   DISCRETE_DAC_R1(NODE_21,      // base of Q1
417417         SUPERBUG_SPEED_DATA,   // IC B5, pins 3, 14, 6, 11
418418         DEFAULT_TTL_V_LOGIC_1,
419419         &superbug_motor_v_dac)
r5891r5892
427427         NODE_22, DISC_CLK_ON_F_EDGE)               // from IC A6, pin 3
428428   DISCRETE_TRANSFORM2(NODE_24, NODE_23, 0x04, "01&")   // IC A7, pin 8-QD
429429   DISCRETE_TRANSFORM2(NODE_25, NODE_23, 0x01, "01&")   // IC A7, pin 11-QB
430   DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25)   // Gate A9, pin 8
430   DISCRETE_LOGIC_XOR(NODE_26, NODE_24, NODE_25)   // Gate A9, pin 8
431431   DISCRETE_COUNTER(NODE_27, 1, SUPERBUG_ATTRACT_EN,   // IC A7, pin 12-QA
432432         NODE_26,                           // from IC A9, pin 8
433433         1, 1, 0, DISC_CLK_ON_F_EDGE)
434434   DISCRETE_TRANSFORM3(NODE_28, NODE_23, 2, NODE_27, "01*2+")   // Mix QA and QB-D together
435   DISCRETE_DAC_R1(SUPERBUG_MOTORSND, 1, NODE_28,
435   DISCRETE_DAC_R1(SUPERBUG_MOTORSND, NODE_28,
436436         DEFAULT_TTL_V_LOGIC_1,
437437         &superbug_motor_out_dac)
438438
r5891r5892
449449
450450   DISCRETE_SWITCH(NODE_40, 1, SUPERBUG_NOISE, 0,   // Enable gate C8
451451         SUPERBUG_CRASH_DATA)      // IC D8, pins 3,14,6,11
452   DISCRETE_DAC_R1(SUPERBUG_BANGSND, 1,   // Bang
452   DISCRETE_DAC_R1(SUPERBUG_BANGSND,   // Bang
453453         NODE_40,      // from enable gates C8
454454         DEFAULT_TTL_V_LOGIC_1,
455455         &superbug_bang_dac)
r5891r5892
584584   DISCRETE_INPUT_LOGIC(MONTECAR_ATTRACT_INV)
585585   DISCRETE_INPUT_NOT  (MONTECAR_BEEPER_EN)
586586
587   DISCRETE_LOGIC_INVERT(MONTECAR_ATTRACT_EN, 1, MONTECAR_ATTRACT_INV)
587   DISCRETE_LOGIC_INVERT(MONTECAR_ATTRACT_EN, MONTECAR_ATTRACT_INV)
588588
589589   /************************************************/
590590   /* Motor sound circuit is based on a 556 VCO    */
r5891r5892
597597            RES_K(260),   // R87 + R89 @ max
598598            RES_K(10),   // R87 + R89 @ min
599599            DISC_LOGADJ, "R89")
600   DISCRETE_DAC_R1(NODE_21, 1,      // base of Q7
600   DISCRETE_DAC_R1(NODE_21,      // base of Q7
601601         MONTECAR_MOTOR_DATA,   // IC H8, pins 5, 2, 9, 6
602602         DEFAULT_TTL_V_LOGIC_1,
603603         &montecar_motor_v_dac)
r5891r5892
611611         NODE_22, DISC_CLK_ON_F_EDGE)                  // from IC C9, pin 9
612612   DISCRETE_TRANSFORM2(NODE_24, NODE_23, 0x04, "01&")   // IC B/C9, pin 8-QD
613613   DISCRETE_TRANSFORM2(NODE_25, NODE_23, 0x01, "01&")   // IC B/C9, pin 11-QB
614   DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25)   // Gate A9, pin 11
614   DISCRETE_LOGIC_XOR(NODE_26, NODE_24, NODE_25)   // Gate A9, pin 11
615615   DISCRETE_COUNTER(NODE_27, 1, MONTECAR_ATTRACT_EN,   // IC B/C9, pin 12-QA
616616         NODE_26,                           // from IC A9, pin 11
617617         1, 1, 0, DISC_CLK_ON_F_EDGE)
618618   DISCRETE_TRANSFORM3(NODE_28, NODE_23, 2, NODE_27, "01*2+")   // Mix QA and QB-D together
619   DISCRETE_DAC_R1(MONTECAR_MOTORSND, 1, NODE_28,
619   DISCRETE_DAC_R1(MONTECAR_MOTORSND, NODE_28,
620620         DEFAULT_TTL_V_LOGIC_1,
621621         &montecar_motor_out_dac)
622622
r5891r5892
632632            RES_K(260),   // R85 + R88 @ max
633633            RES_K(10),   // R85 + R88 @ min
634634            DISC_LOGADJ, "R88")
635   DISCRETE_DAC_R1(NODE_41, 1,         // base of Q7
635   DISCRETE_DAC_R1(NODE_41,         // base of Q7
636636         MONTECAR_DRONE_MOTOR_DATA,   // IC H8, pins 19, 16, 12, 15
637637         DEFAULT_TTL_V_LOGIC_1,
638638         &montecar_motor_v_dac)
r5891r5892
646646         NODE_42, DISC_CLK_ON_F_EDGE)               // from IC C9, pin 5
647647   DISCRETE_TRANSFORM2(NODE_44, NODE_43, 0x04, "01&")   // IC A/B9, pin 8-QD
648648   DISCRETE_TRANSFORM2(NODE_45, NODE_43, 0x01, "01&")   // IC A/B9, pin 11-QB
649   DISCRETE_LOGIC_XOR(NODE_46, 1, NODE_44, NODE_45)   // Gate A9, pin 6
649   DISCRETE_LOGIC_XOR(NODE_46, NODE_44, NODE_45)   // Gate A9, pin 6
650650   DISCRETE_COUNTER(NODE_47, 1, MONTECAR_ATTRACT_EN,   // IC A/B9, pin 12-QA
651651         NODE_46,                           // from IC A9, pin 6
652652         1, 1, 0, DISC_CLK_ON_F_EDGE)
653653   DISCRETE_TRANSFORM3(NODE_48, NODE_43, 2, NODE_47, "01*2+")   // Mix QA and QB-D together
654   DISCRETE_DAC_R1(MONTECAR_DRONE_MOTORSND, 1, NODE_48,
654   DISCRETE_DAC_R1(MONTECAR_DRONE_MOTORSND, NODE_48,
655655         DEFAULT_TTL_V_LOGIC_1,
656656         &montecar_motor_out_dac)
657657
r5891r5892
668668
669669   DISCRETE_SWITCH(NODE_50, 1, MONTECAR_NOISE, 0,   // Enable gate A9
670670         MONTECAR_CRASH_DATA)      // IC J8, pins 3,6,11,14
671   DISCRETE_DAC_R1(NODE_51, 1,   // Bang
671   DISCRETE_DAC_R1(NODE_51,   // Bang
672672         NODE_50,   // from enable gates A9
673673         DEFAULT_TTL_V_LOGIC_1,
674674         &montecar_bang_dac)
src/mame/audio/skyraid.c
r0r5892
1/************************************************************************
2 * skyraid Sound System Analog emulation
3 * Sept 2009, Derrick Renaud
4 ************************************************************************/
5
6#include "driver.h"
7#include "skyraid.h"
8
9
10/* Discrete Sound Input Nodes */
11#define SKYRAID_PLANE_SWEEP_EN      NODE_01
12#define SKYRAID_MISSILE_EN         NODE_02
13#define SKYRAID_EXPLOSION_EN      NODE_03
14#define SKYRAID_PLANE_ON_EN         NODE_04
15#define SKYRAID_PLANE_ON__IC_E8      SKYRAID_PLANE_ON_EN
16#define SKYRAID_ATTRACT_EN         NODE_05
17
18/* Discrete Sound Output Nodes */
19#define SKYRAID_NOISE            NODE_10
20#define SKYRAID_EXPLOSION_SND      NODE_11
21#define SKYRAID_JET_A_SND         NODE_12
22#define SKYRAID_JET_B_SND         NODE_13
23#define SKYRAID_MSL_A_SND         NODE_14
24#define SKYRAID_MSL_B_SND         NODE_15
25#define SKYRAID_PLANE_SND         NODE_16
26
27/* Parts List - Resistors */
28#define SKYRAID_R12      RES_K(1)
29#define SKYRAID_R13      RES_K(10)
30#define SKYRAID_R14      RES_K(100)
31#define SKYRAID_R16      RES_M(10)
32#define SKYRAID_R18      RES_K(10)
33#define SKYRAID_R19      RES_K(10)
34#define SKYRAID_R20      RES_K(47)
35#define SKYRAID_R24      RES_M(10)
36#define SKYRAID_R25      RES_M(3.9)
37#define SKYRAID_R27      RES_M(1.5)
38#define SKYRAID_R28      RES_M(1.5)
39#define SKYRAID_R29      RES_M(4.7)
40#define SKYRAID_R30      RES_M(1)
41#define SKYRAID_R31      RES_M(1)
42#define SKYRAID_R32      RES_M(4.7)
43#define SKYRAID_R84      RES_K(22)
44#define SKYRAID_R85      RES_K(100)
45#define SKYRAID_R86      820
46#define SKYRAID_R110   RES_K(330)
47#define SKYRAID_R118   RES_K(470)
48#define SKYRAID_R119   RES_K(10)
49#define SKYRAID_R120   RES_K(220)
50#define SKYRAID_R121   RES_K(1)
51#define SKYRAID_R122   RES_K(150)
52
53/* Parts List - Capacitors */
54#define SKYRAID_C44      CAP_U(4.7)
55#define SKYRAID_C45      CAP_U(.0047)
56#define SKYRAID_C46      CAP_U(.001)
57#define SKYRAID_C48      CAP_U(.0047)
58#define SKYRAID_C49      CAP_U(.1)
59#define SKYRAID_C50      CAP_U(.001)
60#define SKYRAID_C51      CAP_U(.01)
61#define SKYRAID_C68      CAP_U(10)
62#define SKYRAID_C85      CAP_U(.068)
63#define SKYRAID_C86      CAP_U(.1)
64#define SKYRAID_C93      CAP_U(.1)
65
66
67static const discrete_lfsr_desc skyraid_lfsr =
68{
69   DISC_CLK_IS_FREQ,
70   16,               /* Bit Length */
71   0,               /* Reset Value */
72   0,               /* Use Bit 0 as XOR input 0 */
73   14,               /* Use Bit 14 as XOR input 1 */
74   DISC_LFSR_XNOR,      /* Feedback stage1 is XNOR */
75   DISC_LFSR_OR,      /* Feedback stage2 is just stage 1 output OR with external feed */
76   DISC_LFSR_REPLACE,   /* Feedback stage3 replaces the shifted register contents */
77   0x000001,         /* Everything is shifted into the first bit only */
78   DISC_LFSR_FLAG_RESET_TYPE_H,   /* Output is not inverted */
79   15               /* Output bit */
80};
81
82static const discrete_op_amp_filt_info skyraid_explosion_filter =
83{
84   SKYRAID_R85, 0, SKYRAID_R86, 0, SKYRAID_R110,   /* r1, r2, r3, r4, rF*/
85   SKYRAID_C85, SKYRAID_C86, 0,   /* c1, c2, c3 */
86   0, 12, -5,   /* vRef, vP, vN */
87};
88
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
97static const discrete_dac_r1_ladder skyraid_plane_dac =
98{
99   2, {SKYRAID_R28, SKYRAID_R27},
100   0, 0, 0, 0            /* no vBias, rBias, rGnd, cFilter */
101};
102
103static const discrete_mixer_desc skyraid_mixer =
104{
105   DISC_MIXER_IS_RESISTOR,
106   {SKYRAID_R120, SKYRAID_R32, SKYRAID_R29, SKYRAID_R30, SKYRAID_R31, RES_2_PARALLEL(SKYRAID_R28, SKYRAID_R27)},
107   {0, 0, 0, 0, 0, SKYRAID_PLANE_ON__IC_E8},   /* r_nodes */
108   {0}, 0, 0, 0, 0, 0, 1      /* no c, rI, rF, cF, cAmp, vRef, gain */
109};
110
111
112/************************************************************************
113 *
114 * Custom skyraid explosion charge
115 *
116 * input[0]    - In1 (Logic)
117 * input[1]    - In2 (Logic)
118 * input[2]    - R
119 * input[3]    - C
120 *
121 *              5V
122 *               v
123 *               |
124 *           .-------.
125 *           |  4066 |
126 *   In1 >---|c      |
127 *           '-------'
128 *               |
129 *               +------------.
130 *               |            |
131 *           .-------.       --- C
132 *           |  4066 |       ---
133 *   In2 >---|c      |        |
134 *           '-------'       gnd
135 *               |
136 *               +----> Node Output
137 *               |
138 *               Z
139 *               Z R
140 *               Z
141 *               |
142 *              gnd
143 *
144 ************************************************************************/
145#define SKYRAID_EXPLOSION_CUSTOM_IN1      DISCRETE_INPUT(0)
146#define SKYRAID_EXPLOSION_CUSTOM_IN2      DISCRETE_INPUT(1)
147#define SKYRAID_EXPLOSION_CUSTOM_R         DISCRETE_INPUT(2)
148#define SKYRAID_EXPLOSION_CUSTOM_C         DISCRETE_INPUT(3)
149
150#define SKYRAID_4066_R_ON   270
151
152struct skyraid_explosion_custom_charge_context
153{
154   double v_cap;
155   double v_charge_1_2;
156   double v_drop;
157   double exp_1;
158   double exp_1_2;
159   double exp_2;
160};
161
162static DISCRETE_STEP( skyraid_explosion_custom_charge )
163{
164   struct skyraid_explosion_custom_charge_context *context = (struct skyraid_explosion_custom_charge_context *)node->context;
165
166   if (SKYRAID_EXPLOSION_CUSTOM_IN1 == 0)
167      if (SKYRAID_EXPLOSION_CUSTOM_IN2 == 0)
168         /* cap is floating and does not change charge */
169         /* output is pulled to ground */
170         node->output[0] = 0;
171      else
172      {
173         /* cap is discharged */
174         context->v_cap -= context->v_cap * context->exp_2;
175         node->output[0] = context->v_cap * context->v_drop;
176      }
177   else
178      if (SKYRAID_EXPLOSION_CUSTOM_IN2 == 0)
179      {
180         /* cap is charged */
181         context->v_cap += (5.0 - context->v_cap) * context->exp_1;
182         /* output is pulled to ground */
183         node->output[0] = 0;
184      }
185      else
186      {
187         /* cap is charged slightly less */
188         context->v_cap += (context->v_charge_1_2 - context->v_cap) * context->exp_1_2;
189         node->output[0] = context->v_cap * context->v_drop;
190      }
191}
192
193static DISCRETE_RESET( skyraid_explosion_custom_charge )
194{
195   struct skyraid_explosion_custom_charge_context *context = (struct skyraid_explosion_custom_charge_context *)node->context;
196
197   /* the charging voltage across the cap based on in2*/
198   context->v_drop =  RES_VOLTAGE_DIVIDER(SKYRAID_4066_R_ON, SKYRAID_4066_R_ON + SKYRAID_EXPLOSION_CUSTOM_R);
199   context->v_charge_1_2 = 5.0 * context->v_drop;
200   context->v_cap = 0;
201
202   /* precalculate charging exponents */
203   /* discharge cap - in1 = 0, in2 = 1*/
204   context->exp_2 = RC_CHARGE_EXP((SKYRAID_4066_R_ON + SKYRAID_EXPLOSION_CUSTOM_R) * SKYRAID_EXPLOSION_CUSTOM_C);
205   /* charge cap - in1 = 1, in2 = 0 */
206   context->exp_1 = RC_CHARGE_EXP(SKYRAID_4066_R_ON * SKYRAID_EXPLOSION_CUSTOM_C);
207   /* charge cap - in1 = 1, in2 = 1 */
208   context->exp_1_2 = RC_CHARGE_EXP(RES_2_PARALLEL(SKYRAID_4066_R_ON, SKYRAID_4066_R_ON + SKYRAID_EXPLOSION_CUSTOM_R) * SKYRAID_EXPLOSION_CUSTOM_C);
209
210   /* starts at 0 until cap starts charging */
211   node->output[0] = 0;
212}
213
214static const discrete_custom_info skyraid_explosion_custom_charge =
215{
216   DISCRETE_CUSTOM_MODULE(skyraid_explosion_custom_charge, struct skyraid_explosion_custom_charge_context),
217   NULL
218};
219
220
221/************************************************************************
222 *
223 * Custom skyraid missle charge
224 *
225 * input[0]    - In1 (Logic)
226 * input[1]    - R1
227 * input[2]    - R2
228 * input[3]    - R3
229 * input[4]    - C
230 *
231 *              12V            5V
232 *               v              v
233 *               |              |
234 *               Z             ---
235 *               Z R1           ^   1N914
236 *               Z             / \  Diode
237 *               |            -----
238 *               |              |
239 *               +--------------+
240 *               |              |
241 *              ---             Z
242 *              --- C           Z R2
243 *               |              Z
244 *               |              |
245 *               +--------------+----> Node Output
246 *               |
247 *               Z
248 *               Z R3
249 *         O.C.  Z
250 *          |\   |
251 *   In1 >--| o--+
252 *          |/
253 *
254 ************************************************************************/
255#define SKYRAID_MISSLE_CUSTOM_IN1      DISCRETE_INPUT(0)
256#define SKYRAID_MISSLE_CUSTOM_R1      DISCRETE_INPUT(1)
257#define SKYRAID_MISSLE_CUSTOM_R2      DISCRETE_INPUT(2)
258#define SKYRAID_MISSLE_CUSTOM_R3      DISCRETE_INPUT(3)
259#define SKYRAID_MISSLE_CUSTOM_C         DISCRETE_INPUT(4)
260
261struct skyraid_missle_custom_charge_context
262{
263   double v_charge[2];
264   double v_cap;
265   double exp[2];
266};
267
268/* the high charge is clamped by the diode to 0.7V above the 5V line */
269#define SKYRAID_MISSLE_CHARGE_PLUS   (5.0 + 0.7)
270
271static DISCRETE_STEP( skyraid_missle_custom_charge )
272{
273   struct skyraid_missle_custom_charge_context *context = (struct skyraid_missle_custom_charge_context *)node->context;
274
275   int in_1 = (SKYRAID_MISSLE_CUSTOM_IN1 == 0) ? 0 : 1;
276
277   /* charge/discharge cap */
278   context->v_cap += (context->v_charge[in_1] - context->v_cap) * context->exp[in_1];
279
280   node->output[0] = SKYRAID_MISSLE_CHARGE_PLUS - context->v_cap;
281}
282
283static DISCRETE_RESET( skyraid_missle_custom_charge )
284{
285   struct skyraid_missle_custom_charge_context *context = (struct skyraid_missle_custom_charge_context *)node->context;
286
287   /* everything is based on the input to the O.C. inverter */
288
289   /* the charging voltage across the cap */
290   context->v_charge[0] = 0;
291   context->v_charge[1] = SKYRAID_MISSLE_CHARGE_PLUS * RES_VOLTAGE_DIVIDER(SKYRAID_MISSLE_CUSTOM_R1 + SKYRAID_MISSLE_CUSTOM_R2, SKYRAID_MISSLE_CUSTOM_R3);
292   context->v_charge[1] = SKYRAID_MISSLE_CHARGE_PLUS - context->v_charge[1];
293   context->v_cap = 0;
294
295   /* precalculate charging exponents */
296   /* discharge cap */
297   context->exp[0] = RC_CHARGE_EXP(SKYRAID_MISSLE_CUSTOM_R2 * SKYRAID_MISSLE_CUSTOM_C);
298   /* charge cap */
299   context->exp[1] = RC_CHARGE_EXP(RES_2_PARALLEL(SKYRAID_MISSLE_CUSTOM_R1 + SKYRAID_MISSLE_CUSTOM_R2, SKYRAID_MISSLE_CUSTOM_R3) * SKYRAID_MISSLE_CUSTOM_C);
300
301   /* starts at full voltage until cap starts charging */
302   node->output[0] = SKYRAID_MISSLE_CHARGE_PLUS;
303}
304
305static const discrete_custom_info skyraid_missle_custom_charge =
306{
307   DISCRETE_CUSTOM_MODULE( skyraid_missle_custom_charge, struct skyraid_missle_custom_charge_context),
308   NULL
309};
310
311
312DISCRETE_SOUND_START( skyraid )
313   /************************************************
314     * Input register mapping
315     ************************************************/
316   /* convert the PLANE_SWEEP line to voltage*/
317   DISCRETE_INPUTX_LOGIC(SKYRAID_PLANE_SWEEP_EN, DEFAULT_TTL_V_LOGIC_1 * RES_VOLTAGE_DIVIDER(SKYRAID_R25, SKYRAID_R24), 0, 0)
318   DISCRETE_INPUT_LOGIC(SKYRAID_MISSILE_EN)
319   DISCRETE_INPUT_LOGIC(SKYRAID_EXPLOSION_EN)
320   /* convert PLANE_ON into 4066 Ron value of 270 ohms @ 5V */
321   DISCRETE_INPUTX_LOGIC(SKYRAID_PLANE_ON__IC_E8, 270, 0, 0)
322   DISCRETE_INPUT_LOGIC(SKYRAID_ATTRACT_EN)
323
324   /************************************************
325     * Noise Generator, Explosion sound
326     ************************************************/
327   /* Note: the noise reset is not emulated 100% accurate */
328   /* According to the schematics, Attract only clears the lower 8 bits. */
329   /* I may modify the noise module in the future to properly emulate this, */
330   /* but you will never hear the difference. */
331   /* It only wrong for 8 cycles of the 555 while no sound is being generated. */
332   DISCRETE_LFSR_NOISE(SKYRAID_NOISE,         /* IC F7, pin 13 */
333      1,                              /* ENAB */
334      SKYRAID_ATTRACT_EN,                  /* RESET */
335      1.49 / ((SKYRAID_R20 + 2 * SKYRAID_R19) * SKYRAID_C51),      /* CLK - 555 astable source */
336      1, 0, 0.5, &skyraid_lfsr)            /* AMPL,FEED,BIAS,LFSRTB */
337
338   DISCRETE_LOGIC_NOR(NODE_20, SKYRAID_EXPLOSION_EN, SKYRAID_NOISE)
339   DISCRETE_CUSTOM4(NODE_21, SKYRAID_EXPLOSION_EN, NODE_20, RES_2_PARALLEL(SKYRAID_R84, SKYRAID_R85 + SKYRAID_R86), SKYRAID_C68, &skyraid_explosion_custom_charge)
340   DISCRETE_OP_AMP_FILTER(NODE_22,
341      1,                              /* ENAB */
342      NODE_21, 0,                        /* INP0,INP1 */
343      DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &skyraid_explosion_filter)   /* TYPE,INFO */
344   /* IC E10, pin 14 gain and clipping */
345   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)
347
348   /************************************************
349     * Jet, Plane sound
350     ************************************************/
351   DISCRETE_RCFILTER(NODE_30,            /* IC J6, pin 5 */
352      1,                           /* ENAB */
353      SKYRAID_PLANE_SWEEP_EN,            /* IN0 */
354      RES_2_PARALLEL(SKYRAID_R25, SKYRAID_R24), SKYRAID_C49)
355   DISCRETE_566(NODE_31,               /* IC J6, pin 3 */
356      NODE_30,                     /* VMOD */
357      SKYRAID_R18, SKYRAID_C48, &skyraid_566_desc)
358   DISCRETE_LOGIC_SHIFT(NODE_32,         /* IC H7, J7 output */
359      SKYRAID_NOISE,                  /* IC H7, J7 pins 1 & 2 */
360      1, NODE_31, 16,                  /* RESET, CLK, SIZE */
361      DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_ON_R_EDGE)
362   /* move bits together for ease of use */
363   DISCRETE_TRANSFORM4(NODE_33, NODE_32, 1, 1 << 14, 2, "01&02/3&|")
364   DISCRETE_DAC_R1(SKYRAID_PLANE_SND,
365      NODE_33,                     /* DATA */
366      DEFAULT_TTL_V_LOGIC_1, &skyraid_plane_dac)
367   DISCRETE_BIT_DECODE(SKYRAID_JET_A_SND, NODE_32, 0, DEFAULT_TTL_V_LOGIC_1)   /* IC H7, pin 3 */
368   DISCRETE_BIT_DECODE(SKYRAID_JET_B_SND, NODE_32, 15, DEFAULT_TTL_V_LOGIC_1)   /* IC J7, pin 13 */
369
370   /************************************************
371     * Missle sound
372     ************************************************/
373   DISCRETE_CUSTOM5(NODE_40, SKYRAID_MISSILE_EN, SKYRAID_R12, SKYRAID_R14, SKYRAID_R13, SKYRAID_C44, &skyraid_missle_custom_charge)
374   DISCRETE_566(NODE_41,               /* IC K6, pin 3 */
375      NODE_40,                     /* VMOD */
376      SKYRAID_R16, SKYRAID_C45, &skyraid_566_desc)
377   DISCRETE_LOGIC_SHIFT(NODE_42,         /* IC K7, L7 output */
378      SKYRAID_NOISE,                  /* IC K7, L7 pins 1 & 2 */
379      1, NODE_41, 16,                  /* RESET, CLK, SIZE */
380      DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_ON_R_EDGE)
381   DISCRETE_BIT_DECODE(SKYRAID_MSL_A_SND, NODE_42, 0, DEFAULT_TTL_V_LOGIC_1)   /* IC K7, pin 3 */
382   DISCRETE_BIT_DECODE(SKYRAID_MSL_B_SND, NODE_42, 15, DEFAULT_TTL_V_LOGIC_1)   /* IC L7, pin 13 */
383
384   /************************************************
385     * Final Mix
386     ************************************************/
387   DISCRETE_LOGIC_INVERT(NODE_91, SKYRAID_ATTRACT_EN)
388   DISCRETE_MIXER6(NODE_92,
389      NODE_91,            /* ENAB */
390      SKYRAID_EXPLOSION_SND,
391      SKYRAID_JET_A_SND,
392      SKYRAID_JET_B_SND,
393      SKYRAID_MSL_A_SND,
394      SKYRAID_MSL_B_SND,
395      SKYRAID_PLANE_SND,
396      &skyraid_mixer)
397   DISCRETE_CRFILTER(NODE_93,
398      1,                  /* ENAB */
399      NODE_92,            /* IN0 */
400      SKYRAID_R122 + RES_6_PARALLEL(SKYRAID_R120, SKYRAID_R32, SKYRAID_R29, SKYRAID_R30, SKYRAID_R31, RES_2_PARALLEL(SKYRAID_R27, SKYRAID_R28)),
401      SKYRAID_C93)
402   /* IC E10, pin 1 gain and clipping */
403   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)
406DISCRETE_SOUND_END
407
408
409WRITE8_DEVICE_HANDLER( skyraid_sound_w )
410{
411   /* BIT0 => PLANE SWEEP */
412   /* BIT1 => MISSILE     */
413   /* BIT2 => EXPLOSION   */
414   /* BIT3 => START LAMP  */
415   /* BIT4 => PLANE ON    */
416   /* BIT5 => ATTRACT     */
417
418   discrete_sound_w(device, SKYRAID_PLANE_SWEEP_EN, data & 0x01);
419   discrete_sound_w(device, SKYRAID_MISSILE_EN, data & 0x02);
420   discrete_sound_w(device, SKYRAID_EXPLOSION_EN, data & 0x04);
421   set_led_status(0, !(data & 0x08));
422   discrete_sound_w(device, SKYRAID_PLANE_ON_EN, data & 0x10);
423   discrete_sound_w(device, SKYRAID_ATTRACT_EN, data & 0x20);
424}
src/mame/audio/dragrace.c
r5891r5892
9393   /************************************************/
9494   DISCRETE_RCFILTER(NODE_20, 1, DRAGRACE_MOTOR1_DATA, 119898, 2.2e-6)
9595   DISCRETE_ADJUSTMENT_TAG(NODE_21, (214.0-27.0)/12/31, (4416.0-27.0)/12/31, DISC_LOGADJ, "MOTOR1")
96   DISCRETE_MULTIPLY(NODE_22, 1, NODE_20, NODE_21)
96   DISCRETE_MULTIPLY(NODE_22, NODE_20, NODE_21)
9797
98   DISCRETE_MULTADD(NODE_23, 1, NODE_22, 2, 27.0/6)   /* F1 = /12*2 = /6 */
98   DISCRETE_MULTADD(NODE_23, NODE_22, 2, 27.0/6)   /* F1 = /12*2 = /6 */
9999   DISCRETE_SQUAREWAVE(NODE_24, 1, NODE_23, (581.6/3), 50.0, 0, 0)
100100   DISCRETE_RCFILTER(NODE_25, 1, NODE_24, 10000, 1e-7)
101101
102   DISCRETE_MULTADD(NODE_26, 1, NODE_22, 3, 27.0/4)   /* F2 = /12*3 = /4 */
102   DISCRETE_MULTADD(NODE_26, NODE_22, 3, 27.0/4)   /* F2 = /12*3 = /4 */
103103   DISCRETE_SQUAREWAVE(NODE_27, 1, NODE_26, (581.6/3), 50.0, 0, 0)
104104   DISCRETE_RCFILTER(NODE_28, 1, NODE_27, 10000, 1e-7)
105105
106   DISCRETE_MULTADD(NODE_29, 1, NODE_22, 4, 27.0/3)   /* F3 = /12*4 = /3 */
106   DISCRETE_MULTADD(NODE_29, NODE_22, 4, 27.0/3)   /* F3 = /12*4 = /3 */
107107   DISCRETE_SQUAREWAVE(NODE_30, 1, NODE_29, (581.6/3), 100.0/3, 0, 360.0/3)
108108   DISCRETE_RCFILTER(NODE_31, 1, NODE_30, 10000, 1e-7)
109109
r5891r5892
116116   /************************************************/
117117   DISCRETE_RCFILTER(NODE_40, 1, DRAGRACE_MOTOR2_DATA, 119898, 2.2e-6)
118118   DISCRETE_ADJUSTMENT_TAG(NODE_41, (214.0-27.0)/12/31, (4416.0-27.0)/12/31, DISC_LOGADJ, "MOTOR2")
119   DISCRETE_MULTIPLY(NODE_42, 1, NODE_40, NODE_41)
119   DISCRETE_MULTIPLY(NODE_42, NODE_40, NODE_41)
120120
121   DISCRETE_MULTADD(NODE_43, 1, NODE_42, 2, 27.0/6)   /* F1 = /12*2 = /6 */
121   DISCRETE_MULTADD(NODE_43, NODE_42, 2, 27.0/6)   /* F1 = /12*2 = /6 */
122122   DISCRETE_SQUAREWAVE(NODE_44, 1, NODE_43, (581.6/3), 50.0, 0, 0)
123123   DISCRETE_RCFILTER(NODE_45, 1, NODE_44, 10000, 1e-7)
124124
125   DISCRETE_MULTADD(NODE_46, 1, NODE_42, 3, 27.0/4)   /* F2 = /12*3 = /4 */
125   DISCRETE_MULTADD(NODE_46, NODE_42, 3, 27.0/4)   /* F2 = /12*3 = /4 */
126126   DISCRETE_SQUAREWAVE(NODE_47, 1, NODE_46, (581.6/3), 50.0, 0, 0)
127127   DISCRETE_RCFILTER(NODE_48, 1, NODE_47, 10000, 1e-7)
128128
129   DISCRETE_MULTADD(NODE_49, 1, NODE_42, 4, 27.0/3)   /* F3 = /12*4 = /3 */
129   DISCRETE_MULTADD(NODE_49, NODE_42, 4, 27.0/3)   /* F3 = /12*4 = /3 */
130130   DISCRETE_SQUAREWAVE(NODE_50, 1, NODE_49, (581.6/3), 100.0/3, 0, 360.0/3)
131131   DISCRETE_RCFILTER(NODE_51, 1, NODE_50, 10000, 1e-7)
132132
r5891r5892
143143   DISCRETE_LFSR_NOISE(DRAGRACE_NOISE, 1, DRAGRACE_ATTRACT_EN, 15750.0/2, 1.0, 0, 0, &dragrace_lfsr)
144144
145145   DISCRETE_RAMP(NODE_61, DRAGRACE_EXPLODE1_EN, DRAGRACE_EXPLODE1_EN, (1000.0-0.0)/1, 1000.0, 0.0, 1000.0)
146   DISCRETE_MULTIPLY(NODE_62, 1, DRAGRACE_NOISE, NODE_61)
146   DISCRETE_MULTIPLY(NODE_62, DRAGRACE_NOISE, NODE_61)
147147   DISCRETE_RCFILTER(DRAGRACE_EXPLODE1_SND, DRAGRACE_KLEXPL1_EN, NODE_62, 1500, 2.2e-7)
148148
149149   DISCRETE_RAMP(NODE_66, DRAGRACE_EXPLODE2_EN, DRAGRACE_EXPLODE2_EN, (1000.0-0.0)/1, 1000.0, 0.0, 1000.0)
150   DISCRETE_MULTIPLY(NODE_67, 1, DRAGRACE_NOISE, NODE_66)
150   DISCRETE_MULTIPLY(NODE_67, DRAGRACE_NOISE, NODE_66)
151151   DISCRETE_RCFILTER(DRAGRACE_EXPLODE2_SND, DRAGRACE_KLEXPL2_EN, NODE_67, 1500, 2.2e-7)
152152
153153   /************************************************/
r5891r5892
164164   /*  the duty variance is so small we ignore it  */
165165   /************************************************/
166166   DISCRETE_INVERT(NODE_70, DRAGRACE_NOISE)
167   DISCRETE_MULTADD(NODE_71, 1, NODE_70, 940.0-630.0, ((940.0-630.0)/2)+630.0)
167   DISCRETE_MULTADD(NODE_71, NODE_70, 940.0-630.0, ((940.0-630.0)/2)+630.0)
168168   DISCRETE_RCFILTER(NODE_72, 1, NODE_71, 1000, 1e-5)
169169   DISCRETE_SQUAREWAVE(NODE_73, 1, NODE_72, 407.8, 31.5, 0, 0.0)
170170   DISCRETE_ONOFF(DRAGRACE_SCREECH1_SND, DRAGRACE_SCREECH1_EN, NODE_73)
src/mame/audio/madalien.c
r5891r5892
181181
182182   // middle op-amp
183183   // pin 3
184   DISCRETE_MULTIPLY(NODE_30, MADALIEN_8910_PORTA_4, MADALIEN_8910_PSG_B, RES_K(3.3)/(RES_K(3.3)+RES_K(3.3)))
184   DISCRETE_MULTIPLY(NODE_30, MADALIEN_8910_PSG_B, RES_K(3.3)/(RES_K(3.3)+RES_K(3.3)))
185   DISCRETE_ONOFF(NODE_31, MADALIEN_8910_PORTA_4, NODE_30)
185186   // pin 2
186   DISCRETE_TRANSFORM3(NODE_31, MADALIEN_8910_PSG_A, NODE_30, -RES_K(10)/RES_K(3.3), "01-2*1+")
187   DISCRETE_TRANSFORM3(NODE_32, MADALIEN_8910_PSG_A, NODE_30, -RES_K(10)/RES_K(3.3), "01-2*1+")
187188   // pin 1
188   DISCRETE_SWITCH(NODE_32, 1, MADALIEN_8910_PORTA_3, NODE_30, NODE_31)
189   DISCRETE_CLAMP(NODE_33, 1, NODE_32, -5, 5.0-1.5, 0)
189   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)
190191
191192   // bottom op-amp
192193   DISCRETE_ONOFF(NODE_40, MADALIEN_8910_PORTA_6, MADALIEN_8910_PSG_B)
r5891r5892
214215      NODE_50,                  // IC 1F pin 5 in
215216      &madalien_555_1f)
216217   // convert reset to active high for module use
217   DISCRETE_LOGIC_INVERT(NODE_53, 1, MADALIEN_8910_PORTB_45)
218   DISCRETE_LOGIC_INVERT(NODE_53, MADALIEN_8910_PORTB_45)
218219   DISCRETE_COUNTER(NODE_54, 1,
219220      NODE_53,                  // pin 7 in
220221      NODE_52,                  // pin 1 in
221222      15, 1, 0, DISC_CLK_BY_COUNT)   // 4-bit binary up counter
222   DISCRETE_DAC_R1(NODE_55, 1, NODE_54, DEFAULT_TTL_V_LOGIC_1, &madalien_effect1a_dac)
223   DISCRETE_DAC_R1(NODE_56, 1, NODE_54, DEFAULT_TTL_V_LOGIC_1, &madalien_effect1b_dac)
223   DISCRETE_DAC_R1(NODE_55, NODE_54, DEFAULT_TTL_V_LOGIC_1, &madalien_effect1a_dac)
224   DISCRETE_DAC_R1(NODE_56, NODE_54, DEFAULT_TTL_V_LOGIC_1, &madalien_effect1b_dac)
224225   DISCRETE_RCFILTER(NODE_57, 1, NODE_56, RES_K(22)/2 + RES_K(22), CAP_U(.033))
225226   DISCRETE_COMP_ADDER(NODE_59, MADALIEN_8910_PORTB_23, &madalien_effect_1b_vol_r)
226227
r5891r5892
241242      NODE_64,                  // IC 1C pin 5 in
242243      &madalien_555_1c)
243244   // convert reset to active high for module use
244   DISCRETE_LOGIC_INVERT(NODE_66, 1, MADALIEN_8910_PORTB_6)
245   DISCRETE_LOGIC_INVERT(NODE_66, MADALIEN_8910_PORTB_6)
245246   DISCRETE_COUNTER(NODE_67, 1,
246247      NODE_66,                  // pin 7 in
247248      NODE_65,                  // pin 1 in
248249      15, 1, 0, DISC_CLK_BY_COUNT)   // 4-bit binary up counter
249   DISCRETE_DAC_R1(NODE_68, 1, NODE_67, DEFAULT_TTL_V_LOGIC_1, &madalien_effect2_dac)
250   DISCRETE_DAC_R1(NODE_68, NODE_67, DEFAULT_TTL_V_LOGIC_1, &madalien_effect2_dac)
250251
251252   /************************************************
252253     * Mixer
src/mame/audio/orbit.c
r5891r5892
9696   /* LFSR clk = 32V= 15750.0Hz/2/32               */
9797   /************************************************/
9898   DISCRETE_LFSR_NOISE(ORBIT_NOISE, ORBIT_NOISE_EN, ORBIT_NOISE_EN, 15750.0/2/32, 1, 0, 0, &orbit_lfsr)
99   DISCRETE_MULTIPLY(NODE_20, 1, ORBIT_NOISE, ORBIT_NOISE1_AMP)
100   DISCRETE_MULTIPLY(NODE_21, 1, ORBIT_NOISE, ORBIT_NOISE2_AMP)
99   DISCRETE_MULTIPLY(NODE_20, ORBIT_NOISE, ORBIT_NOISE1_AMP)
100   DISCRETE_MULTIPLY(NODE_21, ORBIT_NOISE, ORBIT_NOISE2_AMP)
101101   DISCRETE_FILTER2(ORBIT_NOISE1_SND, 1, NODE_20, 160.0, (1.0 / 10.0), DISC_FILTER_BANDPASS)
102102   DISCRETE_FILTER2(ORBIT_NOISE2_SND, 1, NODE_21, 160.0, (1.0 / 10.0), DISC_FILTER_BANDPASS)
103103
src/mame/audio/triplhnt.c
r5891r5892
134134            10000,   // R86 + R88 @ 0
135135            260000,   // R86 + R88 @ max
136136            DISC_LOGADJ, "BEAR")
137   DISCRETE_DAC_R1(NODE_21, 1,         // base of Q2
137   DISCRETE_DAC_R1(NODE_21,         // base of Q2
138138         TRIPLHNT_BEAR_ROAR_DATA,   // IC B10, Q0-Q3
139139         DEFAULT_TTL_V_LOGIC_1,      // TTL ON level
140140         &triplhnt_bear_roar_v_dac)
r5891r5892
148148         NODE_22,                        // from IC C11, pin 3
149149         5, 1, 0, DISC_CLK_ON_R_EDGE)         // /6 counter on rising edge
150150   DISCRETE_TRANSFORM2(NODE_24, NODE_23, 2, "01>")   // IC B6, pin 8
151   DISCRETE_LOGIC_INVERT(NODE_25, 1, NODE_22)         // IC D9, pin 3
152   DISCRETE_LOGIC_NAND(NODE_26, 1, NODE_25, TRIPLHNT_NOISE)   // IC D9, pin 11
153   DISCRETE_LOGIC_XOR(NODE_27, 1, NODE_24, NODE_26)   // IC B8, pin 6
151   DISCRETE_LOGIC_INVERT(NODE_25, NODE_22)         // IC D9, pin 3
152   DISCRETE_LOGIC_NAND(NODE_26, NODE_25, TRIPLHNT_NOISE)   // IC D9, pin 11
153   DISCRETE_LOGIC_XOR(NODE_27, NODE_24, NODE_26)   // IC B8, pin 6
154154   DISCRETE_COUNTER(NODE_28, 1, TRIPLHNT_BEAR_EN,   // IC B6, pin 12
155155         NODE_27,                        // from IC B8, pin 6
156156         1, 1, 0, DISC_CLK_ON_R_EDGE)         // /2 counter on rising edge
157157   DISCRETE_TRANSFORM5(NODE_29, NODE_24, NODE_28, NODE_26, 2, 4, "13*24*+0+")   // Mix the mess together in binary
158   DISCRETE_DAC_R1(TRIPLHNT_BEAR_ROAR_SND, 1, NODE_29,
158   DISCRETE_DAC_R1(TRIPLHNT_BEAR_ROAR_SND, NODE_29,
159159         DEFAULT_TTL_V_LOGIC_1,
160160         &triplhnt_bear_roar_out_dac)
161161
r5891r5892
166166   DISCRETE_SWITCH(NODE_40, 1,   // Gate A9, pins 6, 8, 11, 3
167167         TRIPLHNT_NOISE,   // noise enables the data which is then inverted
168168         1, TRIPLHNT_SHOT_DATA)
169   DISCRETE_DAC_R1(TRIPLHNT_SHOT_SND, 1,
169   DISCRETE_DAC_R1(TRIPLHNT_SHOT_SND,
170170         NODE_40,
171171         DEFAULT_TTL_V_LOGIC_1,
172172         &triplhnt_shot_dac)
src/mame/audio/starshp1.c
r5891r5892
191191                  DEFAULT_TTL_V_LOGIC_1)
192192   /* fake MC3340 */
193193   DISCRETE_MULTIPLY(   NODE_22,
194                  1,                     /* ENAB */
195194                  NODE_21,
196195                  STARSHP1_NOISE_AMPLITUDE)
197196   DISCRETE_RCFILTER(   NODE_23,
r5891r5892
250249                  5,                     /* 5V to R55 */
251250                  &starshp1_566_a9_mix_r)
252251   DISCRETE_566(      NODE_42,               /* IC A9, pin 4 */
253                  1,                     /* ENAB */
254252                  STARSHP1_MOTOR_SPEED,      /* IC A9, pin 5 */
255253                  RES_2_PARALLEL(STARSHP1_R54, STARSHP1_R55),
256254                  STARSHP1_C34,
257255                  &starshp1_566_a9)
258256   DISCRETE_MULTIPLY(   STARSHP1_MOTOR_SND,
259                  1,                     /* ENAB */
260257                  NODE_42,
261258                  STARSHP1_MOLVL_GAIN)
262259
src/mame/audio/starwars.c
r5891r5892
3131 *
3232 *************************************/
3333
34static UINT8 r6532_porta_r(const device_config *device, UINT8 olddata)
34static READ8_DEVICE_HANDLER( r6532_porta_r )
3535{
3636   /* Configured as follows:           */
3737   /* d7 (in)  Main Ready Flag         */
r5891r5892
4444   /* d1 (out) TMS5220 Not Read        */
4545   /* d0 (out) TMS5220 Not Write       */
4646   /* Note: bit 4 is always set to avoid sound self test */
47   UINT8 olddata = riot6532_porta_in_get(device);
4748
48   return (olddata & 0xc0) | 0x10 | (!tms5220_ready_r(devtag_get_device(device->machine, "tms")) << 2);
49   return (olddata & 0xc0) | 0x10 | (tms5220_readyq_r(devtag_get_device(device->machine, "tms")) << 2);
4950}
5051
5152
52static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
53static WRITE8_DEVICE_HANDLER( r6532_porta_w )
5354{
54   const device_config *tms = devtag_get_device(device->machine, "tms");
55
5655   /* handle 5220 read */
57   if ((olddata & 2) != 0 && (newdata & 2) == 0)
58      riot6532_portb_in_set(riot, tms5220_status_r(tms, 0), 0xff);
59
56   tms5220_rsq_w(device, (data & 2)>>1);
6057   /* handle 5220 write */
61   if ((olddata & 1) != 0 && (newdata & 1) == 0)
62      tms5220_data_w(tms, 0, riot6532_portb_out_get(riot));
58   tms5220_wsq_w(device, (data & 1)>>0);
6359}
6460
6561
66static void snd_interrupt(const device_config *device, int state)
62static WRITE_LINE_DEVICE_HANDLER( snd_interrupt )
6763{
6864   cputag_set_input_line(device->machine, "audiocpu", M6809_IRQ_LINE, state);
6965}
r5891r5892
7167
7268const riot6532_interface starwars_riot6532_intf =
7369{
74   r6532_porta_r,
75   NULL,
76   r6532_porta_w,
77   NULL,
78   snd_interrupt
70   DEVCB_HANDLER(r6532_porta_r),
71   DEVCB_DEVICE_HANDLER("tms", tms5220_status_r),
72   DEVCB_DEVICE_HANDLER("tms", r6532_porta_w),
73   DEVCB_DEVICE_HANDLER("tms", tms5220_data_w),
74   DEVCB_LINE(snd_interrupt)
7975};
8076
8177
src/mame/audio/mario.c
r5891r5892
282282   DISCRETE_RCFILTER(NODE_11, 1, NODE_10, MR_R6, CAP_AGE(MR_C3, 0.5) )
283283   DISCRETE_CUSTOM7(NODE_12, NODE_10, NODE_11, NODE_11, MR_C6, MR_C17,
284284         MR_MIXER_RPAR, MR_C31, &mario_custom_run_info)
285   DISCRETE_MULTIPLY(DS_OUT_SOUND0, 1, NODE_12, MR_MIXER_RPAR / MR_R20)
285   DISCRETE_MULTIPLY(DS_OUT_SOUND0, NODE_12, MR_MIXER_RPAR / MR_R20)
286286
287287   /************************************************/
288288   /* SOUND1                                       */
r5891r5892
292292   DISCRETE_RCFILTER(NODE_21, 1, NODE_20, MR_R7, CAP_AGE(MR_C4, 0.5) )
293293   DISCRETE_CUSTOM7(NODE_22, NODE_20, NODE_21, NODE_21, MR_C5, MR_C16,
294294      MR_MIXER_RPAR, MR_C31, &mario_custom_run_info)
295   DISCRETE_MULTIPLY(DS_OUT_SOUND1, 1, NODE_22, MR_MIXER_RPAR / MR_R19)
295   DISCRETE_MULTIPLY(DS_OUT_SOUND1, NODE_22, MR_MIXER_RPAR / MR_R19)
296296
297297   /************************************************/
298298   /* SOUND7                                       */
r5891r5892
306306   DISCRETE_LS123(NODE_110, DS_SOUND7_INV, MR_R61, CAP_AGE(MR_C41, 0.6))
307307   DISCRETE_TRANSFORM2(NODE_111, NODE_110, TTL_HIGH, "0!1*")
308308   DISCRETE_RCFILTER(NODE_112, 1, NODE_111, MR_R65, MR_C44)
309   DISCRETE_74LS624(NODE_113, 1, NODE_112, VSS, MR_C40, DISC_LS624_OUT_LOGIC)
309   DISCRETE_74LS624(NODE_113, NODE_112, VSS, MR_C40, DISC_LS624_OUT_LOGIC)
310310
311   DISCRETE_LOGIC_XOR(NODE_115, 1, NODE_102, NODE_113)
311   DISCRETE_LOGIC_XOR(NODE_115, NODE_102, NODE_113)
312312
313313   DISCRETE_RCFILTER(NODE_117, 1, NODE_104, MR_R64, MR_C43)
314   DISCRETE_74LS624(NODE_118, 1, NODE_117, VSS, MR_C39, DISC_LS624_OUT_COUNT_F)
314   DISCRETE_74LS624(NODE_118, NODE_117, VSS, MR_C39, DISC_LS624_OUT_COUNT_F)
315315
316   DISCRETE_LOGIC_AND(NODE_120, 1, NODE_115, NODE_110)
317   DISCRETE_MULTIPLY(NODE_121, 1, NODE_120, TTL_HIGH * MR_MIXER_RPAR / MR_R41)
316   DISCRETE_LOGIC_AND(NODE_120, NODE_115, NODE_110)
317   DISCRETE_MULTIPLY(NODE_121, NODE_120, TTL_HIGH * MR_MIXER_RPAR / MR_R41)
318318   DISCRETE_RCFILTER(DS_OUT_SOUND7, 1, NODE_121, MR_MIXER_RPAR, MR_C31)
319319
320320   /************************************************/
r5891r5892
325325     * is a filter circuit. Simulation in LTSPICE shows, that the following is equivalent:
326326     */
327327
328   DISCRETE_MULTIPLY(NODE_170, 1, DS_DAC, TTL_HIGH/256.0)
328   DISCRETE_MULTIPLY(NODE_170, DS_DAC, TTL_HIGH/256.0)
329329   DISCRETE_RCFILTER(NODE_171, 1, NODE_170, RES_K(750), CAP_P(200))
330330
331   DISCRETE_MULTIPLY(NODE_172, 1, NODE_171, MR_MIXER_RPAR / MR_R40)
331   DISCRETE_MULTIPLY(NODE_172, NODE_171, MR_MIXER_RPAR / MR_R40)
332332   DISCRETE_RCFILTER(DS_OUT_DAC, 1, NODE_172, MR_MIXER_RPAR, MR_C31)
333333
334334
src/mame/audio/atarifb.c
r5891r5892
9696   /************************************************/
9797   DISCRETE_LFSR_NOISE(NODE_20, ATARIFB_NOISE_EN, ATARIFB_NOISE_EN, 15750.0, 1, 0, .5, &atarifb_lfsr)
9898   DISCRETE_SWITCH(NODE_21, 1, NODE_20, 0, ATARIFB_CROWD_DATA)   // enable data, gate D8
99   DISCRETE_DAC_R1(NODE_22, 1, NODE_21, DEFAULT_TTL_V_LOGIC_1, &atarifb_crowd_r1_ladder)
99   DISCRETE_DAC_R1(NODE_22, NODE_21, DEFAULT_TTL_V_LOGIC_1, &atarifb_crowd_r1_ladder)
100100   DISCRETE_OP_AMP_FILTER(ATARIFB_CROWD_SND, 1, NODE_22, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &atarifb_crowd_filt)
101101
102102   /************************************************/
r5891r5892
186186   /************************************************/
187187   DISCRETE_LFSR_NOISE(NODE_20, ATARIFB_NOISE_EN, ATARIFB_NOISE_EN, 15750.0, 1, 0, .5, &atarifb_lfsr)
188188   DISCRETE_SWITCH(NODE_21, 1, NODE_20, 0, ATARIFB_CROWD_DATA)   // enable data, gate D8
189   DISCRETE_DAC_R1(NODE_22, 1, NODE_21, DEFAULT_TTL_V_LOGIC_1, &abaseb_crowd_r1_ladder)
189   DISCRETE_DAC_R1(NODE_22, NODE_21, DEFAULT_TTL_V_LOGIC_1, &abaseb_crowd_r1_ladder)
190190   DISCRETE_OP_AMP_FILTER(ABASEB_CROWD_SND, 1, NODE_22, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &abaseb_crowd_filt)
191191
192192   /************************************************/
src/mame/audio/gottlieb.c
r5891r5892
9494 *
9595 *************************************/
9696
97static void snd_interrupt(const device_config *device, int state)
97static WRITE_LINE_DEVICE_HANDLER( snd_interrupt )
9898{
9999   cputag_set_input_line(device->machine, "audiocpu", M6502_IRQ_LINE, state);
100100}
101101
102102
103static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata)
103static WRITE8_DEVICE_HANDLER( r6532_portb_w )
104104{
105   return input_port_read(device->machine, "SB1");
106}
107
108
109static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata)
110{
111105   /* unsure if this is ever used, but the NMI is connected to the RIOT's PB7 */
112   cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, (newdata & 0x80) ? CLEAR_LINE : ASSERT_LINE);
106   cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
113107}
114108
115109
116110static const riot6532_interface gottlieb_riot6532_intf =
117111{
118   NULL,
119   r6532_portb_r,
120   NULL,
121   r6532_portb_w,
122   snd_interrupt
112   DEVCB_NULL,
113   DEVCB_INPUT_PORT("SB1"),
114   DEVCB_NULL,
115   DEVCB_HANDLER(r6532_portb_w),
116   DEVCB_LINE(snd_interrupt)
123117};
124118
125119
src/mame/audio/jedi.c
r5891r5892
156156
157157static READ8_HANDLER( speech_ready_r )
158158{
159   return (!tms5220_ready_r(devtag_get_device(space->machine, "tms"))) << 7;
159   return (tms5220_readyq_r(devtag_get_device(space->machine, "tms"))) << 7;
160160}
161161
162162
src/mame/audio/galaga.c
r5891r5892
139139     * CHANL1 sound
140140     ************************************************/
141141   DISCRETE_DAC_R1(NODE_20,
142               1,         /* ENAB */
143142               NAMCO_54XX_2_DATA(NODE_01),
144143               4,         /* 4V - unmeasured*/
145144               &bosco_54xx_dac)
r5891r5892
153152     * CHANL2 sound
154153     ************************************************/
155154   DISCRETE_DAC_R1(NODE_30,
156               1,         /* ENAB */
157155               NAMCO_54XX_1_DATA(NODE_01),
158156               4,         /* 4V - unmeasured*/
159157               &bosco_54xx_dac)
r5891r5892
167165     * CHANL3 sound
168166     ************************************************/
169167   DISCRETE_DAC_R1(NODE_40,
170               1,         /* ENAB */
171168               NAMCO_54XX_0_DATA(NODE_01),
172169               4,         /* 4V - unmeasured*/
173170               &bosco_54xx_dac)
r5891r5892
182179     ************************************************/
183180   /* this circuit was simulated in SPICE and an equivalent filter circuit generated */
184181   DISCRETE_DAC_R1(NODE_50,
185               1,         /* ENAB */
186182               NAMCO_52XX_P_DATA(NODE_04),
187183               4,         /* 4V - unmeasured*/
188184               &bosco_52xx_dac)
r5891r5892
322318     * CHANL1 sound
323319     ************************************************/
324320   DISCRETE_DAC_R1(NODE_20,
325               1,         /* ENAB */
326321               NAMCO_54XX_2_DATA(NODE_01),
327322               4,         /* 4V - unmeasured*/
328323               &galaga_54xx_dac)
r5891r5892
336331     * CHANL2 sound
337332     ************************************************/
338333   DISCRETE_DAC_R1(NODE_30,
339               1,         /* ENAB */
340334               NAMCO_54XX_1_DATA(NODE_01),
341335               4,         /* 4V - unmeasured*/
342336               &galaga_54xx_dac)
r5891r5892
350344     * CHANL3 sound
351345     ************************************************/
352346   DISCRETE_DAC_R1(NODE_40,
353               1,         /* ENAB */
354347               NAMCO_54XX_0_DATA(NODE_01),
355348               4,         /* 4V - unmeasured*/
356349               &galaga_54xx_dac)
src/mame/audio/subs.c
r5891r5892
101101   /************************************************/
102102   /* Launch is just amplitude contolled noise     */
103103   /************************************************/
104   DISCRETE_MULTIPLY(SUBS_LAUNCH_SND, 1, SUBS_NOISE, SUBS_LAUNCH_DATA)
104   DISCRETE_MULTIPLY(SUBS_LAUNCH_SND, SUBS_NOISE, SUBS_LAUNCH_DATA)
105105
106106   /************************************************/
107107   /* Crash resamples the noise at 8V and then     */
r5891r5892
109109   /* 8V = Hsync/2/8 = 15750/2/8                   */
110110   /************************************************/
111111   DISCRETE_SQUAREWFIX(NODE_20, 1, 15750.0/2/8, 1.0, 50, 1.0/2, 0)   /* Resample freq. */
112   DISCRETE_SAMPLHOLD(NODE_21, 1, SUBS_NOISE, NODE_20, DISC_SAMPHOLD_REDGE)
113   DISCRETE_MULTIPLY(SUBS_CRASH_SND, SUBS_CRASH_EN, NODE_21, SUBS_CRASH_DATA)
112   DISCRETE_SAMPLHOLD(NODE_21, SUBS_NOISE, NODE_20, DISC_SAMPHOLD_REDGE)
113   DISCRETE_MULTIPLY(NODE_22, NODE_21, SUBS_CRASH_DATA)
114   DISCRETE_ONOFF(SUBS_CRASH_SND, SUBS_CRASH_EN, NODE_22)
114115
115116   /************************************************/
116117   /* Explode filters the crash sound.             */
r5891r5892
124125   /************************************************/
125126   DISCRETE_RCDISC2(NODE_40, SUBS_SONAR1_EN, SUBS_SONAR1_EN, 680000.0, SUBS_SONAR1_EN, 1000.0, 1e-6)   /* Decay envelope */
126127   DISCRETE_ADDER2(NODE_41, 1, NODE_40, 800)
127   DISCRETE_LOGIC_AND(NODE_42, 1, SUBS_SONAR1_EN, SUBS_NOISE)
128   DISCRETE_LOGIC_AND(NODE_42, SUBS_SONAR1_EN, SUBS_NOISE)
128129   DISCRETE_TRIANGLEWAVE(SUBS_SONAR1_SND, NODE_42, NODE_41, 320.8, 0.0, 0)
129130
130131   DISCRETE_RCDISC2(NODE_50, SUBS_SONAR2_EN, SUBS_SONAR2_EN, 18600.0, SUBS_SONAR2_EN, 20.0, 4.7e-6)   /* Decay envelope */
131132   DISCRETE_ADDER2(NODE_51, 1, NODE_50, 800)
132   DISCRETE_LOGIC_AND(NODE_52, 1, SUBS_SONAR2_EN, SUBS_NOISE)
133   DISCRETE_LOGIC_AND(NODE_52, SUBS_SONAR2_EN, SUBS_NOISE)
133134   DISCRETE_TRIANGLEWAVE(SUBS_SONAR2_SND, NODE_52, NODE_51, 320.8, 0.0, 0)
134135
135136   /************************************************/
src/mame/audio/polepos.c
r5891r5892
260260     * CHANL1 sound
261261     ************************************************/
262262   DISCRETE_DAC_R1(NODE_20,
263               1,         /* ENAB */
264263               NAMCO_54XX_2_DATA(NODE_01),
265264               4,         /* 4V - unmeasured*/
266265               &polepos_54xx_dac)
r5891r5892
278277     * CHANL2 sound
279278     ************************************************/
280279   DISCRETE_DAC_R1(NODE_30,
281               1,         /* ENAB */
282280               NAMCO_54XX_1_DATA(NODE_01),
283281               4,         /* 4V - unmeasured*/
284282               &polepos_54xx_dac)
r5891r5892
296294     * CHANL3 sound
297295     ************************************************/
298296   DISCRETE_DAC_R1(NODE_40,
299               1,         /* ENAB */
300297               NAMCO_54XX_0_DATA(NODE_01),
301298               4,         /* 4V - unmeasured*/
302299               &polepos_54xx_dac)
r5891r5892
315312     ************************************************/
316313   /* this circuit was simulated in SPICE and an equivalent filter circuit generated */
317314   DISCRETE_DAC_R1(NODE_50,
318               1,         /* ENAB */
319315               NAMCO_52XX_P_DATA(NODE_04),
320316               4,         /* 4V - unmeasured*/
321317               &polepos_52xx_dac)
src/mame/audio/exidy.c
r5891r5892
459459}
460460
461461
462static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
462static WRITE8_DEVICE_HANDLER( r6532_porta_w )
463463{
464464   if (has_mc3417)
465      cputag_set_input_line(device->machine, "cvsdcpu", INPUT_LINE_RESET, (newdata & 0x10) ? CLEAR_LINE : ASSERT_LINE);
465      cputag_set_input_line(device->machine, "cvsdcpu", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
466
467   if (has_tms5220)
468   {
469      const device_config *tms = devtag_get_device(device->machine, "tms");
470      logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot));
471      tms5220_data_w(tms, 0, data);
472   }
466473}
467474
475static READ8_DEVICE_HANDLER( r6532_porta_r )
476{
477   if (has_tms5220)
478   {
479      const device_config *tms = devtag_get_device(device->machine, "tms");
480      logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(tms, 0));
481      return tms5220_status_r(tms, 0);
482   }
483   else
484      return 0xff;
485}
468486
469static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata)
487static WRITE8_DEVICE_HANDLER( r6532_portb_w )
470488{
471   const device_config *tms = devtag_get_device(device->machine, "tms");
472   if (device != NULL)
489   if (has_tms5220)
473490   {
474      if ((olddata & 0x01) && !(newdata & 0x01))
475      {
476         riot6532_porta_in_set(riot, tms5220_status_r(tms, 0), 0xff);
477         logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(tms, 0));
478      }
479      if ((olddata & 0x02) && !(newdata & 0x02))
480      {
481         logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot));
482         tms5220_data_w(tms, 0, riot6532_porta_out_get(riot));
483      }
491      const device_config *tms = devtag_get_device(device->machine, "tms");
492
493      tms5220_rsq_w(tms, data & 0x01);
494      tms5220_wsq_w(tms, (data >> 1) & 0x01);
484495   }
485496}
486497
487498
488static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata)
499static READ8_DEVICE_HANDLER( r6532_portb_r )
489500{
490   UINT8 newdata = olddata;
501   UINT8 newdata = riot6532_portb_in_get(device);
491502   if (has_tms5220)
492503   {
493504      const device_config *tms = devtag_get_device(device->machine, "tms");
494505      newdata &= ~0x0c;
495      if (!tms5220_ready_r(tms)) newdata |= 0x04;
496      if (!tms5220_int_r(tms)) newdata |= 0x08;
506      if (tms5220_readyq_r(tms)) newdata |= 0x04;
507      if (tms5220_intq_r(tms)) newdata |= 0x08;
497508   }
498509   return newdata;
499510}
r5891r5892
501512
502513static const riot6532_interface r6532_interface =
503514{
504   NULL,               /* port A read handler */
505   r6532_portb_r,         /* port B read handler */
506   r6532_porta_w,         /* port A write handler */
507   r6532_portb_w,         /* port B write handler */
508   r6532_irq            /* IRQ callback */
515   DEVCB_HANDLER(r6532_porta_r),   /* port A read handler */
516   DEVCB_HANDLER(r6532_portb_r),   /* port B read handler */
517   DEVCB_HANDLER(r6532_porta_w),   /* port A write handler */
518   DEVCB_HANDLER(r6532_portb_w),   /* port B write handler */
519   DEVCB_LINE(r6532_irq)         /* IRQ callback */
509520};
510521
511522
src/mame/audio/tank8.c
r5891r5892
147147   /* A 9334 has typical 3.6V output.              */
148148   /************************************************/
149149
150   DISCRETE_LOGIC_INVERT(NODE_30, 1, TANK8_MOTOR1_EN)
151   DISCRETE_DAC_R1(NODE_32, 1, TANK8_MOTOR1_EN, 3.6, &tank8_dac)
150   DISCRETE_LOGIC_INVERT(NODE_30, TANK8_MOTOR1_EN)
151   DISCRETE_DAC_R1(NODE_32, TANK8_MOTOR1_EN, 3.6, &tank8_dac)
152152   DISCRETE_555_ASTABLE_CV(NODE_33, NODE_30, RES_K(220), RES_K(39), CAP_U(0.22), NODE_32, &tank8_555_a)
153153   DISCRETE_CRFILTER_VREF(NODE_34, 1, NODE_33, RES_K(22), CAP_U(0.001), 5.0)
154154   DISCRETE_555_MSTABLE(NODE_35, 1, NODE_34, RES_K(56), CAP_U(0.1), &tank8_555_m)
155155   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR1, 1, NODE_35, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
156156
157   DISCRETE_LOGIC_INVERT(NODE_40, 1, TANK8_MOTOR2_EN)
158   DISCRETE_DAC_R1(NODE_42, 1, TANK8_MOTOR2_EN, 3.6, &tank8_dac)
157   DISCRETE_LOGIC_INVERT(NODE_40, TANK8_MOTOR2_EN)
158   DISCRETE_DAC_R1(NODE_42, TANK8_MOTOR2_EN, 3.6, &tank8_dac)
159159   DISCRETE_555_ASTABLE_CV(NODE_43, NODE_40, RES_K(220), RES_K(39), CAP_U(0.22), NODE_42, &tank8_555_a)
160160   DISCRETE_CRFILTER_VREF(NODE_44, 1, NODE_43, RES_K(22), CAP_U(0.001), 5.0)
161161   DISCRETE_555_MSTABLE(NODE_45, 1, NODE_44, RES_K(56), CAP_U(0.1), &tank8_555_m)
162162   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR2, 1, NODE_45, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
163163
164   DISCRETE_LOGIC_INVERT(NODE_50, 1, TANK8_MOTOR3_EN)
165   DISCRETE_DAC_R1(NODE_52, 1, TANK8_MOTOR3_EN, 3.6, &tank8_dac)
164   DISCRETE_LOGIC_INVERT(NODE_50, TANK8_MOTOR3_EN)
165   DISCRETE_DAC_R1(NODE_52, TANK8_MOTOR3_EN, 3.6, &tank8_dac)
166166   DISCRETE_555_ASTABLE_CV(NODE_53, NODE_50, RES_K(220), RES_K(39), CAP_U(0.22), NODE_52, &tank8_555_a)
167167   DISCRETE_CRFILTER_VREF(NODE_54, 1 , NODE_53, RES_K(22), CAP_U(0.001), 5.0)
168168   DISCRETE_555_MSTABLE(NODE_55, 1, NODE_54, RES_K(56), CAP_U(0.1), &tank8_555_m)
169169   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR3, 1, NODE_55, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
170170
171   DISCRETE_LOGIC_INVERT(NODE_60, 1, TANK8_MOTOR4_EN)
172   DISCRETE_DAC_R1(NODE_62, 1, TANK8_MOTOR4_EN, 3.6, &tank8_dac)
171   DISCRETE_LOGIC_INVERT(NODE_60, TANK8_MOTOR4_EN)
172   DISCRETE_DAC_R1(NODE_62, TANK8_MOTOR4_EN, 3.6, &tank8_dac)
173173   DISCRETE_555_ASTABLE_CV(NODE_63, NODE_60, RES_K(220), RES_K(39), CAP_U(0.22), NODE_62, &tank8_555_a)
174174   DISCRETE_CRFILTER_VREF(NODE_64, 1, NODE_63, RES_K(22), CAP_U(0.001), 5.0)
175175   DISCRETE_555_MSTABLE(NODE_65, 1, NODE_64, RES_K(56), CAP_U(0.1), &tank8_555_m)
176176   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR4, 1, NODE_65, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
177177
178   DISCRETE_LOGIC_INVERT(NODE_70, 1, TANK8_MOTOR5_EN)
179   DISCRETE_DAC_R1(NODE_72, 1, TANK8_MOTOR5_EN, 3.6, &tank8_dac)
178   DISCRETE_LOGIC_INVERT(NODE_70, TANK8_MOTOR5_EN)
179   DISCRETE_DAC_R1(NODE_72, TANK8_MOTOR5_EN, 3.6, &tank8_dac)
180180   DISCRETE_555_ASTABLE_CV(NODE_73, NODE_70, RES_K(220), RES_K(39), CAP_U(0.22), NODE_72, &tank8_555_a)
181181   DISCRETE_CRFILTER_VREF(NODE_74, 1, NODE_73, RES_K(22), CAP_U(0.001), 5.0)
182182   DISCRETE_555_MSTABLE(NODE_75, 1, NODE_74, RES_K(56), CAP_U(0.1), &tank8_555_m)
183183   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR5, 1, NODE_75, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
184184
185   DISCRETE_LOGIC_INVERT(NODE_80, 1, TANK8_MOTOR6_EN)
186   DISCRETE_DAC_R1(NODE_82, 1, TANK8_MOTOR6_EN, 3.6, &tank8_dac)
185   DISCRETE_LOGIC_INVERT(NODE_80, TANK8_MOTOR6_EN)
186   DISCRETE_DAC_R1(NODE_82, TANK8_MOTOR6_EN, 3.6, &tank8_dac)
187187   DISCRETE_555_ASTABLE_CV(NODE_83, NODE_80, RES_K(220), RES_K(39), CAP_U(0.22), NODE_82, &tank8_555_a)
188188   DISCRETE_CRFILTER_VREF(NODE_84, 1, NODE_83, RES_K(22), CAP_U(0.001), 5.0)
189189   DISCRETE_555_MSTABLE(NODE_85, 1, NODE_84, RES_K(56), CAP_U(0.1), &tank8_555_m)
190190   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR6, 1, NODE_85, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
191191
192   DISCRETE_LOGIC_INVERT(NODE_90, 1, TANK8_MOTOR7_EN)
193   DISCRETE_DAC_R1(NODE_92, 1, TANK8_MOTOR7_EN, 3.6, &tank8_dac)
192   DISCRETE_LOGIC_INVERT(NODE_90, TANK8_MOTOR7_EN)
193   DISCRETE_DAC_R1(NODE_92, TANK8_MOTOR7_EN, 3.6, &tank8_dac)
194194   DISCRETE_555_ASTABLE_CV(NODE_93, NODE_90, RES_K(220), RES_K(39), CAP_U(0.22), NODE_92, &tank8_555_a)
195195   DISCRETE_CRFILTER_VREF(NODE_94, 1, NODE_93, RES_K(22), CAP_U(0.001), 5.0)
196196   DISCRETE_555_MSTABLE(NODE_95, 1, NODE_94, RES_K(56), CAP_U(0.1), &tank8_555_m)
197197   DISCRETE_OP_AMP_FILTER(TANK8_MOTOR7, 1, NODE_95, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &tank8_filt)
198198
199   DISCRETE_LOGIC_INVERT(NODE_100, 1, TANK8_MOTOR8_EN)
200   DISCRETE_DAC_R1(NODE_102, 1, TANK8_MOTOR8_EN, 3.6, &tank8_dac)
199   DISCRETE_LOGIC_INVERT(NODE_100, TANK8_MOTOR8_EN)
200   DISCRETE_DAC_R1(NODE_102, TANK8_MOTOR8_EN, 3.6, &tank8_dac)
201201   DISCRETE_555_ASTABLE_CV(NODE_103, NODE_100, RES_K(220), RES_K(39), CAP_U(0.22), NODE_102, &tank8_555_a)
202202   DISCRETE_CRFILTER_VREF(NODE_104, 1, NODE_103, RES_K(22), CAP_U(0.001), 5.0)
203203   DISCRETE_555_MSTABLE(NODE_105, 1, NODE_104, RES_K(56), CAP_U(0.1), &tank8_555_m)
r5891r5892
245245   /* generator                                    */
246246   /************************************************/
247247   DISCRETE_ADDER2(NODE_125, 1 , NODE_122, NODE_124 )
248   DISCRETE_MULTIPLY(NODE_126, 1, NODE_120, NODE_125 )
248   DISCRETE_MULTIPLY(NODE_126, NODE_120, NODE_125 )
249249   DISCRETE_RCFILTER(NODE_127, 1, NODE_126, RES_K(47), CAP_U(0.1))
250250   DISCRETE_ADJUSTMENT_TAG(NODE_128,
251251            1.0,            // min gain of E5
252252            1.0 + 100.0/22,      // max gain of E5 = 1 + r132/r101
253253            DISC_LINADJ, "CRASH")
254   DISCRETE_MULTIPLY(NODE_129, 1, NODE_127, NODE_128 )
254   DISCRETE_MULTIPLY(NODE_129, NODE_127, NODE_128 )
255255   DISCRETE_CLAMP(TANK8_CRASHEXPL, 1, NODE_129, -(12.0 - OP_AMP_VP_RAIL_OFFSET)/2, (12.0 - OP_AMP_VP_RAIL_OFFSET)/2, 0)
256256
257257   /************************************************/
258258   /* Combine all 10 sound sources.                */
259259   /************************************************/
260260   DISCRETE_ADDER4(NODE_130, 1, TANK8_MOTOR1, TANK8_MOTOR2, TANK8_MOTOR3, TANK8_MOTOR4)
261   DISCRETE_MULTADD(NODE_131, 1, NODE_130, 1.0, -10)
261   DISCRETE_MULTADD(NODE_131, NODE_130, 1.0, -10)
262262   DISCRETE_ADDER4(NODE_132, 1, TANK8_MOTOR5, TANK8_MOTOR6, TANK8_MOTOR7, TANK8_MOTOR8)
263   DISCRETE_MULTADD(NODE_133, 1, NODE_132, 1.0, -10)
263   DISCRETE_MULTADD(NODE_133, NODE_132, 1.0, -10)
264264   DISCRETE_ADDER4(TANK8_FINAL_MIX, TANK8_ATTRACT_EN, TANK8_CRASHEXPL, TANK8_BUGLE, NODE_131, NODE_133)
265265
266266   DISCRETE_OUTPUT(TANK8_FINAL_MIX, 5000)
src/mame/audio/8080bw.c
r5891r5892
256256   // Convert count to 7492 output
257257   DISCRETE_TRANSFORM2(NODE_21, NODE_20, 2, "01>0+")
258258
259   DISCRETE_DAC_R1(NODE_22, 1, NODE_21, DEFAULT_TTL_V_LOGIC_1, &indianbt_music_dac)
259   DISCRETE_DAC_R1(NODE_22, NODE_21, DEFAULT_TTL_V_LOGIC_1, &indianbt_music_dac)
260260
261261/******************************************************************************
262262 *
r5891r5892
478478 *
479479 ******************************************************************************/
480480   DISCRETE_NOTE(NODE_30, 1, 23396, POLARIS_MUSIC_DATA, 255, 3, DISC_CLK_IS_FREQ)
481   DISCRETE_DAC_R1(NODE_31, 1, NODE_30, DEFAULT_TTL_V_LOGIC_1, &polaris_music_dac)
481   DISCRETE_DAC_R1(NODE_31, NODE_30, DEFAULT_TTL_V_LOGIC_1, &polaris_music_dac)
482482   DISCRETE_OP_AMP_FILTER(NODE_32, 1, NODE_31, 0, DISC_OP_AMP_FILTER_IS_HIGH_PASS_0 | DISC_OP_AMP_IS_NORTON, &polaris_music_op_amp_filt_info)
483   DISCRETE_MULTIPLY(POLARIS_MUSIC, 1, NODE_32, POLARIS_ADJ_VR3)
483   DISCRETE_MULTIPLY(POLARIS_MUSIC, NODE_32, POLARIS_ADJ_VR3)
484484
485485/******************************************************************************
486486 *
r5891r5892
503503   DISCRETE_TRANSFORM2(NODE_43, NODE_41, 16, "01&!")      // IC 5F, pin 8
504504   DISCRETE_ONESHOT(NODE_44, NODE_43, 1, 0.0015, DISC_ONESHOT_REDGE | DISC_ONESHOT_NORETRIG | DISC_OUT_ACTIVE_HIGH)
505505
506   DISCRETE_LOGIC_OR(NODE_45, 1, NODE_42, POLARIS_SX3_EN)
507   DISCRETE_LOGIC_DFLIPFLOP(NODE_46, 1, 1, 1, NODE_40, NODE_45)
506   DISCRETE_LOGIC_OR(NODE_45, NODE_42, POLARIS_SX3_EN)
507   DISCRETE_LOGIC_DFLIPFLOP(NODE_46, 1, 1, NODE_40, NODE_45)
508508
509509   DISCRETE_OP_AMP_VCO1(NODE_47, 1, POLARIS_NOISE_LO_FILT, &polaris_sonar_vco_info)
510510   DISCRETE_OP_AMP_TRIG_VCA(POLARIS_SONARSND, NODE_45, NODE_46, 0, NODE_47, 0, &polaris_sonar_tvca_info)
r5891r5892
610610 *
611611 ******************************************************************************/
612612   DISCRETE_MIXER4(NODE_90, 1, POLARIS_SHOTSND, POLARIS_SONARSND, POLARIS_HITSND, POLARIS_PLANESND, &polaris_mixer_vr1_desc)
613   DISCRETE_MULTIPLY(NODE_91, 1, NODE_90, POLARIS_ADJ_VR1)
613   DISCRETE_MULTIPLY(NODE_91, NODE_90, POLARIS_ADJ_VR1)
614614   DISCRETE_MIXER2(NODE_92, 1, POLARIS_SHIPSND, POLARIS_SHIP_HITSND, &polaris_mixer_vr2_desc)
615   DISCRETE_MULTIPLY(NODE_93, 1, NODE_92, POLARIS_ADJ_VR2)
615   DISCRETE_MULTIPLY(NODE_93, NODE_92, POLARIS_ADJ_VR2)
616616   DISCRETE_MIXER4(NODE_94, POLARIS_SX5_EN, NODE_91, POLARIS_EXPLOSIONSND, NODE_93, POLARIS_MUSIC, &polaris_mixer_vr4_desc)
617617
618618   DISCRETE_OUTPUT(NODE_94, 1)
r5891r5892
761761   DISCRETE_SWITCH(NODE_22, SCHASER_DOT_EN, SCHASER_DOT_SEL, NODE_20, NODE_21)
762762   DISCRETE_RCFILTER(NODE_23, 1, NODE_22, 560, CAP_U(.1))
763763   DISCRETE_RCFILTER(NODE_24, 1, NODE_23, RES_K(6.8) + 560, CAP_U(.1))
764   DISCRETE_MULTIPLY(SCHASER_DOT_SND, 1, NODE_24, SCHASER_VR3)
764   DISCRETE_MULTIPLY(SCHASER_DOT_SND, NODE_24, SCHASER_VR3)
765765
766766   /************************************************/
767767   /* Explosion/Effect filtering                   */
r5891r5892
769769   DISCRETE_RCFILTER(NODE_30, 1, SCHASER_EXP_STREAM, 560, CAP_U(.1))
770770   DISCRETE_RCFILTER(NODE_31, 1, NODE_30, RES_K(6.8) + 560, CAP_U(.1))
771771   DISCRETE_CRFILTER(NODE_32, 1, NODE_31, RES_K(6.8) + 560 + RES_K(2) + RES_K(50), CAP_U(1))
772   DISCRETE_MULTIPLY(SCHASER_EXP_SND, 1, NODE_32, SCHASER_VR2)
772   DISCRETE_MULTIPLY(SCHASER_EXP_SND, NODE_32, SCHASER_VR2)
773773
774774   /************************************************/
775775   /* Music is just a 1 bit DAC                    */
776776   /************************************************/
777777   DISCRETE_CRFILTER(NODE_40, 1, SCHASER_MUSIC_BIT, RES_K(470) + RES_K(50), CAP_U(.01))
778   DISCRETE_MULTIPLY(SCHASER_MUSIC_SND, 1, NODE_40, SCHASER_VR1)
778   DISCRETE_MULTIPLY(SCHASER_MUSIC_SND, NODE_40, SCHASER_VR1)
779779
780780   /************************************************/
781781   /* Final mix with gain                          */
src/mame/audio/mw8080bw.c
r5891r5892
289289   DISCRETE_SQUAREWFIX(TORNBASE_SQUAREW_120, 1, 120, 1.0, 50.0, 1.0/2, 0)   /* pin V */
290290
291291   /* 7403 O/C NAND gate at G6.  3 of the 4 gates used with their outputs tied together */
292   DISCRETE_LOGIC_NAND(TORNBASE_TONE_240_SND, 1, TORNBASE_SQUAREW_240, TORNBASE_TONE_240_EN)   /* pins 4,5,6 */
293   DISCRETE_LOGIC_NAND(TORNBASE_TONE_960_SND, 1, TORNBASE_SQUAREW_960, TORNBASE_TONE_960_EN)   /* pins 2,1,3 */
294   DISCRETE_LOGIC_NAND(TORNBASE_TONE_120_SND, 1, TORNBASE_SQUAREW_120, TORNBASE_TONE_120_EN)   /* pins 13,12,11 */
295   DISCRETE_LOGIC_AND3(TORNBASE_TONE_SND,     1, TORNBASE_TONE_240_SND, TORNBASE_TONE_960_SND, TORNBASE_TONE_120_SND)
292   DISCRETE_LOGIC_NAND(TORNBASE_TONE_240_SND, TORNBASE_SQUAREW_240, TORNBASE_TONE_240_EN)   /* pins 4,5,6 */
293   DISCRETE_LOGIC_NAND(TORNBASE_TONE_960_SND, TORNBASE_SQUAREW_960, TORNBASE_TONE_960_EN)   /* pins 2,1,3 */
294   DISCRETE_LOGIC_NAND(TORNBASE_TONE_120_SND, TORNBASE_SQUAREW_120, TORNBASE_TONE_120_EN)   /* pins 13,12,11 */
295   DISCRETE_LOGIC_AND3(TORNBASE_TONE_SND,     TORNBASE_TONE_240_SND, TORNBASE_TONE_960_SND, TORNBASE_TONE_120_SND)
296296
297297   /* 47K resistor (R601) and 0.047uF capacitor (C601)
298298       There is also a 50K pot acting as a volume control, but we output at
r5891r5892
477477   /* After the 30s has expired, there is no sound until the next coin is inserted. */
478478   /* There is also sound for the first 30s after power up even without a coin. */
479479   DISCRETE_LOGIC_INVERT(NODE_20,            /* IC E2, pin 8 */
480               1,                     /* ENAB */
481480               MAZE_JOYSTICK_IN_USE)      /* IN0 */
482481   DISCRETE_555_MSTABLE(MAZE_GAME_OVER,      /* IC F2, pin 3 */
483482               1,                     /* RESET */
r5891r5892
486485               CAP_U(100),               /* C204 */
487486               &maze_555_F2)
488487   DISCRETE_LOGIC_JKFLIPFLOP(MAZE_AUDIO_ENABLE,/* IC F1, pin 5 */
489               1,                     /* ENAB */
490488               MAZE_COIN,               /* RESET */
491489               1,                     /* SET */
492490               MAZE_GAME_OVER,            /* CLK */
493491               1,                     /* J */
494492               0)                     /* K */
495493   DISCRETE_LOGIC_INVERT(MAZE_TONE_ENABLE,      /* IC F1, pin 6 */
496               1,                     /* ENAB */
497494               MAZE_AUDIO_ENABLE)         /* IN0 */
498495   DISCRETE_LOGIC_AND3(NODE_21,
499               1,                     /* ENAB */
500496               MAZE_JOYSTICK_IN_USE,      /* INP0 */
501497               MAZE_TONE_ENABLE,         /* INP1 */
502498               MAZE_TONE_TIMING)         /* INP2 */
503499
504500   /* The following circuits use the control info to generate a tone. */
505501   DISCRETE_LOGIC_JKFLIPFLOP(MAZE_PLAYER_SEL,   /* IC C1, pin 3 */
506               1,                     /* ENAB */
507502               1,                     /* RESET */
508503               1,                     /* SET */
509504               MAZE_TONE_TIMING,         /* CLK */
510505               1,                     /* J */
511506               1)                     /* K */
512507   DISCRETE_MULTIPLEX2(NODE_31,            /* IC D1 */
513               1,                     /* ENAB */
514508               MAZE_PLAYER_SEL,         /* ADDR */
515509               MAZE_P1_DATA,            /* INP0 */
516510               MAZE_P2_DATA)            /* INP1 */
517511   DISCRETE_LOOKUP_TABLE(NODE_32,            /* IC E1 */
518               1,                     /* ENAB */
519512               NODE_31,               /* ADDR */
520513               16,                     /* SIZE */
521514               &maze_74147_table)
r5891r5892
26932686               CAP_U(1),               /* C713 */
26942687               &spcenctr_555_bonus)
26952688   DISCRETE_LOGIC_AND3(NODE_82,            /* IC C-D, pin 6 */
2696               1,                     /* ENAB */
26972689               NODE_80,               /* INP0 */
26982690               NODE_81,               /* INP1 */
26992691               SPCENCTR_BONUS_EN)         /* INP2 */
r5891r5892
35263518               1.0/2,                                    /* BIAS */                                  \
35273519               0)                                       /* PHASE */                                 \
35283520   DISCRETE_LOGIC_AND3(INVADERS_NODE(42, _board),                  /* IC F3, pin 12 */                         \
3529               1,                                       /* ENAB */                                  \
35303521               INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, _board),/* INP0 */                                 \
35313522               INVADERS_NODE(41, _board),                     /* INP1 */                                  \
35323523               INVADERS_NODE(40, _board) )                     /* INP2 */                                  \
r5891r5892
38043795   /* so we will cheat and add a pulse 1 sample wide to trigger it */
38053796   DISCRETE_ONESHOT(NODE_30, BLUESHRK_HIT_EN, 1, /* 1 sample wide */ 0, DISC_ONESHOT_REDGE | DISC_ONESHOT_NORETRIG | DISC_OUT_ACTIVE_LOW)
38063797   DISCRETE_555_MSTABLE(NODE_31, BLUESHRK_HIT_EN, NODE_30, RES_K(47), CAP_U(2.2), &blueshrk_555_H1A)
3807   DISCRETE_LOGIC_INVERT(NODE_32, 1, BLUESHRK_HIT_EN)
3798   DISCRETE_LOGIC_INVERT(NODE_32, BLUESHRK_HIT_EN)
38083799   DISCRETE_COUNTER(NODE_33, 1, /*RST*/ NODE_32, /*CLK*/ NODE_31, 1, DISC_COUNT_UP, 0, DISC_CLK_ON_F_EDGE)
38093800   DISCRETE_SWITCH(NODE_34, 1, NODE_33, CAP_U(0.015) + CAP_U(0.01), CAP_U(0.022))
38103801   DISCRETE_555_ASTABLE(BLUESHRK_HIT_SND, BLUESHRK_HIT_EN, RES_K(22), RES_K(39), NODE_34, &blueshrk_555_H1B)
src/mame/audio/m79amb.c
r5891r5892
229229   /* (iR36 + iR35 + iR37) * R36||R35||R37 where iR35 = 0/R35 = 0 */
230230   DISCRETE_TRANSFORM4(NODE_51, 12.0 / M79AMB_R36, NODE_50, M79AMB_R37, RES_3_PARALLEL(M79AMB_R36, M79AMB_R35, M79AMB_R37), "012/+3*")
231231   DISCRETE_566(NODE_52,               /* IC U3, pin 4 */
232            1,                     /* ENAB */
233232            NODE_51,               /* IC U3, pin 5 */
234233            M79AMB_R39, M79AMB_C21, &m79amb_566_desc)
235234   DISCRETE_CRFILTER(NODE_53,
r5891r5892
241240     * Tank, Truck, Jeep
242241     ************************************************/
243242   DISCRETE_566(NODE_60,                  /* IC U4, pin 4 */
244            1,                        /* ENAB */
245243            12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R44, M79AMB_R45),      /* IC U5, pin 5 */
246244            M79AMB_R46, M79AMB_C25, &m79amb_566_desc)
247245   DISCRETE_ONOFF(NODE_61,
r5891r5892
267265   /* cap charge to B+ ratio changes voltage on pin 5 */
268266   DISCRETE_TRANSFORM3(NODE_71, 12, NODE_70, RES_VOLTAGE_DIVIDER(M79AMB_R51, M79AMB_R52), "01-2*1+")
269267   DISCRETE_566(NODE_72,               /* IC U5, pin 4 */
270            1,                     /* ENAB */
271268            NODE_71,               /* IC U5, pin 5 */
272269            M79AMB_R54, M79AMB_C30, &m79amb_566_desc)
273270   DISCRETE_CRFILTER(NODE_73,
r5891r5892
287284   /* cap charge to B+ ratio changes voltage on pin 5 */
288285   DISCRETE_TRANSFORM3(NODE_81, 12, NODE_80, RES_VOLTAGE_DIVIDER(M79AMB_R61, M79AMB_R62), "01-2*1+")
289286   DISCRETE_566(NODE_82,               /* IC U5, pin 4 */
290            1,                     /* ENAB */
291287            NODE_81,               /* IC U5, pin 5 */
292288            M79AMB_R64, M79AMB_C34, &m79amb_566_desc)
293289   DISCRETE_CRFILTER(NODE_83,
src/mame/audio/nitedrvr.c
r5891r5892
8181   /************************************************/
8282   DISCRETE_RCFILTER(NODE_20, 1, NITEDRVR_MOTOR_DATA, 123037, 2.2e-6)
8383   DISCRETE_ADJUSTMENT_TAG(NODE_21, (214.0-27.0)/12/31, (4416.0-27.0)/12/31, DISC_LOGADJ, "MOTOR")
84   DISCRETE_MULTIPLY(NODE_22, 1, NODE_20, NODE_21)
84   DISCRETE_MULTIPLY(NODE_22, NODE_20, NODE_21)
8585
86   DISCRETE_MULTADD(NODE_23, 1, NODE_22, 2, 27.0/6)   /* F1 = /12*2 = /6 */
86   DISCRETE_MULTADD(NODE_23, NODE_22, 2, 27.0/6)   /* F1 = /12*2 = /6 */
8787   DISCRETE_SQUAREWAVE(NODE_24, 1, NODE_23, (786.7/3), 50.0, 0, 0)
8888   DISCRETE_RCFILTER(NODE_25, 1, NODE_24, 10000, 1e-7)
8989
90   DISCRETE_MULTADD(NODE_26, 1, NODE_22, 3, 27.0/4)   /* F2 = /12*3 = /4 */
90   DISCRETE_MULTADD(NODE_26, NODE_22, 3, 27.0/4)   /* F2 = /12*3 = /4 */
9191   DISCRETE_SQUAREWAVE(NODE_27, 1, NODE_26, (786.7/3), 50.0, 0, 0)
9292   DISCRETE_RCFILTER(NODE_28, 1, NODE_27, 10000, 1e-7)
9393
94   DISCRETE_MULTADD(NODE_29, 1, NODE_22, 4, 27.0/3)   /* F3 = /12*4 = /3 */
94   DISCRETE_MULTADD(NODE_29, NODE_22, 4, 27.0/3)   /* F3 = /12*4 = /3 */
9595   DISCRETE_SQUAREWAVE(NODE_30, 1, NODE_29, (786.7/3), 100.0/3, 0, 360.0/3)
9696   DISCRETE_RCFILTER(NODE_31, 1, NODE_30, 10000, 1e-7)
9797
r5891r5892
107107   /************************************************/
108108   DISCRETE_LFSR_NOISE(NITEDRVR_NOISE, NITEDRVR_CRASH_EN, NITEDRVR_CRASH_EN, 15750.0/2/4, 1.0, 0, 0, &nitedrvr_lfsr)
109109
110   DISCRETE_MULTIPLY(NODE_62, 1, NITEDRVR_NOISE, NITEDRVR_BANG_DATA)
110   DISCRETE_MULTIPLY(NODE_62, NITEDRVR_NOISE, NITEDRVR_BANG_DATA)
111111   DISCRETE_RCFILTER(NITEDRVR_BANG_SND, 1, NODE_62, 545.6, 3.3e-7)
112112
113113   /************************************************/
r5891r5892
128128   /************************************************/
129129   DISCRETE_INVERT(NODE_70, NITEDRVR_NOISE)
130130   DISCRETE_RCFILTER(NODE_71, 1, NODE_70, 1000, 1e-5)
131   DISCRETE_MULTADD(NODE_72, 1, NODE_71, 940.0-630.0, ((940.0-630.0)/2)+630.0)
131   DISCRETE_MULTADD(NODE_72, NODE_71, 940.0-630.0, ((940.0-630.0)/2)+630.0)
132132   DISCRETE_SQUAREWAVE(NITEDRVR_SCREECH1_SND, NITEDRVR_SKID1_EN, NODE_72, 226.9, 31.5, 0, 0.0)
133133
134   DISCRETE_MULTADD(NODE_75, 1, NODE_71, 1380.0-626.0, 626.0+((1380.0-626.0)/2))   /* Frequency */
135   DISCRETE_MULTADD(NODE_76, 1, NODE_71, 32.0-13.0, 13.0+((32.0-13.0)/2))      /* Duty */
134   DISCRETE_MULTADD(NODE_75, NODE_71, 1380.0-626.0, 626.0+((1380.0-626.0)/2))   /* Frequency */
135   DISCRETE_MULTADD(NODE_76, NODE_71, 32.0-13.0, 13.0+((32.0-13.0)/2))      /* Duty */
136136   DISCRETE_SQUAREWAVE(NITEDRVR_SCREECH2_SND, NITEDRVR_SKID2_EN, NODE_75, 226.9, NODE_76, 0, 0.0)
137137
138138   /************************************************/
src/mame/machine/cx4ops.c
r5891r5892
33    cx4ops.c
44
55    Code based on original work by zsKnight, anomie and Nach.
6    This implementation is based on C++ "cx4*.cpp" by byuu
6    This implementation is based on C++ "cx4*.cpp" by byuu
77    (up to date with source v 0.49).
88
99***************************************************************************/
src/mame/machine/mhavoc.c
r5891r5892
222222
223223CUSTOM_INPUT( tms5220_r )
224224{
225   return tms5220_ready_r(devtag_get_device(field->port->machine, "tms")) ? 0 : 1;
225   return tms5220_readyq_r(devtag_get_device(field->port->machine, "tms")) ? 1 : 0;
226226}
227227
228228CUSTOM_INPUT( mhavoc_bit67_r )
src/mame/machine/snescx4.c
r5891r5892
55    File to handle emulation of the SNES "CX4" add-on chip.
66
77    Code based on original work by zsKnight, anomie and Nach.
8    This implementation is based on C++ "cx4*.cpp" by byuu
8    This implementation is based on C++ "cx4*.cpp" by byuu
99    (up to date with source v 0.49).
1010
1111***************************************************************************/
src/mame/machine/snescx4.h
r5891r5892
33    snescx4.h
44
55    Code based on original work by zsKnight, anomie and Nach.
6    This implementation is based on C++ "cx4*.cpp" by byuu
6    This implementation is based on C++ "cx4*.cpp" by byuu
77    (up to date with source v 0.49).
88
99***************************************************************************/
src/mame/machine/snes.c
r5891r5892
674674      case DMAP5:
675675      case DMAP6:
676676      case DMAP7:
677//         return (snes_ram[offset] & 0xdf) | (snes_open_bus_r(space,0) & 0x20);
677//          return (snes_ram[offset] & 0xdf) | (snes_open_bus_r(space,0) & 0x20);
678678      case BBAD0: case A1T0L: case A1T0H: case A1B0: case DAS0L:
679679      case DAS0H: case DSAB0: case A2A0L: case A2A0H: case NTRL0:
680680       case BBAD1: case A1T1L: case A1T1H: case A1B1: case DAS1L:
src/mame/machine/neocrypt.c
r5891r5892
15591559
15601560      for (a=0;a<0x80000/2;a++)
15611561      {
1562         //data xor
1563         #ifdef LSB_FIRST
1564         if (src[a] & 0x0004)   src[a] ^= 0x0001;
1565         if (src[a] & 0x0010)   src[a] ^= 0x0002;
1566         if (src[a] & 0x0020)   src[a] ^= 0x0008;
1567         #else
1568         if (src[a] & 0x0400)   src[a] ^= 0x0100;
1569         if (src[a] & 0x1000)   src[a] ^= 0x0200;
1570         if (src[a] & 0x2000)   src[a] ^= 0x0800;
1571         #endif
1562         if (src[a] & (0x0004 << (8*BYTE_XOR_LE(0))))   src[a] ^= 0x0001 << (8*BYTE_XOR_LE(0));
1563         if (src[a] & (0x0010 << (8*BYTE_XOR_LE(0))))   src[a] ^= 0x0002 << (8*BYTE_XOR_LE(0));
1564         if (src[a] & (0x0020 << (8*BYTE_XOR_LE(0))))   src[a] ^= 0x0008 << (8*BYTE_XOR_LE(0));
15721565         //address xor
15731566         addr  = a & ~0xff;
15741567         addr |= address[BYTE_XOR_LE(a & 0x7f)];
src/mame/machine/naomibd.c
r5891r5892
225225   UINT32            prot_offset, prot_key;
226226   UINT32            aw_offset, aw_file_base, aw_file_offset;
227227
228   const UINT32            *prot_translate;
228   INT32            prot_sum;
229
230   const UINT32         *prot_translate;
229231   int            prot_reverse_bytes;
230232   #if NAOMIBD_PRINTF_PROTECTION
231233   int            prot_pio_count;
r5891r5892
276278           0x3232, 0, 0x170000, 0x8989, 0, 0x190000, 0x6655, 0, 0x1a0000,
277279           0x3944, 0, 0x1c0000, 0x655a, 0, 0x1d0000, 0xf513, 0, 0x1e0000,
278280           0xb957, 0, 0, 0x37ca, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
279/*  { "pstone2", 0, { 0x4a65, 0, 0x000000, 0x0ead, 0, 0x010000, 0x0492, 0, 0x020000, 0x414a, 0, 0x030000,
280              0xad8c, 0, 0x040000, 0x923d, 0, 0x050000, 0x4a65, 0, 0x060000, 0x9958, 0, 0x070000,
281              0x8216, 0, 0x080000, 0xaa91, 0, 0x090000, 0xd007, 0, 0x0a0000, 0x71ee, 0, 0x0b0000,
282              0x3e41, 0, 0x0c0000, 0xb7af, 0, 0x0d0000, 0x9651, 0, 0x0e0000, 0x0492, 0, 0x0f0000,
283              0x414a, 0, 0x100000, 0xaf99, 0, 0x110000, 0x5182, 0, 0x120000, 0x08aa, 0, 0x130000,
284              0x69d0, 0, 0x140000, 0x9d71, 0, 0x150000, 0xd319, 0, 0x160000, 0xcc09, 0, 0x170000,
285              0x5ec4, 0, 0x180000, 0x7103, 0, 0x190000, 0xffffffff, 0xffffffff, 0xffffffff } },
286*/
287   { "toyfight", 0,{ 0x0615, 0, 0x0000, 0x1999, 0, 0x1000, 0x7510, 0, 0x2000, 0x5736, 0, 0x3000,
281   { "pstone2", 0, { -2, 0x14db3f4,  0x000000, -2, 0xfbd0179d, 0x010000, -2, 0x9827117, 0x020000, -2, 0x69358f, 0x030000,
282           -2, 0x193954e, 0x040000, -2, 0xba50eb, 0x050000, -2, 0x9f1523, 0x060000, -2, 0xcb7b03, 0x070000,
283           -2, 0x8f712b, 0x080000, -2, 0x120f246, 0x090000, -2, 0xacc9fc, 0x0a0000, -2, 0x4eb319, 0x0b0000,
284           -2, 0x19d0c41, 0x0c0000, -2, 0x1077853, 0x0d0000, -2, 0x100019d, 0x0e0000, -2, 0xfd91596b, 0x0f0000,
285           -2, 0x63bae7, 0x100000, -2, 0x3e3685, 0x110000, -2, 0x6d08a9, 0x120000, -2, 0xfff85c5d, 0x130000,
286           -2, 0x5263bf, 0x140000, -2, 0x396180, 0x150000, -2, 0x73af6c, 0x160000, -2, 0xfffa8a76, 0x170000,
287           -2, 0xc2d9e0, 0x180000, -2, 0x33be72, 0x190000,
288           0xffffffff, 0xffffffff, 0xffffffff } },
289   { "toyfight", 0,{ 0x0615, 0, 0x8f058, 0x1999, 0, 0x8ec58, 0x7510, 0, 0x8f458, 0x5736, 0, 0x8e858,
288290                0xffffffff, 0xffffffff, 0xffffffff } },
289291   { "ggx",      0,{ -1, 0x200000, 0x100000, -1, 0x210004, 0x110000, -1, 0x220008, 0x120000, -1, 0x228000, 0x130000,
290292                0x3af9, 0, 0x000000, 0x2288, 0, 0x010000, 0xe5e6, 0, 0x020000, 0xebb0, 0, 0x030000,
r5891r5892
380382
381383static void soft_reset(naomibd_state *v)
382384{
385   v->prot_sum = 0;
383386}
384387
385388
r5891r5892
414417            UINT8 *prot = (UINT8 *)v->protdata;
415418            UINT32 byte_offset = v->prot_offset*2;
416419
420            // this is a good time to clear the prot_sum
421            v->prot_sum = 0;
422
417423            if (v->prot_translate == NULL)
418424            {
419425               #if NAOMIBD_PRINTF_PROTECTION
r5891r5892
646652                  v->prot_key = data;
647653
648654                  #if NAOMIBD_PRINTF_PROTECTION
649                  printf("Protection: set up read @ %x, key %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->rom_offset, v->dma_offset, cpuexec_describe_context(device->machine));
655                  printf("Protection: set up read @ %x, key %x sum %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->prot_sum, v->rom_offset, v->dma_offset, cpuexec_describe_context(device->machine));
650656
651657                  v->prot_pio_count = 0;
652658                  #endif
r5891r5892
657663                     i = 0;
658664                     while (v->prot_translate[i+1] != 0xffffffff)
659665                     {
660                        // should we match by key or address?
661                        if (v->prot_translate[i] != -1)
666                        // should we match by key, address, or sum?
667                        if (v->prot_translate[i] == -2)   // match sum
662668                        {
663                           if (v->prot_translate[i] == v->prot_key)
669                           if (v->prot_translate[i+1] == v->prot_sum)
664670                           {
665671                              #if NAOMIBD_PRINTF_PROTECTION
666                              printf("Protection: got key %x, translated to %x\n", v->prot_key, v->prot_translate[i+2]);
672                              printf("Protection: got sum %x, translated to %x\n", v->prot_sum, v->prot_translate[i+2]);
667673                              #endif
668674                              v->prot_offset = v->prot_translate[i+2]/2;
669675                              break;
r5891r5892
673679                              i+= 3;
674680                           }
675681                        }
676                        else
682                        else if (v->prot_translate[i] == -1)   // match address
677683                        {
678684                           if (v->prot_translate[i+1] == (v->prot_offset*2))
679685                           {
r5891r5892
688694                              i += 3;
689695                           }
690696                        }
697                        else   // match key
698                        {
699                           if (v->prot_translate[i] == v->prot_key)
700                           {
701                              #if NAOMIBD_PRINTF_PROTECTION
702                              printf("Protection: got key %x, translated to %x\n", v->prot_key, v->prot_translate[i+2]);
703                              #endif
704                              v->prot_offset = v->prot_translate[i+2]/2;
705                              break;
706                           }
707                           else
708                           {
709                              i+= 3;
710                           }
711                        }
691712                     }
692713                  }
693714                  #if NAOMIBD_PRINTF_PROTECTION
r5891r5892
698719                  #endif
699720                  break;
700721
722               case 0x2000000:
723               case 0x2020000:
724                  #if NAOMIBD_PRINTF_PROTECTION
725                  printf("Protection write %04x to upload\n", (UINT32)(data&0xffff));
726                  #endif
727                  v->prot_sum += (INT16)(data&0xffff);
728                  break;
729
701730               default:
702731                  #if NAOMIBD_PRINTF_PROTECTION
703                  printf("naomibd: unknown protection write %x @ %x\n", (UINT32)data, offset);
732                  printf("naomibd: unknown protection write %x @ %x\n", (UINT32)data, v->rom_offset);
704733                  #endif
705734                  break;
706735            }
src/mame/machine/cx4data.c
r5891r5892
33    cx4data.c
44
55    Code based on original work by zsKnight, anomie and Nach.
6    This implementation is based on C++ "cx4*.cpp" by byuu
6    This implementation is based on C++ "cx4*.cpp" by byuu
77    (up to date with source v 0.49).
88
99***************************************************************************/
src/mame/machine/cx4oam.c
r5891r5892
33    cx4oam.c
44
55    Code based on original work by zsKnight, anomie and Nach.
6    This implementation is based on C++ "cx4*.cpp" by byuu
6    This implementation is based on C++ "cx4*.cpp" by byuu
77    (up to date with source v 0.49).
88
99***************************************************************************/
src/mame/mamedriv.c
r5891r5892
422422   /* Jangou Night   *//* (c) 1983 */
423423   DRIVER( jngolady )   /* (c) 1984 */
424424   DRIVER( cntrygrl )   /* (c) 1984 Royal Denshi */
425   DRIVER( cntrygrla ) /* (c) 1984 */
425426   DRIVER( fruitbun )   /* (c) 1984 */
426427   DRIVER( luckygrl )   /* (c) 1984 Wing? */
427428   DRIVER( nightgal )   /* (c) 1984 */
r5891r5892
15231524   DRIVER( lethalth )   /* (c) 1991 Irem (World) */
15241525   DRIVER( thndblst )   /* (c) 1991 Irem (Japan) */
15251526   DRIVER( uccops )   /* (c) 1992 Irem (World) */
1527   DRIVER( uccopsu )   /* (c) 1992 Irem (US) */
15261528   DRIVER( uccopsar )   /* (c) 1992 Irem (World) */
15271529   DRIVER( uccopsj )   /* (c) 1992 Irem (Japan) */
15281530   DRIVER( mysticri )   /* (c) 1992 Irem (World) */
r5891r5892
17661768   DRIVER( perestrof )   /* (c) 1993 Promat / Fuuki */
17671769   DRIVER( pbillian )   /* (c) 1986 Taito */
17681770   DRIVER( hotsmash )   /* B18 (c) 1987 Taito */
1769   DRIVER( exzisus )   /* B23 (c) 1987 Taito Corporation (Japan) */
1771   DRIVER( exzisus )   /* B12 (c) 1987 Taito Corporation (Japan) */
1772   DRIVER( exzisusa )   /* B23 (c) 1987 Taito Corporation (Japan) */
17701773   DRIVER( minivadr )   /* D26 cabinet test board */
17711774   DRIVER( volfied )   /* C04 (c) 1989 Taito Corporation Japan (World) */
17721775   DRIVER( volfiedu )   /* C04 (c) 1989 Taito America Corporation (US) */
r5891r5892
21632166   DRIVER( hellfire )   /* B90 / TP-??? (c) 1989 Toaplan + Taito license */
21642167   DRIVER( hellfire1 )   /* B90 / TP-??? (c) 1989 Toaplan + Taito license */
21652168   DRIVER( hellfire2 )   /* B90 / TP-??? (c) 1989 Toaplan + Taito license */
2169   DRIVER( hellfire3 )   /* B90 / TP-??? (c) 1989 Toaplan + Taito license */
21662170   DRIVER( zerowing )   /* TP-O15 (c) 1989 Toaplan */
21672171   DRIVER( zerowing2 )   /* TP-O15 (c) 1989 Toaplan */
21682172   DRIVER( demonwld )   /* TP-O16 (c) 1990 Toaplan (+ Taito license when set to Japan) */
r5891r5892
22342238   DRIVER( kingdmgp )   /* (c) 1994 Raizing/8ing (hack?) */
22352239   DRIVER( bgaregga )   /* (c) 1996 Raizing/8ing */
22362240   DRIVER( bgareggahk )   /* (c) 1996 Raizing/8ing */
2241   DRIVER( bgareggatw )   /* (c) 1996 Raizing/8ing */
22372242   DRIVER( bgaregganv )   /* (c) 1996 Raizing/8ing */
22382243   DRIVER( bgareggat2 )   /* (c) 1996 Raizing/8ing */
22392244   DRIVER( bgareggacn )   /* (c) 1996 Raizing/8ing */
r5891r5892
45574562                  /* 2003.12 Sangoku Senki Shichisei Tensei (IGS) */
45584563   DRIVER( rumblef )    /* 2004.03 The Rumble Fish */
45594564   DRIVER( rangrmsn )   /* 2004.03 Ranger Mission */
4560                  /* 2004.06 Salary Man Kintarou Net Select */
4565   DRIVER( salmankt )   /* 2004.06 Salary Man Kintarou Net Select */
45614566   DRIVER( kofnw )      /* 2004.07 The King of Fighters Neo Wave */
45624567   DRIVER( xtrmhunt )   /* 2004.09 Extreme Hunting */
45634568                  /* 2004.09 Dirty Pig Skin Football */
45644569                  /* 2004.09 Faster than Speed */
45654570   DRIVER( kov7sprt )   /* 2004.?? Knights of Valour - The Seven Sprits */
4566                  /* 2005.03 Net Select Keiba Victory Furlong */
4571   DRIVER( vfurlong )   /* 2005.03 Net Select Keiba Victory Furlong */
45674572                  /* 2005.03 The Rumble Fish 2 */
45684573   DRIVER( ngbc )      /* 2005.07 NeoGeo Battle Colloseum */
45694574                  /* 2005.09 Samurai Spirits Tenkaichi Kenkakuden */
r5891r5892
52925297   DRIVER( lethaleneab )   /* GX191 (c) 1992 */
52935298   DRIVER( lethaleneae )   /* GX191 (c) 1992 */
52945299   DRIVER( lethalenj )   /* GX191 (c) 1992 */
5300   DRIVER( tgtpanic )   /* GX601 (c) 1996 */
52955301
52965302   /* Konami "Nemesis hardware" games */
52975303   DRIVER( nemesis )   /* GX456 (c) 1985 */
r5891r5892
53205326   DRIVER( darkadv )   /* GX687 (c) 1987 */
53215327   DRIVER( majuu )      /* GX687 (c) 1987 (Japan) */
53225328   DRIVER( vulcan )   /* GX785 (c) 1988 */
5329   DRIVER( vulcana )   /* GX785 (c) 1988 */
53235330   DRIVER( gradius2 )   /* GX785 (c) 1988 (Japan) */
53245331   DRIVER( gradius2a )   /* GX785 (c) 1988 (Japan) */
53255332   DRIVER( gradius2b )   /* GX785 (c) 1988 (Japan) */
r5891r5892
53705377   DRIVER( ssridersb )   /* bootleg */
53715378   DRIVER( xmen )      /* GX065 (c) 1992 (US) */
53725379   DRIVER( xmenj )      /* GX065 (c) 1992 (Japan) */
5373   DRIVER( xmen2p )   /* GX065 (c) 1992 (World) */
5380   DRIVER( xmen2pe )   /* GX065 (c) 1992 (World) */
5381   DRIVER( xmen2pa )   /* GX065 (c) 1992 (Asia) */
53745382   DRIVER( xmen2pj )   /* GX065 (c) 1992 (Japan) */
53755383   DRIVER( xmen6p )   /* GX065 (c) 1992 */
53765384   DRIVER( xmen6pu )   /* GX065 (c) 1992 */
r5891r5892
61776185    DRIVER( neogeo )
61786186   DRIVER( nam1975 )   /* 0001 (c) 1990 SNK */
61796187   DRIVER( bstars )   /* 0002 (c) 1990 SNK */
6188   DRIVER( bstarsh )   /* 0002 (c) 1990 SNK */
61806189   DRIVER( tpgolf )   /* 0003 (c) 1990 SNK */
61816190   DRIVER( mahretsu )   /* 0004 (c) 1990 SNK */
61826191   DRIVER( maglord )   /* 0005 (c) 1990 Alpha Denshi Co. */
r5891r5892
62326241   DRIVER( samsho )   /* 0045 (c) 1993 SNK */
62336242   DRIVER( samshoh )   /* 0045 (c) 1993 SNK */
62346243   DRIVER( tophuntr )   /* 0046 (c) 1994 SNK */
6235   DRIVER( tophuntra )   /* 0046 (c) 1994 SNK */
6244   DRIVER( tophuntrh )   /* 0046 (c) 1994 SNK */
62366245   DRIVER( fatfury2 )   /* 0047 (c) 1992 SNK */
62376246   DRIVER( janshin )   /* 0048 (c) 1994 Aicom */
62386247   DRIVER( androdun )   /* 0049 (c) 1992 Visco */
r5891r5892
62786287   DRIVER( ssideki3 )   /* 0081 (c) 1995 SNK */
62796288   DRIVER( doubledr )   /* 0082 (c) 1995 Technos */
62806289   DRIVER( pbobblen )   /* 0083 (c) 1994 Taito */
6281   DRIVER( pbobblena )   /* 0083 (c) 1994 Taito */
6290   DRIVER( pbobblenb )   /* bootleg */
62826291   DRIVER( kof95 )      /* 0084 (c) 1995 SNK */
62836292   DRIVER( kof95h )   /* 0084 (c) 1995 SNK */
62846293                  /* 0085 Shinsetsu Samurai Spirits Bushidoretsuden / Samurai Shodown RPG (CD only) */
r5891r5892
63006309   DRIVER( sonicwi3 )   /* 0097 (c) 1995 Video System Co. */
63016310                  /* 0098 Idol Mahjong - final romance 2 (CD only? not confirmed, MVS might exist) */
63026311                  /* 0099 Neo Pool Masters */
6303                  /* 0160 98 BEST 44 (c) 1997/1998 SNK */
63046312   DRIVER( turfmast )   /* 0200 (c) 1996 Nazca */
63056313   DRIVER( mslug )      /* 0201 (c) 1996 Nazca */
63066314   DRIVER( puzzledp )   /* 0202 (c) 1995 Taito (Visco license) */
r5891r5892
63386346   DRIVER( breakers )   /* 0230 (c) 1996 Visco */
63396347   DRIVER( miexchng )   /* 0231 (c) 1997 Face */
63406348   DRIVER( kof97 )      /* 0232 (c) 1997 SNK */
6341   DRIVER( kof97a )   /* 0232 (c) 1997 SNK */
6349   DRIVER( kof97h )   /* 0232 (c) 1997 SNK */
63426350   DRIVER( kof97pls )   /* bootleg of kof97 */
63436351   DRIVER( kog )      /* bootleg of kof97 */
63446352   DRIVER( magdrop3 )   /* 0233 (c) 1997 Data East Corporation */
r5891r5892
63956403   DRIVER( ct2k3sp )   /* bootleg of kof2001 */
63966404   DRIVER( ct2k3sa )   /* bootleg of kof2001 */
63976405   DRIVER( mslug4 )   /* 0263 (c) 2002 Mega Enterprise */
6406   DRIVER( mslug4h )   /* 0263 (c) 2002 Mega Enterprise */
63986407   DRIVER( ms4plus )   /* bootleg */
63996408   DRIVER( rotd )      /* 0264 (c) 2002 Evoga */
64006409   DRIVER( kof2002 )   /* 0265 (c) 2002 Eolith / Playmore */
r5891r5892
67606769   DRIVER( totcarnp )   /* (c) 1992 Midway */
67616770   DRIVER( mk2 )      /* (c) 1993 Midway */
67626771   DRIVER( mk2r32 )   /* (c) 1993 Midway */
6772   DRIVER( mk2r30 )   /* (c) 1993 Midway */
67636773   DRIVER( mk2r21 )   /* (c) 1993 Midway */
67646774   DRIVER( mk2r14 )   /* (c) 1993 Midway */
67656775   DRIVER( mk2r42 )   /* hack */
r5891r5892
89188928   DRIVER( rbmk )      /* (c) 1995 GMS */
89198929   DRIVER( go2000 )   /* (c) 2000 SA */
89208930   DRIVER( mirax )      /* (c) 1985 Current Technologies */
8931   DRIVER( miraxa )   /* (c) 1985 Current Technologies */
89218932
89228933   DRIVER( victor5 )   /* (c) 1990 Subsino */
89238934   DRIVER( victor21 )   /* (c) 1990 Subsino */
r5891r5892
97219732   /* Play Mechanix */
97229733   DRIVER( jnero )      /* (c) 2004 */
97239734
9735   /* Amatic Trading GMBH */
9736   DRIVER( am_uslot )   /* (c) Amatic 1996 */
9737   DRIVER( am_mg24 )   /* (c) Amatic 2000 */
9738   DRIVER( am_mg3 )   /* (c) Amatic 2000 */
9739
97249740#endif   /* DRIVER_RECURSIVE */
src/mame/includes/dkong.h
r5891r5892
112112   /* 2650 protection */
113113   UINT8 protect_type;
114114   UINT8 hunchloopback;
115   UINT8 prot_cnt;
116   UINT8 main_fo;
115117
116118   /* Save state relevant */
117119   UINT8   gfx_bank, palette_bank;
src/mame/includes/skyraid.h
r0r5892
1#include "sound/discrete.h"
2
3
4/*----------- defined in audio/norautp.c -----------*/
5
6DISCRETE_SOUND_EXTERN( skyraid );
7
8extern WRITE8_DEVICE_HANDLER( skyraid_sound_w );
src/mame/includes/atari.h
r5891r5892
157157#define GTIA_PLAYER    0x02
158158#define GTIA_TRIGGER   0x04
159159
160#ifdef  LSB_FIRST
161
162/* make a UINT32 from four bytes */
163#define MKD(b0,b1,b2,b3) ((b0)|((b1)<<8)|((b2)<<16)|((b3)<<24))
164
165#define BYTE0   0x000000ff
166#define BYTE1   0x0000ff00
167#define BYTE2   0x00ff0000
168#define BYTE3   0xff000000
169
170#else
171
172/* make a UINT32 from four bytes */
173#define MKD(b0,b1,b2,b3) (((b0)<<24)|((b1)<<16)|((b2)<<8)|(b3))
174
175#define BYTE0   0xff000000
176#define BYTE1   0x00ff0000
177#define BYTE2   0x0000ff00
178#define BYTE3   0x000000ff
179
180#endif
181
182/* make a qUINT16 from eight bytes */
183#define MKQ(b0,b1,b2,b3,b4,b5,b6,b7) MKD(b0,b1,b2,b3), MKD(b4,b5,b6,b7)
184
185/* make two UINT32s from 4 bytes by doubling them */
186#define MKDD(b0,b1,b2,b3) MKD(b0,b0,b1,b1), MKD(b2,b2,b3,b3)
187
188/* make a four UINT32s from 4 bytes by quadrupling them */
189#define MKQD(b0,b1,b2,b3) MKD(b0,b0,b0,b0), MKD(b1,b1,b1,b1), MKD(b2,b2,b2,b2), MKD(b3,b3,b3,b3)
190
191160/*****************************************************************************
192161 * If your memcpy does not expand too well if you use it with constant
193162 * size_t field, you might want to define these macros somehow different.
src/mame/includes/taito_f2.h
r5891r5892
3636VIDEO_UPDATE( taitof2 );
3737VIDEO_UPDATE( taitof2_pri );
3838VIDEO_UPDATE( taitof2_pri_roz );
39VIDEO_UPDATE( taitof2_driftout );
4039VIDEO_UPDATE( taitof2_ssi );
4140VIDEO_UPDATE( taitof2_thundfox );
4241VIDEO_UPDATE( taitof2_deadconx );
r5891r5892
4746READ16_HANDLER ( koshien_spritebank_r );
4847WRITE16_HANDLER( koshien_spritebank_w );
4948WRITE16_HANDLER( taitof2_sprite_extension_w );
50WRITE16_HANDLER( taitof2_palette_w );
src/mame/mame.mak
r5891r5892
213213#SOUNDS += SID8580
214214SOUNDS += SP0256
215215SOUNDS += DIGITALKER
216SOUNDS += CDP1863
217SOUNDS += CDP1864
216218
217219
218220#-------------------------------------------------
r5891r5892
428430   $(DRIVERS)/shuuz.o $(VIDEO)/shuuz.o \
429431   $(DRIVERS)/skullxbo.o $(VIDEO)/skullxbo.o \
430432   $(DRIVERS)/skydiver.o $(AUDIO)/skydiver.o $(VIDEO)/skydiver.o \
431   $(DRIVERS)/skyraid.o $(VIDEO)/skyraid.o \
433   $(DRIVERS)/skyraid.o $(AUDIO)/skyraid.o $(VIDEO)/skyraid.o \
432434   $(DRIVERS)/sprint2.o $(AUDIO)/sprint2.o $(VIDEO)/sprint2.o \
433435   $(DRIVERS)/sprint4.o $(VIDEO)/sprint4.o $(AUDIO)/sprint4.o \
434436   $(DRIVERS)/sprint8.o $(VIDEO)/sprint8.o \
r5891r5892
831833   $(DRIVERS)/simpsons.o $(MACHINE)/simpsons.o $(VIDEO)/simpsons.o \
832834   $(DRIVERS)/spy.o $(VIDEO)/spy.o \
833835   $(DRIVERS)/surpratk.o $(VIDEO)/surpratk.o \
836   $(DRIVERS)/tgtpanic.o \
834837   $(DRIVERS)/thunderx.o $(VIDEO)/thunderx.o \
835838   $(DRIVERS)/timeplt.o $(AUDIO)/timeplt.o $(VIDEO)/timeplt.o \
836839   $(DRIVERS)/tmnt.o $(VIDEO)/tmnt.o \
r5891r5892
14671470   $(DRIVERS)/4roses.o \
14681471   $(DRIVERS)/acefruit.o \
14691472   $(DRIVERS)/adp.o \
1473   $(DRIVERS)/amaticmg.o \
14701474   $(DRIVERS)/ambush.o $(VIDEO)/ambush.o \
14711475   $(DRIVERS)/ampoker2.o $(VIDEO)/ampoker2.o \
14721476   $(DRIVERS)/amspdwy.o $(VIDEO)/amspdwy.o \
r5891r5892
18521856            $(MAMESRC)/machine/snesdsp3.c \
18531857            $(MAMESRC)/machine/snesdsp4.c \
18541858            $(MAMESRC)/machine/snesobc1.c \
1859            $(MAMESRC)/machine/snescx4.c \
1860            $(MAMESRC)/machine/cx4ops.c \
1861            $(MAMESRC)/machine/cx4oam.c \
1862            $(MAMESRC)/machine/cx4fn.c \
1863            $(MAMESRC)/machine/cx4data.c \
18551864            $(MAMESRC)/machine/snesrtc.c \
1856            $(MAMESRC)/machine/snessdd1.c
1865            $(MAMESRC)/machine/snessdd1.c \
1866            $(MAMESRC)/machine/snes7110.c \
1867            $(MAMESRC)/machine/snesst10.c
src/mame/video/namcona1.c
r5891r5892
185185
186186/*************************************************************************/
187187
188#define XOR(a) BYTE_XOR_BE(a)
189
188190static const gfx_layout shape_layout =
189191{
190192   8,8,
r5891r5892
192194   1,
193195   { 0 },
194196   { 0,1,2,3,4,5,6,7 },
195#ifdef LSB_FIRST
196   { 8*1,8*0,8*3,8*2,8*5,8*4,8*7,8*6 },
197#else
198   { 8*0,8*1,8*2,8*3,8*4,8*5,8*6,8*7 },
199#endif
197   { 8*XOR(0),8*XOR(1),8*XOR(2),8*XOR(3),8*XOR(4),8*XOR(5),8*XOR(6),8*XOR(7) },
200198   8*8
201199}; /* shape_layout */
202200
r5891r5892
206204   0x1000,
207205   8, /* 8BPP */
208206   { 0,1,2,3,4,5,6,7 },
209#ifdef LSB_FIRST
210   { 8*1,8*0,8*3,8*2,8*5,8*4,8*7,8*6 },
211#else
212   { 8*0,8*1,8*2,8*3,8*4,8*5,8*6,8*7 },
213#endif
207   { 8*XOR(0),8*XOR(1),8*XOR(2),8*XOR(3),8*XOR(4),8*XOR(5),8*XOR(6),8*XOR(7) },
214208   { 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7 },
215209   64*8
216210}; /* cg_layout_8bpp */
r5891r5892
221215   0x1000,
222216   4, /* 4BPP */
223217   { 4,5,6,7 },
224#ifdef LSB_FIRST
225   { 8*1,8*0,8*3,8*2,8*5,8*4,8*7,8*6 },
226#else
227   { 8*0,8*1,8*2,8*3,8*4,8*5,8*6,8*7 },
228#endif
218   { 8*XOR(0),8*XOR(1),8*XOR(2),8*XOR(3),8*XOR(4),8*XOR(5),8*XOR(6),8*XOR(7) },
229219   { 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7 },
230220   64*8
231221}; /* cg_layout_4bpp */
src/mame/video/taitoic.c
r5891r5892
14421442
14431443/* Is this endian-correct ??? */
14441444
1445#define XOR(a) WORD_XOR_BE(a)
1446
14451447static const gfx_layout TC0080VCO_charlayout =
14461448{
14471449   8, 8,   /* 8x8 pixels */
14481450   256,   /* 256 chars */
1449
1450// can't be 4bpp as it becomes opaque in Ainferno...
1451//  4,      /* 4 bits per pixel */
1452//#ifdef LSB_FIRST
1453//  { 0x10000*8 + 8, 0x10000*8, 8, 0 },
1454//#else
1455//  { 0x10000*8, 0x10000*8 + 8, 0, 8 },
1456//#endif
1457
14581451   3,      /* 3 bits per pixel */
1459#ifdef LSB_FIRST
1460   { 0x10000*8, 8, 0 },
1461#else
1462   { 0x10000*8 + 8, 0, 8 },
1463#endif
1452   { 0x10000*8 + XOR(2)*4, XOR(0)*4, XOR(2)*4 },
14641453   { 0, 1, 2, 3, 4, 5, 6, 7 },
14651454   { 16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7 },
14661455   16*8
r5891r5892
21332122   8,8,   /* 8*8 characters */
21342123   256,   /* 256 characters */
21352124   2,   /* 2 bits per pixel */
2136#ifdef LSB_FIRST
2137   { 8, 0 },
2138#else
2139   { 0, 8 },
2140#endif
2125   { XOR(0)*4, XOR(2)*4 },
21412126   { 0, 1, 2, 3, 4, 5, 6, 7 },
21422127   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
21432128   16*8   /* every sprite takes 16 consecutive bytes */
r5891r5892
29222907   256,   /* 256 characters */
29232908   4,   /* 4 bits per pixel */
29242909   { 0, 1, 2, 3 },
2925#ifdef LSB_FIRST
2926   { 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 },
2927#else
2928   { 3*4, 2*4, 1*4, 0*4, 7*4, 6*4, 5*4, 4*4 },
2929#endif
2910   { XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4, XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4 },
29302911   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
29312912   32*8   /* every sprite takes 32 consecutive bytes */
29322913};
src/mame/video/segaic24.c
r5891r5892
8484static int sys24_char_gfx_index;
8585static tilemap *sys24_tile_layer[4];
8686
87#ifdef LSB_FIRST
87#define XOR(a) WORD_XOR_BE(a)
88
8889static const gfx_layout sys24_char_layout = {
8990   8, 8,
9091   SYS24_TILES,
9192   4,
9293   { 0, 1, 2, 3 },
93   { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
94   { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 },
9495   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
9596   8*32
9697};
97#else
98static const gfx_layout sys24_char_layout = {
99   8, 8,
100   SYS24_TILES,
101   4,
102   { 0, 1, 2, 3 },
103   { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
104   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
105   8*32
106};
107#endif
10898
10999static TILE_GET_INFO( sys24_tile_info_0s )
110100{
src/mame/video/vigilant.c
r5891r5892
276276   }
277277}
278278
279VIDEO_UPDATE( kikcubic )
280{
281   int offs;
282
283   for (offs = 0; offs<videoram_size; offs+=2 )
284   {
285      int sy = 8 * ((offs/2) / 64);
286      int sx = 8 * ((offs/2) % 64);
287      int attributes = videoram[offs+1];
288      int color = (attributes & 0xF0) >> 4;
289      int tile_number = videoram[offs] | ((attributes & 0x0F) << 8);
290
291      drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],
292            tile_number,
293            color,
294            0,0,
295            sx,sy);
296   }
297
298   draw_sprites(screen->machine,bitmap,cliprect);
299   return 0;
300}
301
279302VIDEO_UPDATE( vigilant )
280303{
281304   int i;
r5891r5892
314337   }
315338   return 0;
316339}
317
318VIDEO_UPDATE( kikcubic )
319{
320   int offs;
321
322
323   for (offs = 0; offs<videoram_size; offs+=2 )
324   {
325      int sy = 8 * ((offs/2) / 64);
326      int sx = 8 * ((offs/2) % 64);
327      int attributes = videoram[offs+1];
328      int color = (attributes & 0xF0) >> 4;
329      int tile_number = videoram[offs] | ((attributes & 0x0F) << 8);
330
331      drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],
332            tile_number,
333            color,
334            0,0,
335            sx,sy);
336   }
337
338   draw_sprites(screen->machine,bitmap,cliprect);
339   return 0;
340}
src/mame/video/konamiic.c
r5891r5892
19621962}
19631963
19641964
1965#define XOR(a) WORD_XOR_BE(a)
1966
19651967void K052109_vh_start(running_machine *machine,const char *gfx_memory_region,int plane_order,
19661968      void (*callback)(int tmap,int bank,int *code,int *color,int *flags,int *priority))
19671969{
r5891r5892
19831985      0,
19841986      4,
19851987      { 0, 1, 2, 3 },
1986#ifdef LSB_FIRST
1987      { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
1988#else
1989      { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
1990#endif
1988      { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 },
19911989      { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
19921990      32*8
19931991   };
r5891r5892
46274625      0,
46284626      4,
46294627      { 0, 1, 2, 3 },
4630#ifdef LSB_FIRST
4631      { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4,
4632            10*4, 11*4, 8*4, 9*4, 14*4, 15*4, 12*4, 13*4 },
4633#else
4634      { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
4635            8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
4636#endif
4628      { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4,
4629            XOR(8)*4, XOR(9)*4, XOR(10)*4, XOR(11)*4, XOR(12)*4, XOR(13)*4, XOR(14)*4, XOR(15)*4 },
46374630      { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
46384631            8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
46394632      128*8
src/mame/video/neogeo.c
r5891r5892
334334}
335335
336336      {
337         UINT8 data = 0;
337         UINT8 data;
338338         int i;
339339
340340         UINT8 *gfx = &gfx_base[((code << 5) | (scanline & 0x07)) & addr_mask];
341341         pen_t *char_pens = &pens[code_and_palette >> 12 << 4];
342342
343         for (i = 0; i < 8; i++)
343         for (i = 0; i < 4; i++)
344344         {
345345            static const UINT32 pix_offsets[] = { 0x10, 0x18, 0x00, 0x08 };
346346
347            if (i & 0x01)
348               data = data >> 4;
349            else
350               data = gfx[pix_offsets[i >> 1]];
347            data = gfx[pix_offsets[i]];
351348
352349            if (data & 0x0f)
353350               *pixel_addr = char_pens[data & 0x0f];
351            pixel_addr++;
354352
353            if (data & 0xf0)
354               *pixel_addr = char_pens[(data & 0xf0) >> 4];
355355            pixel_addr++;
356356         }
357357      }
src/mame/video/taito_f2.c
r5891r5892
7373static UINT8 f2_spritepri[6]; // todo - move into taitoic.c
7474static UINT8 f2_spriteblendmode; // todo - move into taitoic.c
7575
76static UINT16 *paletteram_buffer;
77
7876enum
7977{
8078   FOOTCHMP = 1
r5891r5892
297295   f2_pivot_xdisp = -16;
298296   f2_pivot_ydisp = 16;
299297   taitof2_core_vh_start(machine, 0,3,3,0,0,0,0,0,0);
300
301   paletteram_buffer = auto_alloc_array(machine, UINT16, 4096);
302   memset(paletteram_buffer, 0, 4096*sizeof(UINT16));
303   state_save_register_global_pointer(machine, paletteram_buffer, 4096);
304298}
305299
306WRITE16_HANDLER( taitof2_palette_w )
307{
308   COMBINE_DATA(&paletteram_buffer[offset]);
309}
310300
311
312301/********************************************************
313302          SPRITE READ AND WRITE HANDLERS
314303
r5891r5892
12051194   return 0;
12061195}
12071196
1208VIDEO_UPDATE( taitof2_driftout )
1209{
1210   UINT16 pen;
12111197
1212   /* send palette, workaround for bug http://www.mametesters.org/view.php?id=3356 (just for this game)
1213     driftout writes twice per frame to the palette, this causes glitches on some setups due to
1214     VIDEO_UPDATE not being synced to renderer update when multithreading is on. */
1215   for (pen=0;pen<4096;pen++)
1216      palette_set_color_rgb(screen->machine, pen, pal5bit(paletteram_buffer[pen] >> 10), pal5bit(paletteram_buffer[pen] >> 5), pal5bit(paletteram_buffer[pen] >> 0));
12171198
1218   return VIDEO_UPDATE_CALL( taitof2_pri_roz );
1219}
1220
1221
1222
12231199/* Thunderfox */
12241200VIDEO_UPDATE( taitof2_thundfox )
12251201{
src/mame/drivers/tgtpanic.c
r0r5892
1/***************************************************************************
2
3    Konami Target Panic (cabinet test PCB)
4
5    driver by Phil Bennett
6
7    TODO: Determine correct clock frequencies, fix 'stuck' inputs in
8    test mode
9
10***************************************************************************/
11
12#include "driver.h"
13#include "cpu/z80/z80.h"
14
15static UINT8 *ram;
16static UINT8 color;
17
18
19/*************************************
20 *
21 *  Video hardware
22 *
23 *************************************/
24
25static VIDEO_UPDATE( tgtpanic )
26{
27   UINT32 colors[4];
28   UINT32 offs;
29   UINT32 x, y;
30
31   colors[0] = 0;
32   colors[1] = 0xffffffff;
33   colors[2] = MAKE_RGB(pal1bit(color >> 2), pal1bit(color >> 1), pal1bit(color >> 0));
34   colors[3] = MAKE_RGB(pal1bit(color >> 6), pal1bit(color >> 5), pal1bit(color >> 4));
35
36   for (offs = 0; offs < 0x2000; ++offs)
37   {
38      UINT8 val = ram[offs];
39
40      y = (offs & 0x7f) << 1;
41      x = (offs >> 7) << 2;
42
43      /* I'm guessing the hardware doubles lines */
44      *BITMAP_ADDR32(bitmap, y + 0, x + 0) = colors[val & 3];
45      *BITMAP_ADDR32(bitmap, y + 1, x + 0) = colors[val & 3];
46      val >>= 2;
47      *BITMAP_ADDR32(bitmap, y + 0, x + 1) = colors[val & 3];
48      *BITMAP_ADDR32(bitmap, y + 1, x + 1) = colors[val & 3];
49      val >>= 2;
50      *BITMAP_ADDR32(bitmap, y + 0, x + 2) = colors[val & 3];
51      *BITMAP_ADDR32(bitmap, y + 1, x + 2) = colors[val & 3];
52      val >>= 2;
53      *BITMAP_ADDR32(bitmap, y + 0, x + 3) = colors[val & 3];
54      *BITMAP_ADDR32(bitmap, y + 1, x + 3) = colors[val & 3];
55   }
56
57   return 0;
58}
59
60static WRITE8_HANDLER( color_w )
61{
62   video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
63   color = data;
64}
65
66
67/*************************************
68 *
69 *  Address maps
70 *
71 *************************************/
72
73static ADDRESS_MAP_START( prg_map, ADDRESS_SPACE_PROGRAM, 8 )
74   AM_RANGE(0x0000, 0x7fff) AM_ROM
75   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(&ram)
76ADDRESS_MAP_END
77
78static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
79   ADDRESS_MAP_GLOBAL_MASK(0xff)
80   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(color_w)
81   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
82ADDRESS_MAP_END
83
84
85/*************************************
86 *
87 *  Inputs
88 *
89 *************************************/
90
91static INPUT_PORTS_START( tgtpanic )
92   PORT_START("IN0")
93   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
94   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
95   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
96   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
97   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
98   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
99   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
100   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
101
102   PORT_START("IN1")
103   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
104   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )
105   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
106   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
107   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
108   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
109   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
110   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
111INPUT_PORTS_END
112
113
114/*************************************
115 *
116 *  Machine driver
117 *
118 *************************************/
119
120static MACHINE_DRIVER_START( tgtpanic )
121
122   /* basic machine hardware */
123   MDRV_CPU_ADD("cpu", Z80, XTAL_4MHz)
124   MDRV_CPU_PROGRAM_MAP(prg_map)
125   MDRV_CPU_IO_MAP(io_map)
126   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 20) /* Unverified */
127
128   /* video hardware */
129   MDRV_VIDEO_UPDATE(tgtpanic)
130
131   MDRV_SCREEN_ADD("screen", RASTER)
132   MDRV_SCREEN_REFRESH_RATE(60) /* Unverified */
133   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* Unverified */
134   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
135   MDRV_SCREEN_SIZE(256, 256)
136   MDRV_SCREEN_VISIBLE_AREA(0, 192 - 1, 0, 192 - 1)
137MACHINE_DRIVER_END
138
139
140 /*************************************
141 *
142 *  ROM definition
143 *
144 *************************************/
145
146ROM_START( tgtpanic )
147   ROM_REGION( 0x10000, "cpu", 0 )
148   ROM_LOAD( "601_ja_a01.13e", 0x0000, 0x8000, CRC(ece71952) SHA1(0f9cbd8adac2b1950bc608d51f0f122399c8f00f) )
149ROM_END
150
151
152/*************************************
153 *
154 *  Game driver
155 *
156 *************************************/
157
158GAME( 1996, tgtpanic, 0, tgtpanic, tgtpanic, 0, ROT0, "Konami", "Target Panic", GAME_NO_SOUND )
src/mame/drivers/tomcat.c
r5891r5892
88    - game has no sound, while sound hardware was developed, sound program was
99      not prepared
1010
11    ToDo:
11    TODO:
1212    - add proper timing of interrupts and framerate (currently commented out,
1313      as they cause test mode to hang)
1414    - vector quality appears to be worse than original game (compared to original
r5891r5892
1818    - current implementation of 68010 <-> tms32010 is a little bit hacky, after
1919      tms32010 is started by 68010, 68010 is suspended until tms32010 reads command
2020      and starts executing
21    - hook up tms5220 - it is currently not used at all
2122
2223*/
2324
r5891r5892
354355
355356static const riot6532_interface tomcat_riot6532_intf =
356357{
357   NULL,
358   DEVCB_NULL,
358359/*
359360    PA0 = /WS   OUTPUT  (TMS-5220 WRITE STROBE)
360361    PA1 = /RS   OUTPUT  (TMS-5220 READ STROBE)
r5891r5892
367368    PA6 = /MUSRES   OUTPUT  (Reset the Yamaha)
368369    PA7 = MAINFLAG  INPUT
369370*/
370   NULL,
371   NULL,
372   NULL,   //  PB0 - PB7   OUTPUT  Speech Data
373   NULL   // connected to IRQ line of 6502
371   DEVCB_NULL,
372   DEVCB_NULL,
373   DEVCB_NULL,   //  PB0 - PB7   OUTPUT  Speech Data
374   DEVCB_NULL   // connected to IRQ line of 6502
374375};
375376
376377static MACHINE_DRIVER_START(tomcat)
src/mame/drivers/skyraid.c
r5891r5892
66
77#include "driver.h"
88#include "cpu/m6502/m6502.h"
9#include "skyraid.h"
910
1011extern UINT8* skyraid_alpha_num_ram;
1112extern UINT8* skyraid_pos_ram;
r5891r5892
5657   return val;
5758}
5859
59static WRITE8_HANDLER( skyraid_sound_w )
60{
61   /* BIT0 => PLANE SWEEP */
62   /* BIT1 => MISSILE     */
63   /* BIT2 => EXPLOSION   */
64   /* BIT3 => START LAMP  */
65   /* BIT4 => PLANE ON    */
66   /* BIT5 => ATTRACT     */
6760
68   set_led_status(0, !(data & 0x08));
69}
70
71
7261static WRITE8_HANDLER( skyraid_range_w )
7362{
7463   analog_range = data & 0x3f;
r5891r5892
9786   AM_RANGE(0x1400, 0x1401) AM_READ_PORT("SYSTEM")
9887   AM_RANGE(0x1c00, 0x1c0f) AM_WRITEONLY AM_BASE(&skyraid_obj_ram)
9988   AM_RANGE(0x4000, 0x4000) AM_WRITE(skyraid_scroll_w)
100   AM_RANGE(0x4400, 0x4400) AM_WRITE(skyraid_sound_w)
89   AM_RANGE(0x4400, 0x4400) AM_DEVWRITE("discrete", skyraid_sound_w)
10190   AM_RANGE(0x4800, 0x4800) AM_WRITE(skyraid_range_w)
10291   AM_RANGE(0x5000, 0x5000) AM_WRITE(watchdog_reset_w)
10392   AM_RANGE(0x5800, 0x5800) AM_WRITE(skyraid_offset_w)
r5891r5892
240229   MDRV_CPU_ADD("maincpu", M6502, 12096000 / 12)
241230   MDRV_CPU_PROGRAM_MAP(skyraid_map)
242231   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
232   MDRV_WATCHDOG_VBLANK_INIT(4)
243233
244234   /* video hardware */
245235   MDRV_SCREEN_ADD("screen", RASTER)
r5891r5892
258248   MDRV_VIDEO_UPDATE(skyraid)
259249
260250   /* sound hardware */
251   MDRV_SPEAKER_STANDARD_MONO("mono")
252
253   MDRV_SOUND_ADD("discrete", DISCRETE, 96000)
254   MDRV_SOUND_CONFIG_DISCRETE(skyraid)
255   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
261256MACHINE_DRIVER_END
262257
263258
r5891r5892
291286ROM_END
292287
293288
294GAME( 1978, skyraid, 0, skyraid, skyraid, 0, ORIENTATION_FLIP_Y, "Atari", "Sky Raider", GAME_NO_SOUND | GAME_IMPERFECT_COLORS )
289GAME( 1978, skyraid, 0, skyraid, skyraid, 0, ORIENTATION_FLIP_Y, "Atari", "Sky Raider", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_COLORS )
src/mame/drivers/chinagat.c
r5891r5892
580580   MDRV_SOUND_ROUTE(0, "mono", 0.80)
581581   MDRV_SOUND_ROUTE(1, "mono", 0.80)
582582
583   MDRV_SOUND_ADD("oki", OKIM6295, 1452000)
584   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified
585   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.45)
583   MDRV_SOUND_ADD("oki", OKIM6295, 1065000)
584   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // pin 7 not verified, clock frequency estimated with recording
585   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
586586MACHINE_DRIVER_END
587587
588588static MACHINE_DRIVER_START( saiyugb1 )
src/mame/drivers/kaneko16.c
r5891r5892
21562156static MACHINE_DRIVER_START( shogwarr )
21572157
21582158   /* basic machine hardware */
2159   MDRV_CPU_ADD("maincpu", M68000, 12000000)
2159   MDRV_CPU_ADD("maincpu", M68000, XTAL_12MHz)
21602160   MDRV_CPU_PROGRAM_MAP(shogwarr)
21612161   MDRV_CPU_VBLANK_INT_HACK(shogwarr_interrupt,SHOGWARR_INTERRUPTS_NUM)
21622162
r5891r5892
21642164
21652165   /* video hardware */
21662166   MDRV_SCREEN_ADD("screen", RASTER)
2167   MDRV_SCREEN_REFRESH_RATE(60)
2167   MDRV_SCREEN_REFRESH_RATE(59.1854)
21682168   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
21692169   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
21702170   MDRV_SCREEN_SIZE(320, 240)
r5891r5892
21812181   /* sound hardware */
21822182   MDRV_SPEAKER_STANDARD_MONO("mono")
21832183
2184   MDRV_SOUND_ADD("oki1", OKIM6295, 1980000)
2185   MDRV_SOUND_CONFIG(okim6295_interface_pin7low) // clock frequency & pin 7 not verified
2184   MDRV_SOUND_ADD("oki1", OKIM6295, XTAL_16MHz/8)
2185   MDRV_SOUND_CONFIG(okim6295_interface_pin7low)
21862186   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
21872187
2188   MDRV_SOUND_ADD("oki2", OKIM6295, 1980000)
2189   MDRV_SOUND_CONFIG(okim6295_interface_pin7low) // clock frequency & pin 7 not verified
2188   MDRV_SOUND_ADD("oki2", OKIM6295, XTAL_16MHz/8)
2189   MDRV_SOUND_CONFIG(okim6295_interface_pin7low)
21902190   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
21912191MACHINE_DRIVER_END
21922192
r5891r5892
35323532
35333533Main PCB No: ZO1DK-002
35343534ROM PCB No:  ZO1DK-EXROM
3535CPU: TMP68HC000N-12
3536SND: OKI M6295 x 2
3535CPU: TMP68HC000N-12 @ 12.000MHz
3536SND: OKI M6295 x 2 @ 2.000MHz [16/8]. Pin 7 is low.
35373537OSC: 16.000MHz, 12.000MHz
35383538DIP: 1 x 8 POSITION
35393539SW1 - PCB location for 2 position DIP but location is unpopulated.
r5891r5892
35973597KANEKO JAPAN 9204 T (44 PIN PQFP)
35983598PALs (x 11, read protected, not dumped)
35993599
3600VSync is 59.1854Hz
3601HSync is 15.625kHz
3602
36003603ROMs:
36013604RB-004.U61  27C010    \     Main program
36023605RB-005.U62  27C010    /
src/mame/drivers/gauntlet.c
r5891r5892
135135 *
136136 *************************************/
137137
138static UINT8 speech_val;
139static UINT8 last_speech_write;
140138static UINT16 sound_reset_val;
141139
142140
r5891r5892
168166
169167static MACHINE_RESET( gauntlet )
170168{
171   last_speech_write = 0x80;
172169   sound_reset_val = 1;
173170
174171   atarigen_eeprom_reset();
r5891r5892
231228
232229   if (atarigen_cpu_to_sound_ready) temp ^= 0x80;
233230   if (atarigen_sound_to_cpu_ready) temp ^= 0x40;
234   if (tms5220_ready_r(devtag_get_device(space->machine, "tms"))) temp ^= 0x20;
231   if (!tms5220_readyq_r(devtag_get_device(space->machine, "tms"))) temp ^= 0x20;
235232   if (!(input_port_read(space->machine, "803008") & 0x0008)) temp ^= 0x10;
236233
237234   return temp;
238235}
239236
240237
241
242238/*************************************
243239 *
244 *  Sound TMS5220 write
245 *
246 *************************************/
247
248static WRITE8_HANDLER( tms5220_w )
249{
250   speech_val = data;
251}
252
253
254
255/*************************************
256 *
257240 *  Sound control write
258241 *
259242 *************************************/
r5891r5892
267250         break;
268251
269252      case 1:   /* speech write, bit D7, active low */
270         if (((data ^ last_speech_write) & 0x80) && (data & 0x80))
271            tms5220_data_w(tms, 0, speech_val);
272         last_speech_write = data;
253         tms5220_wsq_w(tms, data >> 7);
273254         break;
274255
275256      case 2:   /* speech reset, bit D7, active low */
276         if (((data ^ last_speech_write) & 0x80) && (data & 0x80))
277            device_reset(tms);
257         tms5220_rsq_w(tms, data >> 7);
278258         break;
279259
280260      case 3:   /* speech squeak, bit D7 */
r5891r5892
358338   AM_RANGE(0x1030, 0x103f) AM_MIRROR(0x27c0) AM_READWRITE(switch_6502_r, sound_ctl_w)
359339   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE("pokey", pokey_r, pokey_w)
360340   AM_RANGE(0x1810, 0x1811) AM_MIRROR(0x27ce) AM_DEVREADWRITE("ym", ym2151_r, ym2151_w)
361   AM_RANGE(0x1820, 0x182f) AM_MIRROR(0x27c0) AM_WRITE(tms5220_w)
341   AM_RANGE(0x1820, 0x182f) AM_MIRROR(0x27c0) AM_DEVWRITE("tms", tms5220_data_w)
362342   AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x27c0) AM_READWRITE(atarigen_6502_irq_ack_r, atarigen_6502_irq_ack_w)
363343   AM_RANGE(0x4000, 0xffff) AM_ROM
364344ADDRESS_MAP_END
r5891r5892
557537   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.32)
558538   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.32)
559539
560   MDRV_SOUND_ADD("tms", TMS5220, ATARI_CLOCK_14MHz/2/11)   /* potentially ATARI_CLOCK_14MHz/2/9 as well */
540   MDRV_SOUND_ADD("tms", TMS5220C, ATARI_CLOCK_14MHz/2/11)   /* potentially ATARI_CLOCK_14MHz/2/9 as well */
561541   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80)
562542   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80)
563543MACHINE_DRIVER_END
src/mame/drivers/btime.c
r5891r5892
13861386   /* Mix 5 channels 1A, 1B, 1C, 2B, 2C directly */
13871387   DISCRETE_ADDER3(NODE_20, 1, NODE_01, NODE_02, NODE_03)
13881388   DISCRETE_ADDER3(NODE_21, 1, NODE_20, NODE_05, NODE_06)
1389   DISCRETE_MULTIPLY(NODE_22, 1, NODE_21, 0.2)
1389   DISCRETE_MULTIPLY(NODE_22, NODE_21, 0.2)
13901390
13911391   /* Filter of channel 2A */
13921392   DISCRETE_OP_AMP_FILTER(NODE_30, 1, NODE_04, NODE_NC, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &btime_opamp_desc)
src/mame/drivers/nova2001.c
r5891r5892
386386   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ninjakun_io_A002_ctrl_r, NULL)
387387
388388   PORT_START("DSW1")
389   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
389   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )  PORT_DIPLOCATION("SW1:1")
390390   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
391391   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
392   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )
392   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )  PORT_DIPLOCATION("SW1:2,3")
393393   PORT_DIPSETTING(    0x02, "2" )
394394   PORT_DIPSETTING(    0x04, "3" )
395395   PORT_DIPSETTING(    0x06, "4" )
396396   PORT_DIPSETTING(    0x00, "5" )
397   PORT_DIPNAME( 0x08, 0x08, "First Bonus" )
397   PORT_DIPNAME( 0x08, 0x08, "First Bonus" )  PORT_DIPLOCATION("SW1:4")
398398   PORT_DIPSETTING(    0x08, "30000" )
399399   PORT_DIPSETTING(    0x00, "40000" )
400   PORT_DIPNAME( 0x30, 0x30, "Second Bonus" )
400   PORT_DIPNAME( 0x30, 0x30, "Second Bonus" )  PORT_DIPLOCATION("SW1:5,6")
401401   PORT_DIPSETTING(    0x00, "No Bonus" )
402402   PORT_DIPSETTING(    0x10, "Every 30000" )
403403   PORT_DIPSETTING(    0x30, "Every 50000" )
404404   PORT_DIPSETTING(    0x20, "Every 70000" )
405   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
405   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW1:7")
406406   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
407407   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
408   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )
408   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )  PORT_DIPLOCATION("SW1:8")
409409   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
410410   PORT_DIPSETTING(    0x00, DEF_STR( Hard )   )
411411
412412   PORT_START("DSW2")
413   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
413   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )  PORT_DIPLOCATION("SW2:1,2,3")
414414   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
415415   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
416416   PORT_DIPSETTING(    0x00, DEF_STR( 4C_2C ) )
r5891r5892
419419   PORT_DIPSETTING(    0x02, DEF_STR( 2C_2C ) )
420420   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
421421   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
422   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )
422   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )  PORT_DIPLOCATION("SW2:4")
423423   PORT_DIPSETTING(    0x00, "3 Letters" )
424424   PORT_DIPSETTING(    0x08, "8 Letters" )
425   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Allow_Continue ) )
425   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Allow_Continue ) )  PORT_DIPLOCATION("SW2:5")
426426   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
427427   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
428   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )/* Probably Unused */
429   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
430   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
431   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
428        PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" )
429   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )  PORT_DIPLOCATION("SW2:7")
432430   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
433431   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
434   PORT_DIPNAME( 0x80, 0x80, "Infinite Lives (If Free Play)" )
432   PORT_DIPNAME( 0x80, 0x80, "Infinite Lives (If Free Play)" )  PORT_DIPLOCATION("SW2:8")
435433   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
436434   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
437435INPUT_PORTS_END
r5891r5892
458456   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
459457
460458   PORT_START("IN2")
461   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
462   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
463   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
464   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
465   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
466   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
467   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
468   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
469   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
470   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
471   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
472   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
473   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
474   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
475   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
476   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
477   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
478   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
479   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
480   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
481   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
482   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
483   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
484   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
459        PORT_DIPUNKNOWN_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" )
460        PORT_DIPUNKNOWN_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" )
461        PORT_DIPUNKNOWN_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" )
462        PORT_DIPUNKNOWN_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" )
463        PORT_DIPUNKNOWN_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" )
464        PORT_DIPUNKNOWN_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" )
465        PORT_DIPUNKNOWN_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" )
466        PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
485467
486468   PORT_START("DSW1")
487   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
469   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )  PORT_DIPLOCATION("SW2:1,2")
488470   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
489471   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
490472   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
491473   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
492   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
474   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )  PORT_DIPLOCATION("SW2:3")
493475   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
494476   PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
495   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
477   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW2:4")
496478   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
497479   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
498   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
480   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )  PORT_DIPLOCATION("SW2:5,6")
499481   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
500482   PORT_DIPSETTING(    0x30, DEF_STR( Medium ) )
501483   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
502484   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
503   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
485   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )  PORT_DIPLOCATION("SW2:7")
504486   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
505487   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
506   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
488   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )  PORT_DIPLOCATION("SW2:8")
507489   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
508490   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
509491INPUT_PORTS_END
r5891r5892
530512   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
531513
532514   PORT_START("IN2")
533   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
515   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )  PORT_DIPLOCATION("SW1:1")
534516   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
535517   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
536   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) )
518   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) )  PORT_DIPLOCATION("SW1:2,3")
537519   PORT_DIPSETTING(    0x00, "2" )
538520   PORT_DIPSETTING(    0x06, "3" )
539521   PORT_DIPSETTING(    0x04, "4" )
540522   PORT_DIPSETTING(    0x02, "5" )
541   PORT_DIPNAME( 0x08, 0x08, "1st Bonus" )
523   PORT_DIPNAME( 0x08, 0x08, "1st Bonus" )  PORT_DIPLOCATION("SW1:4")
542524   PORT_DIPSETTING(    0x08, "30000" )
543525   PORT_DIPSETTING(    0x00, "40000" )
544   PORT_DIPNAME( 0x30, 0x30, "2nd Bonus" )
545   PORT_DIPSETTING(    0x30, "Every(?) 50000" )
546   PORT_DIPSETTING(    0x20, "Every(?) 70000" )
547   PORT_DIPSETTING(    0x10, "Every(?) 90000" )
526   PORT_DIPNAME( 0x30, 0x30, "2nd Bonus" )  PORT_DIPLOCATION("SW1:5,6")
527   PORT_DIPSETTING(    0x30, "Every 50000" )
528   PORT_DIPSETTING(    0x20, "Every 70000" )
529   PORT_DIPSETTING(    0x10, "Every 90000" )
548530   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
549   PORT_DIPNAME( 0x40, 0x40, "Exercise" )
531   PORT_DIPNAME( 0x40, 0x40, "Exercise" )  PORT_DIPLOCATION("SW1:7")  // Unused in manual
550532   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
551533   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
552   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )
534   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )  PORT_DIPLOCATION("SW1:8")
553535   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
554536   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
555537
556538   PORT_START("DSW1")
557   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
539   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )  PORT_DIPLOCATION("SW2:1,2,3")
558540   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
559541   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
560542   PORT_DIPSETTING(    0x00, DEF_STR( 4C_2C ) )
r5891r5892
563545   PORT_DIPSETTING(    0x02, DEF_STR( 2C_2C ) )
564546   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
565547   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
566   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )
548   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )  PORT_DIPLOCATION("SW2:4")
567549   PORT_DIPSETTING(    0x00, "3 Letters" )
568550   PORT_DIPSETTING(    0x08, "8 Letters" )
569   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
551   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )  PORT_DIPLOCATION("SW2:5")
570552   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
571553   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
572   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
573   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
574   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
575   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
554        PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" )
555   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )  PORT_DIPLOCATION("SW2:7") // Unused in manual
576556   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
577557   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
578   PORT_DIPNAME( 0x80, 0x80, "Unlimited Lives (If Free Play)" )
558   PORT_DIPNAME( 0x80, 0x80, "Unlimited Lives (If Free Play)" )  PORT_DIPLOCATION("SW2:8")  // Unused in manual
579559   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
580560   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
581561INPUT_PORTS_END
src/mame/drivers/photon2.c
r5891r5892
55
66    Russian arcade system based on ZX Spectrum home computer.
77
8    Each coin buys you 1-6 minutes of game time.
89*/
910
1011#include "driver.h"
r5891r5892
243244
244245   PORT_START("COIN")
245246   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_PLAYER(1) PORT_IMPULSE(1)
246   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
247   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
248   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
249   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
250   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
251   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
252   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
247   PORT_DIPNAME( 0x0e, 0x0e, "Time per Coin" )
248   PORT_DIPSETTING(    0x00, "1:00" )
249   PORT_DIPSETTING(    0x02, "1:30" )
250   PORT_DIPSETTING(    0x04, "2:00" )
251   PORT_DIPSETTING(    0x06, "2:30" )
252   PORT_DIPSETTING(    0x08, "3:00" )
253   PORT_DIPSETTING(    0x0a, "4:00" )
254   PORT_DIPSETTING(    0x0c, "5:00" )
255   PORT_DIPSETTING(    0x0e, "6:00" )
256   // todo: check if these are really unused..
257   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
258   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
259   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
260   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
253261INPUT_PORTS_END
254262
255263static INPUT_PORTS_START( black )
r5891r5892
353361   ROM_LOAD( "brod13.bin", 0xa000, 0x2000, CRC(1177cd17) SHA1(58c5c09a7b857ce6311339c4d0f4d8c1a7e232a3) )
354362ROM_END
355363
356GAME( 19??,  kok,   0,      photon2, photon2, 0, ROT0, "<unknown>", "Povar / Sobrat' Buran / Agroprom", 0 )
357GAME( 19??,  black, 0,      photon2, black,   0, ROT0, "<unknown>", "Czernyj Korabl", 0 )
358GAME( 19??,  brod,  0,      photon2, black,   0, ROT0, "<unknown>", "Brodjaga", 0 )
364GAME( 19??,  kok,   0,      photon2, photon2, 0, ROT0, "<unknown>", "Povar / Sobrat' Buran / Agroprom (Arcade multi-game bootleg of ZX Spectrum 'Cookie', 'Jetpac' & 'Pssst')", 0 ) // originals (c)1983 ACG / Ultimate
365GAME( 19??,  black, 0,      photon2, black,   0, ROT0, "<unknown>", "Czernyj Korabl (Arcade bootleg of ZX Spectrum 'Blackbeard')", 0 ) // original (c)1988 Toposoft
366GAME( 19??,  brod,  0,      photon2, black,   0, ROT0, "<unknown>", "Brodjaga (Arcade bootleg of ZX Spectrum 'Inspector Gadget and the Circus of Fear')", 0 ) // original (c)1987 BEAM software
src/mame/drivers/amaticmg.c
r0r5892
1/**********************************************************************************
2
3
4  AMATIC - MULTI GAME SYSTEM
5  --------------------------
6
7  Preliminary driver by Roberto Fresca.
8
9
10  Encrypted gambling hardware based on a custom CPU.
11
12
13***********************************************************************************
14
15
16  Hardware Notes
17  --------------
18
19  ---------------------------------
20    Board #1 (unknown slots game)
21  ---------------------------------
22
23  1x 40-pin custom CPU labeled:
24
25     0288
26     8012 (last digit is hard to read)
27     11.12.96
28
29  1x Unknown 40-pins IC (maybe 6845).
30  1x Altera EPM5130LC (84-pins).
31  1x KS82C55A (2x PPI).
32  1x Unknown 40-pins IC (maybe another PPI).
33
34  1x Dallas DS1236-10 (micro manager).
35  1x Push button.
36
37  1x Unknown 24-pin IC labeled SM64.
38  1x Unknown 8-pin IC labeled SM65 (looks like a DAC).
39  1x Unknown 8-pin IC no labeled (looks like a DAC).
40  1x MC14538BCL (Dual precision monostable multivibrator).
41  1x TDA2003 Audio Amp.
42  1x Pot.
43
44  1x HY6264ALP-10 (RAM).
45  1x HY62256ALP-10 (RAM).
46
47  1x 1mb ROM, near CPU.
48  2x 27C512 ROMs.
49  1x N82S147AN bipolar PROM.
50
51  1x Xtal 16 MHz.
52  1x DIP switches bank (x8).
53  1x Battery.
54
55  1x 2x17 male connector (like IDE ones).
56  1x 2x8 contacts edge connector.
57  1x 2x22 contacts edge connector.
58
59
60  -----------------------
61     Multi-Game I v2.4
62  -----------------------
63
64  1x 40-pin custom CPU labeled:
65
66     Amatic Trading GMBH
67     Lfnd. Nr. 1000
68     Type:     801 I
69     Datum:    12.02.96
70
71  1x GoldStar 6845S.
72  1x Altera EPM5130LC (84-pins).
73  3x PPI 8255AC-2.
74
75  1x Dallas DS1236-10 (micro manager).
76  1x Push button.
77
78  1x Unknown 24-pin IC labeled K-666 9330.
79  1x Unknown 8-pin IC labeled K-664 9432 (looks like a DAC).
80  1x LM358P (8-pin).
81  1x MC14538BCL (Dual precision monostable multivibrator).
82  1x TDA2003 Audio Amp.
83  1x Pot.
84
85  1x KM6264BL-7 (RAM).
86  1x HY62256A-10 (RAM).
87
88  1x 27C2001 ROM labeled MGI V GER 3.9/I/8201.
89  1x 27C4000 ROM labeled Multi 2.4 ZG1.
90  1x 27C4001 ROM labeled Multi 2.4 ZG2.
91  1x 27C4001 ROM labeled Multi 2.4 ZG3.
92  2x N82S147AN bipolar PROMs.
93
94  1x Xtal 16 MHz.
95  1x DIP switches bank (x8).
96  1x Battery.
97
98  1x 2x17 male connector (like IDE ones).
99  1x 2x36 contacts edge connector.
100
101
102  -------------------------
103     Multi-Game III v3.5
104  -------------------------
105
106  1x 40-pin custom CPU labeled:
107
108     Amatic
109     Lfnd. Nr. 99/5070 467
110     Type:     80(1?) I
111     Datum:    10.01.00
112
113  1x F68B45P.
114  1x Altera EPM5130LC (84-pins).
115  3x PPI NEC D71055C.
116
117  1x Dallas DS1236-5 (micro manager).
118  1x Push button.
119
120  1x Yamaha YM3812.
121  1x Yamaha Y3014B (DAC).
122  1x LM358M (8-pin).
123  1x MC14538 (Dual precision monostable multivibrator).
124  1x TDA2003 (Audio Amp, Heatsinked).
125  1x Pot.
126
127  1x HY6264A (RAM).
128  1x KM62256 (RAM).
129
130  1x 27C2000 ROM labeled 'MG III VGer 3.5/I/8205'.
131  1x 27C4000 ROM labeled 'MG III 51 ZG1'.
132  1x 27C040 ROM labeled 'MG III 51 ZG2'.
133  1x 27C040 ROM labeled 'MG III 51 ZG3'.
134  1x 27C1024 labeled 'V'
135
136  1x Xtal 16 MHz.
137  1x DIP switches bank (x8).
138  1x Battery.
139
140  2x 2x17 male connector (like IDE ones).
141  1x 2x36 contacts edge connector.
142
143
144***********************************************************************************
145
146
147    Memory Map
148    ----------
149
150    $00000 - $FFFFF   Still unknown...
151
152
153***********************************************************************************
154
155  +------------------------------------------------------------------------------+
156  |             AMATIC Standard Edge Connector (Videomat, Multigame)             |
157  +----------------------------------------+-------------------------------------+
158  |            Component Side              |              Solder Side            |
159  +-------------------+---------------+----+----+---------------+----------------+
160  |     Function      |   Direction   | Nr | Nr |   Direction   |    Function    |
161  +-------------------+---------------+----+----+---------------+----------------+
162  | Lamp-HOLD3        |    OUTPUT     | 36 | r  |    ------     | N/C            |
163  | REMOTE-PL         |    OUTPUT     | 35 | p  |    OUTPUT     | COIN-INVERTER  |
164  | REMOTE-CLOCK      |    OUTPUT     | 34 | n  |    OUTPUT     | D-OUT          |
165  | D-IN              |    INPUT      | 33 | m  |    SUPPLY     | +5V            |
166  | REMOTE-SELECT     |    INPUT      | 32 | l  |    INPUT      | ???            |
167  | N/C               |    ------     | 31 | k  |    INPUT      | ???            |
168  | Coin-INPUT4       |    INPUT      | 30 | j  |    INPUT      | ???            |
169  | GND               |    SUPPLY     | 29 | h  |    SUPPLY     | GND            |
170  | HOPPER-RELAIS     |    OUTPUT     | 28 | f  |    INPUT      | ANTENNE        |
171  | N/C               |    ------     | 27 | e  |    ------     | N/C            |
172  | TICKET-OUT        |    OUTPUT     | 26 | d  |    ------     | N/C            |
173  | N/C               |    ------     | 25 | c  |    ------     | N/C            |
174  | KEY-DATA          |   TTLINPUT    | 24 | b  |   TTLINPUT    | KEY-DATA       |
175  | N/C               |    ------     | 23 | a  |    INPUT      | KEY-CONTACT    |
176  | GND               |    SUPPLY     | 22 | Z  |    SUPPLY     | GND            |
177  | GND               |    SUPPLY     | 21 | Y  |    SUPPLY     | GND            |
178  | GND               |    SUPPLY     | 20 | X  |    SUPPLY     | GND            |
179  | +5V               |    SUPPLY     | 19 | W  |    SUPPLY     | +5V            |
180  | +12V              |    SUPPLY     | 18 | V  |    SUPPLY     | +12V           |
181  | Lamp-HOLD1        |    OUTPUT     | 17 | U  |    OUTPUT     | Lamp-START     |
182  | Lamp-HOLD2        |    OUTPUT     | 16 | T  |    OUTPUT     | Lamp-HOLD5     |
183  | Lamp-CANCEL       |    OUTPUT     | 15 | S  |    OUTPUT     | Lamp-HOLD4     |
184  | Coin-INPUT1       |    INPUT      | 14 | R  |    OUTPUT     | HOPPER-OUT     |
185  | Mech. Counter-IN  |    OUTPUT     | 13 | P  |    INPUT      | REMOTE         |
186  | Mech. Counter-OUT |    OUTPUT     | 12 | N  |    INPUT      | Button-HOLD1   |
187  | Mech. Counter-EXT |    OUTPUT     | 11 | M  |    INPUT      | Button-CANCEL  |
188  | Button-HOLD5      |    INPUT      | 10 | L  |    INPUT      | Button-START   |
189  | Bookkeeping 2     |    INPUT      | 09 | K  |    INPUT      | Bookkeeping 1  |
190  | Button-HOLD2      |    INPUT      | 08 | J  |    INPUT      | Button-HOLD4   |
191  | Button-HOPPER-OUT |    INPUT      | 07 | H  |    INPUT      | Button-HOLD3   |
192  | HOPPER-COUNT      |    INPUT      | 06 | F  |    ------     | N/C            |
193  | Coin-INPUT3       |    INPUT      | 05 | E  |    INPUT      | Coin-INPUT2    |
194  | Monitor-GREEN     | TTLOUT-Analog | 04 | D  | TTLOUT-Analog | Monitor-RED    |
195  | Monitor-SYNC      | TTLOUT-Analog | 03 | C  | TTLOUT-Analog | Monitor-BLUE   |
196  | SPEAKER           |  OUT-Analog   | 02 | B  |    SUPPLY     | Monitor-GND    |
197  | CREDIT-CLEAR      |    INPUT      | 01 | A  |    SUPPLY     | SPEAKER-GND    |
198  +-------------------+---------------+----+----+---------------+----------------+
199
200***********************************************************************************
201
202
203  Findings about the encryption scheme
204  ------------------------------------
205
206  The program ROM is encrypted, but... The programmers left the cow out...
207  They left some blank spaces that allow see some encryption patterns.
208
209
210  Example:
211
212
213  1) A string of 4 consecutive values with relation between them, is repeated once.
214     Then the whole string is repeated again, but with bit 3 XOR'ed.
215
216         +------------ value1
217         |  +--------- value2 = value1 ^ 0x88
218         |  |  +------ value3 = value1 ^ 0x22
219         |  |  |  +--- value4 = value1 ^ 0x22 ^ 0x88
220         |  |  |  |
221         |  |  |  |
222
223  $E000: AF 27 8D 05   AF 27 8D 05   A7 2F 85 0D  A7 2F 85 0D
224        +-----------+ +-----------+ |                        |
225           string1       string1    |                        |
226        +-------------------------+ +------------------------+
227                  string2                string2 ^ 0x08
228        +----------------------------------------------------+
229                                string3
230
231
232  3) Then, all the E000-E00F range repeats in E010-E01F, but with bit 2 XOR'ed.
233
234  $E010: AB 23 89 01 AB 23 89 01 A3 2B 81 09 A3 2B 81 09
235        +-----------------------------------------------+
236                        string3 ^ 0x04
237
238
239  4) Then repeat all the E000-E01F range...
240
241  $E000: AF 27 8D 05 AF 27 8D 05 A7 2F 85 0D A7 2F 85 0D
242  $E010: AB 23 89 01 AB 23 89 01 A3 2B 81 09 A3 2B 81 09
243
244  $E020: AF 27 8D 05 AF 27 8D 05 A7 2F 85 0D A7 2F 85 0D
245  $E030: AB 23 89 01 AB 23 89 01 A3 2B 81 09 A3 2B 81 09
246
247
248  5) Then the original value changes (0xAF -> 0x63), using the same algorithm
249     (steps 1-4) for the next 0x40 bytes...
250
251  $E040: 63 EB 41 C9 63 EB 41 C9 6B E3 49 C1 6B E3 49 C1
252  $E050: 67 EF 45 CD 67 EF 45 CD 6F E7 4D C5 6F E7 4D C5
253  $E060: 63 EB 41 C9 63 EB 41 C9 6B E3 49 C1 6B E3 49 C1
254  $E070: 67 EF 45 CD 67 EF 45 CD 6F E7 4D C5 6F E7 4D C5
255
256  Repeat step (5) ...till $E0FF.
257
258
259  The encryption pattern repeats for the next 0x100 bytes, so the E000-E0FF range is repeated
260  in E100-E1FF. Then the original values changes again, creating another block of 0x200 bytes.
261
262  And so on....
263
264
265***********************************************************************************
266
267
268  [2009/09/11]
269
270  - Initial release.
271  - Added hardware specs from PCB pictures. Figured out some components.
272  - Added findings about the encryption scheme.
273  - Decoded 2 graphics bitplanes.
274  - Added pre-defined clocks.
275  - Added technical notes.
276
277
278  *** TO DO ***
279
280  - Decrypt the program ROMs.
281  - Identify the CPU type.
282  - Memory map.
283  - Hook the remaining GFX bitplanes.
284  - CRTC
285  - Proper inputs.
286  - Color decode routines.
287  - Sound support.
288
289
290***********************************************************************************/
291
292
293#define MASTER_CLOCK   XTAL_16MHz
294#define CPU_CLOCK      MASTER_CLOCK/4   /* guess */
295#define SND_CLOCK      MASTER_CLOCK/4   /* guess */
296#define CRTC_CLOCK      MASTER_CLOCK/8   /* guess */
297
298
299#include "driver.h"
300#include "cpu/z80/z80.h"
301#include "video/mc6845.h"
302#include "machine/8255ppi.h"
303#include "sound/3812intf.h"
304#include "sound/dac.h"
305
306
307/************************************
308*          Video Hardware           *
309************************************/
310
311static VIDEO_START( amaticmg )
312{
313}
314
315static VIDEO_UPDATE( amaticmg )
316{
317   return 0;
318}
319
320static PALETTE_INIT( amaticmg )
321{
322}
323
324
325/************************************
326*       Read/Write Handlers         *
327************************************/
328
329
330
331/************************************
332*      Memory Map Information       *
333************************************/
334
335static ADDRESS_MAP_START( amaticmg_map, ADDRESS_SPACE_PROGRAM, 8 )
336   AM_RANGE(0x00000, 0x3ffff) AM_ROM
337//  AM_RANGE(0x0000, 0x0000) AM_RAM // AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
338//  AM_RANGE(0x0000, 0x0000) AM_DEVWRITE("crtc", mc6845_address_w)
339//  AM_RANGE(0x0000, 0x0000) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
340//  AM_RANGE(0x0000, 0x0000) AM_RAM_WRITE(amaticmg_videoram_w) AM_BASE(&videoram)
341//  AM_RANGE(0x0000, 0x0000) AM_RAM_WRITE(amaticmg_colorram_w) AM_BASE(&colorram)
342ADDRESS_MAP_END
343
344static ADDRESS_MAP_START( amaticmg_portmap, ADDRESS_SPACE_IO, 8 )
345   ADDRESS_MAP_GLOBAL_MASK(0xff)
346//  AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
347//  AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
348//  AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
349//  AM_RANGE(0x00, 0x00) AM_DEVWRITE("ym", ym3812_w)
350//  AM_RANGE(0x00, 0x00) AM_DEVWRITE("dac1", dac_signed_w)
351//  AM_RANGE(0x00, 0x00) AM_DEVWRITE("dac2", dac_signed_w)
352
353ADDRESS_MAP_END
354
355/*
356    Unknown R/W
357    -----------
358
359
360*/
361
362
363/************************************
364*           Input ports             *
365************************************/
366
367static INPUT_PORTS_START( amaticmg )
368   PORT_START("IN0")
369   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-1") PORT_CODE(KEYCODE_1)
370   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-2") PORT_CODE(KEYCODE_2)
371   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-3") PORT_CODE(KEYCODE_3)
372   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-4") PORT_CODE(KEYCODE_4)
373   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-5") PORT_CODE(KEYCODE_5)
374   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-6") PORT_CODE(KEYCODE_6)
375   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-7") PORT_CODE(KEYCODE_7)
376   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-8") PORT_CODE(KEYCODE_8)
377
378   PORT_START("IN1")
379   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-1") PORT_CODE(KEYCODE_Q)
380   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-2") PORT_CODE(KEYCODE_W)
381   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-3") PORT_CODE(KEYCODE_E)
382   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-4") PORT_CODE(KEYCODE_R)
383   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-5") PORT_CODE(KEYCODE_T)
384   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-6") PORT_CODE(KEYCODE_Y)
385   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-7") PORT_CODE(KEYCODE_U)
386   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-8") PORT_CODE(KEYCODE_I)
387
388   PORT_START("IN2")
389   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-1") PORT_CODE(KEYCODE_A)
390   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-2") PORT_CODE(KEYCODE_S)
391   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-3") PORT_CODE(KEYCODE_D)
392   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-4") PORT_CODE(KEYCODE_F)
393   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-5") PORT_CODE(KEYCODE_G)
394   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-6") PORT_CODE(KEYCODE_H)
395   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-7") PORT_CODE(KEYCODE_J)
396   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2-8") PORT_CODE(KEYCODE_K)
397
398   PORT_START("IN3")
399   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-1") PORT_CODE(KEYCODE_Z)
400   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-2") PORT_CODE(KEYCODE_X)
401   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-3") PORT_CODE(KEYCODE_C)
402   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-4") PORT_CODE(KEYCODE_V)
403   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-5") PORT_CODE(KEYCODE_B)
404   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-6") PORT_CODE(KEYCODE_N)
405   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-7") PORT_CODE(KEYCODE_M)
406   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3-8") PORT_CODE(KEYCODE_L)
407
408   PORT_START("SW1")
409   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
410   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
411   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
412   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
413   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
414   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
415   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
416   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
417   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
418   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
419   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
420   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
421   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
422   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
423   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
424   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
425   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
426   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
427   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
428   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
429   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
430   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
431   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
432   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
433INPUT_PORTS_END
434
435
436/************************************
437*         Graphics Layouts          *
438************************************/
439
440static const gfx_layout charlayout =
441{
442/* Only 2 planes are hooked. This need to be fixed */
443
444   4,8,
445   RGN_FRAC(1,2),
446   2,
447   { RGN_FRAC(0,2), RGN_FRAC(0,2) + 4 },
448   { 3, 2, 1, 0 },   /* tiles are x-flipped */
449   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
450   8*4*2
451};
452
453
454/************************************
455*    Graphics Decode Information    *
456************************************/
457
458static GFXDECODE_START( amaticmg )
459   GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 16 )
460GFXDECODE_END
461
462
463/************************************
464*          Sound Interface          *
465************************************/
466
467//static const ym3812_interface ym3812_config =
468//{
469//  sound_irq
470//};
471
472
473/************************************
474*          CRTC Interface           *
475************************************/
476
477//static const mc6845_interface mc6845_intf =
478//{
479//  "screen",   /* screen we are acting on */
480//  8,          /* number of pixels per video memory address */
481//  NULL,       /* before pixel update callback */
482//  NULL,       /* row update callback */
483//  NULL,       /* after pixel update callback */
484//  DEVCB_NULL, /* callback for display state changes */
485//  DEVCB_NULL, /* callback for cursor state changes */
486//  DEVCB_NULL, /* HSYNC callback */
487//  DEVCB_NULL, /* VSYNC callback */
488//  NULL        /* update address callback */
489//};
490
491
492/************************************
493*      PPI 8255 (x3) Interface      *
494************************************/
495
496//static const ppi8255_interface ppi8255_intf[3] =
497//{
498//  {   /* (00-00) Mode X - Port X set as input */
499//      DEVCB_NULL,                     /* Port A read */
500//      DEVCB_NULL,                     /* Port B read */
501//      DEVCB_NULL,                     /* Port C read */
502//      DEVCB_NULL,                     /* Port A write */
503//      DEVCB_NULL,                     /* Port B write */
504//      DEVCB_NULL,                     /* Port C write */
505//  },
506//  {   /* (00-00) Mode X - Port X set as input */
507//      DEVCB_NULL,                     /* Port A read */
508//      DEVCB_NULL,                     /* Port B read */
509//      DEVCB_NULL,                     /* Port C read */
510//      DEVCB_NULL,                     /* Port A write */
511//      DEVCB_NULL,                     /* Port B write */
512//      DEVCB_NULL,                     /* Port C write */
513//  },
514//  {   /* (00-00) Mode X - Port X set as input */
515//      DEVCB_NULL,                     /* Port A read */
516//      DEVCB_NULL,                     /* Port B read */
517//      DEVCB_NULL,                     /* Port C read */
518//      DEVCB_NULL,                     /* Port A write */
519//      DEVCB_NULL,                     /* Port B write */
520//      DEVCB_NULL,                     /* Port C write */
521//  }
522//};
523
524/************************************
525*          Machine Drivers          *
526************************************/
527
528static MACHINE_DRIVER_START( amaticmg )
529   /* basic machine hardware */
530   MDRV_CPU_ADD("maincpu", Z80, CPU_CLOCK)      /* WRONG! */
531   MDRV_CPU_PROGRAM_MAP(amaticmg_map)
532   MDRV_CPU_IO_MAP(amaticmg_portmap)
533   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
534
535//  MDRV_NVRAM_HANDLER(generic_0fill)
536
537   /* 3x 8255 */
538//  MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
539//  MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
540//  MDRV_PPI8255_ADD( "ppi8255_2", ppi8255_intf[2] )
541
542   /* video hardware */
543   MDRV_SCREEN_ADD("screen", RASTER)
544   MDRV_SCREEN_REFRESH_RATE(60)
545   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
546   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
547   MDRV_SCREEN_SIZE(512, 256)
548   MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
549
550//  MDRV_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf)
551
552   MDRV_GFXDECODE(amaticmg)
553
554   MDRV_PALETTE_INIT(amaticmg)
555   MDRV_PALETTE_LENGTH(0x100)
556   MDRV_VIDEO_START(amaticmg)
557   MDRV_VIDEO_UPDATE(amaticmg)
558
559   /* sound hardware */
560//  MDRV_SPEAKER_STANDARD_MONO("mono")
561
562//  MDRV_SOUND_ADD("ym", YM3812, SND_CLOCK)
563//  MDRV_SOUND_CONFIG(ym3812_config)
564//  MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
565
566//  MDRV_SOUND_ADD("dac", DAC, 0)   /* Y3014B */
567//  MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
568
569MACHINE_DRIVER_END
570
571
572/************************************
573*             Rom Load              *
574************************************/
575
576ROM_START( am_uslot )
577   ROM_REGION( 0x40000, "maincpu", 0 )   /* encrypted program ROM...*/
578   ROM_LOAD( "u3.bin",  0x00000, 0x20000, CRC(29bf4a95) SHA1(a73873f7cd1fdf5accc3e79f4619949f261400b8) )
579
580   ROM_REGION( 0x20000, "gfx1", 0 )   /* There are only slots tiles. No chars inside */
581   ROM_LOAD( "u9.bin",  0x00000, 0x10000, CRC(823a736a) SHA1(a5227e3080367736aac1198d9dbb55efc4114624) )
582   ROM_LOAD( "u10.bin", 0x00000, 0x10000, CRC(6a811c81) SHA1(af01cd9b1ce6aca92df71febb05fe216b18cf42a) )
583
584   ROM_REGION( 0x0200, "proms", 0 )
585   ROM_LOAD( "n82s147a.bin", 0x0000, 0x0200, CRC(dfeabd11) SHA1(21e8bbcf4aba5e4d672e5585890baf8c5bc77c98) )
586ROM_END
587
588
589ROM_START( am_mg24 )
590   ROM_REGION( 0x40000, "maincpu", 0 )   /* encrypted program ROM...*/
591   ROM_LOAD( "mgi_vger_3.9-i-8201.i6.bin", 0x00000, 0x40000, CRC(9ce159f7) SHA1(101c277d579a69cb03f879288b2cecf838cf1741) )
592
593   ROM_REGION( 0x180000, "gfx1", 0 )
594   ROM_LOAD( "multi_2.4_zg1.i17.bin", 0x000000, 0x80000, CRC(4a60a718) SHA1(626991abee768da58e87c7cdfc4fcbae86c6ea2a) )
595   ROM_LOAD( "multi_2.4_zg2.i18.bin", 0x080000, 0x80000, CRC(b504e1b8) SHA1(ffa17a2c212eb2fffb89b131868e69430cb41203) )
596   ROM_LOAD( "multi_2.4_zg3.i33.bin", 0x100000, 0x80000, CRC(9b66bb4d) SHA1(64035d2028a9b68164c87475a1ec9754453ad572) )
597
598   ROM_REGION( 0x0400, "proms", 0 )
599   ROM_LOAD( "n82s147a_1.bin", 0x0000, 0x0200, NO_DUMP )
600   ROM_LOAD( "n82s147a_2.bin", 0x0200, 0x0200, NO_DUMP )
601ROM_END
602
603ROM_START( am_mg3 )
604   ROM_REGION( 0x40000, "maincpu", 0 )   /* encrypted program ROM...*/
605   ROM_LOAD( "mg_iii_vger_3.5-i-8205.bin", 0x00000, 0x40000, CRC(21d64029) SHA1(d5c3fde02833a96dd7a43481a489bfc4a5c9609d) )
606
607   ROM_REGION( 0x180000, "gfx1", 0 )
608   ROM_LOAD( "mg_iii_51_zg1.bin", 0x000000, 0x80000, CRC(84f86874) SHA1(c483a50df6a9a71ddfdf8530a894135f9b852b89) )
609   ROM_LOAD( "mg_iii_51_zg2.bin", 0x080000, 0x80000, CRC(4425e535) SHA1(726c322c5d0b391b82e49dd1797ebf0abfa4a65a) )
610   ROM_LOAD( "mg_iii_51_zg3.bin", 0x100000, 0x80000, CRC(36d4c0fa) SHA1(20352dbbb2ce2233be0f4f694ddf49b8f5d6a64f) )
611
612   ROM_REGION( 0x20000, "other", 0 )
613   ROM_LOAD( "v.bin", 0x00000, 0x20000, CRC(524767e2) SHA1(03a108494f42365c820fdfbcba9496bda86f3081) )
614ROM_END
615
616
617/************************************
618*       Driver Initialization       *
619************************************/
620
621static DRIVER_INIT( amaticmg )
622{
623
624}
625
626
627/************************************
628*           Game Drivers            *
629************************************/
630
631/*    YEAR  NAME      PARENT  MACHINE   INPUT     INIT      ROT    COMPANY                FULLNAME                     FLAGS  */
632GAME( 1996, am_uslot, 0,      amaticmg, amaticmg, amaticmg, ROT0, "Amatic Trading GMBH", "Amatic Unknown Slots Game",  GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING )
633GAME( 2000, am_mg24,  0,      amaticmg, amaticmg, amaticmg, ROT0, "Amatic Trading GMBH", "Multi Game I (V.Ger 2.4)",   GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING )
634GAME( 2000, am_mg3,   0,      amaticmg, amaticmg, amaticmg, ROT0, "Amatic Trading GMBH", "Multi Game III (V.Ger 3.5)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING )
src/mame/drivers/jangou.c
r5891r5892
10231023   ROM_LOAD( "tbp18s30n.4f", 0x00, 0x20, CRC(dc54dc52) SHA1(db91a7ae05eb6b6e4b42f91dfe20ac0da6680b46) ) //verified on real hardware
10241024ROM_END
10251025
1026ROM_START( cntrygrla )
1027   ROM_REGION( 0x10000, "cpu0", 0 )
1028   ROM_LOAD( "5bunny.7l", 0x00000, 0x02000, CRC(ef07e029) SHA1(4be1bea9acaa37c615e937c3d0e0b8454aff2a8c) )
1029   ROM_LOAD( "5bunny.7k", 0x02000, 0x02000, CRC(cdf822b0) SHA1(a3cae79713cf7ff94a98705b7cba621730dbac1f) )
1030
1031   /* same non-sense like Country Girl... */
1032   ROM_REGION( 0x1000, "user1", 0 )
1033   ROM_LOAD( "5bunny.7h", 0x00000, 0x0800, CRC(18da8863) SHA1(2151bc67173507dc35edc2426c2ef97d7937d01c) )
1034   ROM_LOAD( "5bunny.7j", 0x00800, 0x0800, CRC(06666bbf) SHA1(3d8eb4ea2d4fc6f3f327e710e19bcb68d8466d80) )
1035
1036   ROM_REGION( 0x10000, "gfx", 0 )
1037   ROM_LOAD( "rom1.bin", 0x00000, 0x02000, CRC(92033f37) SHA1(aa407c2feb1cbb7cbc6c59656338453c5a670749)  ) //5bunny.m5
1038   ROM_LOAD( "rom2.bin", 0x02000, 0x02000, CRC(0588cc48) SHA1(f769ece2955eb9f055c499b6243a2fead9d07984)  ) //5bunny.l5
1039   ROM_LOAD( "rom3.bin", 0x04000, 0x02000, CRC(ce00ff56) SHA1(c5e58707a5dd0f57c34b09de542ef30e96ab95d1)  ) //5bunny.k5
1040
1041   ROM_REGION( 0x20, "proms", 0 )
1042   ROM_LOAD( "tbp18s30n.4f", 0x00, 0x20, CRC(dc54dc52) SHA1(db91a7ae05eb6b6e4b42f91dfe20ac0da6680b46) ) //verified on real hardware
1043ROM_END
1044
10261045ROM_START( luckygrl )
10271046   ROM_REGION( 0x10000, "cpu0", 0 ) //encrypted z80 cpu
10281047   ROM_LOAD( "5.9c", 0x00000, 0x01000, CRC(79b34eb2) SHA1(4b4916e09bfd6573fd2c7a7254fa4419164e0c4d) )
r5891r5892
10981117GAME( 1983, jangou,     0,        jangou,   jangou,    0,        ROT0, "Nichibutsu",   "Jangou [BET] (Japan)", GAME_NO_COCKTAIL )
10991118GAME( 1983, macha,      0,        jangou,   macha,     0,        ROT0, "Logitec",      "Monoshiri Quiz Osyaberi Macha (Japan)", GAME_NO_COCKTAIL )
11001119GAME( 1984, jngolady,   0,        jngolady, jngolady,  jngolady, ROT0, "Nichibutsu",   "Jangou Lady (Japan)", GAME_NO_COCKTAIL )
1101GAME( 1984, cntrygrl,   0,        cntrygrl, cntrygrl,  0,        ROT0, "Royal Denshi", "Country Girl (Japan)",  GAME_NO_COCKTAIL )
1120GAME( 1984, cntrygrl,   0,        cntrygrl, cntrygrl,  0,        ROT0, "Royal Denshi", "Country Girl (Japan set 1)",  GAME_NO_COCKTAIL )
1121GAME( 1984, cntrygrla,  cntrygrl, cntrygrl, cntrygrl,  0,        ROT0, "Nichibutsu",   "Country Girl (Japan set 2)",  GAME_NO_COCKTAIL )
11021122GAME( 1984, fruitbun,   cntrygrl, cntrygrl, cntrygrl,  0,        ROT0, "Nichibutsu",   "Fruits & Bunny (World?)",  GAME_NO_COCKTAIL )
11031123/* The following might not run there... */
11041124GAME( 1984?,luckygrl,   0,        cntrygrl, cntrygrl,  luckygrl, ROT0, "Wing",         "Lucky Girl? (Wing)", GAME_NOT_WORKING )
src/mame/drivers/gameplan.c
r5891r5892
180180 *
181181 *************************************/
182182
183static void r6532_irq(const device_config *device, int state)
183static WRITE_LINE_DEVICE_HANDLER( r6532_irq )
184184{
185185   cputag_set_input_line(device->machine, "audiocpu", 0, state);
186186   if (state == ASSERT_LINE)
r5891r5892
188188}
189189
190190
191static void r6532_soundlatch_w(const device_config *device, UINT8 newdata, UINT8 olddata)
191static WRITE8_DEVICE_HANDLER( r6532_soundlatch_w )
192192{
193193   const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
194   soundlatch_w(space, 0, newdata);
194   soundlatch_w(space, 0, data);
195195}
196196
197197
198198static const riot6532_interface r6532_interface =
199199{
200   NULL,               /* port A read handler */
201   NULL,               /* port B read handler */
202   NULL,               /* port A write handler */
203   r6532_soundlatch_w,      /* port B write handler */
204   r6532_irq            /* IRQ callback */
200   DEVCB_NULL,                     /* port A read handler */
201   DEVCB_NULL,                     /* port B read handler */
202   DEVCB_NULL,                     /* port A write handler */
203   DEVCB_HANDLER(r6532_soundlatch_w),   /* port B write handler */
204   DEVCB_LINE(r6532_irq)            /* IRQ callback */
205205};
206206
207207
src/mame/drivers/toaplan2.c
r5891r5892
4040    shippumd    RA-MA9402-03  Raizing/8ing  Shippu Mahou Daisakusen
4141    bgaregga    RA9503        Raizing/8ing  Battle Garegga (World - Sat Feb 3 1996)
4242    bgareghk    RA9503        Raizing/8ing  Battle Garegga (Hong Kong (and Austria?) - Sat Feb 3 1996)
43    bgaregtw    RA9503        Raizing/8ing  Battle Garegga (Taiwan and Germany - Thu Feb 1 1996)
4344    bgaregnv    RA9503        Raizing/8ing  Battle Garegga - New Version (Hong Kong (and Austria?) - Sat Mar 2 1996)
4445    bgaregt2    RA9503        Raizing/8ing  Battle Garegga - Type 2 (World - Sat Mar 2 1996)
4546    bgaregcn    RA9503        Raizing/8ing  Battle Garegga - Type 2 (China (and Denmark?) - Tue Apr 2 1996)
r5891r5892
29732974INPUT_PORTS_END
29742975
29752976
2977static INPUT_PORTS_START( bgaregtw )
2978   PORT_INCLUDE(bgaregga)
2979
2980   PORT_MODIFY("JMPR")
2981   PORT_DIPNAME( 0x0003,   0x0003, "Territory" )
2982   PORT_DIPSETTING(      0x0001, "Germany (German Tuning license)" )
2983   /* These two settings end up reporting ROM-0 as BAD */
2984//  PORT_DIPSETTING(        0x0002, "USA (Fabtek license)" )
2985//  PORT_DIPSETTING(        0x0000, DEF_STR( Japan ) )
2986   PORT_DIPSETTING(      0x0003, "Taiwan (Liang Hwa license)" )
2987INPUT_PORTS_END
2988
2989
29762990static INPUT_PORTS_START( bgaregcn )
29772991   PORT_INCLUDE(bgaregga)
29782992
r5891r5892
32533267   8*32
32543268};
32553269
3256#ifdef LSB_FIRST
3270#define XOR(a) WORD_XOR_LE(a)
3271#define LOC(x) (x+XOR(0))
3272
32573273static const gfx_layout truxton2_tx_tilelayout =
32583274{
32593275   8,8,   /* 8x8 characters */
32603276   1024,   /* 1024 characters */
32613277   4,      /* 4 bits per pixel */
32623278   { 0, 1, 2, 3 },
3263   { 0, 4, 16, 20, 32, 36, 48, 52 },
3279   { LOC(0)*4, LOC(1)*4, LOC(4)*4, LOC(5)*4, LOC(8)*4, LOC(9)*4, LOC(12)*4, LOC(13)*4 },
32643280   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 },
32653281   8*64
32663282};
3267#else
3268static const gfx_layout truxton2_tx_tilelayout =
3269{
3270   8,8,   /* 8x8 characters */
3271   1024,   /* 1024 characters */
3272   4,      /* 4 bits per pixel */
3273   { 0, 1, 2, 3 },
3274   { 0+8, 4+8, 16+8, 20+8, 32+8, 36+8, 48+8, 52+8 },
3275   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 },
3276   8*64
3277};
3278#endif
32793283
3280#ifdef LSB_FIRST
32813284static const gfx_layout batrider_tx_tilelayout =
32823285{
32833286   8,8,   /* 8x8 characters */
32843287   1024,   /* 1024 characters */
32853288   4,      /* 4 bits per pixel */
32863289   { 0, 1, 2, 3 },
3287   { 0, 4, 8, 12, 16, 20, 24, 28 },
3290   { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 },
32883291   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32893292   8*32
32903293};
3291#else
3292static const gfx_layout batrider_tx_tilelayout =
3293{
3294   8,8,   /* 8x8 characters */
3295   1024,   /* 1024 characters */
3296   4,      /* 4 bits per pixel */
3297   { 0, 1, 2, 3 },
3298   { 8, 12, 0, 4, 24, 28, 16, 20 },
3299   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
3300   8*32
3301};
3302#endif
33033294
3304
33053295static const gfx_layout fixeighblayout =
33063296{
33073297   8,8,
r5891r5892
38073797static MACHINE_DRIVER_START( vfive )
38083798
38093799   /* basic machine hardware */
3810   MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)         /* 10MHz Oscillator */
3800   MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2)   /* verified on pcb */
38113801   MDRV_CPU_PROGRAM_MAP(vfive_68k_mem)
38123802   MDRV_CPU_VBLANK_INT("screen", toaplan2_vblank_irq4)
38133803
38143804#if USE_V25
3815   MDRV_CPU_ADD("audiocpu", V25, XTAL_32MHz/2)         /* NEC V25+ type Toaplan marked CPU ??? */
3805   MDRV_CPU_ADD("audiocpu", V25, XTAL_20MHz/2)   /* Verified on pcb, NEC V25+ type Toaplan mark scratched out */
38163806   MDRV_CPU_PROGRAM_MAP(V25_rambased_mem)
38173807   //MDRV_CPU_IO_MAP(V25_port)
38183808#endif
r5891r5892
38233813   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
38243814
38253815   MDRV_SCREEN_ADD("screen", RASTER)
3826   MDRV_SCREEN_REFRESH_RATE( (XTAL_27MHz / 4) / (432 * 263) )   /* 27MHz Oscillator */
3816   MDRV_SCREEN_REFRESH_RATE( (XTAL_27MHz / 4) / (432 * 263) )   /* verified on pcb */
38273817   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
38283818   MDRV_SCREEN_SIZE(432, 262)
38293819   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
r5891r5892
38383828   /* sound hardware */
38393829   MDRV_SPEAKER_STANDARD_MONO("mono")
38403830
3841   MDRV_SOUND_ADD("ym", YM2151, XTAL_27MHz/8)
3831   MDRV_SOUND_ADD("ym", YM2151, XTAL_27MHz/8) /* verified on pcb */
38423832   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
38433833MACHINE_DRIVER_END
38443834
r5891r5892
48044794ROM_END
48054795
48064796
4797ROM_START( bgareggatw )
4798   ROM_REGION( 0x100000, "maincpu", 0 )         /* Main 68K code */
4799   ROM_LOAD16_BYTE( "garegga_prg0.u123", 0x000000, 0x080000, CRC(235b7405) SHA1(a2434801df4231a6b48f6c63f47c202d25a89e79) )
4800   ROM_LOAD16_BYTE( "garegga_prg1.u65",  0x000001, 0x080000, CRC(c29ccf6a) SHA1(38806e0b4ff852f4bfefd80c56ca23f71623e275) )
4801
4802   ROM_REGION( 0x40000, "audiocpu", 0 )         /* Sound Z80 code + bank */
4803   ROM_LOAD( "snd.bin", 0x00000, 0x08000, CRC(68632952) SHA1(fb834db83157948e2b420b6051102a9c6ac3969b) )
4804   ROM_CONTINUE(        0x10000, 0x18000 )
4805
4806   ROM_REGION( 0x800000, "gfx1", 0 )
4807   ROM_LOAD( "rom4.bin",  0x000000, 0x200000, CRC(b333d81f) SHA1(5481465f1304334fd55798be2f44324c57c2dbcb) )
4808   ROM_LOAD( "rom3.bin",  0x200000, 0x200000, CRC(51b9ebfb) SHA1(30e0c326f5175aa436df8dba08f6f4e08130b92f) )
4809   ROM_LOAD( "rom2.bin",  0x400000, 0x200000, CRC(b330e5e2) SHA1(5d48e9d56f99d093b6390e0af1609fd796df2d35) )
4810   ROM_LOAD( "rom1.bin",  0x600000, 0x200000, CRC(7eafdd70) SHA1(7c8da8e86c3f9491719b1d7d5d285568d7614f38) )
4811
4812   ROM_REGION( 0x010000, "gfx2", 0 )
4813   ROM_LOAD( "text.u81", 0x00000, 0x08000, CRC(e67fd534) SHA1(987d0edffc2c243a13d4567319ea3d185eaadbf8) )
4814
4815   ROM_REGION( 0x140000, "oki", 0 )      /* ADPCM Samples */
4816   ROM_LOAD( "rom5.bin", 0x040000, 0x100000, CRC(f6d49863) SHA1(3a3c354852adad06e8a051511abfab7606bce382) )
4817ROM_END
4818
4819
48074820ROM_START( bgaregganv )
48084821   ROM_REGION( 0x100000, "maincpu", 0 )         /* Main 68K code */
48094822   ROM_LOAD16_BYTE( "prg_0.bin", 0x000000, 0x080000, CRC(951ecc07) SHA1(a82e4b59e4a974566e59f3ab2fbae1aec7d88a2b) )
r5891r5892
52575270
52585271GAME( 1996, bgaregga,   0,        bgaregga, bgaregga, T2_Z80,   ROT270, "Raizing / Eighting", "Battle Garegga (Europe / USA / Japan / Asia) (Sat Feb 3 1996)", GAME_SUPPORTS_SAVE )
52595272GAME( 1996, bgareggahk, bgaregga, bgaregga, bgareghk, T2_Z80,   ROT270, "Raizing / Eighting", "Battle Garegga (Austria / Hong Kong) (Sat Feb 3 1996)", GAME_SUPPORTS_SAVE )
5273GAME( 1996, bgareggatw, bgaregga, bgaregga, bgaregtw, T2_Z80,   ROT270, "Raizing / Eighting", "Battle Garegga (Taiwan / Germany) (Thu Feb 1 1996)", GAME_SUPPORTS_SAVE )
52605274GAME( 1996, bgaregganv, bgaregga, bgaregga, bgareghk, T2_Z80,   ROT270, "Raizing / Eighting", "Battle Garegga - New Version (Austria / Hong Kong) (Sat Mar 2 1996)" , GAME_SUPPORTS_SAVE ) // displays New Version only when set to HK
52615275GAME( 1996, bgareggat2, bgaregga, bgaregga, bgaregga, T2_Z80,   ROT270, "Raizing / Eighting", "Battle Garegga - Type 2 (Europe / USA / Japan / Asia) (Sat Mar 2 1996)" , GAME_SUPPORTS_SAVE ) // displays Type 2 only when set to Europe
52625276GAME( 1996, bgareggacn, bgaregga, bgaregga, bgaregcn, T2_Z80,   ROT270, "Raizing / Eighting", "Battle Garegga - Type 2 (Denmark / China) (Tue Apr 2 1996)", GAME_SUPPORTS_SAVE ) // displays Type 2 only when set to Denmark
src/mame/drivers/zaccaria.c
r5891r5892
66thanks to Andrea Babich for the manual.
77
88TODO:
9- correctly hook up TMS5200 (there's a kludge in zaccaria_ca2_r to make it work)
109
11- there seems to be a strange kind of DAC connected to 8910 #0 port A, but it sounds
12  horrible so I'm leaving its volume at 0.
10- implement discrete filters for analog signals 1 to 5 and attenuation control
11  for signal 5 (74LS156)
1312
1413- The 8910 outputs go through some analog circuitry to make them sound more like
1514  real intruments.
r5891r5892
5554
5655
5756static int dsw;
57static int active_8910, port0a, acs;
58static int last_port0b;
5859
5960static WRITE8_DEVICE_HANDLER( zaccaria_dsw_sel_w )
6061{
r5891r5892
8990
9091static WRITE8_DEVICE_HANDLER( ay8910_port0a_w )
9192{
92   // bits 0-2 go to a weird kind of DAC ??
93   /* bits 0-2 go to a 74LS156 with open collector outputs
94     * one out of 8 Resitors is than used to form a resistor
95     * divider with Analog input 5 (tromba)
96     */
97
9398   // bits 3-4 control the analog drum emulation on 8910 #0 ch. A
9499
95   if (data & 1)   /* DAC enable */
96   {
97      /* TODO: is this right? it sound awful */
98      static const int table[4] = { 0x05, 0x1b, 0x0b, 0x55 };
99      dac_signed_data_w(devtag_get_device(device->machine, "dac1"),table[(data & 0x06) >> 1]);
100   }
101   else
102      dac_signed_data_w(devtag_get_device(device->machine, "dac1"),0x80);
100   static const int table[8] = { 8200, 5600, 3300, 1500, 820, 390, 150, 47 };
101   int b0, b1, b2, ba, v;
102   b0 = data & 0x01;
103   b1 = (data & 0x02) >> 1;
104   b2 = (data & 0x04) >> 2;
105   ba = (b0<<2) | (b1<<1) | b2;
106   /* 150 below to scale to volume 100 */
107   v = (150 * table[ba]) / (4700 + table[ba]);
108   //printf("dac1w %02d %04d\n", ba, v);
109   ay8910_set_volume(devtag_get_device(device->machine, "ay2"), 1, v);
103110}
104111
105112
106static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0a ) { cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); }
107static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0b ) { cputag_set_input_line(device->machine, "audiocpu", 0, state ? ASSERT_LINE : CLEAR_LINE); }
113static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0a )
114{
115   cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
116}
108117
109static int active_8910, port0a, acs;
118static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0b )
119{
120   cputag_set_input_line(device->machine, "audiocpu", 0, state ? ASSERT_LINE : CLEAR_LINE);
121}
110122
111123static READ8_DEVICE_HANDLER( zaccaria_port0a_r )
112124{
r5891r5892
120132
121133static WRITE8_DEVICE_HANDLER( zaccaria_port0b_w )
122134{
123   static int last;
124135
125
126136   /* bit 1 goes to 8910 #0 BDIR pin  */
127   if ((last & 0x02) == 0x02 && (data & 0x02) == 0x00)
137   if ((last_port0b & 0x02) == 0x02 && (data & 0x02) == 0x00)
128138   {
129139      /* bit 0 goes to the 8910 #0 BC1 pin */
130      ay8910_data_address_w(devtag_get_device(device->machine, "ay1"), last, port0a);
140      ay8910_data_address_w(devtag_get_device(device->machine, "ay1"), last_port0b, port0a);
131141   }
132   else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
142   else if ((last_port0b & 0x02) == 0x00 && (data & 0x02) == 0x02)
133143   {
134144      /* bit 0 goes to the 8910 #0 BC1 pin */
135      if (last & 0x01)
145      if (last_port0b & 0x01)
136146         active_8910 = 0;
137147   }
138148   /* bit 3 goes to 8910 #1 BDIR pin  */
139   if ((last & 0x08) == 0x08 && (data & 0x08) == 0x00)
149   if ((last_port0b & 0x08) == 0x08 && (data & 0x08) == 0x00)
140150   {
141151      /* bit 2 goes to the 8910 #1 BC1 pin */
142      ay8910_data_address_w(devtag_get_device(device->machine, "ay2"), last >> 2, port0a);
152      ay8910_data_address_w(devtag_get_device(device->machine, "ay2"), last_port0b >> 2, port0a);
143153   }
144   else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
154   else if ((last_port0b & 0x08) == 0x00 && (data & 0x08) == 0x08)
145155   {
146156      /* bit 2 goes to the 8910 #1 BC1 pin */
147      if (last & 0x04)
157      if (last_port0b & 0x04)
148158         active_8910 = 1;
149159   }
150160
151   last = data;
161   last_port0b = data;
152162}
153163
154164static INTERRUPT_GEN( zaccaria_cb1_toggle )
r5891r5892
160170   toggle ^= 1;
161171}
162172
163
164
165static int port1a,port1b;
166
167static READ8_DEVICE_HANDLER( zaccaria_port1a_r )
168{
169   const device_config *tms = devtag_get_device(device->machine, "tms");
170   if (~port1b & 1) return tms5220_status_r(tms,0);
171   else return port1a;
172}
173
174static WRITE8_DEVICE_HANDLER( zaccaria_port1a_w )
175{
176   port1a = data;
177}
178
179173static WRITE8_DEVICE_HANDLER( zaccaria_port1b_w )
180174{
181175   const device_config *tms = devtag_get_device(device->machine, "tms");
182   port1b = data;
183176
184177   // bit 0 = /RS
185
178   tms5220_rsq_w(tms, (data >> 0) & 0x01);
186179   // bit 1 = /WS
187   if (~data & 2) tms5220_data_w(tms,0,port1a);
180   tms5220_wsq_w(tms, (data >> 1) & 0x01);
188181
189182   // bit 3 = "ACS" (goes, inverted, to input port 6 bit 3)
190183   acs = ~data & 0x08;
r5891r5892
195188
196189static READ_LINE_DEVICE_HANDLER( zaccaria_ca2_r )
197190{
198// TODO: this doesn't work, why?
199//  return !tms5220_ready_r();
200
201static int counter;
202counter = (counter+1) & 0x0f;
203
204return counter;
205
191   return tms5220_readyq_r(device);
206192}
207193
208static void tms5220_irq_handler(const device_config *device, int state)
209{
210   const device_config *pia1 = devtag_get_device(device->machine, "pia1");
211   pia6821_cb1_w(pia1,0,state ? 0 : 1);
212}
213194
214
215195static const pia6821_interface pia_0_intf =
216196{
217197   DEVCB_HANDLER(zaccaria_port0a_r),      /* port A in */
r5891r5892
231211
232212static const pia6821_interface pia_1_intf =
233213{
234   DEVCB_HANDLER(zaccaria_port1a_r),      /* port A in */
214   DEVCB_DEVICE_HANDLER("tms", tms5220_status_r),      /* port A in */
235215   DEVCB_NULL,      /* port B in */
236216   DEVCB_NULL,      /* line CA1 in */
237217   DEVCB_NULL,      /* line CB1 in */
238   DEVCB_LINE(zaccaria_ca2_r),      /* line CA2 in */
218   DEVCB_DEVICE_LINE("tms", zaccaria_ca2_r),      /* line CA2 in */
239219   DEVCB_NULL,      /* line CB2 in */
240   DEVCB_HANDLER(zaccaria_port1a_w),      /* port A out */
220   DEVCB_DEVICE_HANDLER("tms", tms5220_data_w),      /* port A out */
241221   DEVCB_HANDLER(zaccaria_port1b_w),      /* port B out */
242222   DEVCB_NULL,      /* line CA2 out */
243223   DEVCB_NULL,      /* port CB2 out */
r5891r5892
562542
563543static const tms5220_interface tms5220_config =
564544{
565   tms5220_irq_handler   /* IRQ handler */
545   DEVCB_DEVICE_HANDLER("pia1", pia6821_cb1_w)   /* IRQ handler */
566546};
567547
568548
r5891r5892
573553   MDRV_CPU_ADD("maincpu", Z80,XTAL_18_432MHz/6)   /* verified on pcb */
574554   MDRV_CPU_PROGRAM_MAP(main_map)
575555   MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
556   MDRV_QUANTUM_TIME(HZ(1000000))
576557
577558   MDRV_CPU_ADD("audiocpu", M6802,XTAL_3_579545MHz) /* verified on pcb */
578559   MDRV_CPU_PROGRAM_MAP(sound_map_1)
579560   MDRV_CPU_PERIODIC_INT(zaccaria_cb1_toggle,(double)3580000/4096)
561   MDRV_QUANTUM_TIME(HZ(1000000))
580562
581563   MDRV_CPU_ADD("audio2", M6802,XTAL_3_579545MHz) /* verified on pcb */
582564   MDRV_CPU_PROGRAM_MAP(sound_map_2)
565   MDRV_QUANTUM_TIME(HZ(1000000))
583566
567
584568   MDRV_PPI8255_ADD( "ppi8255", ppi8255_intf )
585569   MDRV_PIA6821_ADD( "pia0", pia_0_intf )
586570   MDRV_PIA6821_ADD( "pia1", pia_1_intf )
r5891r5892
610594   MDRV_SOUND_ADD("ay2", AY8910, XTAL_3_579545MHz/2) /* verified on pcb */
611595   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
612596
613   MDRV_SOUND_ADD("dac1", DAC, 0)
614   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.0)      /* first DAC sounds awful */
615
616597   MDRV_SOUND_ADD("dac2", DAC, 0)
617598   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
618599
src/mame/drivers/namcos23.c
r5891r5892
13531353   namcos23_jvssense = 1;
13541354}
13551355
1356#define XOR(a) WORD2_XOR_BE(a)
1357
13561358static const gfx_layout namcos23_cg_layout =
13571359{
13581360   16,16,
13591361   0x400, /* 0x3c0 */
13601362   4,
13611363   { 0,1,2,3 },
1362#ifdef LSB_FIRST
1363   { 4*6,4*7,4*4,4*5,4*2,4*3,4*0,4*1,4*14,4*15,4*12,4*13,4*10,4*11,4*8,4*9 },
1364#else
1365   { 4*0,4*1,4*2,4*3,4*4,4*5,4*6,4*7,4*8,4*9,4*10,4*11,4*12,4*13,4*14,4*15 },
1366#endif
1364   { XOR(0)*4, XOR(1)*4,  XOR(2)*4,  XOR(3)*4,  XOR(4)*4,  XOR(5)*4,  XOR(6)*4,  XOR(7)*4,
1365     XOR(8)*4, XOR(9)*4, XOR(10)*4, XOR(11)*4, XOR(12)*4, XOR(13)*4, XOR(14)*4, XOR(15)*4 },
13671366   { 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7,64*8,64*9,64*10,64*11,64*12,64*13,64*14,64*15 },
13681367   64*16
13691368}; /* cg_layout */
src/mame/drivers/atarisy2.c
r5891r5892
392392
393393   if (atarigen_cpu_to_sound_ready) result ^= 0x01;
394394   if (atarigen_sound_to_cpu_ready) result ^= 0x02;
395   if (!has_tms5220 || tms5220_ready_r(devtag_get_device(space->machine, "tms"))) result ^= 0x04;
395   if (!has_tms5220 || !tms5220_readyq_r(devtag_get_device(space->machine, "tms"))) result ^= 0x04;
396396   if (!(input_port_read(space->machine, "1801") & 0x80)) result ^= 0x10;
397397
398398   return result;
src/mame/drivers/naomi.c
r5891r5892
729729VGA             - 15 pin VGA out connector @ 31.5kHz
730730SER             - 9 pin Serial connector  \
731731VOL             - Volume pot              / These are on a small daughterboard that plugs into the main PCB via a multi-wire cable.
732CN3             - Unknown 10 pin connector labelled 'CN3'
732CN3             - 10 pin Speaker output & Extension serial connector
7337333V_BATT         - Panasonic ML2020 3 Volt Coin Battery
734734
735CN3 Pinout
736Pin     Function    I/O    Pin   Function  I/O
737----------------------------------------------
738 1    Stereo L (+)  Out  |  2      TXD     Out
739 3    Stereo L (-)  Out  |  4      RXD      In
740 5    Stereo R (+)  Out  |  6      GND      -
741 7    Stereo R (-)  Out  |  8      +5V     Out
742 9      No Connection    | 10  No Connection
743
735744The bottom of the PCB contains nothing significant except some connectors. One for the game cart, one for special controls
736745or I/O, one for a communication module, one for a cooling fan and one for the serial connection daughterboard.
737746
r5891r5892
983992                           ---------------------------------------------------
984993                           Extreme Hunting 2 Tournament Edition   317-0445-COM
985994
995AW-NET Network Board
996--------------------
997
998Sammy
999AM3AJG-01
1000LAN PCB
10012003
1002SAMLAN Rev: D
1003|-----------------------------------|
1004| RJ45                              |
1005|PULSE                              |
1006|        25Mz                       |
1007|                                   |
1008|      RTL8139CL+*           CN*    |
1009|                  315-6310*        |
1010|                                   |
1011|       L46R                        |
1012|-----------------------------------|
1013Notes:
1014      *          - Denotes those parts are on the other side of the PCB
1015      RJ45       - RJ45 network connector
1016      PULSE      - Pulse H0011 10/100 LAN Magnetics Module (SOIC16)
1017      L46R       - 93C46 compatible 128x8 EEPROM (SOIC8)
1018      RTL8139CL+ - Realtek RTL8139CL+ 3.3 volt Single Chip Fast Ethernet Controller with Power Management (QFP120)
1019      315-6310   - Sega 315-6310 Custom IC (QFP100)
1020      CN         - This connector plugs into the main board
1021
1022
1023
9861024Gun Sub Board
9871025-------------
9881026
r5891r5892
27832821   ROM_LOAD("mpr-21899.ic19",0x9800000, 0x0800000, CRC(14a4b87d) SHA1(33177dea88c6aec31e2c16c8d0d3f29c7ea772c5) )
27842822   ROM_LOAD("mpr-21900.ic20",0xa000000, 0x0800000, CRC(81901130) SHA1(1573b5c4360e29ba1a4b4901af49d5399fa1e635) )
27852823   ROM_LOAD("mpr-21901.ic21",0xa800000, 0x0800000, BAD_DUMP CRC(55dcbd6d) SHA1(9fec353f9e58016090e177f899a799e2e8fc7c9f) ) // returns bad in Naomi test mode
2786ROM_END
2824ROM_END                                                  // ROM reads different each time and fails test mode on real h/w, need a new cart
27872825
27882826ROM_START( hotd2 )
27892827   ROM_REGION( 0x200000, "maincpu", 0)
r5891r5892
30053043   ROM_LOAD("mpr-23712.ic8", 0x4000000, 0x0800000, CRC(154f10ce) SHA1(67f6ff297f77632efe1965a81ed9f5c7dfa7a6b3) )
30063044   ROM_LOAD("mpr-23713.ic9", 0x4800000, 0x0800000, CRC(2969bac7) SHA1(5f1cf6ac726c2fe183d66e4022962e44592f9ccd) )
30073045   ROM_LOAD("mpr-23714.ic10",0x5000000, 0x0800000, CRC(da462c44) SHA1(ca450b6c07f939f96eba7b44c45b4e38abd598aa) )
3008   ROM_LOAD("mpr-23715.ic11",0x5800000, 0x0800000, BAD_DUMP CRC(59dfd3ad) SHA1(bb8f7a1bcf16038b18f4485a6b6d81fa72ca7bd0) )
3009
3046        ROM_LOAD("mpr-23715.ic11",0x5800000, 0x0800000, CRC(c750abbd) SHA1(2a5bedc2b21cd3f991c7145ccfd8c7a9e7f647ae) )
30103047   // trojaned protection data
30113048   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
30123049        ROM_LOAD( "a3075ac0.bin", 0x000000, 0x00ff04, CRC(440dca2a) SHA1(4e261ff309e7e774fa2061de30174b0e4e967c00) )
r5891r5892
32303267   ROM_LOAD("mpr-22033.ic9", 0x4800000, 0x0800000, CRC(5fe5586e) SHA1(3ff41ae1f81469597684faadd88e62b5e0634352) )
32313268   ROM_LOAD("mpr-22034.ic10",0x5000000, 0x0800000, CRC(3aa5ce5e) SHA1(f00a906235e4522d6fc2ac771324114346875314) )
32323269
3233   // trojaned protection data (filename is address read from)
3234   ROM_REGION( 0x4000, "naomibd_prot", ROMREGION_ERASE00 )
3235        ROM_LOAD( "a0309000.bin", 0x000000, 0x000400, CRC(e4f8b4a2) SHA1(a0d54aa6e1ffd5b1db31002ee4a94943c2157a3e) )
3236        ROM_LOAD( "a0309500.bin", 0x001000, 0x000400, CRC(5d3a9b15) SHA1(30d55a686493bb2f5e7d2c7d7df3dedf2f93dff0) )
3237        ROM_LOAD( "a030a000.bin", 0x002000, 0x000400, CRC(22b88804) SHA1(7b53778ddbf360b364376f0358b0acfb689e8713) )
3238        ROM_LOAD( "a030a500.bin", 0x003000, 0x000400, CRC(6a501389) SHA1(c2c75cd8beed6bb9e3fa39722fa01b35f2e7992d) )
3270   // protection data (also found in cleartext in the program ROM!)
3271   ROM_REGION( 0x400000, "naomibd_prot", ROMREGION_ERASE00 )
3272   ROM_COPY("user1", 0, 0, 0x400000)
32393273ROM_END
32403274
32413275
r5891r5892
34373471
34383472   // trojaned protection data (filename is address read from)
34393473   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3474        ROM_LOAD( "a2785e20.bin", 0x000000, 0x0072f0, CRC(52912418) SHA1(ec0992eda50953001801d152e09195a17132cb0f) )
3475        ROM_LOAD( "a2765e00.bin", 0x010000, 0x00e47c, CRC(d9acaa94) SHA1(6ab7ebc2dd78c0bc007f3656a67f3c24d23d48ae) )
3476        ROM_LOAD( "a2774280.bin", 0x020000, 0x00c61c, CRC(8dd9581f) SHA1(f852c44e423effa894769d3e156325a132b2df8e) )
3477        ROM_LOAD( "a27808a0.bin", 0x030000, 0x005568, CRC(4f4aee03) SHA1(453c0ec08ca69ad844f24be290e92bf16231a713) )
3478        ROM_LOAD( "a154bdc0.bin", 0x040000, 0x00ec9c, CRC(755a7343) SHA1(a4355850e1cb6f81d53d461e70884a5c51083454) )
3479        ROM_LOAD( "a155aa60.bin", 0x050000, 0x00951c, CRC(fc7a23d8) SHA1(a428114d89471f4b4c8af6d932376e7b0887c4cc) )
3480        ROM_LOAD( "a1563f80.bin", 0x060000, 0x009f3c, CRC(90903b9c) SHA1(da6fcda74710497bab97c4c8342d93b5dfb14184) )
3481        ROM_LOAD( "a156dec0.bin", 0x070000, 0x00dbdc, CRC(fb7b0b77) SHA1(ace73e925e5ffa3f805ff0ef68b564119cf4ce41) )
3482        ROM_LOAD( "a157baa0.bin", 0x080000, 0x00cb3c, CRC(60e5dad6) SHA1(db8880ebbc3ebb02d861aa3bcf2cc34071d613e8) )
3483        ROM_LOAD( "a15885e0.bin", 0x090000, 0x00e91c, CRC(6b2e1400) SHA1(8965e97e3d85a568c2bef2d1d0faf5b8aee289d0) )
3484        ROM_LOAD( "a1596f00.bin", 0x0a0000, 0x00a3bc, CRC(cf538afa) SHA1(b7f94195760a0b14c18654823ead2e28fe526b07) )
3485        ROM_LOAD( "a15a12c0.bin", 0x0b0000, 0x007f04, CRC(e07d589b) SHA1(60bc7f3e91d1f22b4854777644add346e5df58bb) )
3486        ROM_LOAD( "a15a91e0.bin", 0x0c0000, 0x00c91c, CRC(124fce0b) SHA1(8949df4586c736e22c88b7594221ae114848284a) )
3487        ROM_LOAD( "a15b5b00.bin", 0x0d0000, 0x00a53c, CRC(453bb126) SHA1(d5251f54e80504f3c427f6cc3443fe56edcd62c0) )
3488        ROM_LOAD( "a15c0040.bin", 0x0e0000, 0x0088e0, CRC(7d601fb3) SHA1(ff2aca546e0db05b79f48fdb086f0e8e7e0853e4) )
3489        ROM_LOAD( "a16203e0.bin", 0x0f0000, 0x00c61c, CRC(300c8e1e) SHA1(25f9c4af3bed0da5fc9e440096fb5cf4c29a89b3) )
3490        ROM_LOAD( "a162ca00.bin", 0x100000, 0x009e9c, CRC(8f0ccd81) SHA1(0ae2209912e31195bb8110e28d0791fc398b49cd) )
3491        ROM_LOAD( "a16368a0.bin", 0x110000, 0x00b2dc, CRC(e497f060) SHA1(05d8ffc0ead6c31ddc3197c877466fec354a71d9) )
3492        ROM_LOAD( "a1641b80.bin", 0x120000, 0x00ac5c, CRC(e6d81d57) SHA1(97cfe0b14e1e23c7428dad426848de3fe2496ddb) )
3493        ROM_LOAD( "a164c7e0.bin", 0x130000, 0x008b7c, CRC(ab6ca421) SHA1(84979f01f82f34a9d708b645e9f2cc45abed03a9) )
3494        ROM_LOAD( "a1655360.bin", 0x140000, 0x00c8bc, CRC(c5554803) SHA1(06b712aed14a489d167876217cec48ad0aee495f) )
3495        ROM_LOAD( "a1661c20.bin", 0x150000, 0x0083dc, CRC(4f5abf07) SHA1(3d03f8728ce445b6070f182d84f843f08420ad05) )
3496        ROM_LOAD( "a166a000.bin", 0x160000, 0x00f73c, CRC(bfddc3bf) SHA1(a89bdebefaffc235e163a022d85b7c3bdbffcaf6) )
3497        ROM_LOAD( "a1679740.bin", 0x170000, 0x00fb5c, CRC(ec9889a5) SHA1(d7f04b62a8a78b3bfc9a25f1b21be08dcb986546) )
3498        ROM_LOAD( "a1688d00.bin", 0x180000, 0x00e080, CRC(ad7adaf6) SHA1(516858081ebab25ef0561e4b0f8842026504c5dd) )
3499        ROM_LOAD( "a1696d80.bin", 0x190000, 0x007c10, CRC(4e0c7365) SHA1(0d564956c8330aa57c504a247aef6a230b1e8884) )
34403500ROM_END
34413501
3502
34423503/*
34433504
34443505SYSTEMID: NAOMI
r5891r5892
52075268   ROM_REGION( 0xb800000, "user1", ROMREGION_ERASEFF)
52085269        ROM_LOAD( "epr-23785.ic22", 0x0000000, 0x0400000, CRC(9bd98d4b) SHA1(3b0622625317cd6b2736c5b4a23484fb8bf39e4b) )
52095270        ROM_LOAD( "mpr-23774.ic1",  0x0800000, 0x1000000, CRC(0fe7b864) SHA1(357ca3a5d96d7ff27e06367e115ddfd00cb260e3) )
5210        ROM_LOAD( "mpr-23775.ic2",  0x1800000, 0x1000000, BAD_DUMP CRC(6c64d9d9) SHA1(d2033ca3ab9838cad39e17b5c1eb079c6d15b758) )
5271        ROM_LOAD( "mpr-23775.ic2",  0x1800000, 0x1000000, CRC(a11cd9e5) SHA1(7fd8f634d0d14a91dfe9f39b5643b9c761dc7053) )
52115272        ROM_LOAD( "mpr-23776.ic3",  0x2800000, 0x1000000, CRC(44b8429e) SHA1(0ec6b6156bef1621700791651903a4589f4b5f84) )
52125273        ROM_LOAD( "mpr-23777.ic4",  0x3800000, 0x1000000, CRC(78a4264e) SHA1(40d045240173f330ac6f108b132f9a87884922be) )
52135274        ROM_LOAD( "mpr-23778.ic5",  0x4800000, 0x1000000, CRC(02dee78b) SHA1(e08ce0fc0b1db2dcef957c2edb6d51db400a38cb) )
52145275        ROM_LOAD( "mpr-23779.ic6",  0x5800000, 0x1000000, CRC(6e458eea) SHA1(4c85fcacf4ff46d4a137afcf5906092fd88fe4b1) )
52155276        ROM_LOAD( "mpr-23780.ic7",  0x6800000, 0x1000000, CRC(a775a51c) SHA1(b3eae20e5e7d74252368fd902c4e94a6ba6cb154) )
5216        ROM_LOAD( "mpr-23781.ic8",  0x7800000, 0x1000000, BAD_DUMP CRC(689457fa) SHA1(734b6b5f2ba78af24a613aef8d4e739f296413f7) )
5277        ROM_LOAD( "mpr-23781.ic8",  0x7800000, 0x1000000, CRC(401bca00) SHA1(10c6011fae7076ea0dc5ab0ebca9cb88659a93e9) )
52175278        ROM_LOAD( "mpr-23782.ic9",  0x8800000, 0x1000000, CRC(4f72e901) SHA1(a1d231c446d2c34e5a7e7145754b2313a2d03fd4) )
52185279        ROM_LOAD( "mpr-23783.ic10", 0x9800000, 0x1000000, CRC(c8d4f6f9) SHA1(9e9df605c050b3780d7df34bd5041d30bc084d2d) )
5219        ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, BAD_DUMP CRC(3a7ebe78) SHA1(6f414db03761be0d2f995193df8146f3b82c18a8) )
5280        ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) )
52205281ROM_END
52215282
52225283ROM_START( clubkrte )
r5891r5892
52265287        ROM_LOAD( "epr-23704.ic22", 0x0000000, 0x0400000, CRC(ff700a0d) SHA1(e2db0d2bd7dc88b3a487077e8ce56eb6cfd9b02d) )
52275288        ROM_LOAD( "mpr-23693.ic1",  0x0800000, 0x1000000, CRC(28995764) SHA1(a1457f9935dde2e5aaa5ef245c736c0f2f8c74b7) )
52285289        ROM_LOAD( "mpr-22694.ic2",  0x1800000, 0x1000000, CRC(37d30111) SHA1(4c07df8cd548cac79d48709e61f692d762471f8f) )
5229        ROM_LOAD( "mpr-22695.ic3",  0x2800000, 0x1000000, BAD_DUMP CRC(9fdeaa70) SHA1(2d01a49b8d8d23f61584bec31d75723cee47dc44) )
5230        ROM_LOAD( "mpr-22696.ic4",  0x3800000, 0x1000000, BAD_DUMP CRC(cb12ae00) SHA1(cf94ae123217071c169aa79c842f0a28abba9713) )
5290        ROM_LOAD( "mpr-22695.ic3",  0x2800000, 0x1000000, CRC(41ac1510) SHA1(01b889b627fdfc1f12a0c84fcc36debdfb1cf377) )
5291        ROM_LOAD( "mpr-22696.ic4",  0x3800000, 0x1000000, CRC(6f2da455) SHA1(b655757bc513398820bfeae07dca8a4f3ea9752c) )
52315292        ROM_LOAD( "mpr-22697.ic5",  0x4800000, 0x1000000, CRC(1383c742) SHA1(6efd17632a277a4bb0e47cc912fbc9865a8b14c3) )
5232        ROM_LOAD( "mpr-22698.ic6",  0x5800000, 0x1000000, BAD_DUMP CRC(1701cd3a) SHA1(e217206745ce9dca51733f77eb093b3ef2a10c5e) )
5233        ROM_LOAD( "mpr-22699.ic7",  0x6800000, 0x1000000, BAD_DUMP CRC(e58cfa77) SHA1(27c421c37d7e3df88cb7b2240bfec1ae460001a3) )
5293        ROM_LOAD( "mpr-22698.ic6",  0x5800000, 0x1000000, CRC(da79cd06) SHA1(fdfe068caca1eb764dec28ab327e56b39144f3ae) )
5294        ROM_LOAD( "mpr-22699.ic7",  0x6800000, 0x1000000, CRC(ea77f000) SHA1(35aa8ee804d9429e72f516137a3b06c585a57b6d) )
52345295        ROM_LOAD( "mpr-22700.ic8",  0x7800000, 0x1000000, CRC(db9e5c1d) SHA1(db918c0fa1860f4345806e574d44354aba5fcd54) )
5235        ROM_LOAD( "mpr-22701.ic9",  0x8800000, 0x1000000, BAD_DUMP CRC(66ee25be) SHA1(17804308aa63bf58d2bde0b4b202d2bd0974a981) )
5296        ROM_LOAD( "mpr-22701.ic9",  0x8800000, 0x1000000, CRC(0fa92fd7) SHA1(67a1cf085101884a17a4783d0d509ab198aa6425) )
52365297        ROM_LOAD( "mpr-22702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
52375298        ROM_LOAD( "mpr-22703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
52385299ROM_END
r5891r5892
54965557 *
54975558 *********************************************/
54985559
5499typedef struct _atomiswave_key atomiswave_key;
5500struct _atomiswave_key
5560typedef struct _sbox_set sbox_set;
5561struct _sbox_set
55015562{
5502    int P0[16];
55035563    int S0[32];
55045564    int S1[16];
55055565    int S2[16];
55065566    int S3[8];
55075567};
55085568
5509static const atomiswave_key ssu_key = {
5569static const int permutation_table[4][16] =
5570{
55105571    {8,10,1,3,7,4,11,2,5,15,6,0,12,13,9,14},
5511    {4,12,8,14,16,30,31,0,23,29,24,21,11,22,27,5,3,20,18,26,10,7,17,1,28,6,15,13,2,9,25,19},
5512    {13,1,0,9,5,12,4,14,3,15,2,10,11,6,8,7},
5513    {7,13,4,6,5,9,3,2,0,15,12,10,8,11,1,14},
5514    {4,0,1,2,5,7,3,6}
5515};
5516
5517static const atomiswave_key rm_key = {
55185572    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5519    {3,0,14,17,10,15,31,20,13,2,29,28,9,18,25,27,6,19,30,22,7,12,1,16,23,11,24,4,8,26,21,5},
5520    {2,10,6,9,11,13,4,5,3,15,7,14,12,1,0,8},
5521    {1,13,11,3,8,7,9,10,12,15,4,14,0,5,6,2},
5522    {6,5,0,3,7,1,4,2}
5523};
5524
5525static const atomiswave_key fotns_key = {
55265573    {12,7,11,2,0,5,15,6,1,8,14,4,9,13,3,10},
5527    {4,7,9,22,13,8,24,19,10,5,26,27,14,21,30,28,1,20,25,17,0,11,6,23,16,12,31,3,15,29,18,2},
5528    {3,11,7,8,10,12,5,4,2,14,6,15,13,0,1,9},
5529    {10,6,0,8,3,12,2,1,7,4,15,5,11,14,13,9},
5530    {7,4,1,2,6,0,5,3}
5574    {14,1,11,15,7,3,8,13,0,4,2,12,6,10,5,9}
55315575};
55325576
5533static const atomiswave_key xh_key = {
5534    {12,7,11,2,0,5,15,6,1,8,14,4,9,13,3,10},
5535    {4,12,8,14,16,30,31,0,23,29,24,21,11,22,27,5,3,20,18,26,10,7,17,1,28,6,15,13,2,9,25,19},
5536    {13,1,0,9,5,12,4,14,3,15,2,10,11,6,8,7},
5537    {7,13,4,6,5,9,3,2,0,15,12,10,8,11,1,14},
5538    {4,0,1,2,5,7,3,6}
5577static const sbox_set sboxes_table[4] =
5578{
5579    {
5580        {4,12,8,14,16,30,31,0,23,29,24,21,11,22,27,5,3,20,18,26,10,7,17,1,28,6,15,13,2,9,25,19},
5581        {13,1,0,9,5,12,4,14,3,15,2,10,11,6,8,7},
5582        {7,13,4,6,5,9,3,2,0,15,12,10,8,11,1,14},
5583        {4,0,1,2,5,7,3,6}
5584    },
5585    {
5586        {3,0,14,17,10,15,31,20,13,2,29,28,9,18,25,27,6,19,30,22,7,12,1,16,23,11,24,4,8,26,21,5},
5587        {2,10,6,9,11,13,4,5,3,15,7,14,12,1,0,8},
5588        {1,13,11,3,8,7,9,10,12,15,4,14,0,5,6,2},
5589        {6,5,0,3,7,1,4,2}
5590    },
5591    {
5592        {9,15,28,7,13,24,2,23,21,1,22,16,18,8,17,31,27,6,30,12,4,20,5,19,0,25,3,29,10,14,11,26},
5593        {5,2,13,11,8,6,12,1,4,3,0,10,14,15,7,9},
5594        {11,6,10,0,12,1,8,14,2,9,13,3,7,4,15,5},
5595        {1,5,6,2,4,7,3,0}
5596    },
5597    {
5598        {17,3,31,2,28,10,9,29,6,25,24,8,13,1,19,15,22,0,14,20,16,7,21,4,18,26,27,5,12,23,11,30},
5599        {4,8,11,15,3,14,7,12,1,0,9,5,6,13,2,10},
5600        {14,0,9,11,4,1,7,5,13,6,8,12,2,3,10,15},
5601        {2,1,0,5,4,6,7,3}
5602    },
55395603};
55405604
5541static const atomiswave_key xh2_key = {
5542    {14,1,11,15,7,3,8,13,0,4,2,12,6,10,5,9},
5543    {11,3,7,1,31,17,16,15,24,18,23,26,4,25,20,10,12,27,29,21,5,8,30,14,19,9,0,2,13,6,22,28},
5544    {7,11,10,3,15,6,14,4,9,5,8,0,1,12,2,13},
5545    {11,1,8,10,9,5,15,14,12,3,0,6,4,7,13,2},
5546    {4,0,1,2,5,7,3,6}
5547};
5548
5549static const atomiswave_key dolphin_key = {
5550    {8,10,1,3,7,4,11,2,5,15,6,0,12,13,9,14},
5551    {11,8,6,25,2,7,23,28,5,10,21,20,1,26,17,19,14,27,22,30,15,4,9,24,31,3,16,12,0,18,29,13},
5552    {13,5,9,6,4,2,11,10,12,0,8,1,3,14,15,7},
5553    {1,13,11,3,8,7,9,10,12,15,4,14,0,5,6,2},
5554    {3,0,5,6,2,4,1,7}
5555};
5556
5557static const atomiswave_key demofist_key = {
5558    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5559    {9,15,28,7,13,24,2,23,21,1,22,16,18,8,17,31,27,6,30,12,4,20,5,19,0,25,3,29,10,14,11,26},
5560    {5,2,13,11,8,6,12,1,4,3,0,10,14,15,7,9},
5561    {11,6,10,0,12,1,8,14,2,9,13,3,7,4,15,5},
5562    {1,5,6,2,4,7,3,0}
5563};
5564
5565static const atomiswave_key rumblef_key = {
5566    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5567    {11,3,7,1,31,17,16,15,24,18,23,26,4,25,20,10,12,27,29,21,5,8,30,14,19,9,0,2,13,6,22,28},
5568    {7,11,10,3,15,6,14,4,9,5,8,0,1,12,2,13},
5569    {11,1,8,10,9,5,15,14,12,3,0,6,4,7,13,2},
5570    {4,0,1,2,5,7,3,6}
5571};
5572
5573static const atomiswave_key ngbc_key = {
5574    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5575    {17,25,29,27,5,11,10,21,2,8,13,0,30,3,14,16,22,1,7,15,31,18,4,20,9,19,26,24,23,28,12,6},
5576    {15,3,2,11,7,14,6,12,1,13,0,8,9,4,10,5},
5577    {6,12,5,7,4,8,2,3,1,14,13,11,9,10,0,15},
5578    {5,1,0,3,4,6,2,7}
5579};
5580
5581static const atomiswave_key kofnw_key = {
5582    {4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
5583    {22,16,3,24,18,7,29,8,10,30,9,15,13,23,14,0,4,25,1,19,27,11,26,12,31,6,28,2,21,17,20,5},
5584    {8,15,0,6,5,11,1,12,9,14,13,7,3,2,10,4},
5585    {2,15,3,9,5,8,1,7,11,0,4,10,14,13,6,12},
5586    {4,0,3,7,1,2,6,5}
5587};
5588
5589static const atomiswave_key kov7sprt_key = {
5590    {14,1,11,15,7,3,8,13,0,4,2,12,6,10,5,9},
5591    {17,3,31,2,28,10,9,29,6,25,24,8,13,1,19,15,22,0,14,20,16,7,21,4,18,26,27,5,12,23,11,30},
5592    {4,8,11,15,3,14,7,12,1,0,9,5,6,13,2,10},
5593    {14,0,9,11,4,1,7,5,13,6,8,12,2,3,10,15},
5594    {2,1,0,5,4,6,7,3}
5595};
5596
5597static const atomiswave_key ggisuka_key = {
5598    {12,7,11,2,0,5,15,6,1,8,14,4,9,13,3,10},
5599    {14,6,2,4,26,20,21,10,29,23,18,31,1,28,17,15,9,30,24,16,0,13,27,11,22,12,5,7,8,3,19,25},
5600    {5,9,8,1,13,4,12,6,11,7,10,2,3,14,0,15},
5601    {15,5,12,14,13,1,11,10,8,7,4,2,0,3,9,6},
5602    {1,5,4,7,0,2,6,3}
5603};
5604
5605static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const atomiswave_key* key)
5605static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const UINT32 key)
56065606{
56075607    int b0,b1,b2,b3;
56085608    int aux;
5609    const int* pbox = permutation_table[key>>18];
5610    const sbox_set* ss = &sboxes_table[(key>>16)&3];
56095611
56105612    aux = BITSWAP16(cipherText,
5611                    key->P0[15],key->P0[14],key->P0[13],key->P0[12],key->P0[11],key->P0[10],key->P0[9],key->P0[8],
5612                    key->P0[7],key->P0[6],key->P0[5],key->P0[4],key->P0[3],key->P0[2],key->P0[1],key->P0[0]);
5613                    pbox[15],pbox[14],pbox[13],pbox[12],pbox[11],pbox[10],pbox[9],pbox[8],
5614                    pbox[7],pbox[6],pbox[5],pbox[4],pbox[3],pbox[2],pbox[1],pbox[0]);
56135615    aux = aux ^ BITSWAP16(address/2, 13,5,2, 14,10,9,4, 15,11,6,1, 12,8,7,3,0);
56145616
56155617    b0 = aux&0x1f;
r5891r5892
56175619    b2 = (aux>>9)&0xf;
56185620    b3 = aux>>13;
56195621
5620    b0 = key->S0[b0];
5621    b1 = key->S1[b1];
5622    b2 = key->S2[b2];
5623    b3 = key->S3[b3];
5622    b0 = ss->S0[b0];
5623    b1 = ss->S1[b1];
5624    b2 = ss->S2[b2];
5625    b3 = ss->S3[b3];
56245626
5625    return (b3<<13)|(b2<<9)|(b1<<5)|b0;
5627    return ((b3<<13)|(b2<<9)|(b1<<5)|b0)^(key&0xffff);
56265628}
56275629
5630
5631/*
5632We are using 20 bits keys with the following subfields' structure:
5633bits 0-15 is a 16-bits XOR
5634bits 17-16 is a index to the sboxes table
5635bits 19-18 is a index to the permutation table
5636
5637These subfields could be differing from the "real" ones in the following ways:
5638- Every one of the index subfields could be suffering an arbitrary bitswap and XOR
5639- The 16-bits-XOR subfield could suffer an arbitrary XOR which could depend on the 4 index bits (that is: a different XOR per every index combination)
5640- Of course, the way in which we are mixing 3 subfields in one only key is arbitrary too.
5641*/
5642
5643
5644static const UINT32 sprtshot_key = 0x00000;
5645static const UINT32 rangrmsn_key = 0x50000;
5646static const UINT32 fotns_key    = 0x93627;
5647static const UINT32 xtrmhunt_key = 0x80000;
5648static const UINT32 xtrmhnt2_key = 0xc194f;
5649static const UINT32 dolphin_key  = 0x1a1e8;
5650static const UINT32 demofist_key = 0x60000;
5651static const UINT32 rumblef_key  = 0x4194f;
5652static const UINT32 ngbc_key     = 0x42255;
5653static const UINT32 kofnw_key    = 0x6b3bf;
5654static const UINT32 kov7sprt_key = 0xf0000;
5655static const UINT32 ggisuka_key  = 0x8b10a;
5656static const UINT32 vfurlong_key = 0xa547a;
5657static const UINT32 salmankt_key = 0x34b74;
5658
5659
56285660static DRIVER_INIT( atomiswave )
56295661{
56305662   UINT64 *ROM = (UINT64 *)memory_region(machine, "maincpu");
r5891r5892
56425674   intelflash_init(machine, 0, FLASH_MACRONIX_29L001MC, memory_region(machine, "maincpu"));
56435675}
56445676
5645
5646static DRIVER_INIT(fotns)
5647{
5648     int i;
5649   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5650
5651   long rom_size = memory_region_length(machine, "user1");
5652
5653   for(i=0; i<rom_size/2; i++)
5654   {
5655      src[i] = atomiswave_decrypt(src[i], i*2, &fotns_key);
5656   }
5657
5658   DRIVER_INIT_CALL(atomiswave);
5677#define AW_DRIVER_INIT(DRIVER)   \
5678static DRIVER_INIT(DRIVER)   \
5679{   \
5680     int i;   \
5681   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));   \
5682   int rom_size = memory_region_length(machine, "user1");   \
5683   for(i=0; i<rom_size/2; i++)   \
5684   {   \
5685      src[i] = atomiswave_decrypt(src[i], i*2, DRIVER##_key);   \
5686   }   \
5687   DRIVER_INIT_CALL(atomiswave);   \
56595688}
56605689
5690AW_DRIVER_INIT(fotns)
5691AW_DRIVER_INIT(demofist)
5692AW_DRIVER_INIT(sprtshot)
5693AW_DRIVER_INIT(rangrmsn)
5694AW_DRIVER_INIT(xtrmhunt)
5695AW_DRIVER_INIT(xtrmhnt2)
5696AW_DRIVER_INIT(dolphin)
5697AW_DRIVER_INIT(rumblef)
5698AW_DRIVER_INIT(ngbc)
5699AW_DRIVER_INIT(kofnw)
5700AW_DRIVER_INIT(kov7sprt)
5701AW_DRIVER_INIT(ggisuka)
5702AW_DRIVER_INIT(vfurlong)
5703AW_DRIVER_INIT(salmankt)
56615704
5662
5663static DRIVER_INIT(demofist)
5664{
5665     int i;
5666   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5667
5668   long rom_size = memory_region_length(machine, "user1");
5669
5670   for(i=0; i<rom_size/2; i++)
5671   {
5672      src[i] = atomiswave_decrypt(src[i], i*2, &demofist_key);
5673   }
5674
5675   DRIVER_INIT_CALL(atomiswave);
5676}
5677
5678static DRIVER_INIT(sprtshot)
5679{
5680     int i;
5681   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5682
5683   long rom_size = memory_region_length(machine, "user1");
5684
5685   for(i=0; i<rom_size/2; i++)
5686   {
5687      src[i] = atomiswave_decrypt(src[i], i*2, &ssu_key);
5688   }
5689
5690   DRIVER_INIT_CALL(atomiswave);
5691}
5692
5693static DRIVER_INIT(rangrmsn)
5694{
5695     int i;
5696   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5697
5698   long rom_size = memory_region_length(machine, "user1");
5699
5700   for(i=0; i<rom_size/2; i++)
5701   {
5702      src[i] = atomiswave_decrypt(src[i], i*2, &rm_key);
5703   }
5704
5705   DRIVER_INIT_CALL(atomiswave);
5706}
5707
5708static DRIVER_INIT(xtrmhunt)
5709{
5710     int i;
5711   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5712
5713   long rom_size = memory_region_length(machine, "user1");
5714
5715   for(i=0; i<rom_size/2; i++)
5716   {
5717      src[i] = atomiswave_decrypt(src[i], i*2, &xh_key);
5718   }
5719
5720   DRIVER_INIT_CALL(atomiswave);
5721}
5722
5723static DRIVER_INIT(xtrmhnt2)
5724{
5725     int i;
5726   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5727
5728   long rom_size = memory_region_length(machine, "user1");
5729
5730   for(i=0; i<rom_size/2; i++)
5731   {
5732      src[i] = atomiswave_decrypt(src[i], i*2, &xh2_key);
5733   }
5734
5735   DRIVER_INIT_CALL(atomiswave);
5736}
5737
5738static DRIVER_INIT(dolphin)
5739{
5740     int i;
5741   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5742
5743   long rom_size = memory_region_length(machine, "user1");
5744
5745   for(i=0; i<rom_size/2; i++)
5746   {
5747      src[i] = atomiswave_decrypt(src[i], i*2, &dolphin_key);
5748   }
5749
5750   DRIVER_INIT_CALL(atomiswave);
5751}
5752
5753static DRIVER_INIT(rumblef)
5754{
5755     int i;
5756   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5757
5758   long rom_size = memory_region_length(machine, "user1");
5759
5760   for(i=0; i<rom_size/2; i++)
5761   {
5762      src[i] = atomiswave_decrypt(src[i], i*2, &rumblef_key);
5763   }
5764
5765   DRIVER_INIT_CALL(atomiswave);
5766}
5767
5768static DRIVER_INIT(ngbc)
5769{
5770     int i;
5771   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5772
5773   long rom_size = memory_region_length(machine, "user1");
5774
5775   for(i=0; i<rom_size/2; i++)
5776   {
5777      src[i] = atomiswave_decrypt(src[i], i*2, &ngbc_key);
5778   }
5779
5780   DRIVER_INIT_CALL(atomiswave);
5781}
5782
5783static DRIVER_INIT(kofnw)
5784{
5785     int i;
5786   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5787
5788   long rom_size = memory_region_length(machine, "user1");
5789
5790   for(i=0; i<rom_size/2; i++)
5791   {
5792      src[i] = atomiswave_decrypt(src[i], i*2, &kofnw_key);
5793   }
5794
5795   DRIVER_INIT_CALL(atomiswave);
5796}
5797
5798static DRIVER_INIT(kov7sprt)
5799{
5800     int i;
5801   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5802
5803   long rom_size = memory_region_length(machine, "user1");
5804
5805   for(i=0; i<rom_size/2; i++)
5806   {
5807      src[i] = atomiswave_decrypt(src[i], i*2, &kov7sprt_key);
5808   }
5809
5810   DRIVER_INIT_CALL(atomiswave);
5811}
5812
5813static DRIVER_INIT(ggisuka)
5814{
5815     int i;
5816   UINT16 *src = (UINT16 *)(memory_region(machine, "user1"));
5817
5818   long rom_size = memory_region_length(machine, "user1");
5819
5820   for(i=0; i<rom_size/2; i++)
5821   {
5822      src[i] = atomiswave_decrypt(src[i], i*2, &ggisuka_key);
5823   }
5824
5825   DRIVER_INIT_CALL(atomiswave);
5826}
5827
58285705ROM_START( fotns )
58295706   ROM_REGION( 0x200000, "maincpu", 0)
58305707   AW_BIOS
r5891r5892
59845861
59855862   ROM_REGION( 0x9000000, "user1", ROMREGION_ERASE)
59865863        ROM_LOAD( "ax1201p01.ic18", 0x0000000, 0x0800000, CRC(0a78d52c) SHA1(e9006dc43cd11d5ba49a092a1dff31dc10700c28) )
5864        ROM_LOAD( "ax1201m01.ic10", 0x0800000, 0x1000000, CRC(df96ce30) SHA1(25a9f743b1c2b11896d0c7a2dc1c198fc977aaca) )   // second half is blank
59875865        ROM_LOAD( "ax1202m01.ic11", 0x1000000, 0x1000000, CRC(dfc6fd67) SHA1(f9d35b18a03d22f70feda42d314b0f9dd54eea55) )
59885866        ROM_LOAD( "ax1203m01.ic12", 0x2000000, 0x1000000, CRC(bf623df9) SHA1(8b9a8e8100ff6d2ce9a982ab8eb1d542f1c7af03) )
59895867        ROM_LOAD( "ax1204m01.ic13", 0x3000000, 0x1000000, CRC(c80c3930) SHA1(5c39fde36e2ebbfe72967d7d0202eb454a8d3bbe) )
r5891r5892
59915869        ROM_LOAD( "ax1206m01.ic15", 0x5000000, 0x1000000, CRC(807ab795) SHA1(17c86b1a56333c05b68ff84f83e964d013c1819c) )
59925870        ROM_LOAD( "ax1207m01.ic16", 0x6000000, 0x1000000, CRC(6636d1b8) SHA1(9bd8fc114557f6fbe772f85eeb246f7336d4255e) )
59935871        ROM_LOAD( "ax1208m01.ic17", 0x7000000, 0x1000000, CRC(38bda476) SHA1(0234a6f5fbaf5e958b3ba0db311dff157f80addc) )
5994        ROM_LOAD( "ax1201m01.ic10", 0x8000000, 0x1000000, CRC(df96ce30) SHA1(25a9f743b1c2b11896d0c7a2dc1c198fc977aaca) )
59955872ROM_END
59965873
5874ROM_START( vfurlong )
5875   ROM_REGION( 0x200000, "maincpu", 0)
5876   AW_BIOS
5877
5878   ROM_REGION( 0x9000000, "user1", ROMREGION_ERASE)
5879        ROM_LOAD( "ax2001p01.ic18", 0x0000000, 0x0800000, CRC(17ea9aa9) SHA1(c68500e9b3407a9d4b20f2678718ce475f179f7d) )
5880        ROM_LOAD( "ax2001m01.ic11", 0x1000000, 0x1000000, CRC(64460b24) SHA1(044857d6593897d303622e005a63ca7b3acd7453) )
5881        ROM_LOAD( "ax2002m01.ic12", 0x2000000, 0x1000000, CRC(d4da357f) SHA1(c462cddec9a369a1a5595676de76499d56683ea9) )
5882        ROM_LOAD( "ax2003m01.ic13", 0x3000000, 0x1000000, CRC(ad046ad7) SHA1(ac7c46e458595714e327526354e1111fb25b44e0) )
5883        ROM_LOAD( "ax2004m01.ic14", 0x4000000, 0x1000000, CRC(4d555d7c) SHA1(a5eccc920bdb7ad9cf57c0e1ef6a905c6b9eee45) )
5884        ROM_LOAD( "ax2005m01.ic15", 0x5000000, 0x1000000, CRC(785208e2) SHA1(6ba5bd3901c5b1d71abcc8d833a011bd4abae6b6) )
5885        ROM_LOAD( "ax2006m01.ic16", 0x6000000, 0x1000000, CRC(8134ec55) SHA1(843e473d4f99237ded641cce9515b7802cfe3742) )
5886        ROM_LOAD( "ax2007m01.ic17", 0x7000000, 0x1000000, CRC(d0557e8a) SHA1(df8057597eb690bd18c5d26736f5d4f86e3b1225) )
5887ROM_END
5888
5889ROM_START( salmankt )
5890   ROM_REGION( 0x200000, "maincpu", 0)
5891   AW_BIOS
5892
5893   ROM_REGION( 0x9000000, "user1", ROMREGION_ERASE)
5894        ROM_LOAD( "ax1401p01.ic18", 0x0000000, 0x0800000, CRC(28d779e0) SHA1(dab785a595de5f474c18c713e672949176a5b1b5) )
5895        ROM_LOAD( "ax1401m01.ic11", 0x1000000, 0x1000000, CRC(fd7af845) SHA1(0c8f5a91662e46d5c187a0758af95082183cdf69) )
5896        ROM_LOAD( "ax1402m01.ic12", 0x2000000, 0x1000000, CRC(88d458a7) SHA1(c661196d5a9640013995c8aa6a5bea057d984f87) )
5897        ROM_LOAD( "ax1403m01.ic13", 0x3000000, 0x1000000, CRC(074f7c4b) SHA1(4955e4f333d15d5d9cc69bb9658f29a37e912012) )
5898        ROM_LOAD( "ax1404m01.ic14", 0x4000000, 0x1000000, CRC(af4e3829) SHA1(18d9e8a8d8e930ad697b686a98f31ea175f5fd4a) )
5899        ROM_LOAD( "ax1405m01.ic15", 0x5000000, 0x1000000, CRC(b548446f) SHA1(8b4661e601e36c067dff2530aff4f7ea76e1c21e) )
5900        ROM_LOAD( "ax1406m01.ic16", 0x6000000, 0x1000000, CRC(437673e6) SHA1(66f7e5f246ebbb1bdbf074da41ec16bf32720a82) )
5901        ROM_LOAD( "ax1407m01.ic17", 0x7000000, 0x1000000, CRC(6b6acc0a) SHA1(a8c692c875271a0806460caa79c67fd756231273) )
5902ROM_END
5903
59975904/* Atomiswave */
59985905GAME( 2001, awbios,   0,        aw,    aw,    0,        ROT0, "Sammy",                           "Atomiswave Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
59995906
60005907GAME( 2002, sprtshot, awbios,   aw,    aw,    sprtshot, ROT0, "Sammy USA",                       "Sports Shooting USA", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
60015908GAME( 2003, demofist, awbios,   aw,    aw,    demofist, ROT0, "Polygon Magic / Dimps",           "Demolish Fist", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
60025909GAME( 2003, dolphin,  awbios,   aw,    aw,    dolphin,  ROT0, "Sammy",                           "Dolphin Blue", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
6003GAME( 2003, ggisuka,  awbios,   aw,    aw,    ggisuka,  ROT0, "Sammy / Arc System Works",        "Guilty Gear Isuka", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5910GAME( 2003, ggisuka,  awbios,   aw,    aw,    ggisuka,  ROT0, "Sammy / Arc System Works",        "Guilty Gear Isuka", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
60045911GAME( 2004, rumblef,  awbios,   aw,    aw,    rumblef,  ROT0, "Sammy / Dimps",                   "The Rumble Fish", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
60055912GAME( 2004, rangrmsn, awbios,   aw,    aw,    rangrmsn, ROT0, "Sammy",                           "Ranger Mission", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5913GAME( 2004, salmankt, awbios,   aw,    aw,    salmankt, ROT0, "Sammy",                           "Salary Man Kintarou", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
60065914GAME( 2004, kov7sprt, awbios,   aw,    aw,    kov7sprt, ROT0, "Sammy / IGS",           "Knights of Valour - The Seven Spirits", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
5915GAME( 2005, vfurlong, awbios,   aw,    aw,    vfurlong, ROT0, "Sammy",                   "Net Select Keiba Victory Furlong", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
60075916GAME( 2005, ngbc,     awbios,   aw,    aw,    ngbc,     ROT0, "Sammy / SNK Playmore",            "Neo-Geo Battle Coliseum", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
60085917GAME( 2005, fotns,    awbios,   aw,    aw,    fotns,    ROT0, "Sega / Arc System Works",         "Fist Of The North Star", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
60095918GAME( 2005, kofnw,    awbios,   aw,    aw,    kofnw,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters Neowave", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
src/mame/drivers/firefox.c
r5891r5892
289289 *
290290 *************************************/
291291
292static UINT8 riot_porta_r(const device_config *device, UINT8 olddata)
292static READ8_DEVICE_HANDLER( riot_porta_r )
293293{
294294   /* bit 7 = MAINFLAG */
295295   /* bit 6 = SOUNDFLAG */
r5891r5892
300300   /* bit 1 = TMS /read */
301301   /* bit 0 = TMS /write */
302302
303   const device_config *tms = devtag_get_device(device->machine, "tms");
304   return (main_to_sound_flag << 7) | (sound_to_main_flag << 6) | 0x10 | (!tms5220_ready_r(tms) << 2);
303   return (main_to_sound_flag << 7) | (sound_to_main_flag << 6) | 0x10 | (tms5220_readyq_r(device) << 2);
305304}
306305
307
308static void riot_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
306static WRITE8_DEVICE_HANDLER( riot_porta_w )
309307{
310308   const device_config *tms = devtag_get_device(device->machine, "tms");
311309
312310   /* handle 5220 read */
313   if ((olddata & 2) != 0 && (newdata & 2) == 0)
314      riot6532_portb_in_set(device, tms5220_status_r(tms, 0), 0xff);
311   tms5220_rsq_w(tms, (data>>1) & 1);
315312
316313   /* handle 5220 write */
317   if ((olddata & 1) != 0 && (newdata & 1) == 0)
318      tms5220_data_w(tms, 0, riot6532_portb_out_get(device));
314   tms5220_wsq_w(tms, data & 1);
319315}
320316
321
322static void riot_irq(const device_config *device, int state)
317static WRITE_LINE_DEVICE_HANDLER( riot_irq )
323318{
324319   cputag_set_input_line(device->machine, "audiocpu", M6502_IRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
325320}
r5891r5892
639634
640635static const riot6532_interface riot_intf =
641636{
642   riot_porta_r,
643   NULL,
644   riot_porta_w,
645   NULL,
646   riot_irq
637   DEVCB_DEVICE_HANDLER("tms", riot_porta_r),
638   DEVCB_DEVICE_HANDLER("tms", tms5220_status_r),
639   DEVCB_DEVICE_HANDLER("tms", riot_porta_w),
640   DEVCB_DEVICE_HANDLER("tms", tms5220_data_w),
641   DEVCB_LINE(riot_irq)
647642};
648643
649644
src/mame/drivers/bogeyman.c
r5891r5892
217217
218218static MACHINE_DRIVER_START( bogeyman )
219219   // basic machine hardware
220   MDRV_CPU_ADD("maincpu", M6502, 2000000)   // 12 MHz clock on board
220   MDRV_CPU_ADD("maincpu", M6502, 1500000)   /* Verified */
221221   MDRV_CPU_PROGRAM_MAP(bogeyman_map)
222222   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 16) // Controls sound
223223
r5891r5892
241241   // sound hardware
242242   MDRV_SPEAKER_STANDARD_MONO("mono")
243243
244   MDRV_SOUND_ADD("ay1", AY8910, 1500000)
244   MDRV_SOUND_ADD("ay1", AY8910, 1500000)   /* Verified */
245245   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
246246
247   MDRV_SOUND_ADD("ay2", AY8910, 1500000)
247   MDRV_SOUND_ADD("ay2", AY8910, 1500000)   /* Verified */
248248   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
249249MACHINE_DRIVER_END
250250
src/mame/drivers/looping.c
r5891r5892
332332}
333333
334334
335static void looping_spcint(const device_config *device, int state)
335static WRITE_LINE_DEVICE_HANDLER( looping_spcint )
336336{
337   cputag_set_input_line_and_vector(device->machine, "audiocpu", 0, state, 6);
337   cputag_set_input_line_and_vector(device->machine, "audiocpu", 0, !state, 6);
338338}
339339
340340
r5891r5892
576576
577577static const tms5220_interface tms5220_config =
578578{
579   looping_spcint
579   DEVCB_LINE(looping_spcint)
580580};
581581
582582static const ay8910_interface ay8910_config =
src/mame/drivers/neodrvr.c
r5891r5892
66
77****************************************************************************/
88
9
10/* Game specific input definitions */
11
912static INPUT_PORTS_START( svcpcb )
1013   STANDARD_IN0
1114
r5891r5892
299302INPUT_PORTS_END
300303
301304
305/* Neo-Geo bios */
302306
303/******************************************************************************/
307/******************************************************************************
304308
305/****
306309 These are the known Bios Roms, Set options.bios to the one you want
307310
308 the Universe bios roms are supported because they're now used on enough PCBs
311 The Universe bios roms are supported because they're now used on enough PCBs
309312 to be considered 'in active arcade use' rather than just homebrew hacks.
310313  -- some may be missing, there have been multiple CRCs reported for the same
311     revision in some cases
314     revision in some cases (the Universe bios has an option for entering / displaying
315     a serial number; these should be noted as such if they're added.
312316
313317 The 'japan-hotel' BIOS is a dump of an MVS which could be found in some japanese
314318 hotels. it is a custom MVS mobo which uses MVS carts but it hasn't jamma
315319 connector and it's similar to a console with a coin mechanism, so it's a sort
316320 of little coin op console installed in hotels.
317321
318 ****/
322 *****************************************************************************/
319323
320324#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \
321325      ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */
r5891r5892
369373//  ROM_SYSTEM_BIOS(22, "jap-aes",   "Japan AES" )
370374//  ROM_LOAD16_WORD_SWAP_BIOS(22, "neo-po.bin", 0x00000, 0x020000, CRC(16d0c132) SHA1(4e4a440cae46f3889d20234aebd7f8d5f522e22c) ) /* AES Console (Japan) Bios */
371375
372
373376/* note you'll have to modify the last for lines of each block to use the extra bios roms,
374377   they're hacks / homebrew / console bios roms so MAME doesn't list them by default */
375378
379
376380/******************************************************************************
377381
378382    The current Neo-Geo MVS system set (SFIX/SM1/000-LO) used is from a NEO-MVH MV1FS board.
r5891r5892
490494   ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) )
491495
492496
497/* AES and MVS cartridge information */
498
493499/***************************************************************************
494500
495501    Neo-Geo game pcb infos:
r5891r5892
680686    . Metal Slug 4 (AES)
681687    . Metal Slug 4 (MVS, 1st revision)
682688    . Metal Slug 5 (PCB)
683    . 98 Best 44
689    . Sengoku 3 (alternate revision)
684690
685    Redump required:
686    . All set with BAD_DUMP roms
687    . Sets which have a p1h
688
689691    All rom labels need to be reverified
690692
691693    SMA protected sets:
r5891r5892
694696    MVS sets confirmed are garou, mslug3, mslug3a and kof2000.
695697*/
696698
699/*
700
701  About supported sets:
702
703  MVS carts (arcade) were released before the AES carts (home)
704  The actual codepath taken depends entirely on the BIOS rom, not the roms in the cartridge, which (with
705  a few exceptions) support both codepaths.
706
707  The initial AES releases are therefore later revisions of the game, often with bug fixes over the
708  initial MVS releases.  It isn't uncommon for later production runs and bootlegs to use these newer sets,
709  so all of them are supported in MAME.
710
711  Likewise, because the MVS carts were released first (and were produced in higher numbers and generally
712  have a lower cost) it's not uncommon for AES units to operate with converted MVS carts, so, with the
713  exception of the sets that specifically lock out the AES mode* these sets are all equally suitable
714  for MESS.
715
716  * nitd, kof2001 (initial release has no AES code), and a number of the hacked bootlegs.
717
718*/
719
720/* dummy entry for the dummy bios driver */
721ROM_START( neogeo )
722   NEOGEO_BIOS
723
724   ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF )
725
726   ROM_REGION( 0x20000, "audiobios", 0 )
727   ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
728
729   ROM_REGION( 0x50000, "audiocpu", 0 )
730   ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
731
732   ROM_Y_ZOOM
733
734   ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF )
735
736   ROM_REGION( 0x20000, "fixedbios", 0 )
737   ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
738
739   ROM_REGION( 0x10000, "ym", ROMREGION_ERASEFF )
740
741   NO_DELTAT_REGION
742
743   ROM_REGION( 0x100000, "sprites", ROMREGION_ERASEFF )
744ROM_END
745
697746ROM_START( nam1975 ) /* MVS AND AES VERSION */
698747   ROM_REGION( 0x100000, "maincpu", 0 )
699748   ROM_LOAD16_WORD_SWAP( "001-p1.bin", 0x000000, 0x080000, CRC(cc9fc951) SHA1(92f4e6ddeeb825077d92dbb70b50afea985f15c0) )
r5891r5892
720769   ROM_LOAD16_BYTE( "001-c6.bin", 0x200001, 0x80000, CRC(e62bed58) SHA1(d05b2903b212a51ee131e52c761b714cb787683e) ) /* Plane 2,3 */
721770ROM_END
722771
723ROM_START( bstars )
772ROM_START( bstars ) /* MVS VERSION */
724773   ROM_REGION( 0x100000, "maincpu", 0 )
774   ROM_LOAD16_WORD_SWAP( "002-pg.p1", 0x000000, 0x080000, CRC(c100b5f5) SHA1(4cea9f29ad67288c3eccfa4cf961ee9782e49165) )
775
776   NEO_SFIX_128K( "002-s1.bin", CRC(1a7fd0c6) SHA1(3fc701b7afddab369ddf9dedfbc5e1aaf80b8af3) )
777
778   /* MB832000 */
779   NEO_BIOS_AUDIO_256K( "002-m1.bin", CRC(4ecaa4ee) SHA1(50abfb8eed6cb4887393089f9ccc76f306ef69b5) )
780
781   ROM_REGION( 0x200000, "ym", 0 )
782   ROM_LOAD( "002-v11.bin", 0x000000, 0x080000, CRC(b7b925bd) SHA1(644c92fa90e74998e73714f74b1e0680ee372a07) )
783   ROM_LOAD( "002-v12.bin", 0x080000, 0x080000, CRC(329f26fc) SHA1(2c8009edc88c6b26f7be5beb2b8d260aac394ee1) )
784   ROM_LOAD( "002-v13.bin", 0x100000, 0x080000, CRC(0c39f3c8) SHA1(db8f8670639601215707d918d4fb93221460446a) )
785   ROM_LOAD( "002-v14.bin", 0x180000, 0x080000, CRC(c7e11c38) SHA1(5abf2a7877e0162c758a4dcf09f183930fa7ef24) )
786
787   ROM_REGION( 0x080000, "ym.deltat", 0 )
788   ROM_LOAD( "002-v21.bin", 0x000000, 0x080000, CRC(04a733d1) SHA1(84159368c0f6de2c3b8121227201cd3422455cf6) )
789
790   ROM_REGION( 0x300000, "sprites", 0 )
791   ROM_LOAD16_BYTE( "002-c1.bin", 0x000000, 0x080000, CRC(aaff2a45) SHA1(c91ee72d1d74514df8ec44fca703409d92158ae3) ) /* Plane 0,1 */
792   ROM_LOAD16_BYTE( "002-c2.bin", 0x000001, 0x080000, CRC(3ba0f7e4) SHA1(f023b134b9c7994f477867307d2732026033501d) ) /* Plane 2,3 */
793   ROM_LOAD16_BYTE( "002-c3.bin", 0x100000, 0x080000, CRC(96f0fdfa) SHA1(9f779a1ae46aeda54d69382b074392ade687f62f) ) /* Plane 0,1 */
794   ROM_LOAD16_BYTE( "002-c4.bin", 0x100001, 0x080000, CRC(5fd87f2f) SHA1(a5dd6f26f9485f216c2428ae1792c182beb10dbc) ) /* Plane 2,3 */
795   ROM_LOAD16_BYTE( "002-c5.bin", 0x200000, 0x080000, CRC(807ed83b) SHA1(3268e7d4602c3f55f1e0da2c80653d5ae461ef67) ) /* Plane 0,1 */
796   ROM_LOAD16_BYTE( "002-c6.bin", 0x200001, 0x080000, CRC(5a3cad41) SHA1(c620d18f4ff32ed5489c941dfc641030a54f1c14) ) /* Plane 2,3 */
797ROM_END
798
799ROM_START( bstarsh ) /* AES VERSION */
800   ROM_REGION( 0x100000, "maincpu", 0 )
725801   ROM_LOAD16_WORD_SWAP( "002-p1.bin", 0x000000, 0x080000, CRC(3bc7790e) SHA1(50b2fffb1278151bb4849fbe1f8cb23916019815) )
726802
727803   NEO_SFIX_128K( "002-s1.bin", CRC(1a7fd0c6) SHA1(3fc701b7afddab369ddf9dedfbc5e1aaf80b8af3) )
r5891r5892
12021278   ROM_LOAD16_BYTE( "019-c2.bin", 0x000001, 0x080000, CRC(d4dd0802) SHA1(82069752028c118d42384a95befde45844f0f247) ) /* Plane 2,3 */
12031279ROM_END
12041280
1205ROM_START( gpilots )
1281ROM_START( gpilots ) /* MVS VERSION */
12061282   ROM_REGION( 0x100000, "maincpu", 0 )
12071283   ROM_LOAD16_WORD_SWAP( "020-p1.bin", 0x000000, 0x080000, CRC(e6f2fe64) SHA1(50ab82517e077727d97668a4df2b9b96d2e78ab6) )
12081284   ROM_LOAD16_WORD_SWAP( "020-p2.bin", 0x080000, 0x020000, CRC(edcb22ac) SHA1(505d2db38ae999b7d436e8f2ff56b81796d62b54) )
r5891r5892
17471823ROM_START( 3countb ) /* MVS AND AES VERSION */
17481824   ROM_REGION( 0x100000, "maincpu", 0 )
17491825   ROM_LOAD16_WORD_SWAP( "043-p1.bin", 0x000000, 0x100000, CRC(ffbdd928) SHA1(05b24655ca32723661adc5509b450824deb0c176) )
1750
17511826   /* The original p1 is 8mbit; also found sets with p1 / p2 4mbit on eprom. */
17521827
17531828   NEO_SFIX_128K( "043-s1.bin", CRC(c362d484) SHA1(a3c029292572842feabe9aa8c3372628fb63978d) )
r5891r5892
18461921ROM_END
18471922
18481923   /* Old version looked like this; p's on eprom?
1849
18501924    ROM_START( samsho )
18511925    ROM_REGION( 0x180000, "maincpu", 0 )
18521926    ROM_LOAD16_WORD_SWAP( "045-p1.bin", 0x000000, 0x080000, CRC(80aa6c97) SHA1(6e07a4aa7b4719ae487a10cee9389cb55a370a7a) )
18531927    ROM_LOAD16_WORD_SWAP( "045-p2.bin", 0x080000, 0x080000, CRC(71768728) SHA1(9ff0e01d3fb73ad04279d4fdf4c53c3160888179) )
18541928    ROM_LOAD16_WORD_SWAP( "045-p3.bin", 0x100000, 0x080000, CRC(38ee9ba9) SHA1(48190699a6be83cb6257365ae81f93fdd23abe09) )
1855
18561929    */
18571930
18581931ROM_START( tophuntr ) /* MVS VERSION */
r5891r5892
18831956   ROM_LOAD16_BYTE( "046-c8.bin", 0x600001, 0x100000, CRC(c944e03d) SHA1(be23999b8ce09ee15ba500ce4d5e2a82a4f58d9b) ) /* Plane 2,3 */
18841957ROM_END
18851958
1886ROM_START( tophuntra )
1959ROM_START( tophuntrh ) /* AES VERSION */
18871960   ROM_REGION( 0x200000, "maincpu", 0 )
18881961   ROM_LOAD16_WORD_SWAP( "046-pg1.bin",0x000000, 0x100000, CRC(771e39bc) SHA1(c0e05fd1ca81926438bb75e2fa6894e40ab6521e) )
18891962   ROM_LOAD16_WORD_SWAP( "046-p2.bin", 0x100000, 0x100000, CRC(f182cb3e) SHA1(6b4e0af5d4e623f0682f37ff5c69e5b705e20028) )
18901963
1891   NEO_SFIX_128K( "046-s1.bin", CRC(14b01d7b) SHA1(618ce75c25d6cc86a3b46bd64a0aa34ab82f75ae) )
1964   NEO_SFIX_128K( "046-sg1.bin", CRC(92e9ac8c) SHA1(cab5c77c091e8d12d9c3a2cc8d741b74e4386efb) )
18921965
18931966   NEO_BIOS_AUDIO_128K( "046-m1.bin", CRC(3f84bb9f) SHA1(07446040871d11da3c2217ee9d1faf8c3cae7420) )
18941967
r5891r5892
19622035
19632036   NEO_SFIX_128K( "049-s1.bin", CRC(6349de5d) SHA1(bcc44b9576d7bedd9a39294530bb66f707690c72) )
19642037
1965   NEO_BIOS_AUDIO_128K( "049-m1.bin", CRC(1a009f8c) SHA1(7782dfe48e143417f34fba5353e6deb63efeaa8a) )
2038   NEO_BIOS_AUDIO_128K( "049-m1.bin", CRC(edd2acf4) SHA1(c4ee6ba834d54b9fc5a854dbc41a05877e090371) )
19662039
19672040   ROM_REGION( 0x100000, "ym", 0 )
1968   ROM_LOAD( "049-v1.bin", 0x000000, 0x080000, CRC(577c85b3) SHA1(2c3072401fe73497dca0e9009ae2ba4053fe936d) )
1969   ROM_LOAD( "049-v2.bin", 0x080000, 0x080000, CRC(e14551c4) SHA1(763a9912b9df55defb190af3f29ae034f6dd78d6) )
1970   /* The MVS version has only v1 rom, size 8mbit. */
2041   ROM_LOAD( "049-v1.bin", 0x000000, 0x100000, CRC(ce43cb89) SHA1(47f82e077abb6efc6b1b0490412ae147d5d2acef) )
19712042
19722043   NO_DELTAT_REGION
19732044
r5891r5892
23202391ROM_START( fightfeva ) /* MVS VERSION */
23212392   ROM_REGION( 0x200000, "maincpu", 0 )
23222393   ROM_LOAD16_WORD_SWAP( "060-p1.rom", 0x0000000, 0x100000, CRC(2a104b50) SHA1(3eb663d3df7074e1cdf4c0e450a35c9cf55d8979) )
2323
23242394   /* There was also a copy of the 060-p1.bin with the name 060-p2.bin maybe it should be loaded over the top or this
23252395    larger rom is an older revision... */
23262396
r5891r5892
25582628   ROM_LOAD16_BYTE( "067-c2.bin", 0x000001, 0x200000, CRC(9db64084) SHA1(68a43c12f63f5e98d68ad0902a6551c5d30f8543) ) /* Plane 2,3 */
25592629ROM_END
25602630
2561ROM_START( pspikes2 )
2631ROM_START( pspikes2 ) /* MVS VERSION */
25622632   ROM_REGION( 0x100000, "maincpu", 0 )
25632633   ROM_LOAD16_WORD_SWAP( "068-pg1.bin", 0x000000, 0x100000, CRC(105a408f) SHA1(2ee51defa1c24c66c63a6498ee542ac26de3cfbb) )
25642634
r5891r5892
28442914
28452915ROM_START( pbobblen ) /* MVS VERSION */
28462916   /* This set uses CHA and PROG board from Power Spikes II. Six Power Spikes II prom's are replaced with
2847    Puzzle Bobble prom's. Confirmed on two original carts. Do other layouts also exist? Later production run set? */
2917    Puzzle Bobble prom's. Confirmed on several original carts. Do other layouts also exist? */
28482918
28492919   ROM_REGION( 0x100000, "maincpu", 0 )
28502920   ROM_LOAD16_WORD_SWAP( "d96-07.ep1", 0x000000, 0x080000, CRC(6102ca14) SHA1(328429d11de5b327a0654ae0548da4d0025a2ae6) )
r5891r5892
28702940   ROM_LOAD16_BYTE( "d96-03.c6", 0x400001, 0x80000, CRC(4b42d7eb) SHA1 (042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */
28712941ROM_END
28722942
2873ROM_START( pbobblena )
2874   /* Does this set exist? Layout correct? */
2875   ROM_REGION( 0x100000, "maincpu", 0 )
2876   ROM_LOAD16_WORD_SWAP( "083-p1.bin", 0x000000, 0x080000, CRC(ac1e9ef3) SHA1(a2b125ee70869667431ab125bc29e768500802ad) )
2877
2878   NEO_SFIX_128K( "d96-04.s1", CRC(9caae538) SHA1 (cf2d90a7c1a42107c0bb8b9a61397634286dbe0a) )
2879
2880   NEO_BIOS_AUDIO_128K( "d96-06.m1", CRC(f424368a) SHA1 (5e5bbcaeb82bed2ee17df08f005ca20ad1030723) )
2881
2882   ROM_REGION( 0x380000, "ym", 0 )
2883   /* 0x000000-0x1fffff empty */
2884   ROM_LOAD( "d96-01.v3", 0x200000, 0x100000, CRC(0840cbc4) SHA1 (1adbd7aef44fa80832f63dfb8efdf69fd7256a57) )
2885   ROM_LOAD( "d96-05.v4", 0x300000, 0x080000, CRC(0a548948) SHA1 (e1e4afd17811cb60401c14fbcf0465035165f4fb) )
2886
2887   NO_DELTAT_REGION
2888
2889   ROM_REGION( 0x100000, "sprites", 0 )
2890   ROM_LOAD16_BYTE( "d96-02.c5", 0x000000, 0x80000, CRC(e89ad494) SHA1 (69c9ea415773af94ac44c48af05d55ada222b138) ) /* Plane 0,1 */
2891   ROM_LOAD16_BYTE( "d96-03.c6", 0x000001, 0x80000, CRC(4b42d7eb) SHA1 (042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */
2892ROM_END
2893
28942943ROM_START( kof95 )
28952944   ROM_REGION( 0x200000, "maincpu", 0 )
28962945   ROM_LOAD16_WORD_SWAP( "084-p1.bin",0x100000, 0x100000, CRC(2cba2716) SHA1(f6c2d0537c9c3e0938065c65b1797c47198fcff8) )
r5891r5892
39774026   ROM_LOAD16_BYTE( "232-c6.bin", 0x2000001, 0x400000, CRC(4ff4d47b) SHA1(4d5689ede24a5fe4330bd85d4d3f4eb2795308bb) ) /* Plane 2,3 */
39784027ROM_END
39794028
3980ROM_START( kof97a )
4029ROM_START( kof97h ) /* AES VERSION */
39814030   ROM_REGION( 0x500000, "maincpu", 0 )
39824031   ROM_LOAD16_WORD_SWAP( "232-pg1.bin",0x000000, 0x100000, CRC(5c2400b7) SHA1(49e23f80c012c62146a1bb8f254a7597823de430) )
39834032   ROM_LOAD16_WORD_SWAP( "232-p2.bin", 0x100000, 0x400000, CRC(158b23f6) SHA1(9744620a70513490aaf9c5eda33e5ec31222be19) )
r5891r5892
44364485   ROM_LOAD16_BYTE( "242-c8.bin", 0x3000001, 0x800000, CRC(c823e045) SHA1(886fbf64bcb58bc4eabb1fc9262f6ac9901a0f28) ) /* Plane 2,3 */
44374486ROM_END
44384487
4439ROM_START( lastbld2 )
4488ROM_START( lastbld2 ) /* MVS AND AES VERSION */ /* later revision */
44404489   ROM_REGION( 0x500000, "maincpu", 0 )
44414490   ROM_LOAD16_WORD_SWAP( "243-pg1.bin", 0x000000, 0x100000, CRC(af1e6554) SHA1(bd8526f60c2472937728a5d933fbd19d899f2cba) )
44424491   ROM_LOAD16_WORD_SWAP( "243-pg2.bin", 0x100000, 0x400000, CRC(add4a30b) SHA1(7db62564db49fe0218cbb35b119d62582a24d658) )
r5891r5892
44784527   NO_DELTAT_REGION
44794528
44804529   ROM_REGION( 0x1000000, "sprites", 0 )
4481   ROM_LOAD16_BYTE( "244-c1.bin", 0x000000, 0x800000, CRC(d2c40ec7) SHA1(989d972aabcc7f190bdd5d861d3e13c09dd0803e) ) /* Plane 0,1 */
4530   ROM_LOAD16_BYTE( "244-c1.bin", 0x000000, 0x800000, CRC(c7a62b23) SHA1(4534ecc9ade69c543188c66229dcad89dbc48668) ) /* Plane 0,1 */
44824531   ROM_LOAD16_BYTE( "244-c2.bin", 0x000001, 0x800000, CRC(33aa0f35) SHA1(3443c7765c6aa177003d42bbfcac9f31d1e12575) ) /* Plane 2,3 */
44834532ROM_END
44844533
r5891r5892
53115360   ROM_LOAD16_BYTE( "262-c8-08-e0.bin", 0x3000001, 0x800000, CRC(59289a6b) SHA1(ddfce7c85b2a144975db5bb14b4b51aaf881880e) ) /* Plane 2,3 */
53125361ROM_END
53135362
5314ROM_START( mslug4 ) /* Original Version - Encrypted GFX */ /* MVS VERSION */ /* 2nd revision */
5363ROM_START( mslug4 ) /* Original Version - Encrypted GFX */ /* MVS VERSION */
53155364   ROM_REGION( 0x500000, "maincpu", 0 )
5316   ROM_LOAD16_WORD_SWAP( "263-pg1.bin", 0x000000, 0x100000, CRC(27e4def3) SHA1(a08785e8145981bb6b5332a3b2df7eb321253cca) )
5317   ROM_LOAD16_WORD_SWAP( "263-p2.bin",  0x100000, 0x400000, CRC(fdb7aed8) SHA1(dbeaec38f44e58ffedba99e70fa1439c2bf0dfa3) )
5365   /* There also exist carts where p1 label is pg1;
5366    The PG1 revision has a Japanese cart label, SN 02Jxxxxx
5367    The P1 revision has a US/EUR cart label, SN 02Txxxxx
5368    Rom data on both is identical.
5369    These carts were manufactured by Mega Enterprise, not SNK. */
5370   ROM_LOAD16_WORD_SWAP( "263-p1.bin", 0x000000, 0x100000, CRC(27e4def3) SHA1(a08785e8145981bb6b5332a3b2df7eb321253cca) )
5371   ROM_LOAD16_WORD_SWAP( "263-p2.bin", 0x100000, 0x400000, CRC(fdb7aed8) SHA1(dbeaec38f44e58ffedba99e70fa1439c2bf0dfa3) )
53185372
53195373   ROM_Y_ZOOM
53205374
r5891r5892
53445398   ROM_LOAD16_BYTE( "263-c6.bin", 0x2000001, 0x800000, CRC(5c8ba116) SHA1(6034db09c8706d4ddbcefc053efbc47a0953eb92) ) /* Plane 2,3 */
53455399ROM_END
53465400
5401ROM_START( mslug4h ) /* Original Version - Encrypted GFX */ /* AES VERSION */
5402   ROM_REGION( 0x500000, "maincpu", 0 )
5403   ROM_LOAD16_WORD_SWAP( "263-ph1.bin", 0x000000, 0x100000, CRC(c67f5c8d) SHA1(12af74964843f103520d9f0825069ea2f67eeb2f) )
5404   ROM_LOAD16_WORD_SWAP( "263-ph2.bin", 0x100000, 0x400000, CRC(bc3ec89e) SHA1(2cb0626bc4fa57e1d25f208e04532b570d87b3fb) )
5405
5406   ROM_Y_ZOOM
5407
5408   /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */
5409   ROM_REGION( 0x80000, "fixed", 0 )   /* larger char set */
5410   ROM_FILL( 0x000000, 0x20000, 0 )
5411   ROM_REGION( 0x20000, "fixedbios", 0 )
5412   ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
5413
5414   /* Encrypted */
5415   NEO_BIOS_AUDIO_ENCRYPTED_128K( "263-m1.bin", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) )
5416
5417   ROM_REGION( 0x1000000, "ym", 0 )
5418   /* Encrypted */
5419   ROM_LOAD( "263-v1.bin", 0x000000, 0x800000, CRC(01e9b9cd) SHA1(0b045c2999449f7dab5ae8a42e957d5b6650431e) )
5420   ROM_LOAD( "263-v2.bin", 0x800000, 0x800000, CRC(4ab2bf81) SHA1(77ccfa48f7e3daddef5fe5229a0093eb2f803742) )
5421
5422   NO_DELTAT_REGION
5423
5424   ROM_REGION( 0x3000000, "sprites", 0 )
5425   /* Encrypted */
5426   ROM_LOAD16_BYTE( "263-c1.bin", 0x0000000, 0x800000, CRC(84865f8a) SHA1(34467ada896eb7c7ca58658bf2a932936d8b632c) ) /* Plane 0,1 */
5427   ROM_LOAD16_BYTE( "263-c2.bin", 0x0000001, 0x800000, CRC(81df97f2) SHA1(2b74493b8ec8fd49216a627aeb3db493f76124e3) ) /* Plane 2,3 */
5428   ROM_LOAD16_BYTE( "263-c3.bin", 0x1000000, 0x800000, CRC(1a343323) SHA1(bbbb5232bba538c277ce2ee02e2956ca2243b787) ) /* Plane 0,1 */
5429   ROM_LOAD16_BYTE( "263-c4.bin", 0x1000001, 0x800000, CRC(942cfb44) SHA1(d9b46c71726383c4581fb042e63897e5a3c92d1b) ) /* Plane 2,3 */
5430   ROM_LOAD16_BYTE( "263-c5.bin", 0x2000000, 0x800000, CRC(a748854f) SHA1(2611bbedf9b5d8e82c6b2c99b88f842c46434d41) ) /* Plane 0,1 */
5431   ROM_LOAD16_BYTE( "263-c6.bin", 0x2000001, 0x800000, CRC(5c8ba116) SHA1(6034db09c8706d4ddbcefc053efbc47a0953eb92) ) /* Plane 2,3 */
5432ROM_END
5433
5434
53475435ROM_START( rotd ) /* Encrypted Set */ /* MVS VERSION */
53485436   ROM_REGION( 0x800000, "maincpu", 0 )
53495437   ROM_LOAD16_WORD_SWAP( "264-p1.bin", 0x000000, 0x800000, CRC(b8cc969d) SHA1(4f2205b4bdd32dd1522106ef4df10ac0eb1b852d) )
r5891r5892
67236811   ROM_LOAD16_BYTE( "268-c8c.bin", 0x3000001, 0x800000, CRC(551d720e) SHA1(ebf69e334fcaba0fda6fd432fd0970283a365d12) ) /* Plane 2,3 */
67246812ROM_END
67256813
6814/* Puzzle Bobble / Bust-A-Move (Neo-Geo) bootleg */
6815
6816ROM_START( pbobblenb )
6817   ROM_REGION( 0x100000, "maincpu", 0 )
6818   ROM_LOAD16_WORD_SWAP( "u7", 0x000000, 0x080000, CRC(ac1e9ef3) SHA1(a2b125ee70869667431ab125bc29e768500802ad) )
6819
6820   NEO_SFIX_128K( "us1", CRC(9caae538) SHA1 (cf2d90a7c1a42107c0bb8b9a61397634286dbe0a) )
6821
6822   NEO_BIOS_AUDIO_128K( "um1", CRC(f424368a) SHA1 (5e5bbcaeb82bed2ee17df08f005ca20ad1030723) )
6823
6824   ROM_REGION( 0x380000, "ym", 0 )
6825   /* 0x000000-0x1fffff empty */
6826   ROM_LOAD( "u8", 0x200000, 0x100000, CRC(0840cbc4) SHA1 (1adbd7aef44fa80832f63dfb8efdf69fd7256a57) )
6827   ROM_LOAD( "u9", 0x300000, 0x080000, CRC(0a548948) SHA1 (e1e4afd17811cb60401c14fbcf0465035165f4fb) )
6828
6829   NO_DELTAT_REGION
6830
6831   ROM_REGION( 0x100000, "sprites", 0 )
6832   ROM_LOAD16_BYTE( "uc5", 0x000000, 0x80000, CRC(e89ad494) SHA1 (69c9ea415773af94ac44c48af05d55ada222b138) ) /* Plane 0,1 */
6833   ROM_LOAD16_BYTE( "uc6", 0x000001, 0x80000, CRC(4b42d7eb) SHA1 (042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */
6834ROM_END
6835
67266836/* SNK vs. CAPCOM SVC CHAOS bootlegs */
67276837
67286838ROM_START( svcboot )
r5891r5892
71077217ROM_END
71087218
71097219
7220/* Game specific inits */
71107221
7111/******************************************************************************/
7112
7113/* dummy entry for the dummy bios driver */
7114ROM_START( neogeo )
7115   NEOGEO_BIOS
7116
7117   ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF )
7118
7119   ROM_REGION( 0x20000, "audiobios", 0 )
7120   ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
7121
7122   ROM_REGION( 0x50000, "audiocpu", 0 )
7123   ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
7124
7125   ROM_Y_ZOOM
7126
7127   ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF )
7128
7129   ROM_REGION( 0x20000, "fixedbios", 0 )
7130   ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
7131
7132   ROM_REGION( 0x10000, "ym", ROMREGION_ERASEFF )
7133
7134   NO_DELTAT_REGION
7135
7136   ROM_REGION( 0x100000, "sprites", ROMREGION_ERASEFF )
7137ROM_END
7138
7139
71407222static DRIVER_INIT( fatfury2 )
71417223{
71427224   DRIVER_INIT_CALL(neogeo);
r5891r5892
77247806   DRIVER_INIT_CALL(neogeo);
77257807}
77267808
7809/***********************************************************************/
77277810
77287811
77297812/*    YEAR  NAME      PARENT    MACHINE   INPUT     INIT      MONITOR  */
r5891r5892
77317814
77327815/* SNK */
77337816GAME( 1990, nam1975,  neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "NAM-1975", 0 )
7734GAME( 1990, bstars,   neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Baseball Stars Professional", 0 )
7817GAME( 1990, bstars,   neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Baseball Stars Professional (set 1)", 0 )
7818GAME( 1990, bstarsh,  bstars,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Baseball Stars Professional (set 2)", 0 )
77357819GAME( 1990, tpgolf,   neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Top Player's Golf", 0 )
77367820GAME( 1990, mahretsu, neogeo,   neogeo,   mjneogeo, neogeo,   ROT0, "SNK", "Mahjong Kyoretsuden", 0 )
77377821GAME( 1990, ridhero,  neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Riding Hero (set 1)", 0 )
r5891r5892
77727856GAME( 1993, samsho,   neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Samurai Shodown / Samurai Spirits (set 1)", 0 )
77737857GAME( 1993, samshoh,  samsho,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Samurai Shodown / Samurai Spirits (set 2)", 0 )
77747858GAME( 1994, tophuntr, neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Top Hunter - Roddy & Cathy (set 1)", 0 )
7775GAME( 1994, tophuntra,tophuntr, neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Top Hunter - Roddy & Cathy (set 2)", 0 )
7859GAME( 1994, tophuntrh,tophuntr, neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Top Hunter - Roddy & Cathy (set 2)", 0 )
77767860GAME( 1992, fatfury2, neogeo,   neogeo,   neogeo,   fatfury2, ROT0, "SNK", "Fatal Fury 2 / Garou Densetsu 2 - arata-naru tatakai", 0 )
77777861GAME( 1992, ssideki,  neogeo,   neogeo,   neogeo,   fatfury2, ROT0, "SNK", "Super Sidekicks / Tokuten Ou", 0 )
77787862GAME( 1994, kof94,    neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "The King of Fighters '94", 0 )
r5891r5892
78037887GAME( 1996, samsho4k, samsho4,  neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Pae Wang Jeon Seol / Legend of a Warrior (Korean censored Samurai Shodown IV)", 0 )
78047888GAME( 1996, rbffspec, neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Real Bout Fatal Fury Special / Real Bout Garou Densetsu Special", 0 )
78057889GAME( 1997, kof97,    neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "The King of Fighters '97 (set 1)", 0 )
7806GAME( 1997, kof97a,   kof97,    neogeo,   neogeo,   neogeo,   ROT0, "SNK", "The King of Fighters '97 (set 2)", 0 )
7890GAME( 1997, kof97h,   kof97,    neogeo,   neogeo,   neogeo,   ROT0, "SNK", "The King of Fighters '97 (set 2)", 0 )
78077891GAME( 1997, kof97pls, kof97,    neogeo,   neogeo,   neogeo,   ROT0, "bootleg", "The King of Fighters '97 Plus (bootleg)", 0 )
78087892GAME( 1997, kog,      kof97,    neogeo,   kog,      kog,      ROT0, "bootleg", "King of Gladiator (The King of Fighters '97 bootleg)", GAME_NOT_WORKING) // protected bootleg
78097893GAME( 1997, lastblad, neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "SNK", "Last Blade / Bakumatsu Roman - Gekka no Kenshi, The (set 1)", 0 )
r5891r5892
79618045
79628046/* Taito */
79638047GAME( 1994, pbobblen, neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "Taito", "Puzzle Bobble / Bust-A-Move (Neo-Geo) (set 1)", 0 )
7964GAME( 1994, pbobblena,pbobblen, neogeo,   neogeo,   neogeo,   ROT0, "Taito", "Puzzle Bobble / Bust-A-Move (Neo-Geo) (set 2)", 0 )
8048GAME( 1994, pbobblenb,pbobblen, neogeo,   neogeo,   neogeo,   ROT0, "Taito", "Puzzle Bobble / Bust-A-Move (Neo-Geo) (bootleg)", 0 )
79658049GAME( 1999, pbobbl2n, neogeo,   neogeo,   neogeo,   neogeo,   ROT0, "Taito (SNK license)", "Puzzle Bobble 2 / Bust-A-Move Again (Neo-Geo)", 0 )
79668050GAME( 2003, pnyaa,    neogeo,   neogeo,   neogeo,   pnyaa,    ROT0, "Aiky / Taito", "Pochi and Nyaa", 0 )
79678051
r5891r5892
80028086//GAME( 2000, bangbedp, bangbead, neogeo,   neogeo,   neogeo,   ROT0, "Visco", "Bang Bead (prototype)", 0 )
80038087
80048088/* Mega Enterprise */
8005GAME( 2002, mslug4,   neogeo,   neogeo,   neogeo,   mslug4,   ROT0, "Mega / Playmore", "Metal Slug 4", 0 )
8089GAME( 2002, mslug4,   neogeo,   neogeo,   neogeo,   mslug4,   ROT0, "Mega / Playmore", "Metal Slug 4 (set 1)", 0 )
8090GAME( 2002, mslug4h,  mslug4,   neogeo,   neogeo,   mslug4,   ROT0, "Mega / Playmore", "Metal Slug 4 (set 2)", 0 )
80068091GAME( 2002, ms4plus,  mslug4,   neogeo,   neogeo,   ms4plus,  ROT0, "bootleg", "Metal Slug 4 Plus (bootleg)", 0 )
80078092
80088093/* Evoga */
src/mame/drivers/namcoic.c
r5891r5892
15201520   ROAD_TILE_SIZE,   ROAD_TILE_SIZE,
15211521   ROAD_TILE_COUNT_MAX,
15221522   2,
1523#ifndef LSB_FIRST
1524   { 0,8 },
1525#else
1526   { 8,0 },
1527#endif
1523   { NATIVE_ENDIAN_VALUE_LE_BE(0,8), NATIVE_ENDIAN_VALUE_LE_BE(8,0) },
15281524   {/* x offset */
15291525      0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
15301526      0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17
src/mame/drivers/taito_f2.c
r5891r5892
11321132   AM_RANGE(0x300000, 0x30ffff) AM_RAM
11331133   AM_RANGE(0x400000, 0x401fff) AM_READWRITE(TC0430GRW_word_r, TC0430GRW_word_w)   /* ROZ tilemap */
11341134   AM_RANGE(0x402000, 0x40200f) AM_WRITE(TC0430GRW_ctrl_word_w)
1135   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(taitof2_palette_w)
1135   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
11361136   AM_RANGE(0x800000, 0x80ffff) AM_READWRITE(TC0100SCN_word_0_r, TC0100SCN_word_0_w)   /* tilemaps */
11371137   AM_RANGE(0x820000, 0x82000f) AM_READWRITE(TC0100SCN_ctrl_word_0_r, TC0100SCN_ctrl_word_0_w)
11381138   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
r5891r5892
36093609   /* video hardware */
36103610   MDRV_GFXDECODE(pivot)
36113611   MDRV_VIDEO_START(taitof2_driftout)
3612   MDRV_VIDEO_UPDATE(taitof2_driftout)
3612   MDRV_VIDEO_UPDATE(taitof2_pri_roz)
36133613MACHINE_DRIVER_END
36143614
36153615
src/mame/drivers/goldnpkr.c
r5891r5892
21262126   DISCRETE_INPUT_NOT   (NODE_01)      /* bit 3 - enable/disable */
21272127   DISCRETE_INPUT_DATA  (NODE_10)      /* bits 0-2  - sound data */
21282128
2129   DISCRETE_DAC_R1(NODE_20, NODE_01, NODE_10, 5, &dac_goldnpkr_ladder)
2129   DISCRETE_DAC_R1(NODE_20, NODE_10, 5, &dac_goldnpkr_ladder)
21302130
21312131   DISCRETE_555_ASTABLE_CV(NODE_30, NODE_01, RES_K(1), RES_K(10), CAP_U(.1), NODE_20, &goldnpkr_555_vco_desc)
21322132   DISCRETE_OUTPUT(NODE_30, 3000)
r5891r5892
21892189   DISCRETE_INPUT_NOT   (NODE_01)      /* bit 3 - enable/disable */
21902190   DISCRETE_INPUT_DATA  (NODE_10)      /* bits 0-2  - sound data */
21912191
2192   DISCRETE_DAC_R1(NODE_20, NODE_01, NODE_10, 5, &dac_pottnpkr_ladder)
2192   DISCRETE_DAC_R1(NODE_20, NODE_10, 5, &dac_pottnpkr_ladder)
21932193
21942194   DISCRETE_555_ASTABLE_CV(NODE_30, NODE_01, RES_K(1), RES_K(1), CAP_U(1), NODE_20, &goldnpkr_555_vco_desc)
21952195   DISCRETE_OUTPUT(NODE_30, 3000)
src/mame/drivers/m92.c
r5891r5892
17031703   ROM_LOAD( "uc_w42.rom", 0x000000, 0x080000, CRC(d17d3fd6) SHA1(b02da0d01c41c7bf50cd35d6c75bacc3e3e0b85a) )
17041704ROM_END
17051705
1706ROM_START( uccopsu )
1707   ROM_REGION( 0x100000, "maincpu", 0 )
1708   ROM_LOAD16_BYTE( "uc_h0.rom",   0x000001, 0x040000, CRC(240aa5f7) SHA1(8d864bb1377e9f6d266631ed365c5809b9da33f8) )
1709   ROM_LOAD16_BYTE( "uc_l0.rom",   0x000000, 0x040000, CRC(df9a4826) SHA1(298033d97b9587e3548cb3bffa16b7ba9a6ff20d) )
1710   ROM_LOAD16_BYTE( "uc_h1-g.rom", 0x080001, 0x020000, CRC(6b8ca2de) SHA1(1096b93bbaa4c97d4900e8c083cde99195cad5ba) )
1711   ROM_LOAD16_BYTE( "uc_l1-g.rom", 0x080000, 0x020000, CRC(2bdec7dd) SHA1(58817099e74fd5bc299b7bc14d83ee75ed200b53) )
17061712
1713   ROM_REGION( 0x100000, "soundcpu", 0 )   /* 1MB for the audio CPU - encrypted V30 = NANAO custom D80001 (?) */
1714   ROM_LOAD16_BYTE( "uc_sh0.rom", 0x000001, 0x010000, CRC(df90b198) SHA1(6b334457f06f6b9cfb355ba3d399bebb37b5733e) )
1715   ROM_LOAD16_BYTE( "uc_sl0.rom", 0x000000, 0x010000, CRC(96c11aac) SHA1(16c47b4f97f0532fff30bb163f26d8cf6b923a2e) )
1716
1717   ROM_REGION( 0x200000, "gfx1", 0 ) /* Tiles */
1718   ROM_LOAD( "uc_w38m.rom", 0x000000, 0x080000, CRC(130a40e5) SHA1(f70bad2fe126bb0e451a3fa6100a610928e9a502) )
1719   ROM_LOAD( "uc_w39m.rom", 0x080000, 0x080000, CRC(e42ca144) SHA1(ea83b1027d403e874fda6e68097814f8b9ce25d6) )
1720   ROM_LOAD( "uc_w40m.rom", 0x100000, 0x080000, CRC(c2961648) SHA1(b5d28638e72ab50d598e284f31bf389956ae12c6) )
1721   ROM_LOAD( "uc_w41m.rom", 0x180000, 0x080000, CRC(f5334b80) SHA1(6fa70ceba4f67fb0562be7b24b28bda0ffc13ef5) )
1722
1723   ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
1724   ROM_LOAD( "uc_k16m.rom", 0x000000, 0x100000, CRC(4a225f09) SHA1(f4d27813241fd9b020e4df8b03c852c8ecb92586) )
1725   ROM_LOAD( "uc_k17m.rom", 0x100000, 0x100000, CRC(e4ed9a54) SHA1(55befbd2e156c765c5e79a3176cf4336d2111293) )
1726   ROM_LOAD( "uc_k18m.rom", 0x200000, 0x100000, CRC(a626eb12) SHA1(826c4796c2e63f777490b43f84ffa37a6b749ca2) )
1727   ROM_LOAD( "uc_k19m.rom", 0x300000, 0x100000, CRC(5df46549) SHA1(87b0b799b50bf2b6ee916d9f8dfc1ee7666ce800) )
1728
1729   ROM_REGION( 0x80000, "irem", 0 )
1730   ROM_LOAD( "uc_w42.rom", 0x000000, 0x080000, CRC(d17d3fd6) SHA1(b02da0d01c41c7bf50cd35d6c75bacc3e3e0b85a) )
1731ROM_END
1732
1733
17071734/*
17081735Undercover Cops Alpha Renewal Version
17091736Irem, 1992
r5891r5892
21682195GAME( 1991, lethalth, 0,        lethalth,      lethalth, lethalth, ROT270, "Irem",         "Lethal Thunder (World)", 0 )
21692196GAME( 1991, thndblst, lethalth, lethalth,      lethalth, lethalth, ROT270, "Irem",         "Thunder Blaster (Japan)", 0 )
21702197GAME( 1992, uccops,   0,        uccops,        uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (World)", 0 )
2198GAME( 1992, uccopsu,  uccops,   uccops,        uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (US)", 0 )
21712199GAME( 1992, uccopsar, uccops,   uccops,        uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (Alpha Renewal Version)", 0 )
21722200GAME( 1992, uccopsj,  uccops,   uccops,        uccops,   uccops,   ROT0,   "Irem",         "Undercover Cops (Japan)", 0 )
21732201GAME( 1992, mysticri, 0,        mysticri,      mysticri, mysticri, ROT0,   "Irem",         "Mystic Riders (World)", 0 )
src/mame/drivers/tourtabl.c
r5891r5892
1616#define MASTER_CLOCK   3579575
1717
1818
19static void tourtabl_led_w(const device_config *device, UINT8 newdata, UINT8 olddata)
19static WRITE8_DEVICE_HANDLER( tourtabl_led_w )
2020{
21   set_led_status(0, newdata & 0x40); /* start 1 */
22   set_led_status(1, newdata & 0x20); /* start 2 */
23   set_led_status(2, newdata & 0x10); /* start 4 */
24   set_led_status(3, newdata & 0x80); /* select game */
21   set_led_status(0, data & 0x40); /* start 1 */
22   set_led_status(1, data & 0x20); /* start 2 */
23   set_led_status(2, data & 0x10); /* start 4 */
24   set_led_status(3, data & 0x80); /* select game */
2525
26   coin_lockout_global_w(!(newdata & 0x80));
26   coin_lockout_global_w(!(data & 0x80));
2727}
2828
2929
r5891r5892
5151ADDRESS_MAP_END
5252
5353
54static UINT8 port6_r(const device_config *device, UINT8 olddata)
54static WRITE8_DEVICE_HANDLER( watchdog_w )
5555{
56   return input_port_read(device->machine, "RIOT0_SWA");
57}
58
59static UINT8 port7_r(const device_config *device, UINT8 olddata)
60{
61   return input_port_read(device->machine, "RIOT0_SWB");
62}
63
64static UINT8 port8_r(const device_config *device, UINT8 olddata)
65{
66   return input_port_read(device->machine, "RIOT1_SWA");
67}
68
69static UINT8 port9_r(const device_config *device, UINT8 olddata)
70{
71   return input_port_read(device->machine, "RIOT1_SWB");
72}
73
74static void watchdog_w(const device_config *device, UINT8 newdata, UINT8 olddata)
75{
7656   watchdog_reset(device->machine);
7757}
7858
7959static const riot6532_interface r6532_interface_0 =
8060{
81   port6_r,
82   port7_r,
83   NULL,
84   watchdog_w,
85   NULL
61   DEVCB_INPUT_PORT("RIOT0_SWA"),   /* Port 6 */
62   DEVCB_INPUT_PORT("RIOT0_SWB"),   /* Port 7 */
63   DEVCB_NULL,
64   DEVCB_HANDLER(watchdog_w),
65   DEVCB_NULL
8666};
8767
8868
8969static const riot6532_interface r6532_interface_1 =
9070{
91   port8_r,
92   port9_r,
93   NULL,
94   tourtabl_led_w,
95   NULL
71   DEVCB_INPUT_PORT("RIOT1_SWA"),   /* Port 8 */
72   DEVCB_INPUT_PORT("RIOT1_SWB"),   /* Port 9 */
73   DEVCB_NULL,
74   DEVCB_HANDLER(tourtabl_led_w),
75   DEVCB_NULL
9676};
9777
9878
src/mame/drivers/multfish.c
r5891r5892
377377   AM_RANGE(0xe1, 0xe1)  AM_WRITE(multfish_bank_w)
378378   AM_RANGE(0xe5, 0xe5)  AM_WRITE(multfish_bank_w)
379379   AM_RANGE(0xe8, 0xe8)  AM_WRITE(multfish_bank_w) // mirror banking for some games
380   AM_RANGE(0xea, 0xea)  AM_WRITE(multfish_bank_w) // mirror banking for some games
380381
381382   AM_RANGE(0xf1, 0xf1)  AM_WRITE(multfish_rambank_w)
382383   AM_RANGE(0xf3, 0xf3)  AM_WRITE(multfish_f3_w) // from 00->01 at startup, irq enable maybe?
r5891r5892
17071708
17081709Note:
17091710
1710   Only the first set of a given revision is listed in Irgosoft's official hashes list.
1711   Only the first set of a given revision is listed in Igrosoft's official hashes list.
17111712
17121713   It is not known if the alternate sets are hacks or were intended for different regions.
17131714   It looks like the difference are in the payout percentage / odds
17141715
1716Most games had a revision in early 2007 to meet the standards of the "Government gambling control"
1717   law of The Russian Federation No 244-03 of Dec 29, 2006
1718
1719From Igrosoft's web site about version types (IE: some version have "M" in them):
1720
1721   * Two software versions are shown, one of them corresponds to Russian legislation,
1722     the other one (with the letter m) is for the countries without such restrictions.
1723
17151724*/
17161725
17171726GAME( 2002, mfish_3,     0,        multfish, multfish,  0, ROT0, "Igro", "Multi Fish (021124, set 1)",  0 )
r5891r5892
18201829GAME( 2006, keksa,       keks,     multfish, multfish,  0, ROT0, "Igrosoft", "Keks (060328, set 2)",  0 )
18211830GAME( 2006, keksb,       keks,     multfish, multfish,  0, ROT0, "Igrosoft", "Keks (060328, set 3)",  0 )
18221831GAME( 2006, keks_2,      keks,     multfish, multfish,  0, ROT0, "Igrosoft", "Keks (060403. set 1)",  0 )
1823GAME( 2006, keks_2a,     keks,     multfish, multfish,  0, ROT0, "Igrosoft", "Keks (060403, set 3)",  0 )
1832GAME( 2006, keks_2a,     keks,     multfish, multfish,  0, ROT0, "Igrosoft", "Keks (060403, set 2)",  0 )
src/mame/drivers/midtunit.c
r5891r5892
823823ROM_END
824824
825825
826ROM_START( mk2r30 )
827   ROM_REGION16_LE( 0xc00000, "dcs", ROMREGION_ERASEFF )   /* sound data */
828   ROM_LOAD16_BYTE( "su2.l1", 0x000000, 0x80000, CRC(5f23d71d) SHA1(54c2afef243759e0f3dbe2907edbc4302f5c8bad) )
829   ROM_RELOAD(                  0x100000, 0x80000 )
830   ROM_LOAD16_BYTE( "su3.l1", 0x200000, 0x80000, CRC(d6d92bf9) SHA1(397351c6b707f2595e36360471015f9fa494e894) )
831   ROM_RELOAD(                  0x300000, 0x80000 )
832   ROM_LOAD16_BYTE( "su4.l1", 0x400000, 0x80000, CRC(eebc8e0f) SHA1(705ab63ff7672a4857d546afda6dca4973cce1ad) )
833   ROM_RELOAD(                  0x500000, 0x80000 )
834   ROM_LOAD16_BYTE( "su5.l1", 0x600000, 0x80000, CRC(2b0b7961) SHA1(1cdc64aab74d14afbd8c3531e3d0bd49271a281f) )
835   ROM_RELOAD(                  0x700000, 0x80000 )
836   ROM_LOAD16_BYTE( "su6.l1", 0x800000, 0x80000, CRC(f694b27f) SHA1(d43e38a124665f49ebb4ffc5a55e8f19a1a64686) )
837   ROM_RELOAD(                  0x900000, 0x80000 )
838   ROM_LOAD16_BYTE( "su7.l1", 0xa00000, 0x80000, CRC(20387e0a) SHA1(505d05173b2a1f1ee3ebc2898ccd3a95c98dd04a) )
839   ROM_RELOAD(                  0xb00000, 0x80000 )
840   /* su8 and su9 are unpopulated */
841
842   ROM_REGION16_LE( 0x100000, "user1", 0 )   /* 34010 code */
843   ROM_LOAD16_BYTE( "uj12.l3", 0x00000, 0x80000, CRC(93440895) SHA1(e81735db939cd12b3836c7b9507a087e6899cdbd) )
844   ROM_LOAD16_BYTE( "ug12.l3", 0x00001, 0x80000, CRC(6153c2d8) SHA1(7b12eecc830f770a9c605a7e8376c8e719c33678) )
845
846   ROM_REGION( 0xc00000, "gfx1", 0 )
847   ROM_LOAD( "ug14-vid", 0x000000, 0x100000, CRC(01e73af6) SHA1(6598cfd704cc92a7f358a0e1f1c973ab79dcc493) )
848   ROM_LOAD( "ug16-vid", 0x100000, 0x100000, CRC(8ba6ae18) SHA1(465fe907de4a1e502180c4e41642998dd3abc8e6) )
849   ROM_LOAD( "ug17-vid", 0x200000, 0x100000, CRC(937d8620) SHA1(8b9f80a460b124a747a6d1495b53f01f580e28f1) )
850
851   ROM_LOAD( "uj14-vid", 0x300000, 0x100000, CRC(d4985cbb) SHA1(367865da7efae38d83de3c0868d02a705177ae63) )
852   ROM_LOAD( "uj16-vid", 0x400000, 0x100000, CRC(39d885b4) SHA1(2251826d247c3c6df421124718401fb35a672f83) )
853   ROM_LOAD( "uj17-vid", 0x500000, 0x100000, CRC(218de160) SHA1(87aea173720d2a33d8183903f4fe8ba1d47e3348) )
854
855   ROM_LOAD( "ug19-vid", 0x600000, 0x100000, CRC(fec137be) SHA1(f11ecb8a7993f5c4f4449564b4911f69bd6e9bf8) )
856   ROM_LOAD( "ug20-vid", 0x700000, 0x100000, CRC(809118c1) SHA1(86153e648834c749e34573151cd4fee403a81962) )
857   ROM_LOAD( "ug22-vid", 0x800000, 0x100000, CRC(154d53b1) SHA1(58ff0aa59101f40a9a3b5fbae1c904d0b0b31612) )
858
859   ROM_LOAD( "uj19-vid", 0x900000, 0x100000, CRC(2d763156) SHA1(06536006da49ab5fb6b75b25f801b83fad000ff5) )
860   ROM_LOAD( "uj20-vid", 0xa00000, 0x100000, CRC(b96824f0) SHA1(d42b122f9a57da330192abc7e5f97abc4065d718) )
861   ROM_LOAD( "uj22-vid", 0xb00000, 0x100000, CRC(8891d785) SHA1(fd460df1ef8f4306ea42f7dc41488a80fd2c8f53) )
862ROM_END
863
864
826865ROM_START( mk2r21 )
827866   ROM_REGION16_LE( 0xc00000, "dcs", ROMREGION_ERASEFF )   /* sound data */
828867   ROM_LOAD16_BYTE( "su2.l1", 0x000000, 0x80000, CRC(5f23d71d) SHA1(54c2afef243759e0f3dbe2907edbc4302f5c8bad) )
r5891r5892
13161355
13171356GAME( 1993, mk2,      0,       tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.1)", GAME_SUPPORTS_SAVE )
13181357GAME( 1993, mk2r32,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.2 (European))", GAME_SUPPORTS_SAVE )
1358GAME( 1993, mk2r30,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L3.0)", GAME_SUPPORTS_SAVE )
13191359GAME( 1993, mk2r21,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L2.1)", GAME_SUPPORTS_SAVE )
13201360GAME( 1993, mk2r14,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "Midway",   "Mortal Kombat II (rev L1.4)", GAME_SUPPORTS_SAVE )
13211361GAME( 1993, mk2r42,   mk2,     tunit_dcs,   mk2,      mk2,      ROT0, "hack",     "Mortal Kombat II (rev L4.2, hack)", GAME_SUPPORTS_SAVE )
src/mame/drivers/dkong.c
r5891r5892
416416    state->hunchloopback = 0;
417417
418418    state_save_register_global(machine, state->hunchloopback);
419    state_save_register_global(machine, state->prot_cnt);
420    state_save_register_global(machine, state->main_fo);
419421
420422    if (strcmp(game_name,"herbiedk") == 0) state->protect_type = DK2650_HERBIEDK;
421423    else if (strcmp(game_name,"hunchbkd") == 0) state->protect_type = DK2650_HUNCHBKD;
r5891r5892
644646    state->hunchloopback = data;
645647}
646648
649static WRITE8_HANDLER( s2650_fo_w )
650{
651    dkong_state *state = (dkong_state *)space->machine->driver_data;
652#if DEBUG_PROTECTION
653    logerror("write : pc = %04x, FO = %02x\n",cpu_get_pc(space->cpu), data);
654#endif
655
656    state->main_fo = data;
657
658    if (state->main_fo)
659       state->hunchloopback = 0xfb;
660}
661
647662static READ8_HANDLER( s2650_port0_r )
648663{
649664    dkong_state *state = (dkong_state *)space->machine->driver_data;
650665#if DEBUG_PROTECTION
651    logerror("port 0 : pc = %04x, loopback = %02x\n",cpu_get_pc(space->cpu), state->hunchloopback);
666    logerror("port 0 : pc = %04x, loopback = %02x fo=%d\n",cpu_get_pc(space->cpu), state->hunchloopback, state->main_fo);
652667#endif
653668
654    switch (COMBINE_TYPE_PC(state->protect_type, cpu_get_pc(space->cpu)))
655    {
656        case COMBINE_TYPE_PC(DK2650_HUNCHBKD, 0x00e9):  return 0xff;
657        case COMBINE_TYPE_PC(DK2650_HUNCHBKD, 0x0114):  return 0xfb; //fb
658        case COMBINE_TYPE_PC(DK2650_HUNCHBKD, 0x209b):  return state->hunchloopback; /* this at least prevents reset after super bonus */
659        case COMBINE_TYPE_PC(DK2650_SHOOTGAL, 0x0079):  return 0xff;
660        case COMBINE_TYPE_PC(DK2650_SPCLFORC, 0x00a3):  return 0x01;
661        case COMBINE_TYPE_PC(DK2650_SPCLFORC, 0x007b):  return 0x01;
662    }
663
664669    switch (state->protect_type)
665670    {
666        case DK2650_HUNCHBKD:  return 0x00;
667        case DK2650_SHOOTGAL:  return 0x00;
668        case DK2650_SPCLFORC:  return 0x00;
671       case DK2650_SHOOTGAL:
672       case DK2650_HUNCHBKD:
673           if (state->main_fo)
674              return state->hunchloopback;
675           else
676              return state->hunchloopback--;
677        case DK2650_SPCLFORC:
678          if (!state->main_fo)
679             return state->hunchloopback;
680          else
681             return state->hunchloopback--;
669682    }
670683    fatalerror("Unhandled read from port 0 : pc = %4x\n",cpu_get_pc(space->cpu));
671684}
r5891r5892
674687static READ8_HANDLER( s2650_port1_r )
675688{
676689    dkong_state *state = (dkong_state *)space->machine->driver_data;
690
677691#if DEBUG_PROTECTION
678    logerror("port 1 : pc = %04x, loopback = %02x\n",cpu_get_pc(space->cpu), state->hunchloopback);
692    logerror("port 1 : pc = %04x, loopback = %02x fo=%d\n",cpu_get_pc(space->cpu), state->hunchloopback, state->main_fo);
679693#endif
680694
681    switch (COMBINE_TYPE_PC(state->protect_type, cpu_get_pc(space->cpu)))
682    {
683        case COMBINE_TYPE_PC(DK2650_EIGHTACT, 0x0021):  return 0x00;
684        case COMBINE_TYPE_PC(DK2650_HERBIEDK, 0x002b):  return 0x00;
685        case COMBINE_TYPE_PC(DK2650_HERBIEDK, 0x09dc):  return 0x00;
686    }
687
688695    switch (state->protect_type)
689696    {
690        case DK2650_HUNCHBKD:  return state->hunchloopback;
691        case DK2650_EIGHTACT:  return 1;
692        case DK2650_HERBIEDK:  return 1;
697        case DK2650_HUNCHBKD:
698           return state->hunchloopback--;
699        case DK2650_EIGHTACT:
700        case DK2650_HERBIEDK:
701           if (state->hunchloopback & 0x80)
702              return state->prot_cnt;
703           else
704              return ++state->prot_cnt;
693705    }
694706    fatalerror("Unhandled read from port 1 : pc = %4x\n",cpu_get_pc(space->cpu));
695707}
r5891r5892
749761    AM_RANGE(0x0000, 0x3fff) AM_ROM
750762    AM_RANGE(0x6000, 0x6bff) AM_RAM
751763    AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE_MEMBER(dkong_state, sprite_ram)
752                                    AM_SIZE_MEMBER(dkong_state, sprite_ram_size) /* sprite set 1 */
764                                    AM_SIZE_MEMBER(dkong_state, sprite_ram_size) /* sprite set 1 */
753765    AM_RANGE(0x7400, 0x77ff) AM_RAM_WRITE(dkong_videoram_w)
754766                                    AM_BASE_MEMBER(dkong_state, video_ram)
755767    AM_RANGE(0x7800, 0x780f) AM_DEVREADWRITE("dma8257", dma8257_r, dma8257_w)   /* P8257 control registers */
756    AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_LATCH8_WRITE("ls175.3d")      /* IN0, sound CPU intf */
757    AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_WRITE(radarscp_grid_color_w)  /* IN1 */
768    AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_LATCH8_WRITE("ls175.3d")    /* IN0, sound CPU intf */
769    AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_WRITE(radarscp_grid_color_w)/* IN1 */
758770
759    AM_RANGE(0x7d00, 0x7d00) AM_READ(dkong_in2_r)                                 /* IN2 */
760    AM_RANGE(0x7d00, 0x7d07) AM_DEVWRITE("ls259.6h", latch8_bit0_w)       /* Sound signals */
771    AM_RANGE(0x7d00, 0x7d00) AM_READ(dkong_in2_r)                               /* IN2 */
772    AM_RANGE(0x7d00, 0x7d07) AM_DEVWRITE("ls259.6h", latch8_bit0_w)            /* Sound signals */
761773
762    AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w)     /* DSW0 */
774    AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w)   /* DSW0 */
763775    AM_RANGE(0x7d81, 0x7d81) AM_WRITE(radarscp_grid_enable_w)
764776    AM_RANGE(0x7d82, 0x7d82) AM_WRITE(dkong_flipscreen_w)
765    AM_RANGE(0x7d83, 0x7d83) AM_WRITE(dkong_spritebank_w)                         /* 2 PSL Signal */
777    AM_RANGE(0x7d83, 0x7d83) AM_WRITE(dkong_spritebank_w)                       /* 2 PSL Signal */
766778    AM_RANGE(0x7d84, 0x7d84) AM_WRITE(interrupt_enable_w)
767    AM_RANGE(0x7d85, 0x7d85) AM_DEVWRITE("dma8257", p8257_drq_w)          /* P8257 ==> /DRQ0 /DRQ1 */
779    AM_RANGE(0x7d85, 0x7d85) AM_DEVWRITE("dma8257", p8257_drq_w)                /* P8257 ==> /DRQ0 /DRQ1 */
768780    AM_RANGE(0x7d86, 0x7d87) AM_WRITE(dkong_palettebank_w)
769781ADDRESS_MAP_END
770782
r5891r5892
839851    AM_RANGE(0x0000, 0x0fff) AM_ROM
840852    AM_RANGE(0x1000, 0x13ff) AM_RAM AM_BASE_MEMBER(dkong_state, sprite_ram)
841853                                    AM_SIZE_MEMBER(dkong_state, sprite_ram_size)  /* 0x7000 */
842    AM_RANGE(0x1400, 0x1400) AM_READ_PORT("IN0") AM_DEVWRITE("ls175.3d", latch8_w)
854    AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x007f) AM_READ_PORT("IN0") AM_DEVWRITE("ls175.3d", latch8_w)
843855    AM_RANGE(0x1480, 0x1480) AM_READ_PORT("IN1")
844    AM_RANGE(0x1500, 0x1500) AM_READ(dkong_in2_r)                                 /* IN2 */
856    AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x007f) AM_READ(dkong_in2_r)                                 /* IN2 */
845857    AM_RANGE(0x1500, 0x1507) AM_DEVWRITE("ls259.6h", latch8_bit0_w)       /* Sound signals */
846858    AM_RANGE(0x1580, 0x1580) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w)     /* DSW0 */
847859    AM_RANGE(0x1582, 0x1582) AM_WRITE(dkong_flipscreen_w)
r5891r5892
867879    AM_RANGE(0x00, 0x00) AM_READ(s2650_port0_r)
868880    AM_RANGE(0x01, 0x01) AM_READ(s2650_port1_r)
869881    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
882    AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_WRITE(s2650_fo_w)
870883    AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_WRITE(s2650_data_w)
871884ADDRESS_MAP_END
872885
src/mame/drivers/wiz.c
r5891r5892
662662   DISCRETE_RCDISC      (SHOT_IN1, STINGER_SHOT_EN1, 1.0, 0.2, 1.0)
663663   DISCRETE_RCDISC      (SHOT_IN2, STINGER_SHOT_EN2, 1.0, 0.2, 1.0)
664664   DISCRETE_SWITCH      (SHOT_MOD, 1, STINGER_SHOT_EN1, SHOT_IN2, SHOT_IN1)
665   DISCRETE_MULTIPLY   (SHOT_FRQ, 1, SHOT_MOD, 2000)
666   DISCRETE_MULTIPLY   (SHOT_AMP, 1, SHOT_MOD,  800)
665   DISCRETE_MULTIPLY   (SHOT_FRQ, SHOT_MOD, 2000)
666   DISCRETE_MULTIPLY   (SHOT_AMP, SHOT_MOD,  800)
667667   DISCRETE_SQUAREWAVE   (STINGER_SHOT_OUT, 1, SHOT_FRQ, SHOT_AMP, 50, 0, 0)
668668
669669   //---------------------------------------
r5891r5892
677677   DISCRETE_RCDISC      (BOOM_IN1, STINGER_BOOM_EN1, 1.0, 0.25, 1.0)
678678   DISCRETE_RCDISC      (BOOM_IN2, STINGER_BOOM_EN2, 1.0, 0.25, 1.0)
679679   DISCRETE_SWITCH      (BOOM_MOD, 1, STINGER_BOOM_EN1, BOOM_IN2, BOOM_IN1)
680   DISCRETE_MULTIPLY   (BOOM_AMP, 1, BOOM_MOD, 1500)
680   DISCRETE_MULTIPLY   (BOOM_AMP, BOOM_MOD, 1500)
681681   DISCRETE_LFSR_NOISE   (STINGER_BOOM_OUT, 1, 1, 1800, BOOM_AMP, 0, 0, &stinger_lfsr)
682682
683683   //---------------------------------------
src/mame/drivers/namcos11.c
r5891r5892
16441644GAME( 1995, tekken2,   0,        coh100, tekken,   namcos11, ROT0, "Namco", "Tekken 2 Ver.B (TES3/VER.B)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
16451645GAME( 1995, tekken2a,  tekken2,  coh100, tekken,   namcos11, ROT0, "Namco", "Tekken 2 Ver.B (TES2/VER.B)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
16461646GAME( 1995, tekken2b,  tekken2,  coh100, tekken,   namcos11, ROT0, "Namco", "Tekken 2 (TES2/VER.A)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1647GAME( 1996, souledge,  0,        coh110, souledge, namcos11, ROT0, "Namco", "Soul Edge Ver. II (SO4/VER.C)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
1647GAME( 1996, souledge,  0,        coh110, souledge, namcos11, ROT0, "Namco", "Soul Edge Ver. II (SO4/VER.C)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
16481648GAME( 1995, souledgea, souledge, coh110, souledge, namcos11, ROT0, "Namco", "Soul Edge Ver. II (SO3/VER.C)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
16491649GAME( 1995, souledge1, souledge, coh110, souledge, namcos11, ROT0, "Namco", "Soul Edge (SO3/VER.A)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
16501650GAME( 1995, souledge1j,souledge, coh110, souledge, namcos11, ROT0, "Namco", "Soul Edge (Japan, SO1/VER.A)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
src/mame/drivers/toaplan1.c
r5891r5892
16291629   ROM_LOAD( "b90_08.7",   0x60000, 0x20000, CRC(3404a5e3) SHA1(f717b9e31c2a093dbb060b8ea54a8c3f52688d7a) )
16301630
16311631   ROM_REGION( 0x40, "proms", 0 )      /* nibble bproms, lo/hi order to be determined */
1632   ROM_LOAD( "3w.bpr",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* sprite attribute (flip/position) ?? */
1633   ROM_LOAD( "6b.bpr",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* ??? */
1632   ROM_LOAD( "13.3w",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* N82S123AN bprom - sprite attribute (flip/position) ?? */
1633   ROM_LOAD( "12.6b",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* N82S123AN bprom -  ??? */
16341634ROM_END
16351635
16361636ROM_START( hellfire1 )
r5891r5892
16541654   ROM_LOAD( "b90_08.7",   0x60000, 0x20000, CRC(3404a5e3) SHA1(f717b9e31c2a093dbb060b8ea54a8c3f52688d7a) )
16551655
16561656   ROM_REGION( 0x40, "proms", 0 )      /* nibble bproms, lo/hi order to be determined */
1657   ROM_LOAD( "3w.bpr",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* sprite attribute (flip/position) ?? */
1658   ROM_LOAD( "6b.bpr",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* ??? */
1657   ROM_LOAD( "13.3w",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* N82S123AN bprom - sprite attribute (flip/position) ?? */
1658   ROM_LOAD( "12.6b",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* N82S123AN bprom -  ??? */
16591659ROM_END
16601660
16611661ROM_START( hellfire2 )/* Original version, by rom numbers (IE: 01 & 02) */
r5891r5892
16791679   ROM_LOAD( "b90_08.7",   0x60000, 0x20000, CRC(3404a5e3) SHA1(f717b9e31c2a093dbb060b8ea54a8c3f52688d7a) )
16801680
16811681   ROM_REGION( 0x40, "proms", 0 )      /* nibble bproms, lo/hi order to be determined */
1682   ROM_LOAD( "3w.bpr",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* sprite attribute (flip/position) ?? */
1683   ROM_LOAD( "6b.bpr",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* ??? */
1682   ROM_LOAD( "13.3w",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* N82S123AN bprom - sprite attribute (flip/position) ?? */
1683   ROM_LOAD( "12.6b",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* N82S123AN bprom -  ??? */
16841684ROM_END
16851685
1686ROM_START( hellfire3 )
1687   ROM_REGION( 0x040000, "maincpu", 0 )   /* Main 68K code */
1688   ROM_LOAD16_BYTE( "b90_01.10m",  0x000000, 0x20000, CRC(034966d3) SHA1(f987d8e7ebe6a546be621fe4d5a59de1284c4ebb) ) /* Same labels as hellfire2 but different data */
1689   ROM_LOAD16_BYTE( "b90_02.9m",   0x000001, 0x20000, CRC(06dd24c7) SHA1(a990de7ffac6bd0dd219c7bf9f773ccb41395be6) )
1690
1691   ROM_REGION( 0x10000, "audiocpu", 0 )   /* Sound Z80 code */
1692   ROM_LOAD( "b90_03.2",   0x0000, 0x8000, CRC(4058fa67) SHA1(155c364273c270cd74955f447efc804bb4c9b560) )
1693
1694   ROM_REGION( 0x80000, "gfx1", 0 )
1695   ROM_LOAD( "b90_04.3",   0x00000, 0x20000, CRC(ea6150fc) SHA1(1116947d10ce14fbc6a3b86368fc2024c6f51803) )
1696   ROM_LOAD( "b90_05.4",   0x20000, 0x20000, CRC(bb52c507) SHA1(b0b1821476647f10c7023f92a66a7f54b92f50c3) )
1697   ROM_LOAD( "b90_06.5",   0x40000, 0x20000, CRC(cf5b0252) SHA1(e2102967af61afb11d2290a40d13d2faf9ef1e12) )
1698   ROM_LOAD( "b90_07.6",   0x60000, 0x20000, CRC(b98af263) SHA1(54d636a50a41dbb58b54c22dfab3eabfdb452575) )
1699
1700   ROM_REGION( 0x80000, "gfx2", 0 )
1701   ROM_LOAD( "b90_11.10",  0x00000, 0x20000, CRC(c33e543c) SHA1(b85cba30cc651f820aeedd41e04584df92078ed9) )
1702   ROM_LOAD( "b90_10.9",   0x20000, 0x20000, CRC(35fd1092) SHA1(5e136a35eea45034ccd4aea52cc0ffeec944e27e) )
1703   ROM_LOAD( "b90_09.8",   0x40000, 0x20000, CRC(cf01009e) SHA1(e260c479fa97f23a65c220e5071aaf2dc2baf46d) )
1704   ROM_LOAD( "b90_08.7",   0x60000, 0x20000, CRC(3404a5e3) SHA1(f717b9e31c2a093dbb060b8ea54a8c3f52688d7a) )
1705
1706   ROM_REGION( 0x40, "proms", 0 )      /* nibble bproms, lo/hi order to be determined */
1707   ROM_LOAD( "13.3w",     0x00, 0x20, CRC(bc88cced) SHA1(5055362710c0f58823c05fb4c0e0eec638b91e3d) )   /* N82S123AN bprom - sprite attribute (flip/position) ?? */
1708   ROM_LOAD( "12.6b",     0x20, 0x20, CRC(a1e17492) SHA1(9ddec4c97f2d541f69f3c32c47aaa21fd9699ae2) )   /* N82S123AN bprom -  ??? */
1709ROM_END
1710
16861711ROM_START( zerowing )
16871712   ROM_REGION( 0x080000, "maincpu", 0 )   /* Main 68K code */
16881713   ROM_LOAD16_BYTE( "o15-11.rom",  0x000000, 0x08000, CRC(6ff2b9a0) SHA1(c9f2a631f185689dfc42a451d85fac23c2f4b64b) )
r5891r5892
22422267GAME( 1989, hellfire, 0,        hellfire, hellfire, toaplan1, ROT0,   "Toaplan (Taito license)", "Hellfire (2P Ver.)", 0 )
22432268GAME( 1989, hellfire1,hellfire, hellfire, hellfir1, toaplan1, ROT0,   "Toaplan (Taito license)", "Hellfire (1P Ver.)", 0 )
22442269GAME( 1989, hellfire2,hellfire, hellfire, hellfire, toaplan1, ROT0,   "Toaplan (Taito license)", "Hellfire (2P Ver., first edition)", 0 )
2270GAME( 1989, hellfire3,hellfire, hellfire, hellfire, toaplan1, ROT0,   "Toaplan (Taito license)", "Hellfire (1P Ver., alt)", 0 )
22452271GAME( 1989, zerowing, 0,        zerowing, zerowing, toaplan1, ROT0,   "Toaplan", "Zero Wing", 0 )
22462272GAME( 1989, zerowing2,zerowing, zerowing, zerowng2, toaplan1, ROT0,   "[Toaplan] Williams Electronics Games, Inc", "Zero Wing (2 player simultaneous ver.)", 0 )
22472273GAME( 1990, demonwld, 0,        demonwld, demonwld, demonwld, ROT0,   "Toaplan", "Demon's World / Horror Story (set 1)", 0 )
src/mame/drivers/spiders.c
r5891r5892
820820 *************************************/
821821
822822/* this is a newer version with just one bug fix */
823GAME( 1981, spiders,  0,       spiders, spiders, 0, ROT270, "Sigma Enterprises Inc.", "Spiders (set 1)", GAME_SUPPORTS_SAVE)
824GAME( 1981, spiders2, spiders, spiders, spiders, 0, ROT270, "Sigma Enterprises Inc.", "Spiders (set 2)", GAME_SUPPORTS_SAVE)
825GAME( 1981, spinner,  spiders, spiders, spiders, 0, ROT270, "bootleg",              "Spinner", GAME_SUPPORTS_SAVE)
823GAME( 1981, spiders,  0,       spiders, spiders, 0, ROT270, "Sigma Enterprises Inc.", "Spiders (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE)
824GAME( 1981, spiders2, spiders, spiders, spiders, 0, ROT270, "Sigma Enterprises Inc.", "Spiders (set 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE)
825GAME( 1981, spinner,  spiders, spiders, spiders, 0, ROT270, "bootleg",              "Spinner", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE)
src/mame/drivers/namcos22.c
r5891r5892
20042004   16*16*8
20052005};
20062006
2007#define XOR(a) WORD2_XOR_BE(a)
2008
20072009/* text layer uses a set of 16x16x8bpp tiles defined in RAM */
20082010const gfx_layout namcos22_cg_layout =
20092011{
r5891r5892
20112013   0x400, /* 0x3c0 */
20122014   4,
20132015   { 0,1,2,3 },
2014#ifdef LSB_FIRST
2015   { 4*6,4*7,4*4,4*5,4*2,4*3,4*0,4*1,4*14,4*15,4*12,4*13,4*10,4*11,4*8,4*9 },
2016#else
2017   { 4*0,4*1,4*2,4*3,4*4,4*5,4*6,4*7,4*8,4*9,4*10,4*11,4*12,4*13,4*14,4*15 },
2018#endif
2016   { XOR(0)*4,  XOR(1)*4,  XOR(2)*4,  XOR(3)*4,  XOR(4)*4,  XOR(5)*4,  XOR(6)*4,  XOR(7)*4,
2017     XOR(8)*4,  XOR(9)*4, XOR(10)*4, XOR(11)*4, XOR(12)*4, XOR(13)*4, XOR(14)*4, XOR(15)*4 },
20192018   { 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7,64*8,64*9,64*10,64*11,64*12,64*13,64*14,64*15 },
20202019   64*16
20212020}; /* cg_layout */
src/mame/drivers/atarisy1.c
r5891r5892
423423
424424static READ8_DEVICE_HANDLER( via_pb_r )
425425{
426   return (!tms5220_ready_r(device) << 2) | (!tms5220_int_r(device) << 3);
426   return (tms5220_readyq_r(device) << 2) | (tms5220_intq_r(device) << 3);
427427}
428428
429429
src/mame/drivers/hikaru.c
r5891r5892
481481
482482   /* ROM board using 128M TSOP48 MASKROMs */
483483   ROM_REGION( 0x10000000, "user2", 0)
484   ROM_LOAD("mpr-23549.ic37" , 0x0000000, 0x1000000, NO_DUMP )
485   ROM_LOAD("mpr-23553.ic38" , 0x1000000, 0x1000000, NO_DUMP )
486   ROM_LOAD("mpr-23550.ic41" , 0x2000000, 0x1000000, NO_DUMP )
487   ROM_LOAD("mpr-23554.ic42" , 0x3000000, 0x1000000, NO_DUMP )
488   ROM_LOAD("mpr-23551.ic45" , 0x4000000, 0x1000000, NO_DUMP )
489   ROM_LOAD("mpr-23555.ic46" , 0x5000000, 0x1000000, NO_DUMP )
490   ROM_LOAD("mpr-23552.ic49" , 0x6000000, 0x1000000, NO_DUMP )
491   ROM_LOAD("mpr-23556.ic50" , 0x7000000, 0x1000000, NO_DUMP )
492   ROM_LOAD("mpr-23557.ic53" , 0x8000000, 0x1000000, NO_DUMP )
493   ROM_LOAD("mpr-23561.ic54" , 0x9000000, 0x1000000, NO_DUMP )
494   ROM_LOAD("mpr-23558.ic57" , 0xa000000, 0x1000000, NO_DUMP )
495   ROM_LOAD("mpr-23562.ic58" , 0xb000000, 0x1000000, NO_DUMP )
496   ROM_LOAD("mpr-23559.ic61" , 0xc000000, 0x1000000, NO_DUMP )
497   ROM_LOAD("mpr-23563.ic62" , 0xd000000, 0x1000000, NO_DUMP )
498   ROM_LOAD("mpr-23560.ic65" , 0xe000000, 0x1000000, NO_DUMP )
499   ROM_LOAD("mpr-23564.ic66" , 0xf000000, 0x1000000, NO_DUMP )
484        ROM_LOAD( "mpr-23549.ic37", 0x0000000, 0x1000000, CRC(ed764200) SHA1(ad840a40347345f72a443f284b1bb0ae2b37f7ac) )
485        ROM_LOAD( "mpr-23553.ic38", 0x1000000, 0x1000000, CRC(5e70ae78) SHA1(2ae6bdb5aa1434bb60b2b9bca7af12d6476cd35f) )
486        ROM_LOAD( "mpr-23550.ic41", 0x2000000, 0x1000000, CRC(841b4d3b) SHA1(d442078b6b4926e6e32b911d88a4408d20a8f0df) )
487        ROM_LOAD( "mpr-23554.ic42", 0x3000000, 0x1000000, CRC(5cce99de) SHA1(c39330e4bcfb4cec8b0b59ab184fad5093188765) )
488        ROM_LOAD( "mpr-23551.ic45", 0x4000000, 0x1000000, CRC(71f61d04) SHA1(6f24f82ddc5aaf9bbb41b8baddbcb855f1d37a16) )
489        ROM_LOAD( "mpr-23555.ic46", 0x5000000, 0x1000000, CRC(582e5453) SHA1(cf9fb8b52a169446b98630d67cdce745de917edc) )
490        ROM_LOAD( "mpr-23552.ic49", 0x6000000, 0x1000000, CRC(32487181) SHA1(a885747428c280f77dd861bf802d953da133ef59) )
491        ROM_LOAD( "mpr-23556.ic50", 0x7000000, 0x1000000, CRC(45002955) SHA1(85a27c86692ca79fc4e51a64af63a5e970b86cfa) )
492        ROM_LOAD( "mpr-23557.ic53", 0x8000000, 0x1000000, CRC(c20dff1b) SHA1(d90d3d85f4fddf39c109502c8f9e9f25a7fc43d1) )
493        ROM_LOAD( "mpr-23561.ic54", 0x9000000, 0x1000000, CRC(01237844) SHA1(7a8c6bfdea1d4db5e9f6850fdf1a03d703df3958) )
494        ROM_LOAD( "mpr-23558.ic57", 0xa000000, 0x1000000, CRC(e93cc8d7) SHA1(05fc23b8382daaca7ccd1ca80e7c5e93cbf2b6b1) )
495        ROM_LOAD( "mpr-23562.ic58", 0xb000000, 0x1000000, CRC(85e0816c) SHA1(28106404d1eef4c85dd425d3535a53c5d71e47a0) )
496        ROM_LOAD( "mpr-23559.ic61", 0xc000000, 0x1000000, CRC(1a7f2ba0) SHA1(e2a20138f21297f5313f5368ef9992da8fa23937) )
497        ROM_LOAD( "mpr-23563.ic62", 0xd000000, 0x1000000, CRC(e3dc328b) SHA1(d04ccc4025442c98b96f84c1b300671f3687ec6c) )
498        ROM_LOAD( "mpr-23560.ic65", 0xe000000, 0x1000000, CRC(24bb7072) SHA1(dad5135c89d292e4a1f96bd0ad28be6a17154be0) )
499        ROM_LOAD( "mpr-23564.ic66", 0xf000000, 0x1000000, CRC(255724b6) SHA1(1b382fad165831de3f2e39352c031146759dfc69) )
500500ROM_END
501501
502502ROM_START( podrace )
src/mame/drivers/cbuster.c
r5891r5892
491491
492492   /* Main cpu decrypt */
493493   for (i=0x00000; i<0x80000; i+=2) {
494#ifdef LSB_FIRST
495      RAM[i+1]=(RAM[i+1] & 0xcf) | ((RAM[i+1] & 0x10) << 1) | ((RAM[i+1] & 0x20) >> 1);
496      RAM[i+1]=(RAM[i+1] & 0x5f) | ((RAM[i+1] & 0x20) << 2) | ((RAM[i+1] & 0x80) >> 2);
494      int h = i+NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = i+NATIVE_ENDIAN_VALUE_LE_BE(0,1);
497495
498      RAM[i]=(RAM[i] & 0xbd) | ((RAM[i] & 0x2) << 5) | ((RAM[i] & 0x40) >> 5);
499      RAM[i]=(RAM[i] & 0xf5) | ((RAM[i] & 0x2) << 2) | ((RAM[i] & 0x8) >> 2);
500#else
501      RAM[i]=(RAM[i] & 0xcf) | ((RAM[i] & 0x10) << 1) | ((RAM[i] & 0x20) >> 1);
502      RAM[i]=(RAM[i] & 0x5f) | ((RAM[i] & 0x20) << 2) | ((RAM[i] & 0x80) >> 2);
496      RAM[h]=(RAM[h] & 0xcf) | ((RAM[h] & 0x10) << 1) | ((RAM[h] & 0x20) >> 1);
497      RAM[h]=(RAM[h] & 0x5f) | ((RAM[h] & 0x20) << 2) | ((RAM[h] & 0x80) >> 2);
503498
504      RAM[i+1]=(RAM[i+1] & 0xbd) | ((RAM[i+1] & 0x2) << 5) | ((RAM[i+1] & 0x40) >> 5);
505      RAM[i+1]=(RAM[i+1] & 0xf5) | ((RAM[i+1] & 0x2) << 2) | ((RAM[i+1] & 0x8) >> 2);
506#endif
499      RAM[l]=(RAM[l] & 0xbd) | ((RAM[l] & 0x2) << 5) | ((RAM[l] & 0x40) >> 5);
500      RAM[l]=(RAM[l] & 0xf5) | ((RAM[l] & 0x2) << 2) | ((RAM[l] & 0x8) >> 2);
507501   }
508502
509503   /* Rearrange the 'extra' sprite bank to be in the same format as main sprites */
src/mame/drivers/cvs.c
r5891r5892
8080Hardware Info
8181 Malcolm & Darren
8282
83Additional work
84    2009 Couriersud
85
86Todo & FIXME:
87
88- the board most probably has discrete circuits. The 393Hz tone used
89  for shots (superbike) and collisions (8ball) is just a guess.
90
8391***************************************************************************/
8492
8593#include "driver.h"
r5891r5892
94102#define CVS_SHOW_ALL_INPUTS   0
95103
96104
97#define VERBOSE 1
105#define VERBOSE
98106#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
99107
100108
r5891r5892
113121UINT8 *cvs_s2636_0_ram;
114122UINT8 *cvs_s2636_1_ram;
115123UINT8 *cvs_s2636_2_ram;
124static UINT8 *cvs_fo_state;
116125
117126static emu_timer *cvs_393hz_timer;
118127static UINT8 cvs_393hz_clock;
119128static UINT8 *cvs_4_bit_dac_data;
120129static UINT8 *cvs_tms5110_ctl_data;
130static UINT8 *dac3_state;
121131
122132static UINT8 character_banking_mode;
123133static UINT16 character_ram_page_start;
r5891r5892
125135
126136
127137
138
128139UINT8 cvs_get_character_banking_mode(void)
129140{
130141   return character_banking_mode;
r5891r5892
140151
141152READ8_HANDLER( cvs_video_or_color_ram_r )
142153{
143   if (cpu_get_reg(space->cpu, S2650_FO))
154   if (*cvs_fo_state)
144155      return cvs_video_ram[offset];
145156   else
146157      return cvs_color_ram[offset];
r5891r5892
148159
149160WRITE8_HANDLER( cvs_video_or_color_ram_w )
150161{
151   if (cpu_get_reg(space->cpu, S2650_FO))
162   if (*cvs_fo_state)
152163      cvs_video_ram[offset] = data;
153164   else
154165      cvs_color_ram[offset] = data;
r5891r5892
157168
158169READ8_HANDLER( cvs_bullet_ram_or_palette_r )
159170{
160   if (cpu_get_reg(space->cpu, S2650_FO))
171   if (*cvs_fo_state)
161172      return cvs_palette_ram[offset & 0x0f];
162173   else
163174      return cvs_bullet_ram[offset];
r5891r5892
165176
166177WRITE8_HANDLER( cvs_bullet_ram_or_palette_w )
167178{
168   if (cpu_get_reg(space->cpu, S2650_FO))
179   if (*cvs_fo_state)
169180      cvs_palette_ram[offset & 0x0f] = data;
170181   else
171182      cvs_bullet_ram[offset] = data;
r5891r5892
174185
175186READ8_HANDLER( cvs_s2636_0_or_character_ram_r )
176187{
177   if (cpu_get_reg(space->cpu, S2650_FO))
188   if (*cvs_fo_state)
178189      return cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset];
179190   else
180191      return cvs_s2636_0_ram[offset];
r5891r5892
182193
183194WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w )
184195{
185   if (cpu_get_reg(space->cpu, S2650_FO))
196   if (*cvs_fo_state)
186197   {
187198      offset |= (0 * 0x800) | 0x400 | character_ram_page_start;
188199      cvs_character_ram[offset] = data;
r5891r5892
195206
196207READ8_HANDLER( cvs_s2636_1_or_character_ram_r )
197208{
198   if (cpu_get_reg(space->cpu, S2650_FO))
209   if (*cvs_fo_state)
199210      return cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset];
200211   else
201212      return cvs_s2636_1_ram[offset];
r5891r5892
203214
204215WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w )
205216{
206   if (cpu_get_reg(space->cpu, S2650_FO))
217   if (*cvs_fo_state)
207218   {
208219      offset |= (1 * 0x800) | 0x400 | character_ram_page_start;
209220      cvs_character_ram[offset] = data;
r5891r5892
216227
217228READ8_HANDLER( cvs_s2636_2_or_character_ram_r )
218229{
219   if (cpu_get_reg(space->cpu, S2650_FO))
230   if (*cvs_fo_state)
220231      return cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset];
221232   else
222233      return cvs_s2636_2_ram[offset];
r5891r5892
224235
225236WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w )
226237{
227   if (cpu_get_reg(space->cpu, S2650_FO))
238   if (*cvs_fo_state)
228239   {
229240      offset |= (2 * 0x800) | 0x400 | character_ram_page_start;
230241      cvs_character_ram[offset] = data;
r5891r5892
251262}
252263
253264
254static void cvs_dac_cpu_interrupt(running_machine *machine)
265static void cvs_slave_cpu_interrupt(running_machine *machine, const char *cpu, int state)
255266{
256   cpu_set_input_line_vector(cputag_get_cpu(machine, "audiocpu"), 0, 0x03);
257   cputag_set_input_line(machine, "audiocpu", 0, HOLD_LINE);
267   cpu_set_input_line_vector(cputag_get_cpu(machine, cpu), 0, 0x03);
268   //cputag_set_input_line(machine, cpu, 0, state ? ASSERT_LINE : CLEAR_LINE);
269   cputag_set_input_line(machine, cpu, 0, state ? HOLD_LINE : CLEAR_LINE);
258270}
259271
260272
r5891r5892
295307 *  Timing
296308 *
297309 *************************************/
298
310#if 0
299311static READ8_HANDLER( cvs_393hz_clock_r )
300312{
301313     return cvs_393hz_clock ? 0x80 : 0;
302314}
315#endif
303316
317static READ8_DEVICE_HANDLER( tms_clock_r )
318{
319     return tms5110_romclk_r(device, 0) ? 0x80 : 0;
320}
304321
305322static TIMER_CALLBACK( cvs_393hz_timer_cb )
306323{
307324   cvs_393hz_clock = !cvs_393hz_clock;
325   if (dac3_state[2])
326      dac_w(devtag_get_device(machine, "dac3"), 0, cvs_393hz_clock * 0xff);
308327}
309328
310329
311330static void start_393hz_timer(running_machine *machine)
312331{
313332   cvs_393hz_timer = timer_alloc(machine, cvs_393hz_timer_cb, NULL);
314   timer_adjust_periodic(cvs_393hz_timer, ATTOTIME_IN_HZ(2*393), 0, ATTOTIME_IN_HZ(2*393));
333   timer_adjust_periodic(cvs_393hz_timer, ATTOTIME_IN_HZ(30*393), 0, ATTOTIME_IN_HZ(30*393));
315334}
316335
317336
r5891r5892
325344static WRITE8_DEVICE_HANDLER( cvs_4_bit_dac_data_w )
326345{
327346   UINT8 dac_value;
347   static int old_data[4] = {0,0,0,0};
328348
349   if (data != old_data[offset])
350   {
351      LOG(("4BIT: %02x %02x\n", offset, data));
352      old_data[offset] = data;
353   }
329354   cvs_4_bit_dac_data[offset] = data >> 7;
330355
331356   /* merge into D0-D3 */
r5891r5892
338363   dac_data_w(device, (dac_value << 4) | dac_value);
339364}
340365
366static WRITE8_DEVICE_HANDLER( cvs_unknown_w )
367{
368   /* offset 2 is used in 8ball
369     * offset 0 is used in spacefrt
370     * offset 3 is used in darkwar
371     *
372     * offset 1 is not used (no trace in disassembly
373     */
341374
375   if (data != dac3_state[offset])
376   {
377      if (offset != 2)
378         popmessage("Unknown: %02x %02x\n", offset, data);
379      dac3_state[offset] = data;
380   }
381}
342382
383
343384/*************************************
344385 *
345386 *  Speech hardware
346387 *
347388 *************************************/
348389
349/* temporary code begin */
350static void speech_execute_command(const device_config *tms, UINT8 command)
351{
352   /* reset */
353   if (command == 0x3f)
354   {
355      tms5110_ctl_w(tms, 0, TMS5110_CMD_RESET);
356390
357      tms5110_pdc_w(tms, 0,0);
358      tms5110_pdc_w(tms, 0,1);
359      tms5110_pdc_w(tms, 0,0);
360
361      tms5110_pdc_w(tms, 0,0);
362      tms5110_pdc_w(tms, 0,1);
363      tms5110_pdc_w(tms, 0,0);
364
365      tms5110_pdc_w(tms, 0,0);
366      tms5110_pdc_w(tms, 0,1);
367      tms5110_pdc_w(tms, 0,0);
368
369      speech_rom_bit_address = 0;
370   }
371   /* start */
372   else
373   {
374      tms5110_ctl_w(tms, 0, TMS5110_CMD_SPEAK);
375
376      tms5110_pdc_w(tms, 0, 0);
377      tms5110_pdc_w(tms, 0, 1);
378      tms5110_pdc_w(tms, 0, 0);
379
380      speech_rom_bit_address = command * 0x80 * 8;
381   }
382}
383/* temporary code end */
384
385
386391static WRITE8_HANDLER( cvs_speech_rom_address_lo_w )
387392{
388393   /* assuming that d0-d2 are cleared here */
389394   speech_rom_bit_address = (speech_rom_bit_address & 0xf800) | (data << 3);
390   LOG(("%04x : CVS: Speech Address = %04x\n", cpu_get_pc(space->cpu), speech_rom_bit_address >> 3));
395   LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", cpu_get_pc(space->cpu), data, speech_rom_bit_address >> 3));
391396}
392397
393398static WRITE8_HANDLER( cvs_speech_rom_address_hi_w )
394399{
395400   speech_rom_bit_address = (speech_rom_bit_address & 0x07ff) | (data << 11);
401   LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", cpu_get_pc(space->cpu), data, speech_rom_bit_address >> 3));
396402}
397403
398404
399static void cvs_set_speech_command_w(const address_space *space, UINT8 data)
400{
401   soundlatch2_w(space, 0, data & 0x7f);
402   if (~data & 0x40) LOG(("%04x : CVS: Speech Command W = %04x\n", cpu_get_pc(space->cpu), data & 0x7f));
403}
404
405
406405static READ8_HANDLER( cvs_speech_command_r )
407406{
408   /* bit 7 is TMS status (active LO) */
409   return (~tms5110_status_r(devtag_get_device(space->machine, "tms"), 0) << 7) | soundlatch2_r(space, 0);
407   /* FIXME: this was by observation on board ???
408     *          -bit 7 is TMS status (active LO) */
409   return ((tms5110_ctl_r(devtag_get_device(space->machine, "tms"), 0) ^ 1) << 7)
410      | (soundlatch_r(space, 0) & 0x7f);
410411}
411412
412413
413414static WRITE8_DEVICE_HANDLER( cvs_tms5110_ctl_w )
414415{
415416   UINT8 ctl;
416
417   /*
418     * offset 0: CS ?
419     */
417420   cvs_tms5110_ctl_data[offset] = (~data >> 7) & 0x01;
418421
419422   ctl = 0 |                        /* CTL1 */
420423        (cvs_tms5110_ctl_data[1] << 1) |   /* CTL2 */
421        0 |                        /* CTL4 */
422        (cvs_tms5110_ctl_data[0] << 3);   /* CTL8 */
424        (cvs_tms5110_ctl_data[2] << 2) |   /* CTL4 */
425        (cvs_tms5110_ctl_data[1] << 3);   /* CTL8 */
423426
424   //tms5110_ctl_w(device, ctl);
427   LOG(("CVS: Speech CTL = %04x %02x %02x\n",  ctl, offset, data));
428   tms5110_ctl_w(device, 0, ctl);
425429}
426430
427431
428432static WRITE8_DEVICE_HANDLER( cvs_tms5110_pdc_w )
429433{
430   //tms5110_pdc_w(device, ~data >> 7);
434   UINT8 out = ((~data) >> 7) & 1;
435   LOG(("CVS: Speech PDC = %02x %02x\n", offset, out));
436   tms5110_pdc_w(device, 0, out);
431437}
432438
433439
r5891r5892
464470
465471static WRITE8_HANDLER( audio_command_w )
466472{
473   LOG(("data %02x\n", data));
467474    /* cause interrupt on audio CPU if bit 7 set */
468   if (data & 0x80)
469   {
470         soundlatch_w(space, 0, data);
471      cvs_dac_cpu_interrupt(space->machine);
472
473      LOG(("%04x : CVS: Audio command = %02x\n", cpu_get_pc(space->cpu), data));
474   }
475
476   cvs_set_speech_command_w(space, data);
477
478   /* temporary code begin */
479   if ((data & 0x40) == 0)
480      speech_execute_command(devtag_get_device(space->machine, "tms"), data & 0x03f);
481   /* temporary code end */
475   soundlatch_w(space, 0, data);
476   cvs_slave_cpu_interrupt(space->machine, "audiocpu", data & 0x80 ? 1 : 0);
482477}
483478
484479
r5891r5892
541536   AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(cvs_collision_clear, cvs_video_fx_w)
542537   AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE(cvs_collision_r, audio_command_w)
543538    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
539    AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE(&cvs_fo_state)
544540ADDRESS_MAP_END
545541
546542
r5891r5892
558554    AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
559555    AM_RANGE(0x1840, 0x1840) AM_DEVWRITE("dac1", dac_w)
560556    AM_RANGE(0x1880, 0x1883) AM_DEVWRITE("dac2", cvs_4_bit_dac_data_w) AM_BASE(&cvs_4_bit_dac_data)
561    AM_RANGE(0x1884, 0x1887) AM_WRITENOP      /* not connected to anything */
557    AM_RANGE(0x1884, 0x1887) AM_DEVWRITE("dac3", cvs_unknown_w)   AM_BASE(&dac3_state)   /* ???? not connected to anything */
562558ADDRESS_MAP_END
563559
564560
565561static ADDRESS_MAP_START( cvs_dac_cpu_io_map, ADDRESS_SPACE_IO, 8 )
566    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cvs_393hz_clock_r)
562   /* doesn't look like it is used at all */
563    //AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cvs_393hz_clock_r)
567564ADDRESS_MAP_END
568565
569566
r5891r5892
580577   AM_RANGE(0x1d00, 0x1d00) AM_WRITE(cvs_speech_rom_address_lo_w)
581578   AM_RANGE(0x1d40, 0x1d40) AM_WRITE(cvs_speech_rom_address_hi_w)
582579    AM_RANGE(0x1d80, 0x1d80) AM_READ(cvs_speech_command_r)
583   AM_RANGE(0x1ddd, 0x1dde) AM_DEVWRITE("tms", cvs_tms5110_ctl_w) AM_BASE(&cvs_tms5110_ctl_data)
580   AM_RANGE(0x1ddc, 0x1dde) AM_DEVWRITE("tms", cvs_tms5110_ctl_w) AM_BASE(&cvs_tms5110_ctl_data)
584581   AM_RANGE(0x1ddf, 0x1ddf) AM_DEVWRITE("tms", cvs_tms5110_pdc_w)
585582ADDRESS_MAP_END
586583
587584
588585static ADDRESS_MAP_START( cvs_speech_cpu_io_map, ADDRESS_SPACE_IO, 8 )
589    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cvs_393hz_clock_r)
586/* romclk is much more probable, 393 Hz results in timing issues */
587//  AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cvs_393hz_clock_r)
588    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_DEVREAD("tms", tms_clock_r)
590589ADDRESS_MAP_END
591590
592591
593
594592/*************************************
595593 *
596594 *  Standard CVS port definitions
r5891r5892
10511049   MDRV_SOUND_ADD("dac1", DAC, 0)
10521050   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
10531051
1052   //MDRV_SOUND_ADD("dac1a", DAC, 0)
1053   //MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1054
10541055   MDRV_SOUND_ADD("dac2", DAC, 0)
10551056   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
10561057
1058   MDRV_SOUND_ADD("dac3", DAC, 0)
1059   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1060
10571061   MDRV_SOUND_ADD("tms", TMS5100, 640000)
10581062   MDRV_SOUND_CONFIG(tms5100_interface)
10591063   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
r5891r5892
16411645 *
16421646 *************************************/
16431647
1644GAME( 1981, cosmos,   0,        cvs,     cosmos,   0,        ROT90, "Century Electronics", "Cosmos", GAME_NO_COCKTAIL )
1645GAME( 1981, darkwar,  0,        cvs,     darkwar,  0,        ROT90, "Century Electronics", "Dark Warrior", GAME_NO_COCKTAIL )
1646GAME( 1981, spacefrt, 0,        cvs,     spacefrt, 0,        ROT90, "Century Electronics", "Space Fortress (CVS)", GAME_NO_COCKTAIL )
1647GAME( 1982, 8ball,    0,        cvs,     8ball,    0,        ROT90, "Century Electronics", "Video Eight Ball", GAME_NO_COCKTAIL )
1648GAME( 1982, 8ball1,   8ball,    cvs,     8ball,    0,        ROT90, "Century Electronics", "Video Eight Ball (Rev.1)", GAME_NO_COCKTAIL )
1649GAME( 1982, logger,   0,        cvs,     logger,   0,        ROT90, "Century Electronics", "Logger", GAME_NO_COCKTAIL )
1650GAME( 1982, dazzler,  0,        cvs,     dazzler,  0,        ROT90, "Century Electronics", "Dazzler", GAME_NO_COCKTAIL )
1651GAME( 1982, wallst,   0,        cvs,     wallst,   0,        ROT90, "Century Electronics", "Wall Street", GAME_NO_COCKTAIL )
1652GAME( 1982, radarzon, 0,        cvs,     radarzon, 0,        ROT90, "Century Electronics", "Radar Zone", GAME_NO_COCKTAIL )
1653GAME( 1982, radarzon1,radarzon, cvs,     radarzon, 0,        ROT90, "Century Electronics", "Radar Zone (Rev.1)", GAME_NO_COCKTAIL )
1654GAME( 1982, radarzont,radarzon, cvs,     radarzon, 0,        ROT90, "Century Electronics (Tuni Electro Service Inc)", "Radar Zone (Tuni)", GAME_NO_COCKTAIL )
1655GAME( 1982, outline,  radarzon, cvs,     radarzon, 0,        ROT90, "Century Electronics", "Outline", GAME_NO_COCKTAIL )
1656GAME( 1982, goldbug,  0,        cvs,     goldbug,  0,        ROT90, "Century Electronics", "Gold Bug", GAME_NO_COCKTAIL )
1657GAME( 1982, diggerc,  0,        cvs,     diggerc,  0,        ROT90, "Century Electronics", "Digger (CVS)", GAME_NO_COCKTAIL )
1658GAME( 1983, heartatk, 0,        cvs,     heartatk, 0,        ROT90, "Century Electronics", "Heart Attack", GAME_NO_COCKTAIL )
1659GAME( 1983, hunchbak, 0,        cvs,     hunchbak, 0,        ROT90, "Century Electronics", "Hunchback (set 1)", GAME_NO_COCKTAIL )
1660GAME( 1983, hunchbaka,hunchbak, cvs,     hunchbak, hunchbka, ROT90, "Century Electronics", "Hunchback (set 2)", GAME_NO_COCKTAIL )
1661GAME( 1983, superbik, 0,        cvs,     superbik, superbik, ROT90, "Century Electronics", "Superbike", GAME_NO_COCKTAIL )
1662GAME( 1983, raiders,  0,        cvs,     raiders,  raiders,  ROT90, "Century Electronics", "Raiders", GAME_NO_COCKTAIL )
1663GAME( 1983, hero,     0,        cvs,     hero,     hero,     ROT90, "Seatongrove Ltd",     "Hero", GAME_NO_COCKTAIL )
1664GAME( 1984, huncholy, 0,        cvs,     huncholy, huncholy, ROT90, "Seatongrove Ltd",     "Hunchback Olympic", GAME_NO_COCKTAIL )
1648GAME( 1981, cosmos,   0,        cvs,     cosmos,   0,        ROT90, "Century Electronics", "Cosmos", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND )
1649GAME( 1981, darkwar,  0,        cvs,     darkwar,  0,        ROT90, "Century Electronics", "Dark Warrior", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1650GAME( 1981, spacefrt, 0,        cvs,     spacefrt, 0,        ROT90, "Century Electronics", "Space Fortress (CVS)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND )
1651GAME( 1982, 8ball,    0,        cvs,     8ball,    0,        ROT90, "Century Electronics", "Video Eight Ball", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1652GAME( 1982, 8ball1,   8ball,    cvs,     8ball,    0,        ROT90, "Century Electronics", "Video Eight Ball (Rev.1)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1653GAME( 1982, logger,   0,        cvs,     logger,   0,        ROT90, "Century Electronics", "Logger", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1654GAME( 1982, dazzler,  0,        cvs,     dazzler,  0,        ROT90, "Century Electronics", "Dazzler", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1655GAME( 1982, wallst,   0,        cvs,     wallst,   0,        ROT90, "Century Electronics", "Wall Street", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1656GAME( 1982, radarzon, 0,        cvs,     radarzon, 0,        ROT90, "Century Electronics", "Radar Zone", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1657GAME( 1982, radarzon1,radarzon, cvs,     radarzon, 0,        ROT90, "Century Electronics", "Radar Zone (Rev.1)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1658GAME( 1982, radarzont,radarzon, cvs,     radarzon, 0,        ROT90, "Century Electronics (Tuni Electro Service Inc)", "Radar Zone (Tuni)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1659GAME( 1982, outline,  radarzon, cvs,     radarzon, 0,        ROT90, "Century Electronics", "Outline", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1660GAME( 1982, goldbug,  0,        cvs,     goldbug,  0,        ROT90, "Century Electronics", "Gold Bug", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1661GAME( 1982, diggerc,  0,        cvs,     diggerc,  0,        ROT90, "Century Electronics", "Digger (CVS)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1662GAME( 1983, heartatk, 0,        cvs,     heartatk, 0,        ROT90, "Century Electronics", "Heart Attack", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1663GAME( 1983, hunchbak, 0,        cvs,     hunchbak, 0,        ROT90, "Century Electronics", "Hunchback (set 1)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1664GAME( 1983, hunchbaka,hunchbak, cvs,     hunchbak, hunchbka, ROT90, "Century Electronics", "Hunchback (set 2)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1665GAME( 1983, superbik, 0,        cvs,     superbik, superbik, ROT90, "Century Electronics", "Superbike", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1666GAME( 1983, raiders,  0,        cvs,     raiders,  raiders,  ROT90, "Century Electronics", "Raiders", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1667GAME( 1983, hero,     0,        cvs,     hero,     hero,     ROT90, "Seatongrove Ltd",     "Hero", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
1668GAME( 1984, huncholy, 0,        cvs,     huncholy, huncholy, ROT90, "Seatongrove Ltd",     "Hunchback Olympic", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND)
src/mame/drivers/esripsys.c
r5891r5892
558558      UINT8 status = tms5220_status_r(tms, 0);
559559
560560      status = ((status & 0x80) >> 5) | ((status & 0x40) >> 5) | ((status & 0x20) >> 5);
561      return (!tms5220_ready_r(tms) << 7) | (!tms5220_int_r(tms) << 6) | status;
561      return (tms5220_readyq_r(tms) << 7) | (tms5220_intq_r(tms) << 6) | status;
562562   }
563563
564564   return 0xff;
src/mame/drivers/f1gp.c
r5891r5892
367367   64*16
368368};
369369
370#define XOR(a) WORD_XOR_BE(a)
371
370372static const gfx_layout tilelayout2 =
371373{
372374   16,16,
373375   0x800,
374376   4,
375377   { 0, 1, 2, 3 },
376#ifdef LSB_FIRST
377   { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4,
378         10*4, 11*4, 8*4, 9*4, 14*4, 15*4, 12*4, 13*4 },
379#else
380   { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
381         8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
382#endif
378   { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4,
379         XOR(8)*4, XOR(9)*4, XOR(10)*4, XOR(11)*4, XOR(12)*4, XOR(13)*4, XOR(14)*4, XOR(15)*4 },
383380   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
384381         8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
385382   64*16
src/mame/drivers/namcos2.c
r5891r5892
50315031GAMEL(1987, finallapc, finallap, finallap, finallap, finallap, ROT0,   "Namco", "Final Lap (Rev C)", GAME_IMPERFECT_GRAPHICS, layout_finallap )
50325032GAMEL(1987, finallapjc,finallap, finallap, finallap, finallap, ROT0,   "Namco", "Final Lap (Japan - Rev C)", GAME_IMPERFECT_GRAPHICS, layout_finallap )
50335033GAMEL(1987, finallapjb,finallap, finallap, finallap, finallap, ROT0,   "Namco", "Final Lap (Japan - Rev B)", GAME_IMPERFECT_GRAPHICS, layout_finallap )
5034GAME( 1988, assault,   0,        default2, assault,  assault , ROT90,  "Namco", "Assault" , 0)      /* adjusted */
5035GAME( 1988, assaultj,  assault,  default2, assault,  assaultj, ROT90,  "Namco", "Assault (Japan)" , 0)   /* adjusted */
5036GAME( 1988, assaultp,  assault,  default2, assault,  assaultp, ROT90,  "Namco", "Assault Plus (Japan)" , 0)   /* adjusted */
5034GAME( 1988, assault,   0,        default2, assault,  assault , ROT90,  "Namco", "Assault" , 0)
5035GAME( 1988, assaultj,  assault,  default2, assault,  assaultj, ROT90,  "Namco", "Assault (Japan)" , 0)
5036GAME( 1988, assaultp,  assault,  default2, assault,  assaultp, ROT90,  "Namco", "Assault Plus (Japan)" , 0)
50375037GAME( 1988, metlhawk,  0,        metlhawk, metlhawk, metlhawk, ROT90,  "Namco", "Metal Hawk", 0)
50385038GAME( 1988, metlhawkj, metlhawk, metlhawk, metlhawk, metlhawk, ROT90,  "Namco", "Metal Hawk (Japan)", 0)
50395039GAME( 1988, ordyne,    0,        default,  default,  ordyne,   ROT180, "Namco", "Ordyne (Japan, English Version)", 0 )
50405040GAME( 1988, ordynej,   ordyne,   default,  default,  ordyne,   ROT180, "Namco", "Ordyne (Japan)", 0 )
50415041GAME( 1988, mirninja,  0,        default,  default,  mirninja, ROT0,   "Namco", "Mirai Ninja (Japan)", 0 )
5042GAME( 1988, phelios,   0,        default2, default,  phelios , ROT90,  "Namco", "Phelios (Japan)" , 0)   /* adjusted */
5043GAME( 1989, dirtfoxj,  0,        default2, dirtfox,  dirtfoxj, ROT90,  "Namco", "Dirt Fox (Japan)" , 0)   /* adjusted */
5042GAME( 1988, phelios,   0,        default2, default,  phelios , ROT90,  "Namco", "Phelios (Japan)" , 0)
5043GAME( 1989, dirtfoxj,  0,        default2, dirtfox,  dirtfoxj, ROT90,  "Namco", "Dirt Fox (Japan)" , 0 )
50445044GAME( 1989, fourtrax,  0,        finallap, fourtrax, fourtrax, ROT0,   "Namco", "Four Trax", GAME_IMPERFECT_GRAPHICS )
50455045GAME( 1989, valkyrie,  0,        default3, default,  valkyrie, ROT90,  "Namco", "Valkyrie No Densetsu (Japan)", 0 )
5046GAME( 1989, finehour,  0,        default2, default,  finehour, ROT0,   "Namco", "Finest Hour (Japan)" , 0)      /* adjusted */
5046GAME( 1989, finehour,  0,        default2, default,  finehour, ROT0,   "Namco", "Finest Hour (Japan)" , 0)
50475047GAME( 1989, burnforc,  0,        default3, default,  burnforc, ROT0,   "Namco", "Burning Force (Japan new version)", 0 )
50485048GAME( 1989, burnforco, burnforc, default3, default,  burnforc, ROT0,   "Namco", "Burning Force (Japan old version)", 0 )
50495049GAME( 1989, marvland,  0,        default,  default,  marvland, ROT0,   "Namco", "Marvel Land (US)", 0 )
src/mame/drivers/exzisus.c
r5891r5892
1010
1111Supported games :
1212==================
13 Exzisus       (C) 1987 Taito
13   Exzisus (2 sets)    (C) 1987 Taito
1414
1515
1616System specs :
1717===============
18   CPU       : Z80(4 MHz) x 4
19   Sound     : YM2151 x 1
20   Chips     : TC0010VCU + TC0140SYT
18   CPU       : Z80 x 4
19   Sound     : YM2151
20   Chips     : TC0010VCU x 2 + TC0140SYT
2121
22   There are two types of Exzisus PCB:
2223
24   * The first (K1100256A) has separate RGB outputs for the background and sprites.
25   Exactly how they are combined to form the final image is unknown.
26   * The second, later PCB has a single video output and is JAMMA compliant.
27
2328TODO:
2429- There must be a way for cpu a to stop cpu c, otherwise the RAM check in test
2530  mode cannot work. However, the only way I found to do that is making writes
r5891r5892
7075
7176static WRITE8_HANDLER( exzisus_cpua_bankswitch_w )
7277{
73   UINT8 *RAM = memory_region(space->machine, "maincpu");
78   UINT8 *RAM = memory_region(space->machine, "cpua");
7479   static int exzisus_cpua_bank = 0;
7580
7681   if ( (data & 0x0f) != exzisus_cpua_bank )
r5891r5892
141146// the RAM check to work
142147static DRIVER_INIT( exzisus )
143148{
144   UINT8 *RAM = memory_region(machine, "maincpu");
149   UINT8 *RAM = memory_region(machine, "cpua");
145150
146151   /* Fix WORK RAM error */
147152   RAM[0x67fd] = 0x18;
r5891r5892
270275};
271276
272277static GFXDECODE_START( exzisus )
273   GFXDECODE_ENTRY( "gfx1", 0, charlayout,   0, 256 )
274   GFXDECODE_ENTRY( "gfx2", 0, charlayout, 256, 256 )
278   GFXDECODE_ENTRY( "bg0", 0, charlayout,   0, 256 )
279   GFXDECODE_ENTRY( "bg1", 0, charlayout, 256, 256 )
275280GFXDECODE_END
276281
277282
r5891r5892
287292};
288293
289294
290
295/* All clocks are unconfirmed */
291296static MACHINE_DRIVER_START( exzisus )
292297
293298   /* basic machine hardware */
294   MDRV_CPU_ADD("maincpu", Z80, 6000000)         /* 6 MHz ??? */
299   MDRV_CPU_ADD("cpua", Z80, 6000000)
295300   MDRV_CPU_PROGRAM_MAP(cpua_map)
296301   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
297302
298   MDRV_CPU_ADD("audiocpu", Z80, 4000000)         /* 4 MHz ??? */
299   MDRV_CPU_PROGRAM_MAP(sound_map)
300
301   MDRV_CPU_ADD("cpub", Z80, 6000000)         /* 6 MHz ??? */
303   MDRV_CPU_ADD("cpub", Z80, 6000000)
302304   MDRV_CPU_PROGRAM_MAP(cpub_map)
303305   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
304306
305   MDRV_CPU_ADD("cpuc", Z80, 6000000)         /* 6 MHz ??? */
307   MDRV_CPU_ADD("cpuc", Z80, 6000000)
306308   MDRV_CPU_PROGRAM_MAP(cpuc_map)
307309   MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
308310
311   MDRV_CPU_ADD("audiocpu", Z80, 4000000)
312   MDRV_CPU_PROGRAM_MAP(sound_map)
313
309314   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
310315
311316   /* video hardware */
r5891r5892
339344***************************************************************************/
340345
341346ROM_START( exzisus )
342   ROM_REGION( 0x48000, "maincpu", 0 )                /* Z80 CPU A */
343   ROM_LOAD( "b23-10.bin", 0x00000, 0x08000, CRC(c80216fc) SHA1(7b952779c420be08573768f09bd65d0a188df024) )
347   ROM_REGION( 0x48000, "cpua", 0 )
348   ROM_LOAD( "b12-09.7d",  0x00000, 0x08000, CRC(e80f49a9) SHA1(3995d52195cdadfa82ff992ec0456fce09e75132) )
344349   ROM_CONTINUE(           0x10000, 0x08000 )
345   ROM_LOAD( "b23-12.bin", 0x18000, 0x10000, CRC(13637f54) SHA1(c175bc60120e32eec6ccca822fa497a42dd59823) )
350   ROM_LOAD( "b12-11.9d", 0x18000, 0x10000, CRC(11fcda2c) SHA1(4f8d1dff339d96ffadde2cc7eec23cfeb42481f2) )
346351
347   ROM_REGION( 0x10000, "audiocpu", 0 )                 /* Z80 for Sound */
348   ROM_LOAD( "b23-14.bin",  0x00000, 0x08000, CRC(f7ca7df2) SHA1(6048d9341f0303546e447a76439e1927d14cdd57) )
352   ROM_REGION( 0x48000, "cpub", 0 )
353   ROM_LOAD( "b12-10.7f",  0x00000, 0x08000, CRC(a60227f1) SHA1(1e0d09f6b77794095092316fe8bf823d4c7775bb) )
354   ROM_CONTINUE(           0x10000, 0x08000 )
355   ROM_LOAD( "b12-12.8f",  0x18000, 0x10000, CRC(a662be67) SHA1(0643480d56d8ac020288db800a705dd5d0d3ad9f) )
356   ROM_LOAD( "b12-13.10f", 0x28000, 0x10000, CRC(04a29633) SHA1(39476365241718f01f9630c12467cb24791a67e1) )
349357
350   ROM_REGION( 0x48000, "cpub", 0 )                 /* Z80 CPU B */
351   ROM_LOAD( "b23-11.bin", 0x00000, 0x08000, CRC(d6a79cef) SHA1(e2b56aa38c017b24b50f304b9fe49ee14006f9a4) )
358   ROM_REGION( 0x10000, "cpuc", 0 )
359   ROM_LOAD( "b12-14.12c", 0x00000, 0x08000, CRC(b5ce5e75) SHA1(6d5ec788684e1be4c727ac02b9fa313a42985b40) )
360
361   ROM_REGION( 0x10000, "audiocpu", 0 )
362   ROM_LOAD( "b12-21.19f", 0x00000, 0x08000, CRC(b7e0f00e) SHA1(f79ef0dee6bd29c09b8e5c586514200e3fbaa87e) )
363
364   ROM_REGION( 0x80000, "bg0", ROMREGION_INVERT )
365   ROM_LOAD( "b12-16.17d", 0x00000, 0x10000, CRC(6fec6acb) SHA1(2289c116d3f6093988a088d011f192dd4a99aa77) )
366   ROM_LOAD( "b12-18.19d", 0x10000, 0x10000, CRC(64e358aa) SHA1(cd1a23458b1a2f9c8c8aea8086dc04e0f6cc6908) )
367   ROM_LOAD( "b12-20.20d", 0x20000, 0x10000, CRC(87f52e89) SHA1(3f8530aca087fa2a32dc6dfbcfe2f86604ee3ca1) )
368   ROM_LOAD( "b12-15.17c", 0x40000, 0x10000, CRC(d81107c8) SHA1(c024c9b7956de493687e1373318d4cd74b3555b2) )
369   ROM_LOAD( "b12-17.19c", 0x50000, 0x10000, CRC(db1d5a6c) SHA1(c2e1b8d92c2b3b2ce775ed50ca4a37e84ed35a93) )
370   ROM_LOAD( "b12-19.20c", 0x60000, 0x10000, CRC(772b2641) SHA1(35cc6d5a725f1817791e710afde992e64d14104f) )
371
372   ROM_REGION( 0x80000, "bg1", ROMREGION_INVERT )
373   ROM_LOAD( "b12-05.1c",  0x00000, 0x10000, CRC(be5c5cc1) SHA1(af50c1ee0ce134871ea636c0e939f1a007a1cc13) )
374   ROM_LOAD( "b12-07.3c",  0x10000, 0x10000, CRC(9353e39f) SHA1(576620818eb7a50a86aac0376a58ac22a29bb16d) )
375   ROM_LOAD( "b12-06.1d",  0x40000, 0x10000, CRC(8571e6ed) SHA1(0a3228408f4d2afe3744172d24ae41d6400c30b6) )
376   ROM_LOAD( "b12-08.3d",  0x50000, 0x10000, CRC(55ea5cca) SHA1(5717652ca028ff7a55c40573d52755985ed77ef7) )
377
378   ROM_REGION( 0x00c00, "proms", 0 )
379   ROM_LOAD( "b12-27.13l", 0x00000, 0x00100, CRC(524c9a01) SHA1(1894de29ba15a26043706ca4c5ca33aa8373447a) )
380   ROM_LOAD( "b12-24.6m",  0x00100, 0x00100, CRC(1aa5bde9) SHA1(1bb6d5614183ff98600c5555ec8f5c545648e55c) )
381   ROM_LOAD( "b12-26.12l", 0x00400, 0x00100, CRC(65f42c61) SHA1(7dc493d918f16661e3524c4189e785edfd345dbb) )
382   ROM_LOAD( "b12-23.4m",  0x00500, 0x00100, CRC(fad4db5f) SHA1(bb1169ed6147fb9ac413f0d63e428dd190e7641d) )
383   ROM_LOAD( "b12-25.11l", 0x00800, 0x00100, CRC(3e30f45b) SHA1(aa1f5278975c101f03feb16cac0bd074a6a41d2c) )
384   ROM_LOAD( "b12-22.2m",  0x00900, 0x00100, CRC(936855d2) SHA1(57bb7cb40462f37e49c4ff0d9c833bbd2fb78428) )
385ROM_END
386
387ROM_START( exzisusa )
388   ROM_REGION( 0x48000, "cpua", 0 )
389   ROM_LOAD( "b23-10.7d",  0x00000, 0x08000, CRC(c80216fc) SHA1(7b952779c420be08573768f09bd65d0a188df024) )
352390   ROM_CONTINUE(           0x10000, 0x08000 )
353   ROM_LOAD( "b12-12.bin", 0x18000, 0x10000, CRC(a662be67) SHA1(0643480d56d8ac020288db800a705dd5d0d3ad9f) )
354   ROM_LOAD( "b12-13.bin", 0x28000, 0x10000, CRC(04a29633) SHA1(39476365241718f01f9630c12467cb24791a67e1) )
391   ROM_LOAD( "b23-12.9d",  0x18000, 0x10000, CRC(13637f54) SHA1(c175bc60120e32eec6ccca822fa497a42dd59823) )
355392
356   ROM_REGION( 0x10000, "cpuc", 0 )                 /* Z80 CPU C */
357   ROM_LOAD( "b23-13.bin",  0x00000, 0x08000, CRC(51110aa1) SHA1(34c2701625eb1987affad1efd19ff8c9971456ae) )
393   ROM_REGION( 0x48000, "cpub", 0 )
394   ROM_LOAD( "b23-11.7f",  0x00000, 0x08000, CRC(d6a79cef) SHA1(e2b56aa38c017b24b50f304b9fe49ee14006f9a4) )
395   ROM_CONTINUE(           0x10000, 0x08000 )
396   ROM_LOAD( "b12-12.8f",  0x18000, 0x10000, CRC(a662be67) SHA1(0643480d56d8ac020288db800a705dd5d0d3ad9f) )
397   ROM_LOAD( "b12-13.10f", 0x28000, 0x10000, CRC(04a29633) SHA1(39476365241718f01f9630c12467cb24791a67e1) )
358398
359   ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT )   /* BG 0 */
360   ROM_LOAD( "b12-16.bin",  0x00000, 0x10000, CRC(6fec6acb) SHA1(2289c116d3f6093988a088d011f192dd4a99aa77) )
361   ROM_LOAD( "b12-18.bin",  0x10000, 0x10000, CRC(64e358aa) SHA1(cd1a23458b1a2f9c8c8aea8086dc04e0f6cc6908) )
362   ROM_LOAD( "b12-20.bin",  0x20000, 0x10000, CRC(87f52e89) SHA1(3f8530aca087fa2a32dc6dfbcfe2f86604ee3ca1) )
363   ROM_LOAD( "b12-15.bin",  0x40000, 0x10000, CRC(d81107c8) SHA1(c024c9b7956de493687e1373318d4cd74b3555b2) )
364   ROM_LOAD( "b12-17.bin",  0x50000, 0x10000, CRC(db1d5a6c) SHA1(c2e1b8d92c2b3b2ce775ed50ca4a37e84ed35a93) )
365   ROM_LOAD( "b12-19.bin",  0x60000, 0x10000, CRC(772b2641) SHA1(35cc6d5a725f1817791e710afde992e64d14104f) )
399   ROM_REGION( 0x10000, "cpuc", 0 )
400   ROM_LOAD( "b23-13.12c", 0x00000, 0x08000, CRC(51110aa1) SHA1(34c2701625eb1987affad1efd19ff8c9971456ae) )
366401
367   ROM_REGION( 0x80000, "gfx2", ROMREGION_INVERT )   /* BG 1 */
368   ROM_LOAD( "b23-06.bin",  0x00000, 0x10000, CRC(44f8f661) SHA1(d77160a89e45556cd9ce211d89c398e1086d8d92) )
369   ROM_LOAD( "b23-08.bin",  0x10000, 0x10000, CRC(1ce498c1) SHA1(a9ce3de997089bd40c99bd89919b459c9f215fc8) )
370   ROM_LOAD( "b23-07.bin",  0x40000, 0x10000, CRC(d7f6ec89) SHA1(e8da207ddaf46ceff870b45ecec0e89c499291b4) )
371   ROM_LOAD( "b23-09.bin",  0x50000, 0x10000, CRC(6651617f) SHA1(6351a0b01589cb181b896285ade70e9dfcd799ec) )
402   ROM_REGION( 0x10000, "audiocpu", 0 )
403   ROM_LOAD( "b23-14.19f", 0x00000, 0x08000, CRC(f7ca7df2) SHA1(6048d9341f0303546e447a76439e1927d14cdd57) )
372404
373   ROM_REGION( 0x00c00, "proms", 0 )               /* PROMS */
374   ROM_LOAD( "b23-04.bin",  0x00000, 0x00400, CRC(5042cffa) SHA1(c969748866a12681cf2dbf25a46da2c4e4f92313) )
375   ROM_LOAD( "b23-03.bin",  0x00400, 0x00400, CRC(9458fd45) SHA1(7f7cdacf37bb6f15de1109fa73ba3c5fc88893d0) )
376   ROM_LOAD( "b23-05.bin",  0x00800, 0x00400, CRC(87f0f69a) SHA1(37df6fd56245fab9beaabfd86fd8f95d7c42c2a5) )
405   ROM_REGION( 0x80000, "bg0", ROMREGION_INVERT )
406   ROM_LOAD( "b12-16.17d", 0x00000, 0x10000, CRC(6fec6acb) SHA1(2289c116d3f6093988a088d011f192dd4a99aa77) )
407   ROM_LOAD( "b12-18.19d", 0x10000, 0x10000, CRC(64e358aa) SHA1(cd1a23458b1a2f9c8c8aea8086dc04e0f6cc6908) )
408   ROM_LOAD( "b12-20.20d", 0x20000, 0x10000, CRC(87f52e89) SHA1(3f8530aca087fa2a32dc6dfbcfe2f86604ee3ca1) )
409   ROM_LOAD( "b12-15.17c", 0x40000, 0x10000, CRC(d81107c8) SHA1(c024c9b7956de493687e1373318d4cd74b3555b2) )
410   ROM_LOAD( "b12-17.19c", 0x50000, 0x10000, CRC(db1d5a6c) SHA1(c2e1b8d92c2b3b2ce775ed50ca4a37e84ed35a93) )
411   ROM_LOAD( "b12-19.20c", 0x60000, 0x10000, CRC(772b2641) SHA1(35cc6d5a725f1817791e710afde992e64d14104f) )
412
413   ROM_REGION( 0x80000, "bg1", ROMREGION_INVERT )
414   ROM_LOAD( "b23-06.1c",  0x00000, 0x10000, CRC(44f8f661) SHA1(d77160a89e45556cd9ce211d89c398e1086d8d92) )
415   ROM_LOAD( "b23-08.3c",  0x10000, 0x10000, CRC(1ce498c1) SHA1(a9ce3de997089bd40c99bd89919b459c9f215fc8) )
416   ROM_LOAD( "b23-07.1d",  0x40000, 0x10000, CRC(d7f6ec89) SHA1(e8da207ddaf46ceff870b45ecec0e89c499291b4) )
417   ROM_LOAD( "b23-09.3d",  0x50000, 0x10000, CRC(6651617f) SHA1(6351a0b01589cb181b896285ade70e9dfcd799ec) )
418
419   ROM_REGION( 0x00c00, "proms", 0 )
420   /* These appear to be twice the correct size */
421   ROM_LOAD( "b23-04.15l", 0x00000, 0x00400, CRC(5042cffa) SHA1(c969748866a12681cf2dbf25a46da2c4e4f92313) )
422   ROM_LOAD( "b23-03.14l", 0x00400, 0x00400, BAD_DUMP CRC(9458fd45) SHA1(7f7cdacf37bb6f15de1109fa73ba3c5fc88893d0) ) /* D0 is fixed */
423   ROM_LOAD( "b23-05.16l", 0x00800, 0x00400, CRC(87f0f69a) SHA1(37df6fd56245fab9beaabfd86fd8f95d7c42c2a5) )
377424ROM_END
378425
379426
380GAME( 1987,  exzisus,      0, exzisus, exzisus, 0,    ROT0, "Taito Corporation", "Exzisus (Japan)", 0 )
427GAME( 1987, exzisus,  0,       exzisus, exzisus, 0, ROT0, "Taito Corporation", "Exzisus (Japan, dedicated)",  0 )
428GAME( 1987, exzisusa, exzisus, exzisus, exzisus, 0, ROT0, "Taito Corporation", "Exzisus (Japan, conversion)", 0 )
429/* A third set exists with a 'TAD Corp.' copyright */
src/mame/drivers/xmen.c
r5891r5892
570570   ROM_LOAD( "065-a06.1f",  0x000000, 0x200000, CRC(5adbcee0) SHA1(435feda697193bc51db80eba46be474cbbc1de4b) )
571571ROM_END
572572
573ROM_START( xmen2p )
573ROM_START( xmen2pe )
574574   ROM_REGION( 0x100000, "maincpu", 0 )
575   ROM_LOAD16_BYTE( "065-eaa04.10d",  0x00000, 0x20000, CRC(502861e7) SHA1(f96aab2d2006703065de5bd7e341f929d04f5f60) ) /* Europe 2 Player version */
576   ROM_LOAD16_BYTE( "065-eaa05.10f",  0x00001, 0x20000, CRC(ca6071bf) SHA1(454ddc3b598389e960e87e577a01a7de71d1f591) )
577   ROM_LOAD16_BYTE( "065-a02.9d",     0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) )
578   ROM_LOAD16_BYTE( "065-a03.9f",     0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) )
579
580   ROM_REGION( 0x30000, "audiocpu", 0 )      /* 64k+128k for sound cpu */
581   ROM_LOAD( "065-a01.6f",   0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) )
582   ROM_RELOAD(               0x10000, 0x20000 )
583
584   ROM_REGION( 0x200000, "gfx1", 0 )   /* graphics (addressable by the main CPU) */
585   ROM_LOAD( "065-a08.15l",   0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) )   /* tiles */
586   ROM_LOAD( "065-a07.16l",   0x100000, 0x100000, CRC(c5dc8fc4) SHA1(9887cb002c8b72be7ce933cb397f00cdc5506c8c) )
587
588   ROM_REGION( 0x400000, "gfx2", 0 )   /* graphics (addressable by the main CPU) */
589   ROM_LOAD( "065-a09.2h",  0x000000, 0x100000, CRC(ea05d52f) SHA1(7f2c14f907355856fb94e3a67b73aa1919776835) )   /* sprites */
590   ROM_LOAD( "065-a10.2l",  0x100000, 0x100000, CRC(96b91802) SHA1(641943557b59b91f0edd49ec8a73cef7d9268b32) )
591   ROM_LOAD( "065-a12.1h",  0x200000, 0x100000, CRC(321ed07a) SHA1(5b00ed676daeea974bdce6701667cfe573099dad) )
592   ROM_LOAD( "065-a11.1l",  0x300000, 0x100000, CRC(46da948e) SHA1(168ac9178ee5bad5931557fb549e1237971d7839) )
593
594   ROM_REGION( 0x200000, "konami", 0 )   /* samples for the 054539 */
595   ROM_LOAD( "065-a06.1f",  0x000000, 0x200000, CRC(5adbcee0) SHA1(435feda697193bc51db80eba46be474cbbc1de4b) )
596ROM_END
597
598ROM_START( xmen2pa )
599   ROM_REGION( 0x100000, "maincpu", 0 )
575600   ROM_LOAD16_BYTE( "065-aaa04.10d",  0x00000, 0x20000, CRC(7f8b27c2) SHA1(052db1f47671564a440544a41fc397a19d1aff3a) ) /* Asia 2 Player version */
576   ROM_LOAD16_BYTE( "065-aaa04.10f",  0x00001, 0x20000, CRC(841ed636) SHA1(33f96022ce3dae9b49eb51fd4e8f7387a1777002) )
601   ROM_LOAD16_BYTE( "065-aaa05.10f",  0x00001, 0x20000, CRC(841ed636) SHA1(33f96022ce3dae9b49eb51fd4e8f7387a1777002) )
577602   ROM_LOAD16_BYTE( "065-a02.9d",     0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) )
578603   ROM_LOAD16_BYTE( "065-a03.9f",     0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) )
579604
r5891r5892
736761
737762GAME( 1992, xmen,    0,    xmen, xmen,   xmen,   ROT0, "Konami", "X-Men (4 Players ver UBB)", 0 ) /* Second "version" letter denotes players, A=2 players, B=4 players, C=6 players ??? */
738763GAME( 1992, xmenj,   xmen, xmen, xmen,   xmen,   ROT0, "Konami", "X-Men (4 Players ver JBA)", 0 )
739GAME( 1992, xmen2p,  xmen, xmen, xmen2p, xmen,   ROT0, "Konami", "X-Men (2 Players ver AAA)", 0 )
764GAME( 1992, xmen2pe, xmen, xmen, xmen2p, xmen,   ROT0, "Konami", "X-Men (2 Players ver EAA)", 0 )
765GAME( 1992, xmen2pa, xmen, xmen, xmen2p, xmen,   ROT0, "Konami", "X-Men (2 Players ver AAA)", 0 )
740766GAME( 1992, xmen2pj, xmen, xmen, xmen2p, xmen,   ROT0, "Konami", "X-Men (2 Players ver JAA)", 0 )
741767
742768GAME( 1992, xmen6p,  xmen, xmen6p,xmen6p,   xmen, ROT0, "Konami", "X-Men (6 Players ver ECB)", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/mirax.c
r5891r5892
88Olivier Galibert
99
1010TODO:
11- emulate sound properly;
1211- sprite offsets?
1312- score / credits display should stay above the sprites?
1413
r5891r5892
374373}
375374
376375static MACHINE_DRIVER_START( mirax )
377   MDRV_CPU_ADD("maincpu", Z80, 12000000/2) // ceramic potted module, encrypted z80
376   MDRV_CPU_ADD("maincpu", Z80, 12000000/4) // ceramic potted module, encrypted z80
378377   MDRV_CPU_PROGRAM_MAP(mirax_main_map)
379378   MDRV_CPU_VBLANK_INT("screen",mirax_vblank_irq)
380379
381   MDRV_CPU_ADD("audiocpu", Z80, 12000000/2) // audio cpu ?
380   MDRV_CPU_ADD("audiocpu", Z80, 12000000/4)
382381   MDRV_CPU_PROGRAM_MAP(mirax_sound_map)
383   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 2)
382   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
384383
385384   /* video hardware */
386385   MDRV_SCREEN_ADD("screen", RASTER)
r5891r5892
399398   MDRV_SOUND_START(mirax)
400399
401400   MDRV_SPEAKER_STANDARD_MONO("mono")
402   MDRV_SOUND_ADD("ay1", AY8910, 12000000/6 /* guess */)
401   MDRV_SOUND_ADD("ay1", AY8910, 12000000/4)
403402   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
404   MDRV_SOUND_ADD("ay2", AY8910, 12000000/6 /* guess */)
403   MDRV_SOUND_ADD("ay2", AY8910, 12000000/4)
405404   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
406405MACHINE_DRIVER_END
407406
r5891r5892
436435   ROM_LOAD( "mirax.prm",   0x0040, 0x0020, NO_DUMP )
437436ROM_END
438437
438ROM_START( miraxa )
439   ROM_REGION( 0xc000, "maincpu", ROMREGION_ERASE00 ) // put decrypted code there
439440
441   ROM_REGION( 0xc000, "data_code", 0 ) // encrypted code for the main cpu
442   ROM_LOAD( "mx_p5_43v.p5",   0x0000, 0x4000, CRC(87664903) SHA1(ccc11ecf0658e7af0db3229f60a16b1a44bd12bc) )
443   ROM_LOAD( "mx_r5_43v.r5",   0x4000, 0x4000, CRC(1ba4cd8e) SHA1(8fd22d3a4bca7c989382aaf7b08ac381a3566493) )
444   ROM_LOAD( "mx_s5_43v.s5",   0x8000, 0x4000, CRC(c58cc151) SHA1(0846e22f4da6d85c6dc29ff1472bc84b419b2289) )
445
446   ROM_REGION( 0x10000, "audiocpu", 0 )
447   ROM_LOAD( "mxr2-4v.rom",   0x0000, 0x2000, CRC(cd2d52dc) SHA1(0d4181dc68beac338f47a2065c7b755008877896) )
448
449   ROM_REGION( 0xc000, "gfx1", 0 )
450   ROM_LOAD( "mxe3-4v.rom",   0x0000, 0x4000, CRC(0cede01f) SHA1(c723dd8ee9dc06c94a7fe5d5b5bccc42e2181af1) )
451   ROM_LOAD( "mxh3-4v.rom",   0x4000, 0x4000, CRC(58221502) SHA1(daf5c508939b44616ca76308fc33f94d364ed587) )
452   ROM_LOAD( "mxk3-4v.rom",   0x8000, 0x4000, CRC(6dbc2961) SHA1(5880c28f1ef704fee2d625a42682c7d65613acc8) )
453
454   ROM_REGION( 0x18000, "gfx2", 0 )
455   ROM_LOAD( "mxe2-4v.rom",   0x04000, 0x4000, CRC(2cf5d8b7) SHA1(f66bce4d413a48f6ae07974870dc0f31eefa68e9) )
456   ROM_LOAD( "mxf2-4v.rom",   0x0c000, 0x4000, CRC(1f42c7fa) SHA1(33e56c6ddf7676a12f57de87ec740c6b6eb1cc8c) )
457   ROM_LOAD( "mxh2-4v.rom",   0x14000, 0x4000, CRC(cbaff4c6) SHA1(2dc4a1f51b28e98be0cfb5ab7576047c748b6728) )
458   ROM_LOAD( "mxf3-4v.rom",   0x00000, 0x4000, CRC(14b1ca85) SHA1(775a4c81a81b78490d45095af31e24c16886f0a2) )
459   ROM_LOAD( "mxi3-4v.rom",   0x08000, 0x4000, CRC(20fb2099) SHA1(da6bbd5d2218ba49b8ef98e7affdcab912f84ade) )
460   ROM_LOAD( "mxl3-4v.rom",   0x10000, 0x4000, CRC(918487aa) SHA1(47ba6914722a253f65c733b5edff4d15e73ea6c2) )
461
462   ROM_REGION( 0x0060, "proms", 0 ) // data ? encrypted roms for cpu1 ?
463   ROM_LOAD( "mra3.prm",   0x0000, 0x0020, CRC(ae7e1a63) SHA1(f5596db77c1e352ef7845465db3e54e19cd5df9e) )
464   ROM_LOAD( "mrb3.prm",   0x0020, 0x0020, CRC(e3f3d0f5) SHA1(182b06c9db5bec1e3030f705247763bd2380ba83) )
465   ROM_LOAD( "mirax.prm",   0x0040, 0x0020, NO_DUMP )
466ROM_END
467
468
440469static DRIVER_INIT( mirax )
441470{
442471   UINT8 *DATA = memory_region(machine, "data_code");
r5891r5892
454483
455484}
456485
457GAME( 1985, mirax,  0,      mirax, mirax, mirax, ROT90, "Current Technologies", "Mirax", GAME_IMPERFECT_SOUND )
486GAME( 1985, mirax,  0,     mirax, mirax, mirax, ROT90, "Current Technologies", "Mirax",         0 )
487GAME( 1985, miraxa, mirax, mirax, mirax, mirax, ROT90, "Current Technologies", "Mirax (set 2)", 0 )
src/mame/drivers/segas16b.c
r5891r5892
887887 *
888888 *************************************/
889889
890#define MASTER_CLOCK_10MHz      (10000000)
891#define MASTER_CLOCK_8MHz      (8000000)
892#define MASTER_CLOCK_25MHz      (25174800)
890#define MASTER_CLOCK_10MHz      XTAL_10MHz
891#define MASTER_CLOCK_8MHz      XTAL_8MHz
892#define MASTER_CLOCK_25MHz      XTAL_25_1748MHz
893893
894894#define ROM_BOARD_171_5358_SMALL (0)   /* 171-5358 with smaller ROMs */
895895#define ROM_BOARD_171_5358      (1)      /* 171-5358 */
r5891r5892
32663266 *
32673267 *************************************/
32683268
3269static MACHINE_DRIVER_START( atomicp )
3269static MACHINE_DRIVER_START( atomicp ) /* 10MHz CPU Clock verified */
32703270   MDRV_IMPORT_FROM(system16b)
32713271
32723272   /* basic machine hardware */
r5891r5892
32743274   MDRV_MACHINE_RESET(atomicp)
32753275
32763276   /* sound hardware */
3277   MDRV_SOUND_REPLACE("ym", YM2413, 5000000) /* 20MHz OSC divided by 4 */
3277   MDRV_SOUND_REPLACE("ym", YM2413, XTAL_20MHz/4) /* 20MHz OSC divided by 4 (verified) */
32783278   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
32793279
32803280   MDRV_DEVICE_REMOVE("upd")
src/mame/drivers/taito_f3.c
r5891r5892
287287
288288/******************************************************************************/
289289
290#define XOR(a) WORD2_XOR_BE(a)
291
290292static const gfx_layout charlayout =
291293{
292294   8,8,
293295   256,
294296   4,
295297   { 0,1,2,3 },
296#ifdef LSB_FIRST
297    { 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 },
298#else
299    { 7*4, 6*4, 5*4, 4*4, 3*4, 2*4, 1*4, 0*4 },
300#endif
298   { XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4, XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4 },
301299   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
302300   32*8
303301};
r5891r5892
308306   2048,
309307   4,
310308   { 0,1,2,3 },
311#ifdef LSB_FIRST
312    { 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 },
313#else
314    { 7*4, 6*4, 5*4, 4*4, 3*4, 2*4, 1*4, 0*4 },
315#endif
309   { XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4, XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4 },
316310   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
317311   32*8
318312};
src/mame/drivers/twin16.c
r5891r5892
852852   ROM_LOAD16_BYTE( "687_q12.8s",   0x20001, 0x10000, CRC(6d012167) SHA1(d608e29e0b2e834c099386b6ebb667e4bfc40ce7) )
853853
854854   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
855   ROM_LOAD( "687_l03.10a",      0x00000,  0x8000, CRC(7201983c) SHA1(06d089406d2f702e8d51ffdfbf34e4727a28d506) )
855   ROM_LOAD( "687_l03.10a", 0x00000,  0x8000, CRC(7201983c) SHA1(06d089406d2f702e8d51ffdfbf34e4727a28d506) )
856856
857857   ROM_REGION( 0x4000, "gfx1", 0 )
858   ROM_LOAD( "687_m14.d8",         0x00000,  0x4000, CRC(d7338557) SHA1(9b384baafabaab3888a0139674f0b530303684ca) ) // characters
858   ROM_LOAD( "687_m14.d8", 0x00000,  0x4000, CRC(d7338557) SHA1(9b384baafabaab3888a0139674f0b530303684ca) ) /* Title screen graphics & characters */
859859
860860   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
861861   ROM_LOAD16_WORD( "687i17.p16",   0x000000, 0x80000, CRC(66cb3923) SHA1(3c1fc1dff77201cf8d8c4594c965695066c1701c) )
r5891r5892
868868   ROM_LOAD16_BYTE( "687_l10.8r",   0x00001, 0x10000, CRC(117c91ee) SHA1(dcf8efb25fc73cff916b66b7bcfd3c1fb2556a53) )
869869
870870   ROM_REGION( 0x20000, "konami", 0 )    // samples
871   ROM_LOAD( "687_i01.5a",         0x00000, 0x20000, CRC(d4992dfb) SHA1(c65bef07b6adb9ab6328d679595450945dbf6a88) )
871   ROM_LOAD( "687_i01.5a", 0x00000, 0x20000, CRC(d4992dfb) SHA1(c65bef07b6adb9ab6328d679595450945dbf6a88) )
872872
873873   ROM_REGION( 0x20000, "upd", 0 )    // samples
874   ROM_LOAD( "687_i02.7c",         0x00000, 0x20000, CRC(e5947501) SHA1(9ec7319bd97711981db60af6f477c2ba2ec7e6b8) )
874   ROM_LOAD( "687_i02.7c", 0x00000, 0x20000, CRC(e5947501) SHA1(9ec7319bd97711981db60af6f477c2ba2ec7e6b8) )
875875ROM_END
876876
877877ROM_START( majuu )
r5891r5892
888888   ROM_LOAD16_BYTE( "687_q12.8s",   0x20001, 0x10000, CRC(6d012167) SHA1(d608e29e0b2e834c099386b6ebb667e4bfc40ce7) )
889889
890890   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
891   ROM_LOAD( "687_l03.10a",      0x00000,  0x8000, CRC(7201983c) SHA1(06d089406d2f702e8d51ffdfbf34e4727a28d506) )
891   ROM_LOAD( "687_l03.10a", 0x00000,  0x8000, CRC(7201983c) SHA1(06d089406d2f702e8d51ffdfbf34e4727a28d506) )
892892
893893   ROM_REGION( 0x4000, "gfx1", 0 )
894   ROM_LOAD( "687_l14.d8",         0x00000,  0x4000, CRC(20ecccd6) SHA1(b8ac3186de5ea81ae1c64b9511b7a0718aabab48) ) // characters
894   ROM_LOAD( "687_l14.d8", 0x00000,  0x4000, CRC(20ecccd6) SHA1(b8ac3186de5ea81ae1c64b9511b7a0718aabab48) ) /* Title screen graphics & characters */
895895
896896   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
897897   ROM_LOAD16_WORD( "687i17.p16",   0x000000, 0x80000, CRC(66cb3923) SHA1(3c1fc1dff77201cf8d8c4594c965695066c1701c) )
r5891r5892
904904   ROM_LOAD16_BYTE( "687_l10.8r",   0x00001, 0x10000, CRC(117c91ee) SHA1(dcf8efb25fc73cff916b66b7bcfd3c1fb2556a53) )
905905
906906   ROM_REGION( 0x20000, "konami", 0 )    // samples
907   ROM_LOAD( "687_i01.5a",         0x00000, 0x20000, CRC(d4992dfb) SHA1(c65bef07b6adb9ab6328d679595450945dbf6a88) )
907   ROM_LOAD( "687_i01.5a", 0x00000, 0x20000, CRC(d4992dfb) SHA1(c65bef07b6adb9ab6328d679595450945dbf6a88) )
908908
909909   ROM_REGION( 0x20000, "upd", 0 )    // samples
910   ROM_LOAD( "687_i02.7c",         0x00000, 0x20000, CRC(e5947501) SHA1(9ec7319bd97711981db60af6f477c2ba2ec7e6b8) )
910   ROM_LOAD( "687_i02.7c", 0x00000, 0x20000, CRC(e5947501) SHA1(9ec7319bd97711981db60af6f477c2ba2ec7e6b8) )
911911ROM_END
912912
913913ROM_START( darkadv )
r5891r5892
924924   ROM_LOAD16_BYTE( "687_n12.8s",   0x20001, 0x10000, CRC(da221944) SHA1(c288ee583414a077f0d8b815b8e01b7f19a5fafe) )
925925
926926   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
927   ROM_LOAD( "687_n03.10a",      0x00000,  0x8000, CRC(a24c682f) SHA1(cf053270d3f77448ff802db832598ae3cf7dae6c) )
927   ROM_LOAD( "687_n03.10a", 0x00000,  0x8000, CRC(a24c682f) SHA1(cf053270d3f77448ff802db832598ae3cf7dae6c) )
928928
929929   ROM_REGION( 0x4000, "gfx1", 0 )
930   ROM_LOAD( "687_n14.d8",   0x0000, 0x4000, CRC(c76ac6d2) SHA1(d8fec255f1f7177a3716a5894fb679cbe172b6ea) ) // characters
930   ROM_LOAD( "687_n14.d8",   0x0000, 0x4000, CRC(c76ac6d2) SHA1(d8fec255f1f7177a3716a5894fb679cbe172b6ea) ) /* Title screen graphics & characters */
931931
932932   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
933933   ROM_LOAD16_WORD( "687i17.p16",   0x000000, 0x80000, CRC(66cb3923) SHA1(3c1fc1dff77201cf8d8c4594c965695066c1701c) )
r5891r5892
940940   ROM_LOAD16_BYTE( "687_l10.8r",   0x00001, 0x10000, CRC(117c91ee) SHA1(dcf8efb25fc73cff916b66b7bcfd3c1fb2556a53) )
941941
942942   ROM_REGION( 0x20000, "konami", 0 )    // samples
943   ROM_LOAD( "687_i01.5a",         0x00000, 0x20000, CRC(d4992dfb) SHA1(c65bef07b6adb9ab6328d679595450945dbf6a88) )
943   ROM_LOAD( "687_i01.5a", 0x00000, 0x20000, CRC(d4992dfb) SHA1(c65bef07b6adb9ab6328d679595450945dbf6a88) )
944944
945945   ROM_REGION( 0x20000, "upd", 0 )    // samples
946   ROM_LOAD( "687_i02.7c",         0x00000, 0x20000, CRC(e5947501) SHA1(9ec7319bd97711981db60af6f477c2ba2ec7e6b8) )
946   ROM_LOAD( "687_i02.7c", 0x00000, 0x20000, CRC(e5947501) SHA1(9ec7319bd97711981db60af6f477c2ba2ec7e6b8) )
947947ROM_END
948948
949949ROM_START( vulcan )
r5891r5892
960960   ROM_LOAD16_BYTE( "785_p12.8s",   0x20001, 0x10000, CRC(38ea402a) SHA1(90ff2bd71435988cde967704ce3b1401de206683) )
961961
962962   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
963   ROM_LOAD( "785_g03.10a",      0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
963   ROM_LOAD( "785_g03.10a", 0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
964964
965965   ROM_REGION( 0x4000, "gfx1", 0 )
966   ROM_LOAD( "785_h14.d8",         0x0000,   0x4000, CRC(02f4b16f) SHA1(45addc99f520770f38c6aa69aef9af59cfc410b5) ) // characters
966   ROM_LOAD( "785_h14.d8", 0x0000,   0x4000, CRC(02f4b16f) SHA1(45addc99f520770f38c6aa69aef9af59cfc410b5) ) /* Title screen graphics & characters */
967967
968968   ROM_REGION16_BE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
969969   ROM_LOAD16_WORD( "785f17.p16",   0x000000, 0x80000, CRC(8fbec1a4) SHA1(71cbdb25470b5a2ca7e80c92f12fc47e28085793) )
r5891r5892
974974   ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 )   // tile data; mapped at 0x80000 on CPUB
975975
976976   ROM_REGION( 0x20000, "konami", 0 )    // samples
977   ROM_LOAD( "785_f01.5a",         0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
977   ROM_LOAD( "785_f01.5a", 0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
978978
979979   ROM_REGION( 0x20000, "upd", 0 )    // samples
980   ROM_LOAD( "785_f02.7c",         0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
980   ROM_LOAD( "785_f02.7c", 0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
981981ROM_END
982982
983ROM_START( vulcana )
984   ROM_REGION( 0x40000, "maincpu", 0 )   // 68000 code (CPU A)
985   ROM_LOAD16_BYTE( "785_n05.6n",   0x00000, 0x10000, CRC(6371d475) SHA1(82e6adc38de8363c126cd073dbc95eeec576db98) )
986   ROM_LOAD16_BYTE( "785_n04.4n",   0x00001, 0x10000, CRC(b6f24b9e) SHA1(01685f89955385714062cc70316edce1a6a64e35) )
987   ROM_LOAD16_BYTE( "785_r09.6r",   0x20000, 0x10000, CRC(fbfd1543) SHA1(8ef41a0a9d3d1de9395bdd5288199841c61d7045) )
988   ROM_LOAD16_BYTE( "785_r08.4r",   0x20001, 0x10000, CRC(36bb1be1) SHA1(ce9a98443a453b1c05dfb8d0f8ba0f94292b9d30) )
989
990   ROM_REGION( 0x40000, "sub", 0 )   // 68000 code (CPU B)
991   ROM_LOAD16_BYTE( "785_g07.10n",   0x00000, 0x10000, CRC(ee09dd5d) SHA1(9b6fb12c2cb7930df12d9876810811540fd560ee) )
992   ROM_LOAD16_BYTE( "785_g06.8n" ,   0x00001, 0x10000, CRC(85ab7af7) SHA1(5cb36918a5cdfd16611da76f07450ae1d115f2c7) )
993   ROM_LOAD16_BYTE( "785_g13.10s",   0x20000, 0x10000, CRC(274f325d) SHA1(1076efa204eff0fc8a8788706b17b9a128023d35) )
994   ROM_LOAD16_BYTE( "785_g12.8s",   0x20001, 0x10000, CRC(1625f933) SHA1(3f25d7396af46e75e3ae8456414e31935de43d34) )
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
9831017ROM_START( gradius2 )
9841018   ROM_REGION( 0x40000, "maincpu", 0 )   // 68000 code (CPU A)
9851019   ROM_LOAD16_BYTE( "785_x05.6n",   0x00000, 0x10000, CRC(8a23a7b8) SHA1(9846272c011715b17f146d5265a09e790d6e37cd) )
r5891r5892
9941028   ROM_LOAD16_BYTE( "785_p12.8s",   0x20001, 0x10000, CRC(38ea402a) SHA1(90ff2bd71435988cde967704ce3b1401de206683) )
9951029
9961030   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
997   ROM_LOAD( "785_g03.10a",      0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
1031   ROM_LOAD( "785_g03.10a", 0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
9981032
9991033   ROM_REGION( 0x4000, "gfx1", 0 )
1000   ROM_LOAD( "785_g14.d8",         0x0000, 0x4000, CRC(9dcdad9d) SHA1(22f457408b453a71b7e91974aee1b1e735ff887f) ) // characters
1034   ROM_LOAD( "785_g14.d8", 0x0000, 0x4000, CRC(9dcdad9d) SHA1(22f457408b453a71b7e91974aee1b1e735ff887f) ) /* Title screen graphics & characters */
10011035
10021036   ROM_REGION16_BE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
10031037   ROM_LOAD16_WORD_SWAP( "gr2.p16",   0x000000, 0x80000, CRC(4e7a7b82) SHA1(520b5ebd400954042d55cf243842a6d6b6d10210) ) /* 785f17.p16 byteswapped */
r5891r5892
10131047   ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 )   // tile data; mapped at 0x80000 on CPUB
10141048
10151049   ROM_REGION( 0x20000, "konami", 0 )    // samples
1016   ROM_LOAD( "785_f01.5a",         0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
1050   ROM_LOAD( "785_f01.5a", 0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
10171051
10181052   ROM_REGION( 0x20000, "upd", 0 )    // samples
1019   ROM_LOAD( "785_f02.7c",         0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
1053   ROM_LOAD( "785_f02.7c", 0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
10201054ROM_END
10211055
10221056ROM_START( gradius2a )
r5891r5892
10331067   ROM_LOAD16_BYTE( "785_p12.8s",   0x20001, 0x10000, CRC(38ea402a) SHA1(90ff2bd71435988cde967704ce3b1401de206683) )
10341068
10351069   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
1036   ROM_LOAD( "785_g03.10a",      0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
1070   ROM_LOAD( "785_g03.10a", 0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
10371071
10381072   ROM_REGION( 0x4000, "gfx1", 0 )
1039   ROM_LOAD( "785_g14.d8",         0x0000, 0x4000, CRC(9dcdad9d) SHA1(22f457408b453a71b7e91974aee1b1e735ff887f) ) // characters
1073   ROM_LOAD( "785_g14.d8", 0x0000, 0x4000, CRC(9dcdad9d) SHA1(22f457408b453a71b7e91974aee1b1e735ff887f) ) /* Title screen graphics & characters */
10401074
10411075   ROM_REGION16_BE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
10421076   ROM_LOAD16_WORD( "785f17.p16",   0x000000, 0x80000, CRC(8fbec1a4) SHA1(71cbdb25470b5a2ca7e80c92f12fc47e28085793) )
r5891r5892
10471081   ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 )   // tile data; mapped at 0x80000 on CPUB
10481082
10491083   ROM_REGION( 0x20000, "konami", 0 )    // samples
1050   ROM_LOAD( "785_f01.5a",         0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
1084   ROM_LOAD( "785_f01.5a", 0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
10511085
10521086   ROM_REGION( 0x20000, "upd", 0 )    // samples
1053   ROM_LOAD( "785_f02.7c",         0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
1087   ROM_LOAD( "785_f02.7c", 0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
10541088ROM_END
10551089
10561090ROM_START( gradius2b )
r5891r5892
10671101   ROM_LOAD16_BYTE( "785_p12.8s",   0x20001, 0x10000, CRC(38ea402a) SHA1(90ff2bd71435988cde967704ce3b1401de206683) )
10681102
10691103   ROM_REGION( 0x10000, "audiocpu", 0 )    // Z80 code (sound CPU)
1070   ROM_LOAD( "785_g03.10a",      0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
1104   ROM_LOAD( "785_g03.10a", 0x00000,  0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) )
10711105
10721106   ROM_REGION( 0x4000, "gfx1", 0 )
1073   ROM_LOAD( "785_g14.d8",         0x0000, 0x4000, CRC(9dcdad9d) SHA1(22f457408b453a71b7e91974aee1b1e735ff887f) ) // characters
1107   ROM_LOAD( "785_g14.d8", 0x0000, 0x4000, CRC(9dcdad9d) SHA1(22f457408b453a71b7e91974aee1b1e735ff887f) ) /* Title screen graphics & characters */
10741108
10751109   ROM_REGION16_BE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
10761110   ROM_LOAD16_WORD( "785f17.p16",   0x000000, 0x80000, CRC(8fbec1a4) SHA1(71cbdb25470b5a2ca7e80c92f12fc47e28085793) )
r5891r5892
10811115   ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 )   // tile data; mapped at 0x80000 on CPUB
10821116
10831117   ROM_REGION( 0x20000, "konami", 0 )    // samples
1084   ROM_LOAD( "785_f01.5a",         0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
1118   ROM_LOAD( "785_f01.5a", 0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) )
10851119
10861120   ROM_REGION( 0x20000, "upd", 0 )    // samples
1087   ROM_LOAD( "785_f02.7c",         0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
1121   ROM_LOAD( "785_f02.7c", 0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) )
10881122ROM_END
10891123
10901124ROM_START( fround )
r5891r5892
10931127   ROM_LOAD16_BYTE( "870_m20.bin",   0x00001, 0x20000, CRC(b1c79d6a) SHA1(76e95e87eaa96ba694675fde7706540c584a36fb) )
10941128
10951129   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
1096   ROM_LOAD( "870_f03.10a",      0x00000,  0x8000, CRC(a645c727) SHA1(e173e79130f187d090766664f1c478d47062749c) )
1130   ROM_LOAD( "870_f03.10a", 0x00000,  0x8000, CRC(a645c727) SHA1(e173e79130f187d090766664f1c478d47062749c) )
10971131
10981132   ROM_REGION( 0x4000, "gfx1", 0 )
1099   ROM_LOAD( "870_f14.d8",         0x0000, 0x4000, CRC(c9b46615) SHA1(c0cddb1af47b8e0865055624cf4e89a111ac1b0f) ) // characters
1133   ROM_LOAD( "870_f14.d8", 0x0000, 0x4000, CRC(c9b46615) SHA1(c0cddb1af47b8e0865055624cf4e89a111ac1b0f) ) /* Title screen graphics & characters */
11001134
11011135   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
1102   ROM_LOAD16_WORD("870c18.p18",      0x000000, 0x80000, CRC(07927fe8) SHA1(0ab5e0e785347fbed5c4b930a32876d6ce2bef4a) )
1103   ROM_LOAD16_WORD("870c17.p16",      0x080000, 0x80000, CRC(2bc99ff8) SHA1(9a06502317a71ca5662b79aedf47379b8e5434a9) )
1104   ROM_LOAD16_WORD("870c16.p15",      0x100000, 0x80000, CRC(41df6a1b) SHA1(32e0fdeb53628d18adde851e4496dd01ac6ec68f) )
1105   ROM_LOAD16_WORD("870c15.p13",      0x180000, 0x80000, CRC(8c9281df) SHA1(5e3d80be414db108d5363d0ea1b74021ba942c33) )
1136   ROM_LOAD16_WORD("870c18.p18", 0x000000, 0x80000, CRC(07927fe8) SHA1(0ab5e0e785347fbed5c4b930a32876d6ce2bef4a) )
1137   ROM_LOAD16_WORD("870c17.p16", 0x080000, 0x80000, CRC(2bc99ff8) SHA1(9a06502317a71ca5662b79aedf47379b8e5434a9) )
1138   ROM_LOAD16_WORD("870c16.p15", 0x100000, 0x80000, CRC(41df6a1b) SHA1(32e0fdeb53628d18adde851e4496dd01ac6ec68f) )
1139   ROM_LOAD16_WORD("870c15.p13", 0x180000, 0x80000, CRC(8c9281df) SHA1(5e3d80be414db108d5363d0ea1b74021ba942c33) )
11061140
11071141   ROM_REGION( 0x20000, "konami", 0 )    // samples
1108   ROM_LOAD( "870_c01.5a",         0x00000, 0x20000, CRC(6af96546) SHA1(63b49b28c0f2ef8f52bc4c5955ad6a633dd553cf) )
1142   ROM_LOAD( "870_c01.5a", 0x00000, 0x20000, CRC(6af96546) SHA1(63b49b28c0f2ef8f52bc4c5955ad6a633dd553cf) )
11091143
11101144   ROM_REGION( 0x20000, "upd", 0 )    // samples
1111   ROM_LOAD( "870_c02.7c",         0x00000, 0x20000, CRC(54e12c6d) SHA1(8171441aeb1a1dc4d65fae59c7c217f992f70cbc) )
1145   ROM_LOAD( "870_c02.7c", 0x00000, 0x20000, CRC(54e12c6d) SHA1(8171441aeb1a1dc4d65fae59c7c217f992f70cbc) )
11121146ROM_END
11131147
11141148ROM_START( froundl )
r5891r5892
11171151   ROM_LOAD16_BYTE( "870_l20.bin",   0x00001, 0x20000, CRC(0ce9786f) SHA1(0fb0eef999ed09dd50eed403255887103fc35461) )
11181152
11191153   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
1120   ROM_LOAD( "870_f03.10a",      0x00000,  0x8000, CRC(a645c727) SHA1(e173e79130f187d090766664f1c478d47062749c) )
1154   ROM_LOAD( "870_f03.10a", 0x00000,  0x8000, CRC(a645c727) SHA1(e173e79130f187d090766664f1c478d47062749c) )
11211155
11221156   ROM_REGION( 0x4000, "gfx1", 0 )
1123   ROM_LOAD( "870_f14.d8",         0x0000, 0x4000, CRC(c9b46615) SHA1(c0cddb1af47b8e0865055624cf4e89a111ac1b0f) ) // characters
1157   ROM_LOAD( "870_f14.d8", 0x0000, 0x4000, CRC(c9b46615) SHA1(c0cddb1af47b8e0865055624cf4e89a111ac1b0f) ) /* Title screen graphics & characters */
11241158
11251159   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
1126   ROM_LOAD16_WORD("870c18.p18",      0x000000, 0x80000, CRC(07927fe8) SHA1(0ab5e0e785347fbed5c4b930a32876d6ce2bef4a) )
1127   ROM_LOAD16_WORD("870c17.p16",      0x080000, 0x80000, CRC(2bc99ff8) SHA1(9a06502317a71ca5662b79aedf47379b8e5434a9) )
1128   ROM_LOAD16_WORD("870c16.p15",      0x100000, 0x80000, CRC(41df6a1b) SHA1(32e0fdeb53628d18adde851e4496dd01ac6ec68f) )
1129   ROM_LOAD16_WORD("870c15.p13",      0x180000, 0x80000, CRC(8c9281df) SHA1(5e3d80be414db108d5363d0ea1b74021ba942c33) )
1160   ROM_LOAD16_WORD("870c18.p18", 0x000000, 0x80000, CRC(07927fe8) SHA1(0ab5e0e785347fbed5c4b930a32876d6ce2bef4a) )
1161   ROM_LOAD16_WORD("870c17.p16", 0x080000, 0x80000, CRC(2bc99ff8) SHA1(9a06502317a71ca5662b79aedf47379b8e5434a9) )
1162   ROM_LOAD16_WORD("870c16.p15", 0x100000, 0x80000, CRC(41df6a1b) SHA1(32e0fdeb53628d18adde851e4496dd01ac6ec68f) )
1163   ROM_LOAD16_WORD("870c15.p13", 0x180000, 0x80000, CRC(8c9281df) SHA1(5e3d80be414db108d5363d0ea1b74021ba942c33) )
11301164
11311165   ROM_REGION( 0x20000, "konami", 0 )    // samples
1132   ROM_LOAD( "870_c01.5a",         0x00000, 0x20000, CRC(6af96546) SHA1(63b49b28c0f2ef8f52bc4c5955ad6a633dd553cf) )
1166   ROM_LOAD( "870_c01.5a", 0x00000, 0x20000, CRC(6af96546) SHA1(63b49b28c0f2ef8f52bc4c5955ad6a633dd553cf) )
11331167
11341168   ROM_REGION( 0x20000, "upd", 0 )   // samples
1135   ROM_LOAD( "870_c02.7c",         0x00000, 0x20000, CRC(54e12c6d) SHA1(8171441aeb1a1dc4d65fae59c7c217f992f70cbc) )
1169   ROM_LOAD( "870_c02.7c", 0x00000, 0x20000, CRC(54e12c6d) SHA1(8171441aeb1a1dc4d65fae59c7c217f992f70cbc) )
11361170ROM_END
11371171
11381172ROM_START( hpuncher )
r5891r5892
11471181   ROM_LOAD16_BYTE( "870_h06.8n",   0x00001, 0x10000, CRC(696ba702) SHA1(e35c9aeab4305d828a347eaddf4abc806a889fa3) )
11481182
11491183   ROM_REGION( 0x10000, "audiocpu", 0 )   // Z80 code (sound CPU)
1150   ROM_LOAD( "870_g03.10a",      0x00000,  0x8000, CRC(db9c10c8) SHA1(b2ec4d6800a4ab00dfcc8d3cd4abf9b9d7c5544a) )
1184   ROM_LOAD( "870_g03.10a", 0x00000,  0x8000, CRC(db9c10c8) SHA1(b2ec4d6800a4ab00dfcc8d3cd4abf9b9d7c5544a) )
11511185
11521186   ROM_REGION( 0x4000, "gfx1", 0 )
1153   ROM_LOAD( "870_f14.d8",         0x0000, 0x4000, CRC(c9b46615) SHA1(c0cddb1af47b8e0865055624cf4e89a111ac1b0f) ) // characters
1187   ROM_LOAD( "870_f14.d8", 0x0000, 0x4000, CRC(c9b46615) SHA1(c0cddb1af47b8e0865055624cf4e89a111ac1b0f) ) /* Title screen graphics & characters */
11541188
11551189   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
1156   ROM_LOAD16_WORD("870c17.p16",      0x000000, 0x80000, CRC(2bc99ff8) SHA1(9a06502317a71ca5662b79aedf47379b8e5434a9) )
1157   ROM_LOAD16_WORD("870c18.p18",      0x080000, 0x80000, CRC(07927fe8) SHA1(0ab5e0e785347fbed5c4b930a32876d6ce2bef4a) )
1158   ROM_LOAD16_WORD("870c15.p13",      0x100000, 0x80000, CRC(8c9281df) SHA1(5e3d80be414db108d5363d0ea1b74021ba942c33) )
1159   ROM_LOAD16_WORD("870c16.p15",      0x180000, 0x80000, CRC(41df6a1b) SHA1(32e0fdeb53628d18adde851e4496dd01ac6ec68f) )
1190   ROM_LOAD16_WORD("870c17.p16", 0x000000, 0x80000, CRC(2bc99ff8) SHA1(9a06502317a71ca5662b79aedf47379b8e5434a9) )
1191   ROM_LOAD16_WORD("870c18.p18", 0x080000, 0x80000, CRC(07927fe8) SHA1(0ab5e0e785347fbed5c4b930a32876d6ce2bef4a) )
1192   ROM_LOAD16_WORD("870c15.p13", 0x100000, 0x80000, CRC(8c9281df) SHA1(5e3d80be414db108d5363d0ea1b74021ba942c33) )
1193   ROM_LOAD16_WORD("870c16.p15", 0x180000, 0x80000, CRC(41df6a1b) SHA1(32e0fdeb53628d18adde851e4496dd01ac6ec68f) )
11601194
11611195   ROM_REGION( 0x20000, "konami", 0 )   // samples
1162   ROM_LOAD( "870_c01.5a",         0x00000, 0x20000, CRC(6af96546) SHA1(63b49b28c0f2ef8f52bc4c5955ad6a633dd553cf) )
1196   ROM_LOAD( "870_c01.5a", 0x00000, 0x20000, CRC(6af96546) SHA1(63b49b28c0f2ef8f52bc4c5955ad6a633dd553cf) )
11631197
11641198   ROM_REGION( 0x20000, "upd", 0 )    // samples
1165   ROM_LOAD( "870_c02.7c",         0x00000, 0x20000, CRC(54e12c6d) SHA1(8171441aeb1a1dc4d65fae59c7c217f992f70cbc) )
1199   ROM_LOAD( "870_c02.7c", 0x00000, 0x20000, CRC(54e12c6d) SHA1(8171441aeb1a1dc4d65fae59c7c217f992f70cbc) )
11661200ROM_END
11671201
11681202ROM_START( miaj )
11691203   ROM_REGION( 0x40000, "maincpu", 0 )    // 68000 code (CPU A)
1170   ROM_LOAD16_BYTE("808_r05.6n",      0x00000, 0x10000, CRC(91fd83f4) SHA1(12cba5828d1d752efe4fc1972bed0205ac277850) )
1171   ROM_LOAD16_BYTE("808_r04.4n",      0x00001, 0x10000, CRC(f1c8c597) SHA1(4e8e87aedc9dac4ed05816989210de49f4dd60d2) )
1172   ROM_LOAD16_BYTE("808_r09.6r",      0x20000, 0x10000, CRC(f74d4467) SHA1(2b2491ee7ece979f2ec849075b0c30b6c1ed6bae) )
1173   ROM_LOAD16_BYTE("808_r08.4r",      0x20001, 0x10000, CRC(26f21704) SHA1(123cb2e4bcb25d82faa75e4505f9859c10bca754) )
1204   ROM_LOAD16_BYTE("808_r05.6n", 0x00000, 0x10000, CRC(91fd83f4) SHA1(12cba5828d1d752efe4fc1972bed0205ac277850) )
1205   ROM_LOAD16_BYTE("808_r04.4n", 0x00001, 0x10000, CRC(f1c8c597) SHA1(4e8e87aedc9dac4ed05816989210de49f4dd60d2) )
1206   ROM_LOAD16_BYTE("808_r09.6r", 0x20000, 0x10000, CRC(f74d4467) SHA1(2b2491ee7ece979f2ec849075b0c30b6c1ed6bae) )
1207   ROM_LOAD16_BYTE("808_r08.4r", 0x20001, 0x10000, CRC(26f21704) SHA1(123cb2e4bcb25d82faa75e4505f9859c10bca754) )
11741208
11751209   ROM_REGION( 0x40000, "sub", 0 )    // 68000 code (CPU B)
1176   ROM_LOAD16_BYTE("808_e07.10n",   0x00000, 0x10000, CRC(297bdcea) SHA1(41ed650cbc4f56777fa352812e9a560554459f90) )
1177   ROM_LOAD16_BYTE("808_e06.8n",      0x00001, 0x10000, CRC(8f576b33) SHA1(cd8c9a45626c30571ca12d0241cccc092c0903a0) )
1178   ROM_LOAD16_BYTE("808_e13.10s",   0x20000, 0x10000, CRC(1fa708f4) SHA1(9511a19f50fb61571c2986c72d1a85e87b8d0495) )
1179   ROM_LOAD16_BYTE("808_e12.8s",      0x20001, 0x10000, CRC(d62f1fde) SHA1(1e55084f1294b6ac7c152fcd1800511fcab5d360) )
1210   ROM_LOAD16_BYTE("808_e07.10n", 0x00000, 0x10000, CRC(297bdcea) SHA1(41ed650cbc4f56777fa352812e9a560554459f90) )
1211   ROM_LOAD16_BYTE("808_e06.8n",  0x00001, 0x10000, CRC(8f576b33) SHA1(cd8c9a45626c30571ca12d0241cccc092c0903a0) )
1212   ROM_LOAD16_BYTE("808_e13.10s", 0x20000, 0x10000, CRC(1fa708f4) SHA1(9511a19f50fb61571c2986c72d1a85e87b8d0495) )
1213   ROM_LOAD16_BYTE("808_e12.8s",  0x20001, 0x10000, CRC(d62f1fde) SHA1(1e55084f1294b6ac7c152fcd1800511fcab5d360) )
11801214
11811215   ROM_REGION( 0x10000, "audiocpu", 0 )    // Z80 code (sound CPU)
1182   ROM_LOAD( "808_e03.10a",      0x00000,  0x8000, CRC(3d93a7cd) SHA1(dcdd327e78f32436b276d0666f62a5b733b296e8) )
1216   ROM_LOAD( "808_e03.10a", 0x00000,  0x8000, CRC(3d93a7cd) SHA1(dcdd327e78f32436b276d0666f62a5b733b296e8) )
11831217
11841218   ROM_REGION( 0x4000, "gfx1", 0 )
1185   ROM_LOAD("808_e14.d8",         0x0000, 0x4000, CRC(b9d36525) SHA1(53291c4911d7e1a5110539e4c57a11d0d530dc6f) ) // characters
1219   ROM_LOAD("808_e14.d8", 0x0000, 0x4000, CRC(b9d36525) SHA1(53291c4911d7e1a5110539e4c57a11d0d530dc6f) ) /* Title screen graphics & characters */
11861220
11871221   ROM_REGION16_LE( 0x200000, "gfx2", 0 )   // gfx data used at runtime
1188   ROM_LOAD16_WORD("808d17.p16",      0x000000, 0x80000, CRC(d1299082) SHA1(c3c07b0517e7428ccd1cdf9e15aaf16d98e7c4cd) )
1189   ROM_LOAD16_WORD("808d15.p13",      0x100000, 0x80000, CRC(2b22a6b6) SHA1(8e1af0627a4eac045128c4096e2cfb59c3d2f5ef) )
1222   ROM_LOAD16_WORD("808d17.p16", 0x000000, 0x80000, CRC(d1299082) SHA1(c3c07b0517e7428ccd1cdf9e15aaf16d98e7c4cd) )
1223   ROM_LOAD16_WORD("808d15.p13", 0x100000, 0x80000, CRC(2b22a6b6) SHA1(8e1af0627a4eac045128c4096e2cfb59c3d2f5ef) )
11901224
11911225   ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 )    // tile data; mapped at 0x80000 on CPUB
11921226
11931227   ROM_REGION( 0x20000, "konami", 0 )    // samples
1194   ROM_LOAD("808_d01.5a",         0x00000, 0x20000, CRC(fd4d37c0) SHA1(ef91c6e7bb57c27a9a51729fffd1bfe3e806fb61) )
1228   ROM_LOAD("808_d01.5a", 0x00000, 0x20000, CRC(fd4d37c0) SHA1(ef91c6e7bb57c27a9a51729fffd1bfe3e806fb61) )
11951229
11961230   ROM_REGION( 0x20000, "upd", ROMREGION_ERASE00 )    // samples
11971231ROM_END
r5891r5892
12101244   ROM_LOAD16_BYTE( "903_e12.8s",   0x20001, 0x10000, CRC(883e3097) SHA1(fe0fa1a2881a67223d741c400bb8c1a0c67946c1) )
12111245
12121246   ROM_REGION( 0x10000, "audiocpu", 0 )    // Z80 code (sound CPU)
1213   ROM_LOAD( "903_d03.10a",      0x00000,  0x8000, CRC(455e855a) SHA1(cfdd54a5071862653ee94c0455301f4a7245fbd8) )
1247   ROM_LOAD( "903_d03.10a", 0x00000,  0x8000, CRC(455e855a) SHA1(cfdd54a5071862653ee94c0455301f4a7245fbd8) )
12141248
12151249   ROM_REGION( 0x4000, "gfx1", 0 )
1216   ROM_LOAD( "903_e14.d8",         0x0000, 0x4000, CRC(ddbebbd5) SHA1(df532f19a08cabb28d693e4cd445c47c9e35e5ff) ) // characters
1250   ROM_LOAD( "903_e14.d8", 0x0000, 0x4000, CRC(ddbebbd5) SHA1(df532f19a08cabb28d693e4cd445c47c9e35e5ff) ) /* Title screen graphics & characters */
12171251
12181252   ROM_REGION( 0x200000, "gfx2", ROMREGION_ERASE00 )   // gfx data used at runtime
12191253   // unpopulated
r5891r5892
12741308GAME( 1987, majuu,    devilw,   devilw,      devilw,   twin16,   ROT0, "Konami", "Majuu no Ohkoku", GAME_SUPPORTS_SAVE )
12751309GAME( 1987, darkadv,  devilw,   devilw,      darkadv,  twin16,   ROT0, "Konami", "Dark Adventure", GAME_SUPPORTS_SAVE )
12761310GAME( 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 )
12771312GAME( 1988, gradius2, vulcan,   twin16,      gradius2, twin16,   ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan New Ver.)", GAME_SUPPORTS_SAVE )
12781313GAME( 1988, gradius2a,vulcan,   twin16,      vulcan,   twin16,   ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan Old Ver.)", GAME_SUPPORTS_SAVE )
12791314GAME( 1988, gradius2b,vulcan,   twin16,      vulcan,   twin16,   ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan Older Ver.)", GAME_SUPPORTS_SAVE )
src/mame/drivers/nmk16.c
r5891r5892
44914491   len = memory_region_length(machine, "maincpu");
44924492   for (A = 0;A < len;A += 2)
44934493   {
4494#ifdef LSB_FIRST
4495      UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_tdragonb[0]);
4496      rom[A+1] = tmp >> 8;
4497      rom[A] = tmp & 0xff;
4498#else
4499      UINT16 tmp = decode_word( rom[A]*256 + rom[A+1], decode_data_tdragonb[0]);
4500      rom[A] = tmp >> 8;
4501      rom[A+1] = tmp & 0xff;
4502#endif
4494      int h = A+NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = A+NATIVE_ENDIAN_VALUE_LE_BE(0,1);
4495      UINT16 tmp = decode_word( rom[h]*256 + rom[l], decode_data_tdragonb[0]);
4496      rom[h] = tmp >> 8;
4497      rom[l] = tmp & 0xff;
45034498   }
45044499
45054500   rom = memory_region(machine, "gfx2");
src/osd/windows/windows.mak
r5891r5892
157157   @echo Compiling $<...
158158   @cl.exe /nologo /O1 -D_CRT_SECURE_NO_DEPRECATE -c $< /Fo$@
159159
160OSDCLEAN = msvcclean
161
162msvcclean:
163   @echo Deleting Visual Studio specific files...
164   $(RM) *.pdb
165   $(RM) *.lib
166   $(RM) *.exp
167
160168endif
161169endif
162170
src/emu/debug/debugcpu.c
r5891r5892
17791779   /* shortcut if we have a custom routine */
17801780   if (info->readop != NULL)
17811781   {
1782      UINT64 result;
1783
17841782      /* return early if we got the result directly */
17851783      memory_set_debugger_access(space, global->debugger_access = TRUE);
1786      if ((*info->readop)(space->cpu, address, size, &result))
1784      if ((*info->readop)(space->cpu, address, size, &result2))
17871785      {
17881786         memory_set_debugger_access(space, global->debugger_access = FALSE);
1789         return result;
1787         return result2;
17901788      }
17911789   }
17921790
src/emu/debug/debugcmd.c
r5891r5892
6060   cheat_map *      cheatmap;
6161   UINT8         undo;
6262   UINT8         signed_cheat;
63   UINT8         swapped_cheat;
6364};
6465
6566
r5891r5892
170171   }
171172   return value;
172173}
174/*-------------------------------------------------
175    cheat_byte_swap - swap a value
176-------------------------------------------------*/
173177
178INLINE UINT64 cheat_byte_swap(const cheat_system *cheatsys, UINT64 value)
179{
180   if (cheatsys->swapped_cheat)
181   {
182      switch (cheatsys->width)
183      {
184         case 2:   value = ((value >> 8) & 0x00ff) | ((value << 8) & 0xff00);   break;
185         case 4:   value = ((value >> 24) & 0x000000ff) | ((value >> 8) & 0x0000ff00) | ((value << 8) & 0x00ff0000) | ((value << 24) & 0xff000000);   break;
186         case 8:   value = ((value >> 56) & U64(0x00000000000000ff)) | ((value >> 40) & U64(0x000000000000ff00)) | ((value >> 24) & U64(0x0000000000ff0000)) | ((value >> 8) & U64(0x00000000ff000000)) |
187                     ((value << 8) & U64(0x000000ff00000000)) | ((value << 24) & U64(0x0000ff0000000000)) | ((value << 40) & U64(0x00ff000000000000)) | ((value << 56) & U64(0xff00000000000000));   break;
188      }
189   }
190   return value;
191}
174192
175193/*-------------------------------------------------
176194    cheat_read_extended - read a value from memory
177195    in the given address space, sign-extending
178    if necessary
196    and swapping if necessary
179197-------------------------------------------------*/
180198
181199INLINE UINT64 cheat_read_extended(const cheat_system *cheatsys, const address_space *space, offs_t address)
182200{
183   return cheat_sign_extend(cheatsys, debug_read_memory(space, address, cheatsys->width, TRUE));
201   return cheat_sign_extend(cheatsys, cheat_byte_swap(cheatsys, debug_read_memory(space, address, cheatsys->width, TRUE)));
184202}
185203
186204
r5891r5892
17031721   {
17041722      if (params > 0)
17051723      {
1706         if (!strcmp(param[0], "sb"))
1707         {
1708            cheat.width = 1;
1724         char *srtpnt = (char*)param[0];
1725
1726         if (*srtpnt == 's')
17091727            cheat.signed_cheat = TRUE;
1710         }
1711         else if (!strcmp(param[0], "sw"))
1728         else if (*srtpnt == 'u')
1729            cheat.signed_cheat = FALSE;
1730         else
17121731         {
1713            cheat.width = 2;
1714            cheat.signed_cheat = TRUE;
1732            debug_console_printf(machine, "Invalid sign: expected s or u\n");
1733            return;
17151734         }
1716         else if (!strcmp(param[0], "sd"))
1717         {
1718            cheat.width = 4;
1719            cheat.signed_cheat = TRUE;
1720         }
1721         else if (!strcmp(param[0], "sq"))
1722         {
1723            cheat.width = 8;
1724            cheat.signed_cheat = TRUE;
1725         }
1726         else if (!strcmp(param[0], "ub"))
1727         {
1735
1736         if (*(++srtpnt) == 'b')
17281737            cheat.width = 1;
1729            cheat.signed_cheat = FALSE;
1730         }
1731         else if (!strcmp(param[0], "uw"))
1732         {
1738         else if (*srtpnt == 'w')
17331739            cheat.width = 2;
1734            cheat.signed_cheat = FALSE;
1735         }
1736         else if (!strcmp(param[0], "ud"))
1737         {
1740         else if (*srtpnt == 'd')
17381741            cheat.width = 4;
1739            cheat.signed_cheat = FALSE;
1740         }
1741         else if (!strcmp(param[0], "uq"))
1742         {
1742         else if (*srtpnt == 'q')
17431743            cheat.width = 8;
1744            cheat.signed_cheat = FALSE;
1745         }
17461744         else
17471745         {
1748            debug_console_printf(machine, "Invalid type: expected ub, uw, ud, uq, sb, sw, sd or sq\n");
1746            debug_console_printf(machine, "Invalid width: expected b, w, d or q\n");
17491747            return;
17501748         }
1749
1750         if (*(++srtpnt) == 's')
1751            cheat.swapped_cheat = TRUE;
1752         else
1753            cheat.swapped_cheat = FALSE;
17511754      }
17521755      else
17531756      {
17541757         cheat.width = 1;
17551758         cheat.signed_cheat = FALSE;
1759         cheat.swapped_cheat = FALSE;
17561760      }
17571761   }
17581762
r5891r5892
20182022{
20192023   char spaceletter, sizeletter;
20202024   const address_space *space;
2025   const device_config *cpu;
20212026   UINT32 active_cheat = 0;
20222027   UINT64 cheatindex;
20232028   UINT64 sizemask;
r5891r5892
20262031   if (!debug_command_parameter_cpu_space(machine, &cheat.cpu, ADDRESS_SPACE_PROGRAM, &space))
20272032      return;
20282033
2034   if (!debug_command_parameter_cpu(machine, &cheat.cpu, &cpu))
2035      return;
2036
20292037   if (params > 0)
20302038      f = fopen(param[0], "w");
20312039
r5891r5892
20512059   {
20522060      if (cheat.cheatmap[cheatindex].state == 1)
20532061      {
2054         UINT64 value = cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset) & sizemask;
2062         UINT64 value = cheat_byte_swap(&cheat, cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset)) & sizemask;
20552063         offs_t address = memory_byte_to_address(space, cheat.cheatmap[cheatindex].offset);
20562064
20572065         if (params > 0)
r5891r5892
20592067            active_cheat++;
20602068            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));
20612069            fprintf(f, "    <script state=\"run\">\n");
2062            fprintf(f, "      <action>maincpu.%c%c@%s=%s</action>\n", spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat.cheatmap[cheatindex].first_value & sizemask, cheat.width * 2));
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));
20632071            fprintf(f, "    </script>\n");
20642072            fprintf(f, "  </cheat>\n\n");
20652073         }
20662074         else
2067            debug_console_printf(machine, "Address=%s Start=%s Current=%s\n", core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat.cheatmap[cheatindex].first_value & sizemask, cheat.width * 2), core_i64_hex_format(value, cheat.width * 2));
2075            debug_console_printf(machine, "Address=%s Start=%s Current=%s\n", core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2), core_i64_hex_format(value, cheat.width * 2));
20682076      }
20692077   }
20702078   if (params > 0)
src/emu/debug/debughlp.c
r5891r5892
215215      "  cheatnext <condition>[,<comparisonvalue>] -- continue cheat search comparing with the the last value\n"
216216      "  cheatnextf <condition>[,<comparisonvalue>] -- continue cheat search comparing with the the first value\n"
217217      "  cheatlist [<filename>] -- show the list of cheat search matches or save them to <filename>\n"
218      "  cheatundo [<wpnum>] -- undo the last cheat search (state only)\n"
218      "  cheatundo -- undo the last cheat search (state only)\n"
219219   },
220220   {
221221      "do",
r5891r5892
10471047   {
10481048      "cheatinit",
10491049      "\n"
1050      "  cheatinit [<type>,[<address>,<length>[,<cpu>]]]\n"
1050      "  cheatinit [<sign><width><swap>,[<address>,<length>[,<cpu>]]]\n"
10511051      "\n"
10521052      "The cheatinit command initializes the cheat search to the selected memory area.\n"
10531053      "If no parameter is specified the cheat search is initialized to all changeable memory of the main cpu.\n"
1054      "Possible <type>:\n"
1055      "  ub\n"
1056      "   8 bit unsigned int\n"
1057      "  uw\n"
1058      "   16 bit unsigned int\n"
1059      "  ud\n"
1060      "   32 bit unsigned int\n"
1061      "  uq\n"
1062      "   64 bit unsigned int\n"
1063      "  sb\n"
1064      "   8 bit signed int\n"
1065      "  sw\n"
1066      "   16 bit signed int\n"
1067      "  sd\n"
1068      "   32 bit signed int\n"
1069      "  sq\n"
1070      "   64 bit signed int\n"
1054      "<sign> can be s(signed) or u(unsigned)\n"
1055      "<width> can be b(8 bit), w(16 bit), d(32 bit) or q(64 bit)\n"
1056      "<swap> append s for swapped search\n"
10711057      "\n"
10721058      "Examples:\n"
10731059      "\n"
r5891r5892
10761062      "\n"
10771063      "cheatinit sw,0x2000,0x1000,1\n"
10781064      "  Initialize the cheat search with width of 2 byte in signed mode from 0x2000 to 0x3000 of the second CPU.\n"
1065      "\n"
1066      "cheatinit uds,0x0000,0x1000\n"
1067      "  Initialize the cheat search with width of 4 byte swapped from 0x0000 to 0x1000.\n"
10791068   },
10801069   {
10811070      "cheatrange",
r5891r5892
11921181      "  Save the current matches to cheat.txt.\n"
11931182   },
11941183   {
1184      "cheatundo",
1185      "\n"
11951186      "  cheatundo\n"
11961187      "\n"
11971188      "Undo the results of the last search.\n"
src/emu/cpu/v30mz/v30mz.h
r5891r5892
33
44#define NEC_NMI_INT_VECTOR 2
55
6#ifdef LSB_FIRST
7typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,IXL,IXH,IYL,IYH } BREGS;
8#else
9typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,IXH,IXL,IYH,IYL } BREGS;
10#endif
6typedef enum {
7   AL = NATIVE_ENDIAN_VALUE_LE_BE(0x0, 0x1),
8   AH = NATIVE_ENDIAN_VALUE_LE_BE(0x1, 0x0),
9   CL = NATIVE_ENDIAN_VALUE_LE_BE(0x2, 0x3),
10   CH = NATIVE_ENDIAN_VALUE_LE_BE(0x3, 0x2),
11   DL = NATIVE_ENDIAN_VALUE_LE_BE(0x4, 0x5),
12   DH = NATIVE_ENDIAN_VALUE_LE_BE(0x5, 0x4),
13   BL = NATIVE_ENDIAN_VALUE_LE_BE(0x6, 0x7),
14   BH = NATIVE_ENDIAN_VALUE_LE_BE(0x7, 0x6),
15  SPL = NATIVE_ENDIAN_VALUE_LE_BE(0x8, 0x9),
16  SPH = NATIVE_ENDIAN_VALUE_LE_BE(0x9, 0x8),
17  BPL = NATIVE_ENDIAN_VALUE_LE_BE(0xa, 0xb),
18  BPH = NATIVE_ENDIAN_VALUE_LE_BE(0xb, 0xa),
19  IXL = NATIVE_ENDIAN_VALUE_LE_BE(0xc, 0xd),
20  IXH = NATIVE_ENDIAN_VALUE_LE_BE(0xd, 0xc),
21  IYL = NATIVE_ENDIAN_VALUE_LE_BE(0xe, 0xf),
22  IYH = NATIVE_ENDIAN_VALUE_LE_BE(0xf, 0xe)
23} BREGS;
1124
25
1226/* parameter x = result, y = source 1, z = source 2 */
1327
1428#define SetTF(x)      (cpustate->TF = (x))
src/emu/cpu/m68000/m68kcpu.h
r5891r5892
256256
257257
258258/* Address error */
259/* sigjmp() on Mac OS X and *BSD in general saves signal contexts and is super-slow, use sigsetjmp() to tell it not to */
260#ifdef _BSD_SETJMP_H
259261#define m68ki_set_address_error_trap(m68k) \
262   if(sigsetjmp(m68k->aerr_trap, 0) != 0) \
263   { \
264      m68ki_exception_address_error(m68k); \
265      if(m68k->stopped) \
266      { \
267         if (m68k->remaining_cycles > 0) \
268            m68k->remaining_cycles = 0; \
269         return m68k->initial_cycles; \
270      } \
271   }
272
273#define m68ki_check_address_error(m68k, ADDR, WRITE_MODE, FC) \
274   if((ADDR)&1) \
275   { \
276      m68k->aerr_address = ADDR; \
277      m68k->aerr_write_mode = WRITE_MODE; \
278      m68k->aerr_fc = FC; \
279      siglongjmp(m68k->aerr_trap, 1); \
280   }
281#else
282#define m68ki_set_address_error_trap(m68k) \
260283   if(setjmp(m68k->aerr_trap) != 0) \
261284   { \
262285      m68ki_exception_address_error(m68k); \
r5891r5892
276299      m68k->aerr_fc = FC; \
277300      longjmp(m68k->aerr_trap, 1); \
278301   }
302#endif
279303
280304
281
282305/* -------------------------- EA / Operand Access ------------------------- */
283306
284307/*
r5891r5892
567590   int  reset_cycles;
568591   UINT32 tracing;
569592
593#ifdef _BSD_SETJMP_H
594   sigjmp_buf aerr_trap;
595#else
570596   jmp_buf aerr_trap;
597#endif
571598   UINT32    aerr_address;
572599   UINT32    aerr_write_mode;
573600   UINT32    aerr_fc;
src/emu/cpu/i86/i86priv.h
r5891r5892
1818#define TRUE 1
1919#endif
2020
21#ifdef LSB_FIRST
22typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,SIL,SIH,DIL,DIH } BREGS;
23#else
24typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,SIH,SIL,DIH,DIL } BREGS;
25#endif
2621
22typedef enum {
23   AL = NATIVE_ENDIAN_VALUE_LE_BE(0x0, 0x1),
24   AH = NATIVE_ENDIAN_VALUE_LE_BE(0x1, 0x0),
25   CL = NATIVE_ENDIAN_VALUE_LE_BE(0x2, 0x3),
26   CH = NATIVE_ENDIAN_VALUE_LE_BE(0x3, 0x2),
27   DL = NATIVE_ENDIAN_VALUE_LE_BE(0x4, 0x5),
28   DH = NATIVE_ENDIAN_VALUE_LE_BE(0x5, 0x4),
29   BL = NATIVE_ENDIAN_VALUE_LE_BE(0x6, 0x7),
30   BH = NATIVE_ENDIAN_VALUE_LE_BE(0x7, 0x6),
31  SPL = NATIVE_ENDIAN_VALUE_LE_BE(0x8, 0x9),
32  SPH = NATIVE_ENDIAN_VALUE_LE_BE(0x9, 0x8),
33  BPL = NATIVE_ENDIAN_VALUE_LE_BE(0xa, 0xb),
34  BPH = NATIVE_ENDIAN_VALUE_LE_BE(0xb, 0xa),
35  SIL = NATIVE_ENDIAN_VALUE_LE_BE(0xc, 0xd),
36  SIH = NATIVE_ENDIAN_VALUE_LE_BE(0xd, 0xc),
37  DIL = NATIVE_ENDIAN_VALUE_LE_BE(0xe, 0xf),
38  DIH = NATIVE_ENDIAN_VALUE_LE_BE(0xf, 0xe)
39} BREGS;
40
2741/* parameter x = result, y = source 1, z = source 2 */
2842
2943#define SetTF(x)         (cpustate->TF = (x))
src/emu/cpu/dsp56k/dsp56ops.c
r5891r5892
260260
261261      /* ADD : 011m mKKK 0rru Fuuu : A-22 */
262262      /* SUB : 011m mKKK 0rru Fuuu : A-202 */
263      if ((op & 0xe080) == 0x6000)
263      /* Note: 0x0094 check allows command to drop through to MOVE and TFR */
264      if (((op & 0xe080) == 0x6000) && ((op & 0x0094) != 0x0010))
264265      {
265266         size = dsp56k_op_addsub_2(cpustate, op_byte, &d_register, &cycle_count);
266267      }
r5891r5892
274275      {
275276         size = dsp56k_op_macr_1(cpustate, op_byte, &d_register, &cycle_count);
276277      }
278      /* TFR : 011m mKKK 0rr1 F0DD : A-212 */
279      else if ((op & 0xe094) == 0x6010)
280      {
281         size = dsp56k_op_tfr_2(cpustate, op_byte, &d_register, &cycle_count);
282      }
277283      /* MOVE : 011m mKKK 0rr1 0000 : A-128 */
278284      else if ((op & 0xe09f) == 0x6010)
279285      {
286         /* Note: The opcode encoding : 011x xxxx 0xx1 0000 (move + double memory read)
287                     is .identical. to (tfr X0,A + two parallel reads).  This sparks the notion
288                     that these 'move' opcodes don't actually exist and are just there as
289                     documentation.  Real-world examples would need to be examined to come
290                     to a satisfactory conclusion, but as it stands, tfr will override this
291                     move operation. */
280292         size = dsp56k_op_move_1(cpustate, op_byte, &d_register, &cycle_count);
281293      }
282294      /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */
r5891r5892
289301      {
290302         size = dsp56k_op_mpyr_1(cpustate, op_byte, &d_register, &cycle_count);
291303      }
292      /* TFR : 011m mKKK 0rr1 F0DD : A-212 */
293      else if ((op & 0xe094) == 0x6010)
294      {
295         size = dsp56k_op_tfr_2(cpustate, op_byte, &d_register, &cycle_count);
296      }
297304
298305      /* Now evaluate the parallel data move */
299306      execute_dual_x_memory_data_read(cpustate, op, &d_register);
r5891r5892
788795      size = dsp56k_op_debugcc(cpustate, op, &cycle_count);
789796   }
790797   /* DIV : 0001 0101 0--0 F1DD : A-76 */
791   /* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */
792798   else if ((op & 0xff94) == 0x1504)
793799   {
794800      size = dsp56k_op_div(cpustate, op, &cycle_count);
src/emu/cpu/dsp56k/dsp56dsm.c
r5891r5892
77***************************************************************************/
88
99/*
10  This disassembler has been 75% tested.  There may remain some bugs, but it disassembles
11  Polygonet Commanders' memtest code 100% accurate (to my knowledge).
10  This disassembler has been 95% verified against the docs and a different disassembler.
11  The docs list some conflicting and confusing behaviors.  These are mareked with an asterisk
12  and need to be tested on real hardware before this disassembler is considered 100% complete.
1213*/
1314
1415#include "dsp56k.h"
r5891r5892
1617/*******************/
1718/* Dasm prototypes */
1819/*******************/
19static size_t dsp56k_dasm_addsub_2   (const UINT16 op_byte, char* opcode_str, char* arg_str);
20static size_t dsp56k_dasm_mac_1      (const UINT16 op_byte, char* opcode_str, char* arg_str);
21static size_t dsp56k_dasm_macr_1   (const UINT16 op_byte, char* opcode_str, char* arg_str);
22static size_t dsp56k_dasm_move_1   (const UINT16 op_byte, char* opcode_str, char* arg_str);
23static size_t dsp56k_dasm_mpy_1      (const UINT16 op_byte, char* opcode_str, char* arg_str);
24static size_t dsp56k_dasm_mpyr_1   (const UINT16 op_byte, char* opcode_str, char* arg_str);
25static size_t dsp56k_dasm_tfr_2      (const UINT16 op_byte, char* opcode_str, char* arg_str);
20static size_t dsp56k_dasm_addsub_2   (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
21static size_t dsp56k_dasm_mac_1      (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
22static size_t dsp56k_dasm_macr_1   (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
23static size_t dsp56k_dasm_tfr_2      (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
24static size_t dsp56k_dasm_move_1   (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
25static size_t dsp56k_dasm_mpy_1      (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
26static size_t dsp56k_dasm_mpyr_1   (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
2627static size_t dsp56k_dasm_mpy_2      (const UINT16 op_byte, char* opcode_str, char* arg_str);
2728static size_t dsp56k_dasm_mac_2      (const UINT16 op_byte, char* opcode_str, char* arg_str);
2829static size_t dsp56k_dasm_clr      (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register);
r5891r5892
7980static size_t dsp56k_dasm_debugcc   (const UINT16 op, char* opcode_str, char* arg_str);
8081static size_t dsp56k_dasm_div      (const UINT16 op, char* opcode_str, char* arg_str);
8182static size_t dsp56k_dasm_dmac      (const UINT16 op, char* opcode_str, char* arg_str);
82static size_t dsp56k_dasm_do      (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str);
83static size_t dsp56k_dasm_do_1      (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str);
84static size_t dsp56k_dasm_do_2      (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str);
85static size_t dsp56k_dasm_doforever   (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str);
83static size_t dsp56k_dasm_do      (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc);
84static size_t dsp56k_dasm_do_1      (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc);
85static size_t dsp56k_dasm_do_2      (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc);
86static size_t dsp56k_dasm_doforever   (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc);
8687static size_t dsp56k_dasm_enddo      (const UINT16 op, char* opcode_str, char* arg_str);
8788static size_t dsp56k_dasm_ext      (const UINT16 op, char* opcode_str, char* arg_str);
8889static size_t dsp56k_dasm_illegal   (const UINT16 op, char* opcode_str, char* arg_str);
r5891r5892
189190/**********************************/
190191static void decode_x_memory_data_move(const UINT16 op, char* parallel_move_str);
191192static void decode_x_memory_data_move2(const UINT16 op, char* parallel_move_str, char* d_register);
192static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2);
193static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2, char* d_register);
193194static void decode_register_to_register_data_move(const UINT16 op, char* parallel_move_str, char* d_register);
194195static void decode_x_memory_data_write_and_register_data_move(const UINT16 op, char* parallel_move_str, char* parallel_move_str2);
195196static void decode_address_register_update(const UINT16 op, char* parallel_move_str);
196197static void decode_x_memory_data_move_with_short_displacement(const UINT16 op, const UINT16 op2, char* parallel_move_str);
197198
199
198200/********************/
199201/* Helper functions */
200202/********************/
r5891r5892
202204static UINT16 dsp56k_op_mask(UINT16 op, UINT16 mask);
203205static void pad_string(const int dest_length, char* string);
204206
205enum bbbType  { BBB_UPPER, BBB_MIDDLE, BBB_LOWER };
207enum bbbType  { BBB_UPPER, BBB_MIDDLE, BBB_LOWER, BBB_INVALID };
206208
207209
210
208211/*****************************/
209212/* Main disassembly function */
210213/*****************************/
r5891r5892
222225   const UINT16 op  = oprom[0] | (oprom[1] << 8);
223226   const UINT16 op2 = oprom[2] | (oprom[3] << 8);
224227
225   /* Dual X Memory Data Read : 011m mKKK -rr- ---- : A-142*/
228   /* Dual X Memory Data Read : 011m mKKK .rr. .... : A-142*/
226229   if ((op & 0xe000) == 0x6000)
227230   {
231      char d_register[32] = "";
232
228233      /* Quote: (MOVE, MAC(R), MPY(R), ADD, SUB, TFR) */
229234      UINT16 op_byte = op & 0x00ff;
230235
231236      /* ADD : 011m mKKK 0rru Fuuu : A-22 */
232237      /* SUB : 011m mKKK 0rru Fuuu : A-202 */
233      if ((op & 0xe080) == 0x6000)
238      /* Note: 0x0094 check allows command to drop through to MOVE and TFR */
239      if (((op & 0xe080) == 0x6000) && ((op & 0x0094) != 0x0010))
234240      {
235         size = dsp56k_dasm_addsub_2(op_byte, opcode_str, arg_str);
241         size = dsp56k_dasm_addsub_2(op_byte, opcode_str, arg_str, d_register);
236242      }
237243      /* MAC : 011m mKKK 1xx0 F1QQ : A-122 */
238244      else if ((op & 0xe094) == 0x6084)
239245      {
240         size = dsp56k_dasm_mac_1(op_byte, opcode_str, arg_str);
246         size = dsp56k_dasm_mac_1(op_byte, opcode_str, arg_str, d_register);
241247      }
242248      /* MACR: 011m mKKK 1--1 F1QQ : A-124 */
243249      else if ((op & 0xe094) == 0x6094)
244250      {
245         size = dsp56k_dasm_macr_1(op_byte, opcode_str, arg_str);
251         size = dsp56k_dasm_macr_1(op_byte, opcode_str, arg_str, d_register);
246252      }
253      /* TFR : 011m mKKK 0rr1 F0DD : A-212 */
254      else if ((op & 0xe094) == 0x6010)
255      {
256         size = dsp56k_dasm_tfr_2(op_byte, opcode_str, arg_str, d_register);
257      }
247258      /* MOVE : 011m mKKK 0rr1 0000 : A-128 */
248259      else if ((op & 0xe09f) == 0x6010)
249260      {
250         size = dsp56k_dasm_move_1(op_byte, opcode_str, arg_str);
261         /* Note: The opcode encoding : 011x xxxx 0xx1 0000 (move + double memory read)
262                     is .identical. to (tfr X0,A + two parallel reads).  This sparks the notion
263                     that these 'move' opcodes don't actually exist and are just there as
264                     documentation.  Real-world examples would need to be examined to come
265                     to a satisfactory conclusion, but as it stands, tfr will override this
266                     move operation. */
267         size = dsp56k_dasm_move_1(op_byte, opcode_str, arg_str, d_register);
251268      }
252269      /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */
253270      else if ((op & 0xe094) == 0x6080)
254271      {
255         size = dsp56k_dasm_mpy_1(op_byte, opcode_str, arg_str);
272         size = dsp56k_dasm_mpy_1(op_byte, opcode_str, arg_str, d_register);
256273      }
257274      /* MPYR : 011m mKKK 1--1 F0QQ : A-162 */
258275      else if ((op & 0xe094) == 0x6090)
259276      {
260         size = dsp56k_dasm_mpyr_1(op_byte, opcode_str, arg_str);
277         size = dsp56k_dasm_mpyr_1(op_byte, opcode_str, arg_str, d_register);
261278      }
262      /* TFR : 011m mKKK 0rr1 F0DD : A-212 */
263      else if ((op & 0xe094) == 0x6010)
264      {
265         size = dsp56k_dasm_tfr_2(op_byte, opcode_str, arg_str);
266      }
267279
268280      /* Now evaluate the parallel data move */
269      decode_dual_x_memory_data_read(op, parallel_move_str, parallel_move_str2);
281      decode_dual_x_memory_data_read(op, parallel_move_str, parallel_move_str2, d_register);
270282   }
271   /* X Memory Data Write and Register Data Move : 0001 011k RRDD ---- : A-140 */
283   /* X Memory Data Write and Register Data Move : 0001 011k RRDD .... : A-140 */
272284   else if ((op & 0xfe00) == 0x1600)
273285   {
274286      /* Quote: (MPY or MAC) */
r5891r5892
734746   {
735747      size = dsp56k_dasm_bscc(op, op2, opcode_str, arg_str, pc);
736748   }
737   /* BScc: 0000 0111 RR00 cccc : A-54 */
749   /* BScc : 0000 0111 RR00 cccc : A-54 */
738750   else if ((op & 0xff30) == 0x0700)
739751   {
740752      size = dsp56k_dasm_bscc_1(op, opcode_str, arg_str);
r5891r5892
765777      size = dsp56k_dasm_debugcc(op, opcode_str, arg_str);
766778   }
767779   /* DIV : 0001 0101 0--0 F1DD : A-76 */
768   /* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */
769780   else if ((op & 0xff94) == 0x1504)
770781   {
771782      size = dsp56k_dasm_div(op, opcode_str, arg_str);
r5891r5892
778789   /* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */
779790   else if (((op & 0xffe0) == 0x00c0) && ((op2 & 0x0000) == 0x0000))
780791   {
781      size = dsp56k_dasm_do(op, op2, opcode_str, arg_str);
792      size = dsp56k_dasm_do(op, op2, opcode_str, arg_str, pc);
782793   }
783794   /* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */
784795   else if (((op & 0xff00) == 0x0e00) && ((op2 & 0x0000) == 0x0000))
785796   {
786      size = dsp56k_dasm_do_1(op, op2, opcode_str, arg_str);
797      size = dsp56k_dasm_do_1(op, op2, opcode_str, arg_str, pc);
787798   }
788799   /* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */
789800   else if (((op & 0xffe0) == 0x0400) && ((op2 & 0x0000) == 0x0000))
790801   {
791      size = dsp56k_dasm_do_2(op, op2, opcode_str, arg_str);
802      size = dsp56k_dasm_do_2(op, op2, opcode_str, arg_str, pc);
792803   }
793804   /* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */
794805   else if (((op & 0xffff) == 0x0002) && ((op2 & 0x0000) == 0x0000))
795806   {
796      size = dsp56k_dasm_doforever(op, op2, opcode_str, arg_str);
807      size = dsp56k_dasm_doforever(op, op2, opcode_str, arg_str, pc);
797808   }
798809   /* ENDDO : 0000 0000 0000 1001 : A-92 */
799810   else if ((op & 0xffff) == 0x0009)
r5891r5892
10801091
10811092/* ADD : 011m mKKK 0rru Fuuu : A-22 */
10821093/* SUB : 011m mKKK 0rru Fuuu : A-202 */
1083static size_t dsp56k_dasm_addsub_2(const UINT16 op_byte, char* opcode_str, char* arg_str)
1094static size_t dsp56k_dasm_addsub_2(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
10841095{
10851096   /* TODO: How strange.  Same as SUB?  Investigate */
10861097   char D[32];
r5891r5892
10891100   decode_uuuuF_table(BITS(op_byte,0x17), BITS(op_byte,0x08), arg, S1, D);
10901101   sprintf(opcode_str, "%s", arg);
10911102   sprintf(arg_str, "%s,%s", S1, D);
1103   sprintf(d_register, "%s", D);
10921104   return 1;
10931105}
10941106
10951107/* MAC : 011m mKKK 1xx0 F1QQ : A-122 */
1096static size_t dsp56k_dasm_mac_1(const UINT16 op_byte, char* opcode_str, char* arg_str)
1108static size_t dsp56k_dasm_mac_1(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
10971109{
10981110   char D[32];
10991111   char S1[32];
11001112   char S2[32];
1101   /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */
11021113   decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D);
1114   sprintf(opcode_str, "mac");
11031115   sprintf(arg_str, "%s,%s,%s", S1, S2, D);
1104   sprintf(opcode_str, "mac");
1116   sprintf(d_register, "%s", D);
11051117   return 1;
11061118}
11071119
11081120/* MACR: 011m mKKK 1--1 F1QQ : A-124 */
1109static size_t dsp56k_dasm_macr_1(const UINT16 op_byte, char* opcode_str, char* arg_str)
1121static size_t dsp56k_dasm_macr_1(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
11101122{
11111123   char D[32];
11121124   char S1[32];
11131125   char S2[32];
1114   /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */
11151126   decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D);
1127   sprintf(opcode_str, "macr");
11161128   sprintf(arg_str, "%s,%s,%s", S1, S2, D);
1117   sprintf(opcode_str, "macr");
1129   sprintf(d_register, "%s", D);
11181130   return 1;
11191131}
11201132
1133/* TFR : 011m mKKK 0rr1 F0DD : A-212 */
1134static size_t dsp56k_dasm_tfr_2(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
1135{
1136   /* Note: This opcode collides with move_1 when F0DD is 0000.  Needs verifying on a real CPU. */
1137   char D[32];
1138   char S1[32];
1139   decode_DDF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, D);
1140   sprintf(opcode_str, "tfr");
1141   if (BITS(op_byte,0x0f) == 0x00)
1142      strcat(opcode_str, "*");   /* This asterisk is to denote that this opcode may have an error with its disassembly */
1143   sprintf(arg_str, "%s,%s", S1, D);
1144   sprintf(d_register, "%s", D);
1145   return 1;
1146}
1147
11211148/* MOVE : 011m mKKK 0rr1 0000 : A-128 */
1122static size_t dsp56k_dasm_move_1(const UINT16 op_byte, char* opcode_str, char* arg_str)
1149static size_t dsp56k_dasm_move_1(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
11231150{
1124   /* TODO: This MOVE opcode is .identical. to the TFR one.  Investigate */
1151   /* Note: This opcode collides with tfr_2 & will never be disassembled.  Needs verifying on a real CPU. */
11251152   char D[32];
11261153   char S1[32];
11271154   decode_DDF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, D);
11281155   sprintf(opcode_str, "tfr");
11291156   sprintf(arg_str, "%s,%s", S1, D);
1157   sprintf(d_register, "%s", D);
11301158   return 1;
11311159}
11321160
11331161/* MPY : 011m mKKK 1xx0 F0QQ : A-160 */
1134static size_t dsp56k_dasm_mpy_1(const UINT16 op_byte, char* opcode_str, char* arg_str)
1162static size_t dsp56k_dasm_mpy_1(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
11351163{
11361164   char D[32];
11371165   char S1[32];
11381166   char S2[32];
1139   /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */
11401167   decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D);
1168   sprintf(opcode_str, "mpy");
11411169   sprintf(arg_str, "%s,%s,%s", S1, S2, D);
1142   sprintf(opcode_str, "mpy");
1170   sprintf(d_register, "%s", D);
11431171   return 1;
11441172}
11451173
11461174/* MPYR : 011m mKKK 1--1 F0QQ : A-162 */
1147static size_t dsp56k_dasm_mpyr_1(const UINT16 op_byte, char* opcode_str, char* arg_str)
1175static size_t dsp56k_dasm_mpyr_1(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
11481176{
11491177   char D[32];
11501178   char S1[32];
11511179   char S2[32];
1152   /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */
11531180   decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D);
1181   sprintf(opcode_str, "mpyr");
11541182   sprintf(arg_str, "%s,%s,%s", S1, S2, D);
1155   sprintf(opcode_str, "mpyr");
1183   sprintf(d_register, "%s", D);
11561184   return 1;
11571185}
11581186
1159/* TFR : 011m mKKK 0rr1 F0DD : A-212 */
1160static size_t dsp56k_dasm_tfr_2(const UINT16 op_byte, char* opcode_str, char* arg_str)
1187/* MPY : 0001 0110 RRDD FQQQ : A-160 */
1188static size_t dsp56k_dasm_mpy_2(const UINT16 op_byte, char* opcode_str, char* arg_str)
11611189{
1162   /* TODO - Same as move above. Investigate */
11631190   char D[32];
11641191   char S1[32];
1165   decode_DDF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, D);
1166   sprintf(opcode_str, "tfr");
1167   sprintf(arg_str, "%s,%s", S1, D);
1192   char S2[32];
1193   decode_QQQF_table(BITS(op_byte,0x0007), BITS(op_byte,0x0008), S1, S2, D);
1194   sprintf(opcode_str, "mpy");
1195   sprintf(arg_str, "%s,%s,%s", S1, S2, D);
11681196   return 1;
11691197}
11701198
1171/* MPY : 0001 0110 RRDD FQQQ : A-160 */
1172static size_t dsp56k_dasm_mpy_2(const UINT16 op_byte, char* opcode_str, char* arg_str)
1173{
1174/*  TODO
1175    // MPY - 0001 0110 RRDD FQQQ
1176    decode_k_table(BITS(op,0x0100), Dnot);
1177    Rnum = decode_RR_table(BITS(op,0x00c0));
1178    decode_DD_table(BITS(op,0x0030), S);
1179    decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D);
1180    sprintf(buffer, "mpy       %s,%s,%s %s,(R%d)+N%d %s,%s", S1, S2, D, Dnot, Rnum, Rnum, S, Dnot);
1181    // Strange, but not entirely out of the question - this 'k' parameter is hardcoded
1182    // I cheat here and do the parallel memory data move above - this specific one is only used twice
1183    retSize = 1;
1184*/
1185   return 0;
1186}
1187
11881199/* MAC : 0001 0111 RRDD FQQQ : A-122 */
11891200static size_t dsp56k_dasm_mac_2(const UINT16 op_byte, char* opcode_str, char* arg_str)
11901201{
1191/*  TODO
1192    // MAC - 0001 0111 RRDD FQQQ
1193    decode_k_table(BITS(op,0x0100), Dnot);
1194    Rnum = decode_RR_table(BITS(op,0x00c0));
1195    decode_DD_table(BITS(op,0x0030), S);
1196    decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D);
1197    sprintf(buffer, "mac       %s,%s,%s %s,(R%d)+N%d %s,%s", S1, S2, D, Dnot, Rnum, Rnum, S, Dnot);
1198    // Strange, but not entirely out of the question - this 'k' parameter is hardcoded
1199    // I cheat here and do the parallel memory data move above - this specific one is only used twice
1200    retSize = 1;
1201*/
1202   return 0;
1202   char D[32];
1203   char S1[32];
1204   char S2[32];
1205   decode_QQQF_table(BITS(op_byte,0x0007), BITS(op_byte,0x0008), S1, S2, D);
1206   sprintf(opcode_str, "mac");
1207   sprintf(arg_str, "%s,%s,%s", S1, S2, D);
1208   return 1;
12031209}
12041210
12051211/* CLR : .... .... 0000 F001 : A-60 */
r5891r5892
13641370{
13651371   sprintf(opcode_str, "subl");
13661372
1367   /* Only one option for the F table */
1373   /* There is only one option for the F table.  This is a very strange opcode. */
13681374   if (!BITS(op_byte,0x08))
13691375   {
13701376      sprintf(arg_str, "B,A");
r5891r5892
13721378   }
13731379   else
13741380   {
1375      sprintf(arg_str, "!");
1381      sprintf(arg_str, "!,!");
1382      sprintf(d_register, "!");
13761383   }
13771384
13781385   return 1;
r5891r5892
14181425{
14191426   char D[32];
14201427   char S1[32];
1428   /* Note: This is a JJJF limited in the docs, but other opcodes sneak
1429             in before cmp, so the same decode function can be used. */
14211430   decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D);
1422   /* TODO: This is a JJJF limited */
14231431   sprintf(opcode_str, "cmp");
1424   sprintf(arg_str, "%s,%s", S1,D);
1432   sprintf(arg_str, "%s,%s", S1, D);
14251433   sprintf(d_register, "%s", D);
14261434   return 1;
14271435}
r5891r5892
15201528{
15211529   char D[32];
15221530   char S1[32];
1531   /* Note: This is a JJJF limited in the docs, but other opcodes sneak
1532             in before cmp, so the same decode function can be used. */
15231533   decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D);
1524   /* TODO: This is JJJF limited */
15251534   sprintf(opcode_str, "cmpm");
1526   sprintf(arg_str, "%s,%s", S1,D);
1535   sprintf(arg_str, "%s,%s", S1, D);
15271536   sprintf(d_register, "%s", D);
15281537   return 1;
15291538}
r5891r5892
15311540/* MPY : .... .... 1k00 FQQQ : A-160    -- CONFIRMED TYPO IN DOCS (HHHH vs HHHW) */
15321541static size_t dsp56k_dasm_mpy(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
15331542{
1543   /* There are inconsistencies with the S1 & S2 operand ordering in the docs,
1544       but since it's a multiply it doesn't matter */
15341545   char D[32];
15351546   char S1[32];
15361547   char S2[32];
1537   char SIGN[32];
1548   char sign[32];
15381549   decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D);
1539   decode_kSign_table(BITS(op_byte,0x40), SIGN);
1550   decode_kSign_table(BITS(op_byte,0x40), sign);
15401551   sprintf(opcode_str, "mpy");
1541   sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D);
1552   if (sign[0] == '-')
1553      sprintf(arg_str, "-%s,%s,%s", S1, S2, D);
1554   else
1555      sprintf(arg_str, "%s,%s,%s", S1, S2, D);
15421556   sprintf(d_register, "%s", D);
15431557   return 1;
15441558}
r5891r5892
15461560/* MPYR : .... .... 1k01 FQQQ : A-162 */
15471561static size_t dsp56k_dasm_mpyr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
15481562{
1563   /* There are inconsistencies with the S1 & S2 operand ordering in the docs,
1564       but since it's a multiply it doesn't matter */
15491565   char D[32];
15501566   char S1[32];
15511567   char S2[32];
1552   char SIGN[32];
1568   char sign[32];
15531569   decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D);
1554   decode_kSign_table(BITS(op_byte,0x40), SIGN);
1570   decode_kSign_table(BITS(op_byte,0x40), sign);
15551571   sprintf(opcode_str, "mpyr");
1556   sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D);
1572   if (sign[0] == '-')
1573      sprintf(arg_str, "-%s,%s,%s", S1, S2, D);
1574   else
1575      sprintf(arg_str, "%s,%s,%s", S1, S2, D);
15571576   sprintf(d_register, "%s", D);
15581577   return 1;
15591578}
r5891r5892
15641583   char D[32];
15651584   char S1[32];
15661585   char S2[32];
1567   char SIGN[32];
1586   char sign[32];
15681587   decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D);
1569   decode_kSign_table(BITS(op_byte,0x40), SIGN);
1588   decode_kSign_table(BITS(op_byte,0x40), sign);
15701589   sprintf(opcode_str, "mac");
1571   sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D);
1590   if (sign[0] == '-')
1591      sprintf(arg_str, "-%s,%s,%s", S1, S2, D);
1592   else
1593      sprintf(arg_str, "%s,%s,%s", S1, S2, D);
15721594   sprintf(d_register, "%s", D);
15731595   return 1;
15741596}
r5891r5892
15761598/* MACR : .... .... 1k11 FQQQ : A-124   -- DRAMA - rr vs xx (805) */
15771599static size_t dsp56k_dasm_macr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register)
15781600{
1601   /* There are inconsistencies with the S1 & S2 operand ordering in the docs,
1602       but since it's a multiply it doesn't matter */
15791603   char D[32];
15801604   char S1[32];
15811605   char S2[32];
1582   char SIGN[32];
1606   char sign[32];
15831607   decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D);
1584   decode_kSign_table(BITS(op_byte,0x40), SIGN);
1608   decode_kSign_table(BITS(op_byte,0x40), sign);
15851609   sprintf(opcode_str, "macr");
1586   /* TODO: It's a little odd that macr is S1,S2 while everyone else (mac, mpy, mpyr) is S2,S1.  Check! */
1587   sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S1, S2, D);
1610   if (sign[0] == '-')
1611      sprintf(arg_str, "-%s,%s,%s", S1, S2, D);
1612   else
1613      sprintf(arg_str, "%s,%s,%s", S1, S2, D);
15881614   sprintf(d_register, "%s", D);
15891615   return 1;
15901616}
r5891r5892
16111637   char D[32];
16121638   decode_EE_table(BITS(op,0x0600), D);
16131639   sprintf(opcode_str, "and(i)");
1614   sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D);
1640   sprintf(arg_str, "#$%02x,%s", BITS(op,0x00ff), D);
16151641   return 1;
16161642}
16171643
r5891r5892
16931719         decode_DDDDD_table(BITS(op,0x001f), D);
16941720         break;
16951721   }
1696   sprintf(arg_str, "#%04x,%s", iVal, D);
16971722
1723   if (upperMiddleLower != BBB_INVALID)
1724   {
1725      sprintf(arg_str, "#$%04x,%s", iVal, D);
1726   }
1727   else
1728   {
1729      sprintf(arg_str, "[[invalid]],%s", D);
1730   }
1731
16981732   switch(BITS(op2,0x1f00))
16991733   {
17001734      case 0x12: sprintf(opcode_str, "bfchg");  break;
r5891r5892
17131747   char M[32];
17141748   decode_cccc_table(BITS(op,0x000f), M);
17151749   sprintf(opcode_str, "b.%s", M);
1716   sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + (INT16)op2);
1750   sprintf(arg_str, "$%04x (%d)", pc + 2 + (INT16)op2, (INT16)op2);
17171751   return 2;
17181752}
17191753
r5891r5892
17251759   decode_cccc_table(BITS(op,0x3c0), M);
17261760   relativeInt = get_6_bit_signed_value(BITS(op,0x003f));
17271761   sprintf(opcode_str, "b.%s", M);
1728   sprintf(arg_str, "%d (0x%04x)", relativeInt, pc + 1 + relativeInt);
1762   sprintf(arg_str, "$%04x (%d)", pc + 1 + relativeInt, relativeInt);
17291763   return 1;
17301764}
17311765
r5891r5892
17451779static size_t dsp56k_dasm_bra(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc)
17461780{
17471781   sprintf(opcode_str, "bra");
1748   sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + op2);
1782   sprintf(arg_str, "$%04x (%d)", pc + 2 + op2, (INT16)op2);
17491783   return 2;
17501784}
17511785
17521786/* BRA : 0000 1011 aaaa aaaa : A-50 */
17531787static size_t dsp56k_dasm_bra_1(const UINT16 op, char* opcode_str, char* arg_str, const offs_t pc)
17541788{
1789   INT8 iVal = (INT8)BITS(op,0x00ff);
17551790   sprintf(opcode_str, "bra");
1756   sprintf(arg_str, "%d (0x%02x)", (INT8)BITS(op,0x00ff), pc + 1 + (INT8)BITS(op,0x00ff));
1791   sprintf(arg_str, "$%04x (%d)", pc + 1 + iVal, iVal);
17571792   return 1;
17581793}
17591794
r5891r5892
17831818   char M[32];
17841819   decode_cccc_table(BITS(op,0x000f), M);
17851820   sprintf(opcode_str, "bs.%s", M);
1786   sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + (INT16)op2);
1787   return (2 | DASMFLAG_STEP_OVER);   /* probably */
1821   sprintf(arg_str, "$%04x (%d)", pc + 2 + (INT16)op2, (INT16)op2);
1822   return (2 | DASMFLAG_STEP_OVER);
17881823}
17891824
17901825/* BScc: 0000 0111 RR00 cccc : A-54 */
r5891r5892
17961831   Rnum = decode_RR_table(BITS(op,0x00c0));
17971832   sprintf(opcode_str, "bs.%s", M);
17981833   sprintf(arg_str, "R%d", Rnum);
1799   return (1 | DASMFLAG_STEP_OVER);   /* probably.  What's the diff between a branch and a jump? */
1834   return (1 | DASMFLAG_STEP_OVER);
18001835}
18011836
18021837/* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */
18031838static size_t dsp56k_dasm_bsr(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc)
18041839{
18051840   sprintf(opcode_str, "bsr");
1806   sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + (INT16)op2);
1841   sprintf(arg_str, "$%04x (%d)", pc + 2 + (INT16)op2, (INT16)op2);
18071842   return (2 | DASMFLAG_STEP_OVER);
18081843}
18091844
r5891r5892
18441879}
18451880
18461881/* DIV : 0001 0101 0--0 F1DD : A-76 */
1847/* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */
18481882static size_t dsp56k_dasm_div(const UINT16 op, char* opcode_str, char* arg_str)
18491883{
1884   /* The docs on page A-76 claim there is potential for a parallel move here,
1885       but various other sources (including elsewhere in the family manual) disagree */
18501886   char D[32];
18511887   char S1[32];
18521888   decode_DDF_table(BITS(op,0x0003), BITS(op,0x0008), S1, D);
r5891r5892
18701906}
18711907
18721908/* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */
1873static size_t dsp56k_dasm_do(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str)
1909static size_t dsp56k_dasm_do(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc)
18741910{
18751911   int Rnum;
18761912   Rnum = decode_RR_table(BITS(op,0x0003));
18771913   sprintf(opcode_str, "do");
1878   sprintf(arg_str, "X:(R%d),%02x", Rnum, op2);
1914   sprintf(arg_str, "X:(R%d),$%02x", Rnum, pc + 2 + op2);
18791915   return 2;
18801916}
18811917
18821918/* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */
1883static size_t dsp56k_dasm_do_1(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str)
1919static size_t dsp56k_dasm_do_1(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc)
18841920{
18851921   sprintf(opcode_str, "do");
1886   sprintf(arg_str, "#%02x,%04x", BITS(op,0x00ff), op2);
1922   sprintf(arg_str, "#$%02x,$%04x", BITS(op,0x00ff), pc + 2 + op2);
18871923   return 2;
18881924}
18891925
18901926/* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */
1891static size_t dsp56k_dasm_do_2(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str)
1927static size_t dsp56k_dasm_do_2(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc)
18921928{
18931929   char S1[32];
18941930   decode_DDDDD_table(BITS(op,0x001f), S1);
18951931   sprintf(opcode_str, "do");
1896   sprintf(arg_str, "%s,%04x", S1, op2);
1932   sprintf(arg_str, "%s,$%04x", S1, pc + 2 + op2);
18971933   return 2;
18981934}
18991935
19001936/* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */
1901static size_t dsp56k_dasm_doforever(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str)
1937static size_t dsp56k_dasm_doforever(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc)
19021938{
1903   sprintf(opcode_str, "doForever");
1904   sprintf(arg_str, "%04x", op2);
1939   sprintf(opcode_str, "do forever");
1940   sprintf(arg_str, "$%04x", pc + 2 + op2);
19051941   return 2;
19061942}
19071943
r5891r5892
19611997   char M[32];
19621998   decode_cccc_table(BITS(op,0x000f), M);
19631999   sprintf(opcode_str, "j.%s", M);
1964   sprintf(arg_str, "%04x", op2);
2000   sprintf(arg_str, "$%04x", op2);
19652001   return 2;
19662002}
19672003
r5891r5892
19812017static size_t dsp56k_dasm_jmp(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str)
19822018{
19832019   sprintf(opcode_str, "jmp");
1984   sprintf(arg_str, "%04x", op2);
2020   sprintf(arg_str, "$%04x", op2);
19852021   return 2;
19862022}
19872023
r5891r5892
20012037   char M[32];
20022038   decode_cccc_table(BITS(op,0x000f), M);
20032039   sprintf(opcode_str, "js.%s", M);
2004   sprintf(arg_str, "%04x", op2);
2005   return (2 |DASMFLAG_STEP_OVER);   /* probably */
2040   sprintf(arg_str, "$%04x", op2);
2041   return (2 | DASMFLAG_STEP_OVER);
20062042}
20072043
20082044/* JScc : 0000 0110 RR00 cccc : A-112 */
r5891r5892
20142050   Rnum = decode_RR_table(BITS(op,0x00c0));
20152051   sprintf(opcode_str, "js.%s", M);
20162052   sprintf(arg_str, "R%d", Rnum);
2017   return (1 | DASMFLAG_STEP_OVER);   /* probably.  What's the diff between a branch and a jump? */
2053   return (1 | DASMFLAG_STEP_OVER);
20182054}
20192055
20202056/* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */
20212057static size_t dsp56k_dasm_jsr(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str)
20222058{
20232059   sprintf(opcode_str, "jsr");
2024   sprintf(arg_str, "%04x", op2);
2060   sprintf(arg_str, "$%04x", op2);
20252061   return (2 | DASMFLAG_STEP_OVER);
20262062}
20272063
r5891r5892
20292065static size_t dsp56k_dasm_jsr_1(const UINT16 op, char* opcode_str, char* arg_str)
20302066{
20312067   sprintf(opcode_str, "jsr");
2032   sprintf(arg_str, "%d (0x%02x)", BITS(op,0x00ff), BITS(op,0x00ff));
2068   sprintf(arg_str, "#$%02x", BITS(op,0x00ff));
20332069   return (1 | DASMFLAG_STEP_OVER);
20342070}
20352071
r5891r5892
21942230   char D1[32];
21952231   decode_DD_table(BITS(op,0x0300), D1);
21962232   sprintf(opcode_str, "move(i)");
2197   sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D1);
2233   sprintf(arg_str, "#$%02x,%s", BITS(op,0x00ff), D1);
21982234   return 1;
21992235}
22002236
r5891r5892
22242260   assemble_eas_from_m_table(BITS(op,0x000c), BITS(op,0x00c0), BITS(op,0x0003), ea, ea2);
22252261   sprintf(SD, "P:%s", ea);
22262262   assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea2);
2227   sprintf(opcode_str, "move(m)");
2263   sprintf(opcode_str, "move(m)*");   /* This asterisk is to denote that this opcode may have an error with its disassembly */
22282264   sprintf(arg_str, "%s", args);
22292265   return 1;
22302266}
r5891r5892
22402276   assemble_reg_from_W_table(BITS(op2,0x0100), args, 'P', SD, B);
22412277   sprintf(opcode_str, "move(m)");
22422278   sprintf(arg_str, "%s", args);
2243   /* !!! The docs list the read/write order backwards for all move(m)'s - crackbabies ??? */
22442279   return 2;
22452280}
22462281
r5891r5892
22502285   char A[32];
22512286   char SD[32];
22522287   char args[32];
2253   char fullAddy[128];
2288   char fullAddy[128];      /* Convert Short Absolute Address to full 16-bit */
22542289   decode_HH_table(BITS(op,0x00c0), SD);
2255   assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy);   /* Convert Short Absolute Address to full 16-bit */
2256   sprintf(A, "%02x (%s)", BITS(op,0x001f), fullAddy);
2290   assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy);
2291   sprintf(A, "$%s", fullAddy);
22572292   assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, A);
22582293   sprintf(opcode_str, "move(p)");
22592294   sprintf(arg_str, "%s", args);
r5891r5892
22712306   Rnum = decode_RR_table(BITS(op,0x00c0));
22722307   assemble_ea_from_m_table(BITS(op,0x0020), Rnum, ea);
22732308   assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy);
2274   sprintf(SD, "X:%02x (%s)", BITS(op,0x001f), fullAddy);
2309   sprintf(SD, "X:$%s", fullAddy);
22752310   assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea);
2276   sprintf(opcode_str, "move(p)");
2311   sprintf(opcode_str, "move(p)*");   /* This asterisk is to denote that this opcode may have an error with its disassembly */
22772312   sprintf(arg_str, "%s", args);
22782313   return 1;
22792314}
r5891r5892
22852320   char SD[32];
22862321   char args[32];
22872322   decode_HH_table(BITS(op,0x00c0), SD);
2288   sprintf(A, "00%02x", BITS(op,0x001f));
2323   sprintf(A, "$%02x", BITS(op,0x001f));
22892324   assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, A);
22902325   sprintf(opcode_str, "move(s)");
22912326   sprintf(arg_str, "%s", args);
r5891r5892
23422377   char D[32];
23432378   decode_EE_table(BITS(op,0x0600), D);
23442379   sprintf(opcode_str, "or(i)");
2345   sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D);
2380   sprintf(arg_str, "#$%02x,%s", BITS(op,0x00ff), D);
23462381   return 1;
23472382}
23482383
r5891r5892
23602395static size_t dsp56k_dasm_rep_1(const UINT16 op, char* opcode_str, char* arg_str)
23612396{
23622397   sprintf(opcode_str, "rep");
2363   sprintf(arg_str, "%d (0x%02x)", BITS(op,0x00ff), BITS(op,0x00ff));
2398   sprintf(arg_str, "#$%02x (%d)", BITS(op,0x00ff), BITS(op,0x00ff));
23642399   return 1;
23652400}
23662401
r5891r5892
24492484   decode_h0hF_table(BITS(op,0x0007),BITS(op,0x0008), S, D);
24502485   sprintf(arg_str, "%s,%s  R0,R%d", S, D, Rnum);
24512486
2452   /* TODO: Investigate
2453    if (S1[0] == D[0] && D[0] == 'A')
2454        sprintf(buffer, "t.%s  %s,%s", M, S1, D);
2455    else
2456        sprintf(buffer, "t.%s  %s,%s  R0,R%d", M, S1, D, Rnum);
2457    */
2487   /* Note: S == 'A' && D == 'A' is used by the assembler when "no Data ALU
2488       transfer is specified in the instruction."  The Data ALU contains the
2489       X,Y,A,B registers.  The AGU holds the R registers.  This comment means
2490       the assembler will create Tcc A,A when it wants to conditionally transfer
2491       only a R register to another R register. */
24582492   return 1;
24592493}
24602494
r5891r5892
24782512   char S1[32];
24792513   char SD[32];
24802514   char args[32];
2481   decode_DDF_table(BITS(op,0x0030), BITS(op,0x0008), D1, S1);          /* Intentionally switched */
2515   decode_DDF_table(BITS(op,0x0030), BITS(op,0x0008), D1, S1);      /* Intentionally switched */
24822516   decode_HHH_table(BITS(op,0x0007), SD);
24832517   Rnum = decode_RR_table(BITS(op,0x00c0));
24842518   assemble_ea_from_m_table(BITS(op,0x0200), Rnum, ea);
r5891r5892
25582592}
25592593
25602594/* Dual X Memory Data Read : 011m mKKK -rr- ---- : A-142*/
2561static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2)
2595static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2, char* d_register)
25622596{
25632597   int Rnum;
25642598   char D1[32] = "";
r5891r5892
25702604   decode_KKK_table(BITS(op,0x0700), D1, D2);
25712605   assemble_eas_from_m_table(BITS(op,0x1800), Rnum, 3, ea1, ea2);
25722606
2573   /* TODO : The ^F's should likely be replaced */
2607   /* Not documented, but extrapolated from docs on page A-133 */
2608   if (D1[0] == '^' && D1[1] == 'F')
2609   {
2610      if (d_register[0] == 'B')
2611         sprintf(D1, "A");
2612      else if (d_register[0] == 'A')
2613         sprintf(D1, "B");
2614      else
2615         sprintf(D1, "A");   /* In the case of no data ALU operation */
2616   }
25742617
2575   if (Rnum == -1)
2618   /* D1 and D2 may not specify the same register : A-142 */
2619   if (Rnum == 3)
25762620   {
2577      sprintf(ea1, "(!!)!");
2621      /* Replace the R3 with !! */
2622      ea1[1] = ea1[2] = '!';
25782623   }
25792624
25802625   sprintf(parallel_move_str,  "X:%s,%s", ea1, D1);
r5891r5892
26252670   char S[32];
26262671   char Dnot[32];
26272672
2628   /* TODO : Cross-check the Dnot stuff against the MPY & MAC things. */
2629   /* It's likely correct as-is, since the ALU op and this guy probably decode the same bit, */
2630   /* but i may have to pass in d_register just to be sure? */
26312673   decode_k_table(BITS(op,0x0100), Dnot);
26322674   Rnum = decode_RR_table(BITS(op,0x00c0));
26332675   decode_DD_table(BITS(op,0x0030), S);
26342676
2635   /* TODO : is Nn correct here? */
26362677   sprintf(parallel_move_str,  "%s,X:(R%d)+N%d", Dnot, Rnum, Rnum);
26372678   sprintf(parallel_move_str2, "%s,%s", S, Dnot);
26382679}
r5891r5892
26642705      case 0x1: return BBB_LOWER;
26652706   }
26662707
2667   return BBB_LOWER;                          /* Not really safe... */
2708   return BBB_INVALID;
26682709}
26692710
26702711static void decode_cccc_table(UINT16 cccc, char *mnemonic)
r5891r5892
29182959
29192960static void decode_KKK_table(UINT16 KKK, char *D1, char *D2)
29202961{
2921   /* TODO: Fix ^Fs */
29222962   switch(KKK)
29232963   {
29242964      case 0x0: sprintf(D1, "^F"); sprintf(D2, "X0"); break;
r5891r5892
30083048
30093049static int decode_rr_table(UINT16 rr)
30103050{
3011   if (rr != 0x3)
3012      return rr;
3013   else
3014      return -1;
3051   return rr;
30153052}
30163053
30173054static void decode_s_table(UINT16 s, char *arithmetic)
r5891r5892
30383075{
30393076   UINT16 switchVal = (uuuu << 1) | F;
30403077
3041   /* An invalid uuuuF has been seen in the wild */
30423078   sprintf(D, "sub?");
3043   sprintf(S, "add?");
3079   sprintf(S, "add");
30443080   sprintf(arg, "invalid");
30453081
30463082   switch(switchVal)
r5891r5892
30923128   switch(mm)
30933129   {
30943130      case 0x0: sprintf(ea1, "(R%d)+",    n1)    ;
3095               sprintf(ea2, "(R%d)+",    n2)    ; break;
3131              sprintf(ea2, "(R%d)+",    n2)    ; break;
30963132      case 0x1: sprintf(ea1, "(R%d)+",    n1)    ;
3097               sprintf(ea2, "(R%d)+N%d", n2, n2); break;
3133              sprintf(ea2, "(R%d)+N%d", n2, n2); break;
30983134      case 0x2: sprintf(ea1, "(R%d)+N%d", n1, n1);
3099               sprintf(ea2, "(R%d)+",    n2)    ; break;
3135              sprintf(ea2, "(R%d)+",    n2)    ; break;
31003136      case 0x3: sprintf(ea1, "(R%d)+N%d", n1, n1);
3101               sprintf(ea2, "(R%d)+N%d", n2, n2); break;
3137              sprintf(ea2, "(R%d)+N%d", n2, n2); break;
31023138   }
31033139}
31043140
r5891r5892
31263162{
31273163   switch(t)
31283164   {
3129      /* !!! Looking at page 336 of UM, I'm not sure if 0 is X: or if 0 is just # !!! */
3130      case 0x0: sprintf(ea, "X:%04x", val); break;
3131      case 0x1: sprintf(ea, "#%04x", val);  break;
3165      case 0x0: sprintf(ea, "X:$%04x", val); break;
3166      case 0x1: sprintf(ea, "#$%04x", val);  break;
31323167   }
31333168}
31343169
r5891r5892
31473182
31483183   switch(P)
31493184   {
3150      case 0x0: sprintf(D, "X:%02x", ppppp); break;
3185      case 0x0: sprintf(D, "X:$%02x", ppppp); break;
31513186      case 0x1:
31523187         assemble_address_from_IO_short_address(ppppp, fullAddy);
3153         sprintf(D, "X:%02x (%s)", ppppp, fullAddy);
3188         sprintf(D, "X:$%s", fullAddy);
31543189         break;
31553190   }
31563191}
r5891r5892
31663201
31673202static void assemble_reg_from_W_table(UINT16 W, char *args, char ma, char *SD, INT8 xx)
31683203{
3169   /* TODO : xx is said to be signed on page A-139.  Nowhere else.  Are they all signed? */
3204   UINT8 abs_xx;
3205   char operation[32];
3206
3207   if(xx < 0)
3208      sprintf(operation,"-");
3209   else
3210      sprintf(operation,"+");
3211
3212   abs_xx = abs(xx);
3213
31703214   switch(W)
31713215   {
3172      case 0x0: sprintf(args, "%s,%c:(R2+%02x)", SD, ma, xx); break;
3173      case 0x1: sprintf(args, "%c:(R2+%02x),%s", ma, xx, SD); break;
3216      case 0x0: sprintf(args, "%s,%c:(R2%s$%02x)", SD, ma, operation, abs_xx); break;
3217      case 0x1: sprintf(args, "%c:(R2%s$%02x),%s", ma, operation, abs_xx, SD); break;
31743218   }
31753219}
31763220
r5891r5892
32243268      strcat(string, " ");
32253269   }
32263270}
3227
src/emu/cpu/s2650/s2650.c
r5891r5892
123123   0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84
124124};
125125
126/***************************************************************
127 * handy table to build PC relative offsets
128 * from HR (holding register)
129 ***************************************************************/
130static const int S2650_relative[0x100] =
131{
132     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
133    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
134    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
135    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
136   -64,-63,-62,-61,-60,-59,-58,-57,-56,-55,-54,-53,-52,-51,-50,-49,
137   -48,-47,-46,-45,-44,-43,-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,
138   -32,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
139   -16,-15,-14,-13,-12,-11,-10, -9, -8, -7, -6, -5, -4, -3, -2, -1,
140     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
141    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
142    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
143    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
144   -64,-63,-62,-61,-60,-59,-58,-57,-56,-55,-54,-53,-52,-51,-50,-49,
145   -48,-47,-46,-45,-44,-43,-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,
146   -32,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
147   -16,-15,-14,-13,-12,-11,-10, -9, -8, -7, -6, -5, -4, -3, -2, -1,
148};
149
150
151/***************************************************************
152 * RDMEM
153 * read memory byte from addr
154 ***************************************************************/
155#define RDMEM(addr) memory_read_byte_8le(s2650c->program, addr)
156
126157static void s2650_set_sense(s2650_regs *s2650c, int state);
127158
159INLINE void set_psu(s2650_regs *s2650c, UINT8 new)
160{
161   UINT8 old = s2650c->psu;
128162
129#define CHECK_IRQ_LINE                                 \
130   if (s2650c->irq_state != CLEAR_LINE)                        \
131   {                                             \
132      if( (s2650c->psu & II) == 0 )                         \
133      {                                          \
134         int vector;                               \
135         if (s2650c->halt)                               \
136         {                                       \
137            s2650c->halt = 0;                            \
138            s2650c->iar = (s2650c->iar + 1) & PMSK;                \
139         }                                       \
140         vector = (*s2650c->irq_callback)(s2650c->device, 0) & 0xff;      \
141         /* build effective address within first 8K page */   \
142         s2650c->ea = S2650_relative[vector] & PMSK;            \
143         if (vector & 0x80)      /* indirect bit set ? */   \
144         {                                       \
145            int addr = s2650c->ea;                        \
146            s2650c->icount -= 6;               \
147            /* build indirect 32K address */            \
148            s2650c->ea = RDMEM(addr) << 8;                  \
149            if (!(++addr & PMSK)) addr -= PLEN;          \
150            s2650c->ea = (s2650c->ea + RDMEM(addr)) & AMSK;          \
151         }                                       \
152         LOG(("S2650 interrupt to $%04x\n", s2650c->ea));\
153         s2650c->psu  = (s2650c->psu & ~SP) | ((s2650c->psu + 1) & SP) | II;   \
154         s2650c->ras[s2650c->psu & SP] = s2650c->page + s2650c->iar;               \
155         s2650c->page = s2650c->ea & PAGE;                        \
156         s2650c->iar  = s2650c->ea & PMSK;                        \
157      }                                          \
163    s2650c->psu = new;
164    if ((new ^ old) & FO)
165       memory_write_byte_8le(s2650c->io, S2650_FO_PORT, (new & FO) ? 1 : 0);
166}
167
168INLINE UINT8 get_sp(s2650_regs *s2650c)
169{
170   return (s2650c->psu & SP);
171}
172
173INLINE void set_sp(s2650_regs *s2650c, UINT8 new_sp)
174{
175   s2650c->psu = (s2650c->psu & ~SP) | (new_sp & SP);
176}
177
178INLINE int check_irq_line(s2650_regs *s2650c)
179{
180   int cycles = 0;
181
182   if (s2650c->irq_state != CLEAR_LINE)
183   {
184      if( (s2650c->psu & II) == 0 )
185      {
186         int vector;
187         if (s2650c->halt)
188         {
189            s2650c->halt = 0;
190            s2650c->iar = (s2650c->iar + 1) & PMSK;
191         }
192         vector = (*s2650c->irq_callback)(s2650c->device, 0) & 0xff;
193         /* build effective address within first 8K page */
194         s2650c->ea = S2650_relative[vector] & PMSK;
195         if (vector & 0x80)      /* indirect bit set ? */
196         {
197            int addr = s2650c->ea;
198            cycles += 6;
199            /* build indirect 32K address */
200            s2650c->ea = RDMEM(addr) << 8;
201            if (!(++addr & PMSK)) addr -= PLEN;
202            s2650c->ea = (s2650c->ea + RDMEM(addr)) & AMSK;
203         }
204         LOG(("S2650 interrupt to $%04x\n", s2650c->ea));
205         set_sp(s2650c, get_sp(s2650c) + 1);
206         set_psu(s2650c, s2650c->psu | II);
207         s2650c->ras[get_sp(s2650c)] = s2650c->page + s2650c->iar;
208         s2650c->page = s2650c->ea & PAGE;
209         s2650c->iar  = s2650c->ea & PMSK;
210      }
158211   }
212   return cycles;
213}
159214
160215/***************************************************************
161216 *
r5891r5892
198253}
199254
200255/***************************************************************
201 * RDMEM
202 * read memory byte from addr
203 ***************************************************************/
204#define RDMEM(addr) memory_read_byte_8le(s2650c->program, addr)
205
206/***************************************************************
207 * handy table to build PC relative offsets
208 * from HR (holding register)
209 ***************************************************************/
210static const int S2650_relative[0x100] =
211{
212     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
213    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
214    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
215    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
216   -64,-63,-62,-61,-60,-59,-58,-57,-56,-55,-54,-53,-52,-51,-50,-49,
217   -48,-47,-46,-45,-44,-43,-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,
218   -32,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
219   -16,-15,-14,-13,-12,-11,-10, -9, -8, -7, -6, -5, -4, -3, -2, -1,
220     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
221    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
222    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
223    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
224   -64,-63,-62,-61,-60,-59,-58,-57,-56,-55,-54,-53,-52,-51,-50,-49,
225   -48,-47,-46,-45,-44,-43,-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,
226   -32,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
227   -16,-15,-14,-13,-12,-11,-10, -9, -8, -7, -6, -5, -4, -3, -2, -1,
228};
229
230/***************************************************************
231256 * _REL_EA
232257 * build effective address with relative addressing
233258 ***************************************************************/
r5891r5892
407432{                                                \
408433   if( cond )                                       \
409434   {                                             \
410      REL_EA(s2650c->page);                               \
411      s2650c->psu  = (s2650c->psu & ~SP) | ((s2650c->psu + 1) & SP);         \
412      s2650c->ras[s2650c->psu & SP] = s2650c->page + s2650c->iar;                  \
413      s2650c->page = s2650c->ea & PAGE;                           \
414      s2650c->iar  = s2650c->ea & PMSK;                           \
415   } else   s2650c->iar = (s2650c->iar + 1) & PMSK;                   \
435      REL_EA(s2650c->page);                            \
436      set_sp(s2650c, get_sp(s2650c) + 1);                  \
437      s2650c->ras[get_sp(s2650c)] = s2650c->page + s2650c->iar;                  \
438      s2650c->page = s2650c->ea & PAGE;                  \
439      s2650c->iar  = s2650c->ea & PMSK;                  \
440   } else   s2650c->iar = (s2650c->iar + 1) & PMSK;          \
416441}
417442
418443/***************************************************************
r5891r5892
422447#define M_ZBSR()                                    \
423448{                                                \
424449   REL_ZERO(0);                                      \
425   s2650c->psu  = (s2650c->psu & ~SP) | ((s2650c->psu + 1) & SP);            \
426   s2650c->ras[s2650c->psu & SP] = s2650c->page + s2650c->iar;                     \
427   s2650c->page = s2650c->ea & PAGE;                              \
428   s2650c->iar  = s2650c->ea & PMSK;                              \
450   set_sp(s2650c, get_sp(s2650c) + 1);                     \
451   s2650c->ras[get_sp(s2650c)] = s2650c->page + s2650c->iar;                     \
452   s2650c->page = s2650c->ea & PAGE;                     \
453   s2650c->iar  = s2650c->ea & PMSK;                     \
429454}
430455
431456/***************************************************************
r5891r5892
437462   if( cond )                                       \
438463   {                                             \
439464      BRA_EA();                                    \
440      s2650c->psu = (s2650c->psu & ~SP) | ((s2650c->psu + 1) & SP);          \
441      s2650c->ras[s2650c->psu & SP] = s2650c->page + s2650c->iar;                  \
465      set_sp(s2650c, get_sp(s2650c) + 1);                \
466      s2650c->ras[get_sp(s2650c)] = s2650c->page + s2650c->iar;                  \
442467      s2650c->page = s2650c->ea & PAGE;                           \
443468      s2650c->iar  = s2650c->ea & PMSK;                           \
444469   } else s2650c->iar = (s2650c->iar + 2) & PMSK;                     \
r5891r5892
452477{                                                \
453478   BRA_EA();                                       \
454479   s2650c->ea  = (s2650c->ea + s2650c->reg[3]) & AMSK;                     \
455   s2650c->psu = (s2650c->psu & ~SP) | ((s2650c->psu + 1) & SP);             \
456   s2650c->ras[s2650c->psu & SP] = s2650c->page + s2650c->iar;                     \
480   set_sp(s2650c, get_sp(s2650c) + 1);             \
481   s2650c->ras[get_sp(s2650c)] = s2650c->page + s2650c->iar;                     \
457482   s2650c->page = s2650c->ea & PAGE;                              \
458483   s2650c->iar  = s2650c->ea & PMSK;                              \
459484}
r5891r5892
466491{                                                \
467492   if( cond )                                       \
468493   {                                             \
469      s2650c->icount -= 6;                              \
470      s2650c->ea = s2650c->ras[s2650c->psu & SP];                        \
471      s2650c->psu = (s2650c->psu & ~SP) | ((s2650c->psu - 1) & SP);          \
472      s2650c->page = s2650c->ea & PAGE;                           \
473      s2650c->iar  = s2650c->ea & PMSK;                           \
494      s2650c->icount -= 6;                           \
495      s2650c->ea = s2650c->ras[get_sp(s2650c)];            \
496      set_sp(s2650c, get_sp(s2650c) - 1);                \
497      s2650c->page = s2650c->ea & PAGE;                  \
498      s2650c->iar  = s2650c->ea & PMSK;                  \
474499   }                                             \
475500}
476501
r5891r5892
484509{                                                \
485510   if( cond )                                       \
486511   {                                             \
487      s2650c->ea = s2650c->ras[s2650c->psu & SP];                        \
488      s2650c->psu = (s2650c->psu & ~SP) | ((s2650c->psu - 1) & SP);          \
489      s2650c->page = s2650c->ea & PAGE;                           \
490      s2650c->iar  = s2650c->ea & PMSK;                           \
491      s2650c->psu &= ~II;                                 \
492      CHECK_IRQ_LINE;                               \
512      s2650c->ea = s2650c->ras[get_sp(s2650c)];            \
513      set_sp(s2650c, get_sp(s2650c) - 1);                \
514      s2650c->page = s2650c->ea & PAGE;                  \
515      s2650c->iar  = s2650c->ea & PMSK;                  \
516      set_psu(s2650c, s2650c->psu & ~II);                  \
517      s2650c->icount -= check_irq_line(s2650c);            \
493518   }                                             \
494519}
495520
r5891r5892
673698 ***************************************************************/
674699#define M_CPSU()                                    \
675700{                                                \
676   UINT8 cpsu = ARG(s2650c);                               \
677   s2650c->psu = s2650c->psu & ~cpsu;                              \
678   CHECK_IRQ_LINE;                                  \
701   UINT8 cpsu = ARG(s2650c);                            \
702   set_psu(s2650c, s2650c->psu & ~cpsu);                  \
703   s2650c->icount -= check_irq_line(s2650c);               \
679704}
680705
681706/***************************************************************
r5891r5892
684709 ***************************************************************/
685710#define M_CPSL()                                    \
686711{                                                \
687   UINT8 cpsl = ARG(s2650c);                               \
712   UINT8 cpsl = ARG(s2650c);                            \
688713   /* select other register set now ? */                  \
689   if( (cpsl & RS) && (s2650c->psl & RS) )                     \
714   if( (cpsl & RS) && (s2650c->psl & RS) )                  \
690715      SWAP_REGS;                                    \
691   s2650c->psl = s2650c->psl & ~cpsl;                              \
692   CHECK_IRQ_LINE;                                  \
716   s2650c->psl = s2650c->psl & ~cpsl;                     \
693717}
694718
695719/***************************************************************
r5891r5892
699723 ***************************************************************/
700724#define M_PPSU()                                    \
701725{                                                \
702   UINT8 ppsu = (ARG(s2650c) & ~PSU34) & ~SI;                  \
703   s2650c->psu = s2650c->psu | ppsu;                              \
726   UINT8 ppsu = (ARG(s2650c) & ~PSU34) & ~SI;               \
727   set_psu(s2650c, s2650c->psu | ppsu);                  \
704728}
705729
706730/***************************************************************
r5891r5892
807831   s2650c->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
808832   s2650c->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
809833   s2650c->psl = COM | WC;
810   s2650c->psu = 0;
834   /* force write */
835   s2650c->psu = 0xff;
836   set_psu(s2650c, 0);
811837}
812838
813839static CPU_EXIT( s2650 )
r5891r5892
827853   }
828854
829855   s2650c->irq_state = state;
830   CHECK_IRQ_LINE;
831856}
832857
833858static void s2650_set_flag(s2650_regs *s2650c, int state)
834859{
835860    if (state)
836        s2650c->psu |= FO;
861        set_psu(s2650c, s2650c->psu | FO);
837862    else
838       s2650c->psu &= ~FO;
863       set_psu(s2650c, s2650c->psu & ~FO);
839864}
840865
841866static int s2650_get_flag(s2650_regs *s2650c)
r5891r5892
846871static void s2650_set_sense(s2650_regs *s2650c, int state)
847872{
848873    if (state)
849       s2650c->psu |= SI;
874       set_psu(s2650c, s2650c->psu | SI);
850875    else
851       s2650c->psu &= ~SI;
876       set_psu(s2650c, s2650c->psu & ~SI);
852877}
853878
854879static int s2650_get_sense(s2650_regs *s2650c)
r5891r5892
863888   s2650_regs *s2650c = get_safe_token(device);
864889
865890   s2650c->icount = cycles;
891
892   /* check for external irqs */
893   s2650c->icount -= check_irq_line(s2650c);
894
866895   do
867896   {
868897      s2650c->ppc = s2650c->page + s2650c->iar;
r5891r5892
12171246            break;
12181247         case 0x92:      /* LPSU */
12191248            s2650c->icount -= 6;
1220            s2650c->psu = (R0 & ~PSU34) & ~SI;
1249            set_psu(s2650c, (R0 & ~PSU34) & ~SI);
12211250            break;
12221251         case 0x93:      /* LPSL */
12231252            s2650c->icount -= 6;
r5891r5892
14931522         break;
14941523
14951524      case CPUINFO_INT_REGISTER + S2650_PC:         s2650c->page = info->i & PAGE; s2650c->iar = info->i & PMSK; break;
1496      case CPUINFO_INT_SP:                      s2650c->psu = (s2650c->psu & ~SP) | (info->i & SP); break;
1497      case CPUINFO_INT_REGISTER + S2650_PS:         s2650c->psl = info->i & 0xff; s2650c->psu = info->i >> 8; break;
1525      case CPUINFO_INT_SP:                      set_sp(s2650c, info->i);                   break;
1526      case CPUINFO_INT_REGISTER + S2650_PS:         s2650c->psl = info->i & 0xff; set_psu(s2650c, info->i >> 8); break;
14981527      case CPUINFO_INT_REGISTER + S2650_R0:         s2650c->reg[0] = info->i;                  break;
14991528      case CPUINFO_INT_REGISTER + S2650_R1:         s2650c->reg[1] = info->i;                  break;
15001529      case CPUINFO_INT_REGISTER + S2650_R2:         s2650c->reg[2] = info->i;                  break;
r5891r5892
15511580      case CPUINFO_INT_PC:
15521581      case CPUINFO_INT_REGISTER + S2650_PC:         info->i = s2650c->page + s2650c->iar;            break;
15531582
1554      case CPUINFO_INT_SP:                     info->i = s2650c->psu & SP;               break;
1583      case CPUINFO_INT_SP:                     info->i = get_sp(s2650c);               break;
15551584      case CPUINFO_INT_REGISTER + S2650_PS:         info->i = (s2650c->psu << 8) | s2650c->psl;         break;
15561585      case CPUINFO_INT_REGISTER + S2650_R0:         info->i = s2650c->reg[0];                  break;
15571586      case CPUINFO_INT_REGISTER + S2650_R1:         info->i = s2650c->reg[1];                  break;
src/emu/cpu/s2650/s2650.h
r5891r5892
1212   S2650_HALT, S2650_SI, S2650_FO
1313};
1414
15/* fake control port   M/~IO=0 D/~C=0 E/~NE=0 */
16#define S2650_CTRL_PORT 0x100
15/* fake I/O space ports */
16enum
17{
18   S2650_EXT_PORT      = 0x00ff,   /* M/~IO=0 D/~C=x E/~NE=1 */
19   S2650_CTRL_PORT      = 0x0100,    /* M/~IO=0 D/~C=0 E/~NE=0 */
20   S2650_DATA_PORT    = 0x0101,   /* M/~IO=0 D/~C=1 E/~NE=0 */
21   S2650_SENSE_PORT   = 0x0102,   /* Fake Sense Line */
22   S2650_FO_PORT      = 0x0103   /* Fake FO Line */
23};
1724
18/* fake data port      M/~IO=0 D/~C=1 E/~NE=0 */
19#define S2650_DATA_PORT 0x101
20
21/* extended i/o ports  M/~IO=0 D/~C=x E/~NE=1 */
22#define S2650_EXT_PORT   0xff
23
24/* Fake Sense Line */
25#define S2650_SENSE_PORT 0x102
26
2725extern CPU_GET_INFO( s2650 );
2826#define CPU_S2650 CPU_GET_INFO_NAME( s2650 )
2927
src/emu/cpu/i386/i386priv.h
r5891r5892
1515
1616typedef enum { ES, CS, SS, DS, FS, GS } SREGS;
1717
18#ifdef LSB_FIRST
1918typedef enum
2019{
21   AL = 0,
22   AH = 1,
23   CL = 4,
24   CH = 5,
25   DL = 8,
26   DH = 9,
27   BL = 12,
28   BH = 13
20   AL = NATIVE_ENDIAN_VALUE_LE_BE(0,3),
21   AH = NATIVE_ENDIAN_VALUE_LE_BE(1,2),
22   CL = NATIVE_ENDIAN_VALUE_LE_BE(4,7),
23   CH = NATIVE_ENDIAN_VALUE_LE_BE(5,6),
24   DL = NATIVE_ENDIAN_VALUE_LE_BE(8,11),
25   DH = NATIVE_ENDIAN_VALUE_LE_BE(9,10),
26   BL = NATIVE_ENDIAN_VALUE_LE_BE(12,15),
27   BH = NATIVE_ENDIAN_VALUE_LE_BE(13,14)
2928} BREGS;
30#else
31typedef enum
32{
33   AL = 3,
34   AH = 2,
35   CL = 7,
36   CH = 6,
37   DL = 11,
38   DH = 10,
39   BL = 15,
40   BH = 14
41} BREGS;
42#endif
4329
44#ifdef LSB_FIRST
4530typedef enum
4631{
47   AX = 0,
48   CX = 2,
49   DX = 4,
50   BX = 6,
51   SP = 8,
52   BP = 10,
53   SI = 12,
54   DI = 14
32   AX = NATIVE_ENDIAN_VALUE_LE_BE(0,1),
33   CX = NATIVE_ENDIAN_VALUE_LE_BE(2,3),
34   DX = NATIVE_ENDIAN_VALUE_LE_BE(4,5),
35   BX = NATIVE_ENDIAN_VALUE_LE_BE(6,7),
36   SP = NATIVE_ENDIAN_VALUE_LE_BE(8,9),
37   BP = NATIVE_ENDIAN_VALUE_LE_BE(10,11),
38   SI = NATIVE_ENDIAN_VALUE_LE_BE(12,13),
39   DI = NATIVE_ENDIAN_VALUE_LE_BE(14,15)
5540} WREGS;
56#else
57typedef enum
58{
59   AX = 1,
60   CX = 3,
61   DX = 5,
62   BX = 7,
63   SP = 9,
64   BP = 11,
65   SI = 13,
66   DI = 15
67} WREGS;
68#endif
6941
7042typedef enum { EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI } DREGS;
7143
src/emu/cpu/i386/i386ops.c
r5891r5892
10161016{
10171017   UINT32 repeated_eip = cpustate->eip;
10181018   UINT32 repeated_pc = cpustate->pc;
1019   UINT8 opcode = FETCH(cpustate);
1019   UINT8 opcode; // = FETCH(cpustate);
10201020   UINT32 eas, ead;
10211021   UINT32 count;
10221022   INT32 cycle_base = 0, cycle_adjustment = 0;
1023   UINT8 prefix_flag=1;
10231024   UINT8 *flag = NULL;
10241025
1025   if( cpustate->segment_prefix ) {
1026      eas = i386_translate(cpustate, cpustate->segment_override, cpustate->sreg[CS].d ? REG32(ESI) : REG16(SI) );
1027   } else {
1028      eas = i386_translate(cpustate, DS, cpustate->sreg[CS].d ? REG32(ESI) : REG16(SI) );
1029   }
1030   ead = i386_translate(cpustate, ES, cpustate->sreg[CS].d ? REG32(EDI) : REG16(DI) );
10311026
1032   if( opcode == 0x66 ) {
1027   do {
1028   repeated_eip = cpustate->eip;
1029   repeated_pc = cpustate->pc;
1030   opcode = FETCH(cpustate);
1031   switch(opcode) {
1032      case 0x26:
1033       cpustate->segment_override=1;
1034      cpustate->segment_prefix=ES;
1035      break;
1036      case 0x2e:
1037       cpustate->segment_override=1;
1038      cpustate->segment_prefix=CS;
1039      break;
1040      case 0x36:
1041       cpustate->segment_override=1;
1042      cpustate->segment_prefix=SS;
1043      break;
1044      case 0x3e:
1045       cpustate->segment_override=1;
1046      cpustate->segment_prefix=DS;
1047      break;
1048      case 0x64:
1049       cpustate->segment_override=1;
1050      cpustate->segment_prefix=FS;
1051      break;
1052      case 0x65:
1053       cpustate->segment_override=1;
1054      cpustate->segment_prefix=GS;
1055      break;
1056      case 0x66:
10331057      cpustate->operand_size ^= 1;
1034      repeated_eip = cpustate->eip;
1035      repeated_pc = cpustate->pc;
1036      opcode = FETCH(cpustate);
1037   }
1038   if( opcode == 0x67 ) {
1058      break;
1059      case 0x67:
10391060      cpustate->address_size ^= 1;
1040      repeated_eip = cpustate->eip;
1041      repeated_pc = cpustate->pc;
1042      opcode = FETCH(cpustate);
1061      break;
1062        default:
1063      prefix_flag=0;
1064      }
1065   } while (prefix_flag);
1066
1067
1068   if( cpustate->segment_prefix ) {
1069      // FIXME: the following does not work if both address override and segment override are used
1070      eas = i386_translate(cpustate, cpustate->segment_override, cpustate->sreg[cpustate->segment_prefix].d ? REG32(ESI) : REG16(SI) );
1071   } else {
1072      eas = i386_translate(cpustate, DS, cpustate->address_size ? REG32(ESI) : REG16(SI) );
10431073   }
1074   ead = i386_translate(cpustate, ES, cpustate->address_size ? REG32(EDI) : REG16(DI) );
10441075
10451076   switch(opcode)
10461077   {
r5891r5892
11071138         break;
11081139   }
11091140
1110   if( cpustate->sreg[CS].d ) {
1141   if( cpustate->address_size ) {
11111142      if( REG32(ECX) == 0 )
11121143         return;
11131144   } else {
r5891r5892
11241155      I386OP(decode_opcode)(cpustate);
11251156      CYCLES_NUM(cycle_adjustment);
11261157
1127      if (cpustate->sreg[CS].d)
1158      if (cpustate->address_size)
11281159         count = --REG32(ECX);
11291160      else
11301161         count = --REG16(CX);
src/emu/cpu/sh4/sh4.c
r5891r5892
26222622      n = n & 14;
26232623      sh4->ea = sh4->r[m];
26242624      sh4->r[m] += 8;
2625#ifdef LSB_FIRST
2626      sh4->xf[n+1] = RL(sh4, sh4->ea );
2627      sh4->xf[n] = RL(sh4, sh4->ea+4 );
2628#else
2629      sh4->xf[n] = RL(sh4, sh4->ea );
2630      sh4->xf[n+1] = RL(sh4, sh4->ea+4 );
2631#endif
2625      sh4->xf[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(sh4, sh4->ea );
2626      sh4->xf[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(sh4, sh4->ea+4 );
26322627   } else {              /* PR = 0 */
26332628      if (sh4->fpu_sz) { /* SZ = 1 */
26342629         if (n & 1) {
r5891r5892
26622657   if (sh4->fpu_pr) { /* PR = 1 */
26632658      m= m & 14;
26642659      sh4->ea = sh4->r[n];
2665#ifdef LSB_FIRST
2666      WL(sh4, sh4->ea,sh4->xf[m+1] );
2667      WL(sh4, sh4->ea+4,sh4->xf[m] );
2668#else
2669      WL(sh4, sh4->ea,sh4->xf[m] );
2670      WL(sh4, sh4->ea+4,sh4->xf[m+1] );
2671#endif
2660      WL(sh4, sh4->ea,sh4->xf[m+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] );
2661      WL(sh4, sh4->ea+4,sh4->xf[m+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] );
26722662   } else {              /* PR = 0 */
26732663      if (sh4->fpu_sz) { /* SZ = 1 */
26742664         if (m & 1) {
r5891r5892
26982688      m= m & 14;
26992689      sh4->r[n] -= 8;
27002690      sh4->ea = sh4->r[n];
2701#ifdef LSB_FIRST
2702      WL(sh4, sh4->ea,sh4->xf[m+1] );
2703      WL(sh4, sh4->ea+4,sh4->xf[m] );
2704#else
2705      WL(sh4, sh4->ea,sh4->xf[m] );
2706      WL(sh4, sh4->ea+4,sh4->xf[m+1] );
2707#endif
2691      WL(sh4, sh4->ea,sh4->xf[m+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] );
2692      WL(sh4, sh4->ea+4,sh4->xf[m+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] );
27082693   } else {              /* PR = 0 */
27092694      if (sh4->fpu_sz) { /* SZ = 1 */
27102695         if (m & 1) {
r5891r5892
27362721   if (sh4->fpu_pr) { /* PR = 1 */
27372722      m= m & 14;
27382723      sh4->ea = sh4->r[0] + sh4->r[n];
2739#ifdef LSB_FIRST
2740      WL(sh4, sh4->ea,sh4->xf[m+1] );
2741      WL(sh4, sh4->ea+4,sh4->xf[m] );
2742#else
2743      WL(sh4, sh4->ea,sh4->xf[m] );
2744      WL(sh4, sh4->ea+4,sh4->xf[m+1] );
2745#endif
2724      WL(sh4, sh4->ea,sh4->xf[m+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] );
2725      WL(sh4, sh4->ea+4,sh4->xf[m+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] );
27462726   } else {              /* PR = 0 */
27472727      if (sh4->fpu_sz) { /* SZ = 1 */
27482728         if (m & 1) {
r5891r5892
27712751   if (sh4->fpu_pr) { /* PR = 1 */
27722752      n= n & 14;
27732753      sh4->ea = sh4->r[0] + sh4->r[m];
2774#ifdef LSB_FIRST
2775      sh4->xf[n+1] = RL(sh4, sh4->ea );
2776      sh4->xf[n] = RL(sh4, sh4->ea+4 );
2777#else
2778      sh4->xf[n] = RL(sh4, sh4->ea );
2779      sh4->xf[n+1] = RL(sh4, sh4->ea+4 );
2780#endif
2754      sh4->xf[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(sh4, sh4->ea );
2755      sh4->xf[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(sh4, sh4->ea+4 );
27812756   } else {              /* PR = 0 */
27822757      if (sh4->fpu_sz) { /* SZ = 1 */
27832758         if (n & 1) {
r5891r5892
28082783      if (n & 1) {
28092784         n= n & 14;
28102785         sh4->ea = sh4->r[m];
2811#ifdef LSB_FIRST
2812         sh4->xf[n+1] = RL(sh4, sh4->ea );
2813         sh4->xf[n] = RL(sh4, sh4->ea+4 );
2814#else
2815         sh4->xf[n] = RL(sh4, sh4->ea );
2816         sh4->xf[n+1] = RL(sh4, sh4->ea+4 );
2817#endif
2786         sh4->xf[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(sh4, sh4->ea );
2787         sh4->xf[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(sh4, sh4->ea+4 );
28182788      } else {
28192789         n= n & 14;
28202790         sh4->ea = sh4->r[m];
2821#ifdef LSB_FIRST
2822         sh4->fr[n+1] = RL(sh4, sh4->ea );
2823         sh4->fr[n] = RL(sh4, sh4->ea+4 );
2824#else
2825         sh4->fr[n] = RL(sh4, sh4->ea );
2826         sh4->fr[n+1] = RL(sh4, sh4->ea+4 );
2827#endif
2791         sh4->fr[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(sh4, sh4->ea );
2792         sh4->fr[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(sh4, sh4->ea+4 );
28282793      }
28292794   } else {              /* PR = 0 */
28302795      if (sh4->fpu_sz) { /* SZ = 1 */
r5891r5892
30102975{
30112976   if (sh4->fpu_pr) { /* PR = 1 */
30122977      n = n & 14;
3013#ifdef LSB_FIRST
30142978      if (sh4->fpscr & RM)
3015         sh4->fr[n] &= 0xe0000000; /* round toward zero*/
3016#else
3017      if (sh4->fpscr & RM)
3018         sh4->fr[n | 1] &= 0xe0000000; /* round toward zero*/
3019#endif
2979         sh4->fr[n | NATIVE_ENDIAN_VALUE_LE_BE(0,1)] &= 0xe0000000; /* round toward zero*/
30202980      *((float *)&sh4->fpul) = (float)FP_RFD(n);
30212981   }
30222982}
src/emu/cpu/sh4/sh4comn.c
r5891r5892
12991299            len = s->length * 4;
13001300            p32bytes = (UINT64 *)(s->buffer);
13011301            for (pos = 0;pos < len;pos++) {
1302#ifdef LSB_FIRST
13031302               *p32bytes = memory_read_qword_64le(sh4->program, s->source);
1304#else
1305               *p32bytes = memory_read_qword_64be(sh4->program, s->source);
1306#endif
13071303               p32bytes++;
13081304               s->destination = s->destination + 8;
13091305            }
r5891r5892
13111307            len = s->length * 4;
13121308            p32bytes = (UINT64 *)(s->buffer);
13131309            for (pos = 0;pos < len;pos++) {
1314#ifdef LSB_FIRST
13151310               memory_write_qword_64le(sh4->program, s->destination, *p32bytes);
1316#else
1317               memory_write_qword_64be(sh4->program, s->destination, *p32bytes);
1318#endif
13191311               p32bytes++;
13201312               s->destination = s->destination + 8;
13211313            }
src/emu/cpu/nec/necpriv.h
r5891r5892
1515#define TRUE 1
1616#endif
1717
18#ifdef LSB_FIRST
19typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,IXL,IXH,IYL,IYH } BREGS;
20#else
21typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,IXH,IXL,IYH,IYL } BREGS;
22#endif
18typedef enum {
19   AL = NATIVE_ENDIAN_VALUE_LE_BE(0x0, 0x1),
20   AH = NATIVE_ENDIAN_VALUE_LE_BE(0x1, 0x0),
21   CL = NATIVE_ENDIAN_VALUE_LE_BE(0x2, 0x3),
22   CH = NATIVE_ENDIAN_VALUE_LE_BE(0x3, 0x2),
23   DL = NATIVE_ENDIAN_VALUE_LE_BE(0x4, 0x5),
24   DH = NATIVE_ENDIAN_VALUE_LE_BE(0x5, 0x4),
25   BL = NATIVE_ENDIAN_VALUE_LE_BE(0x6, 0x7),
26   BH = NATIVE_ENDIAN_VALUE_LE_BE(0x7, 0x6),
27  SPL = NATIVE_ENDIAN_VALUE_LE_BE(0x8, 0x9),
28  SPH = NATIVE_ENDIAN_VALUE_LE_BE(0x9, 0x8),
29  BPL = NATIVE_ENDIAN_VALUE_LE_BE(0xa, 0xb),
30  BPH = NATIVE_ENDIAN_VALUE_LE_BE(0xb, 0xa),
31  IXL = NATIVE_ENDIAN_VALUE_LE_BE(0xc, 0xd),
32  IXH = NATIVE_ENDIAN_VALUE_LE_BE(0xd, 0xc),
33  IYL = NATIVE_ENDIAN_VALUE_LE_BE(0xe, 0xf),
34  IYH = NATIVE_ENDIAN_VALUE_LE_BE(0xf, 0xe)
35} BREGS;
2336
2437/* parameter x = result, y = source 1, z = source 2 */
2538
src/emu/cpu/arm7/arm7dasm.c
r5891r5892
845845                        rd = ( opcode & THUMB_ADDSUB_RD ) >> THUMB_ADDSUB_RD_SHIFT;
846846                        pBuf += sprintf( pBuf, "TST R%d, R%d", rd, rs );
847847                        break;
848                     case 0x9: /* NEG Rd, Rs */
849                        rs = ( opcode & THUMB_ADDSUB_RS ) >> THUMB_ADDSUB_RS_SHIFT;
850                        rd = ( opcode & THUMB_ADDSUB_RD ) >> THUMB_ADDSUB_RD_SHIFT;
851                        pBuf += sprintf( pBuf, "NEG R%d, R%d", rd, rs );
852                        break;
848853                     case 0xa: /* CMP Rd, Rs */
849854                        rs = ( opcode & THUMB_ADDSUB_RS ) >> THUMB_ADDSUB_RS_SHIFT;
850855                        rd = ( opcode & THUMB_ADDSUB_RD ) >> THUMB_ADDSUB_RD_SHIFT;
src/emu/cpu/arm7/arm7exec.c
r5891r5892
437437                                    SET_CPSR(GET_CPSR | HandleALUNZFlags(GET_REGISTER(cpustate, rd) & GET_REGISTER(cpustate, rs)));
438438                                    R15 += 2;
439439                                    break;
440                                case 0x9: /* NEG Rd, Rs - todo: check me */
440                                case 0x9: /* NEG Rd, Rs */
441441                                    rs = (insn & THUMB_ADDSUB_RS) >> THUMB_ADDSUB_RS_SHIFT;
442442                                    rd = (insn & THUMB_ADDSUB_RD) >> THUMB_ADDSUB_RD_SHIFT;
443443                                    rrs = GET_REGISTER(cpustate, rs);
src/emu/eigccx86.h
r5891r5892
658658-------------------------------------------------*/
659659
660660#define get_profile_ticks _get_profile_ticks
661
662#ifndef __x86_64__
661663INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
662664{
663665    UINT64 result;
r5891r5892
667669    );
668670    return (INT64) (result & U64(0x7fffffffffffffff));
669671}
672#else
673INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
674{
675   UINT64 result;
676    UINT32 r1, r2;
677    __asm__ __volatile__ (
678            "rdtsc"
679            : "=a" (r1), "=d" (r2)
680    );
670681
682    result = ((UINT64)r2<<32) | (UINT64)r1;
683    return (INT64) (result & U64(0x7fffffffffffffff));
684}
685#endif
686
671687#endif /* __EIGCCX86__ */
src/emu/info.c
r5891r5892
518518               /* for non-disk entries, print offset */
519519               if (!is_disk)
520520                  fprintf(out, " offset=\"%x\"", offset);
521
522521               /* for disk entries, add the disk index */
523522               else
524523                  fprintf(out, " index=\"%x\"", DISK_GETINDEX(rom));
524
525               /* add optional flag */
526               if ((!is_disk && ROM_ISOPTIONAL(rom)) || (is_disk && DISK_ISOPTIONAL(rom)))
527                  fprintf(out, " optional=\"yes\"");
528
525529               fprintf(out, "/>\n");
526530            }
527531         }
r5891r5892
948952      "\t\t\t<!ATTLIST rom region CDATA #IMPLIED>\n"
949953      "\t\t\t<!ATTLIST rom offset CDATA #IMPLIED>\n"
950954      "\t\t\t<!ATTLIST rom status (baddump|nodump|good) \"good\">\n"
951      "\t\t\t<!ATTLIST rom dispose (yes|no) \"no\">\n"
955      "\t\t\t<!ATTLIST rom optional (yes|no) \"no\">\n"
952956      "\t\t<!ELEMENT disk EMPTY>\n"
953957      "\t\t\t<!ATTLIST disk name CDATA #REQUIRED>\n"
954958      "\t\t\t<!ATTLIST disk md5 CDATA #IMPLIED>\n"
r5891r5892
957961      "\t\t\t<!ATTLIST disk region CDATA #IMPLIED>\n"
958962      "\t\t\t<!ATTLIST disk index CDATA #IMPLIED>\n"
959963      "\t\t\t<!ATTLIST disk status (baddump|nodump|good) \"good\">\n"
964      "\t\t\t<!ATTLIST disk optional (yes|no) \"no\">\n"
960965      "\t\t<!ELEMENT sample EMPTY>\n"
961966      "\t\t\t<!ATTLIST sample name CDATA #REQUIRED>\n"
962967      "\t\t<!ELEMENT chip EMPTY>\n"
src/emu/emuopts.h
r5891r5892
2424***************************************************************************/
2525
2626/* option priorities */
27#define OPTION_PRIORITY_CMDLINE      OPTION_PRIORITY_HIGH
28#define OPTION_PRIORITY_INI         OPTION_PRIORITY_NORMAL
27#define OPTION_PRIORITY_CMDLINE         OPTION_PRIORITY_HIGH
28#define OPTION_PRIORITY_INI            OPTION_PRIORITY_NORMAL
29#define OPTION_PRIORITY_MAME_INI      (OPTION_PRIORITY_NORMAL + 1)
30#define OPTION_PRIORITY_DEBUG_INI      (OPTION_PRIORITY_MAME_INI + 1)
31#define OPTION_PRIORITY_ORIENTATION_INI   (OPTION_PRIORITY_DEBUG_INI + 1)
32#define OPTION_PRIORITY_VECTOR_INI      (OPTION_PRIORITY_ORIENTATION_INI + 1)
33#define OPTION_PRIORITY_SOURCE_INI      (OPTION_PRIORITY_VECTOR_INI + 1)
34#define OPTION_PRIORITY_GPARENT_INI      (OPTION_PRIORITY_SOURCE_INI + 1)
35#define OPTION_PRIORITY_PARENT_INI      (OPTION_PRIORITY_GPARENT_INI + 1)
36#define OPTION_PRIORITY_DRIVER_INI      (OPTION_PRIORITY_PARENT_INI + 1)
2937
30
3138/* core options */
3239#define OPTION_GAMENAME            OPTION_UNADORNED(0)
3340
src/emu/uimenu.c
r5891r5892
12291229      mame_pause(menu->machine, !mame_is_paused(menu->machine));
12301230
12311231   /* handle a toggle cheats request */
1232   if (exclusive_input_pressed(menu, IPT_UI_TOGGLE_CHEAT, 0))
1232   if (ui_input_pressed_repeat(menu->machine, IPT_UI_TOGGLE_CHEAT, 0))
12331233      cheat_set_global_enable(menu->machine, !cheat_get_global_enable(menu->machine));
12341234
12351235   /* see if any other UI keys are pressed */
src/emu/memory.c
r5891r5892
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      32                  /* maximum number of explicitly-defined banks */
139#define MAX_EXPLICIT_BANKS      64                  /* 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 */
src/emu/memory.h
r5891r5892
4040{
4141   STATIC_INVALID = 0,                           /* invalid - should never be used */
4242   STATIC_BANK1 = 1,                           /* first memory bank */
43   /* entries 1-32 are for fixed banks 1-32 specified by the driver */
44   /* entries 33-66 are for dynamically allocated internal banks */
45   STATIC_BANKMAX = 66,                        /* last 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 */
45   STATIC_BANKMAX = 122,                        /* last memory bank */
4646   STATIC_RAM,                                 /* RAM - reads/writes map to dynamic banks */
4747   STATIC_ROM,                                 /* ROM - reads = RAM; writes = UNMAP */
4848   STATIC_NOP,                                 /* NOP - reads = unmapped value; writes = no-op */
src/emu/mame.c
r5891r5892
203203
204204extern int mame_validitychecks(const game_driver *driver);
205205
206static int parse_ini_file(core_options *options, const char *name);
206static int parse_ini_file(core_options *options, const char *name, int priority);
207207
208208static running_machine *create_machine(const game_driver *driver);
209209static void destroy_machine(running_machine *machine);
r5891r5892
12991299{
13001300   /* parse the INI file defined by the platform (e.g., "mame.ini") */
13011301   /* we do this twice so that the first file can change the INI path */
1302   parse_ini_file(options, CONFIGNAME);
1303   parse_ini_file(options, CONFIGNAME);
1302   parse_ini_file(options, CONFIGNAME, OPTION_PRIORITY_MAME_INI);
1303   parse_ini_file(options, CONFIGNAME, OPTION_PRIORITY_MAME_INI);
13041304
13051305   /* debug mode: parse "debug.ini" as well */
13061306   if (options_get_bool(options, OPTION_DEBUG))
1307      parse_ini_file(options, "debug");
1307      parse_ini_file(options, "debug", OPTION_PRIORITY_DEBUG_INI);
13081308
13091309   /* if we have a valid game driver, parse game-specific INI files */
13101310   if (driver != NULL)
r5891r5892
13171317
13181318      /* parse "vertical.ini" or "horizont.ini" */
13191319      if (driver->flags & ORIENTATION_SWAP_XY)
1320         parse_ini_file(options, "vertical");
1320         parse_ini_file(options, "vertical", OPTION_PRIORITY_ORIENTATION_INI);
13211321      else
1322         parse_ini_file(options, "horizont");
1322         parse_ini_file(options, "horizont", OPTION_PRIORITY_ORIENTATION_INI);
13231323
13241324      /* parse "vector.ini" for vector games */
13251325      config = machine_config_alloc(driver->machine_config);
r5891r5892
13281328         const screen_config *scrconfig = (const screen_config *)device->inline_config;
13291329         if (scrconfig->type == SCREEN_TYPE_VECTOR)
13301330         {
1331            parse_ini_file(options, "vector");
1331            parse_ini_file(options, "vector", OPTION_PRIORITY_VECTOR_INI);
13321332            break;
13331333         }
13341334      }
r5891r5892
13371337      /* next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini */
13381338      sourcename = core_filename_extract_base(astring_alloc(), driver->source_file, TRUE);
13391339      astring_insc(sourcename, 0, "source" PATH_SEPARATOR);
1340      if (!parse_ini_file(options, astring_c(sourcename)))
1340      if (!parse_ini_file(options, astring_c(sourcename), OPTION_PRIORITY_SOURCE_INI))
13411341      {
13421342         core_filename_extract_base(sourcename, driver->source_file, TRUE);
1343         parse_ini_file(options, astring_c(sourcename));
1343         parse_ini_file(options, astring_c(sourcename), OPTION_PRIORITY_SOURCE_INI);
13441344      }
13451345      astring_free(sourcename);
13461346
13471347      /* then parent the grandparent, parent, and game-specific INIs */
13481348      if (gparent != NULL)
1349         parse_ini_file(options, gparent->name);
1349         parse_ini_file(options, gparent->name, OPTION_PRIORITY_GPARENT_INI);
13501350      if (parent != NULL)
1351         parse_ini_file(options, parent->name);
1352      parse_ini_file(options, driver->name);
1351         parse_ini_file(options, parent->name, OPTION_PRIORITY_PARENT_INI);
1352      parse_ini_file(options, driver->name, OPTION_PRIORITY_DRIVER_INI);
13531353   }
13541354}
13551355
r5891r5892
13581358    parse_ini_file - parse a single INI file
13591359-------------------------------------------------*/
13601360
1361static int parse_ini_file(core_options *options, const char *name)
1361static int parse_ini_file(core_options *options, const char *name, int priority)
13621362{
13631363   file_error filerr;
13641364   mame_file *file;
r5891r5892
13771377
13781378   /* parse the file and close it */
13791379   mame_printf_verbose("Parsing %s.ini\n", name);
1380   options_parse_ini_file(options, mame_core_file(file), OPTION_PRIORITY_INI);
1380   options_parse_ini_file(options, mame_core_file(file), priority);
13811381   mame_fclose(file);
13821382   return TRUE;
13831383}
src/emu/devintrf.c
r5891r5892
361361
362362
363363/*-------------------------------------------------
364    device_find_child_by_tag - retrieve a child
365   device configuration based on a tag
364    device_find_child_by_tag - retrieve a child
365    device configuration based on a tag
366366-------------------------------------------------*/
367367
368368const device_config *device_find_child_by_tag(const device_config *owner, const char *tag)
369369{
370370   astring *tempstring;
371371   const device_config *child;
372   
372
373373   assert(owner != NULL);
374374   assert(tag != NULL);
375375
src/emu/machine/6532riot.c
r5891r5892
3838typedef struct _riot6532_port riot6532_port;
3939struct _riot6532_port
4040{
41   UINT8            in;
42   UINT8            out;
43   UINT8            ddr;
44   riot_read_func      in_func;
45   riot_write_func      out_func;
41   UINT8               in;
42   UINT8               out;
43   UINT8                ddr;
44   devcb_resolved_read8   in_func;
45   devcb_resolved_write8   out_func;
4646};
4747
4848
r5891r5892
5555
5656   riot6532_port   port[2];
5757
58   devcb_resolved_write_line   irq_func;
59
5860   UINT8         irqstate;
5961   UINT8         irqenable;
6062
r5891r5892
9698   riot6532_state *riot = get_safe_token(device);
9799   int state = (riot->irqstate & riot->irqenable);
98100
99   if (riot->intf->irq_func != NULL)
100      (*riot->intf->irq_func)(device, (state != 0) ? ASSERT_LINE : CLEAR_LINE);
101   if (riot->irq_func.write != NULL)
102      devcb_call_write_line(&riot->irq_func, (state != 0) ? ASSERT_LINE : CLEAR_LINE);
101103   else
102104      logerror("%s:6532RIOT chip #%d: no irq callback function\n", cpuexec_describe_context(device->machine), riot->index);
103105}
r5891r5892
256258      /* if A0 == 0, we are writing to the port's output */
257259      else
258260      {
259         UINT8 olddata = port->out;
260261         port->out = data;
261         if (port->out_func != NULL)
262            (*port->out_func)(device, data, olddata);
262         if (port->out_func.write != NULL)
263            devcb_call_write8(&port->out_func, 0, data);
263264         else
264265            logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", cpuexec_describe_context(device->machine), device->tag, 'A' + (offset & 1), data);
265266      }
r5891r5892
321322      else
322323      {
323324         /* call the input callback if it exists */
324         if (port->in_func != NULL)
325         if (port->in_func.read != NULL)
325326         {
326            port->in = (*port->in_func)(device, port->in);
327            port->in = devcb_call_read8(&port->in_func, 0);
327328
328329            /* changes to port A need to update the PA7 state */
329330            if (port == &riot->port[0])
r5891r5892
437438   riot->index = device_list_index(device->machine->config->devicelist, RIOT6532, device->tag);
438439
439440   /* configure the ports */
440   riot->port[0].in_func = riot->intf->in_a_func;
441   riot->port[0].out_func = riot->intf->out_a_func;
442   riot->port[1].in_func = riot->intf->in_b_func;
443   riot->port[1].out_func = riot->intf->out_b_func;
441   devcb_resolve_read8(&riot->port[0].in_func, &riot->intf->in_a_func, device);
442   devcb_resolve_write8(&riot->port[0].out_func, &riot->intf->out_a_func, device);
443   devcb_resolve_read8(&riot->port[1].in_func, &riot->intf->in_b_func, device);
444   devcb_resolve_write8(&riot->port[1].out_func, &riot->intf->out_b_func, device);
444445
446   /* resolve irq func */
447   devcb_resolve_write_line(&riot->irq_func, &riot->intf->irq_func, device);
448
445449   /* allocate timers */
446450   riot->timer = timer_alloc(device->machine, timer_end_callback, (void *)device);
447451
src/emu/machine/6532riot.h
r5891r5892
77#ifndef __RIOT6532_H__
88#define __RIOT6532_H__
99
10#include "devcb.h"
1011
1112/***************************************************************************
1213    TYPE DEFINITIONS
1314***************************************************************************/
1415
15typedef UINT8 (*riot_read_func)(const device_config *device, UINT8 olddata);
16typedef void (*riot_write_func)(const device_config *device, UINT8 newdata, UINT8 olddata);
17typedef void (*riot_irq_func)(const device_config *device, int state);
1816
19
2017typedef struct _riot6532_interface riot6532_interface;
2118struct _riot6532_interface
2219{
23   riot_read_func      in_a_func;
24   riot_read_func      in_b_func;
25   riot_write_func      out_a_func;
26   riot_write_func      out_b_func;
27   riot_irq_func      irq_func;
20   devcb_read8         in_a_func;
21   devcb_read8         in_b_func;
22   devcb_write8      out_a_func;
23   devcb_write8      out_b_func;
24   devcb_write_line   irq_func;
2825};
2926
3027
src/emu/machine/generic.c
r5891r5892
661661   int cpunum = cpu_get_index(device);
662662
663663   assert_always(device != NULL, "cpu_interrupt_enable() called for invalid cpu!");
664   assert_always(cpunum < ARRAY_LENGTH(interrupt_enable), "cpu_interrupt_enable() called for a CPU > position 7!");
664665
665666   /* set the new state */
666667   if (cpunum < ARRAY_LENGTH(interrupt_enable))
src/emu/sound/tms5110.c
r5891r5892
1212     Todo:
1313        - implement CS
1414        - implement missing commands
15        - TMS5110_CMD_TEST_TALK is only partially implemented
1516
1617     TMS5100:
1718
r5891r5892
3233        VSS      | 14           15 |  M0
3334                 +-----------------+
3435
36        T11: Sync for serial data out
37
38
3539    M58817
3640
3741    The following connections could be derived from radar scope schematics.
r5891r5892
8488#define TMS5110_IS_CD2802   TMS5110_IS_5110
8589#define TMS5110_IS_M58817   TMS5110_IS_5110
8690
91/* States for CTL */
92
93#define CTL_STATE_INPUT       (0)
94#define CTL_STATE_OUTPUT       (1)
95#define CTL_STATE_NEXT_OUTPUT    (2)
96
8797struct tms5100_coeffs
8898{
8999   int            subtype;
r5891r5892
119129   UINT8 speaking_now;
120130   UINT8 speak_delay_frames;
121131   UINT8 talk_status;
132   UINT8 state;
122133
123134   /* Rom interface */
124135   UINT32 address;
r5891r5892
162173   const UINT8 *table;
163174   sound_stream *stream;
164175   INT32 speech_rom_bitnum;
176
177   emu_timer *romclk_timer;
178   UINT8 romclk_state;
165179};
166180
167181
r5891r5892
229243   state_save_register_device_item(tms->device, 0, tms->speaking_now);
230244   state_save_register_device_item(tms->device, 0, tms->speak_delay_frames);
231245   state_save_register_device_item(tms->device, 0, tms->talk_status);
246   state_save_register_device_item(tms->device, 0, tms->state);
232247
233248   state_save_register_device_item(tms->device, 0, tms->old_energy);
234249   state_save_register_device_item(tms->device, 0, tms->old_pitch);
r5891r5892
396411         /* if the old frame was a stop frame, exit and do not process any more frames */
397412         if (tms->old_energy == COEFF_ENERGY_SENTINEL)
398413         {
399            /*if (DEBUG_5110) logerror("processing frame: stop frame\n");*/
414            if (DEBUG_5110) logerror("processing frame: stop frame\n");
400415            tms->target_energy = tms->current_energy = 0;
401416            tms->speaking_now = tms->talk_status = 0;
402417            tms->interp_count = tms->sample_count = tms->pitch_count = 0;
r5891r5892
669684      tms->PDC = data & 0x1;
670685      if (tms->PDC == 0) /* toggling 1->0 processes command on CTL_pins */
671686      {
687         /* first pdc toggles output, next toggles input */
688         switch (tms->state)
689         {
690         case CTL_STATE_INPUT:
691            /* continue */
692            break;
693         case CTL_STATE_NEXT_OUTPUT:
694            tms->state = CTL_STATE_OUTPUT;
695            return;
696         case CTL_STATE_OUTPUT:
697            tms->state = CTL_STATE_INPUT;
698            return;
699         }
672700         /* the only real commands we handle now are SPEAK and RESET */
673701         if (tms->next_is_address)
674702         {
r5891r5892
709737               tms->next_is_address = TRUE;
710738               break;
711739
740            case TMS5110_CMD_TEST_TALK:
741               tms->state = CTL_STATE_NEXT_OUTPUT;
742               break;
743
712744            default:
713745               logerror("tms5110.c: unknown command: 0x%02x\n", tms->CTL_pins);
714746               break;
r5891r5892
931963       tms->set_load_address = speech_rom_set_addr;
932964   }
933965
966   tms->state = CTL_STATE_INPUT; /* most probably not defined */
967
934968   register_for_save_states(tms);
935969}
936970
r5891r5892
10451079
10461080/******************************************************************************
10471081
1048     tms5110_status_r -- read status from the sound chip
1082     tms5110_ctl_r -- read status from the sound chip
10491083
10501084        bit 0 = TS - Talk Status is active (high) when the VSP is processing speech data.
10511085                Talk Status goes active at the initiation of a SPEAK command.
r5891r5892
10541088        TMS5110 datasheets mention this is only available as a result of executing
10551089                TEST TALK command.
10561090
1091                FIXME: data read not implemented, CTL1 only available after TALK command
1092
10571093******************************************************************************/
10581094
1059READ8_DEVICE_HANDLER( tms5110_status_r )
1095READ8_DEVICE_HANDLER( tms5110_ctl_r )
10601096{
10611097   tms5110_state *tms = get_safe_token(device);
10621098
10631099    /* bring up to date first */
10641100    stream_update(tms->stream);
1101    if (tms->state == CTL_STATE_OUTPUT)
1102    {
1103      //if (DEBUG_5110) logerror("Status read (status=%2d)\n", tms->talk_status);
1104       return (tms->talk_status << 0); /*CTL1 = still talking ? */
1105    }
1106    else
1107    {
1108      //if (DEBUG_5110) logerror("Status read (not in output mode)\n");
1109       return (0);
1110    }
1111}
1112
1113READ8_DEVICE_HANDLER( m58817_status_r )
1114{
1115   tms5110_state *tms = get_safe_token(device);
1116
1117    /* bring up to date first */
1118    stream_update(tms->stream);
10651119    return (tms->talk_status << 0); /*CTL1 = still talking ? */
10661120}
10671121
1122/******************************************************************************
10681123
1124     tms5110_romclk_r -- read status of romclk
10691125
1126******************************************************************************/
1127
1128static TIMER_CALLBACK( romclk_timer_cb )
1129{
1130   tms5110_state *tms = get_safe_token(ptr);
1131   tms->romclk_state = !tms->romclk_state;
1132}
1133
1134READ8_DEVICE_HANDLER( tms5110_romclk_r )
1135{
1136   tms5110_state *tms = get_safe_token(device);
1137
1138    /* bring up to date first */
1139    stream_update(tms->stream);
1140
1141    /* create and start timer if necessary */
1142    if (tms->romclk_timer == NULL)
1143    {
1144       tms->romclk_timer = timer_alloc(device->machine, romclk_timer_cb, (void *) device);
1145       timer_adjust_periodic(tms->romclk_timer, ATTOTIME_IN_HZ(device->clock / 40), 0, ATTOTIME_IN_HZ(device->clock / 40));
1146    }
1147    return tms->romclk_state;
1148}
1149
1150
1151
10701152/******************************************************************************
10711153
10721154     tms5110_ready_r -- return the not ready status from the sound chip
src/emu/sound/tms5110.h
r5891r5892
2626};
2727
2828WRITE8_DEVICE_HANDLER( tms5110_ctl_w );
29READ8_DEVICE_HANDLER( tms5110_ctl_r );
2930WRITE8_DEVICE_HANDLER( tms5110_pdc_w );
3031
31READ8_DEVICE_HANDLER( tms5110_status_r );
32READ8_DEVICE_HANDLER( tms5110_romclk_r );
33
34/* m58817 status line */
35READ8_DEVICE_HANDLER( m58817_status_r );
36
3237int tms5110_ready_r(const device_config *device);
3338
3439void tms5110_set_frequency(const device_config *device, int frequency);
src/emu/sound/disc_mth.c
r5891r5892
1010 ************************************************************************
1111 *
1212 * DST_ADDDER            - Multichannel adder
13 * DST_BITS_DECODE       - Decode Bits from input node
1314 * DST_CLAMP             - Simple signal clamping circuit
1415 * DST_COMP_ADDER        - Selectable parallel component circuit
1516 * DST_DAC_R1            - R1 Ladder DAC with cap filtering
r5891r5892
2627 * DST_LOGIC_NXOR        - Logic NXOR gate 2 input
2728 * DST_LOGIC_DFF         - Logic D-type flip/flop
2829 * DST_LOGIC_JKFF        - Logic JK-type flip/flop
30 * DST_LOGIC_SHIFT       - Logic Shift Register
2931 * DST_LOOKUP_TABLE      - Return value from lookup table
3032 * DST_MIXER             - Final Mixer Stage
3133 * DST_MULTIPLEX         - 1 of x Multiplexer/switch
r5891r5892
5355   int from;
5456   int count;
5557   int last_val;
56   int v_out;
5758};
5859
5960struct dst_dac_r1_context
r5891r5892
123124   int clocktype;
124125};
125126
127struct dst_shift_context
128{
129   double   t_left;      /* time unused during last sample in seconds */
130   UINT32   shift_data;
131   UINT32   bit_mask;
132   UINT8   clock_type;
133   UINT8   reset_on_high;
134   UINT8   shift_r;
135   UINT8   last;
136};
137
126138struct dst_size_context
127139{
128140   int size;
r5891r5892
292304 *
293305 * DST_DAC_R1 - R1 Ladder DAC with cap smoothing
294306 *
295 * input[0]    - Enable
296 * input[1]    - Binary Data Input
297 * input[2]    - Data On Voltage (3.4 for TTL)
307 * input[0]    - Binary Data Input
308 * input[1]    - Data On Voltage (3.4 for TTL)
298309 *
299310 * also passed discrete_dac_r1_ladder structure
300311 *
301312 * Mar 2004, D Renaud.
302313 ************************************************************************/
303#define DST_DAC_R1__ENABLE      DISCRETE_INPUT(0)
304#define DST_DAC_R1__DATA      DISCRETE_INPUT(1)
305#define DST_DAC_R1__VON         DISCRETE_INPUT(2)
314#define DST_DAC_R1__DATA      DISCRETE_INPUT(0)
315#define DST_DAC_R1__VON         DISCRETE_INPUT(1)
306316
307317static DISCRETE_STEP(dst_dac_r1)
308318{
r5891r5892
317327   data   = (int)DST_DAC_R1__DATA;
318328   x_time = DST_DAC_R1__DATA - data;
319329
320   if (DST_DAC_R1__ENABLE)
330   von = DST_DAC_R1__VON;
331   for (bit=0; bit < info->ladderLength; bit++)
321332   {
322      von = DST_DAC_R1__VON;
323      for (bit=0; bit < info->ladderLength; bit++)
333      /* Add up currents of ON circuits per Millman. */
334
335      /* ignore if no resistor present */
336      if (info->r[bit] != 0)
324337      {
325         /* Add up currents of ON circuits per Millman. */
338         i_bit   = von / info->r[bit];
339         bit_val = (data >> bit) & 0x01;
326340
327         /* ignore if no resistor present */
328         if (info->r[bit] != 0)
341         if ((x_time != 0.0) && (bit_val != ((context->last_data >> bit) & 0x01)))
329342         {
330            i_bit   = von / info->r[bit];
331            bit_val = (data >> bit) & 0x01;
332
333            if ((x_time != 0.0) && (bit_val != ((context->last_data >> bit) & 0x01)))
334            {
335               /* there is x_time and a change in bit,
336                     * so anti-alias the current */
337               i_bit *= bit_val ? x_time : 1.0 - x_time;
338            }
339            else
340            {
341               /* there is no x_time or a change in bit,
342                     * so 0 the current if the bit value is 0 */
343                if (bit_val == 0)
344                   i_bit = 0;
345            }
346            i_total += i_bit;
343            /* there is x_time and a change in bit,
344                 * so anti-alias the current */
345            i_bit *= bit_val ? x_time : 1.0 - x_time;
347346         }
347         else
348         {
349            /* there is no x_time or a change in bit,
350                 * so 0 the current if the bit value is 0 */
351             if (bit_val == 0)
352                i_bit = 0;
353         }
354         i_total += i_bit;
348355      }
356   }
349357
350      v = i_total * context->r_total;
351      context->last_data = data;
358   v = i_total * context->r_total;
359   context->last_data = data;
352360
353      /* Filter if needed, else just output voltage */
354      node->output[0] = info->cFilter ? node->output[0] + ((v - node->output[0]) * context->exponent) : v;
355   }
356   else
357   {
358      /*
359         * If module is disabled we will just leave the voltage where it was.
360         * We may want to set it to 0 in the future, but we will probably never
361         * disable this module.
362         */
363   }
361   /* Filter if needed, else just output voltage */
362   node->output[0] = info->cFilter ? node->output[0] + ((v - node->output[0]) * context->exponent) : v;
364363}
365364
366365static DISCRETE_RESET(dst_dac_r1)
r5891r5892
411410   if (info->cFilter)
412411   {
413412      /* Setup filter constants */
414      context->exponent = RC_CHARGE_EXP(node, context->r_total * info->cFilter);
413      context->exponent = RC_CHARGE_EXP(context->r_total * info->cFilter);
415414   }
416415}
417416
r5891r5892
509508 *
510509 * DST_GAIN - This is a programmable gain module with enable function
511510 *
512 * input[0]    - Enable input value
513 * input[1]    - Channel0 input value
514 * input[2]    - Gain value
515 * input[3]    - Final addition offset
511 * input[0]    - Channel0 input value
512 * input[1]    - Gain value
513 * input[2]    - Final addition offset
516514 *
517515 ************************************************************************/
518#define DST_GAIN__ENABLE   DISCRETE_INPUT(0)
519#define DST_GAIN__IN      DISCRETE_INPUT(1)
520#define DST_GAIN__GAIN      DISCRETE_INPUT(2)
521#define DST_GAIN__OFFSET   DISCRETE_INPUT(3)
516#define DST_GAIN__IN      DISCRETE_INPUT(0)
517#define DST_GAIN__GAIN      DISCRETE_INPUT(1)
518#define DST_GAIN__OFFSET   DISCRETE_INPUT(2)
522519
523520static DISCRETE_STEP(dst_gain)
524521{
525   if(DST_GAIN__ENABLE)
526   {
527      node->output[0]  = DST_GAIN__IN * DST_GAIN__GAIN;
528      node->output[0] += DST_GAIN__OFFSET;
529   }
530   else
531   {
532      node->output[0] = 0;
533   }
522      node->output[0]  = DST_GAIN__IN * DST_GAIN__GAIN + DST_GAIN__OFFSET;
534523}
535524
536525
r5891r5892
660649 * input[1]    - input[0] value
661650 *
662651 ************************************************************************/
663#define DST_LOGIC_INV__ENABLE   DISCRETE_INPUT(0)
664#define DST_LOGIC_INV__IN      DISCRETE_INPUT(1)
652#define DST_LOGIC_INV__IN      DISCRETE_INPUT(0)
665653
666654static DISCRETE_STEP(dst_logic_inv)
667655{
668   if(DST_LOGIC_INV__ENABLE)
669   {
670      node->output[0] = DST_LOGIC_INV__IN ? 0.0 : 1.0;
671   }
672   else
673   {
674      node->output[0] = 0.0;
675   }
656   node->output[0] = DST_LOGIC_INV__IN ? 0.0 : 1.0;
676657}
677658
678659/************************************************************************
r5891r5892
699680   {
700681      context->last_val = v;
701682      for (i = 0; i < context->count; i++ )
702         node->output[i] = ((v >> (i+context->from)) & 1) * context->v_out;
683         node->output[i] = ((v >> (i+context->from)) & 1) * DST_BITS_DECODE__VOUT;
703684   }
704685}
705686
r5891r5892
709690
710691   context->from = DST_BITS_DECODE__FROM;
711692   context->count = DST_BITS_DECODE__TO - context->from + 1;
712   context->v_out = DST_BITS_DECODE__VOUT;
713693
714694   DISCRETE_STEP_CALL(dst_bits_decode);
715695}
r5891r5892
717697 *
718698 * DST_LOGIC_AND - Logic AND gate implementation
719699 *
720 * input[0]    - Enable
721 * input[1]    - input[0] value
722 * input[2]    - input[1] value
723 * input[3]    - input[2] value
724 * input[4]    - input[3] value
700 * input[0]    - input[0] value
701 * input[1]    - input[1] value
702 * input[2]    - input[2] value
703 * input[3]    - input[3] value
725704 *
726705 ************************************************************************/
727#define DST_LOGIC_AND__ENABLE   DISCRETE_INPUT(0)
728#define DST_LOGIC_AND__IN0      DISCRETE_INPUT(1)
729#define DST_LOGIC_AND__IN1      DISCRETE_INPUT(2)
730#define DST_LOGIC_AND__IN2      DISCRETE_INPUT(3)
731#define DST_LOGIC_AND__IN3      DISCRETE_INPUT(4)
706#define DST_LOGIC_AND__IN0      DISCRETE_INPUT(0)
707#define DST_LOGIC_AND__IN1      DISCRETE_INPUT(1)
708#define DST_LOGIC_AND__IN2      DISCRETE_INPUT(2)
709#define DST_LOGIC_AND__IN3      DISCRETE_INPUT(3)
732710
733711static DISCRETE_STEP(dst_logic_and)
734712{
735   if(DST_LOGIC_AND__ENABLE)
736   {
737      node->output[0] = (DST_LOGIC_AND__IN0 && DST_LOGIC_AND__IN1 && DST_LOGIC_AND__IN2 && DST_LOGIC_AND__IN3)? 1.0 : 0.0;
738   }
739   else
740   {
741      node->output[0] = 0.0;
742   }
713   node->output[0] = (DST_LOGIC_AND__IN0 && DST_LOGIC_AND__IN1 && DST_LOGIC_AND__IN2 && DST_LOGIC_AND__IN3)? 1.0 : 0.0;
743714}
744715
745716/************************************************************************
746717 *
747718 * DST_LOGIC_NAND - Logic NAND gate implementation
748719 *
749 * input[0]    - Enable
750 * input[1]    - input[0] value
751 * input[2]    - input[1] value
752 * input[3]    - input[2] value
753 * input[4]    - input[3] value
720 * input[0]    - input[0] value
721 * input[1]    - input[1] value
722 * input[2]    - input[2] value
723 * input[3]    - input[3] value
754724 *
755725 ************************************************************************/
756#define DST_LOGIC_NAND__ENABLE   DISCRETE_INPUT(0)
757#define DST_LOGIC_NAND__IN0      DISCRETE_INPUT(1)
758#define DST_LOGIC_NAND__IN1      DISCRETE_INPUT(2)
759#define DST_LOGIC_NAND__IN2      DISCRETE_INPUT(3)
760#define DST_LOGIC_NAND__IN3      DISCRETE_INPUT(4)
726#define DST_LOGIC_NAND__IN0      DISCRETE_INPUT(0)
727#define DST_LOGIC_NAND__IN1      DISCRETE_INPUT(1)
728#define DST_LOGIC_NAND__IN2      DISCRETE_INPUT(2)
729#define DST_LOGIC_NAND__IN3      DISCRETE_INPUT(3)
761730
762731static DISCRETE_STEP(dst_logic_nand)
763732{
764   if(DST_LOGIC_NAND__ENABLE)
765   {
766      node->output[0]= (DST_LOGIC_NAND__IN0 && DST_LOGIC_NAND__IN1 && DST_LOGIC_NAND__IN2 && DST_LOGIC_NAND__IN3)? 0.0 : 1.0;
767   }
768   else
769   {
770      node->output[0] = 0.0;
771   }
733   node->output[0]= (DST_LOGIC_NAND__IN0 && DST_LOGIC_NAND__IN1 && DST_LOGIC_NAND__IN2 && DST_LOGIC_NAND__IN3)? 0.0 : 1.0;
772734}
773735
774736/************************************************************************
775737 *
776738 * DST_LOGIC_OR  - Logic OR  gate implementation
777739 *
778 * input[0]    - Enable
779 * input[1]    - input[0] value
780 * input[2]    - input[1] value
781 * input[3]    - input[2] value
782 * input[4]    - input[3] value
740 * input[0]    - input[0] value
741 * input[1]    - input[1] value
742 * input[2]    - input[2] value
743 * input[3]    - input[3] value
783744 *
784745 ************************************************************************/
785#define DST_LOGIC_OR__ENABLE   DISCRETE_INPUT(0)
786#define DST_LOGIC_OR__IN0      DISCRETE_INPUT(1)
787#define DST_LOGIC_OR__IN1      DISCRETE_INPUT(2)
788#define DST_LOGIC_OR__IN2      DISCRETE_INPUT(3)
789#define DST_LOGIC_OR__IN3      DISCRETE_INPUT(4)
746#define DST_LOGIC_OR__IN0      DISCRETE_INPUT(0)
747#define DST_LOGIC_OR__IN1      DISCRETE_INPUT(1)
748#define DST_LOGIC_OR__IN2      DISCRETE_INPUT(2)
749#define DST_LOGIC_OR__IN3      DISCRETE_INPUT(3)
790750
791751static DISCRETE_STEP(dst_logic_or)
792752{
793   if(DST_LOGIC_OR__ENABLE)
794   {
795      node->output[0] = (DST_LOGIC_OR__IN0 || DST_LOGIC_OR__IN1 || DST_LOGIC_OR__IN2 || DST_LOGIC_OR__IN3) ? 1.0 : 0.0;
796   }
797   else
798   {
799      node->output[0] = 0.0;
800   }
753   node->output[0] = (DST_LOGIC_OR__IN0 || DST_LOGIC_OR__IN1 || DST_LOGIC_OR__IN2 || DST_LOGIC_OR__IN3) ? 1.0 : 0.0;
801754}
802755
803756/************************************************************************
804757 *
805758 * DST_LOGIC_NOR - Logic NOR gate implementation
806759 *
807 * input[0]    - Enable
808 * input[1]    - input[0] value
809 * input[2]    - input[1] value
810 * input[3]    - input[2] value
811 * input[4]    - input[3] value
760 * input[0]    - input[0] value
761 * input[1]    - input[1] value
762 * input[2]    - input[2] value
763 * input[3]    - input[3] value
812764 *
813765 ************************************************************************/
814#define DST_LOGIC_NOR__ENABLE   DISCRETE_INPUT(0)
815#define DST_LOGIC_NOR__IN0      DISCRETE_INPUT(1)
816#define DST_LOGIC_NOR__IN1      DISCRETE_INPUT(2)
817#define DST_LOGIC_NOR__IN2      DISCRETE_INPUT(3)
818#define DST_LOGIC_NOR__IN3      DISCRETE_INPUT(4)
766#define DST_LOGIC_NOR__IN0      DISCRETE_INPUT(0)
767#define DST_LOGIC_NOR__IN1      DISCRETE_INPUT(1)
768#define DST_LOGIC_NOR__IN2      DISCRETE_INPUT(2)
769#define DST_LOGIC_NOR__IN3      DISCRETE_INPUT(3)
819770
820771static DISCRETE_STEP(dst_logic_nor)
821772{
822   if(DST_LOGIC_NOR__ENABLE)
823   {
824      node->output[0] = (DST_LOGIC_NOR__IN0 || DST_LOGIC_NOR__IN1 || DST_LOGIC_NOR__IN2 || DST_LOGIC_NOR__IN3) ? 0.0 : 1.0;
825   }
826   else
827   {
828      node->output[0] = 0.0;
829   }
773   node->output[0] = (DST_LOGIC_NOR__IN0 || DST_LOGIC_NOR__IN1 || DST_LOGIC_NOR__IN2 || DST_LOGIC_NOR__IN3) ? 0.0 : 1.0;
830774}
831775
832776/************************************************************************
833777 *
834778 * DST_LOGIC_XOR - Logic XOR gate implementation
835779 *
836 * input[0]    - Enable
837 * input[1]    - input[0] value
838 * input[2]    - input[1] value
780 * input[0]    - input[0] value
781 * input[1]    - input[1] value
839782 *
840783 ************************************************************************/
841#define DST_LOGIC_XOR__ENABLE   DISCRETE_INPUT(0)
842#define DST_LOGIC_XOR__IN0      DISCRETE_INPUT(1)
843#define DST_LOGIC_XOR__IN1      DISCRETE_INPUT(2)
784#define DST_LOGIC_XOR__IN0      DISCRETE_INPUT(0)
785#define DST_LOGIC_XOR__IN1      DISCRETE_INPUT(1)
844786
845787static DISCRETE_STEP(dst_logic_xor)
846788{
847   if(DST_LOGIC_XOR__ENABLE)
848   {
849      node->output[0] = ((DST_LOGIC_XOR__IN0 && !DST_LOGIC_XOR__IN1) || (!DST_LOGIC_XOR__IN0 && DST_LOGIC_XOR__IN1)) ? 1.0 : 0.0;
850   }
851   else
852   {
853      node->output[0] = 0.0;
854   }
789   node->output[0] = ((DST_LOGIC_XOR__IN0 && !DST_LOGIC_XOR__IN1) || (!DST_LOGIC_XOR__IN0 && DST_LOGIC_XOR__IN1)) ? 1.0 : 0.0;
855790}
856791
857792/************************************************************************
858793 *
859794 * DST_LOGIC_NXOR - Logic NXOR gate implementation
860795 *
861 * input[0]    - Enable
862 * input[1]    - input[0] value
863 * input[2]    - input[1] value
796 * input[0]    - input[0] value
797 * input[1]    - input[1] value
864798 *
865799 ************************************************************************/
866#define DST_LOGIC_XNOR__ENABLE   DISCRETE_INPUT(0)
867#define DST_LOGIC_XNOR__IN0      DISCRETE_INPUT(1)
868#define DST_LOGIC_XNOR__IN1      DISCRETE_INPUT(2)
800#define DST_LOGIC_XNOR__IN0      DISCRETE_INPUT(0)
801#define DST_LOGIC_XNOR__IN1      DISCRETE_INPUT(1)
869802
870803static DISCRETE_STEP(dst_logic_nxor)
871804{
872   if(DST_LOGIC_XNOR__ENABLE)
873   {
874      node->output[0] = ((DST_LOGIC_XNOR__IN0 && !DST_LOGIC_XNOR__IN1) || (!DST_LOGIC_XNOR__IN0 && DST_LOGIC_XNOR__IN1)) ? 0.0 : 1.0;
875   }
876   else
877   {
878      node->output[0] = 0.0;
879   }
805   node->output[0] = ((DST_LOGIC_XNOR__IN0 && !DST_LOGIC_XNOR__IN1) || (!DST_LOGIC_XNOR__IN0 && DST_LOGIC_XNOR__IN1)) ? 0.0 : 1.0;
880806}
881807
882808
r5891r5892
884810 *
885811 * DST_LOGIC_DFF - Standard D-type flip-flop implementation
886812 *
887 * input[0]    - enable
888 * input[1]    - /Reset
889 * input[2]    - /Set
890 * input[3]    - clock
891 * input[4]    - data
813 * input[0]    - /Reset
814 * input[1]    - /Set
815 * input[2]    - clock
816 * input[3]    - data
892817 *
893818 ************************************************************************/
894#define DST_LOGIC_DFF__ENABLE    DISCRETE_INPUT(0)
895#define DST_LOGIC_DFF__RESET   !DISCRETE_INPUT(1)
896#define DST_LOGIC_DFF__SET      !DISCRETE_INPUT(2)
897#define DST_LOGIC_DFF__CLOCK    DISCRETE_INPUT(3)
898#define DST_LOGIC_DFF__DATA     DISCRETE_INPUT(4)
819#define DST_LOGIC_DFF__RESET   !DISCRETE_INPUT(0)
820#define DST_LOGIC_DFF__SET      !DISCRETE_INPUT(1)
821#define DST_LOGIC_DFF__CLOCK    DISCRETE_INPUT(2)
822#define DST_LOGIC_DFF__DATA     DISCRETE_INPUT(3)
899823
900824static DISCRETE_STEP(dst_logic_dff)
901825{
r5891r5892
903827
904828   int clk = (int)DST_LOGIC_DFF__CLOCK;
905829
906   if (DST_LOGIC_DFF__ENABLE)
907   {
908      if (DST_LOGIC_DFF__RESET)
909         node->output[0] = 0;
910      else if (DST_LOGIC_DFF__SET)
911         node->output[0] = 1;
912      else if (!context->last_clk && clk)   /* low to high */
913         node->output[0] = DST_LOGIC_DFF__DATA;
914   }
915   else
916   {
830   if (DST_LOGIC_DFF__RESET)
917831      node->output[0] = 0;
918   }
832   else if (DST_LOGIC_DFF__SET)
833      node->output[0] = 1;
834   else if (!context->last_clk && clk)   /* low to high */
835      node->output[0] = DST_LOGIC_DFF__DATA;
919836   context->last_clk = clk;
920837}
921838
r5891r5892
932849 *
933850 * DST_LOGIC_JKFF - Standard JK-type flip-flop implementation
934851 *
935 * input[0]    - enable
936 * input[1]    - /Reset
937 * input[2]    - /Set
938 * input[3]    - clock
939 * input[4]    - J
940 * input[5]    - K
852 * input[0]    - /Reset
853 * input[1]    - /Set
854 * input[2]    - clock
855 * input[3]    - J
856 * input[4]    - K
941857 *
942858 ************************************************************************/
943#define DST_LOGIC_JKFF__ENABLE    DISCRETE_INPUT(0)
944#define DST_LOGIC_JKFF__RESET   !DISCRETE_INPUT(1)
945#define DST_LOGIC_JKFF__SET      !DISCRETE_INPUT(2)
946#define DST_LOGIC_JKFF__CLOCK    DISCRETE_INPUT(3)
947#define DST_LOGIC_JKFF__J        DISCRETE_INPUT(4)
948#define DST_LOGIC_JKFF__K        DISCRETE_INPUT(5)
859#define DST_LOGIC_JKFF__RESET   !DISCRETE_INPUT(0)
860#define DST_LOGIC_JKFF__SET      !DISCRETE_INPUT(1)
861#define DST_LOGIC_JKFF__CLOCK    DISCRETE_INPUT(2)
862#define DST_LOGIC_JKFF__J        DISCRETE_INPUT(3)
863#define DST_LOGIC_JKFF__K        DISCRETE_INPUT(4)
949864
950865static DISCRETE_STEP(dst_logic_jkff)
951866{
r5891r5892
955870   int j   = (int)DST_LOGIC_JKFF__J;
956871   int k   = (int)DST_LOGIC_JKFF__K;
957872
958   if (DST_LOGIC_JKFF__ENABLE)
873   if (DST_LOGIC_JKFF__RESET)
874      node->output[0] = 0;
875   else if (DST_LOGIC_JKFF__SET)
876      node->output[0] = 1;
877   else if (context->last_clk && !clk)   /* high to low */
959878   {
960      if (DST_LOGIC_JKFF__RESET)
961         node->output[0] = 0;
962      else if (DST_LOGIC_JKFF__SET)
963         node->output[0] = 1;
964      else if (context->last_clk && !clk)   /* high to low */
879      if (!j)
965880      {
966         if (!j)
967         {
968            /* J=0, K=0 - Hold */
969            if (k)
970               /* J=0, K=1 - Reset */
971               node->output[0] = 0;
972         }
881         /* J=0, K=0 - Hold */
882         if (k)
883            /* J=0, K=1 - Reset */
884            node->output[0] = 0;
885      }
886      else
887      {
888         if (!k)
889            /* J=1, K=0 - Set */
890            node->output[0] = 1;
973891         else
974         {
975            if (!k)
976               /* J=1, K=0 - Set */
977               node->output[0] = 1;
978            else
979               /* J=1, K=1 - Toggle */
980               node->output[0] = !(int)node->output[0];
981         }
892            /* J=1, K=1 - Toggle */
893            node->output[0] = !(int)node->output[0];
982894      }
983895   }
896   context->last_clk = clk;
897}
898
899
900/************************************************************************
901 *
902 * DST_LOGIC_SHIFT - Shift Register implementation
903 *
904 ************************************************************************/
905#define DST_LOGIC_SHIFT__IN         DISCRETE_INPUT(0)
906#define DST_LOGIC_SHIFT__RESET      DISCRETE_INPUT(1)
907#define DST_LOGIC_SHIFT__CLK      DISCRETE_INPUT(2)
908#define DST_LOGIC_SHIFT__SIZE      DISCRETE_INPUT(3)
909#define DST_LOGIC_SHIFT__OPTIONS   DISCRETE_INPUT(4)
910
911static DISCRETE_STEP(dst_logic_shift)
912{
913   struct dst_shift_context *context = (struct dst_shift_context *)node->context;
914
915   double   cycles;
916   double   ds_clock;
917   int      clock = 0, inc = 0;
918
919   int input_bit = (DST_LOGIC_SHIFT__IN != 0) ? 1 : 0;
920   ds_clock = DST_LOGIC_SHIFT__CLK;
921   if (context->clock_type == DISC_CLK_IS_FREQ)
922   {
923      /* We need to keep clocking the internal clock even if in reset. */
924      cycles = (context->t_left + node->info->sample_time) * ds_clock;
925      inc    = (int)cycles;
926      context->t_left = (cycles - inc) / ds_clock;
927   }
984928   else
985929   {
930      clock  = (int)ds_clock;
931   }
932
933   /* If reset enabled then set output to the reset value.  No x_time in reset. */
934   if(((DST_LOGIC_SHIFT__RESET == 0) ? 0 : 1) == context->reset_on_high)
935   {
936      context->shift_data = 0;
986937      node->output[0] = 0;
938      return;
987939   }
988   context->last_clk = clk;
940
941   /* increment clock */
942   switch (context->clock_type)
943   {
944      case DISC_CLK_ON_F_EDGE:
945      case DISC_CLK_ON_R_EDGE:
946         /* See if the clock has toggled to the proper edge */
947         clock = (clock != 0);
948         if (context->last != clock)
949         {
950            context->last = clock;
951            if (context->clock_type == clock)
952            {
953               /* Toggled */
954               inc = 1;
955            }
956         }
957         break;
958
959      case DISC_CLK_BY_COUNT:
960         /* Clock number of times specified. */
961         inc = clock;
962         break;
963   }
964
965   if (inc > 0)
966   {
967      if (context->shift_r)
968      {
969         context->shift_data >>= 1;
970         context->shift_data |= input_bit << ((int)DST_LOGIC_SHIFT__SIZE - 1);
971         inc--;
972         context->shift_data >>= inc;
973      }
974      else
975      {
976         context->shift_data <<= 1;
977         context->shift_data |= input_bit;
978         inc--;
979         context->shift_data <<= inc;
980      }
981      context->shift_data &= context->bit_mask;
982   }
983
984   node->output[0] = context->shift_data;
989985}
990986
987static DISCRETE_RESET(dst_logic_shift)
988{
989   struct dst_shift_context *context = (struct dst_shift_context *)node->context;
991990
991   context->bit_mask = (1 << (int)DST_LOGIC_SHIFT__SIZE) - 1;
992   context->clock_type = (int)DST_LOGIC_SHIFT__OPTIONS & DISC_CLK_MASK;
993   context->reset_on_high = ((int)DST_LOGIC_SHIFT__OPTIONS & DISC_LOGIC_SHIFT__RESET_H) ? 1 : 0;
994   context->shift_r = ((int)DST_LOGIC_SHIFT__OPTIONS & DISC_LOGIC_SHIFT__RIGHT)  ? 1 : 0;
995
996   context->t_left  = 0;
997   context->last = 0;
998   context->shift_data   = 0;
999   node->output[0]  = 0;
1000}
1001
9921002/************************************************************************
9931003 *
9941004 * DST_LOOKUP_TABLE  - Return value from lookup table
9951005 *
996 * input[0]    - Enable input value
997 * input[1]    - Input 1
998 * input[2]    - Table size
1006 * input[0]    - Input 1
1007 * input[1]    - Table size
9991008 *
10001009 * Also passed address of the lookup table
10011010 *
10021011 * Feb 2007, D Renaud.
10031012 ************************************************************************/
1004#define DST_LOOKUP_TABLE__ENABLE   DISCRETE_INPUT(0)
1005#define DST_LOOKUP_TABLE__IN      DISCRETE_INPUT(1)
1006#define DST_LOOKUP_TABLE__SIZE      DISCRETE_INPUT(2)
1013#define DST_LOOKUP_TABLE__IN      DISCRETE_INPUT(0)
1014#define DST_LOOKUP_TABLE__SIZE      DISCRETE_INPUT(1)
10071015
10081016static DISCRETE_STEP(dst_lookup_table)
10091017{
r5891r5892
10111019
10121020   int   addr = DST_LOOKUP_TABLE__IN;
10131021
1014   if (!DST_LOOKUP_TABLE__ENABLE || addr < 0 || addr >= DST_LOOKUP_TABLE__SIZE)
1022   if (addr < 0 || addr >= DST_LOOKUP_TABLE__SIZE)
10151023      node->output[0] = 0;
10161024   else
10171025      node->output[0] = table[addr];
r5891r5892
11381146                     /* Re-calculate exponent if resistor is a node and has changed value */
11391147                     if (*context->r_node[bit] != context->r_last[bit])
11401148                     {
1141                        context->exponent_rc[bit] =  RC_CHARGE_EXP(node, rTemp2 * info->c[bit]);
1149                        context->exponent_rc[bit] =  RC_CHARGE_EXP(rTemp2 * info->c[bit]);
11421150                        context->r_last[bit] = *context->r_node[bit];
11431151                     }
11441152                  }
r5891r5892
11941202         if (r_node_bit_flag != 0)
11951203         {
11961204            /* Re-calculate exponent if resistor nodes are used */
1197            context->exponent_c_f =  RC_CHARGE_EXP(node, r_total * info->cF);
1205            context->exponent_c_f =  RC_CHARGE_EXP(r_total * info->cF);
11981206         }
11991207         context->v_cap_f += (v - v_ref - context->v_cap_f) * context->exponent_c_f;
12001208         v = context->v_cap_f;
r5891r5892
12881296               break;
12891297         }
12901298         /* Setup filter constants */
1291         context->exponent_rc[bit] = RC_CHARGE_EXP(node, rTemp * info->c[bit]);
1299         context->exponent_rc[bit] = RC_CHARGE_EXP(rTemp * info->c[bit]);
12921300      }
12931301   }
12941302
r5891r5892
13031311   if (info->cF != 0)
13041312   {
13051313      /* Setup filter constants */
1306      context->exponent_c_f = RC_CHARGE_EXP(node, ((info->type == DISC_MIXER_IS_OP_AMP) ? info->rF : (1.0 / context->r_total)) * info->cF);
1314      context->exponent_c_f = RC_CHARGE_EXP(((info->type == DISC_MIXER_IS_OP_AMP) ? info->rF : (1.0 / context->r_total)) * info->cF);
13071315   }
13081316
13091317   context->v_cap_amp      = 0;
r5891r5892
13131321      /* Setup filter constants */
13141322      /* We will use 100k ohms as an average final stage impedance. */
13151323      /* Your amp/speaker system will have more effect on incorrect filtering then any value used here. */
1316      context->exponent_c_amp = RC_CHARGE_EXP(node, RES_K(100) * info->cAmp);
1324      context->exponent_c_amp = RC_CHARGE_EXP(RES_K(100) * info->cAmp);
13171325   }
13181326
13191327   if (context->type == DISC_MIXER_IS_OP_AMP_WITH_RI) context->gain = info->rF / info->rI;
r5891r5892
13261334 *
13271335 * DST_MULTIPLEX - 1 of x multiplexer/switch
13281336 *
1329 * input[0]    - Enable input value
1330 * input[1]    - switch position
1331 * input[2]    - input[0]
1332 * input[3]    - input[1]
1337 * input[0]    - switch position
1338 * input[1]    - input[0]
1339 * input[2]    - input[1]
13331340 * .....
13341341 *
13351342 * Dec 2004, D Renaud.
13361343 ************************************************************************/
1337#define DST_MULTIPLEX__ENABLE      DISCRETE_INPUT(0)
1338#define DST_MULTIPLEX__ADDR         DISCRETE_INPUT(1)
1339#define DST_MULTIPLEX__INP(addr)   DISCRETE_INPUT(2 + addr)
1344#define DST_MULTIPLEX__ADDR         DISCRETE_INPUT(0)
1345#define DST_MULTIPLEX__INP(addr)   DISCRETE_INPUT(1 + addr)
13401346
13411347static DISCRETE_STEP(dst_multiplex)
13421348{
r5891r5892
13441350
13451351   int addr;
13461352
1347   if(DST_MULTIPLEX__ENABLE)
1353   addr = DST_MULTIPLEX__ADDR;   /* FP to INT */
1354   if ((addr >= 0) && (addr < context->size))
13481355   {
1349      addr = DST_MULTIPLEX__ADDR;   /* FP to INT */
1350      if ((addr >= 0) && (addr < context->size))
1351      {
1352         node->output[0] = DST_MULTIPLEX__INP(addr);
1353      }
1354      else
1355      {
1356         /* Bad address.  We will leave the output alone. */
1357         discrete_log(node->info, "NODE_%02d - Address = %d. Out of bounds\n", NODE_BLOCKINDEX(node), addr);
1358      }
1356      node->output[0] = DST_MULTIPLEX__INP(addr);
13591357   }
13601358   else
13611359   {
1362      node->output[0] = 0;
1360      /* Bad address.  We will leave the output alone. */
1361      discrete_log(node->info, "NODE_%02d - Address = %d. Out of bounds\n", NODE_BLOCKINDEX(node), addr);
13631362   }
13641363}
13651364
r5891r5892
15241523 *
15251524 * DST_SAMPHOLD - Sample & Hold Implementation
15261525 *
1527 * input[0]    - Enable
1528 * input[1]    - input[0] value
1529 * input[2]    - clock node
1530 * input[3]    - clock type
1526 * input[0]    - input[0] value
1527 * input[1]    - clock node
1528 * input[2]    - clock type
15311529 *
15321530 ************************************************************************/
1533#define DST_SAMPHOLD__ENABLE   DISCRETE_INPUT(0)
1534#define DST_SAMPHOLD__IN0      DISCRETE_INPUT(1)
1535#define DST_SAMPHOLD__CLOCK      DISCRETE_INPUT(2)
1536#define DST_SAMPHOLD__TYPE      DISCRETE_INPUT(3)
1531#define DST_SAMPHOLD__IN0      DISCRETE_INPUT(0)
1532#define DST_SAMPHOLD__CLOCK      DISCRETE_INPUT(1)
1533#define DST_SAMPHOLD__TYPE      DISCRETE_INPUT(2)
15371534
15381535static DISCRETE_STEP(dst_samphold)
15391536{
15401537   struct dst_samphold_context *context = (struct dst_samphold_context *)node->context;
15411538
1542   if(DST_SAMPHOLD__ENABLE)
1539   switch(context->clocktype)
15431540   {
1544      switch(context->clocktype)
1545      {
1546         case DISC_SAMPHOLD_REDGE:
1547            /* Clock the whole time the input is rising */
1548            if (DST_SAMPHOLD__CLOCK > context->last_input) node->output[0] = DST_SAMPHOLD__IN0;
1549            break;
1550         case DISC_SAMPHOLD_FEDGE:
1551            /* Clock the whole time the input is falling */
1552            if(DST_SAMPHOLD__CLOCK < context->last_input) node->output[0] = DST_SAMPHOLD__IN0;
1553            break;
1554         case DISC_SAMPHOLD_HLATCH:
1555            /* Output follows input if clock != 0 */
1556            if( DST_SAMPHOLD__CLOCK) node->output[0] = DST_SAMPHOLD__IN0;
1557            break;
1558         case DISC_SAMPHOLD_LLATCH:
1559            /* Output follows input if clock == 0 */
1560            if (DST_SAMPHOLD__CLOCK == 0) node->output[0] = DST_SAMPHOLD__IN0;
1561            break;
1562         default:
1563            discrete_log(node->info, "dst_samphold_step - Invalid clocktype passed");
1564            break;
1565      }
1541      case DISC_SAMPHOLD_REDGE:
1542         /* Clock the whole time the input is rising */
1543         if (DST_SAMPHOLD__CLOCK > context->last_input) node->output[0] = DST_SAMPHOLD__IN0;
1544         break;
1545      case DISC_SAMPHOLD_FEDGE:
1546         /* Clock the whole time the input is falling */
1547         if(DST_SAMPHOLD__CLOCK < context->last_input) node->output[0] = DST_SAMPHOLD__IN0;
1548         break;
1549      case DISC_SAMPHOLD_HLATCH:
1550         /* Output follows input if clock != 0 */
1551         if( DST_SAMPHOLD__CLOCK) node->output[0] = DST_SAMPHOLD__IN0;
1552         break;
1553      case DISC_SAMPHOLD_LLATCH:
1554         /* Output follows input if clock == 0 */
1555         if (DST_SAMPHOLD__CLOCK == 0) node->output[0] = DST_SAMPHOLD__IN0;
1556         break;
1557      default:
1558         discrete_log(node->info, "dst_samphold_step - Invalid clocktype passed");
1559         break;
15661560   }
1567   else
1568   {
1569      node->output[0] = 0;
1570   }
15711561   /* Save the last value */
15721562   context->last_input = DST_SAMPHOLD__CLOCK;
15731563}
r5891r5892
15861576
15871577/************************************************************************
15881578 *
1589 * DSS_SWITCH - Programmable 2 pole switch module with enable function
1579 * DST_SWITCH - Programmable 2 pole switch module with enable function
15901580 *
15911581 * input[0]    - Enable input value
15921582 * input[1]    - switch position
r5891r5892
15941584 * input[3]    - input[1]
15951585 *
15961586 ************************************************************************/
1597#define DSS_SWITCH__ENABLE   DISCRETE_INPUT(0)
1598#define DSS_SWITCH__SWITCH   DISCRETE_INPUT(1)
1599#define DSS_SWITCH__IN0      DISCRETE_INPUT(2)
1600#define DSS_SWITCH__IN1      DISCRETE_INPUT(3)
1587#define DST_SWITCH__ENABLE   DISCRETE_INPUT(0)
1588#define DST_SWITCH__SWITCH   DISCRETE_INPUT(1)
1589#define DST_SWITCH__IN0      DISCRETE_INPUT(2)
1590#define DST_SWITCH__IN1      DISCRETE_INPUT(3)
16011591
16021592static DISCRETE_STEP(dst_switch)
16031593{
1604   if(DSS_SWITCH__ENABLE)
1594   if(DST_SWITCH__ENABLE)
16051595   {
1606      node->output[0] = DSS_SWITCH__SWITCH ? DSS_SWITCH__IN1 : DSS_SWITCH__IN0;
1596      node->output[0] = DST_SWITCH__SWITCH ? DST_SWITCH__IN1 : DST_SWITCH__IN0;
16071597   }
16081598   else
16091599   {
r5891r5892
16131603
16141604/************************************************************************
16151605 *
1616 * DSS_ASWITCH - Analog switch
1606 * DST_ASWITCH - Analog switch
16171607 *
1618 * input[0]    - Enable input value
16191608 * input[1]    - Control
16201609 * input[2]    - Input
16211610 * input[3]    - Threshold for enable
16221611 *
16231612 ************************************************************************/
1624#define DSS_ASWITCH__ENABLE      DISCRETE_INPUT(0)
1625#define DSS_ASWITCH__CTRL      DISCRETE_INPUT(1)
1626#define DSS_ASWITCH__IN         DISCRETE_INPUT(2)
1627#define DSS_ASWITCH__THRESHOLD   DISCRETE_INPUT(3)
1613#define DST_ASWITCH__CTRL      DISCRETE_INPUT(1)
1614#define DST_ASWITCH__IN         DISCRETE_INPUT(2)
1615#define DST_ASWITCH__THRESHOLD   DISCRETE_INPUT(3)
16281616
16291617
16301618static DISCRETE_STEP(dst_aswitch)
16311619{
1632   if(DSS_SWITCH__ENABLE)
1633   {
1634      node->output[0] = DSS_ASWITCH__CTRL > DSS_ASWITCH__THRESHOLD ? DSS_ASWITCH__IN : 0;
1635   }
1636   else
1637   {
1638      node->output[0] = 0;
1639   }
1620   node->output[0] = DST_ASWITCH__CTRL > DST_ASWITCH__THRESHOLD ? DST_ASWITCH__IN : 0;
16401621}
16411622
16421623/************************************************************************
r5891r5892
18641845      if (context->has_r4)
18651846      {
18661847         /* exponential charge */
1867         context->exponent = RC_CHARGE_EXP(node, info->r4 * info->c);
1848         context->exponent = RC_CHARGE_EXP(info->r4 * info->c);
18681849      }
18691850      else
18701851         /* linear charge */
r5891r5892
19351916   const  discrete_op_amp_1sht_info *info    = (const  discrete_op_amp_1sht_info *)node->custom;
19361917   struct dst_op_amp_1sht_context   *context = (struct dst_op_amp_1sht_context *)node->context;
19371918
1938   context->exponent1c = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r3, info->r4) * info->c1);
1939   context->exponent1d = RC_CHARGE_EXP(node, info->r4 * info->c1);
1940   context->exponent2  = RC_CHARGE_EXP(node, info->r2 * info->c2);
1919   context->exponent1c = RC_CHARGE_EXP(RES_2_PARALLEL(info->r3, info->r4) * info->c1);
1920   context->exponent1d = RC_CHARGE_EXP(info->r4 * info->c1);
1921   context->exponent2  = RC_CHARGE_EXP(info->r2 * info->c2);
19411922   context->i_fixed  = (info->vP - OP_AMP_NORTON_VBE) / info->r1;
19421923   context->v_cap1   = context->v_cap2 = 0;
19431924   context->v_max    = info->vP - OP_AMP_NORTON_VBE;
r5891r5892
20622043   context->v_cap1 = 0;
20632044   /* Charge rate thru r5 */
20642045   /* There can be a different charge rates depending on function F3. */
2065   context->exponent_c[0] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r5, info->r6) * info->c1);
2066   context->exponent_c[1] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r5, context->r67) * info->c1);
2046   context->exponent_c[0] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r5, info->r6) * info->c1);
2047   context->exponent_c[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r5, context->r67) * info->c1);
20672048   /* Discharge rate thru r6 + r7 */
2068   context->exponent_d[1] = RC_CHARGE_EXP(node, context->r67 * info->c1);
2049   context->exponent_d[1] = RC_CHARGE_EXP(context->r67 * info->c1);
20692050   /* Discharge rate thru r6 */
20702051   if (info->r6 != 0)
20712052   {
2072      context->exponent_d[0] = RC_CHARGE_EXP(node, info->r6 * info->c1);
2053      context->exponent_d[0] = RC_CHARGE_EXP(info->r6 * info->c1);
20732054   }
20742055   context->v_cap2       = 0;
20752056   context->v_trig2      = (info->v2 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r8, info->r9);
2076   context->exponent2[0] = RC_CHARGE_EXP(node, info->r9 * info->c2);
2077   context->exponent2[1] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r8, info->r9) * info->c2);
2057   context->exponent2[0] = RC_CHARGE_EXP(info->r9 * info->c2);
2058   context->exponent2[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r8, info->r9) * info->c2);
20782059   context->v_cap3  = 0;
20792060   context->v_trig3 = (info->v3 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r10, info->r11);
2080   context->exponent3[0] = RC_CHARGE_EXP(node, info->r11 * info->c3);
2081   context->exponent3[1] = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r10, info->r11) * info->c3);
2061   context->exponent3[0] = RC_CHARGE_EXP(info->r11 * info->c3);
2062   context->exponent3[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r10, info->r11) * info->c3);
20822063
20832064   DISCRETE_STEP_CALL(dst_tvca_op_amp);
20842065}
src/emu/sound/ymf271.c
r5891r5892
16441644         case 1: plfo[3] = PLFO_MAX - ftri_wave; break;
16451645         case 2: plfo[3] = 0 - ftri_wave; break;
16461646         case 3: plfo[3] = 0 - (PLFO_MAX - ftri_wave); break;
1647         default: plfo[3]=0; assert(0); break;
16471648      }
16481649
16491650      for (j=0; j < 4; j++)
src/emu/sound/cdp1863.c
r5891r5892
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - what happens if you connect both clocks?
14    - what happens if you connect both clocks?
1515
1616*/
1717
r5891r5892
7474WRITE8_DEVICE_HANDLER( cdp1863_str_w )
7575{
7676   cdp1863_t *cdp1863 = get_safe_token(device);
77   
77
7878   cdp1863->latch = data;
7979}
8080
src/emu/sound/cdp1863.h
r5891r5892
77
88**********************************************************************
99                            _____   _____
10            _RESET   1 |*    \_/     | 16  Vdd
10                _RESET   1 |*    \_/     | 16  Vdd
1111                 CLK 2   2 |             | 15  OE
1212                 CLK 1   3 |             | 14  OUT
1313                   STR   4 |   CDP1863   | 13  DO7
1414                   DI0   5 |             | 12  DI6
15                   DI1   6 |           | 11  DI5
15                   DI1   6 |             | 11  DI5
1616                   DI2   7 |             | 10  DI4
1717                   Vss   8 |_____________| 9   DI3
1818
src/emu/sound/discrete.c
r5891r5892
1919 * file. All discrete sound primatives MUST implement the following
2020 * API:
2121 *
22 * dsX_NAME_step(inputs, context,float timestep)  - Perform time step
22 * dsX_NAME_step(inputs, context, float timestep)  - Perform time step
2323 *                                                  return output value
2424 * dsX_NAME_reset(context) - Reset to initial state
2525 *
r5891r5892
222222   { DST_DIVIDE      ,"DST_DIVIDE"      , 1 ,0                                      ,NULL                  ,dst_divide_step      ,NULL                  ,NULL                 },
223223   { DST_GAIN        ,"DST_GAIN"        , 1 ,0                                      ,NULL                  ,dst_gain_step        ,NULL                  ,NULL                 },
224224   { DST_LOGIC_INV   ,"DST_LOGIC_INV"   , 1 ,0                                      ,NULL                  ,dst_logic_inv_step   ,NULL                  ,NULL                 },
225   { DST_GAIN        ,"DST_GAIN"        , 1 ,0                                      ,NULL                  ,dst_gain_step        ,NULL                  ,NULL                 },
226225   { DST_BITS_DECODE ,"DST_BITS_DECODE" , 8 ,sizeof(struct dst_bits_decode_context) ,dst_bits_decode_reset ,dst_bits_decode_step ,NULL                  ,NULL                 },
227226   { DST_LOGIC_AND   ,"DST_LOGIC_AND"   , 1 ,0                                      ,NULL                  ,dst_logic_and_step   ,NULL                  ,NULL                 },
228227   { DST_LOGIC_NAND  ,"DST_LOGIC_NAND"  , 1 ,0                                      ,NULL                  ,dst_logic_nand_step  ,NULL                  ,NULL                 },
r5891r5892
232231   { DST_LOGIC_NXOR  ,"DST_LOGIC_NXOR"  , 1 ,0                                      ,NULL                  ,dst_logic_nxor_step  ,NULL                  ,NULL                 },
233232   { DST_LOGIC_DFF   ,"DST_LOGIC_DFF"   , 1 ,sizeof(struct dst_flipflop_context)    ,dst_logic_ff_reset    ,dst_logic_dff_step   ,NULL                  ,NULL                 },
234233   { DST_LOGIC_JKFF  ,"DST_LOGIC_JKFF"  , 1 ,sizeof(struct dst_flipflop_context)    ,dst_logic_ff_reset    ,dst_logic_jkff_step  ,NULL                  ,NULL                 },
234   { DST_LOGIC_SHIFT ,"DST_LOGIC_SHIFT" , 1 ,sizeof(struct dst_shift_context)       ,dst_logic_shift_reset ,dst_logic_shift_step ,NULL                  ,NULL                 },
235235   { DST_LOOKUP_TABLE,"DST_LOOKUP_TABLE", 1 ,0                                      ,NULL                  ,dst_lookup_table_step,NULL                  ,NULL                 },
236236   { DST_MULTIPLEX   ,"DST_MULTIPLEX"   , 1 ,sizeof(struct dst_size_context)        ,dst_multiplex_reset   ,dst_multiplex_step   ,NULL                  ,NULL                 },
237237   { DST_ONESHOT     ,"DST_ONESHOT"     , 1 ,sizeof(struct dst_oneshot_context)     ,dst_oneshot_reset     ,dst_oneshot_step     ,NULL                  ,NULL                 },
r5891r5892
968968
969969      /* --- the following bits of info are returned as NULL-terminated strings --- */
970970      case DEVINFO_STR_NAME:                     strcpy(info->s, "Discrete");                  break;
971      case DEVINFO_STR_FAMILY:               strcpy(info->s, "Analog");                     break;
972      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.1");                        break;
973      case DEVINFO_STR_SOURCE_FILE:                  strcpy(info->s, __FILE__);                     break;
974      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
971      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Analog");                     break;
972      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.1");                        break;
973      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
974      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
975975   }
976976}
977977
src/emu/sound/discrete.h
r5891r5892
224224 * DISCRETE_DIVIDE(NODE,ENAB,IN0,IN1)
225225 * DISCRETE_GAIN(NODE,IN0,GAIN)
226226 * DISCRETE_INVERT(NODE,IN0)
227 * DISCRETE_LOOKUP_TABLE(NODE,ENAB,ADDR,SIZE,TABLE)
227 * DISCRETE_LOOKUP_TABLE(NODE,ADDR,SIZE,TABLE)
228228 * DISCRETE_MULTIPLY(NODE,ENAB,IN0,IN1)
229 * DISCRETE_MULTADD(NODE,ENAB,INP0,INP1,INP2)
229 * DISCRETE_MULTADD(NODE,INP0,INP1,INP2)
230230 * DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE)
231231 * DISCRETE_ONESHOTR(NODE,RESET,TRIG,AMPL,WIDTH,TYPE)
232232 * DISCRETE_ONOFF(NODE,ENAB,INP0)
233233 * DISCRETE_RAMP(NODE,ENAB,RAMP,GRAD,MIN,MAX,CLAMP)
234 * DISCRETE_SAMPLHOLD(NODE,ENAB,INP0,CLOCK,CLKTYPE)
234 * DISCRETE_SAMPLHOLD(NODE,INP0,CLOCK,CLKTYPE)
235235 * DISCRETE_SWITCH(NODE,ENAB,SWITCH,INP0,INP1)
236 * DISCRETE_ASWITCH(NODE,CTRL,INP,THRESHOLD)
236237 * DISCRETE_TRANSFORM2(NODE,INP0,INP1,FUNCT)
237238 * DISCRETE_TRANSFORM3(NODE,INP0,INP1,INP2,FUNCT)
238239 * DISCRETE_TRANSFORM4(NODE,INP0,INP1,INP2,INP3,FUNCT)
239240 * DISCRETE_TRANSFORM5(NODE,INP0,INP1,INP2,INP3,INP4,FUNCT)
240241 *
241242 * DISCRETE_COMP_ADDER(NODE,DATA,TABLE)
242 * DISCRETE_DAC_R1(NODE,ENAB,DATA,VDATA,LADDER)
243 * DISCRETE_DAC_R1(NODE,DATA,VDATA,LADDER)
243244 * DISCRETE_DIODE_MIXER2(NODE,IN0,IN1,TABLE)
244245 * DISCRETE_DIODE_MIXER3(NODE,IN0,IN1,IN2,TABLE)
245246 * DISCRETE_DIODE_MIXER4(NODE,IN0,IN1,IN2,IN3,TABLE)
r5891r5892
258259 * DISCRETE_BIT_DECODE(NODE,INP,BIT_N,VOUT)
259260 * DISCRETE_BITS_DECODE(NODE,INP,BIT_FROM,BIT_TO,VOUT)
260261 *
261 * DISCRETE_LOGIC_INVERT(NODE,ENAB,INP0)
262 * DISCRETE_LOGIC_AND(NODE,ENAB,INP0,INP1)
263 * DISCRETE_LOGIC_AND3(NODE,ENAB,INP0,INP1,INP2)
264 * DISCRETE_LOGIC_AND4(NODE,ENAB,INP0,INP1,INP2,INP3)
265 * DISCRETE_LOGIC_NAND(NODE,ENAB,INP0,INP1)
266 * DISCRETE_LOGIC_NAND3(NODE,ENAB,INP0,INP1,INP2)
267 * DISCRETE_LOGIC_NAND4(NODE,ENAB,INP0,INP1,INP2,INP3)
268 * DISCRETE_LOGIC_OR(NODE,ENAB,INP0,INP1)
269 * DISCRETE_LOGIC_OR3(NODE,ENAB,INP0,INP1,INP2)
270 * DISCRETE_LOGIC_OR4(NODE,ENAB,INP0,INP1,INP2,INP3)
271 * DISCRETE_LOGIC_NOR(NODE,ENAB,INP0,INP1)
272 * DISCRETE_LOGIC_NOR3(NODE,ENAB,INP0,INP1,INP2)
273 * DISCRETE_LOGIC_NOR4(NODE,ENAB,INP0,INP1,INP2,INP3)
274 * DISCRETE_LOGIC_XOR(NODE,ENAB,INP0,INP1)
275 * DISCRETE_LOGIC_NXOR(NODE,ENAB,INP0,INP1)
276 * DISCRETE_LOGIC_DFLIPFLOP(NODE,ENAB,RESET,SET,CLK,INP)
277 * DISCRETE_LOGIC_JKFLIPFLOP(NODE,ENAB,RESET,SET,CLK,J,K)
278 * DISCRETE_MULTIPLEX2(NODE,ENAB,ADDR,INP0,INP1)
279 * DISCRETE_MULTIPLEX4(NODE,ENAB,ADDR,INP0,INP1,INP2,INP3)
280 * DISCRETE_MULTIPLEX8(NODE,ENAB,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7)
262 * DISCRETE_LOGIC_INVERT(NODE,INP0)
263 * DISCRETE_LOGIC_AND(NODE,INP0,INP1)
264 * DISCRETE_LOGIC_AND3(NODE,INP0,INP1,INP2)
265 * DISCRETE_LOGIC_AND4(NODE,INP0,INP1,INP2,INP3)
266 * DISCRETE_LOGIC_NAND(NODE,INP0,INP1)
267 * DISCRETE_LOGIC_NAND3(NODE,INP0,INP1,INP2)
268 * DISCRETE_LOGIC_NAND4(NODE,INP0,INP1,INP2,INP3)
269 * DISCRETE_LOGIC_OR(NODE,INP0,INP1)
270 * DISCRETE_LOGIC_OR3(NODE,INP0,INP1,INP2)
271 * DISCRETE_LOGIC_OR4(NODE,INP0,INP1,INP2,INP3)
272 * DISCRETE_LOGIC_NOR(NODE,INP0,INP1)
273 * DISCRETE_LOGIC_NOR3(NODE,INP0,INP1,INP2)
274 * DISCRETE_LOGIC_NOR4(NODE,INP0,INP1,INP2,INP3)
275 * DISCRETE_LOGIC_XOR(NODE,INP0,INP1)
276 * DISCRETE_LOGIC_NXOR(NODE,INP0,INP1)
277 * DISCRETE_LOGIC_DFLIPFLOP(NODE,RESET,SET,CLK,INP)
278 * DISCRETE_LOGIC_JKFLIPFLOP(NODE,RESET,SET,CLK,J,K)
279 * DISCRETE_LOGIC_SHIFT(NODE,INP0,RESET,CLK,SIZE,OPTIONS)
280 * DISCRETE_MULTIPLEX2(NODE,ADDR,INP0,INP1)
281 * DISCRETE_MULTIPLEX4(NODE,ADDR,INP0,INP1,INP2,INP3)
282 * DISCRETE_MULTIPLEX8(NODE,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7)
281283 *
282284 * DISCRETE_FILTER1(NODE,ENAB,INP0,FREQ,TYPE)
283285 * DISCRETE_FILTER2(NODE,ENAB,INP0,FREQ,DAMP,TYPE)
r5891r5892
301303 * DISCRETE_555_CC(NODE,RESET,VIN,R,C,RBIAS,RGND,RDIS,OPTIONS)
302304 * DISCRETE_555_VCO1(NODE,RESET,VIN,OPTIONS)
303305 * DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS)
304 * DISCRETE_566(NODE,ENAB,VMOD,R,C,OPTIONS)
306 * DISCRETE_566(NODE,VMOD,R,C,OPTIONS)
307 * DISCRETE_74LS624(NODE,VMOD,VRNG,C,OUTTYPE)
305308 *
306309 * DISCRETE_CUSTOM1(NODE,IN0,INFO)
307310 * DISCRETE_CUSTOM2(NODE,IN0,IN1,INFO)
r5891r5892
12961299 *
12971300 *                        .------------.
12981301 *                        |            |
1299 *    ENAB       -0------>|            |
1300 *                        |            |
13011302 *    INPUT0     -0------>|            |
13021303 *                        |   LOGIC    |
13031304 *    [INPUT1]   -1------>|  FUNCTION  |---->   Netlist node
r5891r5892
13111312 *  Declaration syntax
13121313 *
13131314 *     DISCRETE_LOGIC_XXXn(name of node,
1314 *      (X=INV/AND/etc)    enable node or static value,
1315 *      (X=INV/AND/etc)
13151316 *      (n=Blank/2/3)      input0 node or static value,
13161317 *                         [input1 node or static value],
13171318 *                         [input2 node or static value],
r5891r5892
13191320 *
13201321 *  Example config lines
13211322 *
1322 *     DISCRETE_LOGIC_INVERT(NODE_03,1,NODE_12)
1323 *     DISCRETE_LOGIC_AND(NODE_03,1,NODE_12,NODE_13)
1324 *     DISCRETE_LOGIC_NOR4(NODE_03,1,NODE_12,NODE_13,NODE_14,NODE_15)
1323 *     DISCRETE_LOGIC_INVERT(NODE_03,NODE_12)
1324 *     DISCRETE_LOGIC_AND(NODE_03,NODE_12,NODE_13)
1325 *     DISCRETE_LOGIC_NOR4(NODE_03,NODE_12,NODE_13,NODE_14,NODE_15)
13251326 *
13261327 *  Node output is always either 0.0 or 1.0 any input value !=0.0 is
13271328 *  taken as a logic 1.
r5891r5892
13481349 *  Declaration syntax
13491350 *
13501351 *       DISCRETE_LOGIC_DFLIPFLOP(name of node,
1351 *                                enable node or static value,
13521352 *                                reset node or static value,
13531353 *                                set node or static value,
13541354 *                                clock node,
r5891r5892
13561356 *
13571357 *  Example config line
13581358 *
1359 *     DISCRETE_LOGIC_DFLIPFLOP(NODE_7,1,NODE_17,0,NODE_13,1)
1359 *     DISCRETE_LOGIC_DFLIPFLOP(NODE_7,NODE_17,0,NODE_13,1)
13601360 *
13611361 *  A flip-flop that clocks a logic 1 through on the rising edge of
13621362 *  NODE_13. A logic 1 on NODE_17 resets the output to 0.
r5891r5892
13851385 *  Declaration syntax
13861386 *
13871387 *       DISCRETE_LOGIC_JKFLIPFLOP(name of node,
1388 *                                 enable node or static value,
13891388 *                                 reset node or static value,
13901389 *                                 set node or static value,
13911390 *                                 clock node,
r5891r5892
14011400 *  Declaration syntax
14021401 *
14031402 *       DISCRETE_LOOKUP_TABLE(name of node,
1404 *                             enable node or static value,
14051403 *                             address node,
14061404 *                             size of table static value,
14071405 *                             address of table of double values)
r5891r5892
14311429 *  Declaration syntax
14321430 *
14331431 *       DISCRETE_MULTIPLEXx(name of node,
1434 *           (x=2/4/8)       enable node or static value,
1435 *                           address node,
1432 *           (x=2/4/8)       address node,
14361433 *                           input 0 node or static value,
14371434 *                           input 1 node or static value, ...)
14381435 *
14391436 ***********************************************************************
14401437 *
1438 * DISCRETE_LOGIC_SHIFT - shift register
1439 *
1440 *  Declaration syntax
1441 *
1442 *     DISCRETE_LOGIC_SHIFT(name of node,
1443 *                          input node,
1444 *                          reset node or static value,
1445 *                          clock node or static value,
1446 *                          size static value,
1447 *                          options static value)
1448 *
1449 * Options:
1450 *          reset type: DISC_LOGIC_SHIFT__RESET_L
1451 *                      DISC_LOGIC_SHIFT__RESET_H
1452 *          shift type: DISC_LOGIC_SHIFT__LEFT
1453 *                      DISC_LOGIC_SHIFT__RIGHT
1454 *          clock type: DISC_CLK_ON_F_EDGE - toggle on falling edge.
1455 *                      DISC_CLK_ON_R_EDGE - toggle on rising edge.
1456 *                      DISC_CLK_BY_COUNT  - toggle specified number of times.
1457 *                      DISC_CLK_IS_FREQ   - internally clock at this frequency.
1458 *
1459 * EXAMPLES: see Sky Raider
1460 *
1461 ***********************************************************************
1462 *
14411463 * DISCRETE_GAIN       - Node multiplication function output is equal
14421464 * DISCRETE_MULTIPLY     to INPUT0 * INPUT1
14431465 * DISCRETE_MULTADD      to (INPUT0 * INPUT1) + INPUT 2
14441466 *
14451467 *                        .------------.
14461468 *                        |            |
1447 *    ENAB       -0------>|            |
1448 *                        |            |
14491469 *    INPUT0     -1------>|     \|/    |
14501470 *                        |     -+-    |---->   Netlist node
14511471 *    INPUT1     -2------>|     /|\    |
r5891r5892
14571477 *  Declaration syntax
14581478 *
14591479 *     DISCRETE_MULTIPLY  (name of node,
1460 *                         enable node or static value,
14611480 *                         input0 node or static value,
14621481 *                         input1 node or static value)
14631482 *
14641483 *     DISCRETE_MULTADD   (name of node,
1465 *                         enable node or static value,
14661484 *                         input0 node or static value,
14671485 *                         input1 node or static value,
14681486 *                         input2 node or static value)
r5891r5892
16361654 *  Declaration syntax
16371655 *
16381656 *     DISCRETE_ASWITCH   (name of node,
1639 *                         enable node or static value,
16401657 *                         ctrl node or static value,
16411658 *                         input node or static value,
16421659 *                         threshold satic value )
16431660 *
16441661 *  Example config line
16451662 *
1646 *     DISCRETE_ASWITCH(NODE_03,1,NODE_10,NODE_90, 2.73)
1663 *     DISCRETE_ASWITCH(NODE_03,NODE_10,NODE_90, 2.73)
16471664 *
16481665 *  Always enabled, NODE_10 switches output to be either NODE_90 or
16491666 *  constant value 0.0. Ctrl>2.73 output=NODE_90 else output=0
r5891r5892
17731790 *  Declaration syntax
17741791 *
17751792 *     DISCRETE_DAC_R1(name of node,
1776 *                     enable node or static value,
17771793 *                     data node (static value is useless),
17781794 *                     vData node or static value (voltage when a bit is on ),
17791795 *                     address of discrete_dac_r1_ladder structure)
r5891r5892
31603176 *  Declaration syntax
31613177 *
31623178 *     DISCRETE_566(name of node,
3163 *                  enable node or static value,
31643179 *                  vMod node or static value,
31653180 *                  R node or static value in ohms,
31663181 *                  C node or static value in Farads,
r5891r5892
32133228 *  Declaration syntax
32143229 *
32153230 *     DISCRETE_74LS624(name of node,
3216 *                      enable node or static value,
32173231 *                      vMod node or static value,
3218 *                      vRng node or static value,
3219 *                      C node or static value in Farads,
3232 *                      vRng static value,
3233 *                      C static value in Farads,
32203234 *                      Type of output static value)
32213235 *
32223236 * Type of Output
r5891r5892
32253239 *      DISC_LS624_OUT_COUNT_F  Number of Falling edges
32263240 *      DISC_LS624_OUT_COUNT_R  Number of Rising  edges
32273241 *
3242 *
3243 * EXAMPLES: see Donkey Kong Jr.
3244 *
32283245 ***********************************************************************
32293246 *
32303247 * DISCRETE_CUSTOMx - Link to custom code
r5891r5892
32463263 * if you have used DISCRETE_STEP(basename) and DISCRETE_RESET(basename) to define
32473264 * the step/reset procedures.
32483265 *
3249 * EXAMPLES: see Donkey Kong, Mario Bros.
3266 * EXAMPLES: see Donkey Kong, Mario Bros., Sky Raider
32503267 *
32513268 ***********************************************************************
32523269 =======================================================================
r5891r5892
33413358 *************************************/
33423359
33433360/* calculate charge exponent using discrete sample time */
3344#define RC_CHARGE_EXP(_node, rc)            (1.0 - exp((_node)->info->neg_sample_time / (rc)))
3361#define RC_CHARGE_EXP(rc)                  (1.0 - exp((node)->info->neg_sample_time / (rc)))
33453362/* calculate charge exponent using given sample time */
3346#define RC_CHARGE_EXP_DT(rc, dt)      (1.0 - exp(-(dt) / (rc)))
3347#define RC_CHARGE_NEG_EXP_DT(rc, dt)   (1.0 - exp((dt) / (rc)))
3363#define RC_CHARGE_EXP_DT(rc, dt)            (1.0 - exp(-(dt) / (rc)))
3364#define RC_CHARGE_NEG_EXP_DT(rc, dt)         (1.0 - exp((dt) / (rc)))
33483365
33493366/* calculate discharge exponent using discrete sample time */
3350#define RC_DISCHARGE_EXP(_node, rc)         (exp((_node)->info->neg_sample_time / (rc)))
3367#define RC_DISCHARGE_EXP(rc)               (exp((node)->info->neg_sample_time / (rc)))
33513368/* calculate discharge exponent using given sample time */
3352#define RC_DISCHARGE_EXP_DT(rc, dt)      (exp(-(dt) / (rc)))
3353#define RC_DISCHARGE_NEG_EXP_DT(rc, dt)   (exp((dt) / (rc)))
3369#define RC_DISCHARGE_EXP_DT(rc, dt)            (exp(-(dt) / (rc)))
3370#define RC_DISCHARGE_NEG_EXP_DT(rc, dt)         (exp((dt) / (rc)))
33543371
33553372/*************************************
33563373 *
r5891r5892
33583375 *
33593376 *************************************/
33603377
3361#define DISCRETE_STEP_NAME( _func )  _func ## _step
3362#define DISCRETE_RESET_NAME( _func ) _func ## _reset
3363#define DISCRETE_START_NAME( _func ) _func ## _start
3364#define DISCRETE_STOP_NAME( _func )  _func ## _stop
3378#define DISCRETE_STEP_NAME( _func )           _func ## _step
3379#define DISCRETE_RESET_NAME( _func )         _func ## _reset
3380#define DISCRETE_START_NAME( _func )          _func ## _start
3381#define DISCRETE_STOP_NAME( _func )           _func ## _stop
33653382
3366#define DISCRETE_FUNC(_func) void _func (node_description *node)
3383#define DISCRETE_FUNC(_func)                void _func (node_description *node)
33673384
3368#define DISCRETE_STEP(_func) DISCRETE_FUNC(DISCRETE_STEP_NAME(_func))
3369#define DISCRETE_RESET(_func) DISCRETE_FUNC(DISCRETE_RESET_NAME(_func))
3370#define DISCRETE_START(_func) DISCRETE_FUNC(DISCRETE_START_NAME(_func))
3371#define DISCRETE_STOP(_func) DISCRETE_FUNC(DISCRETE_STOP_NAME(_func))
3385#define DISCRETE_STEP(_func)                DISCRETE_FUNC(DISCRETE_STEP_NAME(_func))
3386#define DISCRETE_RESET(_func)                DISCRETE_FUNC(DISCRETE_RESET_NAME(_func))
3387#define DISCRETE_START(_func)                DISCRETE_FUNC(DISCRETE_START_NAME(_func))
3388#define DISCRETE_STOP(_func)                DISCRETE_FUNC(DISCRETE_STOP_NAME(_func))
33723389
3373#define DISCRETE_STEP_CALL(_func) DISCRETE_STEP_NAME(_func) (node)
3374#define DISCRETE_RESET_CALL(_func) DISCRETE_RESET_NAME(_func) (node)
3375#define DISCRETE_START_CALL(_func) DISCRETE_START_NAME(_func) (node)
3376#define DISCRETE_STOP_CALL(_func) DISCRETE_STOP_NAME(_func) (node)
3390#define DISCRETE_STEP_CALL(_func)             DISCRETE_STEP_NAME(_func) (node)
3391#define DISCRETE_RESET_CALL(_func)             DISCRETE_RESET_NAME(_func) (node)
3392#define DISCRETE_START_CALL(_func)             DISCRETE_START_NAME(_func) (node)
3393#define DISCRETE_STOP_CALL(_func)             DISCRETE_STOP_NAME(_func) (node)
33773394
33783395#define DISCRETE_CUSTOM_MODULE(_basename, _context_type) \
33793396   { DST_CUSTOM, "CUSTOM", 1, sizeof(_context_type), DISCRETE_RESET_NAME(_basename), DISCRETE_STEP_NAME(_basename) }
33803397
3381#define DISCRETE_INPUT(_num)   (*(node->input[_num]))
3398#define DISCRETE_INPUT(_num)               (*(node->input[_num]))
33823399
33833400/*************************************
33843401 *
r5891r5892
33863403 *
33873404 *************************************/
33883405
3389#define DISCRETE_MAX_NODES            300
3390#define DISCRETE_MAX_INPUTS            10
3391#define DISCRETE_MAX_OUTPUTS          8
3392#define DISCRETE_MAX_TASK_OUTPUTS       8
3406#define DISCRETE_MAX_NODES               300
3407#define DISCRETE_MAX_INPUTS               10
3408#define DISCRETE_MAX_OUTPUTS             8
3409#define DISCRETE_MAX_TASK_OUTPUTS         8
33933410
33943411
33953412/*************************************
r5891r5892
33983415 *
33993416 *************************************/
34003417
3401#define DEFAULT_TTL_V_LOGIC_1   3.4
3418#define DEFAULT_TTL_V_LOGIC_1            3.4
34023419
3403#define DISC_LOGADJ            1.0
3404#define DISC_LINADJ            0.0
3420#define DISC_LOGADJ                     1.0
3421#define DISC_LINADJ                     0.0
34053422
34063423/* DISCRETE_COMP_ADDER types */
3407#define DISC_COMP_P_CAPACITOR         0x00
3408#define DISC_COMP_P_RESISTOR         0x01
3424#define DISC_COMP_P_CAPACITOR            0x00
3425#define DISC_COMP_P_RESISTOR            0x01
34093426
34103427/* clk types */
3411#define DISC_CLK_MASK         0x03
3412#define DISC_CLK_ON_F_EDGE      0x00
3413#define DISC_CLK_ON_R_EDGE      0x01
3414#define DISC_CLK_BY_COUNT      0x02
3415#define DISC_CLK_IS_FREQ      0x03
3428#define DISC_CLK_MASK                  0x03
3429#define DISC_CLK_ON_F_EDGE               0x00
3430#define DISC_CLK_ON_R_EDGE               0x01
3431#define DISC_CLK_BY_COUNT               0x02
3432#define DISC_CLK_IS_FREQ               0x03
34163433
3417#define DISC_COUNT_DOWN         0
3418#define DISC_COUNT_UP         1
3434#define DISC_COUNT_DOWN                  0
3435#define DISC_COUNT_UP                  1
34193436
3420#define DISC_COUNTER_IS_7492   0x08
3437#define DISC_COUNTER_IS_7492            0x08
34213438
3422#define DISC_OUT_MASK         0x30
3423#define DISC_OUT_DEFAULT      0x00
3424#define DISC_OUT_IS_ENERGY      0x10
3425#define DISC_OUT_HAS_XTIME      0x20
3439#define DISC_OUT_MASK                  0x30
3440#define DISC_OUT_DEFAULT               0x00
3441#define DISC_OUT_IS_ENERGY               0x10
3442#define DISC_OUT_HAS_XTIME               0x20
34263443
34273444/* Function possibilities for the LFSR feedback nodes */
34283445/* 2 inputs, one output                               */
3429#define DISC_LFSR_XOR               0
3430#define DISC_LFSR_OR               1
3431#define DISC_LFSR_AND               2
3432#define DISC_LFSR_XNOR               3
3433#define DISC_LFSR_NOR               4
3434#define DISC_LFSR_NAND               5
3435#define DISC_LFSR_IN0               6
3436#define DISC_LFSR_IN1               7
3437#define DISC_LFSR_NOT_IN0            8
3438#define DISC_LFSR_NOT_IN1            9
3439#define DISC_LFSR_REPLACE            10
3440#define DISC_LFSR_XOR_INV_IN0           11
3441#define DISC_LFSR_XOR_INV_IN1           12
3446#define DISC_LFSR_XOR                  0
3447#define DISC_LFSR_OR                  1
3448#define DISC_LFSR_AND                  2
3449#define DISC_LFSR_XNOR                  3
3450#define DISC_LFSR_NOR                  4
3451#define DISC_LFSR_NAND                  5
3452#define DISC_LFSR_IN0                  6
3453#define DISC_LFSR_IN1                  7
3454#define DISC_LFSR_NOT_IN0               8
3455#define DISC_LFSR_NOT_IN1               9
3456#define DISC_LFSR_REPLACE               10
3457#define DISC_LFSR_XOR_INV_IN0              11
3458#define DISC_LFSR_XOR_INV_IN1              12
34423459
34433460/* LFSR Flag Bits */
3444#define DISC_LFSR_FLAG_OUT_INVERT      0x01
3445#define DISC_LFSR_FLAG_RESET_TYPE_L      0x00
3446#define DISC_LFSR_FLAG_RESET_TYPE_H      0x02
3447#define DISC_LFSR_FLAG_OUTPUT_F0      0x04
3448#define DISC_LFSR_FLAG_OUTPUT_SR_SN1   0x08
3461#define DISC_LFSR_FLAG_OUT_INVERT         0x01
3462#define DISC_LFSR_FLAG_RESET_TYPE_L         0x00
3463#define DISC_LFSR_FLAG_RESET_TYPE_H         0x02
3464#define DISC_LFSR_FLAG_OUTPUT_F0         0x04
3465#define DISC_LFSR_FLAG_OUTPUT_SR_SN1      0x08
34493466
34503467/* Sample & Hold supported clock types */
3451#define DISC_SAMPHOLD_REDGE            0
3452#define DISC_SAMPHOLD_FEDGE            1
3453#define DISC_SAMPHOLD_HLATCH         2
3454#define DISC_SAMPHOLD_LLATCH         3
3468#define DISC_SAMPHOLD_REDGE               0
3469#define DISC_SAMPHOLD_FEDGE               1
3470#define DISC_SAMPHOLD_HLATCH            2
3471#define DISC_SAMPHOLD_LLATCH            3
34553472
3473/* Shift options */
3474#define DISC_LOGIC_SHIFT__RESET_L         0x00
3475#define DISC_LOGIC_SHIFT__RESET_H         0x10
3476#define DISC_LOGIC_SHIFT__LEFT            0x00
3477#define DISC_LOGIC_SHIFT__RIGHT            0x20
3478
34563479/* Maximum number of resistors in ladder chain */
3457#define DISC_LADDER_MAXRES            8
3480#define DISC_LADDER_MAXRES               8
34583481
34593482/* Filter types */
3460#define DISC_FILTER_LOWPASS            0
3461#define DISC_FILTER_HIGHPASS         1
3462#define DISC_FILTER_BANDPASS         2
3483#define DISC_FILTER_LOWPASS               0
3484#define DISC_FILTER_HIGHPASS            1
3485#define DISC_FILTER_BANDPASS            2
34633486
34643487/* Mixer types */
3465#define DISC_MIXER_IS_RESISTOR         0
3466#define DISC_MIXER_IS_OP_AMP         1
3467#define DISC_MIXER_IS_OP_AMP_WITH_RI    2   // Used only internally.  Use DISC_MIXER_IS_OP_AMP
3488#define DISC_MIXER_IS_RESISTOR            0
3489#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
34683491
34693492/* Triggered Op Amp Functions */
34703493enum
r5891r5892
34823505
34833506
34843507/* Common Op Amp Flags and values */
3485#define DISC_OP_AMP_IS_NORTON   0x01
3486#define OP_AMP_NORTON_VBE      0.5      // This is the norton junction voltage. Used only internally.
3487#define OP_AMP_VP_RAIL_OFFSET   1.5      // This is how close an op-amp can get to the vP rail. Used only internally.
3508#define DISC_OP_AMP_IS_NORTON            0x01
3509#define OP_AMP_NORTON_VBE               0.5      // This is the norton junction voltage. Used only internally.
3510#define OP_AMP_VP_RAIL_OFFSET            1.5      // This is how close an op-amp can get to the vP rail. Used only internally.
34883511
34893512/* Integrate options */
3490#define DISC_INTEGRATE_OP_AMP_1   0x00
3491#define DISC_INTEGRATE_OP_AMP_2   0x10
3513#define DISC_INTEGRATE_OP_AMP_1            0x00
3514#define DISC_INTEGRATE_OP_AMP_2            0x10
34923515
34933516/* op amp 1 shot types */
3494#define DISC_OP_AMP_1SHT_1   0x00
3517#define DISC_OP_AMP_1SHT_1               0x00
34953518
34963519/* Op Amp Filter Options */
34973520#define DISC_OP_AMP_FILTER_IS_LOW_PASS_1   0x00
r5891r5892
35203543#define DISC_OP_AMP_OSCILLATOR_TYPE_MASK   (0xf0 | DISC_OP_AMP_IS_NORTON)   // Used only internally.
35213544
35223545/* Schmitt Oscillator Options */
3523#define DISC_SCHMITT_OSC_IN_IS_LOGIC   0x00
3524#define DISC_SCHMITT_OSC_IN_IS_VOLTAGE   0x01
3546#define DISC_SCHMITT_OSC_IN_IS_LOGIC      0x00
3547#define DISC_SCHMITT_OSC_IN_IS_VOLTAGE      0x01
35253548
3526#define DISC_SCHMITT_OSC_ENAB_IS_AND   0x00
3527#define DISC_SCHMITT_OSC_ENAB_IS_NAND   0x02
3528#define DISC_SCHMITT_OSC_ENAB_IS_OR      0x04
3529#define DISC_SCHMITT_OSC_ENAB_IS_NOR   0x06
3549#define DISC_SCHMITT_OSC_ENAB_IS_AND      0x00
3550#define DISC_SCHMITT_OSC_ENAB_IS_NAND      0x02
3551#define DISC_SCHMITT_OSC_ENAB_IS_OR         0x04
3552#define DISC_SCHMITT_OSC_ENAB_IS_NOR      0x06
35303553
3531#define DISC_SCHMITT_OSC_ENAB_MASK      0x06   /* Bits that define output enable type.
3532                                                 * Used only internally in module. */
3554#define DISC_SCHMITT_OSC_ENAB_MASK         0x06   /* Bits that define output enable type.
3555                                                     * Used only internally in module. */
35333556
35343557/* 555 Common output flags */
3535#define DISC_555_OUT_DC               0x00
3536#define DISC_555_OUT_AC               0x10
3558#define DISC_555_OUT_DC                  0x00
3559#define DISC_555_OUT_AC                  0x10
35373560
3538#define DISC_555_TRIGGER_IS_LOGIC      0x00
3539#define DISC_555_TRIGGER_IS_VOLTAGE      0x40
3540#define DISC_555_TRIGGER_DISCHARGES_CAP   0x80
3561#define DISC_555_TRIGGER_IS_LOGIC         0x00
3562#define DISC_555_TRIGGER_IS_VOLTAGE         0x40
3563#define DISC_555_TRIGGER_DISCHARGES_CAP      0x80
35413564
3542#define DISC_555_OUT_SQW            0x00   /* Squarewave */
3543#define DISC_555_OUT_CAP            0x01   /* Cap charge waveform */
3544#define DISC_555_OUT_COUNT_F         0x02   /* Falling count */
3545#define DISC_555_OUT_COUNT_R         0x03   /* Rising count */
3546#define DISC_555_OUT_ENERGY            0x04
3547#define DISC_555_OUT_LOGIC_X         0x05
3548#define DISC_555_OUT_COUNT_F_X         0x06
3549#define DISC_555_OUT_COUNT_R_X         0x07
3565#define DISC_555_OUT_SQW               0x00   /* Squarewave */
3566#define DISC_555_OUT_CAP               0x01   /* Cap charge waveform */
3567#define DISC_555_OUT_COUNT_F            0x02   /* Falling count */
3568#define DISC_555_OUT_COUNT_R            0x03   /* Rising count */
3569#define DISC_555_OUT_ENERGY               0x04
3570#define DISC_555_OUT_LOGIC_X            0x05
3571#define DISC_555_OUT_COUNT_F_X            0x06
3572#define DISC_555_OUT_COUNT_R_X            0x07
35503573
3551#define DISC_555_OUT_MASK            0x07   /* Bits that define output type.
3574#define DISC_555_OUT_MASK               0x07   /* Bits that define output type.
35523575                                                 * Used only internally in module. */
35533576
35543577#define DISC_555_ASTABLE_HAS_FAST_CHARGE_DIODE      0x80
r5891r5892
35563579#define DISCRETE_555_CC_TO_CAP                  0x80
35573580
35583581/* 566 output flags */
3559#define DISC_566_OUT_DC               0x00
3560#define DISC_566_OUT_AC               0x01
3582#define DISC_566_OUT_DC                  0x00
3583#define DISC_566_OUT_AC                  0x01
35613584
3562#define DISC_566_OUT_SQUARE            0x00   /* Squarewave */
3563#define DISC_566_OUT_TRIANGLE         0x10   /* Triangle waveform */
3564#define DISC_566_OUT_LOGIC            0x20   /* 0/1 logic output */
3585#define DISC_566_OUT_SQUARE               0x00   /* Squarewave */
3586#define DISC_566_OUT_TRIANGLE            0x10   /* Triangle waveform */
3587#define DISC_566_OUT_LOGIC               0x20   /* 0/1 logic output */
35653588
3566#define DISC_566_OUT_MASK            0x30   /* Bits that define output type.
3567                                                 * Used only internally in module. */
3589#define DISC_566_OUT_MASK               0x30   /* Bits that define output type.
3590                                                     * Used only internally in module. */
35683591#define DEFAULT_566_CHARGE   -1
35693592
35703593/* LS624 output flags */
3571#define DISC_LS624_OUT_ENERGY         0x01
3572#define DISC_LS624_OUT_LOGIC         0x02
3573#define DISC_LS624_OUT_COUNT_F         0x03
3574#define DISC_LS624_OUT_COUNT_R         0x04
3594#define DISC_LS624_OUT_ENERGY            0x01
3595#define DISC_LS624_OUT_LOGIC            0x02
3596#define DISC_LS624_OUT_COUNT_F            0x03
3597#define DISC_LS624_OUT_COUNT_R            0x04
35753598
35763599/* Oneshot types */
3577#define DISC_ONESHOT_FEDGE            0x00
3578#define DISC_ONESHOT_REDGE            0x01
3600#define DISC_ONESHOT_FEDGE               0x00
3601#define DISC_ONESHOT_REDGE               0x01
35793602
3580#define DISC_ONESHOT_NORETRIG         0x00
3581#define DISC_ONESHOT_RETRIG            0x02
3603#define DISC_ONESHOT_NORETRIG            0x00
3604#define DISC_ONESHOT_RETRIG               0x02
35823605
3583#define DISC_OUT_ACTIVE_LOW            0x04
3584#define DISC_OUT_ACTIVE_HIGH         0x00
3606#define DISC_OUT_ACTIVE_LOW               0x04
3607#define DISC_OUT_ACTIVE_HIGH            0x00
35853608
3586#define DISC_CD4066_THRESHOLD           2.75
3609#define DISC_CD4066_THRESHOLD              2.75
35873610
35883611/* Integrate */
35893612
3590#define DISC_RC_INTEGRATE_TYPE1                  0x00
3591#define DISC_RC_INTEGRATE_TYPE2                  0x01
3592#define DISC_RC_INTEGRATE_TYPE3                  0x02
3613#define DISC_RC_INTEGRATE_TYPE1            0x00
3614#define DISC_RC_INTEGRATE_TYPE2            0x01
3615#define DISC_RC_INTEGRATE_TYPE3            0x02
35933616
35943617/*************************************
35953618 *
r5891r5892
36413664
36423665struct _node_description
36433666{
3644   double         output[DISCRETE_MAX_OUTPUTS];      /* The node's last output value */
3667   double            output[DISCRETE_MAX_OUTPUTS];      /* The node's last output value */
36453668
3646   int            active_inputs;                  /* Number of active inputs on this node type */
3647   int            input_is_node;                  /* Bit Flags.  1 in bit location means input_is_node */
3648   const double *   input[DISCRETE_MAX_INPUTS];         /* Addresses of Input values */
3669   int               active_inputs;                  /* Number of active inputs on this node type */
3670   int               input_is_node;                  /* Bit Flags.  1 in bit location means input_is_node */
3671   const double *      input[DISCRETE_MAX_INPUTS];         /* Addresses of Input values */
36493672
3650   void *         context;                     /* Contextual information specific to this node type */
3651   const void *   custom;                        /* Custom function specific initialisation data */
3673   void *            context;                     /* Contextual information specific to this node type */
3674   const void *      custom;                        /* Custom function specific initialisation data */
36523675
3653   const discrete_module *module;                  /* Node's module info */
3654   const discrete_sound_block *block;               /* Points to the node's setup block. */
3655   const discrete_info *info;                     /* Points to the parent */
3676   const discrete_module *module;                     /* Node's module info */
3677   const discrete_sound_block *block;                  /* Points to the node's setup block. */
3678   const discrete_info *info;                        /* Points to the parent */
36563679
3657   osd_ticks_t      run_time;
3680   osd_ticks_t         run_time;
36583681};
36593682
36603683
r5891r5892
36713694typedef struct _linked_list_entry   linked_list_entry;
36723695struct _linked_list_entry
36733696{
3674   const void *ptr;
3675   linked_list_entry *next;
3697   const void          *ptr;
3698   linked_list_entry    *next;
36763699};
36773700
36783701typedef struct _discrete_task_context discrete_task_context;
r5891r5892
36933716   const device_config *device;
36943717
36953718   /* emulation info */
3696   int      sample_rate;
3697   double   sample_time;
3698   double   neg_sample_time;
3719   int               sample_rate;
3720   double            sample_time;
3721   double            neg_sample_time;
36993722
37003723   /* internal node tracking */
37013724   node_description **indexed_node;
r5891r5892
37193742   linked_list_entry     *output_list;
37203743
37213744   /* the output stream */
3722   sound_stream *discrete_stream;
3745   sound_stream       *discrete_stream;
37233746
37243747   /* debugging statistics */
3725   FILE *disclogfile;
3748   FILE             *disclogfile;
37263749
37273750   /* parallel tasks */
3728   osd_work_queue *queue;
3751   osd_work_queue       *queue;
37293752
37303753   /* profiling */
3731   UINT64 total_samples;
3732   UINT64 total_stream_updates;
3754   UINT64             total_samples;
3755   UINT64             total_stream_updates;
37333756};
37343757
37353758
r5891r5892
41594182   DST_LOGIC_NXOR,
41604183   DST_LOGIC_DFF,
41614184   DST_LOGIC_JKFF,
4185   DST_LOGIC_SHIFT,
41624186   DST_LOOKUP_TABLE,   /* return value from lookup table */
41634187   DST_MULTIPLEX,      /* 1 of x multiplexer */
41644188   DST_ONESHOT,      /* One-shot pulse generator */
r5891r5892
42964320#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" },
42974321#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" },
42984322#define DISCRETE_DIVIDE(NODE,ENAB,INP0,INP1)                            { NODE, DST_DIVIDE      , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_DIVIDE" },
4299#define DISCRETE_GAIN(NODE,INP0,GAIN)                                   { NODE, DST_GAIN        , 4, { NODE_NC,INP0,NODE_NC,NODE_NC }, { 1,INP0,GAIN,0 }, NULL, "DISCRETE_GAIN" },
4300#define DISCRETE_INVERT(NODE,INP0)                                      { NODE, DST_GAIN        , 4, { NODE_NC,INP0,NODE_NC,NODE_NC }, { 1,INP0,-1,0 }, NULL, "DISCRETE_INVERT" },
4301#define DISCRETE_LOGIC_INVERT(NODE,ENAB,INP0)                           { NODE, DST_LOGIC_INV   , 2, { ENAB,INP0 }, { ENAB,INP0 }, NULL, "DISCRETE_LOGIC_INVERT" },
4323#define DISCRETE_GAIN(NODE,INP0,GAIN)                                   { NODE, DST_GAIN        , 3, { INP0,NODE_NC,NODE_NC }, { INP0,GAIN,0 }, NULL, "DISCRETE_GAIN" },
4324#define DISCRETE_INVERT(NODE,INP0)                                      { NODE, DST_GAIN        , 3, { INP0,NODE_NC,NODE_NC }, { INP0,-1,0 }, NULL, "DISCRETE_INVERT" },
4325#define DISCRETE_LOGIC_INVERT(NODE,INP0)                                { NODE, DST_LOGIC_INV   , 1, { INP0 }, { INP0 }, NULL, "DISCRETE_LOGIC_INVERT" },
43024326
43034327#define DISCRETE_BIT_DECODE(NODE, INP, BIT_N, VOUT)                     { NODE, DST_BITS_DECODE , 3, { INP,NODE_NC,NODE_NC,NODE_NC }, { INP,BIT_N,BIT_N, VOUT }, NULL, "DISCRETE_BIT_DECODE" },
43044328#define DISCRETE_BITS_DECODE(NODE, INP, BIT_FROM, BIT_TO, VOUT)         { NODE, DST_BITS_DECODE , 4, { INP,NODE_NC,NODE_NC,NODE_NC }, { INP,BIT_FROM,BIT_TO, VOUT }, NULL, "DISCRETE_BITS_DECODE" },
43054329
4306#define DISCRETE_LOGIC_AND(NODE,ENAB,INP0,INP1)                         { NODE, DST_LOGIC_AND   , 5, { ENAB,INP0,INP1,NODE_NC,NODE_NC }, { ENAB,INP0,INP1,1.0,1.0 }, NULL, "DISCRETE_LOGIC_AND" },
4307#define DISCRETE_LOGIC_AND3(NODE,ENAB,INP0,INP1,INP2)                   { NODE, DST_LOGIC_AND   , 5, { ENAB,INP0,INP1,INP2,NODE_NC }, { ENAB,INP0,INP1,INP2,1.0 }, NULL, "DISCRETE_LOGIC_AND3" },
4308#define DISCRETE_LOGIC_AND4(NODE,ENAB,INP0,INP1,INP2,INP3)              { NODE, DST_LOGIC_AND   , 5, { ENAB,INP0,INP1,INP2,INP3 }, { ENAB,INP0,INP1,INP2,INP3 } ,NULL, "DISCRETE_LOGIC_AND4" },
4309#define DISCRETE_LOGIC_NAND(NODE,ENAB,INP0,INP1)                        { NODE, DST_LOGIC_NAND  , 5, { ENAB,INP0,INP1,NODE_NC,NODE_NC }, { ENAB,INP0,INP1,1.0,1.0 }, NULL, "DISCRETE_LOGIC_NAND" },
4310#define DISCRETE_LOGIC_NAND3(NODE,ENAB,INP0,INP1,INP2)                  { NODE, DST_LOGIC_NAND  , 5, { ENAB,INP0,INP1,INP2,NODE_NC }, { ENAB,INP0,INP1,INP2,1.0 }, NULL, "DISCRETE_LOGIC_NAND3" },
4311#define DISCRETE_LOGIC_NAND4(NODE,ENAB,INP0,INP1,INP2,INP3)             { NODE, DST_LOGIC_NAND  , 5, { ENAB,INP0,INP1,INP2,INP3 }, { ENAB,INP0,INP1,INP2,INP3 }, NULL, ")DISCRETE_LOGIC_NAND4" },
4312#define DISCRETE_LOGIC_OR(NODE,ENAB,INP0,INP1)                          { NODE, DST_LOGIC_OR    , 5, { ENAB,INP0,INP1,NODE_NC,NODE_NC }, { ENAB,INP0,INP1,0.0,0.0 }, NULL, "DISCRETE_LOGIC_OR" },
4313#define DISCRETE_LOGIC_OR3(NODE,ENAB,INP0,INP1,INP2)                    { NODE, DST_LOGIC_OR    , 5, { ENAB,INP0,INP1,INP2,NODE_NC }, { ENAB,INP0,INP1,INP2,0.0 }, NULL, "DISCRETE_LOGIC_OR3" },
4314#define DISCRETE_LOGIC_OR4(NODE,ENAB,INP0,INP1,INP2,INP3)               { NODE, DST_LOGIC_OR    , 5, { ENAB,INP0,INP1,INP2,INP3 }, { ENAB,INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_LOGIC_OR4" },
4315#define DISCRETE_LOGIC_NOR(NODE,ENAB,INP0,INP1)                         { NODE, DST_LOGIC_NOR   , 5, { ENAB,INP0,INP1,NODE_NC,NODE_NC }, { ENAB,INP0,INP1,0.0,0.0 }, NULL, "DISCRETE_LOGIC_NOR" },
4316#define DISCRETE_LOGIC_NOR3(NODE,ENAB,INP0,INP1,INP2)                   { NODE, DST_LOGIC_NOR   , 5, { ENAB,INP0,INP1,INP2,NODE_NC }, { ENAB,INP0,INP1,INP2,0.0 }, NULL, "DISCRETE_LOGIC_NOR3" },
4317#define DISCRETE_LOGIC_NOR4(NODE,ENAB,INP0,INP1,INP2,INP3)              { NODE, DST_LOGIC_NOR   , 5, { ENAB,INP0,INP1,INP2,INP3 }, { ENAB,INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_LOGIC_NOR4" },
4318#define DISCRETE_LOGIC_XOR(NODE,ENAB,INP0,INP1)                         { NODE, DST_LOGIC_XOR   , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_LOGIC_XOR" },
4319#define DISCRETE_LOGIC_NXOR(NODE,ENAB,INP0,INP1)                        { NODE, DST_LOGIC_NXOR  , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_LOGIC_NXOR" },
4320#define DISCRETE_LOGIC_DFLIPFLOP(NODE,ENAB,RESET,SET,CLK,INP)           { NODE, DST_LOGIC_DFF   , 5, { ENAB,RESET,SET,CLK,INP }, { ENAB,RESET,SET,CLK,INP }, NULL, "DISCRETE_LOGIC_DFLIPFLOP" },
4321#define DISCRETE_LOGIC_JKFLIPFLOP(NODE,ENAB,RESET,SET,CLK,J,K)          { NODE, DST_LOGIC_JKFF  , 6, { ENAB,RESET,SET,CLK,J,K }, { ENAB,RESET,SET,CLK,J,K }, NULL, "DISCRETE_LOGIC_JKFLIPFLOP" },
4322#define DISCRETE_LOOKUP_TABLE(NODE,ENAB,ADDR,SIZE,TABLE)                { NODE, DST_LOOKUP_TABLE, 3, { ENAB,ADDR,NODE_NC }, { ENAB,ADDR,SIZE }, TABLE, "DISCRETE_LOOKUP_TABLE" },
4323#define DISCRETE_MULTIPLEX2(NODE,ENAB,ADDR,INP0,INP1)                   { NODE, DST_MULTIPLEX   , 4, { ENAB,ADDR,INP0,INP1 }, { ENAB,ADDR,INP0,INP1 }, NULL, "DISCRETE_MULTIPLEX2" },
4324#define DISCRETE_MULTIPLEX4(NODE,ENAB,ADDR,INP0,INP1,INP2,INP3)         { NODE, DST_MULTIPLEX   , 6, { ENAB,ADDR,INP0,INP1,INP2,INP3 }, { ENAB,ADDR,INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_MULTIPLEX4" },
4325#define DISCRETE_MULTIPLEX8(NODE,ENAB,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7) { NODE, DST_MULTIPLEX, 10, { ENAB,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, { ENAB,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, NULL, "DISCRETE_MULTIPLEX8" },
4326#define DISCRETE_MULTIPLY(NODE,ENAB,INP0,INP1)                          { NODE, DST_GAIN        , 4, { ENAB,INP0,INP1,NODE_NC }, { ENAB,INP0,INP1,0 }, NULL, "DISCRETE_MULTIPLY" },
4327#define DISCRETE_MULTADD(NODE,ENAB,INP0,INP1,INP2)                      { NODE, DST_GAIN        , 4, { ENAB,INP0,INP1,INP2 }, { ENAB,INP0,INP1,INP2 }, NULL, "DISCRETE_MULTADD" },
4330#define DISCRETE_LOGIC_AND(NODE,INP0,INP1)                              { NODE, DST_LOGIC_AND   , 4, { INP0,INP1,NODE_NC,NODE_NC }, { INP0,INP1,1.0,1.0 }, NULL, "DISCRETE_LOGIC_AND" },
4331#define DISCRETE_LOGIC_AND3(NODE,INP0,INP1,INP2)                        { NODE, DST_LOGIC_AND   , 4, { INP0,INP1,INP2,NODE_NC }, { INP0,INP1,INP2,1.0 }, NULL, "DISCRETE_LOGIC_AND3" },
4332#define DISCRETE_LOGIC_AND4(NODE,INP0,INP1,INP2,INP3)                   { NODE, DST_LOGIC_AND   , 4, { INP0,INP1,INP2,INP3 }, { INP0,INP1,INP2,INP3 } ,NULL, "DISCRETE_LOGIC_AND4" },
4333#define DISCRETE_LOGIC_NAND(NODE,INP0,INP1)                             { NODE, DST_LOGIC_NAND  , 4, { INP0,INP1,NODE_NC,NODE_NC }, { INP0,INP1,1.0,1.0 }, NULL, "DISCRETE_LOGIC_NAND" },
4334#define DISCRETE_LOGIC_NAND3(NODE,INP0,INP1,INP2)                       { NODE, DST_LOGIC_NAND  , 4, { INP0,INP1,INP2,NODE_NC }, { INP0,INP1,INP2,1.0 }, NULL, "DISCRETE_LOGIC_NAND3" },
4335#define DISCRETE_LOGIC_NAND4(NODE,INP0,INP1,INP2,INP3)                  { NODE, DST_LOGIC_NAND  , 4, { INP0,INP1,INP2,INP3 }, { INP0,INP1,INP2,INP3 }, NULL, ")DISCRETE_LOGIC_NAND4" },
4336#define DISCRETE_LOGIC_OR(NODE,INP0,INP1)                               { NODE, DST_LOGIC_OR    , 4, { INP0,INP1,NODE_NC,NODE_NC }, { INP0,INP1,0.0,0.0 }, NULL, "DISCRETE_LOGIC_OR" },
4337#define DISCRETE_LOGIC_OR3(NODE,INP0,INP1,INP2)                         { NODE, DST_LOGIC_OR    , 4, { INP0,INP1,INP2,NODE_NC }, { INP0,INP1,INP2,0.0 }, NULL, "DISCRETE_LOGIC_OR3" },
4338#define DISCRETE_LOGIC_OR4(NODE,INP0,INP1,INP2,INP3)                    { NODE, DST_LOGIC_OR    , 4, { INP0,INP1,INP2,INP3 }, { INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_LOGIC_OR4" },
4339#define DISCRETE_LOGIC_NOR(NODE,INP0,INP1)                              { NODE, DST_LOGIC_NOR   , 4, { INP0,INP1,NODE_NC,NODE_NC }, { INP0,INP1,0.0,0.0 }, NULL, "DISCRETE_LOGIC_NOR" },
4340#define DISCRETE_LOGIC_NOR3(NODE,INP0,INP1,INP2)                        { NODE, DST_LOGIC_NOR   , 4, { INP0,INP1,INP2,NODE_NC }, { INP0,INP1,INP2,0.0 }, NULL, "DISCRETE_LOGIC_NOR3" },
4341#define DISCRETE_LOGIC_NOR4(NODE,INP0,INP1,INP2,INP3)                   { NODE, DST_LOGIC_NOR   , 4, { INP0,INP1,INP2,INP3 }, { INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_LOGIC_NOR4" },
4342#define DISCRETE_LOGIC_XOR(NODE,INP0,INP1)                              { NODE, DST_LOGIC_XOR   , 2, { INP0,INP1 }, { INP0,INP1 }, NULL, "DISCRETE_LOGIC_XOR" },
4343#define DISCRETE_LOGIC_NXOR(NODE,INP0,INP1)                             { NODE, DST_LOGIC_NXOR  , 2, { INP0,INP1 }, { INP0,INP1 }, NULL, "DISCRETE_LOGIC_NXOR" },
4344#define DISCRETE_LOGIC_DFLIPFLOP(NODE,RESET,SET,CLK,INP)                { NODE, DST_LOGIC_DFF   , 4, { RESET,SET,CLK,INP }, { RESET,SET,CLK,INP }, NULL, "DISCRETE_LOGIC_DFLIPFLOP" },
4345#define DISCRETE_LOGIC_JKFLIPFLOP(NODE,RESET,SET,CLK,J,K)               { NODE, DST_LOGIC_JKFF  , 5, { RESET,SET,CLK,J,K }, { RESET,SET,CLK,J,K }, NULL, "DISCRETE_LOGIC_JKFLIPFLOP" },
4346#define DISCRETE_LOGIC_SHIFT(NODE,INP0,RESET,CLK,SIZE,OPTIONS)          { NODE, DST_LOGIC_SHIFT , 5, { INP0,RESET,CLK,NODE_NC,NODE_NC }, { INP0,RESET,CLK,SIZE,OPTIONS }, NULL, "DISCRETE_LOGIC_SHIFT" },
4347#define DISCRETE_LOOKUP_TABLE(NODE,ADDR,SIZE,TABLE)                     { NODE, DST_LOOKUP_TABLE, 2, { ADDR,NODE_NC }, { ADDR,SIZE }, TABLE, "DISCRETE_LOOKUP_TABLE" },
4348#define DISCRETE_MULTIPLEX2(NODE,ADDR,INP0,INP1)                        { NODE, DST_MULTIPLEX   , 3, { ADDR,INP0,INP1 }, { ADDR,INP0,INP1 }, NULL, "DISCRETE_MULTIPLEX2" },
4349#define DISCRETE_MULTIPLEX4(NODE,ADDR,INP0,INP1,INP2,INP3)              { NODE, DST_MULTIPLEX   , 5, { ADDR,INP0,INP1,INP2,INP3 }, { ADDR,INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_MULTIPLEX4" },
4350#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" },
4351#define DISCRETE_MULTIPLY(NODE,INP0,INP1)                               { NODE, DST_GAIN        , 3, { INP0,INP1,NODE_NC }, { INP0,INP1,0 }, NULL, "DISCRETE_MULTIPLY" },
4352#define DISCRETE_MULTADD(NODE,INP0,INP1,INP2)                           { NODE, DST_GAIN        , 3, { INP0,INP1,INP2 }, { INP0,INP1,INP2 }, NULL, "DISCRETE_MULTADD" },
43284353#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" },
43294354#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" },
4330#define DISCRETE_ONOFF(NODE,ENAB,INP0)                                  { NODE, DST_GAIN        , 4, { ENAB,INP0,NODE_NC,NODE_NC }, { ENAB,0,1,0 }, NULL, "DISCRETE_ONOFF" },
4355#define DISCRETE_ONOFF(NODE,ENAB,INP0)                                  { NODE, DST_GAIN        , 3, { ENAB,INP0,NODE_NC }, { 0,1,0 }, NULL, "DISCRETE_ONOFF" },
43314356#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" },
4332#define DISCRETE_SAMPLHOLD(NODE,ENAB,INP0,CLOCK,CLKTYPE)                { NODE, DST_SAMPHOLD    , 4, { ENAB,INP0,CLOCK,NODE_NC }, { ENAB,INP0,CLOCK,CLKTYPE }, NULL, "DISCRETE_SAMPLHOLD" },
4357#define DISCRETE_SAMPLHOLD(NODE,INP0,CLOCK,CLKTYPE)                     { NODE, DST_SAMPHOLD    , 3, { INP0,CLOCK,NODE_NC }, { INP0,CLOCK,CLKTYPE }, NULL, "DISCRETE_SAMPLHOLD" },
43334358#define DISCRETE_SWITCH(NODE,ENAB,SWITCH,INP0,INP1)                     { NODE, DST_SWITCH      , 4, { ENAB,SWITCH,INP0,INP1 }, { ENAB,SWITCH,INP0,INP1 }, NULL, "DISCRETE_SWITCH" },
4334#define DISCRETE_ASWITCH(NODE,ENAB,CTRL,INP,THRESHOLD)                  { NODE, DST_ASWITCH     , 3, { ENAB,CTRL,INP,THRESHOLD }, { ENAB,CTRL,INP, THRESHOLD}, NULL, "Analog Switch" },
4359#define DISCRETE_ASWITCH(NODE,CTRL,INP,THRESHOLD)                       { NODE, DST_ASWITCH     , 3, { CTRL,INP,THRESHOLD }, { CTRL,INP, THRESHOLD}, NULL, "Analog Switch" },
43354360#define DISCRETE_TRANSFORM2(NODE,INP0,INP1,FUNCT)                       { NODE, DST_TRANSFORM   , 2, { INP0,INP1 }, { INP0,INP1 }, FUNCT, "DISCRETE_TRANSFORM2" },
43364361#define DISCRETE_TRANSFORM3(NODE,INP0,INP1,INP2,FUNCT)                  { NODE, DST_TRANSFORM   , 3, { INP0,INP1,INP2 }, { INP0,INP1,INP2 }, FUNCT, "DISCRETE_TRANSFORM3" },
43374362#define DISCRETE_TRANSFORM4(NODE,INP0,INP1,INP2,INP3,FUNCT)             { NODE, DST_TRANSFORM   , 4, { INP0,INP1,INP2,INP3 }, { INP0,INP1,INP2,INP3 }, FUNCT, "DISCRETE_TRANSFORM4" },
43384363#define DISCRETE_TRANSFORM5(NODE,INP0,INP1,INP2,INP3,INP4,FUNCT)        { NODE, DST_TRANSFORM   , 5, { INP0,INP1,INP2,INP3,INP4 }, { INP0,INP1,INP2,INP3,INP4 }, FUNCT, "DISCRETE_TRANSFORM5" },
43394364/* Component specific */
43404365#define DISCRETE_COMP_ADDER(NODE,DATA,TABLE)                            { NODE, DST_COMP_ADDER  , 1, { DATA }, { DATA }, TABLE, "DISCRETE_COMP_ADDER" },
4341#define DISCRETE_DAC_R1(NODE,ENAB,DATA,VDATA,LADDER)                    { NODE, DST_DAC_R1      , 3, { ENAB,DATA,VDATA }, { ENAB,DATA,VDATA }, LADDER, "DISCRETE_DAC_R1" },
4366#define DISCRETE_DAC_R1(NODE,DATA,VDATA,LADDER)                         { NODE, DST_DAC_R1      , 2, { DATA,VDATA }, { DATA,VDATA }, LADDER, "DISCRETE_DAC_R1" },
43424367#define DISCRETE_DIODE_MIXER2(NODE,IN0,IN1,TABLE)                       { NODE, DST_DIODE_MIX   , 3, { IN0,IN1 }, { IN0,IN1 }, TABLE, "DISCRETE_DIODE_MIXER2" },
43434368#define DISCRETE_DIODE_MIXER3(NODE,IN0,IN1,IN2,TABLE)                   { NODE, DST_DIODE_MIX   , 4, { IN0,IN1,IN2 }, { IN0,IN1,IN2 }, TABLE, "DISCRETE_DIODE_MIXER3" },
43444369#define DISCRETE_DIODE_MIXER4(NODE,IN0,IN1,IN2,IN3,TABLE)               { NODE, DST_DIODE_MIX   , 5, { IN0,IN1,IN2,IN3 }, { IN0,IN1,IN2,IN3 }, TABLE, "DISCRETE_DIODE_MIXER4" },
r5891r5892
43974422#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" },
43984423#define DISCRETE_555_VCO1(NODE,RESET,VIN,OPTIONS)                       { NODE, DSD_555_VCO1    , 3, { RESET,VIN,NODE_NC }, { RESET,VIN,-1 }, OPTIONS, "DISCRETE_555_VCO1" },
43994424#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" },
4400#define DISCRETE_566(NODE,ENAB,VMOD,R,C,OPTIONS)                        { NODE, DSD_566         , 4, { ENAB,VMOD,R,C }, { ENAB,VMOD,R,C }, OPTIONS, "DISCRETE_566" },
4401#define DISCRETE_74LS624(NODE,ENAB,VMOD,VRNG,C,OUTTYPE)                 { NODE, DSD_LS624       , 5, { ENAB,VMOD,VRNG,C,NODE_NC }, { ENAB,VMOD,VRNG,C, OUTTYPE }, NULL, "DISCRETE_74LS624" },
4425#define DISCRETE_566(NODE,VMOD,R,C,OPTIONS)                             { NODE, DSD_566         , 3, { VMOD,R,C }, { VMOD,R,C }, OPTIONS, "DISCRETE_566" },
4426#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" },
44024427
44034428/* NOP */
44044429#define DISCRETE_NOP(NODE)                                              { NODE, DSS_NOP         , 0, { 0 }, { 0 }, NULL, "DISCRETE_NOP" },
r5891r5892
44244449//#define DISCRETE_TASK_SYNC()                                          { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" },
44254450
44264451/* output */
4427#define DISCRETE_OUTPUT(OPNODE,GAIN)                               { NODE_SPECIAL, DSO_OUTPUT   , 2, { OPNODE,NODE_NC }, { 0,GAIN }, NULL, "DISCRETE_OUTPUT" },
4452#define DISCRETE_OUTPUT(OPNODE,GAIN)                                  { NODE_SPECIAL, DSO_OUTPUT   , 2, { OPNODE,NODE_NC }, { 0,GAIN }, NULL, "DISCRETE_OUTPUT" },
44284453
44294454
44304455/*************************************
src/emu/sound/disc_dev.c
r5891r5892
106106
107107struct dsd_566_context
108108{
109   int         error;
110109   unsigned int state[2];         /* keeps track of excess flip_flop changes during the current step */
111110   int         flip_flop;         /* 566 flip/flop output state */
112111   double      cap_voltage;      /* voltage on cap */
r5891r5892
124123   int         state;
125124   double      remain;         /* remaining time from last step */
126125   int         out_type;
126   double      k1;            /* precalculated cap part of formula */
127   double      k2;            /* precalculated ring part of formula */
127128};
128129
129130
r5891r5892
255256         context->t_rc_bleed  = DSD_555_ASTBL_T_RC_BLEED;
256257         context->t_rc_charge = DSD_555_ASTBL_T_RC_CHARGE;
257258         context->t_rc_discharge = DSD_555_ASTBL_T_RC_DISCHARGE;
258         context->exp_bleed  = RC_CHARGE_EXP(node, context->t_rc_bleed);
259         context->exp_charge = RC_CHARGE_EXP(node, context->t_rc_charge);
260         context->exp_discharge = RC_CHARGE_EXP(node, context->t_rc_discharge);
259         context->exp_bleed  = RC_CHARGE_EXP(context->t_rc_bleed);
260         context->exp_charge = RC_CHARGE_EXP(context->t_rc_charge);
261         context->exp_discharge = RC_CHARGE_EXP(context->t_rc_discharge);
261262         context->last_r1 = DSD_555_ASTBL__R1;
262263         context->last_r2 = DSD_555_ASTBL__R2;
263264         context->last_c  = DSD_555_ASTBL__C;
r5891r5892
418419   else
419420   {
420421      context->t_rc_bleed  = DSD_555_ASTBL_T_RC_BLEED;
421      context->exp_bleed   = RC_CHARGE_EXP(node, context->t_rc_bleed);
422      context->exp_bleed   = RC_CHARGE_EXP(context->t_rc_bleed);
422423      context->t_rc_charge = DSD_555_ASTBL_T_RC_CHARGE;
423      context->exp_charge  = RC_CHARGE_EXP(node, context->t_rc_charge);
424      context->exp_charge  = RC_CHARGE_EXP(context->t_rc_charge);
424425      context->t_rc_discharge = DSD_555_ASTBL_T_RC_DISCHARGE;
425      context->exp_discharge  = RC_CHARGE_EXP(node, context->t_rc_discharge);
426      context->exp_discharge  = RC_CHARGE_EXP(context->t_rc_discharge);
426427   }
427428
428429   context->output_is_ac = info->options & DISC_555_OUT_AC;
r5891r5892
506507         else
507508         {
508509            /* Charging */
509            v_cap_next = v_cap + ((info->v_pos - v_cap) * RC_CHARGE_EXP(node, DSD_555_MSTBL__R * DSD_555_MSTBL__C));
510            v_cap_next = v_cap + ((info->v_pos - v_cap) * RC_CHARGE_EXP(DSD_555_MSTBL__R * DSD_555_MSTBL__C));
510511
511512            /* Has it charged past upper limit? */
512513            /* If trigger is still enabled, then we keep charging,
r5891r5892
994995            break;
995996      }
996997
997      context->exp_bleed  = RC_CHARGE_EXP(node, DSD_555_CC_T_RC_BLEED);
998      context->exp_bleed  = RC_CHARGE_EXP(DSD_555_CC_T_RC_BLEED);
998999      context->t_rc_discharge_01 = DSD_555_CC_T_RC_DISCHARGE_01;
999      context->exp_discharge_01  = RC_CHARGE_EXP(node, context->t_rc_discharge_01);
1000      context->exp_discharge_01  = RC_CHARGE_EXP(context->t_rc_discharge_01);
10001001      context->t_rc_discharge_no_i = DSD_555_CC_T_RC_DISCHARGE_NO_I;
1001      context->exp_discharge_no_i  = RC_CHARGE_EXP(node, context->t_rc_discharge_no_i);
1002      context->exp_discharge_no_i  = RC_CHARGE_EXP(context->t_rc_discharge_no_i);
10021003      context->t_rc_charge = DSD_555_CC_T_RC_CHARGE;
1003      context->exp_charge  = RC_CHARGE_EXP(node, context->t_rc_charge);
1004      context->exp_charge  = RC_CHARGE_EXP(context->t_rc_charge);
10041005      context->t_rc_discharge = DSD_555_CC_T_RC_DISCHARGE;
1005      context->exp_discharge  = RC_CHARGE_EXP(node, context->t_rc_discharge);
1006      context->exp_discharge  = RC_CHARGE_EXP(context->t_rc_discharge);
10061007   }
10071008
10081009   /* Step to set the output */
r5891r5892
13761377 *
13771378 * DSD_566 - Usage of node_description values
13781379 *
1379 * input[0]    - Enable input value
1380 * input[1]    - Modulation Voltage
1381 * input[2]    - R value
1382 * input[3]    - C value
1380 * input[0]    - Modulation Voltage
1381 * input[1]    - R value
1382 * input[2]    - C value
13831383 *
13841384 * also passed discrete_566_desc structure
13851385 *
13861386 * Mar 2004, D Renaud.
13871387 ************************************************************************/
1388#define DSD_566__ENABLE   DISCRETE_INPUT(0)
1389#define DSD_566__VMOD   DISCRETE_INPUT(1)
1390#define DSD_566__R      DISCRETE_INPUT(2)
1391#define DSD_566__C      DISCRETE_INPUT(3)
1388#define DSD_566__VMOD   DISCRETE_INPUT(0)
1389#define DSD_566__R      DISCRETE_INPUT(1)
1390#define DSD_566__C      DISCRETE_INPUT(2)
13921391
13931392static DISCRETE_STEP(dsd_566)
13941393{
r5891r5892
14011400   double v_cap_next = 0;   /* Voltage on capacitor, after dt */
14021401   double v_charge;
14031402
1404   if (DSD_566__ENABLE && !context->error)
1403   dt    = node->info->sample_time;   /* Change in time */
1404   v_cap = context->cap_voltage;   /* Set to voltage before change */
1405
1406   /* get the v_charge and update each step if it is a node */
1407   if (context->v_charge_node != NULL)
14051408   {
1406      dt    = node->info->sample_time;   /* Change in time */
1407      v_cap = context->cap_voltage;   /* Set to voltage before change */
1409      v_charge  = *context->v_charge_node;
1410      v_charge -= info->v_neg;
1411   }
1412   else
1413      v_charge = context->v_charge;
14081414
1409      /* get the v_charge and update each step if it is a node */
1410      if (context->v_charge_node != NULL)
1411      {
1412         v_charge  = *context->v_charge_node;
1413         v_charge -= info->v_neg;
1414      }
1415      else
1416         v_charge = context->v_charge;
1415   /* Calculate charging current */
1416   i = (v_charge - DSD_566__VMOD) / DSD_566__R;
14171417
1418      /* Calculate charging current */
1419      i = (v_charge - DSD_566__VMOD) / DSD_566__R;
1420
1421      /* Keep looping until all toggling in time sample is used up. */
1422      do
1418   /* Keep looping until all toggling in time sample is used up. */
1419   do
1420   {
1421      if (context->flip_flop)
14231422      {
1424         if (context->flip_flop)
1425         {
1426            /* Discharging */
1427            v_cap_next = v_cap - (i * dt / DSD_566__C);
1428            dt         = 0;
1423         /* Discharging */
1424         v_cap_next = v_cap - (i * dt / DSD_566__C);
1425         dt         = 0;
14291426
1430            /* has it discharged past lower limit? */
1431            if (v_cap_next <= context->threshold_low)
1427         /* has it discharged past lower limit? */
1428         if (v_cap_next <= context->threshold_low)
1429         {
1430            if (v_cap_next < context->threshold_low)
14321431            {
1433               if (v_cap_next < context->threshold_low)
1434               {
1435                  /* calculate the overshoot time */
1436                  dt = DSD_566__C * (context->threshold_low - v_cap_next) / i;
1437               }
1438               v_cap = context->threshold_low;
1439               context->flip_flop = 0;
1440               /*
1441                     * If the sampling rate is too low and the desired frequency is too high
1442                     * then we will start getting too many outputs that can't catch up.  We will
1443                     * limit this to 3.  The output is already incorrect because of the low sampling,
1444                     * but at least this way it can recover.
1445                     */
1446               context->state[0] = (context->state[0] + 1) & 0x03;
1432               /* calculate the overshoot time */
1433               dt = DSD_566__C * (context->threshold_low - v_cap_next) / i;
14471434            }
1435            v_cap = context->threshold_low;
1436            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;
14481444         }
1449         else
1450         {
1451            /* Charging */
1452            /* iC=C*dv/dt  works out to dv=iC*dt/C */
1453            v_cap_next = v_cap + (i * dt / DSD_566__C);
1454            dt         = 0;
1455            /* Yes, if the cap voltage has reached the max voltage it can,
1456                 * and the 566 threshold has not been reached, then oscillation stops.
1457                 * This is the way the actual electronics works.
1458                 * This is why you never play with the pots after being factory adjusted
1459                 * to work in the proper range. */
1460            if (v_cap_next > DSD_566__VMOD) v_cap_next = DSD_566__VMOD;
1445      }
1446      else
1447      {
1448         /* Charging */
1449         /* iC=C*dv/dt  works out to dv=iC*dt/C */
1450         v_cap_next = v_cap + (i * dt / DSD_566__C);
1451         dt         = 0;
1452         /* Yes, if the cap voltage has reached the max voltage it can,
1453             * and the 566 threshold has not been reached, then oscillation stops.
1454             * This is the way the actual electronics works.
1455             * This is why you never play with the pots after being factory adjusted
1456             * to work in the proper range. */
1457         if (v_cap_next > DSD_566__VMOD) v_cap_next = DSD_566__VMOD;
14611458
1462            /* has it charged past upper limit? */
1463            if (v_cap_next >= context->threshold_high)
1459         /* has it charged past upper limit? */
1460         if (v_cap_next >= context->threshold_high)
1461         {
1462            if (v_cap_next > context->threshold_high)
14641463            {
1465               if (v_cap_next > context->threshold_high)
1466               {
1467                  /* calculate the overshoot time */
1468                  dt = DSD_566__C * (v_cap_next - context->threshold_high) / i;
1469               }
1470               v_cap = context->threshold_high;
1471               context->flip_flop = 1;
1472               context->state[1] = (context->state[1] + 1) & 0x03;
1464               /* calculate the overshoot time */
1465               dt = DSD_566__C * (v_cap_next - context->threshold_high) / i;
14731466            }
1467            v_cap = context->threshold_high;
1468            context->flip_flop = 1;
1469            context->state[1] = (context->state[1] + 1) & 0x03;
14741470         }
1475      } while(dt);
1471      }
1472   } while(dt);
14761473
1477      context->cap_voltage = v_cap_next;
1474   context->cap_voltage = v_cap_next;
14781475
1479      switch (info->options & DISC_566_OUT_MASK)
1480      {
1481         case DISC_566_OUT_SQUARE:
1482         case DISC_566_OUT_LOGIC:
1483            /* use up any output states */
1484            if (node->output[0] && context->state[0])
1485            {
1486               node->output[0] = 0;
1487               context->state[0]--;
1488            }
1489            else if (!node->output[0] && context->state[1])
1490            {
1491               node->output[0] = 1;
1492               context->state[1]--;
1493            }
1494            else
1495            {
1496               node->output[0] = context->flip_flop;
1497            }
1498            if ((info->options & DISC_566_OUT_MASK) != DISC_566_OUT_LOGIC)
1499               node->output[0] = context->flip_flop ? context->v_sqr_high : context->v_sqr_low;
1500            break;
1501         case DISC_566_OUT_TRIANGLE:
1502            /* we can ignore any unused states when
1503                 * outputting the cap voltage */
1504            node->output[0] = v_cap_next;
1505            if (info->options & DISC_566_OUT_AC)
1506               node->output[0] -= context->triangle_ac_offset;
1507            break;
1508      }
1476   switch (info->options & DISC_566_OUT_MASK)
1477   {
1478      case DISC_566_OUT_SQUARE:
1479      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         {
1493            node->output[0] = context->flip_flop;
1494         }
1495         if ((info->options & DISC_566_OUT_MASK) != DISC_566_OUT_LOGIC)
1496            node->output[0] = context->flip_flop ? context->v_sqr_high : context->v_sqr_low;
1497         break;
1498      case DISC_566_OUT_TRIANGLE:
1499         /* we can ignore any unused states when
1500             * outputting the cap voltage */
1501         node->output[0] = v_cap_next;
1502         if (info->options & DISC_566_OUT_AC)
1503            node->output[0] -= context->triangle_ac_offset;
1504         break;
15091505   }
1510   else
1511      node->output[0] = 0;
15121506}
15131507
15141508static DISCRETE_RESET(dsd_566)
r5891r5892
15191513
15201514   double   v_diff, temp;
15211515
1522   context->error = 0;
15231516   if (info->v_neg >= info->v_pos)
15241517   {
1525      logerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", NODE_BLOCKINDEX(node));
1526      context->error = 1;
1527      return;
1518      fatalerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", NODE_BLOCKINDEX(node));
15281519   }
15291520
15301521   /* setup v_charge or node */
r5891r5892
15671558 *
15681559 * DSD_LS624 - Usage of node_description values
15691560 *
1570 * input[0]    - Enable input value
1571 * input[1]    - Modulation Voltage
1572 * input[2]    - Range Voltage
1573 * input[3]    - C value
1574 * input[4]    - Output type
1561 * input[0]    - Modulation Voltage
1562 * input[1]    - Range Voltage
1563 * input[2]    - C value
1564 * input[3]    - Output type
15751565 *
15761566 * Dec 2007, Couriersud
15771567 ************************************************************************/
1578#define DSD_LS624__ENABLE   DISCRETE_INPUT(0)
1579#define DSD_LS624__VMOD      DISCRETE_INPUT(1)
1580#define DSD_LS624__VRNG      DISCRETE_INPUT(2)
1581#define DSD_LS624__C      DISCRETE_INPUT(3)
1582#define DSD_LS624__OUTTYPE   DISCRETE_INPUT(4)
1568#define DSD_LS624__VMOD      DISCRETE_INPUT(0)
1569#define DSD_LS624__VRNG      DISCRETE_INPUT(1)
1570#define DSD_LS624__C      DISCRETE_INPUT(2)
1571#define DSD_LS624__OUTTYPE   DISCRETE_INPUT(3)
15831572
15841573/*
15851574 * The datasheet mentions a 600 ohm discharge. It also gives
r5891r5892
15931582 * where calculated using least square approximation.
15941583 * This approach gives a bit better results compared to the first approach.
15951584 */
1596#define LS624_F(_C, _VI, _VR)   pow(10, -0.912029404 * log10(_C) + 0.243264328 * (_VI) \
1597                - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925)
1585/* Original formula before optimization of static values
1586 #define LS624_F(_C, _VI, _VR)  pow(10, -0.912029404 * log10(_C) + 0.243264328 * (_VI) \
1587                  - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925)
1588*/
1589#define LS624_F(_VI)   pow(10, context->k1 + 0.243264328 * (_VI) + context->k2 * (_VI))
15981590
15991591static DISCRETE_STEP(dsd_ls624)
16001592{
16011593   struct dsd_ls624_context *context = (struct dsd_ls624_context *)node->context;
16021594
1603   if (DSD_LS624__ENABLE)
1595   double   dt;   /* change in time */
1596   double   sample_t;
1597   double   t;
1598   double  en = 0.0f;
1599   int      cntf = 0, cntr = 0;
1600
1601   sample_t = node->info->sample_time;   /* Change in time */
1602   //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));
1604   t   = context->remain;
1605   en += (double) context->state * t;
1606   while (t + dt <= sample_t)
16041607   {
1605      double   dt;   /* change in time */
1606      double   sample_t;
1607      double   t;
1608      double  en = 0.0f;
1609      int      cntf = 0, cntr = 0;
1608      en += (double) context->state * dt;
1609      context->state = (1 - context->state);
1610      if (context->state)
1611         cntr++;
1612      else
1613         cntf++;
1614      t += dt;
1615   }
1616   en += (sample_t - t) * (double) context->state;
1617   context->remain = t - sample_t;
16101618
1611      sample_t = node->info->sample_time;   /* Change in time */
1612      //dt  = LS624_T(DSD_LS624__C, DSD_LS624__VRNG, DSD_LS624__VMOD) / 2.0;
1613      dt  = 1.0f / (2.0f * LS624_F(DSD_LS624__C, DSD_LS624__VMOD, DSD_LS624__VRNG));
1614      t   = context->remain;
1615      en += (double) context->state * t;
1616      while (t + dt <= sample_t)
1617      {
1618         en += (double) context->state * dt;
1619         context->state = (1 - context->state);
1620         if (context->state)
1621            cntr++;
1619   switch (context->out_type)
1620   {
1621      case DISC_LS624_OUT_ENERGY:
1622         node->output[0] = en / sample_t;
1623         break;
1624      case DISC_LS624_OUT_LOGIC:
1625         /* filter out randomness */
1626         if (cntf + cntr > 1)
1627            node->output[0] = 1;
16221628         else
1623            cntf++;
1624         t += dt;
1625      }
1626      en += (sample_t - t) * (double) context->state;
1627      context->remain = t - sample_t;
1628
1629      switch (context->out_type)
1630      {
1631         case DISC_LS624_OUT_ENERGY:
1632            node->output[0] = en / sample_t;
1633            break;
1634         case DISC_LS624_OUT_LOGIC:
1635            /* filter out randomness */
1636            if (cntf + cntr > 1)
1637               node->output[0] = 1;
1638            else
1639               node->output[0] = context->state;
1640            break;
1641         case DISC_LS624_OUT_COUNT_F:
1642            node->output[0] = cntf;
1643            break;
1644         case DISC_LS624_OUT_COUNT_R:
1645            node->output[0] = cntr;
1646            break;
1647      }
1648
1629            node->output[0] = context->state;
1630         break;
1631      case DISC_LS624_OUT_COUNT_F:
1632         node->output[0] = cntf;
1633         break;
1634      case DISC_LS624_OUT_COUNT_R:
1635         node->output[0] = cntr;
1636         break;
16491637   }
1650   else
1651      node->output[0] = 0;
16521638}
16531639
16541640static DISCRETE_RESET(dsd_ls624)
r5891r5892
16591645   context->state    = 0;
16601646   context->out_type = DSD_LS624__OUTTYPE;
16611647
1648   /* precalculate some parts of the formula for speed */
1649   context->k1 = -0.912029404 * log10(DSD_LS624__C) -0.091695877 * (DSD_LS624__VRNG) - 3.207072925;
1650   context->k2 = -0.014110946 * (DSD_LS624__VRNG);
1651
16621652   /* Step the output */
16631653   DISCRETE_STEP_CALL(dsd_ls624);
16641654}
src/emu/sound/cdp1864.c
r5891r5892
1111 
1212    TODO:
1313 
14   - interlace mode
15   - PAL output, currently using RGB
16   - cpu synchronization
14    - interlace mode
15    - PAL output, currently using RGB
16    - cpu synchronization
1717 
18      SC1 and SC0 are used to provide CDP1864C-to-CPU synchronization for a jitter-free display.
19      During every horizontal sync the CDP1864C samples SC0 and SC1 for SC0 = 1 and SC1 = 0
20      (CDP1800 execute state). Detection of a fetch cycle causes the CDP1864C to skip cycles to
21      attain synchronization. (i.e. picture moves 8 pixels to the right)
18        SC1 and SC0 are used to provide CDP1864C-to-CPU synchronization for a jitter-free display.
19        During every horizontal sync the CDP1864C samples SC0 and SC1 for SC0 = 1 and SC1 = 0
20        (CDP1800 execute state). Detection of a fetch cycle causes the CDP1864C to skip cycles to
21        attain synchronization. (i.e. picture moves 8 pixels to the right)
2222 
2323*/
2424 
src/emu/sound/cdp1864.h
r5891r5892
66    Visit http://mamedev.org for licensing and usage restrictions.
77 
88**********************************************************************
9                     ________________
10         INLACE    1   ---|      \/      |---  40  Vdd
11         CLK IN_    2   ---|            |---  39  AUD
12        CLR OUT_    3   ---|            |---  38  CLR IN_
13            AOE    4   ---|            |---  37  DMA0_
14            SC1    5   ---|            |---  36  INT_
15            SC0    6   ---|            |---  35  TPA
16           MRD_    7   ---|            |---  34  TPB
17          BUS 7    8   ---|            |---  33  EVS
18          BUS 6    9   ---|            |---  32  V SYNC
19          BUS 5   10   ---|   CDP1864C    |---  31  H SYNC
20          BUS 4   11   ---|   top view   |---  30  C SYNC_
21          BUS 3   12   ---|            |---  29  RED
22          BUS 2   13   ---|            |---  28  BLUE
23          BUS 1   14   ---|            |---  27  GREEN
24          BUS 0   15   ---|            |---  26  BCK GND_
25           CON_   16   ---|            |---  25  BURST
26            N2   17   ---|            |---  24  ALT
27            EF_   18   ---|            |---  23  R DATA
28            N0   19   ---|            |---  22  G DATA
29            Vss   20   ---|________________|---  21  B DATA
9                            ________________
10            INLACE   1  ---|       \/       |---  40  Vdd
11           CLK IN_   2  ---|                |---  39  AUD
12          CLR OUT_   3  ---|                |---  38  CLR IN_
13               AOE   4  ---|                |---  37  DMA0_
14               SC1   5  ---|                |---  36  INT_
15               SC0   6  ---|                |---  35  TPA
16              MRD_   7  ---|                |---  34  TPB
17             BUS 7   8  ---|                |---  33  EVS
18             BUS 6   9  ---|                |---  32  V SYNC
19             BUS 5  10  ---|    CDP1864C    |---  31  H SYNC
20             BUS 4  11  ---|    top view    |---  30  C SYNC_
21             BUS 3  12  ---|                |---  29  RED
22             BUS 2  13  ---|                |---  28  BLUE
23             BUS 1  14  ---|                |---  27  GREEN
24             BUS 0  15  ---|                |---  26  BCK GND_
25              CON_  16  ---|                |---  25  BURST
26                N2  17  ---|                |---  24  ALT
27               EF_  18  ---|                |---  23  R DATA
28                N0  19  ---|                |---  22  G DATA
29               Vss  20  ---|________________|---  21  B DATA
3030 
3131 
32         http://homepage.mac.com/ruske/cosmacelf/cdp1864.pdf
32           http://homepage.mac.com/ruske/cosmacelf/cdp1864.pdf
3333 
3434**********************************************************************/
3535 
src/emu/sound/disc_wav.c
r5891r5892
407407   }
408408
409409   /* Reset everything if necessary */
410   if((DSS_LFSR_NOISE__RESET ? 1 : 0) == context->reset_on_high)
410   if(((DSS_LFSR_NOISE__RESET == 0) ? 0 : 1) == context->reset_on_high)
411411   {
412412      DISCRETE_RESET_CALL(dss_lfsr);
413413      return;
r5891r5892
12071207     * So use this for the RC charge constant. */
12081208   rSource     = 1.0 / ((1.0 / info->rIn) + (1.0 / info->rFeedback));
12091209   context->rc = rSource * info->c;
1210   context->exponent = RC_CHARGE_EXP(node, context->rc);
1210   context->exponent = RC_CHARGE_EXP(context->rc);
12111211
12121212   /* Cap is at 0V on power up.  Causing output to be high. */
12131213   context->v_cap = 0;
src/emu/sound/disc_flt.c
r5891r5892
162162{
163163   struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
164164
165   context->exponent = RC_CHARGE_EXP(node, DST_CRFILTER__R * DST_CRFILTER__C);
165   context->exponent = RC_CHARGE_EXP(DST_CRFILTER__R * DST_CRFILTER__C);
166166   context->vCap   = 0;
167167   node->output[0] = DST_CRFILTER__IN;
168168}
r5891r5892
491491   {
492492      case DISC_OP_AMP_FILTER_IS_LOW_PASS_1:
493493      case DISC_OP_AMP_FILTER_IS_LOW_PASS_1M:
494         context->exponentC1 = RC_CHARGE_EXP(node, info->rF * info->c1);
494         context->exponentC1 = RC_CHARGE_EXP(info->rF * info->c1);
495495         context->exponentC2 =  0;
496496         break;
497497      case DISC_OP_AMP_FILTER_IS_HIGH_PASS_1:
498         context->exponentC1 = RC_CHARGE_EXP(node, context->rTotal * info->c1);
498         context->exponentC1 = RC_CHARGE_EXP(context->rTotal * info->c1);
499499         context->exponentC2 =  0;
500500         break;
501501      case DISC_OP_AMP_FILTER_IS_BAND_PASS_1:
502         context->exponentC1 = RC_CHARGE_EXP(node, info->rF * info->c1);
503         context->exponentC2 = RC_CHARGE_EXP(node, context->rTotal * info->c2);
502         context->exponentC1 = RC_CHARGE_EXP(info->rF * info->c1);
503         context->exponentC2 = RC_CHARGE_EXP(context->rTotal * info->c2);
504504         break;
505505      case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M | DISC_OP_AMP_IS_NORTON:
506506         context->rTotal = 1.0 / (1.0 / info->r1 + 1.0 / info->r2);
r5891r5892
525525         break;
526526      }
527527      case DISC_OP_AMP_FILTER_IS_BAND_PASS_0 | DISC_OP_AMP_IS_NORTON:
528         context->exponentC1 = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r1, info->r2 + info->r3 + info->r4) * info->c1);
529         context->exponentC2 = RC_CHARGE_EXP(node, RES_2_PARALLEL(info->r1 + info->r2, info->r3 + info->r4) * info->c2);
530         context->exponentC3 = RC_CHARGE_EXP(node, (info->r1 + info->r2 + info->r3 + info->r4) * info->c3);
528         context->exponentC1 = RC_CHARGE_EXP(RES_2_PARALLEL(info->r1, info->r2 + info->r3 + info->r4) * info->c1);
529         context->exponentC2 = RC_CHARGE_EXP(RES_2_PARALLEL(info->r1 + info->r2, info->r3 + info->r4) * info->c2);
530         context->exponentC3 = RC_CHARGE_EXP((info->r1 + info->r2 + info->r3 + info->r4) * info->c3);
531531         break;
532532      case DISC_OP_AMP_FILTER_IS_HIGH_PASS_0 | DISC_OP_AMP_IS_NORTON:
533         context->exponentC1 = RC_CHARGE_EXP(node, info->r1 * info->c1);
533         context->exponentC1 = RC_CHARGE_EXP(info->r1 * info->c1);
534534         break;
535535   }
536536
r5891r5892
641641
642642   context->state = 0;
643643   context->t = 0;
644   context->exponent0 = RC_DISCHARGE_EXP(node, DST_RCDISC2__R0 * DST_RCDISC2__C);
645   context->exponent1 = RC_DISCHARGE_EXP(node, DST_RCDISC2__R1 * DST_RCDISC2__C);
644   context->exponent0 = RC_DISCHARGE_EXP(DST_RCDISC2__R0 * DST_RCDISC2__C);
645   context->exponent1 = RC_DISCHARGE_EXP(DST_RCDISC2__R1 * DST_RCDISC2__C);
646646}
647647
648648/************************************************************************
r5891r5892
723723   context->state = 0;
724724   context->t = 0;
725725   context->v_diode = DST_RCDISC3__DJV;
726   context->exponent0 = RC_CHARGE_EXP(node, DST_RCDISC3__R1 * DST_RCDISC3__C);
727   context->exponent1 = RC_CHARGE_EXP(node, RES_2_PARALLEL(DST_RCDISC3__R1, DST_RCDISC3__R2) * DST_RCDISC3__C);
726   context->exponent0 = RC_CHARGE_EXP(DST_RCDISC3__R1 * DST_RCDISC3__C);
727   context->exponent1 = RC_CHARGE_EXP(RES_2_PARALLEL(DST_RCDISC3__R1, DST_RCDISC3__R2) * DST_RCDISC3__C);
728728}
729729
730730
r5891r5892
820820         i  = v / rT;
821821         context->v[1] = i * r + .5;
822822         rT = RES_2_PARALLEL(DST_RCDISC4__R2, r);
823         context->exp[1] = RC_CHARGE_EXP(node, rT * DST_RCDISC4__C1);
823         context->exp[1] = RC_CHARGE_EXP(rT * DST_RCDISC4__C1);
824824
825825         /* When the input is 0, R1 is out of circuit. */
826826         rT = DST_RCDISC4__R2 + DST_RCDISC4__R3;
827827         i  = v / rT;
828828         context->v[0] = i * DST_RCDISC4__R3 + .5;
829829         rT = RES_2_PARALLEL(DST_RCDISC4__R2, DST_RCDISC4__R3);
830         context->exp[0] = RC_CHARGE_EXP(node, rT * DST_RCDISC4__C1);
830         context->exp[0] = RC_CHARGE_EXP(rT * DST_RCDISC4__C1);
831831         break;
832832
833833      case 3:
r5891r5892
838838         r = 500.0 + DST_RCDISC4__R1;
839839         context->v[1] = RES_VOLTAGE_DIVIDER(r, DST_RCDISC4__R2) * (5.0 - 0.5);
840840         rT = RES_2_PARALLEL(r, DST_RCDISC4__R2);
841         context->exp[1] = RC_CHARGE_EXP(node, rT * DST_RCDISC4__C1);
841         context->exp[1] = RC_CHARGE_EXP(rT * DST_RCDISC4__C1);
842842
843843         /* When the input is 0, R1 is out of circuit. */
844844         context->v[0] = 0;
845         context->exp[0] = RC_CHARGE_EXP(node, DST_RCDISC4__R2 * DST_RCDISC4__C1);
845         context->exp[0] = RC_CHARGE_EXP(DST_RCDISC4__R2 * DST_RCDISC4__C1);
846846         break;
847847   }
848848}
r5891r5892
902902   context->state = 0;
903903   context->t = 0;
904904   context->v_cap = 0;
905   context->exponent0 = RC_CHARGE_EXP(node, DST_RCDISC5__R * DST_RCDISC5__C);
905   context->exponent0 = RC_CHARGE_EXP(DST_RCDISC5__R * DST_RCDISC5__C);
906906}
907907
908908
r5891r5892
975975   /* DST_RCDISC_MOD__IN1 <= 0.5 */
976976   rc[0] = DST_RCDISC_MOD__R1 + DST_RCDISC_MOD__R2;
977977   if (rc[0] < 1) rc[0] = 1;
978   context->exp_low[0]  = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * rc[0]);
978   context->exp_low[0]  = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * rc[0]);
979979   context->gain[0]     = RES_VOLTAGE_DIVIDER(rc[0], DST_RCDISC_MOD__R4);
980980   /* DST_RCDISC_MOD__IN1 > 0.5 */
981981   rc[1] = DST_RCDISC_MOD__R2;
982982   if (rc[1] < 1) rc[1] = 1;
983   context->exp_low[1]  = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * rc[1]);
983   context->exp_low[1]  = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * rc[1]);
984984   context->gain[1]     = RES_VOLTAGE_DIVIDER(rc[1], DST_RCDISC_MOD__R4);
985985   /* DST_RCDISC_MOD__IN2 <= 0.6 */
986986   rc2[0] = DST_RCDISC_MOD__R4;
987987   /* DST_RCDISC_MOD__IN2 > 0.6 */
988988   rc2[1] = RES_2_PARALLEL(DST_RCDISC_MOD__R3, DST_RCDISC_MOD__R4);
989989   /* DST_RCDISC_MOD__IN1 <= 0.5 && DST_RCDISC_MOD__IN2 <= 0.6 */
990   context->exp_high[0] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[0] + rc2[0]));
990   context->exp_high[0] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[0] + rc2[0]));
991991   context->vd_gain[0]  = RES_VOLTAGE_DIVIDER(rc[0], rc2[0]);
992992   /* DST_RCDISC_MOD__IN1 > 0.5  && DST_RCDISC_MOD__IN2 <= 0.6 */
993   context->exp_high[1] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[1] + rc2[0]));
993   context->exp_high[1] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[1] + rc2[0]));
994994   context->vd_gain[1]  = RES_VOLTAGE_DIVIDER(rc[1], rc2[0]);
995995   /* DST_RCDISC_MOD__IN1 <= 0.5 && DST_RCDISC_MOD__IN2 > 0.6 */
996   context->exp_high[2] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[0] + rc2[1]));
996   context->exp_high[2] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[0] + rc2[1]));
997997   context->vd_gain[2]  = RES_VOLTAGE_DIVIDER(rc[0], rc2[1]);
998998   /* DST_RCDISC_MOD__IN1 > 0.5  && DST_RCDISC_MOD__IN2 > 0.6 */
999   context->exp_high[3] = RC_DISCHARGE_EXP(node, DST_RCDISC_MOD__C * (rc[1] + rc2[1]));
999   context->exp_high[3] = RC_DISCHARGE_EXP(DST_RCDISC_MOD__C * (rc[1] + rc2[1]));
10001000   context->vd_gain[3]  = RES_VOLTAGE_DIVIDER(rc[1], rc2[1]);
10011001
10021002   context->v_cap  = 0;
r5891r5892
10431043{
10441044   struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
10451045
1046   context->exponent = RC_CHARGE_EXP(node, DST_RCFILTER__R * DST_RCFILTER__C);
1046   context->exponent = RC_CHARGE_EXP(DST_RCFILTER__R * DST_RCFILTER__C);
10471047   context->vCap   = 0;
10481048   node->output[0] = 0;
10491049}
r5891r5892
11281128   for (i = 0; i < 4; i++)
11291129   {
11301130      context->vCap[i] = 0;
1131      context->exp[i] = RC_CHARGE_EXP(node, CD4066_ON_RES * DST_RCFILTER_SW__C(i));
1131      context->exp[i] = RC_CHARGE_EXP( CD4066_ON_RES * DST_RCFILTER_SW__C(i));
11321132   }
11331133
11341134   for (bits=0; bits < 15; bits++)
r5891r5892
11461146
11471147
11481148   /* fast cases */
1149   context->exp0 = RC_CHARGE_EXP(node, (CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(0));
1150   context->exp1 = RC_CHARGE_EXP(node, (CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(1));
1149   context->exp0 = RC_CHARGE_EXP((CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(0));
1150   context->exp1 = RC_CHARGE_EXP((CD4066_ON_RES + DST_RCFILTER_SW__R) * DST_RCFILTER_SW__C(1));
11511151   context->factor = RES_VOLTAGE_DIVIDER(DST_RCFILTER_SW__R, CD4066_ON_RES);
11521152
11531153   node->output[0] = 0;
src/emu/sound/tms5220.c
r5891r5892
3838Note the standard naming for d* data bits with 7 as MSB and 0 as LSB is in lowercase.
3939TI's naming has D7 as LSB and D0 as MSB and is in uppercase
4040
41TODO:
42    Implement a ready callback for pc interfaces
43    - this will be quite a challenge since for it to be really accurate
44      the whole emulation has to run in sync (lots of timers) with the
45      cpu cores.
46    If a command is still executing, /READY will be kept high until the command has
47    finished if the next command is written.
48    TMS5220C: see below.
49    tomcat has a 5220 which is not hooked up at all
50
51Notes:
52    Looping has the tms5220 hookep up directly to the cpu. However currently the
53    tms9900 cpu core does not support a ready line.
54
55    Email from Lord Nightmare having a lot more detail follows:
56
57    Yes, there is at least two more differences:
58The 5220 is 'noisier' when playing unvoiced frames than the 5220C is; I
59think the 5220C may use a different energy table (or use one value lower
60in the normal energy table) than the 5220 does, possibly only when
61playing unvoiced frames, but I can't prove this without a decap; the
625220C's PROMOUT pin (for dumping the lpc tables as played) is
63nonfunctional due to changed design or a die bug.
64In addition, the NOP commands on the FIFO interface have been changed
65and data passed in the low bits has a meaning regarding frame length:
66commands :
67(lsb is right, msb is left; x means don't care)
68x0x0xbcc : (5220: NOP) (5220C: select frame length by cc, and b selects
69whether every frame is preceeded by 2 bits to select the frame length
70(instead of using the value set by cc)) (default is 00 for frame length
71(200 samples) and 0 for whether the preceeding 2 bits are enabled (off))
72x001xxxx: sends eight read bit commands (M0 high M1 low) to VSM and
73reads the resulting bits serially into a temporary register, which
74becomes readable as the next byte read from the tms52xx once ready goes
75active.
76
77Note the bit order of the byte read from the TMS52xx is BACKWARDS as
78compared to the actual data order as in the rom on the VSM chips! This
79was IMHO a rather silly design decision of TI. (I asked Larry
80Brantingham about this but he wasn't involved with the TMS52xx chips,
81just the 5100)
82There's ASCII data in the TI 99/4 speech module VSMs which has the bit
83order reversed on purpose because of this!
84
85x011xxxx: sends a read and branch command (M0 high, M1 high) to force
86VSM to set its data pointer to whatever the data is at its current
87pointer location is)
88x100aaaa: send a load address command (M0 low M1 high) to vsm with the 4
89'a' bits
90x101xxxx: 'speak' begins speaking from current address in the data
91pointer of the vsms
92x110xxxx: 'speak external' begins speaking from the 16 byte fifo
93x111xxxx: resets the speech synthesis core immediately; clears the bit
94offset counter in the fifo to the nearest byte 'forward ', but does NOT
95clear the fifo, annoyingly!
96
97Its also possible but inconclusive that the chirp table was changed.
98The LPC tables between the 5220 and 5220C are MOSTLY the same of not
99completely so, but as mentioned above the energy table has some sort of
100difference.
101
102
103As for which games used which chips, from the TMS5220 wikipedia page:
104
105TMS5200 AKA TMC0285: (1981 to 1983ish when supplies ran low)
106    Arcade: Zaccaria's 'money money' and 'jack rabbit'; Bally/Midway's
107'Discs of Tron' (all environmental cabs and a few upright cabs; the code
108exists on all versions for the speech though, and upright cabs can be
109upgraded to add it by hacking on a 'Squawk & Talk' pinball speech board
110(which is also TMS5200 based) with a few modded components)
111    Pinball: All Bally/Midway machines which uses the 'Squawk & Talk' board.
112    Home computer: TI 99/4 PHP1500 Speech module (along with two VSM
113serial chips); Street Electronics Corp.'s Apple II 'Echo 2' Speech
114synthesizer (early cards only)
115
116TMS5220: (mostly on things made between 1982 and 1984-1985 when supplies
117ran low)
118    Arcade: Bally/Midway's 'NFL Football'; Atari's 'Star Wars',
119'Firefox', 'Return of the Jedi', 'Road Runner', 'The Empire Strikes
120Back' (all verified with schematics); Venture Line's 'Looping' and 'Sky
121Bumper' (need verify for both); Olympia's 'Portraits' (need verify);
122Exidy's 'Victory' and 'Victor Banana' (need verify for both)
123    Pinball: Several (don't know names offhand, have not checked schematics)
124    Home computer: Street Electronics Corp.'s Apple II 'Echo 2' Speech
125synthesizer (later cards only); Texas Instruments' 'Speak and Learn'
126scanner wand unit.
127
128TMS5220C AKA TSP5220C: (on stuff made from 1984 to 1992 or so)
129    Arcade: Atari's 'Indiana Jones and the Temple of Doom', '720',
130'Gauntlet', 'Gauntlet II', 'A.P.B.', 'Paperboy', 'RoadBlasters',
131'Vindicators Pt II'(verify?), and 'Escape from the Planet of the Robot
132Monsters' (all verified except for vindicators pt 2)
133    Pinball: Several (less common than the tms5220? (not sure about
134this), mostly on later pinballs with LPC speech)
135    Home computer: Street Electronics Corp.'s 'ECHO' parallel/hobbyist
136module (6511 based), IBM PS/2 Speech adapter (parallel port connection
137device), PES Speech adapter (serial port connection)
138
139
41140***********************************************************************************************/
42141
43142#include "sndintrf.h"
r5891r5892
45144#include "tms5220.h"
46145
47146
48#define DEBUG_5220         0
147#define VERBOSE (0)
148#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
49149
50150#define MAX_SAMPLE_CHUNK   512
151#define FIFO_SIZE 16
51152
52153
53154enum _tms5220_variant
54155{
55   variant_tms5220,   /* TMS5220_IS_TMS5220, TMS5220_IS_TMS5220C,  TMS5220_IS_TSP5220C */
156   variant_tms5220c,   /* TMS5220_IS_TMS5220C  TMS5220_IS_TSP5220C */
157   variant_tms5220,   /* TMS5220_IS_TMS5220 */
56158   variant_tmc0285      /* TMS5220_IS_TMS5200, TMS5220_IS_CD2501 */
57159};
58160typedef enum _tms5220_variant tms5220_variant;
r5891r5892
73175typedef struct _tms5220_state tms5220_state;
74176struct _tms5220_state
75177{
178   /* callbacks */
179   devcb_resolved_write_line   irq_func;
180
76181   /* these contain data that describes the 128-bit data FIFO */
77   #define FIFO_SIZE 16
78182   UINT8 fifo[FIFO_SIZE];
79183   UINT8 fifo_head;
80184   UINT8 fifo_tail;
r5891r5892
99203   UINT8 buffer_empty;      /* FIFO is empty*/
100204   UINT8 irq_pin;         /* state of the IRQ pin (output) */
101205
102   void (*irq_func)(const device_config *device, int state); /* called when the state of the IRQ pin changes */
103
104
105206   /* these contain data describing the current and previous voice frames */
106207   UINT16 old_energy;
107208   UINT16 old_pitch;
r5891r5892
140241   UINT8 data_register;            /* data register, used by read command */
141242   UINT8 RDB_flag;               /* whether we should read data register or status register */
142243
244   /* io_ready: page 3 of the datasheet specifies that READY will be asserted until
245     * data is available or processed by the system.
246     */
247
248   UINT8 io_ready;
249
250   /* flag for "true" timing involving rs/ws */
251
252   UINT8 true_timing;
253
254   /* rsws - state, rs bit 1, ws bit 0 */
255   UINT8 rs_ws;
256   UINT8 read_latch;
257   UINT8 write_latch;
258
143259   /* flag for variant tmc0285/tms5200 emulation */
144260   /* The TMC0285 AKA TMS5200 is an earlier variant of the TMS5220 used in
145261       the early releases of the Speech Module for the TI-99/4(a) computer,
r5891r5892
243359   state_save_register_device_item(tms->device, 0, tms->data_register);
244360   state_save_register_device_item(tms->device, 0, tms->RDB_flag);
245361   state_save_register_device_item(tms->device, 0, tms->digital_select);
362
363   state_save_register_device_item(tms->device, 0, tms->io_ready);
246364}
247365
248366
r5891r5892
265383      if (tms->speak_external)
266384         tms->buffer_empty = 0;
267385
268        if (DEBUG_5220) logerror("Added byte to FIFO (size=%2d)\n", tms->fifo_count);
386        LOG(("Added byte to FIFO (size=%2d)\n", tms->fifo_count));
269387    }
270388    else
271389    {
272        if (DEBUG_5220) logerror("Ran out of room in the FIFO!\n");
390        LOG(("Ran out of room in the FIFO!\n"));
273391    }
274392
275393    /* update the buffer low state */
r5891r5892
317435      /* clear the interrupt pin */
318436      set_interrupt_state(tms, 0);
319437
320      if (DEBUG_5220) logerror("Status read: TS=%d BL=%d BE=%d\n", tms->talk_status, tms->buffer_low, tms->buffer_empty);
438      LOG(("Status read: TS=%d BL=%d BE=%d\n", tms->talk_status, tms->buffer_low, tms->buffer_empty));
321439
322440      return (tms->talk_status << 7) | (tms->buffer_low << 6) | (tms->buffer_empty << 5);
323441   }
r5891r5892
333451
334452static int tms5220_ready_read(tms5220_state *tms)
335453{
336    return (tms->fifo_count < FIFO_SIZE-1);
454   LOG(("io_ready %d\n", tms->io_ready));
455    return (tms->fifo_count < FIFO_SIZE-1) && tms->io_ready;
337456}
338457
339458
r5891r5892
762881         break;
763882
764883      case 0x30 : /* read and branch */
765         if (DEBUG_5220) logerror("read and branch command received\n");
884         LOG(("read and branch command received\n"));
766885         tms->RDB_flag = FALSE;
767886         if (tms->intf->read_and_branch)
768887            (*tms->intf->read_and_branch)(tms->device);
r5891r5892
8931012//  WARNING: This code below breaks Victory's power-on test! If you change it
8941013//  make sure you test Victory.
8951014//  {
896//      if (DEBUG_5220) logerror("Buffer Empty set - Last frame stop frame\n");
1015//      LOG(("Buffer Empty set - Last frame stop frame\n");
8971016
8981017//      tms->buffer_empty = 1;
8991018//      return 1;
r5891r5892
9161035   /* if the index is 0 or 15, we're done */
9171036   if (indx == 0 || indx == 15)
9181037   {
919      if (DEBUG_5220) logerror("  (4-bit energy=%d frame)\n",tms->new_energy);
1038      LOG(("  (4-bit energy=%d frame)\n",tms->new_energy));
9201039
9211040      /* clear tms->fifo if stop frame encountered */
9221041      if (indx == 15)
r5891r5892
9531072        for (i = 0; i < 10; i++)
9541073            tms->new_k[i] = tms->old_k[i];
9551074
956        if (DEBUG_5220) logerror("  (11-bit energy=%d pitch=%d rep=%d frame)\n", tms->new_energy, tms->new_pitch, rep_flag);
1075        LOG(("  (11-bit energy=%d pitch=%d rep=%d frame)\n", tms->new_energy, tms->new_pitch, rep_flag));
9571076        goto done;
9581077    }
9591078
r5891r5892
9751094      else
9761095         tms->new_k[3] = k4table[extract_bits(tms, 4)];
9771096
978        if (DEBUG_5220) logerror("  (29-bit energy=%d pitch=%d rep=%d 4K frame)\n", tms->new_energy, tms->new_pitch, rep_flag);
1097        LOG(("  (29-bit energy=%d pitch=%d rep=%d 4K frame)\n", tms->new_energy, tms->new_pitch, rep_flag));
9791098        goto done;
9801099    }
9811100
r5891r5892
10011120    tms->new_k[8] = k9table[extract_bits(tms, 3)];
10021121    tms->new_k[9] = k10table[extract_bits(tms, 3)];
10031122
1004    if (DEBUG_5220) logerror("  (50-bit energy=%d pitch=%d rep=%d 10K frame)\n", tms->new_energy, tms->new_pitch, rep_flag);
1123    LOG(("  (50-bit energy=%d pitch=%d rep=%d 10K frame)\n", tms->new_energy, tms->new_pitch, rep_flag));
10051124
10061125done:
1007   if (DEBUG_5220)
1008   {
1009      if (tms->speak_external)
1010         logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", bits);
1011      else
1012         logerror("Parsed a frame successfully in ROM\n");
1013   }
1126   if (tms->speak_external)
1127      LOG(("Parsed a frame successfully in FIFO - %d bits remaining\n", bits));
1128   else
1129      LOG(("Parsed a frame successfully in ROM\n"));
10141130
10151131   if (the_first_frame)
10161132   {
r5891r5892
10271143
10281144ranout:
10291145
1030    if (DEBUG_5220) logerror("Ran out of bits on a parse!\n");
1146    LOG(("Ran out of bits on a parse!\n"));
10311147
10321148    /* this is an error condition; mark the buffer empty and turn off speaking */
10331149    tms->buffer_empty = 1;
r5891r5892
10591175            set_interrupt_state(tms, 1);
10601176        tms->buffer_low = 1;
10611177
1062        if (DEBUG_5220) logerror("Buffer low set\n");
1178        LOG(("Buffer low set\n"));
10631179    }
10641180
10651181    /* did we just become full? */
r5891r5892
10671183    {
10681184        tms->buffer_low = 0;
10691185
1070        if (DEBUG_5220) logerror("Buffer low cleared\n");
1186        LOG(("Buffer low cleared\n"));
10711187    }
10721188}
10731189
r5891r5892
10811197
10821198static void set_interrupt_state(tms5220_state *tms, int state)
10831199{
1084    if (tms->intf->irq && state != tms->irq_pin)
1085       tms->intf->irq(tms->device, state);
1200    if (tms->irq_func.write && state != tms->irq_pin)
1201       devcb_call_write_line(&tms->irq_func, !state);
10861202    tms->irq_pin = state;
10871203}
10881204
r5891r5892
10951211
10961212static DEVICE_START( tms5220 )
10971213{
1098   static const tms5220_interface dummy = { 0 };
1214   static const tms5220_interface dummy = { DEVCB_NULL };
10991215   tms5220_state *tms = get_safe_token(device);
11001216
11011217   /* set the interface and device */
r5891r5892
11031219   tms->device = device;
11041220   tms->clock = device->clock;
11051221
1222   /* resolve */
1223
1224   devcb_resolve_write_line(&tms->irq_func, &tms->intf->irq_func, device);
1225
11061226   /* initialize a stream */
11071227   tms->stream = stream_create(device, 0, 1, device->clock / 80, tms, tms5220_update);
11081228
1229   /* not during reset which is called frm within a write! */
1230   tms->io_ready = 1;
1231   tms->true_timing = 0;
1232
1233   tms->variant = variant_tms5220;
11091234   register_for_save_states(tms);
11101235}
11111236
1237static DEVICE_START( tms5220c )
1238{
1239   tms5220_state *tms = get_safe_token(device);
1240   DEVICE_START_CALL( tms5220 );
1241   tms->variant = variant_tms5220c;
1242}
11121243
11131244static DEVICE_START( tmc0285 )
11141245{
r5891r5892
11371268   /* initialize the chip state */
11381269   /* Note that we do not actually clear IRQ on start-up : IRQ is even raised if tms->buffer_empty or tms->buffer_low are 0 */
11391270   tms->tms5220_speaking = tms->speak_external = tms->talk_status = tms->first_frame = tms->last_frame = tms->irq_pin = 0;
1140   if (tms->intf->irq) tms->intf->irq(tms->device, 0);
1271   set_interrupt_state(tms, 0);
11411272   tms->buffer_empty = tms->buffer_low = 1;
11421273
11431274   tms->RDB_flag = FALSE;
r5891r5892
11621293   tms->schedule_dummy_read = TRUE;
11631294}
11641295
1296/**********************************************************************************************
11651297
1298     True timing
11661299
1300***********************************************************************************************/
1301
1302TIMER_CALLBACK( io_ready_cb )
1303{
1304   tms5220_state *tms = (tms5220_state *) ptr;
1305   if (param)
1306   {
1307      switch (tms->rs_ws)
1308      {
1309      case 0x02:
1310         /* Write */
1311          /* bring up to date first */
1312         LOG(("Service write %02x\n", tms->write_latch));
1313          stream_update(tms->stream);
1314          tms5220_data_write(tms, tms->write_latch);
1315          break;
1316      case 0x01:
1317         /* Read */
1318          /* bring up to date first */
1319          stream_update(tms->stream);
1320          tms->read_latch = tms5220_status_read(tms);
1321         break;
1322      case 0x03:
1323         /* High Impedance */
1324      case 0x00:
1325         /* illegal */
1326         break;
1327      }
1328   }
1329   tms->io_ready = param;
1330}
1331
1332WRITE_LINE_DEVICE_HANDLER( tms5220_rsq_w )
1333{
1334   tms5220_state *tms = get_safe_token(device);
1335   UINT8 new;
1336
1337   tms->true_timing = 1;
1338   state &= 0x01;
1339
1340   new = (tms->rs_ws & 0x01) | (state<<1);
1341   if (new != tms->rs_ws)
1342   {
1343      tms->rs_ws = new;
1344      if (new == 0)
1345      {
1346         if (tms->variant == variant_tms5220c)
1347            device_reset(device);
1348         else
1349            /* illegal */
1350            LOG(("tms5220_rs_w: illegal\n"));
1351         return;
1352      }
1353      else if ( new == 3)
1354      {
1355         /* high impedance */
1356         tms->read_latch = 0xff;
1357         return;
1358      }
1359      if (state)
1360      {
1361         /* low to high */
1362      }
1363      else
1364      {
1365         /* high to low - schedule ready cycle*/
1366         LOG(("Schedule write ready\n"));
1367         tms->io_ready = 1;
1368         /* 100 nsec from data sheet */
1369         timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb);
1370         /* 25 usec in datasheet, but zaccaria won't work */
1371         timer_set(tms->device->machine, ATTOTIME_IN_USEC(100), tms, 1, io_ready_cb);
1372      }
1373   }
1374}
1375
1376WRITE_LINE_DEVICE_HANDLER( tms5220_wsq_w )
1377{
1378   tms5220_state *tms = get_safe_token(device);
1379   UINT8 new;
1380
1381   tms->true_timing = 1;
1382   state &= 0x01;
1383   new = (tms->rs_ws & 0x02) | (state<<0);
1384   if (new != tms->rs_ws)
1385   {
1386      tms->rs_ws = new;
1387      if (new == 0)
1388      {
1389         if (tms->variant == variant_tms5220c)
1390            device_reset(device);
1391         else
1392            /* illegal */
1393            LOG(("tms5220_ws_w: illegal\n"));
1394         return;
1395      }
1396      else if ( new == 3)
1397      {
1398         /* high impedance */
1399         tms->read_latch = 0xff;
1400         return;
1401      }
1402      if (state)
1403      {
1404         /* low to high  */
1405      }
1406      else
1407      {
1408         /* high to low - schedule ready cycle*/
1409         tms->io_ready = 1;
1410         timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb);
1411         timer_set(tms->device->machine, ATTOTIME_IN_USEC(25), tms, 1, io_ready_cb);
1412      }
1413   }
1414}
1415
11671416/**********************************************************************************************
11681417
11691418     tms5220_data_w -- write data to the sound chip
r5891r5892
11731422WRITE8_DEVICE_HANDLER( tms5220_data_w )
11741423{
11751424   tms5220_state *tms = get_safe_token(device);
1176    /* bring up to date first */
1177    stream_update(tms->stream);
1178    tms5220_data_write(tms, data);
1425
1426   if (!tms->true_timing)
1427   {
1428      /* bring up to date first */
1429       stream_update(tms->stream);
1430       tms5220_data_write(tms, data);
1431   }
1432   else
1433   {
1434      /* actually in a write ? */
1435      if (!(tms->rs_ws == 0x02))
1436         LOG(("tms5220_data_w: data written outside ws, status: %02x!\n", tms->rs_ws));
1437      tms->write_latch = data;
1438   }
11791439}
11801440
11811441
r5891r5892
11891449READ8_DEVICE_HANDLER( tms5220_status_r )
11901450{
11911451   tms5220_state *tms = get_safe_token(device);
1192    /* bring up to date first */
1193    stream_update(tms->stream);
1194    return tms5220_status_read(tms);
1452   if (!tms->true_timing)
1453   {
1454      /* bring up to date first */
1455       stream_update(tms->stream);
1456       return tms5220_status_read(tms);
1457   }
1458   else
1459   {
1460      /* actually in a read ? */
1461      if (tms->rs_ws == 0x01)
1462         return tms->read_latch;
1463      else
1464         LOG(("tms5220_status_r: data read outside rs!\n"));
1465      return 0xff;
1466   }
11951467}
11961468
11971469
r5891r5892
12021474
12031475***********************************************************************************************/
12041476
1205int tms5220_ready_r(const device_config *device)
1477READ_LINE_DEVICE_HANDLER( tms5220_readyq_r )
12061478{
12071479   tms5220_state *tms = get_safe_token(device);
12081480    /* bring up to date first */
12091481    stream_update(tms->stream);
1210    return tms5220_ready_read(tms);
1482    return !tms5220_ready_read(tms);
12111483}
12121484
12131485
r5891r5892
12371509
12381510***********************************************************************************************/
12391511
1240int tms5220_int_r(const device_config *device)
1512READ_LINE_DEVICE_HANDLER( tms5220_intq_r )
12411513{
12421514   tms5220_state *tms = get_safe_token(device);
12431515    /* bring up to date first */
12441516    stream_update(tms->stream);
1245    return tms5220_int_read(tms);
1517    return !tms5220_int_read(tms);
12461518}
12471519
12481520
r5891r5892
13041576#define DEVTEMPLATE_FAMILY            "TI Speech"
13051577#include "devtempl.h"
13061578
1579#define DEVTEMPLATE_DERIVED_ID(p,s)      p##tms5220c##s
1580#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1581#define DEVTEMPLATE_DERIVED_NAME      "TMS5220C"
1582#include "devtempl.h"
1583
13071584#define DEVTEMPLATE_DERIVED_ID(p,s)      p##tmc0285##s
13081585#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
13091586#define DEVTEMPLATE_DERIVED_NAME      "TMC0285"
src/emu/sound/tms5220.h
r5891r5892
33#ifndef __TMS5220_H__
44#define __TMS5220_H__
55
6#include "devcb.h"
7
68/* clock rate = 80 * output sample rate,     */
79/* usually 640000 for 8000 Hz sample rate or */
810/* usually 800000 for 10000 Hz sample rate.  */
r5891r5892
1012typedef struct _tms5220_interface tms5220_interface;
1113struct _tms5220_interface
1214{
13   void (*irq)(const device_config *device, int state);      /* IRQ callback function */
15   devcb_write_line irq_func;      /* IRQ callback function */
1416
1517   int (*read)(const device_config *device, int count);         /* speech ROM read callback */
1618   void (*load_address)(const device_config *device, int data);   /* speech ROM load address callback */
1719   void (*read_and_branch)(const device_config *device);      /* speech ROM read and branch callback */
1820};
1921
22/* Control lines - once written to will switch interface into
23 * "true" timing behaviour.
24 */
25
26/* all lines with suffix q are active low! */
27
28WRITE_LINE_DEVICE_HANDLER( tms5220_rsq_w );
29WRITE_LINE_DEVICE_HANDLER( tms5220_wsq_w );
30
2031WRITE8_DEVICE_HANDLER( tms5220_data_w );
2132READ8_DEVICE_HANDLER( tms5220_status_r );
22int tms5220_ready_r(const device_config *device);
33
34READ_LINE_DEVICE_HANDLER( tms5220_readyq_r );
35READ_LINE_DEVICE_HANDLER( tms5220_intq_r );
36
37
2338double tms5220_time_to_ready(const device_config *device);
24int tms5220_int_r(const device_config *device);
2539
2640void tms5220_set_frequency(const device_config *device, int frequency);
2741
42DEVICE_GET_INFO( tms5220c );
2843DEVICE_GET_INFO( tms5220 );
2944DEVICE_GET_INFO( tmc0285 );
3045DEVICE_GET_INFO( tms5200 );
3146
47#define SOUND_TMS5220C DEVICE_GET_INFO_NAME( tms5220c )
3248#define SOUND_TMS5220 DEVICE_GET_INFO_NAME( tms5220 )
3349#define SOUND_TMC0285 DEVICE_GET_INFO_NAME( tmc0285 )
3450#define SOUND_TMS5200 DEVICE_GET_INFO_NAME( tms5200 )
src/emu/drivers/xtal.h
r5891r5892
4141/*
4242    Name                = Frequency     Examples
4343    ------------------    ------------  ------------------------------------------------------------ */
44   XTAL_32_768kHz      = 327680,      /* 32.768kHz, used to drive RTC chips */
44   XTAL_32_768kHz      = 32768,      /* 32.768kHz, used to drive RTC chips */
4545   XTAL_1MHz          = 1000000,      /* Used to drive OKI M6295 chips */
4646   XTAL_1_75MHz      = 1750000,      /* RCA CDP1861 */
4747   XTAL_1_8432MHz      = 1843200,      /* Bondwell 12/14 */
src/mess/includes/aim65.h
r5891r5892
3232WRITE8_DEVICE_HANDLER(aim65_pia_a_w);
3333WRITE8_DEVICE_HANDLER(aim65_pia_b_w);
3434
35UINT8 aim65_riot_b_r(const device_config *device, UINT8 olddata);
36void aim65_riot_a_w(const device_config *device, UINT8 data, UINT8 olddata);
37void aim65_riot_irq(const device_config *device, int state);
35READ8_DEVICE_HANDLER(aim65_riot_b_r);
36WRITE8_DEVICE_HANDLER(aim65_riot_a_w);
37WRITE_LINE_DEVICE_HANDLER(aim65_riot_irq);
3838
3939MACHINE_START( aim65 );
4040
src/mess/machine/aim65.c
r5891r5892
127127******************************************************************************/
128128
129129
130UINT8 aim65_riot_b_r(const device_config *device, UINT8 olddata)
130READ8_DEVICE_HANDLER(aim65_riot_b_r)
131131{
132132   static const char *const keynames[] =
133133   {
r5891r5892
148148}
149149
150150
151void aim65_riot_a_w(const device_config *device, UINT8 data, UINT8 olddata)
151WRITE8_DEVICE_HANDLER(aim65_riot_a_w)
152152{
153153   riot_port_a = data;
154154}
155155
156156
157void aim65_riot_irq(const device_config *device, int state)
157WRITE_LINE_DEVICE_HANDLER(aim65_riot_irq)
158158{
159159   cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE);
160160}
src/mess/machine/a7800.c
r5891r5892
5151    6532 RIOT
5252***************************************************************************/
5353
54static UINT8 riot_joystick_r(const device_config *device, UINT8 olddata)
54static READ8_DEVICE_HANDLER( riot_joystick_r )
5555{
5656   return input_port_read(device->machine, "joysticks");
5757}
5858
59static UINT8 riot_console_button_r(const device_config *device, UINT8 olddata)
59static READ8_DEVICE_HANDLER( riot_console_button_r )
6060{
6161   return input_port_read(device->machine, "console_buttons");
6262}
6363
6464const riot6532_interface a7800_r6532_interface =
6565{
66   riot_joystick_r,
67   riot_console_button_r,
68   NULL,
69   NULL
66   DEVCB_HANDLER(riot_joystick_r),
67   DEVCB_HANDLER(riot_console_button_r),
68   DEVCB_NULL,
69   DEVCB_NULL
7070};
7171
7272
src/mess/machine/sym1.c
r5891r5892
7575}
7676
7777
78static UINT8 sym1_riot_a_r(const device_config *device, UINT8 olddata)
78static READ8_DEVICE_HANDLER(sym1_riot_a_r)
7979{
8080   int data = 0x7f;
8181
r5891r5892
9393}
9494
9595
96static UINT8 sym1_riot_b_r(const device_config *device, UINT8 olddata)
96static READ8_DEVICE_HANDLER(sym1_riot_b_r)
9797{
9898   int data = 0xff;
9999
r5891r5892
113113}
114114
115115
116static void sym1_riot_a_w(const device_config *device, UINT8 newdata, UINT8 data)
116static WRITE8_DEVICE_HANDLER(sym1_riot_a_w)
117117{
118118   logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( cputag_get_cpu(device->machine, "maincpu") ), data);
119119
r5891r5892
122122}
123123
124124
125static void sym1_riot_b_w(const device_config *device, UINT8 newdata, UINT8 data)
125static WRITE8_DEVICE_HANDLER(sym1_riot_b_w)
126126{
127127   logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( cputag_get_cpu(device->machine, "maincpu") ), data);
128128
r5891r5892
136136
137137const riot6532_interface sym1_r6532_interface =
138138{
139   sym1_riot_a_r,
140   sym1_riot_b_r,
141   sym1_riot_a_w,
142   sym1_riot_b_w
139   DEVCB_HANDLER(sym1_riot_a_r),
140   DEVCB_HANDLER(sym1_riot_b_r),
141   DEVCB_HANDLER(sym1_riot_a_w),
142   DEVCB_HANDLER(sym1_riot_b_w)
143143};
144144
145145
src/mess/machine/geneve.c
r5891r5892
321321
322322static void speech_kludge_callback(int dummy)
323323{
324   if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
324   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
325325   {
326326      /* Weirdly enough, we are always seeing some problems even though
327327      everything is working fine. */
r5891r5892
345345   there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
346346   case, we would need to store the value on the bus, which would be more
347347   complex. */
348   if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
348   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
349349   {
350350      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
351351      int cycles_to_ready = ceil(cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready));
src/mess/machine/ti99_4x.c
r5891r5892
881881
882882static void speech_kludge_callback(int dummy)
883883{
884   if (! tms5220_ready_r())
884   if (! tms5220_readyq_r())
885885   {
886886      /* Weirdly enough, we are always seeing some problems even though
887887      everything is working fine. */
r5891r5892
905905   there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
906906   case, we would need to store the value on the bus, which would be more
907907   complex. */
908   if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
908   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
909909   {
910910      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
911911      int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
r5891r5892
14091409               there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
14101410               case, we would need to store the value on the bus, which would be more
14111411               complex. */
1412               if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
1412               if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
14131413               {
14141414                  attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
14151415                  double d = ceil(cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready));
src/mess/machine/bbc.c
r5891r5892
12111211//void bbc_TMSint(int status)
12121212//{
12131213//   TMSint=(!status)&1;
1214//   TMSrdy=(!tms5220_ready_r())&1;
1214//   TMSrdy=(!tms5220_readyq_r())&1;
12151215//   via_0_portb_w(0,(0xf | input_port_read(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7)));
12161216//}
12171217
r5891r5892
12201220static READ8_DEVICE_HANDLER( bbcb_via_system_read_portb )
12211221{
12221222//   TMSint=(!tms5220_int_r())&1;
1223//   TMSrdy=(!tms5220_ready_r())&1;
1223//   TMSrdy=(!tms5220_readyq_r())&1;
12241224
12251225   //logerror("SYSTEM read portb %d\n",0xf | input_port(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7));
12261226
src/mess/mess.mak
r5891r5892
221221SOUNDS += SID8580
222222SOUNDS += SP0256
223223#SOUNDS += DIGITALKER
224SOUNDS += CDP1863
225SOUNDS += CDP1864
224226SOUNDS += SOCRATES
225227SOUNDS += TMC0285
226228SOUNDS += TMS5200
r5891r5892
230232#SOUNDS += TMC0281
231233#SOUNDS += TMS5100
232234#SOUNDS += TMS5110A
233SOUNDS += CDP1863
234SOUNDS += CDP1864
235235
236236
237237#-------------------------------------------------
r5891r5892
333333   $(MESSOBJ)/osi.a \
334334   $(MESSOBJ)/palm.a \
335335   $(MESSOBJ)/parker.a \
336   $(MESSOBJ)/pitronic.a \
337336   $(MESSOBJ)/pc.a \
338337   $(MESSOBJ)/pcm.a \
339338   $(MESSOBJ)/pcshare.a \
340339   $(MESSOBJ)/pdp1.a \
341340   $(MESSOBJ)/pel.a \
342341   $(MESSOBJ)/philips.a \
342   $(MESSOBJ)/pitronic.a \
343343   $(MESSOBJ)/poly88.a \
344344   $(MESSOBJ)/radio.a \
345345   $(MESSOBJ)/rca.a \
src/mess/drivers/ti99_8.c
r5891r5892
376376*/
377377static const tms5220_interface ti99_8_tms5220interface =
378378{
379   NULL,                  /* no IRQ callback */
379   DEVCB_NULL,               /* no IRQ callback */
380380   spchroms_read,            /* speech ROM read handler */
381381   spchroms_load_address,      /* speech ROM load address handler */
382382   spchroms_read_and_branch   /* speech ROM read and branch handler */
src/mess/drivers/aim65.c
r5891r5892
141141
142142static const riot6532_interface aim65_riot_interface =
143143{
144   NULL,
145   aim65_riot_b_r,
146   aim65_riot_a_w,
147   NULL,
148   aim65_riot_irq
144   DEVCB_NULL,
145   DEVCB_HANDLER(aim65_riot_b_r),
146   DEVCB_HANDLER(aim65_riot_a_w),
147   DEVCB_NULL,
148   DEVCB_LINE(aim65_riot_irq)
149149};
150150
151151/* system via interface */
src/mess/drivers/a2600.c
r5891r5892
11481148   AM_RANGE(0x1000, 0x1FFF)                   AM_ROMBANK(1)
11491149ADDRESS_MAP_END
11501150
1151static void switch_A_w(const device_config *device, UINT8 olddata, UINT8 data)
1151static WRITE8_DEVICE_HANDLER(switch_A_w)
11521152{
11531153   running_machine *machine = device->machine;
11541154
r5891r5892
11701170   }
11711171}
11721172
1173static UINT8 switch_A_r(const device_config *device, UINT8 data)
1173static READ8_DEVICE_HANDLER( switch_A_r )
11741174{
11751175   static const UINT8 driving_lookup[4] = { 0x00, 0x02, 0x03, 0x01 };
11761176   running_machine *machine = device->machine;
r5891r5892
12231223   return val;
12241224}
12251225
1226static void switch_B_w(const device_config *device, UINT8 newdata, UINT8 olddata)
1226static WRITE8_DEVICE_HANDLER(switch_B_w )
12271227{
12281228}
12291229
1230static void irq_callback(const device_config *device, int state)
1230static WRITE_LINE_DEVICE_HANDLER( irq_callback )
12311231{
12321232}
12331233
1234static UINT8 riot_input_port_8_r(const device_config *device, UINT8 olddata)
1234static READ8_DEVICE_HANDLER( riot_input_port_8_r )
12351235{
12361236   return input_port_read(device->machine, "SWB");
12371237}
12381238
12391239static const riot6532_interface r6532_interface =
12401240{
1241   switch_A_r,
1242   riot_input_port_8_r,
1243   switch_A_w,
1244   switch_B_w,
1245   irq_callback
1241   DEVCB_HANDLER(switch_A_r),
1242   DEVCB_HANDLER(riot_input_port_8_r),
1243   DEVCB_HANDLER(switch_A_w),
1244   DEVCB_HANDLER(switch_B_w),
1245   DEVCB_LINE(irq_callback)
12461246};
12471247
12481248
src/mess/drivers/osi.c
r5891r5892
202202static DISCRETE_SOUND_START( osi600_discrete_interface )
203203   DISCRETE_INPUT_DATA(NODE_01)
204204
205   DISCRETE_DAC_R1(NODE_02, 1, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac)
205   DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac)
206206   DISCRETE_CRFILTER(NODE_03, 1, NODE_02, 1.0/(1.0/RES_K(1)+1.0/180+1.0/180+1.0/180+1.0/180), CAP_U(0.1))
207207   DISCRETE_OUTPUT(NODE_03, 100)
208208   DISCRETE_GAIN(NODE_04, NODE_03, 32767.0/5)
r5891r5892
223223   DISCRETE_INPUT_DATA(NODE_01)
224224   DISCRETE_INPUT_LOGIC(NODE_10)
225225
226   DISCRETE_DAC_R1(NODE_02, 1, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac)
226   DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac)
227227   DISCRETE_ONOFF(NODE_03, NODE_10, NODE_02)
228228   DISCRETE_OUTPUT(NODE_03, 100)
229229DISCRETE_SOUND_END
src/mess/drivers/junior.c
r5891r5892
8080
8181
8282
83static UINT8 junior_riot_a_r(const device_config *device, UINT8 olddata)
83static READ8_DEVICE_HANDLER(junior_riot_a_r)
8484{
85      UINT8   data = 0xff;
85   UINT8   data = 0xff;
8686
8787   switch( ( junior_port_b >> 1 ) & 0x0f )
8888   {
r5891r5892
101101}
102102
103103
104static UINT8 junior_riot_b_r(const device_config *device, UINT8 olddata)
104static READ8_DEVICE_HANDLER(junior_riot_b_r)
105105{
106106   if ( riot6532_portb_out_get(device) & 0x20 )
107107      return 0xFF;
r5891r5892
111111}
112112
113113
114void junior_riot_a_w(const device_config *device, UINT8 newdata, UINT8 olddata)
114WRITE8_DEVICE_HANDLER(junior_riot_a_w)
115115{
116116   UINT8 idx = ( junior_port_b >> 1 ) & 0x0f;
117117
118   junior_port_a = newdata;
118   junior_port_a = data;
119119
120120   if ((idx >= 4 && idx < 10) & ( junior_port_a != 0xff ))
121121   {
r5891r5892
125125}
126126
127127
128void junior_riot_b_w(const device_config *device, UINT8 newdata, UINT8 olddata)
128WRITE8_DEVICE_HANDLER(junior_riot_b_w)
129129{
130   UINT8 newdata = data;
130131   UINT8 idx = ( newdata >> 1 ) & 0x0f;
131132
132133   junior_port_b = newdata;
r5891r5892
139140}
140141
141142
142void junior_riot_irq(const device_config *device, int state)
143static WRITE_LINE_DEVICE_HANDLER( junior_riot_irq )
143144{
144145   cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE);
145146}
r5891r5892
147148
148149static const riot6532_interface junior_riot_interface =
149150{
150   junior_riot_a_r,
151   junior_riot_b_r,
152   junior_riot_a_w,
153   junior_riot_b_w,
154   junior_riot_irq
151   DEVCB_HANDLER(junior_riot_a_r),
152   DEVCB_HANDLER(junior_riot_b_r),
153   DEVCB_HANDLER(junior_riot_a_w),
154   DEVCB_HANDLER(junior_riot_b_w),
155   DEVCB_LINE(junior_riot_irq)
155156};
156157
157158
src/mess/drivers/geneve.c
r5891r5892
438438
439439static const tms5220_interface geneve_tms5220interface =
440440{
441   NULL,                  /* no IRQ callback */
441   DEVCB_NULL,               /* no IRQ callback */
442442#if 1
443443   spchroms_read,            /* speech ROM read handler */
444444   spchroms_load_address,      /* speech ROM load address handler */
src/mess/drivers/beta.c
r5891r5892
8686   }
8787}
8888
89static UINT8 beta_riot_a_r(const device_config *device, UINT8 olddata)
89static READ8_DEVICE_HANDLER(beta_riot_a_r)
9090{
9191   /*
9292
r5891r5892
124124   return data;
125125}
126126
127static void beta_riot_a_w(const device_config *device, UINT8 data, UINT8 olddata)
127static WRITE8_DEVICE_HANDLER(beta_riot_a_w)
128128{
129129   /*
130130
r5891r5892
153153   state->eprom_data = data;
154154}
155155
156static UINT8 beta_riot_b_r(const device_config *device, UINT8 olddata)
156static READ8_DEVICE_HANDLER(beta_riot_b_r)
157157{
158158   return 0;
159159}
160160
161static void beta_riot_b_w(const device_config *device, UINT8 data, UINT8 olddata)
161static WRITE8_DEVICE_HANDLER(beta_riot_b_w)
162162{
163   UINT8 olddata = data; /* HACKHACK - to get 0.134u1 to compile */
163164   /*
164165
165166      bit      description
r5891r5892
211212   }
212213}
213214
214static void beta_riot_irq(const device_config *device, int state)
215static WRITE_LINE_DEVICE_HANDLER( beta_riot_irq )
215216{
216217   cputag_set_input_line(device->machine, M6502_TAG, M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE);
217218}
218219
219220static const riot6532_interface beta_riot_interface =
220221{
221   beta_riot_a_r,
222   beta_riot_b_r,
223   beta_riot_a_w,
224   beta_riot_b_w,
225   beta_riot_irq
222   DEVCB_HANDLER(beta_riot_a_r),
223   DEVCB_HANDLER(beta_riot_b_r),
224   DEVCB_HANDLER(beta_riot_a_w),
225   DEVCB_HANDLER(beta_riot_b_w),
226   DEVCB_LINE(beta_riot_irq)
226227};
227228
228229/* Quickload */
src/mess/drivers/ti99_4p.c
r5891r5892
217217
218218static const tms5220_interface ti99_4p_tms5220interface =
219219{
220   NULL,                  /* no IRQ callback */
220   DEVCB_NULL,               /* no IRQ callback */
221221#if 1
222222   spchroms_read,            /* speech ROM read handler */
223223   spchroms_load_address,      /* speech ROM load address handler */
src/mess/drivers/ti99_4x.c
r5891r5892
502502*/
503503static const tms5220_interface ti99_4x_tms5220interface =
504504{
505   NULL,                  /* no IRQ callback */
505   DEVCB_NULL,                  /* no IRQ callback */
506506   spchroms_read,            /* speech ROM read handler */
507507   spchroms_load_address,      /* speech ROM load address handler */
508508   spchroms_read_and_branch   /* speech ROM read and branch handler */
docs/messnew.txt
r5891r5892
4949
5050Source Changes:
5151----------------
52- The core is based on MAME 0.134u1.  This incorporates all features of the
53  update to this core.  [MAME team]
54
5255- Moved implementation to device [Miodrag Milanovic]
5356
5457- Floppy support for TD0, IMD and CQM [Miodrag Milanovic]
5558
5659
60
57610.134
5862
5963New System Drivers Supported (in no particular order):
makefile
r5891r5892
509509
510510maketree: $(sort $(OBJDIRS))
511511
512clean:
512clean: $(OSDCLEAN)
513513   @echo Deleting object tree $(OBJ)...
514514   $(RM) -r $(OBJ)
515515   @echo Deleting $(EMULATOR)...
r5891r5892
520520   @echo Deleting $(FULLNAME).map...
521521   $(RM) $(FULLNAME).map
522522endif
523ifdef MSVC_BUILD
524   @echo Deleting Visual Studio specific files...
525   $(RM) *.pdb
526   $(RM) *.lib
527   $(RM) *.exp
528endif
529523
530524
531525

Previous 15994 Revisions Next


© 1998-2018 The MESS Team