diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c index 364716bc97a..69eb5bc009f 100644 --- a/src/mame/drivers/bfcobra.c +++ b/src/mame/drivers/bfcobra.c @@ -1360,7 +1360,6 @@ static WRITE8_HANDLER( meter_w ) { int i; int changed = meter_latch ^ data; - UINT64 cycles = downcast(space->cpu)->total_cycles(); meter_latch = data; @@ -1372,7 +1371,7 @@ static WRITE8_HANDLER( meter_w ) { if (changed & (1 << i)) { - Mechmtr_update(i, cycles, data & (1 << i) ); + MechMtr_update(i, data & (1 << i) ); generic_pulse_irq_line(space->cpu, M6809_FIRQ_LINE); } } diff --git a/src/mame/drivers/bfm_sc1.c b/src/mame/drivers/bfm_sc1.c index 83456eed071..3940f8bf08e 100644 --- a/src/mame/drivers/bfm_sc1.c +++ b/src/mame/drivers/bfm_sc1.c @@ -269,7 +269,6 @@ static WRITE8_HANDLER( mmtr_w ) else { int changed = mmtr_latch ^ data; - UINT64 cycles = downcast(space->cpu)->total_cycles(); mmtr_latch = data; @@ -277,7 +276,7 @@ static WRITE8_HANDLER( mmtr_w ) { if ( changed & (1 << i) ) { - Mechmtr_update(i, cycles, data & (1 << i) ); + MechMtr_update(i, data & (1 << i) ); generic_pulse_irq_line(space->machine->device("maincpu"), M6809_FIRQ_LINE); } } @@ -1362,7 +1361,7 @@ static DRIVER_INIT(toppoker) { sc1_common_init(machine,3,1); adder2_decode_char_roms(machine); // decode GFX roms - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); } @@ -1370,7 +1369,7 @@ static DRIVER_INIT(toppoker) static DRIVER_INIT(lotse) { sc1_common_init(machine,6,1); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); BFM_BD1_init(1); @@ -1381,7 +1380,7 @@ static DRIVER_INIT(lotse) static DRIVER_INIT(rou029) { sc1_common_init(machine,6,0); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); } @@ -1391,7 +1390,7 @@ static DRIVER_INIT(rou029) static DRIVER_INIT(clatt) { sc1_common_init(machine,6,1); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c index 6034d6ae085..d1f87d62886 100644 --- a/src/mame/drivers/bfm_sc2.c +++ b/src/mame/drivers/bfm_sc2.c @@ -183,10 +183,6 @@ static int get_scorpion2_uart_status(void); // retrieve status of uart on scorp static int read_e2ram(void); static void e2ram_reset(void); -// global vars //////////////////////////////////////////////////////////// - -static int sc2gui_update_mmtr; // bit pattern which mechanical meter needs updating - // local vars ///////////////////////////////////////////////////////////// static UINT8 key[16]; // security device on gamecard (video games only) @@ -321,7 +317,6 @@ static void on_scorpion2_reset(running_machine *machine) hopper_running = 0; // for video games hopper_coin_sense = 0; - sc2gui_update_mmtr= 0xFF; slide_states[0] = 0; slide_states[1] = 0; @@ -583,7 +578,6 @@ static WRITE8_HANDLER( mmtr_w ) { int i; int changed = mmtr_latch ^ data; - UINT64 cycles = downcast(space->cpu)->total_cycles(); mmtr_latch = data; @@ -591,10 +585,7 @@ static WRITE8_HANDLER( mmtr_w ) { if ( changed & (1 << i) ) { - if ( Mechmtr_update(i, cycles, data & (1 << i) ) ) - { - sc2gui_update_mmtr |= (1 << i); - } + MechMtr_update(i, data & (1 << i) ); } } if ( data & 0x1F ) cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE ); @@ -2251,7 +2242,7 @@ static DRIVER_INIT (quintoon) { sc2_common_init(machine, 1); adder2_decode_char_roms(machine); - Mechmtr_init(8); // setup mech meters + MechMtr_config(machine,8); // setup mech meters has_hopper = 0; @@ -4005,7 +3996,7 @@ static void sc2awp_common_init(running_machine *machine,int reels, int decrypt) static DRIVER_INIT (bbrkfst) { sc2awp_common_init(machine,5, 1); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); BFM_BD1_init(1); @@ -4027,7 +4018,7 @@ static DRIVER_INIT (bbrkfst) static DRIVER_INIT (drwho) { sc2awp_common_init(machine,4, 1); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); BFM_BD1_init(1); @@ -4047,7 +4038,7 @@ static DRIVER_INIT (drwho) static DRIVER_INIT (drwhon) { sc2awp_common_init(machine,4, 0); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); BFM_BD1_init(1); @@ -4068,7 +4059,7 @@ static DRIVER_INIT (drwhon) static DRIVER_INIT (focus) { sc2awp_common_init(machine,6, 1); - Mechmtr_init(5); + MechMtr_config(machine,5); BFM_BD1_init(0); } @@ -4077,7 +4068,7 @@ static DRIVER_INIT (cpeno1) { sc2awp_common_init(machine,6, 1); - Mechmtr_init(5); + MechMtr_config(machine,5); Scorpion2_SetSwitchState(3,3,1); /* 5p play */ Scorpion2_SetSwitchState(3,4,1); /* 20p play */ @@ -4120,7 +4111,7 @@ static DRIVER_INIT (cpeno1) static DRIVER_INIT (bfmcgslm) { sc2awp_common_init(machine,6, 1); - Mechmtr_init(8); + MechMtr_config(machine,8); BFM_BD1_init(0); has_hopper = 0; } @@ -4128,7 +4119,7 @@ static DRIVER_INIT (bfmcgslm) static DRIVER_INIT (luvjub) { sc2awp_common_init(machine,6, 1); - Mechmtr_init(8); + MechMtr_config(machine,8); has_hopper = 0; Scorpion2_SetSwitchState(3,0,1); diff --git a/src/mame/drivers/bfmsys85.c b/src/mame/drivers/bfmsys85.c index 2562763faac..9d5930e5c51 100644 --- a/src/mame/drivers/bfmsys85.c +++ b/src/mame/drivers/bfmsys85.c @@ -220,12 +220,11 @@ static WRITE8_HANDLER( mmtr_w ) { int i; int changed = mmtr_latch ^ data; - UINT64 cycles = downcast(space->cpu)->total_cycles(); mmtr_latch = data; for (i=0; i<8; i++) - if ( changed & (1 << i) ) Mechmtr_update(i, cycles, data & (1 << i) ); + if ( changed & (1 << i) ) MechMtr_update(i, data & (1 << i) ); if ( data ) generic_pulse_irq_line(space->machine->device("maincpu"), M6809_FIRQ_LINE); } diff --git a/src/mame/drivers/jpmimpct.c b/src/mame/drivers/jpmimpct.c index 04d0cefe26c..2a7e91ca84b 100644 --- a/src/mame/drivers/jpmimpct.c +++ b/src/mame/drivers/jpmimpct.c @@ -561,7 +561,6 @@ static READ16_HANDLER( jpmio_r ) static WRITE16_HANDLER( jpmio_w ) { - UINT64 cycles = space->machine->firstcpu->total_cycles(); switch (offset) { case 0x02: @@ -589,7 +588,7 @@ static WRITE16_HANDLER( jpmio_w ) } else // slide = 0; - Mechmtr_update(0, cycles, data >> 10); + MechMtr_update(0, data >> 10); duart_1.IP &= ~0x10; break; } @@ -1206,7 +1205,6 @@ static READ16_HANDLER( optos_r ) static WRITE16_HANDLER( jpmioawp_w ) { int i; - UINT64 cycles = space->machine->firstcpu->total_cycles(); switch (offset) { case 0x00: @@ -1248,7 +1246,7 @@ static WRITE16_HANDLER( jpmioawp_w ) } else // slide = 0; - Mechmtr_update(0, cycles, data >> 10); + MechMtr_update(0, data >> 10); if ( data ) { duart_1.IP &= ~0x10; diff --git a/src/mame/drivers/maygay1b.c b/src/mame/drivers/maygay1b.c index 406eff1fc1f..bcb8c81d3aa 100644 --- a/src/mame/drivers/maygay1b.c +++ b/src/mame/drivers/maygay1b.c @@ -645,7 +645,7 @@ static MACHINE_START( m1 ) int i; // setup 8 mechanical meters //////////////////////////////////////////// - Mechmtr_init(8); + MechMtr_config(machine,8); // setup 6 default 96 half step reels /////////////////////////////////// for ( i = 0; i < 6; i++ ) @@ -706,10 +706,9 @@ static UINT8 m1_duart_r (device_t *device) static WRITE8_DEVICE_HANDLER( m1_meter_w ) { int i; - UINT64 cycles = device->machine->device("maincpu")->total_cycles(); for (i=0; i<8; i++) - if ( data & (1 << i) ) Mechmtr_update(i, cycles, data & (1 << i) ); + if ( data & (1 << i) ) MechMtr_update(i, data & (1 << i) ); } static WRITE8_HANDLER( m1_latch_w ) diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c index e2d4d3a5c72..b713798b4ad 100644 --- a/src/mame/drivers/mpu4.c +++ b/src/mame/drivers/mpu4.c @@ -4,6 +4,7 @@ This is the core driver, no video specific stuff should go in here. This driver holds all the mechanical games. + 01-2011: Adding the missing 'OKI' sound card, and documented it. 05-2009: Miscellaneous lamp fixes, based on data from FME Forever. 09-2007: Haze: Added Deal 'Em video support. 03-08-2007: J Wallace: Removed audio filter for now, since sound is more accurate without them. @@ -53,7 +54,7 @@ when the AY8913 was removed from the main board) -----------+---+-----------------+-------------------------------------------------------------------------- 0850 ? | W | ??????????????? | page latch (NV) -----------+---+-----------------+-------------------------------------------------------------------------- - 0880 |R/W| D D D D D D D D | PIA6821 on soundboard (Oki MSM6376@16MHz,(NV) + 0880 |R/W| D D D D D D D D | PIA6821 on soundboard (Oki MSM6376@16MHz) | | | port A = ?? | | | port B (882) | | | b7 = 0 if OKI busy @@ -66,7 +67,7 @@ when the AY8913 was removed from the main board) | | | b1 = ?? | | | b0 = ?? -----------+---+-----------------+-------------------------------------------------------------------------- - 08C0 | | | MC6840 on sound board(NV?) + 08C0 | | | MC6840 on sound board -----------+---+-----------------+-------------------------------------------------------------------------- 0900- |R/W| D D D D D D D D | MC6840 PTM IC2 @@ -198,6 +199,10 @@ IRQ line connected to CPU TODO: - Fix lamp timing, MAME doesn't update fast enough to see everything - Distinguish door switches using manual + - Complete stubs for hoppers (needs slightly better 68681 emulation, and new 'hoppers' device) + - Any reel using the remote meter drive (CB2) slips backwards due to timing mismatches, a better method + is needed to combine the data. This eventually leads to spin alarms i.e Flo's move in Great Escape + - Add a BwB game with characteriser. ***********************************************************************************************************/ #include "emu.h" #include "machine/6821pia.h" @@ -223,11 +228,13 @@ TODO: - Fix lamp timing, MAME doesn't update fast enough to see everything #define LOG_CHR_FULL(x) do { if (MPU4VERBOSE) logerror x; } while (0) #define LOG_IC3(x) do { if (MPU4VERBOSE) logerror x; } while (0) #define LOG_IC8(x) do { if (MPU4VERBOSE) logerror x; } while (0) +#define LOG_SS(x) do { if (1) logerror x; } while (0) #include "video/awpvid.h" //Fruit Machines Only #include "connect4.lh" #include "gamball.lh" #include "mpu4.lh" +#include "mpu4ext.lh" #define MPU4_MASTER_CLOCK (6880000) /* local vars */ @@ -239,6 +246,8 @@ static int ay8913_address; static int serial_data; static int signal_50hz; static int ic4_input_b; +static int aux1_input; +static int aux2_input; static int IC23G1; static int IC23G2A; static int IC23G2B; @@ -249,16 +258,13 @@ static int prot_col; static int lamp_col; static int reel_flag; static int ic23_active; -static int led_extend; +static int led_lamp; static int link7a_connected; -static int multiplex_smooth; static emu_timer *ic24_timer; static TIMER_CALLBACK( ic24_timeout ); -static int expansion_latch;// OKI MOD 4 and above only -static int global_volume;// OKI MOD 4 and above only - - +static int expansion_latch;// OKI MOD 4 and above only (PIA on Gamecard) +static int global_volume;// OKI MOD 4 and above only (PIA on Gamecard) /* 32 multiplexed inputs - but a further 8 possible per AUX. Two connectors 'orange' (sampled every 8ms) and 'black' (sampled every 16ms) Each connector carries two banks of eight inputs and two enable signals */ @@ -267,11 +273,47 @@ static UINT8 lamp_strobe,lamp_strobe2; static UINT8 lamp_data; static UINT8 ay_data; -static UINT8 MPU4_chr_data[72]; - -static UINT8 Lamps[128]; /* 128 multiplexed lamps */ +static UINT8 Lamps[224]; /* 128 multiplexed lamps + 96 extension */ static int optic_pattern; +static int active_reel; +static int remote_meter; +static UINT8 reel_mux_table[8]= {0,4,2,6,1,5,3,7};//include 7, although I don't think it's used +static UINT8 reel_mux_table7[8]= {3,1,5,6,4,2,0,7}; + +static int reel_mux; /* added support for up to 8 reels */ +#define STANDARD_REEL 0 /* As originally designed 3/4 reels*/ +#define FIVE_REEL_5TO8 1 /* Interfaces to meter port, allows some mechanical metering, but there is significant 'bounce' in the extra reel*/ +#define FIVE_REEL_8TO5 2 /* Mounted backwards for space reasons, but different board*/ +#define FIVE_REEL_3TO6 3 /* Connected to the centre of the meter connector, taking up meters 3 to 6 */ +#define SIX_REEL_1TO8 4 /* Two reels on the meter drives*/ +#define SIX_REEL_5TO8 5 /* Like FIVE_REEL_5TO8, but with an extra reel elsewhere*/ +#define SEVEN_REEL 6 /* Mainly club machines, significant reworking of reel hardware*/ + +static int lamp_extender;/* Plug in boards that add additional lamps and leds via the AUX ports. */ +static int last_b7; +static int last_latch; +#define NO_EXTENDER 0 /* As originally designed */ +#define SMALL_CARD 1 +#define LARGE_CARD_A 2 //96 Lamps +#define LARGE_CARD_B 3 // 96 Lamps, 16 LEDs - as used by BwB +#define LARGE_CARD_C 4 //Identical to B, no built in LED support + +static int lamp_sense; +static int card_live; + +static int led_extender; /* Plug in boards that add leds via the AUX ports. */ +#define CARD_A 1 +#define CARD_B 2 +#define CARD_C 3 + +static int hopper =0; +#define TUBES 0 +#define HOPPER_DUART_A 1 +#define HOPPER_DUART_B 2 +#define HOPPER_DUART_C 3 +#define HOPPER_NONDUART_A 4 +#define HOPPER_NONDUART_B 5 /* Lookup table for CHR data */ struct mpu4_chr_table @@ -301,7 +343,7 @@ with settings like this in the majority of cases. 8 display enables (pins 10 - 17) */ -static UINT8 led_segs[8]; +static UINT8 led_segs[40];//8 regular, up to 32 on extender cards /* Process lamp and LED data for output system */ @@ -313,19 +355,26 @@ static void mpu4_draw_led(UINT8 id, UINT8 value) static void draw_lamps(void) { - int i; + int i,j; for (i = 0; i < 8; i++) { output_set_lamp_value((8*input_strobe)+i, (Lamps[(8*input_strobe)+i])); output_set_lamp_value((8*input_strobe)+i+64, (Lamps[(8*input_strobe)+i+64])); } + if (lamp_extender) + { + for (j = 0; j < 6; j++) + { + output_set_lamp_value((6*input_strobe)+128+j, (Lamps[(6*input_strobe)+128+j])); + output_set_lamp_value((6*input_strobe)+176+j, (Lamps[(6*input_strobe)+176+j])); + } + } } - static void update_lamps(void) { - int i; + int i,j; for (i = 0; i < 8; i++) { @@ -333,9 +382,9 @@ static void update_lamps(void) Lamps[(8*input_strobe)+i+64] = (lamp_strobe2 & (1 << i)) != 0; } - if (led_extend) + if (led_lamp) { - /* Some games uses 'programmable' LED displays, built from light display lines. */ + /* Some games (like Connect 4) use 'programmable' LED displays, built from light display lines. */ UINT8 pled_segs[2] = {0,0}; static const int lamps1[8] = { 106, 107, 108, 109, 104, 105, 110, 133 }; @@ -351,16 +400,187 @@ static void update_lamps(void) mpu4_draw_led(9, pled_segs[1]); } - /* Lamp smoothing, this draws lamps only at the peaks of the AC power that would light them */ - if ((multiplex_smooth == (input_strobe - 1))||((multiplex_smooth == 7) && (input_strobe == 0))) + draw_lamps(); + mpu4_draw_led(input_strobe, led_segs[input_strobe]); + if (led_extender) { - draw_lamps(); - mpu4_draw_led(input_strobe, led_segs[input_strobe]); - multiplex_smooth = input_strobe; + for (j = 0; j < 5; j++) + { + mpu4_draw_led(((8*input_strobe)+8+j), led_segs[((8*input_strobe)+8+j)]); + } } - } +static void lamp_extend_small(int data) +{ + int lamp_strobe_ext,column,i; + column = data & 0x07; + + lamp_strobe_ext = 0x1f - ((data & 0xf8) >> 3); + if ( lamp_strobe_ext ) + { + for (i = 0; i < 5; i++) + { + Lamps[(5*column)+i+128] = (lamp_strobe_ext & (1 << i)) != 0; + } + } +} + +static void lamp_extend_largea(int data,int column,int active) +{ + int lampbase,i,byte7; + + lamp_sense = 0; + byte7 = data & 0x80; + if ( byte7 != last_b7 ) + { + if ( byte7 ) + { + lampbase = 128 + column * 8; + } + else + { + lampbase = 192 + column * 8; + } + if ( data & 0x3f ) + { + lamp_sense = 1; + } + if ( active ) + { + for (i = 0; i < 6; i++) + { + Lamps[(lampbase)+i] = (data & (1 << i)) != 0; + } + } + } + last_b7 = byte7; +} + +static void lamp_extend_largebc(int data,int column,int active) +{ + int lampbase,i,byte7; + + lamp_sense = 0; + byte7 = data & 0x80; + if ( byte7 != last_b7 ) + { + card_live = 1; + if ( byte7 ) + { + lampbase = 128 + column * 8; + } + else + { + lampbase = 192 + column * 8; + } + if ( data & 0x3f ) + { + lamp_sense = 1; + } + if ( active ) + { + for (i = 0; i < 6; i++) + { + Lamps[(lampbase)+i] = (data & (1 << i)) != 0; + } + } + last_b7 = byte7; + } + else + { + card_live = 0; + } +} + +static void led_write_latch(int latch, int data, int column) +{ + int diff; + + diff = (latch ^ last_latch) & latch; + column = 7 - column; + data = ~data;//inverted? + + if ( diff & 1 ) + { + led_segs[column] = data; + } + if ( diff & 2 ) + { + led_segs[8+column] = data; + } + if ( diff & 4 ) + { + led_segs[16+column] = data; + } + if ( diff & 8 ) + { + led_segs[24+column] = data; + } + if ( diff & 16 ) + { + led_segs[32+column] = data; + } + last_latch = diff; +} + + +static void update_meters(void) +{ + int meter; + int data = ((mmtr_data & 0x7f) | remote_meter); + switch (reel_mux) + { + case STANDARD_REEL: + // Change nothing + break; + case FIVE_REEL_5TO8: + stepper_update(4, (data >> 4)); + data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements + awp_draw_reel(4); + break; + case FIVE_REEL_8TO5: + stepper_update(4, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; + data = 0x00; //Strip all reel data from meter drives, nothing is connected + awp_draw_reel(4); + break; + case FIVE_REEL_3TO6: + stepper_update(4, ((data >> 2) & 0x0f)); + data = 0x00; //Strip all reel data from meter drives + awp_draw_reel(4); + break; + case SIX_REEL_1TO8: + stepper_update(4, (data & 0x0f)); + stepper_update(5, ((data >> 4) & 0x0f)); + data = 0x00; //Strip all reel data from meter drives + awp_draw_reel(4); + awp_draw_reel(5); + break; + case SIX_REEL_5TO8: + stepper_update(4, ((data >> 4) & 0x0f)); + data = 0x00; //Strip all reel data from meter drives + awp_draw_reel(4); + break; + case SEVEN_REEL: + stepper_update(0, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; + data = 0x00; //Strip all reel data from meter drives + awp_draw_reel(0); + break; + } + + MechMtr_update(7, (data & 0x80)); + for (meter = 0; meter < 4; meter ++) + { + MechMtr_update(meter, (data & (1 << meter))); + } + if (reel_mux == STANDARD_REEL) + { + for (meter = 4; meter < 7; meter ++) + { + MechMtr_update(meter, (data & (1 << meter))); + } + } +} /* called if board is reset */ static void mpu4_stepper_reset(void) @@ -427,7 +647,7 @@ static WRITE_LINE_DEVICE_HANDLER( cpu0_irq ) pia6821_get_irq_a(pia8) | pia6821_get_irq_b(pia8) | ptm6840_get_irq(ptm2); - if (!link7a_connected) + if (!link7a_connected) //7B = IRQ, 7A = FIRQ, both = NMI { cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); LOG(("6809 int%d \n", combined_state)); @@ -439,13 +659,6 @@ static WRITE_LINE_DEVICE_HANDLER( cpu0_irq ) } } -/*static WRITE_LINE_DEVICE_HANDLER( cpu0_irq_m6840 ) -{ -// cpu0_irq(device->machine->device("pia_ic3"), state); - cpu0_irq(device->machine->device("6840ptm"), state); -}*/ - - /* Bankswitching */ static WRITE8_HANDLER( bankswitch_w ) { @@ -466,6 +679,7 @@ static WRITE8_DEVICE_HANDLER( ic2_o1_callback ) /* copy output value to IC2 c2 this output is the clock for timer2 */ + /* 1200Hz System interrupt timer */ } @@ -473,8 +687,8 @@ static WRITE8_DEVICE_HANDLER( ic2_o2_callback ) { device_t *pia = device->machine->device("pia_ic3"); pia6821_ca1_w(pia, data); /* copy output value to IC3 ca1 */ - /* the output from timer2 is the input clock for timer3 */ + /* miscellaneous interrupts generated here */ ptm6840_set_c3(device, 0, data); } @@ -483,7 +697,7 @@ static WRITE8_DEVICE_HANDLER( ic2_o3_callback ) { /* the output from timer3 is used as a square wave for the alarm output and as an external clock source for timer 1! */ - + /* also runs lamp fade */ ptm6840_set_c1(device, 0, data); } @@ -495,7 +709,7 @@ static const ptm6840_interface ptm_ic2_intf = { DEVCB_HANDLER(ic2_o1_callback), DEVCB_HANDLER(ic2_o2_callback), DEVCB_HANDLER(ic2_o3_callback) }, - DEVCB_LINE(cpu0_irq)//_m6840) + DEVCB_LINE(cpu0_irq) }; @@ -628,13 +842,29 @@ static TIMER_CALLBACK( ic24_timeout ) } -/* IC4 IC4, 7 seg leds, 50Hz timer reel sensors, current sensors */ +/* IC4, 7 seg leds, 50Hz timer reel sensors, current sensors */ static WRITE8_DEVICE_HANDLER( pia_ic4_porta_w ) { if(ic23_active) { + if (((lamp_extender == NO_EXTENDER)||(lamp_extender == SMALL_CARD)||(lamp_extender == LARGE_CARD_C))&& (led_extender == NO_EXTENDER)) led_segs[input_strobe] = data; - mpu4_draw_led(input_strobe, led_segs[input_strobe]); + } +} + +static WRITE8_DEVICE_HANDLER( pia_ic4_portb_w ) +{ + if (reel_mux) + { + /* A write here connects one reel (and only one) + to the optic test circuit. This allows 8 reels + to be supported instead of 4. */ + if (reel_mux == SEVEN_REEL) + { + active_reel= reel_mux_table7[(data >> 4) & 0x07]; + } + else + active_reel= reel_mux_table[(data >> 4) & 0x07]; } } @@ -652,24 +882,44 @@ static READ8_DEVICE_HANDLER( pia_ic4_portb_r ) pia6821_cb1_w(device, 0); } - if ( optic_pattern & 0x01 ) ic4_input_b |= 0x40; /* reel A tab */ - else ic4_input_b &= ~0x40; + if (!reel_mux) + { + if ( optic_pattern & 0x01 ) ic4_input_b |= 0x40; /* reel A tab */ + else ic4_input_b &= ~0x40; - if ( optic_pattern & 0x02 ) ic4_input_b |= 0x20; /* reel B tab */ - else ic4_input_b &= ~0x20; + if ( optic_pattern & 0x02 ) ic4_input_b |= 0x20; /* reel B tab */ + else ic4_input_b &= ~0x20; - if ( optic_pattern & 0x04 ) ic4_input_b |= 0x10; /* reel C tab */ - else ic4_input_b &= ~0x10; + if ( optic_pattern & 0x04 ) ic4_input_b |= 0x10; /* reel C tab */ + else ic4_input_b &= ~0x10; - if ( optic_pattern & 0x08 ) ic4_input_b |= 0x08; /* reel D tab */ - else ic4_input_b &= ~0x08; + if ( optic_pattern & 0x08 ) ic4_input_b |= 0x08; /* reel D tab */ + else ic4_input_b &= ~0x08; + } + else + { + if (stepper_optic_state(active_reel)) + { + ic4_input_b |= 0x08; + } + else + { + ic4_input_b &= ~0x08; + } + } if ( signal_50hz ) ic4_input_b |= 0x04; /* 50 Hz */ else ic4_input_b &= ~0x04; - ic4_input_b |= 0x02; //By triggering the overcurrent circuit here, we can make the MPU4 lamp test pass. + if (ic4_input_b & 0x02) + { + ic4_input_b &= ~0x02; + } + else + { + ic4_input_b |= 0x02; //Pulse the overcurrent line with every read to show the CPU each lamp has lit + } #ifdef UNUSED_FUNCTION - if ( lamp_overcurrent ) ic4_input_b |= 0x02; if ( lamp_undercurrent ) ic4_input_b |= 0x01; #endif @@ -700,7 +950,7 @@ static const pia6821_interface pia_ic4_intf = DEVCB_NULL, /* line CA2 in */ DEVCB_NULL, /* line CB2 in */ DEVCB_HANDLER(pia_ic4_porta_w), /* port A out */ - DEVCB_NULL, /* port B out */ + DEVCB_HANDLER(pia_ic4_portb_w), /* port B out */ DEVCB_LINE(pia_ic4_ca2_w), /* line CA2 out */ DEVCB_LINE(pia_ic4_cb2_w), /* line CB2 out */ DEVCB_LINE(cpu0_irq), /* IRQA */ @@ -710,21 +960,123 @@ static const pia6821_interface pia_ic4_intf = /* IC5, AUX ports, coin lockouts and AY sound chip select (MODs below 4 only) */ static READ8_DEVICE_HANDLER( pia_ic5_porta_r ) { + if (lamp_extender == LARGE_CARD_A) + { + if (lamp_sense && ic23_active) + { + aux1_input |= 0x40; + } + else + { + aux1_input &= ~0x40; //Pulse the overcurrent line with every read to show the CPU each lamp has lit + } + } + if (hopper == HOPPER_NONDUART_A) + { +/* if (hopper1_active) + { + aux1_input |= 0x04; + } + else + { + aux1_input &= ~0x04; + }*/ + } LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",cpuexec_describe_context(device->machine))); - return input_port_read(device->machine, "AUX1"); + return input_port_read(device->machine, "AUX1")|aux1_input; } +static WRITE8_DEVICE_HANDLER( pia_ic5_porta_w ) +{ + device_t *pia_ic4 = device->machine->device("pia_ic5"); + if (hopper == HOPPER_NONDUART_A) + { + //hopper1_drive_sensor(data&0x10); + } + switch (lamp_extender) + { + case NO_EXTENDER: + if (led_extender == CARD_B) + { + led_write_latch(data & 0x1f, pia6821_get_output_a(pia_ic4),input_strobe); + } + else if ((led_extender != CARD_A)||(led_extender != NO_EXTENDER)) + { + led_segs[(input_strobe+8)] = data; + } + break; + case SMALL_CARD: + if(ic23_active) + { + lamp_extend_small(data); + } + break; + case LARGE_CARD_A: + lamp_extend_largea(data,input_strobe,ic23_active); + break; + case LARGE_CARD_B: + lamp_extend_largebc(data,input_strobe,ic23_active); + if ((ic23_active) && card_live) + { + led_segs[(8*(last_b7 >>7))+input_strobe] = (~data); + } + break; + case LARGE_CARD_C: + lamp_extend_largebc(data,input_strobe,ic23_active); + break; + } + if (reel_mux == SIX_REEL_5TO8) + { + stepper_update(4, data&0x0F); + stepper_update(5, (data >> 4)&0x0F); + awp_draw_reel(4); + awp_draw_reel(5); + } + else + if (reel_mux == SEVEN_REEL) + { + stepper_update(1, data&0x0F); + stepper_update(2, (data >> 4)&0x0F); + awp_draw_reel(1); + awp_draw_reel(2); + } +} + +static WRITE8_DEVICE_HANDLER( pia_ic5_portb_w ) +{ + if (hopper == HOPPER_NONDUART_B) + { + //hopper1_drive_motor(data &0x01) + //hopper1_drive_sensor(data &0x08) + } + if (led_extender == CARD_A) + { + // led_write_latch(data & 0x07, pia_get_output_a(pia_ic4),input_strobe) + } +} static READ8_DEVICE_HANDLER( pia_ic5_portb_r ) { device_t *pia_ic5 = device->machine->device("pia_ic5"); + if (hopper == HOPPER_NONDUART_B) + {/* + if (hopper1_active) + { + aux2_input |= 0x08; + } + else + { + aux2_input &= ~0x08; + }*/ + } + LOG(("%s: IC5 PIA Read of Port B (coin input AUX2)\n",cpuexec_describe_context(device->machine))); coin_lockout_w(device->machine, 0, (pia6821_get_output_b(pia_ic5) & 0x01) ); coin_lockout_w(device->machine, 1, (pia6821_get_output_b(pia_ic5) & 0x02) ); coin_lockout_w(device->machine, 2, (pia6821_get_output_b(pia_ic5) & 0x04) ); coin_lockout_w(device->machine, 3, (pia6821_get_output_b(pia_ic5) & 0x08) ); - return input_port_read(device->machine, "AUX2"); + return input_port_read(device->machine, "AUX2") | aux2_input; } @@ -815,8 +1167,8 @@ static const pia6821_interface pia_ic5_intf = DEVCB_NULL, /* line CB1 in */ DEVCB_NULL, /* line CA2 in */ DEVCB_NULL, /* line CB2 in */ - DEVCB_NULL, /* port A out */ - DEVCB_NULL, /* port B out */ + DEVCB_HANDLER(pia_ic5_porta_w), /* port A out */ + DEVCB_HANDLER(pia_ic5_portb_w), /* port B out */ DEVCB_LINE(pia_ic5_ca2_w), /* line CA2 out */ DEVCB_LINE(pia_ic5_cb2_w), /* port CB2 out */ DEVCB_LINE(cpu0_irq), /* IRQA */ @@ -828,10 +1180,23 @@ static const pia6821_interface pia_ic5_intf = static WRITE8_DEVICE_HANDLER( pia_ic6_portb_w ) { LOG(("%s: IC6 PIA Port B Set to %2x (Reel A and B)\n", cpuexec_describe_context(device->machine),data)); - stepper_update(0, data & 0x0F ); - stepper_update(1, (data>>4) & 0x0F ); - if (reel_flag) + if (reel_mux == SEVEN_REEL) + { + stepper_update(3, data&0x0F); + stepper_update(4, (data >> 4)&0x0F); + awp_draw_reel(3); + awp_draw_reel(4); + } + else + { + stepper_update(0, data & 0x0F ); + stepper_update(1, (data>>4) & 0x0F ); + awp_draw_reel(0); + awp_draw_reel(1); + } + + if (reel_flag && (reel_mux == STANDARD_REEL)) { if ( stepper_optic_state(0) ) optic_pattern |= 0x01; else optic_pattern &= ~0x01; @@ -839,8 +1204,6 @@ static WRITE8_DEVICE_HANDLER( pia_ic6_portb_w ) if ( stepper_optic_state(1) ) optic_pattern |= 0x02; else optic_pattern &= ~0x02; } - awp_draw_reel(0); - awp_draw_reel(1); } @@ -900,51 +1263,79 @@ static const pia6821_interface pia_ic6_intf = static WRITE8_DEVICE_HANDLER( pia_ic7_porta_w ) { LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", cpuexec_describe_context(device->machine),data)); - stepper_update(2, data & 0x0F ); - stepper_update(3, (data >> 4)& 0x0F ); + if (reel_mux == SEVEN_REEL) + { + stepper_update(5, data&0x0F); + stepper_update(6, (data >> 4)&0x0F); + awp_draw_reel(5); + awp_draw_reel(6); + } + else + { + stepper_update(2, data & 0x0F ); + stepper_update(3, (data>>4) & 0x0F ); + awp_draw_reel(2); + awp_draw_reel(3); + } - if (reel_flag) + if (reel_flag && (reel_mux == STANDARD_REEL)) { if ( stepper_optic_state(2) ) optic_pattern |= 0x04; else optic_pattern &= ~0x04; if ( stepper_optic_state(3) ) optic_pattern |= 0x08; else optic_pattern &= ~0x08; } - awp_draw_reel(2); - awp_draw_reel(3); } - static WRITE8_DEVICE_HANDLER( pia_ic7_portb_w ) { - int meter; - UINT64 cycles = device->machine->device("maincpu")->total_cycles(); + if (hopper == HOPPER_DUART_A) + { + //duart write data + } + else if (hopper == HOPPER_NONDUART_A) + { + //hoppr1_drive_motor(data & 0x10); + } + mmtr_data = data; +} + +static READ8_DEVICE_HANDLER( pia_ic7_portb_r ) +{ /* The meters are connected to a voltage drop sensor, where current flowing through them also passes through pin B7, meaning that when any meter is activated, pin B7 goes high. As for why they connected this to an output port rather than using -CB1, no idea. +CB1, no idea, although it proved of benefit when the reel multiplexer was designed +as it allows a separate meter to be used when the rest of the port is blocked. This appears to have confounded the schematic drawer, who has assumed that all eight meters are driven from this port, giving the 8 line driver chip 9 connections in total. */ - mmtr_data = data; - if (mmtr_data) + //This may be overkill, but the meter sensing is VERY picky + + int combined_meter = MechMtr_GetActivity(0) | MechMtr_GetActivity(1) | + MechMtr_GetActivity(2) | MechMtr_GetActivity(3) | + MechMtr_GetActivity(4) | MechMtr_GetActivity(5) | + MechMtr_GetActivity(6) | MechMtr_GetActivity(7); + + if(combined_meter) { - pia6821_portb_w(device, 0, mmtr_data | 0x80); - for (meter = 0; meter < 8; meter ++) - if (mmtr_data & (1 << meter)) Mechmtr_update(meter, cycles, mmtr_data & (1 << meter)); + return 0x80; } else { - pia6821_portb_w(device, 0, mmtr_data &~0x80); + return 0x00; } - - LOG(("%s: IC7 PIA Port B Set to %2x (Meters, Reel E and F)\n", cpuexec_describe_context(device->machine),data)); } + + + + + static WRITE_LINE_DEVICE_HANDLER( pia_ic7_ca2_w ) { LOG(("%s: IC7 PIA write CA2 %2x (input strobe bit 0 / LED A)\n", cpuexec_describe_context(device->machine),state)); @@ -954,25 +1345,15 @@ static WRITE_LINE_DEVICE_HANDLER( pia_ic7_ca2_w ) ic23_update(); } - static WRITE_LINE_DEVICE_HANDLER( pia_ic7_cb2_w ) { -/* The eighth meter is connected here, because the voltage sensor -is on PB7. */ - UINT64 cycles = device->machine->device("maincpu")->total_cycles(); - if (state) - { - pia6821_portb_w(device, 0, mmtr_data|0x80); - Mechmtr_update(7, cycles, state ); - } - LOG(("%s: IC7 PIA write CB2 %2x \n", cpuexec_describe_context(device->machine),state)); + remote_meter = state?0x80:0x00; } - static const pia6821_interface pia_ic7_intf = { DEVCB_NULL, /* port A in */ - DEVCB_NULL, /* port B in */ + DEVCB_HANDLER(pia_ic7_portb_r), /* port B in */ DEVCB_NULL, /* line CA1 in */ DEVCB_NULL, /* line CB1 in */ DEVCB_NULL, /* line CA2 in */ @@ -980,7 +1361,7 @@ static const pia6821_interface pia_ic7_intf = DEVCB_HANDLER(pia_ic7_porta_w), /* port A out */ DEVCB_HANDLER(pia_ic7_portb_w), /* port B out */ DEVCB_LINE(pia_ic7_ca2_w), /* line CA2 out */ - DEVCB_LINE(pia_ic7_cb2_w), /* port CB2 out */ + DEVCB_LINE(pia_ic7_cb2_w), /* line CB2 out */ DEVCB_LINE(cpu0_irq), /* IRQA */ DEVCB_LINE(cpu0_irq) /* IRQB */ }; @@ -1003,13 +1384,22 @@ static READ8_DEVICE_HANDLER( pia_ic8_porta_r ) static WRITE8_DEVICE_HANDLER( pia_ic8_portb_w ) { + if (hopper == HOPPER_DUART_B) + { +// duart.drive_sensor(data & 0x04, data & 0x01, 0, 0); + } + else if (hopper == HOPPER_DUART_C) + { +// duart.drive_sensor(data & 0x04, data & 0x01, data & 0x04, data & 0x02); + } int i; LOG_IC8(("%s: IC8 PIA Port B Set to %2x (OUTPUT PORT, TRIACS)\n", cpuexec_describe_context(device->machine),data)); for (i = 0; i < 8; i++) - if ( data & (1 << i) ) output_set_indexed_value("triac", i, data & (1 << i)); + { + output_set_indexed_value("triac", i, data & (1 << i)); + } } - static WRITE_LINE_DEVICE_HANDLER( pia_ic8_ca2_w ) { LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", cpuexec_describe_context(device->machine), state & 0xFF)); @@ -1049,11 +1439,11 @@ static const pia6821_interface pia_ic8_intf = }; +// Sampled sound card, using a PIA and PTM for timing and data handling static WRITE8_DEVICE_HANDLER( pia_gb_porta_w ) { device_t *msm6376 = device->machine->device("msm6376"); - - LOG(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data)); + LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data)); okim6376_w(msm6376, 0, data); } @@ -1061,7 +1451,7 @@ static WRITE8_DEVICE_HANDLER( pia_gb_portb_w ) { int changed = expansion_latch^data; - LOG(("%s: GAMEBOARD: PIA Port B Set to %2x\n", cpuexec_describe_context(device->machine),data)); + LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data)); expansion_latch = data; @@ -1081,35 +1471,31 @@ static WRITE8_DEVICE_HANDLER( pia_gb_portb_w ) { // float percent = (32-global_volume)/32.0; //volume_override?1.0:(32-global_volume)/32.0; // LOG(("GAMEBOARD: OKI volume %f \n",percent)); -// sndti_set_output_gain(SOUND_OKIM6295, 0, 0, percent); } } } } static READ8_DEVICE_HANDLER( pia_gb_portb_r ) { - LOG(("%s: GAMEBOARD: PIA Read of Port B\n",cpuexec_describe_context(device->machine))); + device_t *msm6376 = device->machine->device("msm6376"); + LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n",cpuexec_describe_context(device->machine))); // // b7, 1 = OKI ready, 0 = OKI busy // b5, vol clock // b4, 1 = Vol down, 0 = Vol up // -//if (offset == 0x40) -//{ -// return OKIM6295_status_r(0); -//} - return 0x40; + return okim6376_r(msm6376,0); } static WRITE_LINE_DEVICE_HANDLER( pia_gb_ca2_w ) { - LOG(("%s: GAMEBOARD: OKI RESET data = %02X\n", cpuexec_describe_context(device->machine), state)); + LOG_SS(("%s: GAMEBOARD: OKI RESET data = %02X\n", cpuexec_describe_context(device->machine), state)); -// return okim6376_status_0_r(); +// reset line } -static const pia6821_interface pia_gameboard_intf = +static const pia6821_interface pia_ic4ss_intf = { DEVCB_NULL, /* port A in */ DEVCB_HANDLER(pia_gb_portb_r), /* port B in */ @@ -1125,6 +1511,50 @@ static const pia6821_interface pia_gameboard_intf = DEVCB_NULL /* IRQB */ }; +//Sampled sound timer +/* +FIXME +The MSM6376 sound chip is configured in a slightly strange way, to enable dynamic +sample rate changes (8Khz, 10.6 Khz, 16 KHz) by varying the clock. +According to the BwB programmer's guide, the formula is: +MSM6376 clock frequency:- +freq = (1720000/((t3L+1)(t3H+1)))*[(t3H(T3L+1)+1)/(2(t1+1))] +where [] means rounded up integer, +t3L is the LSB of Clock 3, +t3H is the MSB of Clock 3, +and t1 is the figure added to clock 1. + +The sample speed divisor is f/300 +*/ + +//O3 -> G1 O1 -> c2 o2 -> c1 +static WRITE8_DEVICE_HANDLER( ic3ss_o1_callback ) +{ + ptm6840_set_c2(device, 0, data); +} + + +static WRITE8_DEVICE_HANDLER( ic3ss_o2_callback )//Generates 'beep' tone +{ + ptm6840_set_c1(device, 0, data);//? +} + + +static WRITE8_DEVICE_HANDLER( ic3ss_o3_callback ) +{ + ptm6840_set_g1(device, 0, data); /* this output is the clock for timer1 */ +} + + +static const ptm6840_interface ptm_ic3ss_intf = +{ + MPU4_MASTER_CLOCK / 4, + { 0, 0, 0 }, + { DEVCB_HANDLER(ic3ss_o1_callback), + DEVCB_HANDLER(ic3ss_o2_callback), + DEVCB_HANDLER(ic3ss_o3_callback) }, + DEVCB_NULL//LINE(cpu1_ptm_irq) +}; /* input ports for MPU4 board */ static INPUT_PORTS_START( mpu4 ) @@ -1450,18 +1880,6 @@ static INPUT_PORTS_START( gamball ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) PORT_START("AUX1") -/* PORT_DIPNAME( 0x01, 0x00, "AUX101" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "AUX102" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "AUX103" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, "AUX104" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) )*/ PORT_DIPNAME( 0x10, 0x00, "AUX105" ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) @@ -1489,8 +1907,15 @@ INPUT_PORTS_END static const stepper_interface barcrest_reel_interface = { BARCREST_48STEP_REEL, - 0, - 8, + 92, + 4, + 0x00 +}; +static const stepper_interface barcrest_opto1_interface = +{ + BARCREST_48STEP_REEL, + 4, + 12, 0x00 }; @@ -1500,6 +1925,17 @@ static void mpu4_config_common(running_machine *machine) ic24_timer = timer_alloc(machine, ic24_timeout, NULL); } +static void mpu4_config_common_reels(running_machine *machine,int reels) +{ + int n; + /* setup n default 96 half step reels, using the standard optic flag */ + for ( n = 0; n < reels; n++ ) + { + stepper_config(machine, n, &barcrest_reel_interface); + } + awp_reel_setup(); +} + static MACHINE_START( mpu4mod2 ) { mpu4_config_common(machine); @@ -1508,13 +1944,7 @@ static MACHINE_START( mpu4mod2 ) mod_number=2; /* setup 8 mechanical meters */ - Mechmtr_init(8); - - /* setup 4 reels */ - stepper_config(machine, 0, &barcrest_reel_interface); - stepper_config(machine, 1, &barcrest_reel_interface); - stepper_config(machine, 2, &barcrest_reel_interface); - stepper_config(machine, 3, &barcrest_reel_interface); + MechMtr_config(machine,8); /* setup the standard oki MSC1937 display */ ROC10937_init(0, MSC1937,0); @@ -1527,16 +1957,10 @@ static MACHINE_START( mpu4dutch ) link7a_connected=0; // setup 8 mechanical meters //////////////////////////////////////////// - Mechmtr_init(8); - -// setup 4 default 96 half step reels /////////////////////////////////// - stepper_config(machine, 0, &barcrest_reel_interface); - stepper_config(machine, 1, &barcrest_reel_interface); - stepper_config(machine, 2, &barcrest_reel_interface); - stepper_config(machine, 3, &barcrest_reel_interface); + MechMtr_config(machine,8); // setup the standard oki MSC1937 display /////////////////////////////// - ROC10937_init(0, MSC1937,1); // does oldtimer use a OKI MSC1937 alpha display controller? + ROC10937_init(0, MSC1937,0); // does oldtimer use a OKI MSC1937 alpha display controller? } static MACHINE_START( mpu4mod4 ) @@ -1547,15 +1971,8 @@ static MACHINE_START( mpu4mod4 ) mod_number=4; // setup 8 mechanical meters //////////////////////////////////////////// - Mechmtr_init(8); + MechMtr_config(machine,8); -// setup 4 default 96 half step reels /////////////////////////////////// - stepper_config(machine, 0, &barcrest_reel_interface); - stepper_config(machine, 1, &barcrest_reel_interface); - stepper_config(machine, 2, &barcrest_reel_interface); - stepper_config(machine, 3, &barcrest_reel_interface); - - awp_reel_setup(); // setup the standard oki MSC1937 display /////////////////////////////// ROC10937_init(0, MSC1937,0); } @@ -1563,25 +1980,15 @@ static MACHINE_START( mpu4mod4 ) /* Characteriser (CHR) -I haven't been able to work out all the ways of finding the CHR data, but there must be a flag in the ROMs -somewhere to pick it out. As built, the CHR is a PAL which can perform basic bit manipulation according to an as yet unknown unique key. However, the programmers decided to best use this protection device in read/write/compare +As built, the CHR is a PAL which can perform basic bit manipulation according to +an as yet unknown unique key. However, the programmers decided to best use this protection device in read/write/compare cycles, storing almost the entire 'hidden' data table in the ROMs in plain sight. Only later rebuilds by BwB -avoided this 'feature' of the development kit, and as such, only low level access can defeat their protection. +avoided this 'feature' of the development kit, and will need a different setup. This information has been used to generate the CHR tables loaded by the programs, until a key can be determined. For most Barcrest games, the following method was used: -To calculate the values necessary to program the CHR, we must first find the version string, taking -the example of an AWP called Club Celebration, this starts at 0xff28 and terminates at 0xff2f. -0xff2f then represents the CHR address. -For some reason, the tables always seem to start and end with '00 00'. - -From that point on, every word represents a call and response pair, until we have generated 8 8 byte rows of data. - -The call values appear to be fixed, so it would be possible to make a switch statement, but I believe the emulated -behaviour to be more likely. - The initial 'PALTEST' routine as found in the Barcrest programs simply writes the first 'call' to the CHR space, to read back the 'response'. There is no attempt to alter the order or anything else, just a simple runthrough of the entire data table. The only 'catch' in this is to note that the CHR chip always scans @@ -1599,13 +2006,11 @@ static WRITE8_HANDLER( characteriser_w ) int x; int call=data; LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(space->cpu),offset,data)); - if (!mpu4_current_chr_table) fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu)); if (offset == 0) { - // for (x = prot_col; x < 64; x++) { if (call == 0) { @@ -1628,19 +2033,35 @@ static WRITE8_HANDLER( characteriser_w ) else if (offset == 2) { LOG_CHR(("Characteriser write 2 data %02X\n",data)); - for (x = lamp_col; x < 16; x++) + switch (call) + // Rather than the search strategy, we can map the calls directly here. Note that they are hex versions of the square number series { - if (mpu4_current_chr_table[(64+x)].call == call) - { - lamp_col = x; - LOG_CHR(("Characteriser find column %02X\n",lamp_col)); - break; - } - if (lamp_col > 7) - { - lamp_col = 0; - } + case 0x00: + lamp_col = 0; + break; + case 0x01: + lamp_col = 1; + break; + case 0x04: + lamp_col = 2; + break; + case 0x09: + lamp_col = 3; + break; + case 0x10: + lamp_col = 4; + break; + case 0x19: + lamp_col = 5; + break; + case 0x24: + lamp_col = 6; + break; + case 0x31: + lamp_col = 7; + break; } + LOG_CHR(("Characteriser find 2 column %02X\n",lamp_col)); } } @@ -1651,15 +2072,14 @@ static READ8_HANDLER( characteriser_r ) fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu)); LOG_CHR(("Characteriser read offset %02X \n",offset)); - LOG_CHR_FULL(("%04x Characteriser read offset %02X", cpu_get_previouspc(space->cpu),offset)); if (offset == 0) { - LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[prot_col])); + LOG_CHR(("Characteriser read data %02X \n",mpu4_current_chr_table[prot_col].response)); return mpu4_current_chr_table[prot_col].response; } if (offset == 3) { - LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[lamp_col+64])); + LOG_CHR(("Characteriser read data off 3 %02X \n",mpu4_current_chr_table[lamp_col+64].response)); return mpu4_current_chr_table[lamp_col+64].response; } return 0; @@ -1689,16 +2109,91 @@ static const mpu4_chr_table gmball_data[72] = { {0x00, 0x00},{0x01, 0x18},{0x04, 0x08},{0x09, 0x10},{0x10, 0x00},{0x19, 0x18},{0x24, 0x08},{0x31, 0x00} }; +static const mpu4_chr_table grtecp_data[72] = { +{0x00, 0x00},{0x1a, 0x84},{0x04, 0xa4},{0x10, 0xac},{0x18, 0x70},{0x0f, 0x80},{0x13, 0x2c},{0x1b, 0xc0}, +{0x03, 0xbc},{0x07, 0x5c},{0x17, 0x5c},{0x1d, 0x5c},{0x36, 0xdc},{0x35, 0x5c},{0x2b, 0xcc},{0x28, 0x68}, +{0x39, 0xd0},{0x21, 0xb8},{0x22, 0xdc},{0x25, 0x54},{0x2c, 0x08},{0x29, 0x58},{0x31, 0x54},{0x34, 0x90}, +{0x0a, 0xb8},{0x1f, 0x5c},{0x06, 0x5c},{0x0e, 0x44},{0x1c, 0x84},{0x12, 0xac},{0x1e, 0xe0},{0x0d, 0xbc}, +{0x14, 0xcc},{0x0a, 0xe8},{0x19, 0x70},{0x15, 0x00},{0x06, 0x8c},{0x0f, 0x70},{0x08, 0x00},{0x1b, 0x84}, +{0x1e, 0xa4},{0x04, 0xa4},{0x01, 0xbc},{0x0c, 0xdc},{0x18, 0x5c},{0x1a, 0xcc},{0x11, 0xe8},{0x0b, 0xe0}, +{0x03, 0xbc},{0x17, 0x4c},{0x10, 0xc8},{0x1d, 0xf8},{0x0e, 0xd4},{0x07, 0xa8},{0x12, 0x68},{0x09, 0x40}, +{0x0d, 0x0c},{0x1f, 0xd8},{0x16, 0xdc},{0x05, 0x54},{0x13, 0x98},{0x1c, 0x44},{0x02, 0x9c},{0x00, 0x00}, +{0x00, 0x00},{0x01, 0x18},{0x04, 0x00},{0x09, 0x18},{0x10, 0x08},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00} +}; + +static const mpu4_chr_table oldtmr_data[72] = { +{0x00, 0x00},{0x1a, 0x90},{0x04, 0xc0},{0x10, 0x54},{0x18, 0xa4},{0x0f, 0xf0},{0x13, 0x64},{0x1b, 0x90}, +{0x03, 0xe4},{0x07, 0xd4},{0x17, 0x60},{0x1d, 0xb4},{0x36, 0xc0},{0x35, 0x70},{0x2b, 0x80},{0x28, 0x74}, +{0x39, 0xa4},{0x21, 0xf4},{0x22, 0xe4},{0x25, 0xd0},{0x2c, 0x64},{0x29, 0x10},{0x31, 0x20},{0x34, 0x90}, +{0x0a, 0xe4},{0x1f, 0xf4},{0x06, 0xc4},{0x0e, 0x70},{0x1c, 0x00},{0x12, 0x14},{0x1e, 0x00},{0x0d, 0x14}, +{0x14, 0xa0},{0x0a, 0xf0},{0x19, 0x64},{0x15, 0x10},{0x06, 0x84},{0x0f, 0x70},{0x08, 0x00},{0x1b, 0x90}, +{0x1e, 0x40},{0x04, 0x90},{0x01, 0xe4},{0x0c, 0xf4},{0x18, 0x64},{0x1a, 0x90},{0x11, 0x64},{0x0b, 0x90}, +{0x03, 0xe4},{0x17, 0x50},{0x10, 0x24},{0x1d, 0xb4},{0x0e, 0xe0},{0x07, 0xd4},{0x12, 0xe4},{0x09, 0x50}, +{0x0d, 0x04},{0x1f, 0xb4},{0x16, 0xc0},{0x05, 0xd0},{0x13, 0x64},{0x1c, 0x90},{0x02, 0xe4},{0x00, 0x00}, +{0x00, 0x00},{0x01, 0x00},{0x04, 0x00},{0x09, 0x00},{0x10, 0x00},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00} +}; + +static DRIVER_INIT (m_oldtmr) +{ + reel_mux=SIX_REEL_1TO8; + + stepper_config(machine, 0, &barcrest_opto1_interface); + stepper_config(machine, 1, &barcrest_opto1_interface); + stepper_config(machine, 2, &barcrest_opto1_interface); + stepper_config(machine, 3, &barcrest_opto1_interface); + stepper_config(machine, 4, &barcrest_opto1_interface); + stepper_config(machine, 5, &barcrest_opto1_interface); + + awp_reel_setup(); + mpu4_current_chr_table = oldtmr_data; +} + static DRIVER_INIT (m_ccelbr) { + reel_mux=STANDARD_REEL; + // setup 4 default 96 half step reels /////////////////////////////////// + mpu4_config_common_reels(machine,4); + mpu4_current_chr_table = ccelbr_data; } static DRIVER_INIT (m_gmball) { - mpu4_current_chr_table = gmball_data; + reel_mux=STANDARD_REEL; + // setup 4 default 96 half step reels /////////////////////////////////// + mpu4_config_common_reels(machine,4); + + mpu4_current_chr_table = gmball_data; } +static DRIVER_INIT (m_grtecp) +{ + reel_mux=FIVE_REEL_5TO8; + lamp_extender=SMALL_CARD; + // setup 5 default 96 half step reels with the mux board + mpu4_config_common_reels(machine,5); + mpu4_current_chr_table = grtecp_data; +} + +static DRIVER_INIT (mpu4tst2) +{ + reel_mux=STANDARD_REEL; + // setup 5 default 96 half step reels with the mux board + mpu4_config_common_reels(machine,4); + +} + +static DRIVER_INIT (mpu4utst) +{ + reel_mux=STANDARD_REEL; + // setup 4 default 96 half step reels /////////////////////////////////// + mpu4_config_common_reels(machine,4); +} + +static DRIVER_INIT (connect4) +{ + led_lamp=1; +} /* generate a 50 Hz signal (based on an RC time) */ static TIMER_DEVICE_CALLBACK( gen_50hz ) @@ -1709,8 +2204,13 @@ static TIMER_DEVICE_CALLBACK( gen_50hz ) signal_50hz = signal_50hz?0:1; update_lamps(); pia6821_ca1_w(timer.machine->device("pia_ic4"), signal_50hz); /* signal is connected to IC4 CA1 */ -} + if (signal_50hz) + { + update_meters(); + } + +} static ADDRESS_MAP_START( mod2_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") @@ -1762,9 +2262,9 @@ static ADDRESS_MAP_START( mod4_oki_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select) - AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_gamebd", pia6821_r,pia6821_w) // PIA6821 on sampled sound board + AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w) // PIA6821 on sampled sound board -// AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("??", ptm6840_read, ptm6840_write) // 6840PTM on sampled sound board + AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write) // 6840PTM on sampled sound board // AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers @@ -1789,9 +2289,9 @@ static ADDRESS_MAP_START( dutch_memmap, ADDRESS_SPACE_PROGRAM, 8 ) // AM_RANGE(0x0800, 0x0810) AM_READWRITE(characteriser_r,characteriser_w) AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select) - AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_gamebd", pia6821_r,pia6821_w) // PIA6821 on game board + AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w) // PIA6821 on sampled sound board -// AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("??", ptm6840_read, ptm6840_write) // 6840PTM on game board + AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write) // 6840PTM on sampled sound board // AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers @@ -1862,27 +2362,23 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( mod4oki, mpu4mod2 ) MCFG_MACHINE_START(mpu4mod4) - MCFG_PIA6821_ADD("pia_gamebd", pia_gameboard_intf) + MCFG_PTM6840_ADD("ptm_ic3ss", ptm_ic3ss_intf) + MCFG_PIA6821_ADD("pia_ic4ss", pia_ic4ss_intf) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(mod4_oki_map) MCFG_DEVICE_REMOVE("ay8913") - MCFG_SOUND_ADD("msm6376", OKIM6376, 4000000) //? + MCFG_SOUND_ADD("msm6376", OKIM6376, 64000) //Dynamic, can also be 85430 at 10.5KHz and 128000 at 16KHz MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( mpu4dutch, mod4oki ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(dutch_memmap) // setup read and write memorymap - MCFG_MACHINE_START(mpu4dutch) // main mpu4 board initialisation + MCFG_MACHINE_START(mpu4dutch) // main mpu4 board initialisation MACHINE_CONFIG_END -static DRIVER_INIT (connect4) -{ - led_extend=1; -} - ROM_START( m_oldtmr ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "dot11.bin", 0x00000, 0x10000, CRC(da095666) SHA1(bc7654dc9da1f830a43f925db8079f27e18bb61e)) @@ -1919,17 +2415,27 @@ ROM_START( mpu4met0 ) ROM_LOAD( "meter-zero.p1", 0x8000, 0x8000, CRC(e74297e5) SHA1(49a2cc85eda14199975ec37a794b685c839d3ab9)) ROM_END -// year, name, parent, machine, input, init, monitor, company, fullname, flags -GAME( 198?, m_oldtmr, 0, mpu4dutch, mpu4, 0, ROT0, "Barcrest","Old Timer",GAME_NOT_WORKING|GAME_NO_SOUND|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL ) -GAME( 198?, m_ccelbr, 0, mpu4mod2, mpu4, m_ccelbr, ROT0, "Barcrest","Club Celebration",GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL ) -GAMEL(198?, m_gmball, 0, mod4yam, gamball, m_gmball, ROT0, "Barcrest","Gamball",GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL,layout_gamball ) +ROM_START( m_grtecp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("an2k.p1", 0x00000, 0x10000, CRC(c0886dff) SHA1(ef2b509fde05ef4ef055a09275afc9e153f50efc)) + + ROM_REGION( 0x200000, "msm6376", 0 ) + ROM_LOAD( "an2snd.p1", 0x000000, 0x080000, CRC(5394e9ae) SHA1(86ccd8531fc87f34d3c5482ba7e5a2c06ea69491) ) + ROM_LOAD( "an2snd.p2", 0x080000, 0x080000, CRC(109ace1f) SHA1(9f0e8065186beb61ed50fea834de2d91e68db953) ) + +ROM_END +// year, name, parent, machine, input, init, monitor,company, fullname, flags +GAME( 198?, m_oldtmr,0, mpu4dutch,mpu4, m_oldtmr, ROT0, "Barcrest", "Old Timer", GAME_NOT_WORKING|GAME_NO_SOUND|GAME_REQUIRES_ARTWORK ) +GAME( 198?, m_ccelbr,0, mpu4mod2, mpu4, m_ccelbr, ROT0, "Barcrest", "Club Celebration", GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK ) +GAMEL(198?, m_gmball,0, mod4yam, gamball, m_gmball, ROT0, "Barcrest", "Gamball", GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL,layout_gamball )//Mechanical ball launcher +GAMEL(198?, m_grtecp,0, mod4oki, mpu4, m_grtecp, ROT0, "Barcrest", "Andy's Great Escape", GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK,layout_mpu4ext )//5 reel meter mux //SWP GAMEL(1989?,connect4, 0, mpu4mod2, connect4, connect4, ROT0, "Dolbeck Systems","Connect 4",GAME_IMPERFECT_GRAPHICS|GAME_REQUIRES_ARTWORK,layout_connect4 ) //Diagnostic ROMs -GAME( 198?, mpu4utst, 0, mpu4mod2, mpu4, 0, ROT0, "Barcrest","MPU4 Unit Test (Program 4)",GAME_MECHANICAL ) -GAME( 198?, mpu4tst2, 0, mpu4mod2, mpu4, 0, ROT0, "Barcrest","MPU4 Unit Test (Program 2)",GAME_MECHANICAL ) +GAME( 198?, mpu4utst, 0, mpu4mod2, mpu4, mpu4utst, ROT0, "Barcrest","MPU4 Unit Test (Program 4)",GAME_MECHANICAL ) +GAME( 198?, mpu4tst2, 0, mpu4mod2, mpu4, mpu4tst2, ROT0, "Barcrest","MPU4 Unit Test (Program 2)",GAME_MECHANICAL ) GAME( 198?, mpu4met0, 0, mpu4mod2, mpu4, 0, ROT0, "Barcrest","MPU4 Meter Clear ROM",GAME_MECHANICAL ) #include "drivers/mpu4drvr.c" diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c index 4db031925df..8eaa4e0d9c8 100644 --- a/src/mame/drivers/mpu4drvr.c +++ b/src/mame/drivers/mpu4drvr.c @@ -172,6 +172,7 @@ TODO: - Hook up OKIM6376 sound in The Mating Game - Get the BwB games running * They have a slightly different 68k memory map. The 6850 is at e00000 and the 6840 is at e01000 + They appear to hang on the handshake with the MPU4 board - Find out what causes the games to reset in service mode (see jump taken at CPU1:c8e8) - Deal 'Em lockouts vary on certain cabinets (normally connected to AUX2, but not there?) - Deal 'Em has bad tiles (apostrophe, logo, bottom corner), black should actually be transparent @@ -1094,6 +1095,84 @@ static READ16_HANDLER( ef9369_r ) } } +/****************************************** + * + * Brooktree Bt471 RAMDAC + * Implementation stolen from JPM + * Impact, may not be 100% (that has a 477) + ******************************************/ + +static struct +{ + UINT8 address; + UINT8 addr_cnt; + UINT8 pixmask; + UINT8 command; + rgb_t color; +} bt471; + + +/* + * 0 0 0 Address register (RAM write mode) + * 0 0 1 Color palette RAMs + * 0 1 0 Pixel read mask register + * 0 1 1 Address register (RAM read mode) + * 1 0 0 Address register (overlay write mode) + * 1 1 1 Address register (overlay read mode) + * 1 0 1 Overlay register + */ + +WRITE16_HANDLER( bt471_w ) +{ + UINT8 val = data & 0xff; + { + popmessage("Bt477: Unhandled write access (offset:%x, data:%x)", offset, val); + } + + switch (offset) + { + case 0x0: + { + bt471.address = val; + bt471.addr_cnt = 0; + break; + } + case 0x1: + { + UINT8 *addr_cnt = &bt471.addr_cnt; + rgb_t *color = &bt471.color; + + color[*addr_cnt] = val; + + if (++*addr_cnt == 3) + { + palette_set_color(space->machine, bt471.address, MAKE_RGB(color[0], color[1], color[2])); + *addr_cnt = 0; + + /* Address register increments */ + bt471.address++; + } + break; + } + case 0x2: + { + bt471.pixmask = val; + break; + } + +// default: + { + popmessage("Bt477: Unhandled write access (offset:%x, data:%x)", offset, val); + } + } +} + +READ16_HANDLER( bt471_r ) +{ + popmessage("Bt477: Unhandled read access (offset:%x)", offset); + return 0; +} + /************************************* * @@ -1888,17 +1967,12 @@ static MACHINE_START( mpu4_vid ) { mpu4_config_common(machine); + mod_number=4; //No AY chip /* setup communications */ link7a_connected = 1; /* setup 8 mechanical meters */ - Mechmtr_init(8); - - /* setup 4 reels (for hybrid machines) */ - stepper_config(machine, 0, &barcrest_reel_interface); - stepper_config(machine, 1, &barcrest_reel_interface); - stepper_config(machine, 2, &barcrest_reel_interface); - stepper_config(machine, 3, &barcrest_reel_interface); + MechMtr_config(machine,8); /* setup the standard oki MSC1937 display */ ROC10937_init(0, MSC1937, 0); @@ -1977,12 +2051,64 @@ static ADDRESS_MAP_START( vp_68k_map, ADDRESS_SPACE_PROGRAM, 16 ) /* AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w) Word-based version of old CHR??? */ ADDRESS_MAP_END +static ADDRESS_MAP_START( bwbvid_6809_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x0800, 0x0800) AM_DEVREADWRITE("acia6850_0", acia6850_stat_r, acia6850_ctrl_w) + AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("acia6850_0", acia6850_data_r, acia6850_data_w) + AM_RANGE(0x0880, 0x0881) //AM_NOP //Read/write here + AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write) + AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w) + AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w) + AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE("pia_ic5", pia6821_r, pia6821_w) + AM_RANGE(0x0d00, 0x0d03) AM_DEVREADWRITE("pia_ic6", pia6821_r, pia6821_w) + AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE("pia_ic7", pia6821_r, pia6821_w) + AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE("pia_ic8", pia6821_r, pia6821_w) + AM_RANGE(0x4000, 0x7fff) AM_RAM + AM_RANGE(0xbe00, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu",0) /* 64k EPROM on board, only this region read */ +ADDRESS_MAP_END +static ADDRESS_MAP_START( bwbvid_68k_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x7fffff) AM_ROM + AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram) + AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */ + AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff) + AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff) + AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w) +// AM_RANGE(0xa00000, 0xa0000f) AM_READWRITE(bt471_r,bt471_w) //Some games use this +/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */ + AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w) + AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w) + AM_RANGE(0xe05000, 0xe05001) //AM_READWRITE(adpcm_r, adpcm_w) CHR ? + AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff) + AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bwbvid5_68k_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x7fffff) AM_ROM + AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram) + AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */ + AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff) + AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff) + AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w) + //AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(bt471_r,bt471_w) Some games use this +/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */ + AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w) + AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w) + AM_RANGE(0xe05000, 0xe05001) //AM_READWRITE(adpcm_r, adpcm_w) CHR ? + AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff) + AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff) + AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff) + AM_RANGE(0xe02000, 0xe02007) AM_DEVREADWRITE8("pia_ic4ss", pia6821_r, pia6821_w, 0xff) + AM_RANGE(0xe03000, 0xe0300f) AM_DEVREADWRITE8("6840ptm_ic3ss", ptm6840_read, ptm6840_write, 0xff) +ADDRESS_MAP_END +// /* Deal 'Em */ /* Deal 'Em was designed as an enhanced gamecard, to fit into an existing MPU4 cabinet It's an unoffical addon, and does all its work through the existing 6809 CPU. Although given unofficial status, Barcrest's patent on the MPU4 Video hardware (GB1596363) describes -the Deal 'Em board design, rather than the one they ultimately used, suggesting some sort of licensing deal. */ +the Deal 'Em board design, rather than the one they ultimately used, suggesting some sort of licensing deal. +Perhaps this was the (seemingly very rare) MPU3 Video card design? */ static const gfx_layout dealemcharlayout = { @@ -2269,12 +2395,6 @@ static MACHINE_CONFIG_START( mpu4_vid, driver_device ) MCFG_PALETTE_LENGTH(16) MCFG_PTM6840_ADD("6840ptm_68k", ptm_vid_intf) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8913",AY8913, MPU4_MASTER_CLOCK/4) - MCFG_SOUND_CONFIG(ay8910_config) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - /* Present on all video cards */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_SOUND_ADD("saa", SAA1099, 8000000) @@ -2293,9 +2413,9 @@ static MACHINE_CONFIG_DERIVED( crmaze, mpu4_vid ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( mating, crmaze ) - MCFG_SOUND_ADD("oki", OKIM6376, 64000) //? - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( vgpoker, mpu4_vid ) @@ -2303,7 +2423,69 @@ static MACHINE_CONFIG_DERIVED( vgpoker, mpu4_vid ) MCFG_CPU_PROGRAM_MAP(vp_68k_map) MACHINE_CONFIG_END +static MACHINE_CONFIG_START( bwbvid, driver_device ) + MCFG_CPU_ADD("maincpu", M6809, MPU4_MASTER_CLOCK/4 ) + MCFG_CPU_PROGRAM_MAP(bwbvid_6809_map) + MCFG_TIMER_ADD_PERIODIC("50hz",gen_50hz, attotime::from_hz(100)) + MCFG_NVRAM_ADD_0FILL("nvram") /* confirm */ + + /* 6840 PTM */ + MCFG_PTM6840_ADD("ptm_ic2", ptm_ic2_intf) + + MCFG_PIA6821_ADD("pia_ic3", pia_ic3_intf) + MCFG_PIA6821_ADD("pia_ic4", pia_ic4_intf) + MCFG_PIA6821_ADD("pia_ic5", pia_ic5_intf) + MCFG_PIA6821_ADD("pia_ic6", pia_ic6_intf) + MCFG_PIA6821_ADD("pia_ic7", pia_ic7_intf) + MCFG_PIA6821_ADD("pia_ic8", pia_ic8_intf) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) + MCFG_SCREEN_SIZE(64*8, 40*8) // note this directly affects the scanline counters used below, and thus the timing of everything + MCFG_SCREEN_VISIBLE_AREA(0*8, 63*8-1, 0*8, 37*8-1) + MCFG_SCREEN_REFRESH_RATE(50) + + MCFG_CPU_ADD("video", M68000, VIDEO_MASTER_CLOCK ) + MCFG_CPU_PROGRAM_MAP(bwbvid_68k_map) + + MCFG_QUANTUM_TIME(attotime::from_hz(960)) + + MCFG_MACHINE_START(mpu4_vid) + MCFG_MACHINE_RESET(mpu4_vid) + MCFG_VIDEO_START (mpu4_vid) + MCFG_VIDEO_UPDATE(mpu4_vid) + + MCFG_PALETTE_LENGTH(16) + + MCFG_PTM6840_ADD("6840ptm_68k", ptm_vid_intf) + + /* Present on all video cards */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("saa", SAA1099, 8000000) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) + + MCFG_ACIA6850_ADD("acia6850_0", m6809_acia_if) + MCFG_ACIA6850_ADD("acia6850_1", m68k_acia_if) + + // for the video timing + MCFG_TIMER_ADD_SCANLINE("scan_timer", scanline_timer_callback, "screen", 0, 1) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bwbvid5, bwbvid ) + MCFG_CPU_MODIFY("video") + MCFG_CPU_PROGRAM_MAP(bwbvid5_68k_map) + + MCFG_PTM6840_ADD("6840ptm_ic3ss", ptm_ic3ss_intf) + MCFG_PIA6821_ADD("pia_ic4ss", pia_ic4ss_intf) + + MCFG_SOUND_ADD("msm6376", OKIM6376, 64000) //? + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) + +MACHINE_CONFIG_END /* machine driver for Zenitone Deal 'Em board */ static MACHINE_CONFIG_START( dealem, driver_device ) @@ -2697,6 +2879,64 @@ ROM_START( bloxd ) ROM_LOAD16_BYTE( "blxv___2.0_6", 0x040001, 0x10000, CRC(a3d92b5b) SHA1(1e7042d5eae4a19a01a3ef7d806c434886dc9f4d) ) ROM_END +ROM_START( bwbtetrs ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("tetris22.p0", 0x00000, 0x04000, CRC(b711c7ae) SHA1(767b17ddf9021fdf79ff6c52f04a5d8ea60cf30e) ) + + ROM_REGION( 0x800000, "video", 0 ) + ROM_LOAD16_BYTE( "tetris22.p1", 0x000000, 0x10000, CRC(e81dd182) SHA1(28b460224abf6fe24b637542ccd1c84040674555) ) + ROM_LOAD16_BYTE( "tetris22.p2", 0x000001, 0x10000, CRC(68aa4f15) SHA1(4e4511a64391fc64e5f5b7ccb46a78fd2e1d94d6) ) + ROM_LOAD16_BYTE( "tetris22.p3", 0x020000, 0x10000, CRC(b38b4763) SHA1(d28e77fdd6869cb5b5ec40ed1f300a2a947e0482) ) + ROM_LOAD16_BYTE( "tetris22.p4", 0x020001, 0x10000, CRC(1649f604) SHA1(ca4ac303391a0969d41c8f988b8e81cfcee1a21c) ) + ROM_LOAD16_BYTE( "tetris22.p5", 0x040001, 0x10000, CRC(02859676) SHA1(5293c767021a6b5253eecab0b0568aa082ea7084) ) + ROM_LOAD16_BYTE( "tetris22.p6", 0x040001, 0x10000, CRC(40d24c82) SHA1(7ac3cf148af84ad93eaf11ce3420abbe45d986e2) ) +ROM_END + +/* Vegas Poker Prototype dumped by HIGHWAYMAN */ +ROM_START( vgpoker ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("comms-v2.0.bin", 0x00000, 0x10000, CRC(1717581f) SHA1(40f8cae39a2ab0c89d2bbfd8a37725aaae229c96)) + + ROM_REGION( 0x800000, "video", 0 ) + ROM_LOAD16_BYTE("video-1.bin", 0x000000, 0x010000, CRC(7ba2396c) SHA1(eb24b802b984315fc2eba4f15c208e2c1925c1c8)) + ROM_LOAD16_BYTE("video-2.bin", 0x000001, 0x010000, CRC(4f9e830b) SHA1(f17bebb289c3620bf4c88b2b358a9dab87ac214f)) + ROM_LOAD16_BYTE("video-3.bin", 0x020000, 0x010000, CRC(607e0baa) SHA1(9f64a46ef3b9a854e939b5e7f0d1e6e925735922)) + ROM_LOAD16_BYTE("video-4.bin", 0x020001, 0x010000, CRC(2019f5d3) SHA1(d183b3b92d03be9f9d57b5df1a621cbfe955ed93)) + ROM_LOAD16_BYTE("video-5.bin", 0x040000, 0x010000, CRC(c029202e) SHA1(b08bb2678c2ff62a58ef67d5440c326d0fadc34e)) + ROM_LOAD16_BYTE("video-6.bin", 0x040001, 0x010000, CRC(3287ae4e) SHA1(3b05a036de3ca7ec644bfbf04934e44e631d1e28)) + ROM_LOAD16_BYTE("video-7.bin", 0x060000, 0x010000, CRC(231cf163) SHA1(02b28ef0e1661a82d0fba2ecc5474c79651fa9e7)) + ROM_LOAD16_BYTE("video-8.bin", 0x060001, 0x010000, CRC(076efdc8) SHA1(bef0a1d8f0e7486ee5dc7407ce5c96854cefa5cf)) +ROM_END + + +ROM_START( renoreel ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("rr_27s__.a60", 0x00000, 0x10000, CRC(44c9ff47) SHA1(93a3155144b233c113aa3b49bd4eb5969e400a68)) + + ROM_REGION( 0x800000, "video", 0 ) + ROM_LOAD16_BYTE( "rr______.a_1", 0x000000, 0x80000, CRC(ff27d0ba) SHA1(85cce36495f00a05c1806ecde37274212680e466) ) + ROM_LOAD16_BYTE( "rr______.a_2", 0x000001, 0x80000, CRC(519b9ae1) SHA1(8ccfe8de0f2c85923df81af8cba6f20af43d2fe2) ) + + ROM_REGION( 0x200000, "msm6376", 0 ) + ROM_LOAD( "renosnda.bin", 0x000000, 0x080000, CRC(a72a5e1b) SHA1(a0d5338a400345a55484848a7612119405f617b1) ) + ROM_LOAD( "renosndb.bin", 0x080000, 0x080000, CRC(46e9a32f) SHA1(d45835a82368992597e44b3c5b9d00d8b901e733) ) + +ROM_END + +ROM_START( redhtpkr ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("rp_20s__.3_0", 0x00000, 0x10000, CRC(b7d02d22) SHA1(f9da1c6dde064bc39d0c48a165dac7acde933397)) + + ROM_REGION( 0x800000, "video", 0 ) + ROM_LOAD16_BYTE("rp______.3_1", 0x000000, 0x010000, CRC(b987406d) SHA1(8c4d386570c0c6298b1cabf50295021b3b0cf625)) + ROM_LOAD16_BYTE("rp______.3_2", 0x000001, 0x010000, CRC(73e3c12e) SHA1(19e3ed7255fa0c3bfa14b6a4b705c0c3e1a237b6)) + ROM_LOAD16_BYTE("rp______.3_3", 0x020000, 0x010000, CRC(05a30183) SHA1(302f4926073bf7335da7f0b1e6399b64ea9bbae4)) + ROM_LOAD16_BYTE("rp______.3_4", 0x020001, 0x010000, CRC(6b122765) SHA1(72cd0fda322790bed8cdc7697306ec01efc43789)) + ROM_LOAD16_BYTE("rp______.3_5", 0x040000, 0x010000, CRC(d9fd05d0) SHA1(330ef58c012b5d5fd018bea54b3ae315b3e45cfd)) + ROM_LOAD16_BYTE("rp______.3_6", 0x040001, 0x010000, CRC(eeea91ff) SHA1(cc7870a68f62d4dd70c13713a432a61a091821ef)) + +ROM_END + ROM_START( crmaze ) ROM_REGION( 0x10000, "maincpu", 0 ) VID_BIOS @@ -3122,21 +3362,6 @@ ROM_START( quidgrid2d ) ROM_END -/* Vegas Poker Prototype dumped by HIGHWAYMAN */ -ROM_START( vgpoker ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("comms-v2.0.bin", 0x00000, 0x10000, CRC(1717581f) SHA1(40f8cae39a2ab0c89d2bbfd8a37725aaae229c96)) - - ROM_REGION( 0x800000, "video", 0 ) - ROM_LOAD16_BYTE("video-1.bin", 0x000000, 0x010000, CRC(7ba2396c) SHA1(eb24b802b984315fc2eba4f15c208e2c1925c1c8)) - ROM_LOAD16_BYTE("video-2.bin", 0x000001, 0x010000, CRC(4f9e830b) SHA1(f17bebb289c3620bf4c88b2b358a9dab87ac214f)) - ROM_LOAD16_BYTE("video-3.bin", 0x020000, 0x010000, CRC(607e0baa) SHA1(9f64a46ef3b9a854e939b5e7f0d1e6e925735922)) - ROM_LOAD16_BYTE("video-4.bin", 0x020001, 0x010000, CRC(2019f5d3) SHA1(d183b3b92d03be9f9d57b5df1a621cbfe955ed93)) - ROM_LOAD16_BYTE("video-5.bin", 0x040000, 0x010000, CRC(c029202e) SHA1(b08bb2678c2ff62a58ef67d5440c326d0fadc34e)) - ROM_LOAD16_BYTE("video-6.bin", 0x040001, 0x010000, CRC(3287ae4e) SHA1(3b05a036de3ca7ec644bfbf04934e44e631d1e28)) - ROM_LOAD16_BYTE("video-7.bin", 0x060000, 0x010000, CRC(231cf163) SHA1(02b28ef0e1661a82d0fba2ecc5474c79651fa9e7)) - ROM_LOAD16_BYTE("video-8.bin", 0x060001, 0x010000, CRC(076efdc8) SHA1(bef0a1d8f0e7486ee5dc7407ce5c96854cefa5cf)) -ROM_END /*Deal 'Em was a conversion kit designed to make early MPU4 machines into video games by replacing the top glass and reel assembly with this kit and a supplied monitor. The real Deal 'Em ran on Summit Coin hardware, and was made by someone else. @@ -3192,8 +3417,11 @@ GAME( 199?, quidgridd, quidgrid, mpu4_vid, mpu4, quidgrid, ROT0, "Barcrest" GAME( 199?, quidgrid2, quidgrid, mpu4_vid, mpu4, quidgrid, ROT0, "Barcrest", "Ten Quid Grid (v2.4)", GAME_NOT_WORKING ) GAME( 199?, quidgrid2d,quidgrid, mpu4_vid, mpu4, quidgrid, ROT0, "Barcrest", "Ten Quid Grid (v2.4, Datapak)", GAME_NOT_WORKING ) -/* Games below are newer BwB games and use their own BIOS ROMs */ +/* Games below are newer BwB games and use their own BIOS ROMs and hardware setups*/ GAME( 199?, vgpoker, 0, vgpoker, mpu4, 0, ROT0, "BwB", "Vegas Poker (prototype, release 2)", GAME_NOT_WORKING ) -GAME( 199?, prizeinv, 0, mpu4_vid, mpu4, 0, ROT0, "BwB", "Prize Space Invaders (20\" v1.1)", GAME_NOT_WORKING ) -GAME( 199?, blox, 0, mpu4_vid, mpu4, 0, ROT0, "BwB", "Blox (v2.0)", GAME_NOT_WORKING ) -GAME( 199?, bloxd, blox, mpu4_vid, mpu4, 0, ROT0, "BwB", "Blox (v2.0, Datapak)", GAME_NOT_WORKING ) +GAME( 199?, prizeinv, 0, bwbvid, mpu4, 0, ROT0, "BwB", "Prize Space Invaders (20\" v1.1)", GAME_NOT_WORKING ) +GAME( 199?, blox, 0, bwbvid, mpu4, 0, ROT0, "BwB", "Blox (v2.0)", GAME_NOT_WORKING ) +GAME( 199?, bloxd, blox, bwbvid, mpu4, 0, ROT0, "BwB", "Blox (v2.0, Datapak)", GAME_NOT_WORKING ) +GAME( 1996, renoreel, 0, bwbvid5, mpu4, 0, ROT0, "BwB", "Reno Reels (20p/10GBP Cash, release A)", GAME_NOT_WORKING ) +GAME( 199?, redhtpkr, 0, bwbvid, mpu4, 0, ROT0, "BwB", "Red Hot Poker (20p/10GBP Cash, release 3)", GAME_NOT_WORKING ) +GAME( 199?, bwbtetrs, 0, bwbvid, mpu4, 0, ROT0, "BwB", "BwB Tetris v 2.2", GAME_NOT_WORKING ) diff --git a/src/mame/layout/gamball.lay b/src/mame/layout/gamball.lay index 6c30092ecca..32f0d6a897a 100644 --- a/src/mame/layout/gamball.lay +++ b/src/mame/layout/gamball.lay @@ -2007,2083 +2007,10 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/mame/machine/meters.c b/src/mame/machine/meters.c index c86d8dc990b..5c4b368fc69 100644 --- a/src/mame/machine/meters.c +++ b/src/mame/machine/meters.c @@ -2,12 +2,6 @@ // // // Electro mechanical meters // // // -// 23-07-2004: Re-Animator // -// // -// TODO: - meter ticks if the signal changes from high to low AND the // -// signal was high for at least 'reacttime' cycles // -// It should tick if the signal goes from low to high AND stays // -// high for at least xxx milliseconds // // // /////////////////////////////////////////////////////////////////////////// @@ -18,72 +12,84 @@ static struct { - long timestamp, // time stamp in cycles after which timer will tick - reacttime, - count; // mechmeter value - int state; // state 0/1 + long on, // Activity of reel + reacttime, + count; // mechmeter value + int state; // state 0/1 + emu_timer *meter_timer; } meter_info[MAXMECHMETERS]; - static int number_mtr; /////////////////////////////////////////////////////////////////////////// - -void Mechmtr_init(int number) +static TIMER_CALLBACK( meter_callback ) { - int i; + meter_info[param].count++; +} - if ( number > MAXMECHMETERS ) number = MAXMECHMETERS; +void MechMtr_config(running_machine *machine, int number) +{ + int i; - for ( i = 0; i < number; i++ ) - { - meter_info[i].reacttime = METERREACTTIME; - meter_info[i].state = 0; - meter_info[i].count = 0; - meter_info[i].timestamp = 0; - } - number_mtr = number; + if ( number > MAXMECHMETERS ) number = MAXMECHMETERS; + + for ( i = 0; i < number; i++ ) + { + meter_info[i].reacttime = METERREACTTIME; + meter_info[i].state = 0; + meter_info[i].count = 0; + meter_info[i].on = 0; + meter_info[i].meter_timer = timer_alloc(machine, meter_callback, (void*)(FPTR)i); + timer_reset(meter_info[i].meter_timer, attotime::never); + } + number_mtr = number; } /////////////////////////////////////////////////////////////////////////// -int MechMtr_GetNumberMeters(void) +int MechMtr_GetNumberMeters(void) { - return number_mtr; + return number_mtr; } /////////////////////////////////////////////////////////////////////////// void MechMtr_Setcount(int id, long count) { - if ( id >= number_mtr ) return; + if ( id >= number_mtr ) return; - meter_info[id].count = count; + meter_info[id].count = count; } /////////////////////////////////////////////////////////////////////////// long MechMtr_Getcount(int id) { - long result = 0; + long result = 0; - if ( id < number_mtr ) result = meter_info[id].count; + if ( id < number_mtr ) result = meter_info[id].count; - return result; + return result; } /////////////////////////////////////////////////////////////////////////// void MechMtr_ReactTime(int id, long cycles) { - if ( id >= number_mtr ) return; - - meter_info[id].reacttime = cycles; + if ( id >= number_mtr ) return; + meter_info[id].reacttime = cycles; } /////////////////////////////////////////////////////////////////////////// -int Mechmtr_update(int id, long cycles, int state) +int MechMtr_GetActivity(int id) +{ + return meter_info[id].on; +} + +/////////////////////////////////////////////////////////////////////////// + +int MechMtr_update(int id, int state) { int res = 0; @@ -97,15 +103,13 @@ int Mechmtr_update(int id, long cycles, int state) if ( state ) { - meter_info[id].timestamp = cycles + meter_info[id].reacttime; + meter_info[id].on =1; + timer_adjust_oneshot(meter_info[id].meter_timer, attotime::from_seconds(meter_info[id].reacttime), id); } else { - if ( cycles > meter_info[id].timestamp ) - { // meter has been active long enough - res = 1; - meter_info[id].count++; - } + meter_info[id].on =0; + timer_adjust_oneshot(meter_info[id].meter_timer, attotime::never, id); } } diff --git a/src/mame/machine/meters.h b/src/mame/machine/meters.h index c46a6606f8e..66485d61bb8 100644 --- a/src/mame/machine/meters.h +++ b/src/mame/machine/meters.h @@ -4,21 +4,22 @@ // // // 23-07-2004: Re-Animator // // // -// TODO: - meter ticks if the signal changes from high to low AND the // -// signal was high for at least 'reacttime' cycles // -// It should tick if the signal goes from low to high AND stays // -// high for at least xxx milliseconds // // // /////////////////////////////////////////////////////////////////////////// -#ifndef INC_MMTR -#define INC_MMTR +#pragma once + +#ifndef __METERS_H__ +#define __METERS_H__ + +#include "emu.h" + #define MAXMECHMETERS 8 -#define METERREACTTIME 30000 // number of cycles meter has to be active to tick +#define METERREACTTIME 0.025 // number of seconds meter has to be active to tick -void Mechmtr_init( int number); +void MechMtr_config(running_machine *machine, int number); int MechMtr_GetNumberMeters(void); @@ -28,6 +29,7 @@ long MechMtr_Getcount( int id); void MechMtr_ReactTime(int id, long cycles); -int Mechmtr_update( int id, long cycles, int state); // returns 1 if meter ticked +int MechMtr_update( int id, int state); +int MechMtr_GetActivity(int id); #endif diff --git a/src/mame/machine/steppers.c b/src/mame/machine/steppers.c index d1c814ba535..392013f9958 100644 --- a/src/mame/machine/steppers.c +++ b/src/mame/machine/steppers.c @@ -11,7 +11,8 @@ // 05-03-2004: Re-Animator // // // // TODO: add different types of stepper motors if needed // -// // +// someone who understands the device system may want to convert // +// this // /////////////////////////////////////////////////////////////////////////// #include "emu.h" @@ -344,7 +345,7 @@ static const int BarcrestStepTab[] = 0, //0001->0110 1->6 0, //0001->0111 1->7 0, //0001->1000 1->8 - -1,//0001->1001 1->9 + -1,//0001->1001 1->9 -1,//1001->1000 9->8 0, //0001->1010 1->A 0, //0001->1011 1->B 0, //0001->1100 1->C @@ -660,17 +661,31 @@ static void update_optic(int which) start = step[which].index_start, end = step[which].index_end; - if ( (( pos >= start ) && ( pos <= end )) && + if (start > end) // cope with index patterns that wrap around + { + if ( (( pos > start ) || ( pos < end )) && ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) || ( step[which].pattern == 0 && (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0) ) ) ) + { + step[which].optic = 1; + } + else step[which].optic = 0; + } + else { + if ( (( pos > start ) && ( pos < end )) && + ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) || + ( step[which].pattern == 0 && + (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0) + ) ) ) + { step[which].optic = 1; + } + else step[which].optic = 0; } - else step[which].optic = 0; } - /////////////////////////////////////////////////////////////////////////// void stepper_reset_position(int which) @@ -729,7 +744,7 @@ int stepper_update(int which, UINT8 pattern) break; } #if 0 /* Assists with new index generation */ - if ( which ==0 )logerror("which %d Index %d Steps %d Pattern Old %02X New %02X\n",which,index,steps,step[which].old_pattern,step[which].pattern); + if ( which ==0 )popmessage("which %d Index %d Steps %d Pattern Old %02X New %02X\n",which,index,steps,step[which].old_pattern,step[which].pattern); #endif if ( steps ) diff --git a/src/mame/machine/steppers.h b/src/mame/machine/steppers.h index 4bea5a26579..c8f9edd5be7 100644 --- a/src/mame/machine/steppers.h +++ b/src/mame/machine/steppers.h @@ -1,22 +1,18 @@ /////////////////////////////////////////////////////////////////////////// // // -// Steppermotor emulation // +// steppers.c steppermotor emulation // // // // Emulates : 48 step motors driven with full step or half step // // also emulates the index optic // // // -// 13-08-2008: J. Wallace - Added a rigid interface structure, // -// and removed unnecessary inline functions // -// Rewritten to make it more flexible // -// 26-01-2007: J. Wallace - Rewritten to make it more flexible // -// 26-01-2007: J. Wallace - Rewritten to make it more flexible // // 26-01-2007: J. Wallace - Rewritten to make it more flexible // // and to allow indices to be set in drivers // // 29-12-2006: J. Wallace - Added state save support // // 05-03-2004: Re-Animator // // // // TODO: add different types of stepper motors if needed // -// // +// someone who understands the device system may want to convert // +// this // /////////////////////////////////////////////////////////////////////////// diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 164c67a6b32..70f395b7581 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1876,6 +1876,7 @@ $(DRIVERS)/mpoker.o: $(LAYOUT)/mpoker.lh $(DRIVERS)/mpu4.o: $(LAYOUT)/mpu4.lh \ $(LAYOUT)/connect4.lh \ + $(LAYOUT)/mpu4ext.lh \ $(LAYOUT)/gamball.lh $(DRIVERS)/mw18w.o: $(LAYOUT)/18w.lh diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index 4a8c55203c8..85beb142f84 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -8963,10 +8963,14 @@ Other Sun games DRIVER( eyesdown ) /* 199? */ DRIVER( eyesdownd ) /* 199? */ + /* BwB games */ DRIVER( blox ) /* 199? */ DRIVER( bloxd ) /* 199? */ + DRIVER( bwbtetrs ) /* 199? */ DRIVER( prizeinv ) /* 199? */ DRIVER( vgpoker ) /* 199? */ + DRIVER( renoreel ) /* 199? */ + DRIVER( redhtpkr ) /* 199? */ /* ADP games */ DRIVER( backgamn ) /* (c) 1990 */ @@ -10564,6 +10568,7 @@ Other Sun games DRIVER( m_oldtmr ) /* Barcrest - highly prelim*/ DRIVER( m_ccelbr ) DRIVER( m_gmball ) + DRIVER( m_grtecp ) /* 199? */ /* MPU5 */ DRIVER( m_honmon )